aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/processor_perflib.c46
-rw-r--r--drivers/acpi/sleep/proc.c2
-rw-r--r--drivers/ata/Kconfig10
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/pata_icside.c686
-rw-r--r--drivers/atm/adummy.c1
-rw-r--r--drivers/base/Makefile4
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/bus.c16
-rw-r--r--drivers/base/class.c18
-rw-r--r--drivers/base/core.c29
-rw-r--r--drivers/base/dd.c41
-rw-r--r--drivers/base/firmware.c6
-rw-r--r--drivers/base/platform.c8
-rw-r--r--drivers/base/power/shutdown.c4
-rw-r--r--drivers/base/sys.c14
-rw-r--r--drivers/block/amiflop.c2
-rw-r--r--drivers/block/aoe/aoecmd.c8
-rw-r--r--drivers/block/loop.c4
-rw-r--r--drivers/block/rd.c2
-rw-r--r--drivers/bluetooth/hci_usb.c6
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--drivers/char/Kconfig4
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/agp/ali-agp.c2
-rw-r--r--drivers/char/agp/alpha-agp.c2
-rw-r--r--drivers/char/agp/amd64-agp.c13
-rw-r--r--drivers/char/agp/generic.c22
-rw-r--r--drivers/char/agp/intel-agp.c8
-rw-r--r--drivers/char/agp/nvidia-agp.c9
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/char/agp/sgi-agp.c5
-rw-r--r--drivers/char/agp/sis-agp.c278
-rw-r--r--drivers/char/agp/sworks-agp.c23
-rw-r--r--drivers/char/drm/README.drm16
-rw-r--r--drivers/char/drm/drm.h4
-rw-r--r--drivers/char/drm/drmP.h23
-rw-r--r--drivers/char/drm/drm_bufs.c75
-rw-r--r--drivers/char/drm/drm_drv.c9
-rw-r--r--drivers/char/drm/drm_fops.c96
-rw-r--r--drivers/char/drm/drm_hashtab.c17
-rw-r--r--drivers/char/drm/drm_hashtab.h1
-rw-r--r--drivers/char/drm/drm_irq.c4
-rw-r--r--drivers/char/drm/drm_lock.c134
-rw-r--r--drivers/char/drm/drm_mm.c2
-rw-r--r--drivers/char/drm/drm_pciids.h3
-rw-r--r--drivers/char/drm/drm_proc.c2
-rw-r--r--drivers/char/drm/drm_stub.c1
-rw-r--r--drivers/char/drm/drm_vm.c102
-rw-r--r--drivers/char/drm/i915_dma.c3
-rw-r--r--drivers/char/drm/radeon_cp.c8
-rw-r--r--drivers/char/drm/sis_drv.c2
-rw-r--r--drivers/char/drm/via_drv.c3
-rw-r--r--drivers/char/drm/via_mm.h40
-rw-r--r--drivers/char/hw_random/via-rng.c1
-rw-r--r--drivers/char/keyboard.c101
-rw-r--r--drivers/char/pcmcia/synclink_cs.c1
-rw-r--r--drivers/char/tpm/tpm.h1
-rw-r--r--drivers/char/tty_io.c5
-rw-r--r--drivers/char/watchdog/sc1200wdt.c1
-rw-r--r--drivers/char/watchdog/scx200_wdt.c2
-rw-r--r--drivers/cpufreq/Kconfig61
-rw-r--r--drivers/cpufreq/cpufreq.c47
-rw-r--r--drivers/crypto/Kconfig16
-rw-r--r--drivers/crypto/Makefile1
-rw-r--r--drivers/crypto/padlock.c58
-rw-r--r--drivers/firmware/efivars.c12
-rw-r--r--drivers/i2c/Kconfig18
-rw-r--r--drivers/i2c/Makefile1
-rw-r--r--drivers/i2c/algos/Kconfig8
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c286
-rw-r--r--drivers/i2c/algos/i2c-algo-sgi.c9
-rw-r--r--drivers/i2c/busses/Kconfig151
-rw-r--r--drivers/i2c/busses/Makefile4
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c2
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c2
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c2
-rw-r--r--drivers/i2c/busses/i2c-at91.c1
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c644
-rw-r--r--drivers/i2c/busses/i2c-elektor.c51
-rw-r--r--drivers/i2c/busses/i2c-gpio.c215
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
-rw-r--r--drivers/i2c/busses/i2c-isa.c43
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c2
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c2
-rw-r--r--drivers/i2c/busses/i2c-mpc.c1
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c2
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c6
-rw-r--r--drivers/i2c/busses/i2c-omap.c3
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c144
-rw-r--r--drivers/i2c/busses/i2c-parport.c25
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c2
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c36
-rw-r--r--drivers/i2c/busses/i2c-piix4.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa.c33
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c96
-rw-r--r--drivers/i2c/busses/i2c-simtec.c186
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c2
-rw-r--r--drivers/i2c/busses/i2c-tiny-usb.c277
-rw-r--r--drivers/i2c/busses/i2c-viapro.c2
-rw-r--r--drivers/i2c/busses/scx200_acb.c3
-rw-r--r--drivers/i2c/chips/Kconfig21
-rw-r--r--drivers/i2c/chips/tps65010.c4
-rw-r--r--drivers/i2c/i2c-boardinfo.c90
-rw-r--r--drivers/i2c/i2c-core.c662
-rw-r--r--drivers/i2c/i2c-core.h31
-rw-r--r--drivers/ide/cris/ide-cris.c9
-rw-r--r--drivers/ide/legacy/ide-cs.c1
-rw-r--r--drivers/ide/pci/aec62xx.c22
-rw-r--r--drivers/ide/pci/alim15x3.c7
-rw-r--r--drivers/ide/pci/cmd64x.c537
-rw-r--r--drivers/ide/pci/hpt366.c7
-rw-r--r--drivers/ide/pci/it821x.c126
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ide/pci/siimage.c12
-rw-r--r--drivers/ide/pci/sl82c105.c247
-rw-r--r--drivers/ieee1394/hosts.c1
-rw-r--r--drivers/infiniband/core/cm.c1
-rw-r--r--drivers/infiniband/core/fmr_pool.c32
-rw-r--r--drivers/infiniband/core/iwcm.c1
-rw-r--r--drivers/infiniband/core/mad.c2
-rw-r--r--drivers/infiniband/core/mad_priv.h1
-rw-r--r--drivers/infiniband/core/multicast.c1
-rw-r--r--drivers/infiniband/core/sa_query.c1
-rw-r--r--drivers/infiniband/core/user_mad.c1
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c1
-rw-r--r--drivers/infiniband/core/uverbs_main.c2
-rw-r--r--drivers/infiniband/core/verbs.c4
-rw-r--r--drivers/infiniband/hw/amso1100/c2.h2
-rw-r--r--drivers/infiniband/hw/amso1100/c2_cq.c16
-rw-r--r--drivers/infiniband/hw/amso1100/c2_provider.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_wr.h1
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c19
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.h6
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c14
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_qp.c69
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_iverbs.h4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_reqs.c14
-rw-r--r--drivers/infiniband/hw/ehca/ipz_pt_fn.h8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_cq.c68
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mmap.c64
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c52
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c55
-rw-r--r--drivers/infiniband/hw/ipath/ipath_srq.c55
-rw-r--r--drivers/infiniband/hw/ipath/ipath_stats.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h24
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c12
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.h1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c13
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c14
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c89
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c2
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c2
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c2
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c27
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h1
-rw-r--r--drivers/input/Makefile1
-rw-r--r--drivers/input/evbug.c32
-rw-r--r--drivers/input/evdev.c235
-rw-r--r--drivers/input/input.c266
-rw-r--r--drivers/input/joydev.c187
-rw-r--r--drivers/input/joystick/a3d.c9
-rw-r--r--drivers/input/joystick/adi.c9
-rw-r--r--drivers/input/joystick/analog.c9
-rw-r--r--drivers/input/joystick/cobra.c9
-rw-r--r--drivers/input/joystick/db9.c7
-rw-r--r--drivers/input/joystick/gamecon.c7
-rw-r--r--drivers/input/joystick/gf2k.c10
-rw-r--r--drivers/input/joystick/grip.c9
-rw-r--r--drivers/input/joystick/grip_mp.c11
-rw-r--r--drivers/input/joystick/guillemot.c9
-rw-r--r--drivers/input/joystick/iforce/iforce-ff.c10
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c26
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c22
-rw-r--r--drivers/input/joystick/iforce/iforce-serio.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c13
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/joystick/interact.c8
-rw-r--r--drivers/input/joystick/magellan.c3
-rw-r--r--drivers/input/joystick/sidewinder.c9
-rw-r--r--drivers/input/joystick/spaceball.c3
-rw-r--r--drivers/input/joystick/spaceorb.c3
-rw-r--r--drivers/input/joystick/stinger.c3
-rw-r--r--drivers/input/joystick/tmdc.c9
-rw-r--r--drivers/input/joystick/turbografx.c7
-rw-r--r--drivers/input/joystick/twidjoy.c4
-rw-r--r--drivers/input/joystick/warrior.c3
-rw-r--r--drivers/input/keyboard/Kconfig20
-rw-r--r--drivers/input/keyboard/Makefile2
-rw-r--r--drivers/input/keyboard/aaed2000_kbd.c9
-rw-r--r--drivers/input/keyboard/atakbd.c134
-rw-r--r--drivers/input/keyboard/atkbd.c7
-rw-r--r--drivers/input/keyboard/corgikbd.c3
-rw-r--r--drivers/input/keyboard/gpio_keys.c22
-rw-r--r--drivers/input/keyboard/hil_kbd.c89
-rw-r--r--drivers/input/keyboard/hilkbd.c8
-rw-r--r--drivers/input/keyboard/lkkbd.c7
-rw-r--r--drivers/input/keyboard/locomokbd.c2
-rw-r--r--drivers/input/keyboard/newtonkbd.c3
-rw-r--r--drivers/input/keyboard/omap-keypad.c3
-rw-r--r--drivers/input/keyboard/pxa27x_keyboard.c258
-rw-r--r--drivers/input/keyboard/spitzkbd.c3
-rw-r--r--drivers/input/keyboard/stowaway.c3
-rw-r--r--drivers/input/keyboard/sunkbd.c8
-rw-r--r--drivers/input/keyboard/xtkbd.c3
-rw-r--r--drivers/input/misc/Kconfig23
-rw-r--r--drivers/input/misc/Makefile2
-rw-r--r--drivers/input/misc/cobalt_btns.c172
-rw-r--r--drivers/input/misc/input-polldev.c171
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c11
-rw-r--r--drivers/input/misc/m68kspkr.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/misc/sparcspkr.c6
-rw-r--r--drivers/input/misc/uinput.c10
-rw-r--r--drivers/input/misc/wistron_btns.c685
-rw-r--r--drivers/input/mouse/Kconfig72
-rw-r--r--drivers/input/mouse/Makefile9
-rw-r--r--drivers/input/mouse/alps.c13
-rw-r--r--drivers/input/mouse/alps.h18
-rw-r--r--drivers/input/mouse/atarimouse.c160
-rw-r--r--drivers/input/mouse/hil_ptr.c97
-rw-r--r--drivers/input/mouse/lifebook.c195
-rw-r--r--drivers/input/mouse/lifebook.h11
-rw-r--r--drivers/input/mouse/logips2pp.c7
-rw-r--r--drivers/input/mouse/logips2pp.h7
-rw-r--r--drivers/input/mouse/psmouse-base.c50
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/input/mouse/sermouse.c19
-rw-r--r--drivers/input/mouse/synaptics.c109
-rw-r--r--drivers/input/mouse/synaptics.h18
-rw-r--r--drivers/input/mouse/touchkit_ps2.c100
-rw-r--r--drivers/input/mouse/touchkit_ps2.h24
-rw-r--r--drivers/input/mouse/trackpoint.h9
-rw-r--r--drivers/input/mouse/vsxxxaa.c3
-rw-r--r--drivers/input/mousedev.c441
-rw-r--r--drivers/input/power.c166
-rw-r--r--drivers/input/serio/hil_mlc.c505
-rw-r--r--drivers/input/serio/hp_sdc.c427
-rw-r--r--drivers/input/serio/hp_sdc_mlc.c227
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h24
-rw-r--r--drivers/input/serio/i8042.c7
-rw-r--r--drivers/input/touchscreen/ads7846.c30
-rw-r--r--drivers/input/touchscreen/corgi_ts.c3
-rw-r--r--drivers/input/touchscreen/elo.c3
-rw-r--r--drivers/input/touchscreen/gunze.c2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c9
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c2
-rw-r--r--drivers/input/touchscreen/mtouch.c2
-rw-r--r--drivers/input/touchscreen/penmount.c3
-rw-r--r--drivers/input/touchscreen/touchright.c2
-rw-r--r--drivers/input/touchscreen/touchwin.c2
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c26
-rw-r--r--drivers/input/tsdev.c177
-rw-r--r--drivers/isdn/hisax/netjet.c1
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c1
-rw-r--r--drivers/kvm/kvm.h100
-rw-r--r--drivers/kvm/kvm_main.c792
-rw-r--r--drivers/kvm/kvm_svm.h13
-rw-r--r--drivers/kvm/kvm_vmx.h14
-rw-r--r--drivers/kvm/mmu.c154
-rw-r--r--drivers/kvm/paging_tmpl.h12
-rw-r--r--drivers/kvm/svm.c197
-rw-r--r--drivers/kvm/svm.h6
-rw-r--r--drivers/kvm/vmx.c273
-rw-r--r--drivers/kvm/x86_emulate.c51
-rw-r--r--drivers/kvm/x86_emulate.h32
-rw-r--r--drivers/macintosh/therm_windtunnel.c3
-rw-r--r--drivers/macintosh/via-cuda.c58
-rw-r--r--drivers/macintosh/via-macii.c582
-rw-r--r--drivers/macintosh/via-pmu68k.c3
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-i2c.c3
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c2
-rw-r--r--drivers/media/dvb/frontends/dibx000_common.c4
-rw-r--r--drivers/media/video/adv7170.c1
-rw-r--r--drivers/media/video/adv7175.c1
-rw-r--r--drivers/media/video/bt819.c1
-rw-r--r--drivers/media/video/bt856.c1
-rw-r--r--drivers/media/video/bt866.c1
-rw-r--r--drivers/media/video/cx2341x.c1
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c2
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c1
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c1
-rw-r--r--drivers/media/video/cx88/cx88-video.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c1
-rw-r--r--drivers/media/video/ovcamchip/ovcamchip_priv.h1
-rw-r--r--drivers/media/video/saa7111.c1
-rw-r--r--drivers/media/video/saa7114.c1
-rw-r--r--drivers/media/video/saa711x.c1
-rw-r--r--drivers/media/video/saa7185.c1
-rw-r--r--drivers/media/video/usbvision/usbvision-cards.c1
-rw-r--r--drivers/message/fusion/mptbase.c27
-rw-r--r--drivers/message/fusion/mptbase.h1
-rw-r--r--drivers/message/fusion/mptscsih.c35
-rw-r--r--drivers/message/fusion/mptspi.c36
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c1
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c1
-rw-r--r--drivers/misc/tifm_7xx1.c332
-rw-r--r--drivers/misc/tifm_core.c305
-rw-r--r--drivers/mmc/Kconfig106
-rw-r--r--drivers/mmc/Makefile33
-rw-r--r--drivers/mmc/card/Kconfig17
-rw-r--r--drivers/mmc/card/Makefile11
-rw-r--r--drivers/mmc/card/block.c (renamed from drivers/mmc/mmc_block.c)55
-rw-r--r--drivers/mmc/card/queue.c (renamed from drivers/mmc/mmc_queue.c)12
-rw-r--r--drivers/mmc/card/queue.h (renamed from drivers/mmc/mmc_queue.h)0
-rw-r--r--drivers/mmc/core/Kconfig17
-rw-r--r--drivers/mmc/core/Makefile11
-rw-r--r--drivers/mmc/core/core.c727
-rw-r--r--drivers/mmc/core/core.h70
-rw-r--r--drivers/mmc/core/mmc.c537
-rw-r--r--drivers/mmc/core/mmc_ops.c276
-rw-r--r--drivers/mmc/core/mmc_ops.h27
-rw-r--r--drivers/mmc/core/sd.c587
-rw-r--r--drivers/mmc/core/sd_ops.c316
-rw-r--r--drivers/mmc/core/sd_ops.h25
-rw-r--r--drivers/mmc/core/sysfs.c (renamed from drivers/mmc/mmc_sysfs.c)11
-rw-r--r--drivers/mmc/core/sysfs.h (renamed from drivers/mmc/mmc.h)10
-rw-r--r--drivers/mmc/host/Kconfig103
-rw-r--r--drivers/mmc/host/Makefile18
-rw-r--r--drivers/mmc/host/at91_mci.c (renamed from drivers/mmc/at91_mci.c)1
-rw-r--r--drivers/mmc/host/au1xmmc.c (renamed from drivers/mmc/au1xmmc.c)1
-rw-r--r--drivers/mmc/host/au1xmmc.h (renamed from drivers/mmc/au1xmmc.h)0
-rw-r--r--drivers/mmc/host/imxmmc.c (renamed from drivers/mmc/imxmmc.c)1
-rw-r--r--drivers/mmc/host/imxmmc.h (renamed from drivers/mmc/imxmmc.h)0
-rw-r--r--drivers/mmc/host/mmci.c (renamed from drivers/mmc/mmci.c)1
-rw-r--r--drivers/mmc/host/mmci.h (renamed from drivers/mmc/mmci.h)0
-rw-r--r--drivers/mmc/host/omap.c (renamed from drivers/mmc/omap.c)56
-rw-r--r--drivers/mmc/host/pxamci.c (renamed from drivers/mmc/pxamci.c)5
-rw-r--r--drivers/mmc/host/pxamci.h (renamed from drivers/mmc/pxamci.h)0
-rw-r--r--drivers/mmc/host/sdhci.c (renamed from drivers/mmc/sdhci.c)43
-rw-r--r--drivers/mmc/host/sdhci.h (renamed from drivers/mmc/sdhci.h)4
-rw-r--r--drivers/mmc/host/tifm_sd.c1102
-rw-r--r--drivers/mmc/host/wbsd.c (renamed from drivers/mmc/wbsd.c)205
-rw-r--r--drivers/mmc/host/wbsd.h (renamed from drivers/mmc/wbsd.h)9
-rw-r--r--drivers/mmc/mmc.c1724
-rw-r--r--drivers/mmc/tifm_sd.c987
-rw-r--r--drivers/mtd/devices/Kconfig4
-rw-r--r--drivers/mtd/devices/block2mtd.c6
-rw-r--r--drivers/mtd/devices/doc2000.c1
-rw-r--r--drivers/mtd/devices/doc2001.c1
-rw-r--r--drivers/mtd/devices/doc2001plus.c1
-rw-r--r--drivers/mtd/devices/docecc.c1
-rw-r--r--drivers/mtd/inftlmount.c1
-rw-r--r--drivers/mtd/nand/cs553x_nand.c1
-rw-r--r--drivers/mtd/nftlcore.c1
-rw-r--r--drivers/mtd/ubi/eba.c3
-rw-r--r--drivers/net/7990.c6
-rw-r--r--drivers/net/Kconfig14
-rw-r--r--drivers/net/Space.c4
-rw-r--r--drivers/net/a2065.c8
-rw-r--r--drivers/net/ariadne.c1
-rw-r--r--drivers/net/atl1/atl1_param.c1
-rw-r--r--drivers/net/au1000_eth.c1
-rw-r--r--drivers/net/bnx2.c974
-rw-r--r--drivers/net/bnx2.h65
-rw-r--r--drivers/net/bnx2_fw.h1697
-rw-r--r--drivers/net/bnx2_fw2.h7868
-rw-r--r--drivers/net/cxgb3/version.h4
-rw-r--r--drivers/net/fec_8xx/fec_main.c1
-rw-r--r--drivers/net/fec_8xx/fec_mii.c1
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c1
-rw-r--r--drivers/net/fs_enet/mac-fcc.c1
-rw-r--r--drivers/net/fs_enet/mac-fec.c1
-rw-r--r--drivers/net/fs_enet/mac-scc.c1
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c1
-rw-r--r--drivers/net/fs_enet/mii-fec.c1
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c1
-rw-r--r--drivers/net/irda/pxaficp_ir.c12
-rw-r--r--drivers/net/ixgb/ixgb_osdep.h1
-rw-r--r--drivers/net/jazzsonic.c27
-rw-r--r--drivers/net/lasi_82596.c1
-rw-r--r--drivers/net/mac8390.c245
-rw-r--r--drivers/net/mac89x0.c88
-rw-r--r--drivers/net/macmace.c591
-rw-r--r--drivers/net/macsonic.c65
-rw-r--r--drivers/net/smc91x.h47
-rw-r--r--drivers/net/sonic.c32
-rw-r--r--drivers/net/sun3_82586.c5
-rw-r--r--drivers/net/tg3.c207
-rw-r--r--drivers/net/tg3.h16
-rw-r--r--drivers/net/tokenring/madgemc.c1
-rw-r--r--drivers/net/tokenring/smctr.c1
-rw-r--r--drivers/net/tulip/21142.c1
-rw-r--r--drivers/net/tulip/pnic.c1
-rw-r--r--drivers/net/tulip/pnic2.c1
-rw-r--r--drivers/net/tulip/timer.c1
-rw-r--r--drivers/net/tulip/tulip.h1
-rw-r--r--drivers/net/wan/lmc/lmc_media.c1
-rw-r--r--drivers/net/wan/lmc/lmc_proto.c1
-rw-r--r--drivers/net/wan/pc300_tty.c1
-rw-r--r--drivers/net/wireless/Kconfig12
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--drivers/parisc/hppb.c2
-rw-r--r--drivers/parisc/led.c2
-rw-r--r--drivers/parisc/pdc_stable.c94
-rw-r--r--drivers/pci/Kconfig31
-rw-r--r--drivers/pci/bus.c4
-rw-r--r--drivers/pci/hotplug/Kconfig25
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c4
-rw-r--r--drivers/pci/hotplug/cpcihp_zt5550.c6
-rw-r--r--drivers/pci/hotplug/fakephp.c2
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c4
-rw-r--r--drivers/pci/hotplug/pciehp.h19
-rw-r--r--drivers/pci/hotplug/pciehp_core.c82
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c616
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c34
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c27
-rw-r--r--drivers/pci/hotplug/rpaphp.h8
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c200
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c167
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c49
-rw-r--r--drivers/pci/hotplug/shpchp.h2
-rw-r--r--drivers/pci/hotplug/shpchp_core.c2
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c2
-rw-r--r--drivers/pci/msi.c398
-rw-r--r--drivers/pci/pci-driver.c19
-rw-r--r--drivers/pci/pci-sysfs.c9
-rw-r--r--drivers/pci/pci.c34
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/probe.c42
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/search.c3
-rw-r--r--drivers/pci/setup-bus.c21
-rw-r--r--drivers/pci/setup-res.c6
-rw-r--r--drivers/pcmcia/at91_cf.c3
-rw-r--r--drivers/pcmcia/cs.c1
-rw-r--r--drivers/pcmcia/ds.c113
-rw-r--r--drivers/pcmcia/socket_sysfs.c1
-rw-r--r--drivers/ps3/ps3av.c108
-rw-r--r--drivers/ps3/ps3av_cmd.c20
-rw-r--r--drivers/rtc/Kconfig10
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-bfin.c445
-rw-r--r--drivers/s390/block/dasd.c45
-rw-r--r--drivers/s390/block/dasd_eckd.c81
-rw-r--r--drivers/s390/block/dasd_fba.c2
-rw-r--r--drivers/s390/block/dasd_int.h2
-rw-r--r--drivers/s390/char/tape.h1
-rw-r--r--drivers/s390/char/tape_3590.c29
-rw-r--r--drivers/s390/char/tape_3590.h4
-rw-r--r--drivers/s390/char/tape_core.c3
-rw-r--r--drivers/s390/cio/qdio.c240
-rw-r--r--drivers/s390/cio/qdio.h52
-rw-r--r--drivers/s390/net/qeth.h3
-rw-r--r--drivers/s390/net/qeth_main.c77
-rw-r--r--drivers/s390/net/qeth_mpc.h1
-rw-r--r--drivers/s390/scsi/zfcp_erp.c2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c10
-rw-r--r--drivers/sbus/sbus.c1
-rw-r--r--drivers/scsi/BusLogic.c73
-rw-r--r--drivers/scsi/Kconfig28
-rw-r--r--drivers/scsi/Makefile2
-rw-r--r--drivers/scsi/aacraid/aachba.c402
-rw-r--r--drivers/scsi/aacraid/aacraid.h76
-rw-r--r--drivers/scsi/aacraid/commctrl.c286
-rw-r--r--drivers/scsi/aacraid/comminit.c4
-rw-r--r--drivers/scsi/aacraid/commsup.c112
-rw-r--r--drivers/scsi/aacraid/dpcsup.c36
-rw-r--r--drivers/scsi/aacraid/linit.c65
-rw-r--r--drivers/scsi/aacraid/nark.c3
-rw-r--r--drivers/scsi/aacraid/rkt.c3
-rw-r--r--drivers/scsi/aacraid/rx.c115
-rw-r--r--drivers/scsi/aacraid/sa.c1
-rw-r--r--drivers/scsi/aha1542.c1
-rw-r--r--drivers/scsi/aic7xxx/Kconfig.aic79xx12
-rw-r--r--drivers/scsi/aic7xxx/Kconfig.aic7xxx10
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c6
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h5
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_scb.c1
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c1
-rw-r--r--drivers/scsi/atari_NCR5380.c4398
-rw-r--r--drivers/scsi/atari_scsi.c377
-rw-r--r--drivers/scsi/atari_scsi.h174
-rw-r--r--drivers/scsi/constants.c274
-rw-r--r--drivers/scsi/dpt/dpti_i2o.h48
-rw-r--r--drivers/scsi/dpt/dpti_ioctl.h2
-rw-r--r--drivers/scsi/dpt/dptsig.h4
-rw-r--r--drivers/scsi/dpt_i2o.c2
-rw-r--r--drivers/scsi/eata_generic.h7
-rw-r--r--drivers/scsi/esp_scsi.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c80
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c37
-rw-r--r--drivers/scsi/ipr.c290
-rw-r--r--drivers/scsi/ipr.h45
-rw-r--r--drivers/scsi/iscsi_tcp.c21
-rw-r--r--drivers/scsi/libiscsi.c29
-rw-r--r--drivers/scsi/libsas/sas_expander.c1
-rw-r--r--drivers/scsi/libsrp.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/osst.c1
-rw-r--r--drivers/scsi/pci2000.h197
-rw-r--r--drivers/scsi/pcmcia/Kconfig9
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h13
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c177
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c16
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c11
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/scsi.c47
-rw-r--r--drivers/scsi/scsi_error.c19
-rw-r--r--drivers/scsi/scsi_lib.c8
-rw-r--r--drivers/scsi/scsi_scan.c2
-rw-r--r--drivers/scsi/scsi_sysfs.c54
-rw-r--r--drivers/scsi/scsi_tgt_if.c6
-rw-r--r--drivers/scsi/scsi_tgt_lib.c261
-rw-r--r--drivers/scsi/scsi_tgt_priv.h5
-rw-r--r--drivers/scsi/scsi_transport_fc.c2
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c6
-rw-r--r--drivers/scsi/sd.c405
-rw-r--r--drivers/scsi/sg.c13
-rw-r--r--drivers/scsi/sr.c2
-rw-r--r--drivers/scsi/st.c1
-rw-r--r--drivers/scsi/sun_esp.c1
-rw-r--r--drivers/scsi/tmscsim.c2
-rw-r--r--drivers/serial/8250.c123
-rw-r--r--drivers/serial/Kconfig103
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/amba-pl010.c295
-rw-r--r--drivers/serial/atmel_serial.c9
-rw-r--r--drivers/serial/atmel_serial.h3
-rw-r--r--drivers/serial/bfin_5xx.c1012
-rw-r--r--drivers/serial/crisv10.h136
-rw-r--r--drivers/serial/imx.c268
-rw-r--r--drivers/serial/mpsc.c25
-rw-r--r--drivers/serial/of_serial.c3
-rw-r--r--drivers/serial/pxa.c8
-rw-r--r--drivers/serial/serial_core.c41
-rw-r--r--drivers/serial/sh-sci.c113
-rw-r--r--drivers/serial/sh-sci.h83
-rw-r--r--drivers/serial/sunsu.c8
-rw-r--r--drivers/spi/Kconfig7
-rw-r--r--drivers/spi/Makefile3
-rw-r--r--drivers/spi/spi_bfin5xx.c1313
-rw-r--r--drivers/spi/spi_s3c24xx.c2
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c4
-rw-r--r--drivers/usb/host/ehci-ps3.c7
-rw-r--r--drivers/usb/host/ohci-ps3.c8
-rw-r--r--drivers/usb/host/ohci-pxa27x.c4
-rw-r--r--drivers/usb/input/Makefile5
-rw-r--r--drivers/usb/input/acecad.c28
-rw-r--r--drivers/usb/input/aiptek.c38
-rw-r--r--drivers/usb/input/appletouch.c29
-rw-r--r--drivers/usb/input/ati_remote.c42
-rw-r--r--drivers/usb/input/ati_remote2.c16
-rw-r--r--drivers/usb/input/gtco.c634
-rw-r--r--drivers/usb/input/itmtouch.c271
-rw-r--r--drivers/usb/input/kbtab.c22
-rw-r--r--drivers/usb/input/keyspan_remote.c29
-rw-r--r--drivers/usb/input/mtouchusb.c332
-rw-r--r--drivers/usb/input/powermate.c27
-rw-r--r--drivers/usb/input/touchkitusb.c392
-rw-r--r--drivers/usb/input/usbtouchscreen.c10
-rw-r--r--drivers/usb/input/wacom_sys.c22
-rw-r--r--drivers/usb/input/xpad.c22
-rw-r--r--drivers/usb/input/yealink.c13
-rw-r--r--drivers/usb/net/kaweth.c1
-rw-r--r--drivers/video/Kconfig39
-rw-r--r--drivers/video/Makefile5
-rw-r--r--drivers/video/atafb.c2801
-rw-r--r--drivers/video/atafb.h36
-rw-r--r--drivers/video/atafb_iplan2p2.c293
-rw-r--r--drivers/video/atafb_iplan2p4.c308
-rw-r--r--drivers/video/atafb_iplan2p8.c345
-rw-r--r--drivers/video/atafb_mfb.c112
-rw-r--r--drivers/video/atafb_utils.h400
-rw-r--r--drivers/video/aty/radeon_i2c.c1
-rw-r--r--drivers/video/console/vgacon.c3
-rw-r--r--drivers/video/g364fb.c1
-rw-r--r--drivers/video/intelfb/intelfb_i2c.c3
-rw-r--r--drivers/video/matrox/i2c-matroxfb.c2
-rw-r--r--drivers/video/platinumfb.c1
-rw-r--r--drivers/video/ps3fb.c116
-rw-r--r--drivers/video/pxafb.c4
-rw-r--r--drivers/video/stifb.c1
-rw-r--r--drivers/video/sunxvr2500.c277
-rw-r--r--drivers/video/sunxvr500.c443
-rw-r--r--drivers/video/valkyriefb.c1
-rw-r--r--drivers/zorro/proc.c5
-rw-r--r--drivers/zorro/zorro-sysfs.c3
-rw-r--r--drivers/zorro/zorro.c3
599 files changed, 34884 insertions, 22011 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index 920c975bb6d4..26ca9031ea49 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -58,7 +58,7 @@ obj-$(CONFIG_GAMEPORT) += input/gameport/
58obj-$(CONFIG_INPUT) += input/ 58obj-$(CONFIG_INPUT) += input/
59obj-$(CONFIG_I2O) += message/ 59obj-$(CONFIG_I2O) += message/
60obj-$(CONFIG_RTC_LIB) += rtc/ 60obj-$(CONFIG_RTC_LIB) += rtc/
61obj-$(CONFIG_I2C) += i2c/ 61obj-y += i2c/
62obj-$(CONFIG_W1) += w1/ 62obj-$(CONFIG_W1) += w1/
63obj-$(CONFIG_HWMON) += hwmon/ 63obj-$(CONFIG_HWMON) += hwmon/
64obj-$(CONFIG_PHONE) += telephony/ 64obj-$(CONFIG_PHONE) += telephony/
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ae0654cd11ea..ee5759bef945 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -475,7 +475,7 @@ static void acpi_processor_idle(void)
475 475
476#ifdef CONFIG_GENERIC_TIME 476#ifdef CONFIG_GENERIC_TIME
477 /* TSC halts in C2, so notify users */ 477 /* TSC halts in C2, so notify users */
478 mark_tsc_unstable(); 478 mark_tsc_unstable("possible TSC halt in C2");
479#endif 479#endif
480 /* Re-enable interrupts */ 480 /* Re-enable interrupts */
481 local_irq_enable(); 481 local_irq_enable();
@@ -517,7 +517,7 @@ static void acpi_processor_idle(void)
517 517
518#ifdef CONFIG_GENERIC_TIME 518#ifdef CONFIG_GENERIC_TIME
519 /* TSC halts in C3, so notify users */ 519 /* TSC halts in C3, so notify users */
520 mark_tsc_unstable(); 520 mark_tsc_unstable("TSC halts in C3");
521#endif 521#endif
522 /* Re-enable interrupts */ 522 /* Re-enable interrupts */
523 local_irq_enable(); 523 local_irq_enable();
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 2f2e7964226d..c4efc0c17f8f 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -433,49 +433,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
433 PDE(inode)->data); 433 PDE(inode)->data);
434} 434}
435 435
436static ssize_t
437acpi_processor_write_performance(struct file *file,
438 const char __user * buffer,
439 size_t count, loff_t * data)
440{
441 int result = 0;
442 struct seq_file *m = file->private_data;
443 struct acpi_processor *pr = m->private;
444 struct acpi_processor_performance *perf;
445 char state_string[12] = { '\0' };
446 unsigned int new_state = 0;
447 struct cpufreq_policy policy;
448
449
450 if (!pr || (count > sizeof(state_string) - 1))
451 return -EINVAL;
452
453 perf = pr->performance;
454 if (!perf)
455 return -EINVAL;
456
457 if (copy_from_user(state_string, buffer, count))
458 return -EFAULT;
459
460 state_string[count] = '\0';
461 new_state = simple_strtoul(state_string, NULL, 0);
462
463 if (new_state >= perf->state_count)
464 return -EINVAL;
465
466 cpufreq_get_policy(&policy, pr->id);
467
468 policy.cpu = pr->id;
469 policy.min = perf->states[new_state].core_frequency * 1000;
470 policy.max = perf->states[new_state].core_frequency * 1000;
471
472 result = cpufreq_set_policy(&policy);
473 if (result)
474 return result;
475
476 return count;
477}
478
479static void acpi_cpufreq_add_file(struct acpi_processor *pr) 436static void acpi_cpufreq_add_file(struct acpi_processor *pr)
480{ 437{
481 struct proc_dir_entry *entry = NULL; 438 struct proc_dir_entry *entry = NULL;
@@ -487,10 +444,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
487 444
488 /* add file 'performance' [R/W] */ 445 /* add file 'performance' [R/W] */
489 entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, 446 entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
490 S_IFREG | S_IRUGO | S_IWUSR, 447 S_IFREG | S_IRUGO,
491 acpi_device_dir(device)); 448 acpi_device_dir(device));
492 if (entry){ 449 if (entry){
493 acpi_processor_perf_fops.write = acpi_processor_write_performance;
494 entry->proc_fops = &acpi_processor_perf_fops; 450 entry->proc_fops = &acpi_processor_perf_fops;
495 entry->data = acpi_driver_data(device); 451 entry->data = acpi_driver_data(device);
496 entry->owner = THIS_MODULE; 452 entry->owner = THIS_MODULE;
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 2d912b71e543..dcde9ddd105a 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -60,7 +60,7 @@ acpi_system_write_sleep(struct file *file,
60 state = simple_strtoul(str, NULL, 0); 60 state = simple_strtoul(str, NULL, 0);
61#ifdef CONFIG_SOFTWARE_SUSPEND 61#ifdef CONFIG_SOFTWARE_SUSPEND
62 if (state == 4) { 62 if (state == 4) {
63 error = software_suspend(); 63 error = pm_suspend(PM_SUSPEND_DISK);
64 goto Done; 64 goto Done;
65 } 65 }
66#endif 66#endif
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 365c306c7cf8..45dbdc14915f 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -550,13 +550,21 @@ config PATA_WINBOND_VLB
550 550
551config PATA_PLATFORM 551config PATA_PLATFORM
552 tristate "Generic platform device PATA support" 552 tristate "Generic platform device PATA support"
553 depends on EMBEDDED 553 depends on EMBEDDED || ARCH_RPC
554 help 554 help
555 This option enables support for generic directly connected ATA 555 This option enables support for generic directly connected ATA
556 devices commonly found on embedded systems. 556 devices commonly found on embedded systems.
557 557
558 If unsure, say N. 558 If unsure, say N.
559 559
560config PATA_ICSIDE
561 tristate "Acorn ICS PATA support"
562 depends on ARM && ARCH_ACORN
563 help
564 On Acorn systems, say Y here if you wish to use the ICS PATA
565 interface card. This is not required for ICS partition support.
566 If you are unsure, say N to this.
567
560config PATA_IXP4XX_CF 568config PATA_IXP4XX_CF
561 tristate "IXP4XX Compact Flash support" 569 tristate "IXP4XX Compact Flash support"
562 depends on ARCH_IXP4XX 570 depends on ARCH_IXP4XX
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index b7055e302650..6f42a0e2812d 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o
62obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o 62obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
63obj-$(CONFIG_PATA_SCC) += pata_scc.o 63obj-$(CONFIG_PATA_SCC) += pata_scc.o
64obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o 64obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o
65obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o
65# Should be last but one libata driver 66# Should be last but one libata driver
66obj-$(CONFIG_ATA_GENERIC) += ata_generic.o 67obj-$(CONFIG_ATA_GENERIC) += ata_generic.o
67# Should be last libata driver 68# Should be last libata driver
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
new file mode 100644
index 000000000000..dbc8ee2adcf0
--- /dev/null
+++ b/drivers/ata/pata_icside.c
@@ -0,0 +1,686 @@
1#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/init.h>
4#include <linux/blkdev.h>
5#include <scsi/scsi_host.h>
6#include <linux/ata.h>
7#include <linux/libata.h>
8
9#include <asm/dma.h>
10#include <asm/ecard.h>
11
12#define DRV_NAME "pata_icside"
13
14#define ICS_IDENT_OFFSET 0x2280
15
16#define ICS_ARCIN_V5_INTRSTAT 0x0000
17#define ICS_ARCIN_V5_INTROFFSET 0x0004
18
19#define ICS_ARCIN_V6_INTROFFSET_1 0x2200
20#define ICS_ARCIN_V6_INTRSTAT_1 0x2290
21#define ICS_ARCIN_V6_INTROFFSET_2 0x3200
22#define ICS_ARCIN_V6_INTRSTAT_2 0x3290
23
24struct portinfo {
25 unsigned int dataoffset;
26 unsigned int ctrloffset;
27 unsigned int stepping;
28};
29
30static const struct portinfo pata_icside_portinfo_v5 = {
31 .dataoffset = 0x2800,
32 .ctrloffset = 0x2b80,
33 .stepping = 6,
34};
35
36static const struct portinfo pata_icside_portinfo_v6_1 = {
37 .dataoffset = 0x2000,
38 .ctrloffset = 0x2380,
39 .stepping = 6,
40};
41
42static const struct portinfo pata_icside_portinfo_v6_2 = {
43 .dataoffset = 0x3000,
44 .ctrloffset = 0x3380,
45 .stepping = 6,
46};
47
48#define PATA_ICSIDE_MAX_SG 128
49
50struct pata_icside_state {
51 void __iomem *irq_port;
52 void __iomem *ioc_base;
53 unsigned int type;
54 unsigned int dma;
55 struct {
56 u8 port_sel;
57 u8 disabled;
58 unsigned int speed[ATA_MAX_DEVICES];
59 } port[2];
60 struct scatterlist sg[PATA_ICSIDE_MAX_SG];
61};
62
63#define ICS_TYPE_A3IN 0
64#define ICS_TYPE_A3USER 1
65#define ICS_TYPE_V6 3
66#define ICS_TYPE_V5 15
67#define ICS_TYPE_NOTYPE ((unsigned int)-1)
68
69/* ---------------- Version 5 PCB Support Functions --------------------- */
70/* Prototype: pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr)
71 * Purpose : enable interrupts from card
72 */
73static void pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr)
74{
75 struct pata_icside_state *state = ec->irq_data;
76
77 writeb(0, state->irq_port + ICS_ARCIN_V5_INTROFFSET);
78}
79
80/* Prototype: pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr)
81 * Purpose : disable interrupts from card
82 */
83static void pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr)
84{
85 struct pata_icside_state *state = ec->irq_data;
86
87 readb(state->irq_port + ICS_ARCIN_V5_INTROFFSET);
88}
89
90static const expansioncard_ops_t pata_icside_ops_arcin_v5 = {
91 .irqenable = pata_icside_irqenable_arcin_v5,
92 .irqdisable = pata_icside_irqdisable_arcin_v5,
93};
94
95
96/* ---------------- Version 6 PCB Support Functions --------------------- */
97/* Prototype: pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
98 * Purpose : enable interrupts from card
99 */
100static void pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
101{
102 struct pata_icside_state *state = ec->irq_data;
103 void __iomem *base = state->irq_port;
104
105 if (!state->port[0].disabled)
106 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1);
107 if (!state->port[1].disabled)
108 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2);
109}
110
111/* Prototype: pata_icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
112 * Purpose : disable interrupts from card
113 */
114static void pata_icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
115{
116 struct pata_icside_state *state = ec->irq_data;
117
118 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
119 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
120}
121
122/* Prototype: pata_icside_irqprobe(struct expansion_card *ec)
123 * Purpose : detect an active interrupt from card
124 */
125static int pata_icside_irqpending_arcin_v6(struct expansion_card *ec)
126{
127 struct pata_icside_state *state = ec->irq_data;
128
129 return readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_1) & 1 ||
130 readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_2) & 1;
131}
132
133static const expansioncard_ops_t pata_icside_ops_arcin_v6 = {
134 .irqenable = pata_icside_irqenable_arcin_v6,
135 .irqdisable = pata_icside_irqdisable_arcin_v6,
136 .irqpending = pata_icside_irqpending_arcin_v6,
137};
138
139
140/*
141 * SG-DMA support.
142 *
143 * Similar to the BM-DMA, but we use the RiscPCs IOMD DMA controllers.
144 * There is only one DMA controller per card, which means that only
145 * one drive can be accessed at one time. NOTE! We do not enforce that
146 * here, but we rely on the main IDE driver spotting that both
147 * interfaces use the same IRQ, which should guarantee this.
148 */
149
150/*
151 * Configure the IOMD to give the appropriate timings for the transfer
152 * mode being requested. We take the advice of the ATA standards, and
153 * calculate the cycle time based on the transfer mode, and the EIDE
154 * MW DMA specs that the drive provides in the IDENTIFY command.
155 *
156 * We have the following IOMD DMA modes to choose from:
157 *
158 * Type Active Recovery Cycle
159 * A 250 (250) 312 (550) 562 (800)
160 * B 187 (200) 250 (550) 437 (750)
161 * C 125 (125) 125 (375) 250 (500)
162 * D 62 (50) 125 (375) 187 (425)
163 *
164 * (figures in brackets are actual measured timings on DIOR/DIOW)
165 *
166 * However, we also need to take care of the read/write active and
167 * recovery timings:
168 *
169 * Read Write
170 * Mode Active -- Recovery -- Cycle IOMD type
171 * MW0 215 50 215 480 A
172 * MW1 80 50 50 150 C
173 * MW2 70 25 25 120 C
174 */
175static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev)
176{
177 struct pata_icside_state *state = ap->host->private_data;
178 struct ata_timing t;
179 unsigned int cycle;
180 char iomd_type;
181
182 /*
183 * DMA is based on a 16MHz clock
184 */
185 if (ata_timing_compute(adev, adev->dma_mode, &t, 1000, 1))
186 return;
187
188 /*
189 * Choose the IOMD cycle timing which ensure that the interface
190 * satisfies the measured active, recovery and cycle times.
191 */
192 if (t.active <= 50 && t.recover <= 375 && t.cycle <= 425)
193 iomd_type = 'D', cycle = 187;
194 else if (t.active <= 125 && t.recover <= 375 && t.cycle <= 500)
195 iomd_type = 'C', cycle = 250;
196 else if (t.active <= 200 && t.recover <= 550 && t.cycle <= 750)
197 iomd_type = 'B', cycle = 437;
198 else
199 iomd_type = 'A', cycle = 562;
200
201 ata_dev_printk(adev, KERN_INFO, "timings: act %dns rec %dns cyc %dns (%c)\n",
202 t.active, t.recover, t.cycle, iomd_type);
203
204 state->port[ap->port_no].speed[adev->devno] = cycle;
205}
206
207static void pata_icside_bmdma_setup(struct ata_queued_cmd *qc)
208{
209 struct ata_port *ap = qc->ap;
210 struct pata_icside_state *state = ap->host->private_data;
211 struct scatterlist *sg, *rsg = state->sg;
212 unsigned int write = qc->tf.flags & ATA_TFLAG_WRITE;
213
214 /*
215 * We are simplex; BUG if we try to fiddle with DMA
216 * while it's active.
217 */
218 BUG_ON(dma_channel_active(state->dma));
219
220 /*
221 * Copy ATAs scattered sg list into a contiguous array of sg
222 */
223 ata_for_each_sg(sg, qc) {
224 memcpy(rsg, sg, sizeof(*sg));
225 rsg++;
226 }
227
228 /*
229 * Route the DMA signals to the correct interface
230 */
231 writeb(state->port[ap->port_no].port_sel, state->ioc_base);
232
233 set_dma_speed(state->dma, state->port[ap->port_no].speed[qc->dev->devno]);
234 set_dma_sg(state->dma, state->sg, rsg - state->sg);
235 set_dma_mode(state->dma, write ? DMA_MODE_WRITE : DMA_MODE_READ);
236
237 /* issue r/w command */
238 ap->ops->exec_command(ap, &qc->tf);
239}
240
241static void pata_icside_bmdma_start(struct ata_queued_cmd *qc)
242{
243 struct ata_port *ap = qc->ap;
244 struct pata_icside_state *state = ap->host->private_data;
245
246 BUG_ON(dma_channel_active(state->dma));
247 enable_dma(state->dma);
248}
249
250static void pata_icside_bmdma_stop(struct ata_queued_cmd *qc)
251{
252 struct ata_port *ap = qc->ap;
253 struct pata_icside_state *state = ap->host->private_data;
254
255 disable_dma(state->dma);
256
257 /* see ata_bmdma_stop */
258 ata_altstatus(ap);
259}
260
261static u8 pata_icside_bmdma_status(struct ata_port *ap)
262{
263 struct pata_icside_state *state = ap->host->private_data;
264 void __iomem *irq_port;
265
266 irq_port = state->irq_port + (ap->port_no ? ICS_ARCIN_V6_INTRSTAT_2 :
267 ICS_ARCIN_V6_INTRSTAT_1);
268
269 return readb(irq_port) & 1 ? ATA_DMA_INTR : 0;
270}
271
272static int icside_dma_init(struct ata_probe_ent *ae, struct expansion_card *ec)
273{
274 struct pata_icside_state *state = ae->private_data;
275 int i;
276
277 for (i = 0; i < ATA_MAX_DEVICES; i++) {
278 state->port[0].speed[i] = 480;
279 state->port[1].speed[i] = 480;
280 }
281
282 if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) {
283 state->dma = ec->dma;
284 ae->mwdma_mask = 0x07; /* MW0..2 */
285 }
286
287 return 0;
288}
289
290
291static int pata_icside_port_start(struct ata_port *ap)
292{
293 /* No PRD to alloc */
294 return ata_pad_alloc(ap, ap->dev);
295}
296
297static struct scsi_host_template pata_icside_sht = {
298 .module = THIS_MODULE,
299 .name = DRV_NAME,
300 .ioctl = ata_scsi_ioctl,
301 .queuecommand = ata_scsi_queuecmd,
302 .can_queue = ATA_DEF_QUEUE,
303 .this_id = ATA_SHT_THIS_ID,
304 .sg_tablesize = PATA_ICSIDE_MAX_SG,
305 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
306 .emulated = ATA_SHT_EMULATED,
307 .use_clustering = ATA_SHT_USE_CLUSTERING,
308 .proc_name = DRV_NAME,
309 .dma_boundary = ~0, /* no dma boundaries */
310 .slave_configure = ata_scsi_slave_config,
311 .slave_destroy = ata_scsi_slave_destroy,
312 .bios_param = ata_std_bios_param,
313};
314
315/* wish this was exported from libata-core */
316static void ata_dummy_noret(struct ata_port *port)
317{
318}
319
320/*
321 * We need to shut down unused ports to prevent spurious interrupts.
322 * FIXME: the libata core doesn't call this function for PATA interfaces.
323 */
324static void pata_icside_port_disable(struct ata_port *ap)
325{
326 struct pata_icside_state *state = ap->host->private_data;
327
328 ata_port_printk(ap, KERN_ERR, "disabling icside port\n");
329
330 ata_port_disable(ap);
331
332 state->port[ap->port_no].disabled = 1;
333
334 if (state->type == ICS_TYPE_V6) {
335 /*
336 * Disable interrupts from this port, otherwise we
337 * receive spurious interrupts from the floating
338 * interrupt line.
339 */
340 void __iomem *irq_port = state->irq_port +
341 (ap->port_no ? ICS_ARCIN_V6_INTROFFSET_2 : ICS_ARCIN_V6_INTROFFSET_1);
342 readb(irq_port);
343 }
344}
345
346static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq)
347{
348 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
349 u8 status;
350
351 status = ata_busy_wait(ap, bits, 1000);
352 if (status & bits)
353 if (ata_msg_err(ap))
354 printk(KERN_ERR "abnormal status 0x%X\n", status);
355
356 if (ata_msg_intr(ap))
357 printk(KERN_INFO "%s: irq ack: drv_stat 0x%X\n",
358 __FUNCTION__, status);
359
360 return status;
361}
362
363static struct ata_port_operations pata_icside_port_ops = {
364 .port_disable = pata_icside_port_disable,
365
366 .set_dmamode = pata_icside_set_dmamode,
367
368 .tf_load = ata_tf_load,
369 .tf_read = ata_tf_read,
370 .exec_command = ata_exec_command,
371 .check_status = ata_check_status,
372 .dev_select = ata_std_dev_select,
373
374 .bmdma_setup = pata_icside_bmdma_setup,
375 .bmdma_start = pata_icside_bmdma_start,
376
377 .data_xfer = ata_data_xfer_noirq,
378
379 /* no need to build any PRD tables for DMA */
380 .qc_prep = ata_noop_qc_prep,
381 .qc_issue = ata_qc_issue_prot,
382
383 .freeze = ata_bmdma_freeze,
384 .thaw = ata_bmdma_thaw,
385 .error_handler = ata_bmdma_error_handler,
386 .post_internal_cmd = pata_icside_bmdma_stop,
387
388 .irq_handler = ata_interrupt,
389 .irq_clear = ata_dummy_noret,
390 .irq_on = ata_irq_on,
391 .irq_ack = pata_icside_irq_ack,
392
393 .port_start = pata_icside_port_start,
394
395 .bmdma_stop = pata_icside_bmdma_stop,
396 .bmdma_status = pata_icside_bmdma_status,
397};
398
399static void
400pata_icside_add_port(struct ata_probe_ent *ae, void __iomem *base,
401 const struct portinfo *info)
402{
403 struct ata_ioports *ioaddr = &ae->port[ae->n_ports++];
404 void __iomem *cmd = base + info->dataoffset;
405
406 ioaddr->cmd_addr = cmd;
407 ioaddr->data_addr = cmd + (ATA_REG_DATA << info->stepping);
408 ioaddr->error_addr = cmd + (ATA_REG_ERR << info->stepping);
409 ioaddr->feature_addr = cmd + (ATA_REG_FEATURE << info->stepping);
410 ioaddr->nsect_addr = cmd + (ATA_REG_NSECT << info->stepping);
411 ioaddr->lbal_addr = cmd + (ATA_REG_LBAL << info->stepping);
412 ioaddr->lbam_addr = cmd + (ATA_REG_LBAM << info->stepping);
413 ioaddr->lbah_addr = cmd + (ATA_REG_LBAH << info->stepping);
414 ioaddr->device_addr = cmd + (ATA_REG_DEVICE << info->stepping);
415 ioaddr->status_addr = cmd + (ATA_REG_STATUS << info->stepping);
416 ioaddr->command_addr = cmd + (ATA_REG_CMD << info->stepping);
417
418 ioaddr->ctl_addr = base + info->ctrloffset;
419 ioaddr->altstatus_addr = ioaddr->ctl_addr;
420}
421
422static int __init
423pata_icside_register_v5(struct ata_probe_ent *ae, struct expansion_card *ec)
424{
425 struct pata_icside_state *state = ae->private_data;
426 void __iomem *base;
427
428 base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC),
429 ecard_resource_len(ec, ECARD_RES_MEMC));
430 if (!base)
431 return -ENOMEM;
432
433 state->irq_port = base;
434
435 ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT;
436 ec->irqmask = 1;
437 ec->irq_data = state;
438 ec->ops = &pata_icside_ops_arcin_v5;
439
440 /*
441 * Be on the safe side - disable interrupts
442 */
443 ec->ops->irqdisable(ec, ec->irq);
444
445 pata_icside_add_port(ae, base, &pata_icside_portinfo_v5);
446
447 return 0;
448}
449
450static int __init
451pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec)
452{
453 struct pata_icside_state *state = ae->private_data;
454 void __iomem *ioc_base, *easi_base;
455 unsigned int sel = 0;
456 int ret;
457
458 ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST),
459 ecard_resource_len(ec, ECARD_RES_IOCFAST));
460 if (!ioc_base) {
461 ret = -ENOMEM;
462 goto out;
463 }
464
465 easi_base = ioc_base;
466
467 if (ecard_resource_flags(ec, ECARD_RES_EASI)) {
468 easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI),
469 ecard_resource_len(ec, ECARD_RES_EASI));
470 if (!easi_base) {
471 ret = -ENOMEM;
472 goto unmap_slot;
473 }
474
475 /*
476 * Enable access to the EASI region.
477 */
478 sel = 1 << 5;
479 }
480
481 writeb(sel, ioc_base);
482
483 ec->irq_data = state;
484 ec->ops = &pata_icside_ops_arcin_v6;
485
486 state->irq_port = easi_base;
487 state->ioc_base = ioc_base;
488 state->port[0].port_sel = sel;
489 state->port[1].port_sel = sel | 1;
490
491 /*
492 * Be on the safe side - disable interrupts
493 */
494 ec->ops->irqdisable(ec, ec->irq);
495
496 /*
497 * Find and register the interfaces.
498 */
499 pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_1);
500 pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_2);
501
502 /*
503 * FIXME: work around libata's aversion to calling port_disable.
504 * This permanently disables interrupts on port 0 - bad luck if
505 * you have a drive on that port.
506 */
507 state->port[0].disabled = 1;
508
509 return icside_dma_init(ae, ec);
510
511 unmap_slot:
512 iounmap(ioc_base);
513 out:
514 return ret;
515}
516
517static int __devinit
518pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id)
519{
520 struct pata_icside_state *state;
521 struct ata_probe_ent ae;
522 void __iomem *idmem;
523 int ret;
524
525 ret = ecard_request_resources(ec);
526 if (ret)
527 goto out;
528
529 state = kzalloc(sizeof(struct pata_icside_state), GFP_KERNEL);
530 if (!state) {
531 ret = -ENOMEM;
532 goto release;
533 }
534
535 state->type = ICS_TYPE_NOTYPE;
536 state->dma = NO_DMA;
537
538 idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST),
539 ecard_resource_len(ec, ECARD_RES_IOCFAST));
540 if (idmem) {
541 unsigned int type;
542
543 type = readb(idmem + ICS_IDENT_OFFSET) & 1;
544 type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1;
545 type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2;
546 type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3;
547 iounmap(idmem);
548
549 state->type = type;
550 }
551
552 memset(&ae, 0, sizeof(ae));
553 INIT_LIST_HEAD(&ae.node);
554 ae.dev = &ec->dev;
555 ae.port_ops = &pata_icside_port_ops;
556 ae.sht = &pata_icside_sht;
557 ae.pio_mask = 0x1f;
558 ae.irq = ec->irq;
559 ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST;
560 ae._host_flags = ATA_HOST_SIMPLEX;
561 ae.private_data = state;
562
563 switch (state->type) {
564 case ICS_TYPE_A3IN:
565 dev_warn(&ec->dev, "A3IN unsupported\n");
566 ret = -ENODEV;
567 break;
568
569 case ICS_TYPE_A3USER:
570 dev_warn(&ec->dev, "A3USER unsupported\n");
571 ret = -ENODEV;
572 break;
573
574 case ICS_TYPE_V5:
575 ret = pata_icside_register_v5(&ae, ec);
576 break;
577
578 case ICS_TYPE_V6:
579 ret = pata_icside_register_v6(&ae, ec);
580 break;
581
582 default:
583 dev_warn(&ec->dev, "unknown interface type\n");
584 ret = -ENODEV;
585 break;
586 }
587
588 if (ret == 0)
589 ret = ata_device_add(&ae) == 0 ? -ENODEV : 0;
590
591 if (ret == 0)
592 goto out;
593
594 kfree(state);
595 release:
596 ecard_release_resources(ec);
597 out:
598 return ret;
599}
600
601static void pata_icside_shutdown(struct expansion_card *ec)
602{
603 struct ata_host *host = ecard_get_drvdata(ec);
604 unsigned long flags;
605
606 /*
607 * Disable interrupts from this card. We need to do
608 * this before disabling EASI since we may be accessing
609 * this register via that region.
610 */
611 local_irq_save(flags);
612 if (ec->ops)
613 ec->ops->irqdisable(ec, ec->irq);
614 local_irq_restore(flags);
615
616 /*
617 * Reset the ROM pointer so that we can read the ROM
618 * after a soft reboot. This also disables access to
619 * the IDE taskfile via the EASI region.
620 */
621 if (host) {
622 struct pata_icside_state *state = host->private_data;
623 if (state->ioc_base)
624 writeb(0, state->ioc_base);
625 }
626}
627
628static void __devexit pata_icside_remove(struct expansion_card *ec)
629{
630 struct ata_host *host = ecard_get_drvdata(ec);
631 struct pata_icside_state *state = host->private_data;
632
633 ata_host_detach(host);
634
635 pata_icside_shutdown(ec);
636
637 /*
638 * don't NULL out the drvdata - devres/libata wants it
639 * to free the ata_host structure.
640 */
641 ec->ops = NULL;
642 ec->irq_data = NULL;
643
644 if (state->dma != NO_DMA)
645 free_dma(state->dma);
646 if (state->ioc_base)
647 iounmap(state->ioc_base);
648 if (state->ioc_base != state->irq_port)
649 iounmap(state->irq_port);
650
651 kfree(state);
652 ecard_release_resources(ec);
653}
654
655static const struct ecard_id pata_icside_ids[] = {
656 { MANU_ICS, PROD_ICS_IDE },
657 { MANU_ICS2, PROD_ICS2_IDE },
658 { 0xffff, 0xffff }
659};
660
661static struct ecard_driver pata_icside_driver = {
662 .probe = pata_icside_probe,
663 .remove = __devexit_p(pata_icside_remove),
664 .shutdown = pata_icside_shutdown,
665 .id_table = pata_icside_ids,
666 .drv = {
667 .name = DRV_NAME,
668 },
669};
670
671static int __init pata_icside_init(void)
672{
673 return ecard_register_driver(&pata_icside_driver);
674}
675
676static void __exit pata_icside_exit(void)
677{
678 ecard_remove_driver(&pata_icside_driver);
679}
680
681MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
682MODULE_LICENSE("GPL");
683MODULE_DESCRIPTION("ICS PATA driver");
684
685module_init(pata_icside_init);
686module_exit(pata_icside_exit);
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 8d60c4eb54fe..2ebd07f2ef81 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -6,7 +6,6 @@
6#include <linux/version.h> 6#include <linux/version.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/skbuff.h> 8#include <linux/skbuff.h>
9#include <linux/pci.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
11#include <linux/types.h> 10#include <linux/types.h>
12#include <linux/string.h> 11#include <linux/string.h>
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index e9eb7382ac3a..b39ea3f59c9b 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -2,10 +2,10 @@
2 2
3obj-y := core.o sys.o bus.o dd.o \ 3obj-y := core.o sys.o bus.o dd.o \
4 driver.o class.o platform.o \ 4 driver.o class.o platform.o \
5 cpu.o firmware.o init.o map.o dmapool.o \ 5 cpu.o firmware.o init.o map.o devres.o \
6 dma-mapping.o devres.o \
7 attribute_container.o transport_class.o 6 attribute_container.o transport_class.o
8obj-y += power/ 7obj-y += power/
8obj-$(CONFIG_HAS_DMA) += dma-mapping.o dmapool.o
9obj-$(CONFIG_ISA) += isa.o 9obj-$(CONFIG_ISA) += isa.o
10obj-$(CONFIG_FW_LOADER) += firmware_class.o 10obj-$(CONFIG_FW_LOADER) += firmware_class.o
11obj-$(CONFIG_NUMA) += node.o 11obj-$(CONFIG_NUMA) += node.o
diff --git a/drivers/base/base.h b/drivers/base/base.h
index d597f2659b23..5512d84452f2 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -45,3 +45,5 @@ struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
45extern char *make_class_name(const char *name, struct kobject *kobj); 45extern char *make_class_name(const char *name, struct kobject *kobj);
46 46
47extern void devres_release_all(struct device *dev); 47extern void devres_release_all(struct device *dev);
48
49extern struct kset devices_subsys;
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 1d76e2349654..dca734819e50 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -17,7 +17,7 @@
17#include "power/power.h" 17#include "power/power.h"
18 18
19#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) 19#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
20#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) 20#define to_bus(obj) container_of(obj, struct bus_type, subsys.kobj)
21 21
22/* 22/*
23 * sysfs bindings for drivers 23 * sysfs bindings for drivers
@@ -123,7 +123,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
123{ 123{
124 int error; 124 int error;
125 if (get_bus(bus)) { 125 if (get_bus(bus)) {
126 error = sysfs_create_file(&bus->subsys.kset.kobj, &attr->attr); 126 error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
127 put_bus(bus); 127 put_bus(bus);
128 } else 128 } else
129 error = -EINVAL; 129 error = -EINVAL;
@@ -133,7 +133,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
133void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) 133void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
134{ 134{
135 if (get_bus(bus)) { 135 if (get_bus(bus)) {
136 sysfs_remove_file(&bus->subsys.kset.kobj, &attr->attr); 136 sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
137 put_bus(bus); 137 put_bus(bus);
138 } 138 }
139} 139}
@@ -397,7 +397,7 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
397static int make_deprecated_bus_links(struct device *dev) 397static int make_deprecated_bus_links(struct device *dev)
398{ 398{
399 return sysfs_create_link(&dev->kobj, 399 return sysfs_create_link(&dev->kobj,
400 &dev->bus->subsys.kset.kobj, "bus"); 400 &dev->bus->subsys.kobj, "bus");
401} 401}
402 402
403static void remove_deprecated_bus_links(struct device *dev) 403static void remove_deprecated_bus_links(struct device *dev)
@@ -431,7 +431,7 @@ int bus_add_device(struct device * dev)
431 if (error) 431 if (error)
432 goto out_id; 432 goto out_id;
433 error = sysfs_create_link(&dev->kobj, 433 error = sysfs_create_link(&dev->kobj,
434 &dev->bus->subsys.kset.kobj, "subsystem"); 434 &dev->bus->subsys.kobj, "subsystem");
435 if (error) 435 if (error)
436 goto out_subsys; 436 goto out_subsys;
437 error = make_deprecated_bus_links(dev); 437 error = make_deprecated_bus_links(dev);
@@ -810,7 +810,7 @@ int bus_register(struct bus_type * bus)
810 810
811 BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier); 811 BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier);
812 812
813 retval = kobject_set_name(&bus->subsys.kset.kobj, "%s", bus->name); 813 retval = kobject_set_name(&bus->subsys.kobj, "%s", bus->name);
814 if (retval) 814 if (retval)
815 goto out; 815 goto out;
816 816
@@ -820,13 +820,13 @@ int bus_register(struct bus_type * bus)
820 goto out; 820 goto out;
821 821
822 kobject_set_name(&bus->devices.kobj, "devices"); 822 kobject_set_name(&bus->devices.kobj, "devices");
823 bus->devices.subsys = &bus->subsys; 823 bus->devices.kobj.parent = &bus->subsys.kobj;
824 retval = kset_register(&bus->devices); 824 retval = kset_register(&bus->devices);
825 if (retval) 825 if (retval)
826 goto bus_devices_fail; 826 goto bus_devices_fail;
827 827
828 kobject_set_name(&bus->drivers.kobj, "drivers"); 828 kobject_set_name(&bus->drivers.kobj, "drivers");
829 bus->drivers.subsys = &bus->subsys; 829 bus->drivers.kobj.parent = &bus->subsys.kobj;
830 bus->drivers.ktype = &ktype_driver; 830 bus->drivers.ktype = &ktype_driver;
831 retval = kset_register(&bus->drivers); 831 retval = kset_register(&bus->drivers);
832 if (retval) 832 if (retval)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 80bbb2074636..20c4ea6eb50d 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -19,10 +19,8 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "base.h" 20#include "base.h"
21 21
22extern struct subsystem devices_subsys;
23
24#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) 22#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
25#define to_class(obj) container_of(obj, struct class, subsys.kset.kobj) 23#define to_class(obj) container_of(obj, struct class, subsys.kobj)
26 24
27static ssize_t 25static ssize_t
28class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) 26class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
@@ -80,7 +78,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
80{ 78{
81 int error; 79 int error;
82 if (cls) { 80 if (cls) {
83 error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr); 81 error = sysfs_create_file(&cls->subsys.kobj, &attr->attr);
84 } else 82 } else
85 error = -EINVAL; 83 error = -EINVAL;
86 return error; 84 return error;
@@ -89,7 +87,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
89void class_remove_file(struct class * cls, const struct class_attribute * attr) 87void class_remove_file(struct class * cls, const struct class_attribute * attr)
90{ 88{
91 if (cls) 89 if (cls)
92 sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr); 90 sysfs_remove_file(&cls->subsys.kobj, &attr->attr);
93} 91}
94 92
95static struct class *class_get(struct class *cls) 93static struct class *class_get(struct class *cls)
@@ -147,7 +145,7 @@ int class_register(struct class * cls)
147 INIT_LIST_HEAD(&cls->interfaces); 145 INIT_LIST_HEAD(&cls->interfaces);
148 kset_init(&cls->class_dirs); 146 kset_init(&cls->class_dirs);
149 init_MUTEX(&cls->sem); 147 init_MUTEX(&cls->sem);
150 error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name); 148 error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name);
151 if (error) 149 if (error)
152 return error; 150 return error;
153 151
@@ -611,7 +609,7 @@ int class_device_add(struct class_device *class_dev)
611 if (parent_class_dev) 609 if (parent_class_dev)
612 class_dev->kobj.parent = &parent_class_dev->kobj; 610 class_dev->kobj.parent = &parent_class_dev->kobj;
613 else 611 else
614 class_dev->kobj.parent = &parent_class->subsys.kset.kobj; 612 class_dev->kobj.parent = &parent_class->subsys.kobj;
615 613
616 error = kobject_add(&class_dev->kobj); 614 error = kobject_add(&class_dev->kobj);
617 if (error) 615 if (error)
@@ -619,7 +617,7 @@ int class_device_add(struct class_device *class_dev)
619 617
620 /* add the needed attributes to this device */ 618 /* add the needed attributes to this device */
621 error = sysfs_create_link(&class_dev->kobj, 619 error = sysfs_create_link(&class_dev->kobj,
622 &parent_class->subsys.kset.kobj, "subsystem"); 620 &parent_class->subsys.kobj, "subsystem");
623 if (error) 621 if (error)
624 goto out3; 622 goto out3;
625 class_dev->uevent_attr.attr.name = "uevent"; 623 class_dev->uevent_attr.attr.name = "uevent";
@@ -917,8 +915,8 @@ int __init classes_init(void)
917 /* ick, this is ugly, the things we go through to keep from showing up 915 /* ick, this is ugly, the things we go through to keep from showing up
918 * in sysfs... */ 916 * in sysfs... */
919 subsystem_init(&class_obj_subsys); 917 subsystem_init(&class_obj_subsys);
920 if (!class_obj_subsys.kset.subsys) 918 if (!class_obj_subsys.kobj.parent)
921 class_obj_subsys.kset.subsys = &class_obj_subsys; 919 class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
922 return 0; 920 return 0;
923} 921}
924 922
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8aa090da1cd7..b78fc1e68264 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -252,7 +252,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
252 struct kobject *top_kobj; 252 struct kobject *top_kobj;
253 struct kset *kset; 253 struct kset *kset;
254 char *envp[32]; 254 char *envp[32];
255 char data[PAGE_SIZE]; 255 char *data = NULL;
256 char *pos; 256 char *pos;
257 int i; 257 int i;
258 size_t count = 0; 258 size_t count = 0;
@@ -276,6 +276,10 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
276 if (!kset->uevent_ops->filter(kset, &dev->kobj)) 276 if (!kset->uevent_ops->filter(kset, &dev->kobj))
277 goto out; 277 goto out;
278 278
279 data = (char *)get_zeroed_page(GFP_KERNEL);
280 if (!data)
281 return -ENOMEM;
282
279 /* let the kset specific function add its keys */ 283 /* let the kset specific function add its keys */
280 pos = data; 284 pos = data;
281 retval = kset->uevent_ops->uevent(kset, &dev->kobj, 285 retval = kset->uevent_ops->uevent(kset, &dev->kobj,
@@ -290,6 +294,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
290 count += sprintf(pos, "%s\n", envp[i]); 294 count += sprintf(pos, "%s\n", envp[i]);
291 } 295 }
292out: 296out:
297 free_page((unsigned long)data);
293 return count; 298 return count;
294} 299}
295 300
@@ -560,7 +565,7 @@ static struct kobject * get_device_parent(struct device *dev,
560 /* Set the parent to the class, not the parent device */ 565 /* Set the parent to the class, not the parent device */
561 /* this keeps sysfs from having a symlink to make old udevs happy */ 566 /* this keeps sysfs from having a symlink to make old udevs happy */
562 if (dev->class) 567 if (dev->class)
563 return &dev->class->subsys.kset.kobj; 568 return &dev->class->subsys.kobj;
564 else if (parent) 569 else if (parent)
565 return &parent->kobj; 570 return &parent->kobj;
566 571
@@ -572,7 +577,7 @@ static struct kobject *virtual_device_parent(struct device *dev)
572 static struct kobject *virtual_dir = NULL; 577 static struct kobject *virtual_dir = NULL;
573 578
574 if (!virtual_dir) 579 if (!virtual_dir)
575 virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); 580 virtual_dir = kobject_add_dir(&devices_subsys.kobj, "virtual");
576 581
577 return virtual_dir; 582 return virtual_dir;
578} 583}
@@ -706,12 +711,12 @@ int device_add(struct device *dev)
706 } 711 }
707 712
708 if (dev->class) { 713 if (dev->class) {
709 sysfs_create_link(&dev->kobj, &dev->class->subsys.kset.kobj, 714 sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj,
710 "subsystem"); 715 "subsystem");
711 /* If this is not a "fake" compatible device, then create the 716 /* If this is not a "fake" compatible device, then create the
712 * symlink from the class to the device. */ 717 * symlink from the class to the device. */
713 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 718 if (dev->kobj.parent != &dev->class->subsys.kobj)
714 sysfs_create_link(&dev->class->subsys.kset.kobj, 719 sysfs_create_link(&dev->class->subsys.kobj,
715 &dev->kobj, dev->bus_id); 720 &dev->kobj, dev->bus_id);
716 if (parent) { 721 if (parent) {
717 sysfs_create_link(&dev->kobj, &dev->parent->kobj, 722 sysfs_create_link(&dev->kobj, &dev->parent->kobj,
@@ -769,8 +774,8 @@ int device_add(struct device *dev)
769 sysfs_remove_link(&dev->kobj, "subsystem"); 774 sysfs_remove_link(&dev->kobj, "subsystem");
770 /* If this is not a "fake" compatible device, remove the 775 /* If this is not a "fake" compatible device, remove the
771 * symlink from the class to the device. */ 776 * symlink from the class to the device. */
772 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 777 if (dev->kobj.parent != &dev->class->subsys.kobj)
773 sysfs_remove_link(&dev->class->subsys.kset.kobj, 778 sysfs_remove_link(&dev->class->subsys.kobj,
774 dev->bus_id); 779 dev->bus_id);
775 if (parent) { 780 if (parent) {
776#ifdef CONFIG_SYSFS_DEPRECATED 781#ifdef CONFIG_SYSFS_DEPRECATED
@@ -870,8 +875,8 @@ void device_del(struct device * dev)
870 sysfs_remove_link(&dev->kobj, "subsystem"); 875 sysfs_remove_link(&dev->kobj, "subsystem");
871 /* If this is not a "fake" compatible device, remove the 876 /* If this is not a "fake" compatible device, remove the
872 * symlink from the class to the device. */ 877 * symlink from the class to the device. */
873 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 878 if (dev->kobj.parent != &dev->class->subsys.kobj)
874 sysfs_remove_link(&dev->class->subsys.kset.kobj, 879 sysfs_remove_link(&dev->class->subsys.kobj,
875 dev->bus_id); 880 dev->bus_id);
876 if (parent) { 881 if (parent) {
877#ifdef CONFIG_SYSFS_DEPRECATED 882#ifdef CONFIG_SYSFS_DEPRECATED
@@ -1187,9 +1192,9 @@ int device_rename(struct device *dev, char *new_name)
1187#endif 1192#endif
1188 1193
1189 if (dev->class) { 1194 if (dev->class) {
1190 sysfs_remove_link(&dev->class->subsys.kset.kobj, 1195 sysfs_remove_link(&dev->class->subsys.kobj,
1191 old_symlink_name); 1196 old_symlink_name);
1192 sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, 1197 sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
1193 dev->bus_id); 1198 dev->bus_id);
1194 } 1199 }
1195 put_device(dev); 1200 put_device(dev);
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 18dba8e78da7..92428e55b0c2 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -226,12 +226,10 @@ static int device_probe_drivers(void *data)
226 * 226 *
227 * Walk the list of drivers that the bus has and call 227 * Walk the list of drivers that the bus has and call
228 * driver_probe_device() for each pair. If a compatible 228 * driver_probe_device() for each pair. If a compatible
229 * pair is found, break out and return. If the bus specifies 229 * pair is found, break out and return.
230 * multithreaded probing, walking the list of drivers is done
231 * on a probing thread.
232 * 230 *
233 * Returns 1 if the device was bound to a driver; 231 * Returns 1 if the device was bound to a driver;
234 * 0 if no matching device was found or multithreaded probing is done; 232 * 0 if no matching device was found;
235 * -ENODEV if the device is not registered. 233 * -ENODEV if the device is not registered.
236 * 234 *
237 * When called for a USB interface, @dev->parent->sem must be held. 235 * When called for a USB interface, @dev->parent->sem must be held.
@@ -239,7 +237,6 @@ static int device_probe_drivers(void *data)
239int device_attach(struct device * dev) 237int device_attach(struct device * dev)
240{ 238{
241 int ret = 0; 239 int ret = 0;
242 struct task_struct *probe_task = ERR_PTR(-ENOMEM);
243 240
244 down(&dev->sem); 241 down(&dev->sem);
245 if (dev->driver) { 242 if (dev->driver) {
@@ -251,12 +248,7 @@ int device_attach(struct device * dev)
251 ret = 0; 248 ret = 0;
252 } 249 }
253 } else { 250 } else {
254 if (dev->bus->multithread_probe) 251 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
255 probe_task = kthread_run(device_probe_drivers, dev,
256 "probe-%s", dev->bus_id);
257 if(IS_ERR(probe_task))
258 ret = bus_for_each_drv(dev->bus, NULL, dev,
259 __device_attach);
260 } 252 }
261 up(&dev->sem); 253 up(&dev->sem);
262 return ret; 254 return ret;
@@ -383,33 +375,6 @@ void driver_detach(struct device_driver * drv)
383 } 375 }
384} 376}
385 377
386#ifdef CONFIG_PCI_MULTITHREAD_PROBE
387static int __init wait_for_probes(void)
388{
389 DEFINE_WAIT(wait);
390
391 printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__,
392 atomic_read(&probe_count));
393 if (!atomic_read(&probe_count))
394 return 0;
395 while (atomic_read(&probe_count)) {
396 prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE);
397 if (atomic_read(&probe_count))
398 schedule();
399 }
400 finish_wait(&probe_waitqueue, &wait);
401 return 0;
402}
403
404core_initcall_sync(wait_for_probes);
405postcore_initcall_sync(wait_for_probes);
406arch_initcall_sync(wait_for_probes);
407subsys_initcall_sync(wait_for_probes);
408fs_initcall_sync(wait_for_probes);
409device_initcall_sync(wait_for_probes);
410late_initcall_sync(wait_for_probes);
411#endif
412
413EXPORT_SYMBOL_GPL(device_bind_driver); 378EXPORT_SYMBOL_GPL(device_bind_driver);
414EXPORT_SYMBOL_GPL(device_release_driver); 379EXPORT_SYMBOL_GPL(device_release_driver);
415EXPORT_SYMBOL_GPL(device_attach); 380EXPORT_SYMBOL_GPL(device_attach);
diff --git a/drivers/base/firmware.c b/drivers/base/firmware.c
index cb1b98ae0d58..90c862932169 100644
--- a/drivers/base/firmware.c
+++ b/drivers/base/firmware.c
@@ -17,13 +17,13 @@
17 17
18static decl_subsys(firmware, NULL, NULL); 18static decl_subsys(firmware, NULL, NULL);
19 19
20int firmware_register(struct subsystem * s) 20int firmware_register(struct kset *s)
21{ 21{
22 kset_set_kset_s(s, firmware_subsys); 22 kobj_set_kset_s(s, firmware_subsys);
23 return subsystem_register(s); 23 return subsystem_register(s);
24} 24}
25 25
26void firmware_unregister(struct subsystem * s) 26void firmware_unregister(struct kset *s)
27{ 27{
28 subsystem_unregister(s); 28 subsystem_unregister(s);
29} 29}
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 30480f6f2af2..17b5ece8f82c 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -292,20 +292,22 @@ EXPORT_SYMBOL_GPL(platform_device_add);
292 * @pdev: platform device we're removing 292 * @pdev: platform device we're removing
293 * 293 *
294 * Note that this function will also release all memory- and port-based 294 * Note that this function will also release all memory- and port-based
295 * resources owned by the device (@dev->resource). 295 * resources owned by the device (@dev->resource). This function
296 * must _only_ be externally called in error cases. All other usage
297 * is a bug.
296 */ 298 */
297void platform_device_del(struct platform_device *pdev) 299void platform_device_del(struct platform_device *pdev)
298{ 300{
299 int i; 301 int i;
300 302
301 if (pdev) { 303 if (pdev) {
304 device_del(&pdev->dev);
305
302 for (i = 0; i < pdev->num_resources; i++) { 306 for (i = 0; i < pdev->num_resources; i++) {
303 struct resource *r = &pdev->resource[i]; 307 struct resource *r = &pdev->resource[i];
304 if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO)) 308 if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO))
305 release_resource(r); 309 release_resource(r);
306 } 310 }
307
308 device_del(&pdev->dev);
309 } 311 }
310} 312}
311EXPORT_SYMBOL_GPL(platform_device_del); 313EXPORT_SYMBOL_GPL(platform_device_del);
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index 58b6f77a1b34..a47ee1b70d20 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -16,8 +16,6 @@
16 16
17#define to_dev(node) container_of(node, struct device, kobj.entry) 17#define to_dev(node) container_of(node, struct device, kobj.entry)
18 18
19extern struct subsystem devices_subsys;
20
21 19
22/** 20/**
23 * We handle system devices differently - we suspend and shut them 21 * We handle system devices differently - we suspend and shut them
@@ -36,7 +34,7 @@ void device_shutdown(void)
36{ 34{
37 struct device * dev, *devn; 35 struct device * dev, *devn;
38 36
39 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, 37 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list,
40 kobj.entry) { 38 kobj.entry) {
41 if (dev->bus && dev->bus->shutdown) { 39 if (dev->bus && dev->bus->shutdown) {
42 dev_dbg(dev, "shutdown\n"); 40 dev_dbg(dev, "shutdown\n");
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 04e5db445c74..29f1291966c1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -25,7 +25,7 @@
25 25
26#include "base.h" 26#include "base.h"
27 27
28extern struct subsystem devices_subsys; 28extern struct kset devices_subsys;
29 29
30#define to_sysdev(k) container_of(k, struct sys_device, kobj) 30#define to_sysdev(k) container_of(k, struct sys_device, kobj)
31#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr) 31#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
@@ -138,7 +138,7 @@ int sysdev_class_register(struct sysdev_class * cls)
138 pr_debug("Registering sysdev class '%s'\n", 138 pr_debug("Registering sysdev class '%s'\n",
139 kobject_name(&cls->kset.kobj)); 139 kobject_name(&cls->kset.kobj));
140 INIT_LIST_HEAD(&cls->drivers); 140 INIT_LIST_HEAD(&cls->drivers);
141 cls->kset.subsys = &system_subsys; 141 cls->kset.kobj.parent = &system_subsys.kobj;
142 kset_set_kset_s(cls, system_subsys); 142 kset_set_kset_s(cls, system_subsys);
143 return kset_register(&cls->kset); 143 return kset_register(&cls->kset);
144} 144}
@@ -309,7 +309,7 @@ void sysdev_shutdown(void)
309 pr_debug("Shutting Down System Devices\n"); 309 pr_debug("Shutting Down System Devices\n");
310 310
311 down(&sysdev_drivers_lock); 311 down(&sysdev_drivers_lock);
312 list_for_each_entry_reverse(cls, &system_subsys.kset.list, 312 list_for_each_entry_reverse(cls, &system_subsys.list,
313 kset.kobj.entry) { 313 kset.kobj.entry) {
314 struct sys_device * sysdev; 314 struct sys_device * sysdev;
315 315
@@ -384,7 +384,7 @@ int sysdev_suspend(pm_message_t state)
384 384
385 pr_debug("Suspending System Devices\n"); 385 pr_debug("Suspending System Devices\n");
386 386
387 list_for_each_entry_reverse(cls, &system_subsys.kset.list, 387 list_for_each_entry_reverse(cls, &system_subsys.list,
388 kset.kobj.entry) { 388 kset.kobj.entry) {
389 389
390 pr_debug("Suspending type '%s':\n", 390 pr_debug("Suspending type '%s':\n",
@@ -457,7 +457,7 @@ gbl_driver:
457 } 457 }
458 458
459 /* resume other classes */ 459 /* resume other classes */
460 list_for_each_entry_continue(cls, &system_subsys.kset.list, 460 list_for_each_entry_continue(cls, &system_subsys.list,
461 kset.kobj.entry) { 461 kset.kobj.entry) {
462 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) { 462 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) {
463 pr_debug(" %s\n", kobject_name(&err_dev->kobj)); 463 pr_debug(" %s\n", kobject_name(&err_dev->kobj));
@@ -483,7 +483,7 @@ int sysdev_resume(void)
483 483
484 pr_debug("Resuming System Devices\n"); 484 pr_debug("Resuming System Devices\n");
485 485
486 list_for_each_entry(cls, &system_subsys.kset.list, kset.kobj.entry) { 486 list_for_each_entry(cls, &system_subsys.list, kset.kobj.entry) {
487 struct sys_device * sysdev; 487 struct sys_device * sysdev;
488 488
489 pr_debug("Resuming type '%s':\n", 489 pr_debug("Resuming type '%s':\n",
@@ -501,7 +501,7 @@ int sysdev_resume(void)
501 501
502int __init system_bus_init(void) 502int __init system_bus_init(void)
503{ 503{
504 system_subsys.kset.kobj.parent = &devices_subsys.kset.kobj; 504 system_subsys.kobj.parent = &devices_subsys.kobj;
505 return subsystem_register(&system_subsys); 505 return subsystem_register(&system_subsys);
506} 506}
507 507
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 5d6562171533..27a139025ced 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1480,7 +1480,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
1480 break; 1480 break;
1481 case FDFMTEND: 1481 case FDFMTEND:
1482 floppy_off(drive); 1482 floppy_off(drive);
1483 invalidate_bdev(inode->i_bdev, 0); 1483 invalidate_bdev(inode->i_bdev);
1484 break; 1484 break;
1485 case FDGETPRM: 1485 case FDGETPRM:
1486 memset((void *)&getprm, 0, sizeof (getprm)); 1486 memset((void *)&getprm, 0, sizeof (getprm));
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 1a6aeac5a1c3..01fbdd38e3be 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -194,15 +194,15 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
194 sl = sl_tail = NULL; 194 sl = sl_tail = NULL;
195 195
196 read_lock(&dev_base_lock); 196 read_lock(&dev_base_lock);
197 for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) { 197 for_each_netdev(ifp) {
198 dev_hold(ifp); 198 dev_hold(ifp);
199 if (!is_aoe_netif(ifp)) 199 if (!is_aoe_netif(ifp))
200 continue; 200 goto cont;
201 201
202 skb = new_skb(sizeof *h + sizeof *ch); 202 skb = new_skb(sizeof *h + sizeof *ch);
203 if (skb == NULL) { 203 if (skb == NULL) {
204 printk(KERN_INFO "aoe: skb alloc failure\n"); 204 printk(KERN_INFO "aoe: skb alloc failure\n");
205 continue; 205 goto cont;
206 } 206 }
207 skb_put(skb, sizeof *h + sizeof *ch); 207 skb_put(skb, sizeof *h + sizeof *ch);
208 skb->dev = ifp; 208 skb->dev = ifp;
@@ -221,6 +221,8 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
221 221
222 skb->next = sl; 222 skb->next = sl;
223 sl = skb; 223 sl = skb;
224cont:
225 dev_put(ifp);
224 } 226 }
225 read_unlock(&dev_base_lock); 227 read_unlock(&dev_base_lock);
226 228
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6b5b64207407..0d4ccd4a0957 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -833,7 +833,7 @@ out_clr:
833 lo->lo_backing_file = NULL; 833 lo->lo_backing_file = NULL;
834 lo->lo_flags = 0; 834 lo->lo_flags = 0;
835 set_capacity(disks[lo->lo_number], 0); 835 set_capacity(disks[lo->lo_number], 0);
836 invalidate_bdev(bdev, 0); 836 invalidate_bdev(bdev);
837 bd_set_size(bdev, 0); 837 bd_set_size(bdev, 0);
838 mapping_set_gfp_mask(mapping, lo->old_gfp_mask); 838 mapping_set_gfp_mask(mapping, lo->old_gfp_mask);
839 lo->lo_state = Lo_unbound; 839 lo->lo_state = Lo_unbound;
@@ -917,7 +917,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
917 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); 917 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
918 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); 918 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
919 memset(lo->lo_file_name, 0, LO_NAME_SIZE); 919 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
920 invalidate_bdev(bdev, 0); 920 invalidate_bdev(bdev);
921 set_capacity(disks[lo->lo_number], 0); 921 set_capacity(disks[lo->lo_number], 0);
922 bd_set_size(bdev, 0); 922 bd_set_size(bdev, 0);
923 mapping_set_gfp_mask(filp->f_mapping, gfp); 923 mapping_set_gfp_mask(filp->f_mapping, gfp);
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 485aa87e9bcd..43d4ebcb3b44 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -403,7 +403,7 @@ static void __exit rd_cleanup(void)
403 struct block_device *bdev = rd_bdev[i]; 403 struct block_device *bdev = rd_bdev[i];
404 rd_bdev[i] = NULL; 404 rd_bdev[i] = NULL;
405 if (bdev) { 405 if (bdev) {
406 invalidate_bdev(bdev, 1); 406 invalidate_bdev(bdev);
407 blkdev_put(bdev); 407 blkdev_put(bdev);
408 } 408 }
409 del_gendisk(rd_disks[i]); 409 del_gendisk(rd_disks[i]);
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 406af579ac3a..b0238b46dded 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -114,10 +114,16 @@ static struct usb_device_id blacklist_ids[] = {
114 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, 114 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
115 { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 }, 115 { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 },
116 116
117 /* Broadcom BCM2045 */
118 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_WRONG_SCO_MTU },
119
117 /* IBM/Lenovo ThinkPad with Broadcom chip */ 120 /* IBM/Lenovo ThinkPad with Broadcom chip */
118 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, 121 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU },
119 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU }, 122 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU },
120 123
124 /* Targus ACB10US */
125 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET },
126
121 /* ANYCOM Bluetooth USB-200 and USB-250 */ 127 /* ANYCOM Bluetooth USB-200 and USB-250 */
122 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET }, 128 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
123 129
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index b36f44d4d1bf..3625a05bc3d3 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2384,7 +2384,7 @@ static int cdrom_ioctl_reset(struct cdrom_device_info *cdi,
2384 return -EACCES; 2384 return -EACCES;
2385 if (!CDROM_CAN(CDC_RESET)) 2385 if (!CDROM_CAN(CDC_RESET))
2386 return -ENOSYS; 2386 return -ENOSYS;
2387 invalidate_bdev(bdev, 0); 2387 invalidate_bdev(bdev);
2388 return cdi->ops->reset(cdi); 2388 return cdi->ops->reset(cdi);
2389} 2389}
2390 2390
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index d0c978fbc204..a26d91743b24 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -905,8 +905,8 @@ config SONYPI
905 To compile this driver as a module, choose M here: the 905 To compile this driver as a module, choose M here: the
906 module will be called sonypi. 906 module will be called sonypi.
907 907
908config TANBAC_TB0219 908config GPIO_TB0219
909 tristate "TANBAC TB0219 base board support" 909 tristate "TANBAC TB0219 GPIO support"
910 depends on TANBAC_TB022X 910 depends on TANBAC_TB022X
911 select GPIO_VR41XX 911 select GPIO_VR41XX
912 912
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index ae8567cc529c..2f56ecc035aa 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -91,7 +91,7 @@ obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o
91obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o 91obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o
92obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o 92obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o
93obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o 93obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o
94obj-$(CONFIG_TANBAC_TB0219) += tb0219.o 94obj-$(CONFIG_GPIO_TB0219) += tb0219.o
95obj-$(CONFIG_TELCLOCK) += tlclk.o 95obj-$(CONFIG_TELCLOCK) += tlclk.o
96 96
97obj-$(CONFIG_WATCHDOG) += watchdog/ 97obj-$(CONFIG_WATCHDOG) += watchdog/
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 5b684fddcc03..4941ddb78939 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -145,6 +145,7 @@ static void *m1541_alloc_page(struct agp_bridge_data *bridge)
145 void *addr = agp_generic_alloc_page(agp_bridge); 145 void *addr = agp_generic_alloc_page(agp_bridge);
146 u32 temp; 146 u32 temp;
147 147
148 global_flush_tlb();
148 if (!addr) 149 if (!addr)
149 return NULL; 150 return NULL;
150 151
@@ -160,6 +161,7 @@ static void ali_destroy_page(void * addr)
160 if (addr) { 161 if (addr) {
161 global_cache_flush(); /* is this really needed? --hch */ 162 global_cache_flush(); /* is this really needed? --hch */
162 agp_generic_destroy_page(addr); 163 agp_generic_destroy_page(addr);
164 global_flush_tlb();
163 } 165 }
164} 166}
165 167
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index b0acf41c0db9..aa8f3a39a704 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -173,7 +173,7 @@ alpha_core_agp_setup(void)
173 /* 173 /*
174 * Build a fake pci_dev struct 174 * Build a fake pci_dev struct
175 */ 175 */
176 pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 176 pdev = alloc_pci_dev();
177 if (!pdev) 177 if (!pdev)
178 return -ENOMEM; 178 return -ENOMEM;
179 pdev->vendor = 0xffff; 179 pdev->vendor = 0xffff;
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 485720486d60..c9f0f250d78f 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -14,6 +14,7 @@
14#include <linux/agp_backend.h> 14#include <linux/agp_backend.h>
15#include <linux/mmzone.h> 15#include <linux/mmzone.h>
16#include <asm/page.h> /* PAGE_SIZE */ 16#include <asm/page.h> /* PAGE_SIZE */
17#include <asm/e820.h>
17#include <asm/k8.h> 18#include <asm/k8.h>
18#include "agp.h" 19#include "agp.h"
19 20
@@ -259,7 +260,6 @@ static const struct agp_bridge_driver amd_8151_driver = {
259/* Some basic sanity checks for the aperture. */ 260/* Some basic sanity checks for the aperture. */
260static int __devinit aperture_valid(u64 aper, u32 size) 261static int __devinit aperture_valid(u64 aper, u32 size)
261{ 262{
262 u32 pfn, c;
263 if (aper == 0) { 263 if (aper == 0) {
264 printk(KERN_ERR PFX "No aperture\n"); 264 printk(KERN_ERR PFX "No aperture\n");
265 return 0; 265 return 0;
@@ -272,14 +272,9 @@ static int __devinit aperture_valid(u64 aper, u32 size)
272 printk(KERN_ERR PFX "Aperture out of bounds\n"); 272 printk(KERN_ERR PFX "Aperture out of bounds\n");
273 return 0; 273 return 0;
274 } 274 }
275 pfn = aper >> PAGE_SHIFT; 275 if (e820_any_mapped(aper, aper + size, E820_RAM)) {
276 for (c = 0; c < size/PAGE_SIZE; c++) { 276 printk(KERN_ERR PFX "Aperture pointing to RAM\n");
277 if (!pfn_valid(pfn + c)) 277 return 0;
278 break;
279 if (!PageReserved(pfn_to_page(pfn + c))) {
280 printk(KERN_ERR PFX "Aperture pointing to RAM\n");
281 return 0;
282 }
283 } 278 }
284 279
285 /* Request the Aperture. This catches cases when someone else 280 /* Request the Aperture. This catches cases when someone else
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index f902d71947ba..45aeb917ec63 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -51,28 +51,6 @@ int agp_memory_reserved;
51 */ 51 */
52EXPORT_SYMBOL_GPL(agp_memory_reserved); 52EXPORT_SYMBOL_GPL(agp_memory_reserved);
53 53
54#if defined(CONFIG_X86)
55int map_page_into_agp(struct page *page)
56{
57 int i;
58 i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
59 /* Caller's responsibility to call global_flush_tlb() for
60 * performance reasons */
61 return i;
62}
63EXPORT_SYMBOL_GPL(map_page_into_agp);
64
65int unmap_page_from_agp(struct page *page)
66{
67 int i;
68 i = change_page_attr(page, 1, PAGE_KERNEL);
69 /* Caller's responsibility to call global_flush_tlb() for
70 * performance reasons */
71 return i;
72}
73EXPORT_SYMBOL_GPL(unmap_page_from_agp);
74#endif
75
76/* 54/*
77 * Generic routines for handling agp_memory structures - 55 * Generic routines for handling agp_memory structures -
78 * They use the basic page allocation routines to do the brunt of the work. 56 * They use the basic page allocation routines to do the brunt of the work.
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 55392a45a14b..9c69f2e761f5 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -186,8 +186,9 @@ static void *i8xx_alloc_pages(void)
186 return NULL; 186 return NULL;
187 187
188 if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) { 188 if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) {
189 change_page_attr(page, 4, PAGE_KERNEL);
189 global_flush_tlb(); 190 global_flush_tlb();
190 __free_page(page); 191 __free_pages(page, 2);
191 return NULL; 192 return NULL;
192 } 193 }
193 global_flush_tlb(); 194 global_flush_tlb();
@@ -209,7 +210,7 @@ static void i8xx_destroy_pages(void *addr)
209 global_flush_tlb(); 210 global_flush_tlb();
210 put_page(page); 211 put_page(page);
211 unlock_page(page); 212 unlock_page(page);
212 free_pages((unsigned long)addr, 2); 213 __free_pages(page, 2);
213 atomic_dec(&agp_bridge->current_memory_agp); 214 atomic_dec(&agp_bridge->current_memory_agp);
214} 215}
215 216
@@ -315,9 +316,6 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
315 struct agp_memory *new; 316 struct agp_memory *new;
316 void *addr; 317 void *addr;
317 318
318 if (pg_count != 1 && pg_count != 4)
319 return NULL;
320
321 switch (pg_count) { 319 switch (pg_count) {
322 case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge); 320 case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge);
323 global_flush_tlb(); 321 global_flush_tlb();
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 0c9dab557c94..6cd7373dcdf4 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -320,11 +320,11 @@ static int __devinit agp_nvidia_probe(struct pci_dev *pdev,
320 u8 cap_ptr; 320 u8 cap_ptr;
321 321
322 nvidia_private.dev_1 = 322 nvidia_private.dev_1 =
323 pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 1)); 323 pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 1));
324 nvidia_private.dev_2 = 324 nvidia_private.dev_2 =
325 pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 2)); 325 pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 2));
326 nvidia_private.dev_3 = 326 nvidia_private.dev_3 =
327 pci_find_slot((unsigned int)pdev->bus->number, PCI_DEVFN(30, 0)); 327 pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(30, 0));
328 328
329 if (!nvidia_private.dev_1 || !nvidia_private.dev_2 || !nvidia_private.dev_3) { 329 if (!nvidia_private.dev_1 || !nvidia_private.dev_2 || !nvidia_private.dev_3) {
330 printk(KERN_INFO PFX "Detected an NVIDIA nForce/nForce2 " 330 printk(KERN_INFO PFX "Detected an NVIDIA nForce/nForce2 "
@@ -443,6 +443,9 @@ static int __init agp_nvidia_init(void)
443static void __exit agp_nvidia_cleanup(void) 443static void __exit agp_nvidia_cleanup(void)
444{ 444{
445 pci_unregister_driver(&agp_nvidia_pci_driver); 445 pci_unregister_driver(&agp_nvidia_pci_driver);
446 pci_dev_put(nvidia_private.dev_1);
447 pci_dev_put(nvidia_private.dev_2);
448 pci_dev_put(nvidia_private.dev_3);
446} 449}
447 450
448module_init(agp_nvidia_init); 451module_init(agp_nvidia_init);
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 3d83b461ccad..f4562cc22343 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -329,7 +329,7 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa)
329 struct agp_bridge_data *bridge; 329 struct agp_bridge_data *bridge;
330 int error = 0; 330 int error = 0;
331 331
332 fake_bridge_dev = kmalloc(sizeof (struct pci_dev), GFP_KERNEL); 332 fake_bridge_dev = alloc_pci_dev();
333 if (!fake_bridge_dev) { 333 if (!fake_bridge_dev) {
334 error = -ENOMEM; 334 error = -ENOMEM;
335 goto fail; 335 goto fail;
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index ee8f50edde1b..cda608c42bea 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -47,9 +47,8 @@ static void *sgi_tioca_alloc_page(struct agp_bridge_data *bridge)
47 47
48 nid = info->ca_closest_node; 48 nid = info->ca_closest_node;
49 page = alloc_pages_node(nid, GFP_KERNEL, 0); 49 page = alloc_pages_node(nid, GFP_KERNEL, 0);
50 if (page == NULL) { 50 if (!page)
51 return 0; 51 return NULL;
52 }
53 52
54 get_page(page); 53 get_page(page);
55 SetPageLocked(page); 54 SetPageLocked(page);
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 125f4282d955..eb1a1c738190 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -143,96 +143,6 @@ static struct agp_bridge_driver sis_driver = {
143 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 143 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
144}; 144};
145 145
146static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
147{
148 {
149 .device_id = PCI_DEVICE_ID_SI_5591_AGP,
150 .chipset_name = "5591",
151 },
152 {
153 .device_id = PCI_DEVICE_ID_SI_530,
154 .chipset_name = "530",
155 },
156 {
157 .device_id = PCI_DEVICE_ID_SI_540,
158 .chipset_name = "540",
159 },
160 {
161 .device_id = PCI_DEVICE_ID_SI_550,
162 .chipset_name = "550",
163 },
164 {
165 .device_id = PCI_DEVICE_ID_SI_620,
166 .chipset_name = "620",
167 },
168 {
169 .device_id = PCI_DEVICE_ID_SI_630,
170 .chipset_name = "630",
171 },
172 {
173 .device_id = PCI_DEVICE_ID_SI_635,
174 .chipset_name = "635",
175 },
176 {
177 .device_id = PCI_DEVICE_ID_SI_645,
178 .chipset_name = "645",
179 },
180 {
181 .device_id = PCI_DEVICE_ID_SI_646,
182 .chipset_name = "646",
183 },
184 {
185 .device_id = PCI_DEVICE_ID_SI_648,
186 .chipset_name = "648",
187 },
188 {
189 .device_id = PCI_DEVICE_ID_SI_650,
190 .chipset_name = "650",
191 },
192 {
193 .device_id = PCI_DEVICE_ID_SI_651,
194 .chipset_name = "651",
195 },
196 {
197 .device_id = PCI_DEVICE_ID_SI_655,
198 .chipset_name = "655",
199 },
200 {
201 .device_id = PCI_DEVICE_ID_SI_661,
202 .chipset_name = "661",
203 },
204 {
205 .device_id = PCI_DEVICE_ID_SI_730,
206 .chipset_name = "730",
207 },
208 {
209 .device_id = PCI_DEVICE_ID_SI_735,
210 .chipset_name = "735",
211 },
212 {
213 .device_id = PCI_DEVICE_ID_SI_740,
214 .chipset_name = "740",
215 },
216 {
217 .device_id = PCI_DEVICE_ID_SI_741,
218 .chipset_name = "741",
219 },
220 {
221 .device_id = PCI_DEVICE_ID_SI_745,
222 .chipset_name = "745",
223 },
224 {
225 .device_id = PCI_DEVICE_ID_SI_746,
226 .chipset_name = "746",
227 },
228 {
229 .device_id = PCI_DEVICE_ID_SI_760,
230 .chipset_name = "760",
231 },
232 { }, /* dummy final entry, always present */
233};
234
235
236// chipsets that require the 'delay hack' 146// chipsets that require the 'delay hack'
237static int sis_broken_chipsets[] __devinitdata = { 147static int sis_broken_chipsets[] __devinitdata = {
238 PCI_DEVICE_ID_SI_648, 148 PCI_DEVICE_ID_SI_648,
@@ -269,29 +179,15 @@ static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
269static int __devinit agp_sis_probe(struct pci_dev *pdev, 179static int __devinit agp_sis_probe(struct pci_dev *pdev,
270 const struct pci_device_id *ent) 180 const struct pci_device_id *ent)
271{ 181{
272 struct agp_device_ids *devs = sis_agp_device_ids;
273 struct agp_bridge_data *bridge; 182 struct agp_bridge_data *bridge;
274 u8 cap_ptr; 183 u8 cap_ptr;
275 int j;
276 184
277 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 185 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
278 if (!cap_ptr) 186 if (!cap_ptr)
279 return -ENODEV; 187 return -ENODEV;
280 188
281 /* probe for known chipsets */
282 for (j = 0; devs[j].chipset_name; j++) {
283 if (pdev->device == devs[j].device_id) {
284 printk(KERN_INFO PFX "Detected SiS %s chipset\n",
285 devs[j].chipset_name);
286 goto found;
287 }
288 }
289
290 printk(KERN_ERR PFX "Unsupported SiS chipset (device id: %04x)\n",
291 pdev->device);
292 return -ENODEV;
293 189
294found: 190 printk(KERN_INFO PFX "Detected SiS chipset - id:%i\n", pdev->device);
295 bridge = agp_alloc_bridge(); 191 bridge = agp_alloc_bridge();
296 if (!bridge) 192 if (!bridge)
297 return -ENOMEM; 193 return -ENOMEM;
@@ -320,12 +216,172 @@ static void __devexit agp_sis_remove(struct pci_dev *pdev)
320 216
321static struct pci_device_id agp_sis_pci_table[] = { 217static struct pci_device_id agp_sis_pci_table[] = {
322 { 218 {
323 .class = (PCI_CLASS_BRIDGE_HOST << 8), 219 .class = (PCI_CLASS_BRIDGE_HOST << 8),
324 .class_mask = ~0, 220 .class_mask = ~0,
325 .vendor = PCI_VENDOR_ID_SI, 221 .vendor = PCI_VENDOR_ID_SI,
326 .device = PCI_ANY_ID, 222 .device = PCI_DEVICE_ID_SI_5591_AGP,
327 .subvendor = PCI_ANY_ID, 223 .subvendor = PCI_ANY_ID,
328 .subdevice = PCI_ANY_ID, 224 .subdevice = PCI_ANY_ID,
225 },
226 {
227 .class = (PCI_CLASS_BRIDGE_HOST << 8),
228 .class_mask = ~0,
229 .vendor = PCI_VENDOR_ID_SI,
230 .device = PCI_DEVICE_ID_SI_530,
231 .subvendor = PCI_ANY_ID,
232 .subdevice = PCI_ANY_ID,
233 },
234 {
235 .class = (PCI_CLASS_BRIDGE_HOST << 8),
236 .class_mask = ~0,
237 .vendor = PCI_VENDOR_ID_SI,
238 .device = PCI_DEVICE_ID_SI_540,
239 .subvendor = PCI_ANY_ID,
240 .subdevice = PCI_ANY_ID,
241 },
242 {
243 .class = (PCI_CLASS_BRIDGE_HOST << 8),
244 .class_mask = ~0,
245 .vendor = PCI_VENDOR_ID_SI,
246 .device = PCI_DEVICE_ID_SI_550,
247 .subvendor = PCI_ANY_ID,
248 .subdevice = PCI_ANY_ID,
249 },
250 {
251 .class = (PCI_CLASS_BRIDGE_HOST << 8),
252 .class_mask = ~0,
253 .vendor = PCI_VENDOR_ID_SI,
254 .device = PCI_DEVICE_ID_SI_620,
255 .subvendor = PCI_ANY_ID,
256 .subdevice = PCI_ANY_ID,
257 },
258 {
259 .class = (PCI_CLASS_BRIDGE_HOST << 8),
260 .class_mask = ~0,
261 .vendor = PCI_VENDOR_ID_SI,
262 .device = PCI_DEVICE_ID_SI_630,
263 .subvendor = PCI_ANY_ID,
264 .subdevice = PCI_ANY_ID,
265 },
266 {
267 .class = (PCI_CLASS_BRIDGE_HOST << 8),
268 .class_mask = ~0,
269 .vendor = PCI_VENDOR_ID_SI,
270 .device = PCI_DEVICE_ID_SI_635,
271 .subvendor = PCI_ANY_ID,
272 .subdevice = PCI_ANY_ID,
273 },
274 {
275 .class = (PCI_CLASS_BRIDGE_HOST << 8),
276 .class_mask = ~0,
277 .vendor = PCI_VENDOR_ID_SI,
278 .device = PCI_DEVICE_ID_SI_645,
279 .subvendor = PCI_ANY_ID,
280 .subdevice = PCI_ANY_ID,
281 },
282 {
283 .class = (PCI_CLASS_BRIDGE_HOST << 8),
284 .class_mask = ~0,
285 .vendor = PCI_VENDOR_ID_SI,
286 .device = PCI_DEVICE_ID_SI_646,
287 .subvendor = PCI_ANY_ID,
288 .subdevice = PCI_ANY_ID,
289 },
290 {
291 .class = (PCI_CLASS_BRIDGE_HOST << 8),
292 .class_mask = ~0,
293 .vendor = PCI_VENDOR_ID_SI,
294 .device = PCI_DEVICE_ID_SI_648,
295 .subvendor = PCI_ANY_ID,
296 .subdevice = PCI_ANY_ID,
297 },
298 {
299 .class = (PCI_CLASS_BRIDGE_HOST << 8),
300 .class_mask = ~0,
301 .vendor = PCI_VENDOR_ID_SI,
302 .device = PCI_DEVICE_ID_SI_650,
303 .subvendor = PCI_ANY_ID,
304 .subdevice = PCI_ANY_ID,
305 },
306 {
307 .class = (PCI_CLASS_BRIDGE_HOST << 8),
308 .class_mask = ~0,
309 .vendor = PCI_VENDOR_ID_SI,
310 .device = PCI_DEVICE_ID_SI_651,
311 .subvendor = PCI_ANY_ID,
312 .subdevice = PCI_ANY_ID,
313 },
314 {
315 .class = (PCI_CLASS_BRIDGE_HOST << 8),
316 .class_mask = ~0,
317 .vendor = PCI_VENDOR_ID_SI,
318 .device = PCI_DEVICE_ID_SI_655,
319 .subvendor = PCI_ANY_ID,
320 .subdevice = PCI_ANY_ID,
321 },
322 {
323 .class = (PCI_CLASS_BRIDGE_HOST << 8),
324 .class_mask = ~0,
325 .vendor = PCI_VENDOR_ID_SI,
326 .device = PCI_DEVICE_ID_SI_661,
327 .subvendor = PCI_ANY_ID,
328 .subdevice = PCI_ANY_ID,
329 },
330 {
331 .class = (PCI_CLASS_BRIDGE_HOST << 8),
332 .class_mask = ~0,
333 .vendor = PCI_VENDOR_ID_SI,
334 .device = PCI_DEVICE_ID_SI_730,
335 .subvendor = PCI_ANY_ID,
336 .subdevice = PCI_ANY_ID,
337 },
338 {
339 .class = (PCI_CLASS_BRIDGE_HOST << 8),
340 .class_mask = ~0,
341 .vendor = PCI_VENDOR_ID_SI,
342 .device = PCI_DEVICE_ID_SI_735,
343 .subvendor = PCI_ANY_ID,
344 .subdevice = PCI_ANY_ID,
345 },
346 {
347 .class = (PCI_CLASS_BRIDGE_HOST << 8),
348 .class_mask = ~0,
349 .vendor = PCI_VENDOR_ID_SI,
350 .device = PCI_DEVICE_ID_SI_740,
351 .subvendor = PCI_ANY_ID,
352 .subdevice = PCI_ANY_ID,
353 },
354 {
355 .class = (PCI_CLASS_BRIDGE_HOST << 8),
356 .class_mask = ~0,
357 .vendor = PCI_VENDOR_ID_SI,
358 .device = PCI_DEVICE_ID_SI_741,
359 .subvendor = PCI_ANY_ID,
360 .subdevice = PCI_ANY_ID,
361 },
362 {
363 .class = (PCI_CLASS_BRIDGE_HOST << 8),
364 .class_mask = ~0,
365 .vendor = PCI_VENDOR_ID_SI,
366 .device = PCI_DEVICE_ID_SI_745,
367 .subvendor = PCI_ANY_ID,
368 .subdevice = PCI_ANY_ID,
369 },
370 {
371 .class = (PCI_CLASS_BRIDGE_HOST << 8),
372 .class_mask = ~0,
373 .vendor = PCI_VENDOR_ID_SI,
374 .device = PCI_DEVICE_ID_SI_746,
375 .subvendor = PCI_ANY_ID,
376 .subdevice = PCI_ANY_ID,
377 },
378 {
379 .class = (PCI_CLASS_BRIDGE_HOST << 8),
380 .class_mask = ~0,
381 .vendor = PCI_VENDOR_ID_SI,
382 .device = PCI_DEVICE_ID_SI_760,
383 .subvendor = PCI_ANY_ID,
384 .subdevice = PCI_ANY_ID,
329 }, 385 },
330 { } 386 { }
331}; 387};
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 55212a3811fd..551ef25063ef 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -455,15 +455,6 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
455 u32 temp, temp2; 455 u32 temp, temp2;
456 u8 cap_ptr = 0; 456 u8 cap_ptr = 0;
457 457
458 /* Everything is on func 1 here so we are hardcoding function one */
459 bridge_dev = pci_find_slot((unsigned int)pdev->bus->number,
460 PCI_DEVFN(0, 1));
461 if (!bridge_dev) {
462 printk(KERN_INFO PFX "Detected a Serverworks chipset "
463 "but could not find the secondary device.\n");
464 return -ENODEV;
465 }
466
467 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 458 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
468 459
469 switch (pdev->device) { 460 switch (pdev->device) {
@@ -483,6 +474,15 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
483 return -ENODEV; 474 return -ENODEV;
484 } 475 }
485 476
477 /* Everything is on func 1 here so we are hardcoding function one */
478 bridge_dev = pci_get_bus_and_slot((unsigned int)pdev->bus->number,
479 PCI_DEVFN(0, 1));
480 if (!bridge_dev) {
481 printk(KERN_INFO PFX "Detected a Serverworks chipset "
482 "but could not find the secondary device.\n");
483 return -ENODEV;
484 }
485
486 serverworks_private.svrwrks_dev = bridge_dev; 486 serverworks_private.svrwrks_dev = bridge_dev;
487 serverworks_private.gart_addr_ofs = 0x10; 487 serverworks_private.gart_addr_ofs = 0x10;
488 488
@@ -515,7 +515,7 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
515 515
516 bridge->driver = &sworks_driver; 516 bridge->driver = &sworks_driver;
517 bridge->dev_private_data = &serverworks_private, 517 bridge->dev_private_data = &serverworks_private,
518 bridge->dev = pdev; 518 bridge->dev = pci_dev_get(pdev);
519 519
520 pci_set_drvdata(pdev, bridge); 520 pci_set_drvdata(pdev, bridge);
521 return agp_add_bridge(bridge); 521 return agp_add_bridge(bridge);
@@ -525,8 +525,11 @@ static void __devexit agp_serverworks_remove(struct pci_dev *pdev)
525{ 525{
526 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 526 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
527 527
528 pci_dev_put(bridge->dev);
528 agp_remove_bridge(bridge); 529 agp_remove_bridge(bridge);
529 agp_put_bridge(bridge); 530 agp_put_bridge(bridge);
531 pci_dev_put(serverworks_private.svrwrks_dev);
532 serverworks_private.svrwrks_dev = NULL;
530} 533}
531 534
532static struct pci_device_id agp_serverworks_pci_table[] = { 535static struct pci_device_id agp_serverworks_pci_table[] = {
diff --git a/drivers/char/drm/README.drm b/drivers/char/drm/README.drm
index 6441e01e587c..af74cd79a279 100644
--- a/drivers/char/drm/README.drm
+++ b/drivers/char/drm/README.drm
@@ -1,6 +1,6 @@
1************************************************************ 1************************************************************
2* For the very latest on DRI development, please see: * 2* For the very latest on DRI development, please see: *
3* http://dri.sourceforge.net/ * 3* http://dri.freedesktop.org/ *
4************************************************************ 4************************************************************
5 5
6The Direct Rendering Manager (drm) is a device-independent kernel-level 6The Direct Rendering Manager (drm) is a device-independent kernel-level
@@ -26,21 +26,19 @@ ways:
26 26
27 27
28Documentation on the DRI is available from: 28Documentation on the DRI is available from:
29 http://precisioninsight.com/piinsights.html 29 http://dri.freedesktop.org/wiki/Documentation
30 http://sourceforge.net/project/showfiles.php?group_id=387
31 http://dri.sourceforge.net/doc/
30 32
31For specific information about kernel-level support, see: 33For specific information about kernel-level support, see:
32 34
33 The Direct Rendering Manager, Kernel Support for the Direct Rendering 35 The Direct Rendering Manager, Kernel Support for the Direct Rendering
34 Infrastructure 36 Infrastructure
35 http://precisioninsight.com/dr/drm.html 37 http://dri.sourceforge.net/doc/drm_low_level.html
36 38
37 Hardware Locking for the Direct Rendering Infrastructure 39 Hardware Locking for the Direct Rendering Infrastructure
38 http://precisioninsight.com/dr/locking.html 40 http://dri.sourceforge.net/doc/hardware_locking_low_level.html
39 41
40 A Security Analysis of the Direct Rendering Infrastructure 42 A Security Analysis of the Direct Rendering Infrastructure
41 http://precisioninsight.com/dr/security.html 43 http://dri.sourceforge.net/doc/security_low_level.html
42 44
43************************************************************
44* For the very latest on DRI development, please see: *
45* http://dri.sourceforge.net/ *
46************************************************************
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 8db9041e306c..089198491f16 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -654,11 +654,13 @@ typedef struct drm_set_version {
654 654
655/** 655/**
656 * Device specific ioctls should only be in their respective headers 656 * Device specific ioctls should only be in their respective headers
657 * The device specific ioctl range is from 0x40 to 0x79. 657 * The device specific ioctl range is from 0x40 to 0x99.
658 * Generic IOCTLS restart at 0xA0.
658 * 659 *
659 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 660 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
660 * drmCommandReadWrite(). 661 * drmCommandReadWrite().
661 */ 662 */
662#define DRM_COMMAND_BASE 0x40 663#define DRM_COMMAND_BASE 0x40
664#define DRM_COMMAND_END 0xA0
663 665
664#endif 666#endif
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 85d99e21e188..80041d5b792d 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -414,6 +414,10 @@ typedef struct drm_lock_data {
414 struct file *filp; /**< File descr of lock holder (0=kernel) */ 414 struct file *filp; /**< File descr of lock holder (0=kernel) */
415 wait_queue_head_t lock_queue; /**< Queue of blocked processes */ 415 wait_queue_head_t lock_queue; /**< Queue of blocked processes */
416 unsigned long lock_time; /**< Time of last lock in jiffies */ 416 unsigned long lock_time; /**< Time of last lock in jiffies */
417 spinlock_t spinlock;
418 uint32_t kernel_waiters;
419 uint32_t user_waiters;
420 int idle_has_lock;
417} drm_lock_data_t; 421} drm_lock_data_t;
418 422
419/** 423/**
@@ -590,6 +594,8 @@ struct drm_driver {
590 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); 594 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
591 void (*reclaim_buffers_locked) (struct drm_device *dev, 595 void (*reclaim_buffers_locked) (struct drm_device *dev,
592 struct file *filp); 596 struct file *filp);
597 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
598 struct file * filp);
593 unsigned long (*get_map_ofs) (drm_map_t * map); 599 unsigned long (*get_map_ofs) (drm_map_t * map);
594 unsigned long (*get_reg_ofs) (struct drm_device * dev); 600 unsigned long (*get_reg_ofs) (struct drm_device * dev);
595 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); 601 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
@@ -764,7 +770,7 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
764} 770}
765 771
766#ifdef __alpha__ 772#ifdef __alpha__
767#define drm_get_pci_domain(dev) dev->hose->bus->number 773#define drm_get_pci_domain(dev) dev->hose->index
768#else 774#else
769#define drm_get_pci_domain(dev) 0 775#define drm_get_pci_domain(dev) 0
770#endif 776#endif
@@ -915,9 +921,18 @@ extern int drm_lock(struct inode *inode, struct file *filp,
915 unsigned int cmd, unsigned long arg); 921 unsigned int cmd, unsigned long arg);
916extern int drm_unlock(struct inode *inode, struct file *filp, 922extern int drm_unlock(struct inode *inode, struct file *filp,
917 unsigned int cmd, unsigned long arg); 923 unsigned int cmd, unsigned long arg);
918extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); 924extern int drm_lock_take(drm_lock_data_t *lock_data, unsigned int context);
919extern int drm_lock_free(drm_device_t * dev, 925extern int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context);
920 __volatile__ unsigned int *lock, unsigned int context); 926extern void drm_idlelock_take(drm_lock_data_t *lock_data);
927extern void drm_idlelock_release(drm_lock_data_t *lock_data);
928
929/*
930 * These are exported to drivers so that they can implement fencing using
931 * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
932 */
933
934extern int drm_i_have_hw_lock(struct file *filp);
935extern int drm_kernel_take_hw_lock(struct file *filp);
921 936
922 /* Buffer management support (drm_bufs.h) */ 937 /* Buffer management support (drm_bufs.h) */
923extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); 938extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index a6828cc14e58..c11345856ffe 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -57,7 +57,8 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
57 list_for_each(list, &dev->maplist->head) { 57 list_for_each(list, &dev->maplist->head) {
58 drm_map_list_t *entry = list_entry(list, drm_map_list_t, head); 58 drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
59 if (entry->map && map->type == entry->map->type && 59 if (entry->map && map->type == entry->map->type &&
60 entry->map->offset == map->offset) { 60 ((entry->map->offset == map->offset) ||
61 (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) {
61 return entry; 62 return entry;
62 } 63 }
63 } 64 }
@@ -180,8 +181,20 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
180 if (map->type == _DRM_REGISTERS) 181 if (map->type == _DRM_REGISTERS)
181 map->handle = ioremap(map->offset, map->size); 182 map->handle = ioremap(map->offset, map->size);
182 break; 183 break;
183
184 case _DRM_SHM: 184 case _DRM_SHM:
185 list = drm_find_matching_map(dev, map);
186 if (list != NULL) {
187 if(list->map->size != map->size) {
188 DRM_DEBUG("Matching maps of type %d with "
189 "mismatched sizes, (%ld vs %ld)\n",
190 map->type, map->size, list->map->size);
191 list->map->size = map->size;
192 }
193
194 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
195 *maplist = list;
196 return 0;
197 }
185 map->handle = vmalloc_user(map->size); 198 map->handle = vmalloc_user(map->size);
186 DRM_DEBUG("%lu %d %p\n", 199 DRM_DEBUG("%lu %d %p\n",
187 map->size, drm_order(map->size), map->handle); 200 map->size, drm_order(map->size), map->handle);
@@ -200,15 +213,45 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
200 dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ 213 dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */
201 } 214 }
202 break; 215 break;
203 case _DRM_AGP: 216 case _DRM_AGP: {
204 if (drm_core_has_AGP(dev)) { 217 drm_agp_mem_t *entry;
218 int valid = 0;
219
220 if (!drm_core_has_AGP(dev)) {
221 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
222 return -EINVAL;
223 }
205#ifdef __alpha__ 224#ifdef __alpha__
206 map->offset += dev->hose->mem_space->start; 225 map->offset += dev->hose->mem_space->start;
207#endif 226#endif
208 map->offset += dev->agp->base; 227 /* Note: dev->agp->base may actually be 0 when the DRM
209 map->mtrr = dev->agp->agp_mtrr; /* for getmap */ 228 * is not in control of AGP space. But if user space is
229 * it should already have added the AGP base itself.
230 */
231 map->offset += dev->agp->base;
232 map->mtrr = dev->agp->agp_mtrr; /* for getmap */
233
234 /* This assumes the DRM is in total control of AGP space.
235 * It's not always the case as AGP can be in the control
236 * of user space (i.e. i810 driver). So this loop will get
237 * skipped and we double check that dev->agp->memory is
238 * actually set as well as being invalid before EPERM'ing
239 */
240 for (entry = dev->agp->memory; entry; entry = entry->next) {
241 if ((map->offset >= entry->bound) &&
242 (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
243 valid = 1;
244 break;
245 }
210 } 246 }
247 if (dev->agp->memory && !valid) {
248 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
249 return -EPERM;
250 }
251 DRM_DEBUG("AGP offset = 0x%08lx, size = 0x%08lx\n", map->offset, map->size);
252
211 break; 253 break;
254 }
212 case _DRM_SCATTER_GATHER: 255 case _DRM_SCATTER_GATHER:
213 if (!dev->sg) { 256 if (!dev->sg) {
214 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 257 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
@@ -267,7 +310,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
267 310
268 *maplist = list; 311 *maplist = list;
269 return 0; 312 return 0;
270} 313 }
271 314
272int drm_addmap(drm_device_t * dev, unsigned int offset, 315int drm_addmap(drm_device_t * dev, unsigned int offset,
273 unsigned int size, drm_map_type_t type, 316 unsigned int size, drm_map_type_t type,
@@ -519,6 +562,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
519{ 562{
520 drm_device_dma_t *dma = dev->dma; 563 drm_device_dma_t *dma = dev->dma;
521 drm_buf_entry_t *entry; 564 drm_buf_entry_t *entry;
565 drm_agp_mem_t *agp_entry;
522 drm_buf_t *buf; 566 drm_buf_t *buf;
523 unsigned long offset; 567 unsigned long offset;
524 unsigned long agp_offset; 568 unsigned long agp_offset;
@@ -529,7 +573,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
529 int page_order; 573 int page_order;
530 int total; 574 int total;
531 int byte_count; 575 int byte_count;
532 int i; 576 int i, valid;
533 drm_buf_t **temp_buflist; 577 drm_buf_t **temp_buflist;
534 578
535 if (!dma) 579 if (!dma)
@@ -560,6 +604,19 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
560 if (dev->queue_count) 604 if (dev->queue_count)
561 return -EBUSY; /* Not while in use */ 605 return -EBUSY; /* Not while in use */
562 606
607 /* Make sure buffers are located in AGP memory that we own */
608 valid = 0;
609 for (agp_entry = dev->agp->memory; agp_entry; agp_entry = agp_entry->next) {
610 if ((agp_offset >= agp_entry->bound) &&
611 (agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) {
612 valid = 1;
613 break;
614 }
615 }
616 if (dev->agp->memory && !valid) {
617 DRM_DEBUG("zone invalid\n");
618 return -EINVAL;
619 }
563 spin_lock(&dev->count_lock); 620 spin_lock(&dev->count_lock);
564 if (dev->buf_use) { 621 if (dev->buf_use) {
565 spin_unlock(&dev->count_lock); 622 spin_unlock(&dev->count_lock);
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index f5b9b2480c14..26bec30ee86e 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -496,11 +496,14 @@ int drm_ioctl(struct inode *inode, struct file *filp,
496 (long)old_encode_dev(priv->head->device), 496 (long)old_encode_dev(priv->head->device),
497 priv->authenticated); 497 priv->authenticated);
498 498
499 if (nr < DRIVER_IOCTL_COUNT) 499 if ((nr >= DRIVER_IOCTL_COUNT) &&
500 ioctl = &drm_ioctls[nr]; 500 ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
501 else if ((nr >= DRM_COMMAND_BASE) 501 goto err_i1;
502 if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
502 && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) 503 && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
503 ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; 504 ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
505 else if ((nr >= DRM_COMMAND_END) || (nr < DRM_COMMAND_BASE))
506 ioctl = &drm_ioctls[nr];
504 else 507 else
505 goto err_i1; 508 goto err_i1;
506 509
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 898f47dafec0..3b159cab3bc8 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -46,6 +46,7 @@ static int drm_setup(drm_device_t * dev)
46 drm_local_map_t *map; 46 drm_local_map_t *map;
47 int i; 47 int i;
48 int ret; 48 int ret;
49 u32 sareapage;
49 50
50 if (dev->driver->firstopen) { 51 if (dev->driver->firstopen) {
51 ret = dev->driver->firstopen(dev); 52 ret = dev->driver->firstopen(dev);
@@ -56,7 +57,8 @@ static int drm_setup(drm_device_t * dev)
56 dev->magicfree.next = NULL; 57 dev->magicfree.next = NULL;
57 58
58 /* prebuild the SAREA */ 59 /* prebuild the SAREA */
59 i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map); 60 sareapage = max_t(unsigned, SAREA_MAX, PAGE_SIZE);
61 i = drm_addmap(dev, 0, sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
60 if (i != 0) 62 if (i != 0)
61 return i; 63 return i;
62 64
@@ -84,7 +86,7 @@ static int drm_setup(drm_device_t * dev)
84 INIT_LIST_HEAD(&dev->ctxlist->head); 86 INIT_LIST_HEAD(&dev->ctxlist->head);
85 87
86 dev->vmalist = NULL; 88 dev->vmalist = NULL;
87 dev->sigdata.lock = dev->lock.hw_lock = NULL; 89 dev->sigdata.lock = NULL;
88 init_waitqueue_head(&dev->lock.lock_queue); 90 init_waitqueue_head(&dev->lock.lock_queue);
89 dev->queue_count = 0; 91 dev->queue_count = 0;
90 dev->queue_reserved = 0; 92 dev->queue_reserved = 0;
@@ -354,58 +356,56 @@ int drm_release(struct inode *inode, struct file *filp)
354 current->pid, (long)old_encode_dev(priv->head->device), 356 current->pid, (long)old_encode_dev(priv->head->device),
355 dev->open_count); 357 dev->open_count);
356 358
357 if (priv->lock_count && dev->lock.hw_lock && 359 if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
358 _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && 360 if (drm_i_have_hw_lock(filp)) {
359 dev->lock.filp == filp) {
360 DRM_DEBUG("File %p released, freeing lock for context %d\n",
361 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
362
363 if (dev->driver->reclaim_buffers_locked)
364 dev->driver->reclaim_buffers_locked(dev, filp); 361 dev->driver->reclaim_buffers_locked(dev, filp);
365 362 } else {
366 drm_lock_free(dev, &dev->lock.hw_lock->lock, 363 unsigned long _end=jiffies + 3*DRM_HZ;
367 _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); 364 int locked = 0;
368 365
369 /* FIXME: may require heavy-handed reset of 366 drm_idlelock_take(&dev->lock);
370 hardware at this point, possibly 367
371 processed via a callback to the X 368 /*
372 server. */ 369 * Wait for a while.
373 } else if (dev->driver->reclaim_buffers_locked && priv->lock_count 370 */
374 && dev->lock.hw_lock) { 371
375 /* The lock is required to reclaim buffers */ 372 do{
376 DECLARE_WAITQUEUE(entry, current); 373 spin_lock(&dev->lock.spinlock);
377 374 locked = dev->lock.idle_has_lock;
378 add_wait_queue(&dev->lock.lock_queue, &entry); 375 spin_unlock(&dev->lock.spinlock);
379 for (;;) { 376 if (locked)
380 __set_current_state(TASK_INTERRUPTIBLE); 377 break;
381 if (!dev->lock.hw_lock) { 378 schedule();
382 /* Device has been unregistered */ 379 } while (!time_after_eq(jiffies, _end));
383 retcode = -EINTR; 380
384 break; 381 if (!locked) {
382 DRM_ERROR("reclaim_buffers_locked() deadlock. Please rework this\n"
383 "\tdriver to use reclaim_buffers_idlelocked() instead.\n"
384 "\tI will go on reclaiming the buffers anyway.\n");
385 } 385 }
386 if (drm_lock_take(&dev->lock.hw_lock->lock, 386
387 DRM_KERNEL_CONTEXT)) {
388 dev->lock.filp = filp;
389 dev->lock.lock_time = jiffies;
390 atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
391 break; /* Got lock */
392 }
393 /* Contention */
394 schedule();
395 if (signal_pending(current)) {
396 retcode = -ERESTARTSYS;
397 break;
398 }
399 }
400 __set_current_state(TASK_RUNNING);
401 remove_wait_queue(&dev->lock.lock_queue, &entry);
402 if (!retcode) {
403 dev->driver->reclaim_buffers_locked(dev, filp); 387 dev->driver->reclaim_buffers_locked(dev, filp);
404 drm_lock_free(dev, &dev->lock.hw_lock->lock, 388 drm_idlelock_release(&dev->lock);
405 DRM_KERNEL_CONTEXT);
406 } 389 }
407 } 390 }
408 391
392 if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) {
393
394 drm_idlelock_take(&dev->lock);
395 dev->driver->reclaim_buffers_idlelocked(dev, filp);
396 drm_idlelock_release(&dev->lock);
397
398 }
399
400 if (drm_i_have_hw_lock(filp)) {
401 DRM_DEBUG("File %p released, freeing lock for context %d\n",
402 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
403
404 drm_lock_free(&dev->lock,
405 _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
406 }
407
408
409 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && 409 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
410 !dev->driver->reclaim_buffers_locked) { 410 !dev->driver->reclaim_buffers_locked) {
411 dev->driver->reclaim_buffers(dev, filp); 411 dev->driver->reclaim_buffers(dev, filp);
diff --git a/drivers/char/drm/drm_hashtab.c b/drivers/char/drm/drm_hashtab.c
index a0b2d6802ae4..31acb621dcce 100644
--- a/drivers/char/drm/drm_hashtab.c
+++ b/drivers/char/drm/drm_hashtab.c
@@ -43,7 +43,16 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
43 ht->size = 1 << order; 43 ht->size = 1 << order;
44 ht->order = order; 44 ht->order = order;
45 ht->fill = 0; 45 ht->fill = 0;
46 ht->table = vmalloc(ht->size*sizeof(*ht->table)); 46 ht->table = NULL;
47 ht->use_vmalloc = ((ht->size * sizeof(*ht->table)) > PAGE_SIZE);
48 if (!ht->use_vmalloc) {
49 ht->table = drm_calloc(ht->size, sizeof(*ht->table),
50 DRM_MEM_HASHTAB);
51 }
52 if (!ht->table) {
53 ht->use_vmalloc = 1;
54 ht->table = vmalloc(ht->size*sizeof(*ht->table));
55 }
47 if (!ht->table) { 56 if (!ht->table) {
48 DRM_ERROR("Out of memory for hash table\n"); 57 DRM_ERROR("Out of memory for hash table\n");
49 return -ENOMEM; 58 return -ENOMEM;
@@ -183,7 +192,11 @@ int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item)
183void drm_ht_remove(drm_open_hash_t *ht) 192void drm_ht_remove(drm_open_hash_t *ht)
184{ 193{
185 if (ht->table) { 194 if (ht->table) {
186 vfree(ht->table); 195 if (ht->use_vmalloc)
196 vfree(ht->table);
197 else
198 drm_free(ht->table, ht->size * sizeof(*ht->table),
199 DRM_MEM_HASHTAB);
187 ht->table = NULL; 200 ht->table = NULL;
188 } 201 }
189} 202}
diff --git a/drivers/char/drm/drm_hashtab.h b/drivers/char/drm/drm_hashtab.h
index 40afec05bff8..613091c970af 100644
--- a/drivers/char/drm/drm_hashtab.h
+++ b/drivers/char/drm/drm_hashtab.h
@@ -47,6 +47,7 @@ typedef struct drm_open_hash{
47 unsigned int order; 47 unsigned int order;
48 unsigned int fill; 48 unsigned int fill;
49 struct hlist_head *table; 49 struct hlist_head *table;
50 int use_vmalloc;
50} drm_open_hash_t; 51} drm_open_hash_t;
51 52
52 53
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 9d00c51fe2c4..2e75331fd83e 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -424,7 +424,7 @@ static void drm_locked_tasklet_func(unsigned long data)
424 spin_lock_irqsave(&dev->tasklet_lock, irqflags); 424 spin_lock_irqsave(&dev->tasklet_lock, irqflags);
425 425
426 if (!dev->locked_tasklet_func || 426 if (!dev->locked_tasklet_func ||
427 !drm_lock_take(&dev->lock.hw_lock->lock, 427 !drm_lock_take(&dev->lock,
428 DRM_KERNEL_CONTEXT)) { 428 DRM_KERNEL_CONTEXT)) {
429 spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); 429 spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
430 return; 430 return;
@@ -435,7 +435,7 @@ static void drm_locked_tasklet_func(unsigned long data)
435 435
436 dev->locked_tasklet_func(dev); 436 dev->locked_tasklet_func(dev);
437 437
438 drm_lock_free(dev, &dev->lock.hw_lock->lock, 438 drm_lock_free(&dev->lock,
439 DRM_KERNEL_CONTEXT); 439 DRM_KERNEL_CONTEXT);
440 440
441 dev->locked_tasklet_func = NULL; 441 dev->locked_tasklet_func = NULL;
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c
index e9993ba461a2..befd1af19dfe 100644
--- a/drivers/char/drm/drm_lock.c
+++ b/drivers/char/drm/drm_lock.c
@@ -35,9 +35,6 @@
35 35
36#include "drmP.h" 36#include "drmP.h"
37 37
38static int drm_lock_transfer(drm_device_t * dev,
39 __volatile__ unsigned int *lock,
40 unsigned int context);
41static int drm_notifier(void *priv); 38static int drm_notifier(void *priv);
42 39
43/** 40/**
@@ -80,6 +77,9 @@ int drm_lock(struct inode *inode, struct file *filp,
80 return -EINVAL; 77 return -EINVAL;
81 78
82 add_wait_queue(&dev->lock.lock_queue, &entry); 79 add_wait_queue(&dev->lock.lock_queue, &entry);
80 spin_lock(&dev->lock.spinlock);
81 dev->lock.user_waiters++;
82 spin_unlock(&dev->lock.spinlock);
83 for (;;) { 83 for (;;) {
84 __set_current_state(TASK_INTERRUPTIBLE); 84 __set_current_state(TASK_INTERRUPTIBLE);
85 if (!dev->lock.hw_lock) { 85 if (!dev->lock.hw_lock) {
@@ -87,7 +87,7 @@ int drm_lock(struct inode *inode, struct file *filp,
87 ret = -EINTR; 87 ret = -EINTR;
88 break; 88 break;
89 } 89 }
90 if (drm_lock_take(&dev->lock.hw_lock->lock, lock.context)) { 90 if (drm_lock_take(&dev->lock, lock.context)) {
91 dev->lock.filp = filp; 91 dev->lock.filp = filp;
92 dev->lock.lock_time = jiffies; 92 dev->lock.lock_time = jiffies;
93 atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); 93 atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
@@ -101,12 +101,14 @@ int drm_lock(struct inode *inode, struct file *filp,
101 break; 101 break;
102 } 102 }
103 } 103 }
104 spin_lock(&dev->lock.spinlock);
105 dev->lock.user_waiters--;
106 spin_unlock(&dev->lock.spinlock);
104 __set_current_state(TASK_RUNNING); 107 __set_current_state(TASK_RUNNING);
105 remove_wait_queue(&dev->lock.lock_queue, &entry); 108 remove_wait_queue(&dev->lock.lock_queue, &entry);
106 109
107 DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); 110 DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" );
108 if (ret) 111 if (ret) return ret;
109 return ret;
110 112
111 sigemptyset(&dev->sigmask); 113 sigemptyset(&dev->sigmask);
112 sigaddset(&dev->sigmask, SIGSTOP); 114 sigaddset(&dev->sigmask, SIGSTOP);
@@ -127,14 +129,12 @@ int drm_lock(struct inode *inode, struct file *filp,
127 } 129 }
128 } 130 }
129 131
130 /* dev->driver->kernel_context_switch isn't used by any of the x86
131 * drivers but is used by the Sparc driver.
132 */
133 if (dev->driver->kernel_context_switch && 132 if (dev->driver->kernel_context_switch &&
134 dev->last_context != lock.context) { 133 dev->last_context != lock.context) {
135 dev->driver->kernel_context_switch(dev, dev->last_context, 134 dev->driver->kernel_context_switch(dev, dev->last_context,
136 lock.context); 135 lock.context);
137 } 136 }
137
138 return 0; 138 return 0;
139} 139}
140 140
@@ -184,12 +184,8 @@ int drm_unlock(struct inode *inode, struct file *filp,
184 if (dev->driver->kernel_context_switch_unlock) 184 if (dev->driver->kernel_context_switch_unlock)
185 dev->driver->kernel_context_switch_unlock(dev); 185 dev->driver->kernel_context_switch_unlock(dev);
186 else { 186 else {
187 drm_lock_transfer(dev, &dev->lock.hw_lock->lock, 187 if (drm_lock_free(&dev->lock,lock.context)) {
188 DRM_KERNEL_CONTEXT); 188 /* FIXME: Should really bail out here. */
189
190 if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
191 DRM_KERNEL_CONTEXT)) {
192 DRM_ERROR("\n");
193 } 189 }
194 } 190 }
195 191
@@ -206,18 +202,26 @@ int drm_unlock(struct inode *inode, struct file *filp,
206 * 202 *
207 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction. 203 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
208 */ 204 */
209int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) 205int drm_lock_take(drm_lock_data_t *lock_data,
206 unsigned int context)
210{ 207{
211 unsigned int old, new, prev; 208 unsigned int old, new, prev;
209 volatile unsigned int *lock = &lock_data->hw_lock->lock;
212 210
211 spin_lock(&lock_data->spinlock);
213 do { 212 do {
214 old = *lock; 213 old = *lock;
215 if (old & _DRM_LOCK_HELD) 214 if (old & _DRM_LOCK_HELD)
216 new = old | _DRM_LOCK_CONT; 215 new = old | _DRM_LOCK_CONT;
217 else 216 else {
218 new = context | _DRM_LOCK_HELD; 217 new = context | _DRM_LOCK_HELD |
218 ((lock_data->user_waiters + lock_data->kernel_waiters > 1) ?
219 _DRM_LOCK_CONT : 0);
220 }
219 prev = cmpxchg(lock, old, new); 221 prev = cmpxchg(lock, old, new);
220 } while (prev != old); 222 } while (prev != old);
223 spin_unlock(&lock_data->spinlock);
224
221 if (_DRM_LOCKING_CONTEXT(old) == context) { 225 if (_DRM_LOCKING_CONTEXT(old) == context) {
222 if (old & _DRM_LOCK_HELD) { 226 if (old & _DRM_LOCK_HELD) {
223 if (context != DRM_KERNEL_CONTEXT) { 227 if (context != DRM_KERNEL_CONTEXT) {
@@ -227,7 +231,8 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
227 return 0; 231 return 0;
228 } 232 }
229 } 233 }
230 if (new == (context | _DRM_LOCK_HELD)) { 234
235 if ((_DRM_LOCKING_CONTEXT(new)) == context && (new & _DRM_LOCK_HELD)) {
231 /* Have lock */ 236 /* Have lock */
232 return 1; 237 return 1;
233 } 238 }
@@ -246,13 +251,13 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
246 * Resets the lock file pointer. 251 * Resets the lock file pointer.
247 * Marks the lock as held by the given context, via the \p cmpxchg instruction. 252 * Marks the lock as held by the given context, via the \p cmpxchg instruction.
248 */ 253 */
249static int drm_lock_transfer(drm_device_t * dev, 254static int drm_lock_transfer(drm_lock_data_t *lock_data,
250 __volatile__ unsigned int *lock,
251 unsigned int context) 255 unsigned int context)
252{ 256{
253 unsigned int old, new, prev; 257 unsigned int old, new, prev;
258 volatile unsigned int *lock = &lock_data->hw_lock->lock;
254 259
255 dev->lock.filp = NULL; 260 lock_data->filp = NULL;
256 do { 261 do {
257 old = *lock; 262 old = *lock;
258 new = context | _DRM_LOCK_HELD; 263 new = context | _DRM_LOCK_HELD;
@@ -272,23 +277,32 @@ static int drm_lock_transfer(drm_device_t * dev,
272 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task 277 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
273 * waiting on the lock queue. 278 * waiting on the lock queue.
274 */ 279 */
275int drm_lock_free(drm_device_t * dev, 280int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context)
276 __volatile__ unsigned int *lock, unsigned int context)
277{ 281{
278 unsigned int old, new, prev; 282 unsigned int old, new, prev;
283 volatile unsigned int *lock = &lock_data->hw_lock->lock;
284
285 spin_lock(&lock_data->spinlock);
286 if (lock_data->kernel_waiters != 0) {
287 drm_lock_transfer(lock_data, 0);
288 lock_data->idle_has_lock = 1;
289 spin_unlock(&lock_data->spinlock);
290 return 1;
291 }
292 spin_unlock(&lock_data->spinlock);
279 293
280 dev->lock.filp = NULL;
281 do { 294 do {
282 old = *lock; 295 old = *lock;
283 new = 0; 296 new = _DRM_LOCKING_CONTEXT(old);
284 prev = cmpxchg(lock, old, new); 297 prev = cmpxchg(lock, old, new);
285 } while (prev != old); 298 } while (prev != old);
299
286 if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { 300 if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
287 DRM_ERROR("%d freed heavyweight lock held by %d\n", 301 DRM_ERROR("%d freed heavyweight lock held by %d\n",
288 context, _DRM_LOCKING_CONTEXT(old)); 302 context, _DRM_LOCKING_CONTEXT(old));
289 return 1; 303 return 1;
290 } 304 }
291 wake_up_interruptible(&dev->lock.lock_queue); 305 wake_up_interruptible(&lock_data->lock_queue);
292 return 0; 306 return 0;
293} 307}
294 308
@@ -322,3 +336,67 @@ static int drm_notifier(void *priv)
322 } while (prev != old); 336 } while (prev != old);
323 return 0; 337 return 0;
324} 338}
339
340/**
341 * This function returns immediately and takes the hw lock
342 * with the kernel context if it is free, otherwise it gets the highest priority when and if
343 * it is eventually released.
344 *
345 * This guarantees that the kernel will _eventually_ have the lock _unless_ it is held
346 * by a blocked process. (In the latter case an explicit wait for the hardware lock would cause
347 * a deadlock, which is why the "idlelock" was invented).
348 *
349 * This should be sufficient to wait for GPU idle without
350 * having to worry about starvation.
351 */
352
353void drm_idlelock_take(drm_lock_data_t *lock_data)
354{
355 int ret = 0;
356
357 spin_lock(&lock_data->spinlock);
358 lock_data->kernel_waiters++;
359 if (!lock_data->idle_has_lock) {
360
361 spin_unlock(&lock_data->spinlock);
362 ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT);
363 spin_lock(&lock_data->spinlock);
364
365 if (ret == 1)
366 lock_data->idle_has_lock = 1;
367 }
368 spin_unlock(&lock_data->spinlock);
369}
370EXPORT_SYMBOL(drm_idlelock_take);
371
372void drm_idlelock_release(drm_lock_data_t *lock_data)
373{
374 unsigned int old, prev;
375 volatile unsigned int *lock = &lock_data->hw_lock->lock;
376
377 spin_lock(&lock_data->spinlock);
378 if (--lock_data->kernel_waiters == 0) {
379 if (lock_data->idle_has_lock) {
380 do {
381 old = *lock;
382 prev = cmpxchg(lock, old, DRM_KERNEL_CONTEXT);
383 } while (prev != old);
384 wake_up_interruptible(&lock_data->lock_queue);
385 lock_data->idle_has_lock = 0;
386 }
387 }
388 spin_unlock(&lock_data->spinlock);
389}
390EXPORT_SYMBOL(drm_idlelock_release);
391
392
393int drm_i_have_hw_lock(struct file *filp)
394{
395 DRM_DEVICE;
396
397 return (priv->lock_count && dev->lock.hw_lock &&
398 _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
399 dev->lock.filp == filp);
400}
401
402EXPORT_SYMBOL(drm_i_have_hw_lock);
diff --git a/drivers/char/drm/drm_mm.c b/drivers/char/drm/drm_mm.c
index 9b46b85027d0..2ec1d9f26264 100644
--- a/drivers/char/drm/drm_mm.c
+++ b/drivers/char/drm/drm_mm.c
@@ -274,7 +274,6 @@ int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size)
274 return drm_mm_create_tail_node(mm, start, size); 274 return drm_mm_create_tail_node(mm, start, size);
275} 275}
276 276
277EXPORT_SYMBOL(drm_mm_init);
278 277
279void drm_mm_takedown(drm_mm_t * mm) 278void drm_mm_takedown(drm_mm_t * mm)
280{ 279{
@@ -295,4 +294,3 @@ void drm_mm_takedown(drm_mm_t * mm)
295 drm_free(entry, sizeof(*entry), DRM_MEM_MM); 294 drm_free(entry, sizeof(*entry), DRM_MEM_MM);
296} 295}
297 296
298EXPORT_SYMBOL(drm_mm_takedown);
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index ad54b845978b..01cf482d2d00 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -230,10 +230,10 @@
230 {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 230 {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
231 {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 231 {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
232 {0x1106, 0x3304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 232 {0x1106, 0x3304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
233 {0x1106, 0x3157, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
234 {0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 233 {0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
235 {0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 234 {0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
236 {0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \ 235 {0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \
236 {0x1106, 0x3157, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \
237 {0, 0, 0} 237 {0, 0, 0}
238 238
239#define i810_PCI_IDS \ 239#define i810_PCI_IDS \
@@ -296,5 +296,6 @@
296 {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 296 {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
297 {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 297 {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
298 {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 298 {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
299 {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
299 {0, 0, 0} 300 {0, 0, 0}
300 301
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c
index 7fd0da712142..b204498d1a28 100644
--- a/drivers/char/drm/drm_proc.c
+++ b/drivers/char/drm/drm_proc.c
@@ -72,7 +72,7 @@ static struct drm_proc_list {
72#endif 72#endif
73}; 73};
74 74
75#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0])) 75#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
76 76
77/** 77/**
78 * Initialize the DRI proc filesystem for a device. 78 * Initialize the DRI proc filesystem for a device.
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 120d10256feb..19408adcc775 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -62,6 +62,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
62 spin_lock_init(&dev->count_lock); 62 spin_lock_init(&dev->count_lock);
63 spin_lock_init(&dev->drw_lock); 63 spin_lock_init(&dev->drw_lock);
64 spin_lock_init(&dev->tasklet_lock); 64 spin_lock_init(&dev->tasklet_lock);
65 spin_lock_init(&dev->lock.spinlock);
65 init_timer(&dev->timer); 66 init_timer(&dev->timer);
66 mutex_init(&dev->struct_mutex); 67 mutex_init(&dev->struct_mutex);
67 mutex_init(&dev->ctxlist_mutex); 68 mutex_init(&dev->ctxlist_mutex);
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index 54a632848955..35540cfb43dd 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -41,6 +41,30 @@
41static void drm_vm_open(struct vm_area_struct *vma); 41static void drm_vm_open(struct vm_area_struct *vma);
42static void drm_vm_close(struct vm_area_struct *vma); 42static void drm_vm_close(struct vm_area_struct *vma);
43 43
44static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
45{
46 pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
47
48#if defined(__i386__) || defined(__x86_64__)
49 if (boot_cpu_data.x86 > 3 && map_type != _DRM_AGP) {
50 pgprot_val(tmp) |= _PAGE_PCD;
51 pgprot_val(tmp) &= ~_PAGE_PWT;
52 }
53#elif defined(__powerpc__)
54 pgprot_val(tmp) |= _PAGE_NO_CACHE;
55 if (map_type == _DRM_REGISTERS)
56 pgprot_val(tmp) |= _PAGE_GUARDED;
57#endif
58#if defined(__ia64__)
59 if (efi_range_is_wc(vma->vm_start, vma->vm_end -
60 vma->vm_start))
61 tmp = pgprot_writecombine(tmp);
62 else
63 tmp = pgprot_noncached(tmp);
64#endif
65 return tmp;
66}
67
44/** 68/**
45 * \c nopage method for AGP virtual memory. 69 * \c nopage method for AGP virtual memory.
46 * 70 *
@@ -151,8 +175,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
151 175
152 offset = address - vma->vm_start; 176 offset = address - vma->vm_start;
153 i = (unsigned long)map->handle + offset; 177 i = (unsigned long)map->handle + offset;
154 page = (map->type == _DRM_CONSISTENT) ? 178 page = vmalloc_to_page((void *)i);
155 virt_to_page((void *)i) : vmalloc_to_page((void *)i);
156 if (!page) 179 if (!page)
157 return NOPAGE_SIGBUS; 180 return NOPAGE_SIGBUS;
158 get_page(page); 181 get_page(page);
@@ -389,7 +412,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
389 * Create a new drm_vma_entry structure as the \p vma private data entry and 412 * Create a new drm_vma_entry structure as the \p vma private data entry and
390 * add it to drm_device::vmalist. 413 * add it to drm_device::vmalist.
391 */ 414 */
392static void drm_vm_open(struct vm_area_struct *vma) 415static void drm_vm_open_locked(struct vm_area_struct *vma)
393{ 416{
394 drm_file_t *priv = vma->vm_file->private_data; 417 drm_file_t *priv = vma->vm_file->private_data;
395 drm_device_t *dev = priv->head->dev; 418 drm_device_t *dev = priv->head->dev;
@@ -401,15 +424,23 @@ static void drm_vm_open(struct vm_area_struct *vma)
401 424
402 vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); 425 vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
403 if (vma_entry) { 426 if (vma_entry) {
404 mutex_lock(&dev->struct_mutex);
405 vma_entry->vma = vma; 427 vma_entry->vma = vma;
406 vma_entry->next = dev->vmalist; 428 vma_entry->next = dev->vmalist;
407 vma_entry->pid = current->pid; 429 vma_entry->pid = current->pid;
408 dev->vmalist = vma_entry; 430 dev->vmalist = vma_entry;
409 mutex_unlock(&dev->struct_mutex);
410 } 431 }
411} 432}
412 433
434static void drm_vm_open(struct vm_area_struct *vma)
435{
436 drm_file_t *priv = vma->vm_file->private_data;
437 drm_device_t *dev = priv->head->dev;
438
439 mutex_lock(&dev->struct_mutex);
440 drm_vm_open_locked(vma);
441 mutex_unlock(&dev->struct_mutex);
442}
443
413/** 444/**
414 * \c close method for all virtual memory types. 445 * \c close method for all virtual memory types.
415 * 446 *
@@ -460,7 +491,6 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
460 drm_device_dma_t *dma; 491 drm_device_dma_t *dma;
461 unsigned long length = vma->vm_end - vma->vm_start; 492 unsigned long length = vma->vm_end - vma->vm_start;
462 493
463 lock_kernel();
464 dev = priv->head->dev; 494 dev = priv->head->dev;
465 dma = dev->dma; 495 dma = dev->dma;
466 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n", 496 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
@@ -468,10 +498,8 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
468 498
469 /* Length must match exact page count */ 499 /* Length must match exact page count */
470 if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { 500 if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
471 unlock_kernel();
472 return -EINVAL; 501 return -EINVAL;
473 } 502 }
474 unlock_kernel();
475 503
476 if (!capable(CAP_SYS_ADMIN) && 504 if (!capable(CAP_SYS_ADMIN) &&
477 (dma->flags & _DRM_DMA_USE_PCI_RO)) { 505 (dma->flags & _DRM_DMA_USE_PCI_RO)) {
@@ -494,7 +522,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
494 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 522 vma->vm_flags |= VM_RESERVED; /* Don't swap */
495 523
496 vma->vm_file = filp; /* Needed for drm_vm_open() */ 524 vma->vm_file = filp; /* Needed for drm_vm_open() */
497 drm_vm_open(vma); 525 drm_vm_open_locked(vma);
498 return 0; 526 return 0;
499} 527}
500 528
@@ -529,7 +557,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
529 * according to the mapping type and remaps the pages. Finally sets the file 557 * according to the mapping type and remaps the pages. Finally sets the file
530 * pointer and calls vm_open(). 558 * pointer and calls vm_open().
531 */ 559 */
532int drm_mmap(struct file *filp, struct vm_area_struct *vma) 560static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
533{ 561{
534 drm_file_t *priv = filp->private_data; 562 drm_file_t *priv = filp->private_data;
535 drm_device_t *dev = priv->head->dev; 563 drm_device_t *dev = priv->head->dev;
@@ -565,7 +593,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
565 return -EPERM; 593 return -EPERM;
566 594
567 /* Check for valid size. */ 595 /* Check for valid size. */
568 if (map->size != vma->vm_end - vma->vm_start) 596 if (map->size < vma->vm_end - vma->vm_start)
569 return -EINVAL; 597 return -EINVAL;
570 598
571 if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { 599 if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
@@ -600,37 +628,16 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
600 /* fall through to _DRM_FRAME_BUFFER... */ 628 /* fall through to _DRM_FRAME_BUFFER... */
601 case _DRM_FRAME_BUFFER: 629 case _DRM_FRAME_BUFFER:
602 case _DRM_REGISTERS: 630 case _DRM_REGISTERS:
603#if defined(__i386__) || defined(__x86_64__)
604 if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) {
605 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
606 pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
607 }
608#elif defined(__powerpc__)
609 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
610 if (map->type == _DRM_REGISTERS)
611 pgprot_val(vma->vm_page_prot) |= _PAGE_GUARDED;
612#endif
613 vma->vm_flags |= VM_IO; /* not in core dump */
614#if defined(__ia64__)
615 if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
616 vma->vm_page_prot =
617 pgprot_writecombine(vma->vm_page_prot);
618 else
619 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
620#endif
621 offset = dev->driver->get_reg_ofs(dev); 631 offset = dev->driver->get_reg_ofs(dev);
632 vma->vm_flags |= VM_IO; /* not in core dump */
633 vma->vm_page_prot = drm_io_prot(map->type, vma);
622#ifdef __sparc__ 634#ifdef __sparc__
623 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 635 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
636#endif
624 if (io_remap_pfn_range(vma, vma->vm_start, 637 if (io_remap_pfn_range(vma, vma->vm_start,
625 (map->offset + offset) >> PAGE_SHIFT, 638 (map->offset + offset) >> PAGE_SHIFT,
626 vma->vm_end - vma->vm_start, 639 vma->vm_end - vma->vm_start,
627 vma->vm_page_prot)) 640 vma->vm_page_prot))
628#else
629 if (io_remap_pfn_range(vma, vma->vm_start,
630 (map->offset + offset) >> PAGE_SHIFT,
631 vma->vm_end - vma->vm_start,
632 vma->vm_page_prot))
633#endif
634 return -EAGAIN; 641 return -EAGAIN;
635 DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," 642 DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx,"
636 " offset = 0x%lx\n", 643 " offset = 0x%lx\n",
@@ -638,10 +645,15 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
638 vma->vm_start, vma->vm_end, map->offset + offset); 645 vma->vm_start, vma->vm_end, map->offset + offset);
639 vma->vm_ops = &drm_vm_ops; 646 vma->vm_ops = &drm_vm_ops;
640 break; 647 break;
641 case _DRM_SHM:
642 case _DRM_CONSISTENT: 648 case _DRM_CONSISTENT:
643 /* Consistent memory is really like shared memory. It's only 649 /* Consistent memory is really like shared memory. But
644 * allocate in a different way */ 650 * it's allocated in a different way, so avoid nopage */
651 if (remap_pfn_range(vma, vma->vm_start,
652 page_to_pfn(virt_to_page(map->handle)),
653 vma->vm_end - vma->vm_start, vma->vm_page_prot))
654 return -EAGAIN;
655 /* fall through to _DRM_SHM */
656 case _DRM_SHM:
645 vma->vm_ops = &drm_vm_shm_ops; 657 vma->vm_ops = &drm_vm_shm_ops;
646 vma->vm_private_data = (void *)map; 658 vma->vm_private_data = (void *)map;
647 /* Don't let this area swap. Change when 659 /* Don't let this area swap. Change when
@@ -659,8 +671,20 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
659 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 671 vma->vm_flags |= VM_RESERVED; /* Don't swap */
660 672
661 vma->vm_file = filp; /* Needed for drm_vm_open() */ 673 vma->vm_file = filp; /* Needed for drm_vm_open() */
662 drm_vm_open(vma); 674 drm_vm_open_locked(vma);
663 return 0; 675 return 0;
664} 676}
665 677
678int drm_mmap(struct file *filp, struct vm_area_struct *vma)
679{
680 drm_file_t *priv = filp->private_data;
681 drm_device_t *dev = priv->head->dev;
682 int ret;
683
684 mutex_lock(&dev->struct_mutex);
685 ret = drm_mmap_locked(filp, vma);
686 mutex_unlock(&dev->struct_mutex);
687
688 return ret;
689}
666EXPORT_SYMBOL(drm_mmap); 690EXPORT_SYMBOL(drm_mmap);
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 9354ce3b0093..1ba15d9a171a 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -34,7 +34,8 @@
34#define IS_I965G(dev) (dev->pci_device == 0x2972 || \ 34#define IS_I965G(dev) (dev->pci_device == 0x2972 || \
35 dev->pci_device == 0x2982 || \ 35 dev->pci_device == 0x2982 || \
36 dev->pci_device == 0x2992 || \ 36 dev->pci_device == 0x2992 || \
37 dev->pci_device == 0x29A2) 37 dev->pci_device == 0x29A2 || \
38 dev->pci_device == 0x2A02)
38 39
39/* Really want an OS-independent resettable timer. Would like to have 40/* Really want an OS-independent resettable timer. Would like to have
40 * this loop run for (eg) 3 sec, but have the timer reset every time 41 * this loop run for (eg) 3 sec, but have the timer reset every time
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 5ed965688293..c1850ecac302 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1560,8 +1560,8 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1560 if (dev_priv->flags & RADEON_IS_AGP) { 1560 if (dev_priv->flags & RADEON_IS_AGP) {
1561 base = dev->agp->base; 1561 base = dev->agp->base;
1562 /* Check if valid */ 1562 /* Check if valid */
1563 if ((base + dev_priv->gart_size) > dev_priv->fb_location && 1563 if ((base + dev_priv->gart_size - 1) >= dev_priv->fb_location &&
1564 base < (dev_priv->fb_location + dev_priv->fb_size)) { 1564 base < (dev_priv->fb_location + dev_priv->fb_size - 1)) {
1565 DRM_INFO("Can't use AGP base @0x%08lx, won't fit\n", 1565 DRM_INFO("Can't use AGP base @0x%08lx, won't fit\n",
1566 dev->agp->base); 1566 dev->agp->base);
1567 base = 0; 1567 base = 0;
@@ -1571,8 +1571,8 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1571 /* If not or if AGP is at 0 (Macs), try to put it elsewhere */ 1571 /* If not or if AGP is at 0 (Macs), try to put it elsewhere */
1572 if (base == 0) { 1572 if (base == 0) {
1573 base = dev_priv->fb_location + dev_priv->fb_size; 1573 base = dev_priv->fb_location + dev_priv->fb_size;
1574 if (((base + dev_priv->gart_size) & 0xfffffffful) 1574 if (base < dev_priv->fb_location ||
1575 < base) 1575 ((base + dev_priv->gart_size) & 0xfffffffful) < base)
1576 base = dev_priv->fb_location 1576 base = dev_priv->fb_location
1577 - dev_priv->gart_size; 1577 - dev_priv->gart_size;
1578 } 1578 }
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c
index 3d5b3218b6ff..690e0af8e7c2 100644
--- a/drivers/char/drm/sis_drv.c
+++ b/drivers/char/drm/sis_drv.c
@@ -71,7 +71,7 @@ static struct drm_driver driver = {
71 .context_dtor = NULL, 71 .context_dtor = NULL,
72 .dma_quiescent = sis_idle, 72 .dma_quiescent = sis_idle,
73 .reclaim_buffers = NULL, 73 .reclaim_buffers = NULL,
74 .reclaim_buffers_locked = sis_reclaim_buffers_locked, 74 .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
75 .lastclose = sis_lastclose, 75 .lastclose = sis_lastclose,
76 .get_map_ofs = drm_core_get_map_ofs, 76 .get_map_ofs = drm_core_get_map_ofs,
77 .get_reg_ofs = drm_core_get_reg_ofs, 77 .get_reg_ofs = drm_core_get_reg_ofs,
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c
index bb9dde8b1911..2d4957ab256a 100644
--- a/drivers/char/drm/via_drv.c
+++ b/drivers/char/drm/via_drv.c
@@ -52,7 +52,8 @@ static struct drm_driver driver = {
52 .dma_quiescent = via_driver_dma_quiescent, 52 .dma_quiescent = via_driver_dma_quiescent,
53 .dri_library_name = dri_library_name, 53 .dri_library_name = dri_library_name,
54 .reclaim_buffers = drm_core_reclaim_buffers, 54 .reclaim_buffers = drm_core_reclaim_buffers,
55 .reclaim_buffers_locked = via_reclaim_buffers_locked, 55 .reclaim_buffers_locked = NULL,
56 .reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
56 .lastclose = via_lastclose, 57 .lastclose = via_lastclose,
57 .get_map_ofs = drm_core_get_map_ofs, 58 .get_map_ofs = drm_core_get_map_ofs,
58 .get_reg_ofs = drm_core_get_reg_ofs, 59 .get_reg_ofs = drm_core_get_reg_ofs,
diff --git a/drivers/char/drm/via_mm.h b/drivers/char/drm/via_mm.h
deleted file mode 100644
index d57efda57c76..000000000000
--- a/drivers/char/drm/via_mm.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24#ifndef _via_drm_mm_h_
25#define _via_drm_mm_h_
26
27typedef struct {
28 unsigned int context;
29 unsigned int size;
30 unsigned long offset;
31 unsigned long free;
32} drm_via_mm_t;
33
34typedef struct {
35 unsigned int size;
36 unsigned long handle;
37 void *virtual;
38} drm_via_dma_t;
39
40#endif
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c
index 9ebf84d18655..ec435cb25c4f 100644
--- a/drivers/char/hw_random/via-rng.c
+++ b/drivers/char/hw_random/via-rng.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/pci.h>
30#include <linux/hw_random.h> 29#include <linux/hw_random.h>
31#include <asm/io.h> 30#include <asm/io.h>
32#include <asm/msr.h> 31#include <asm/msr.h>
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index cb8d691576da..c06e86ad1dab 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -41,7 +41,6 @@
41#include <linux/input.h> 41#include <linux/input.h>
42#include <linux/reboot.h> 42#include <linux/reboot.h>
43 43
44static void kbd_disconnect(struct input_handle *handle);
45extern void ctrl_alt_del(void); 44extern void ctrl_alt_del(void);
46 45
47/* 46/*
@@ -159,65 +158,41 @@ static int sysrq_alt_use;
159static int sysrq_alt; 158static int sysrq_alt;
160 159
161/* 160/*
162 * Translation of scancodes to keycodes. We set them on only the first attached 161 * Translation of scancodes to keycodes. We set them on only the first
163 * keyboard - for per-keyboard setting, /dev/input/event is more useful. 162 * keyboard in the list that accepts the scancode and keycode.
163 * Explanation for not choosing the first attached keyboard anymore:
164 * USB keyboards for example have two event devices: one for all "normal"
165 * keys and one for extra function keys (like "volume up", "make coffee",
166 * etc.). So this means that scancodes for the extra function keys won't
167 * be valid for the first event device, but will be for the second.
164 */ 168 */
165int getkeycode(unsigned int scancode) 169int getkeycode(unsigned int scancode)
166{ 170{
167 struct list_head *node; 171 struct input_handle *handle;
168 struct input_dev *dev = NULL; 172 int keycode;
173 int error = -ENODEV;
169 174
170 list_for_each(node, &kbd_handler.h_list) { 175 list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
171 struct input_handle *handle = to_handle_h(node); 176 error = handle->dev->getkeycode(handle->dev, scancode, &keycode);
172 if (handle->dev->keycodesize) { 177 if (!error)
173 dev = handle->dev; 178 return keycode;
174 break;
175 }
176 } 179 }
177 180
178 if (!dev) 181 return error;
179 return -ENODEV;
180
181 if (scancode >= dev->keycodemax)
182 return -EINVAL;
183
184 return INPUT_KEYCODE(dev, scancode);
185} 182}
186 183
187int setkeycode(unsigned int scancode, unsigned int keycode) 184int setkeycode(unsigned int scancode, unsigned int keycode)
188{ 185{
189 struct list_head *node; 186 struct input_handle *handle;
190 struct input_dev *dev = NULL; 187 int error = -ENODEV;
191 unsigned int i, oldkey;
192 188
193 list_for_each(node, &kbd_handler.h_list) { 189 list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
194 struct input_handle *handle = to_handle_h(node); 190 error = handle->dev->setkeycode(handle->dev, scancode, keycode);
195 if (handle->dev->keycodesize) { 191 if (!error)
196 dev = handle->dev;
197 break; 192 break;
198 }
199 } 193 }
200 194
201 if (!dev) 195 return error;
202 return -ENODEV;
203
204 if (scancode >= dev->keycodemax)
205 return -EINVAL;
206 if (keycode < 0 || keycode > KEY_MAX)
207 return -EINVAL;
208 if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
209 return -EINVAL;
210
211 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
212
213 clear_bit(oldkey, dev->keybit);
214 set_bit(keycode, dev->keybit);
215
216 for (i = 0; i < dev->keycodemax; i++)
217 if (INPUT_KEYCODE(dev,i) == oldkey)
218 set_bit(oldkey, dev->keybit);
219
220 return 0;
221} 196}
222 197
223/* 198/*
@@ -225,10 +200,9 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
225 */ 200 */
226static void kd_nosound(unsigned long ignored) 201static void kd_nosound(unsigned long ignored)
227{ 202{
228 struct list_head *node; 203 struct input_handle *handle;
229 204
230 list_for_each(node, &kbd_handler.h_list) { 205 list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
231 struct input_handle *handle = to_handle_h(node);
232 if (test_bit(EV_SND, handle->dev->evbit)) { 206 if (test_bit(EV_SND, handle->dev->evbit)) {
233 if (test_bit(SND_TONE, handle->dev->sndbit)) 207 if (test_bit(SND_TONE, handle->dev->sndbit))
234 input_inject_event(handle, EV_SND, SND_TONE, 0); 208 input_inject_event(handle, EV_SND, SND_TONE, 0);
@@ -1161,7 +1135,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1161 1135
1162 if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) 1136 if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw)
1163 if (emulate_raw(vc, keycode, !down << 7)) 1137 if (emulate_raw(vc, keycode, !down << 7))
1164 if (keycode < BTN_MISC) 1138 if (keycode < BTN_MISC && printk_ratelimit())
1165 printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode); 1139 printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
1166 1140
1167#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ 1141#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
@@ -1285,11 +1259,11 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type,
1285 * likes it, it can open it and get events from it. In this (kbd_connect) 1259 * likes it, it can open it and get events from it. In this (kbd_connect)
1286 * function, we should decide which VT to bind that keyboard to initially. 1260 * function, we should decide which VT to bind that keyboard to initially.
1287 */ 1261 */
1288static struct input_handle *kbd_connect(struct input_handler *handler, 1262static int kbd_connect(struct input_handler *handler, struct input_dev *dev,
1289 struct input_dev *dev, 1263 const struct input_device_id *id)
1290 const struct input_device_id *id)
1291{ 1264{
1292 struct input_handle *handle; 1265 struct input_handle *handle;
1266 int error;
1293 int i; 1267 int i;
1294 1268
1295 for (i = KEY_RESERVED; i < BTN_MISC; i++) 1269 for (i = KEY_RESERVED; i < BTN_MISC; i++)
@@ -1297,24 +1271,37 @@ static struct input_handle *kbd_connect(struct input_handler *handler,
1297 break; 1271 break;
1298 1272
1299 if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) 1273 if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit))
1300 return NULL; 1274 return -ENODEV;
1301 1275
1302 handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); 1276 handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
1303 if (!handle) 1277 if (!handle)
1304 return NULL; 1278 return -ENOMEM;
1305 1279
1306 handle->dev = dev; 1280 handle->dev = dev;
1307 handle->handler = handler; 1281 handle->handler = handler;
1308 handle->name = "kbd"; 1282 handle->name = "kbd";
1309 1283
1310 input_open_device(handle); 1284 error = input_register_handle(handle);
1285 if (error)
1286 goto err_free_handle;
1287
1288 error = input_open_device(handle);
1289 if (error)
1290 goto err_unregister_handle;
1291
1292 return 0;
1311 1293
1312 return handle; 1294 err_unregister_handle:
1295 input_unregister_handle(handle);
1296 err_free_handle:
1297 kfree(handle);
1298 return error;
1313} 1299}
1314 1300
1315static void kbd_disconnect(struct input_handle *handle) 1301static void kbd_disconnect(struct input_handle *handle)
1316{ 1302{
1317 input_close_device(handle); 1303 input_close_device(handle);
1304 input_unregister_handle(handle);
1318 kfree(handle); 1305 kfree(handle);
1319} 1306}
1320 1307
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 157b1d09ab55..13808f6083a0 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -42,7 +42,6 @@
42#include <linux/timer.h> 42#include <linux/timer.h>
43#include <linux/time.h> 43#include <linux/time.h>
44#include <linux/interrupt.h> 44#include <linux/interrupt.h>
45#include <linux/pci.h>
46#include <linux/tty.h> 45#include <linux/tty.h>
47#include <linux/tty_flip.h> 46#include <linux/tty_flip.h>
48#include <linux/serial.h> 47#include <linux/serial.h>
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index bb9a43c6cf3d..9f273f032b0f 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/fs.h> 23#include <linux/fs.h>
25#include <linux/sched.h> 24#include <linux/sched.h>
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7a32df594907..389da364e6b6 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3720,11 +3720,10 @@ int tty_register_driver(struct tty_driver *driver)
3720 if (driver->flags & TTY_DRIVER_INSTALLED) 3720 if (driver->flags & TTY_DRIVER_INSTALLED)
3721 return 0; 3721 return 0;
3722 3722
3723 if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM)) { 3723 if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM) && driver->num) {
3724 p = kmalloc(driver->num * 3 * sizeof(void *), GFP_KERNEL); 3724 p = kzalloc(driver->num * 3 * sizeof(void *), GFP_KERNEL);
3725 if (!p) 3725 if (!p)
3726 return -ENOMEM; 3726 return -ENOMEM;
3727 memset(p, 0, driver->num * 3 * sizeof(void *));
3728 } 3727 }
3729 3728
3730 if (!driver->major) { 3729 if (!driver->major) {
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
index 1e4a8d751a71..2f7ba7a514fe 100644
--- a/drivers/char/watchdog/sc1200wdt.c
+++ b/drivers/char/watchdog/sc1200wdt.c
@@ -38,7 +38,6 @@
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/pnp.h> 39#include <linux/pnp.h>
40#include <linux/fs.h> 40#include <linux/fs.h>
41#include <linux/pci.h>
42 41
43#include <asm/semaphore.h> 42#include <asm/semaphore.h>
44#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
index fc0e0347f9d2..d4fd0fa2f176 100644
--- a/drivers/char/watchdog/scx200_wdt.c
+++ b/drivers/char/watchdog/scx200_wdt.c
@@ -25,7 +25,7 @@
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/fs.h> 27#include <linux/fs.h>
28#include <linux/pci.h> 28#include <linux/ioport.h>
29#include <linux/scx200.h> 29#include <linux/scx200.h>
30 30
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index d155e81b5c97..993fa7b89253 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -9,6 +9,9 @@ config CPU_FREQ
9 clock speed, you need to either enable a dynamic cpufreq governor 9 clock speed, you need to either enable a dynamic cpufreq governor
10 (see below) after boot, or use a userspace tool. 10 (see below) after boot, or use a userspace tool.
11 11
12 To compile this driver as a module, choose M here: the
13 module will be called cpufreq.
14
12 For details, take a look at <file:Documentation/cpu-freq>. 15 For details, take a look at <file:Documentation/cpu-freq>.
13 16
14 If in doubt, say N. 17 If in doubt, say N.
@@ -16,7 +19,7 @@ config CPU_FREQ
16if CPU_FREQ 19if CPU_FREQ
17 20
18config CPU_FREQ_TABLE 21config CPU_FREQ_TABLE
19 tristate 22 tristate
20 23
21config CPU_FREQ_DEBUG 24config CPU_FREQ_DEBUG
22 bool "Enable CPUfreq debugging" 25 bool "Enable CPUfreq debugging"
@@ -32,19 +35,26 @@ config CPU_FREQ_DEBUG
32 4 to activate CPUfreq governor debugging 35 4 to activate CPUfreq governor debugging
33 36
34config CPU_FREQ_STAT 37config CPU_FREQ_STAT
35 tristate "CPU frequency translation statistics" 38 tristate "CPU frequency translation statistics"
36 select CPU_FREQ_TABLE 39 select CPU_FREQ_TABLE
37 default y 40 default y
38 help 41 help
39 This driver exports CPU frequency statistics information through sysfs 42 This driver exports CPU frequency statistics information through sysfs
40 file system 43 file system.
44
45 To compile this driver as a module, choose M here: the
46 module will be called cpufreq_stats.
47
48 If in doubt, say N.
41 49
42config CPU_FREQ_STAT_DETAILS 50config CPU_FREQ_STAT_DETAILS
43 bool "CPU frequency translation statistics details" 51 bool "CPU frequency translation statistics details"
44 depends on CPU_FREQ_STAT 52 depends on CPU_FREQ_STAT
45 help 53 help
46 This will show detail CPU frequency translation table in sysfs file 54 This will show detail CPU frequency translation table in sysfs file
47 system 55 system.
56
57 If in doubt, say N.
48 58
49# Note that it is not currently possible to set the other governors (such as ondemand) 59# Note that it is not currently possible to set the other governors (such as ondemand)
50# as the default, since if they fail to initialise, cpufreq will be 60# as the default, since if they fail to initialise, cpufreq will be
@@ -78,29 +88,38 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE
78endchoice 88endchoice
79 89
80config CPU_FREQ_GOV_PERFORMANCE 90config CPU_FREQ_GOV_PERFORMANCE
81 tristate "'performance' governor" 91 tristate "'performance' governor"
82 help 92 help
83 This cpufreq governor sets the frequency statically to the 93 This cpufreq governor sets the frequency statically to the
84 highest available CPU frequency. 94 highest available CPU frequency.
85 95
96 To compile this driver as a module, choose M here: the
97 module will be called cpufreq_performance.
98
86 If in doubt, say Y. 99 If in doubt, say Y.
87 100
88config CPU_FREQ_GOV_POWERSAVE 101config CPU_FREQ_GOV_POWERSAVE
89 tristate "'powersave' governor" 102 tristate "'powersave' governor"
90 help 103 help
91 This cpufreq governor sets the frequency statically to the 104 This cpufreq governor sets the frequency statically to the
92 lowest available CPU frequency. 105 lowest available CPU frequency.
93 106
107 To compile this driver as a module, choose M here: the
108 module will be called cpufreq_powersave.
109
94 If in doubt, say Y. 110 If in doubt, say Y.
95 111
96config CPU_FREQ_GOV_USERSPACE 112config CPU_FREQ_GOV_USERSPACE
97 tristate "'userspace' governor for userspace frequency scaling" 113 tristate "'userspace' governor for userspace frequency scaling"
98 help 114 help
99 Enable this cpufreq governor when you either want to set the 115 Enable this cpufreq governor when you either want to set the
100 CPU frequency manually or when an userspace program shall 116 CPU frequency manually or when an userspace program shall
101 be able to set the CPU dynamically, like on LART 117 be able to set the CPU dynamically, like on LART
102 <http://www.lartmaker.nl/>. 118 <http://www.lartmaker.nl/>.
103 119
120 To compile this driver as a module, choose M here: the
121 module will be called cpufreq_userspace.
122
104 For details, take a look at <file:Documentation/cpu-freq/>. 123 For details, take a look at <file:Documentation/cpu-freq/>.
105 124
106 If in doubt, say Y. 125 If in doubt, say Y.
@@ -116,6 +135,9 @@ config CPU_FREQ_GOV_ONDEMAND
116 do fast frequency switching (i.e, very low latency frequency 135 do fast frequency switching (i.e, very low latency frequency
117 transitions). 136 transitions).
118 137
138 To compile this driver as a module, choose M here: the
139 module will be called cpufreq_ondemand.
140
119 For details, take a look at linux/Documentation/cpu-freq. 141 For details, take a look at linux/Documentation/cpu-freq.
120 142
121 If in doubt, say N. 143 If in doubt, say N.
@@ -136,6 +158,9 @@ config CPU_FREQ_GOV_CONSERVATIVE
136 step-by-step latency issues between the minimum and maximum frequency 158 step-by-step latency issues between the minimum and maximum frequency
137 transitions in the CPU) you will probably want to use this governor. 159 transitions in the CPU) you will probably want to use this governor.
138 160
161 To compile this driver as a module, choose M here: the
162 module will be called cpufreq_conservative.
163
139 For details, take a look at linux/Documentation/cpu-freq. 164 For details, take a look at linux/Documentation/cpu-freq.
140 165
141 If in doubt, say N. 166 If in doubt, say N.
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3162010900c9..893dbaf386fb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -768,6 +768,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
768 unlock_policy_rwsem_write(cpu); 768 unlock_policy_rwsem_write(cpu);
769 goto err_out; 769 goto err_out;
770 } 770 }
771 policy->user_policy.min = policy->cpuinfo.min_freq;
772 policy->user_policy.max = policy->cpuinfo.max_freq;
773 policy->user_policy.governor = policy->governor;
771 774
772#ifdef CONFIG_SMP 775#ifdef CONFIG_SMP
773 for_each_cpu_mask(j, policy->cpus) { 776 for_each_cpu_mask(j, policy->cpus) {
@@ -858,10 +861,13 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
858 861
859 policy->governor = NULL; /* to assure that the starting sequence is 862 policy->governor = NULL; /* to assure that the starting sequence is
860 * run in cpufreq_set_policy */ 863 * run in cpufreq_set_policy */
861 unlock_policy_rwsem_write(cpu);
862 864
863 /* set default policy */ 865 /* set default policy */
864 ret = cpufreq_set_policy(&new_policy); 866 ret = __cpufreq_set_policy(policy, &new_policy);
867 policy->user_policy.policy = policy->policy;
868
869 unlock_policy_rwsem_write(cpu);
870
865 if (ret) { 871 if (ret) {
866 dprintk("setting policy failed\n"); 872 dprintk("setting policy failed\n");
867 goto err_out_unregister; 873 goto err_out_unregister;
@@ -1620,43 +1626,6 @@ error_out:
1620} 1626}
1621 1627
1622/** 1628/**
1623 * cpufreq_set_policy - set a new CPUFreq policy
1624 * @policy: policy to be set.
1625 *
1626 * Sets a new CPU frequency and voltage scaling policy.
1627 */
1628int cpufreq_set_policy(struct cpufreq_policy *policy)
1629{
1630 int ret = 0;
1631 struct cpufreq_policy *data;
1632
1633 if (!policy)
1634 return -EINVAL;
1635
1636 data = cpufreq_cpu_get(policy->cpu);
1637 if (!data)
1638 return -EINVAL;
1639
1640 if (unlikely(lock_policy_rwsem_write(policy->cpu)))
1641 return -EINVAL;
1642
1643
1644 ret = __cpufreq_set_policy(data, policy);
1645 data->user_policy.min = data->min;
1646 data->user_policy.max = data->max;
1647 data->user_policy.policy = data->policy;
1648 data->user_policy.governor = data->governor;
1649
1650 unlock_policy_rwsem_write(policy->cpu);
1651
1652 cpufreq_cpu_put(data);
1653
1654 return ret;
1655}
1656EXPORT_SYMBOL(cpufreq_set_policy);
1657
1658
1659/**
1660 * cpufreq_update_policy - re-evaluate an existing cpufreq policy 1629 * cpufreq_update_policy - re-evaluate an existing cpufreq policy
1661 * @cpu: CPU which shall be re-evaluated 1630 * @cpu: CPU which shall be re-evaluated
1662 * 1631 *
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index ff8c4beaace4..f21fe66c9eef 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -1,10 +1,10 @@
1menu "Hardware crypto devices" 1menu "Hardware crypto devices"
2 2
3config CRYPTO_DEV_PADLOCK 3config CRYPTO_DEV_PADLOCK
4 tristate "Support for VIA PadLock ACE" 4 bool "Support for VIA PadLock ACE"
5 depends on X86_32 5 depends on X86_32
6 select CRYPTO_ALGAPI 6 select CRYPTO_ALGAPI
7 default m 7 default y
8 help 8 help
9 Some VIA processors come with an integrated crypto engine 9 Some VIA processors come with an integrated crypto engine
10 (so called VIA PadLock ACE, Advanced Cryptography Engine) 10 (so called VIA PadLock ACE, Advanced Cryptography Engine)
@@ -14,16 +14,6 @@ config CRYPTO_DEV_PADLOCK
14 The instructions are used only when the CPU supports them. 14 The instructions are used only when the CPU supports them.
15 Otherwise software encryption is used. 15 Otherwise software encryption is used.
16 16
17 Selecting M for this option will compile a helper module
18 padlock.ko that should autoload all below configured
19 algorithms. Don't worry if your hardware does not support
20 some or all of them. In such case padlock.ko will
21 simply write a single line into the kernel log informing
22 about its failure but everything will keep working fine.
23
24 If you are unsure, say M. The compiled module will be
25 called padlock.ko
26
27config CRYPTO_DEV_PADLOCK_AES 17config CRYPTO_DEV_PADLOCK_AES
28 tristate "PadLock driver for AES algorithm" 18 tristate "PadLock driver for AES algorithm"
29 depends on CRYPTO_DEV_PADLOCK 19 depends on CRYPTO_DEV_PADLOCK
@@ -55,7 +45,7 @@ source "arch/s390/crypto/Kconfig"
55 45
56config CRYPTO_DEV_GEODE 46config CRYPTO_DEV_GEODE
57 tristate "Support for the Geode LX AES engine" 47 tristate "Support for the Geode LX AES engine"
58 depends on CRYPTO && X86_32 && PCI 48 depends on X86_32 && PCI
59 select CRYPTO_ALGAPI 49 select CRYPTO_ALGAPI
60 select CRYPTO_BLKCIPHER 50 select CRYPTO_BLKCIPHER
61 default m 51 default m
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 6059cf869414..d070030f7d7e 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o
2obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o 1obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
3obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o 2obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
4obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o 3obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o
diff --git a/drivers/crypto/padlock.c b/drivers/crypto/padlock.c
deleted file mode 100644
index d6d7dd5bb98c..000000000000
--- a/drivers/crypto/padlock.c
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Cryptographic API.
3 *
4 * Support for VIA PadLock hardware crypto engine.
5 *
6 * Copyright (c) 2006 Michal Ludvig <michal@logix.cz>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/crypto.h>
19#include <linux/cryptohash.h>
20#include <linux/interrupt.h>
21#include <linux/kernel.h>
22#include <linux/scatterlist.h>
23#include "padlock.h"
24
25static int __init padlock_init(void)
26{
27 int success = 0;
28
29 if (crypto_has_cipher("aes-padlock", 0, 0))
30 success++;
31
32 if (crypto_has_hash("sha1-padlock", 0, 0))
33 success++;
34
35 if (crypto_has_hash("sha256-padlock", 0, 0))
36 success++;
37
38 if (!success) {
39 printk(KERN_WARNING PFX "No VIA PadLock drivers have been loaded.\n");
40 return -ENODEV;
41 }
42
43 printk(KERN_NOTICE PFX "%d drivers are available.\n", success);
44
45 return 0;
46}
47
48static void __exit padlock_fini(void)
49{
50}
51
52module_init(padlock_init);
53module_exit(padlock_fini);
54
55MODULE_DESCRIPTION("Load all configured PadLock algorithms.");
56MODULE_LICENSE("GPL");
57MODULE_AUTHOR("Michal Ludvig");
58
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index c6281ccd4fe7..1324984a4c35 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -409,7 +409,7 @@ static struct kobj_type ktype_efivar = {
409}; 409};
410 410
411static ssize_t 411static ssize_t
412dummy(struct subsystem *sub, char *buf) 412dummy(struct kset *kset, char *buf)
413{ 413{
414 return -ENODEV; 414 return -ENODEV;
415} 415}
@@ -422,7 +422,7 @@ efivar_unregister(struct efivar_entry *var)
422 422
423 423
424static ssize_t 424static ssize_t
425efivar_create(struct subsystem *sub, const char *buf, size_t count) 425efivar_create(struct kset *kset, const char *buf, size_t count)
426{ 426{
427 struct efi_variable *new_var = (struct efi_variable *)buf; 427 struct efi_variable *new_var = (struct efi_variable *)buf;
428 struct efivar_entry *search_efivar, *n; 428 struct efivar_entry *search_efivar, *n;
@@ -480,7 +480,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
480} 480}
481 481
482static ssize_t 482static ssize_t
483efivar_delete(struct subsystem *sub, const char *buf, size_t count) 483efivar_delete(struct kset *kset, const char *buf, size_t count)
484{ 484{
485 struct efi_variable *del_var = (struct efi_variable *)buf; 485 struct efi_variable *del_var = (struct efi_variable *)buf;
486 struct efivar_entry *search_efivar, *n; 486 struct efivar_entry *search_efivar, *n;
@@ -551,11 +551,11 @@ static struct subsys_attribute *var_subsys_attrs[] = {
551 * the efivars driver 551 * the efivars driver
552 */ 552 */
553static ssize_t 553static ssize_t
554systab_read(struct subsystem *entry, char *buf) 554systab_read(struct kset *kset, char *buf)
555{ 555{
556 char *str = buf; 556 char *str = buf;
557 557
558 if (!entry || !buf) 558 if (!kset || !buf)
559 return -EINVAL; 559 return -EINVAL;
560 560
561 if (efi.mps != EFI_INVALID_TABLE_ADDR) 561 if (efi.mps != EFI_INVALID_TABLE_ADDR)
@@ -687,7 +687,7 @@ efivars_init(void)
687 goto out_free; 687 goto out_free;
688 } 688 }
689 689
690 kset_set_kset_s(&vars_subsys, efi_subsys); 690 kobj_set_kset_s(&vars_subsys, efi_subsys);
691 691
692 error = subsystem_register(&vars_subsys); 692 error = subsystem_register(&vars_subsys);
693 693
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 11935f66fcd8..434a61b415a3 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -2,9 +2,7 @@
2# I2C subsystem configuration 2# I2C subsystem configuration
3# 3#
4 4
5menu "I2C support" 5menuconfig I2C
6
7config I2C
8 tristate "I2C support" 6 tristate "I2C support"
9 ---help--- 7 ---help---
10 I2C (pronounce: I-square-C) is a slow serial bus protocol used in 8 I2C (pronounce: I-square-C) is a slow serial bus protocol used in
@@ -22,9 +20,14 @@ config I2C
22 This I2C support can also be built as a module. If so, the module 20 This I2C support can also be built as a module. If so, the module
23 will be called i2c-core. 21 will be called i2c-core.
24 22
23if I2C
24
25config I2C_BOARDINFO
26 boolean
27 default y
28
25config I2C_CHARDEV 29config I2C_CHARDEV
26 tristate "I2C device interface" 30 tristate "I2C device interface"
27 depends on I2C
28 help 31 help
29 Say Y here to use i2c-* device files, usually found in the /dev 32 Say Y here to use i2c-* device files, usually found in the /dev
30 directory on your system. They make it possible to have user-space 33 directory on your system. They make it possible to have user-space
@@ -40,7 +43,6 @@ source drivers/i2c/chips/Kconfig
40 43
41config I2C_DEBUG_CORE 44config I2C_DEBUG_CORE
42 bool "I2C Core debugging messages" 45 bool "I2C Core debugging messages"
43 depends on I2C
44 help 46 help
45 Say Y here if you want the I2C core to produce a bunch of debug 47 Say Y here if you want the I2C core to produce a bunch of debug
46 messages to the system log. Select this if you are having a 48 messages to the system log. Select this if you are having a
@@ -48,7 +50,6 @@ config I2C_DEBUG_CORE
48 50
49config I2C_DEBUG_ALGO 51config I2C_DEBUG_ALGO
50 bool "I2C Algorithm debugging messages" 52 bool "I2C Algorithm debugging messages"
51 depends on I2C
52 help 53 help
53 Say Y here if you want the I2C algorithm drivers to produce a bunch 54 Say Y here if you want the I2C algorithm drivers to produce a bunch
54 of debug messages to the system log. Select this if you are having 55 of debug messages to the system log. Select this if you are having
@@ -57,7 +58,6 @@ config I2C_DEBUG_ALGO
57 58
58config I2C_DEBUG_BUS 59config I2C_DEBUG_BUS
59 bool "I2C Bus debugging messages" 60 bool "I2C Bus debugging messages"
60 depends on I2C
61 help 61 help
62 Say Y here if you want the I2C bus drivers to produce a bunch of 62 Say Y here if you want the I2C bus drivers to produce a bunch of
63 debug messages to the system log. Select this if you are having 63 debug messages to the system log. Select this if you are having
@@ -66,12 +66,10 @@ config I2C_DEBUG_BUS
66 66
67config I2C_DEBUG_CHIP 67config I2C_DEBUG_CHIP
68 bool "I2C Chip debugging messages" 68 bool "I2C Chip debugging messages"
69 depends on I2C
70 help 69 help
71 Say Y here if you want the I2C chip drivers to produce a bunch of 70 Say Y here if you want the I2C chip drivers to produce a bunch of
72 debug messages to the system log. Select this if you are having 71 debug messages to the system log. Select this if you are having
73 a problem with I2C support and want to see more of what is going 72 a problem with I2C support and want to see more of what is going
74 on. 73 on.
75 74
76endmenu 75endif # I2C
77
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 71c5a854ac5d..ba26e6cbe74e 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -2,6 +2,7 @@
2# Makefile for the i2c core. 2# Makefile for the i2c core.
3# 3#
4 4
5obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
5obj-$(CONFIG_I2C) += i2c-core.o 6obj-$(CONFIG_I2C) += i2c-core.o
6obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o 7obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
7obj-y += busses/ chips/ algos/ 8obj-y += busses/ chips/ algos/
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
index af0203409dd1..58899078810b 100644
--- a/drivers/i2c/algos/Kconfig
+++ b/drivers/i2c/algos/Kconfig
@@ -3,11 +3,9 @@
3# 3#
4 4
5menu "I2C Algorithms" 5menu "I2C Algorithms"
6 depends on I2C
7 6
8config I2C_ALGOBIT 7config I2C_ALGOBIT
9 tristate "I2C bit-banging interfaces" 8 tristate "I2C bit-banging interfaces"
10 depends on I2C
11 help 9 help
12 This allows you to use a range of I2C adapters called bit-banging 10 This allows you to use a range of I2C adapters called bit-banging
13 adapters. Say Y if you own an I2C adapter belonging to this class 11 adapters. Say Y if you own an I2C adapter belonging to this class
@@ -18,7 +16,6 @@ config I2C_ALGOBIT
18 16
19config I2C_ALGOPCF 17config I2C_ALGOPCF
20 tristate "I2C PCF 8584 interfaces" 18 tristate "I2C PCF 8584 interfaces"
21 depends on I2C
22 help 19 help
23 This allows you to use a range of I2C adapters called PCF adapters. 20 This allows you to use a range of I2C adapters called PCF adapters.
24 Say Y if you own an I2C adapter belonging to this class and then say 21 Say Y if you own an I2C adapter belonging to this class and then say
@@ -29,7 +26,6 @@ config I2C_ALGOPCF
29 26
30config I2C_ALGOPCA 27config I2C_ALGOPCA
31 tristate "I2C PCA 9564 interfaces" 28 tristate "I2C PCA 9564 interfaces"
32 depends on I2C
33 help 29 help
34 This allows you to use a range of I2C adapters called PCA adapters. 30 This allows you to use a range of I2C adapters called PCA adapters.
35 Say Y if you own an I2C adapter belonging to this class and then say 31 Say Y if you own an I2C adapter belonging to this class and then say
@@ -40,11 +36,11 @@ config I2C_ALGOPCA
40 36
41config I2C_ALGO8XX 37config I2C_ALGO8XX
42 tristate "MPC8xx CPM I2C interface" 38 tristate "MPC8xx CPM I2C interface"
43 depends on 8xx && I2C 39 depends on 8xx
44 40
45config I2C_ALGO_SGI 41config I2C_ALGO_SGI
46 tristate "I2C SGI interfaces" 42 tristate "I2C SGI interfaces"
47 depends on I2C && (SGI_IP22 || SGI_IP32 || X86_VISWS) 43 depends on SGI_IP22 || SGI_IP32 || X86_VISWS
48 help 44 help
49 Supports the SGI interfaces like the ones found on SGI Indy VINO 45 Supports the SGI interfaces like the ones found on SGI Indy VINO
50 or SGI O2 MACE. 46 or SGI O2 MACE.
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 95aa5395a5be..8a5f5825bb72 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -33,19 +33,30 @@
33 33
34 34
35/* ----- global defines ----------------------------------------------- */ 35/* ----- global defines ----------------------------------------------- */
36#define DEB(x) if (i2c_debug>=1) x;
37#define DEB2(x) if (i2c_debug>=2) x;
38#define DEBSTAT(x) if (i2c_debug>=3) x; /* print several statistical values*/
39#define DEBPROTO(x) if (i2c_debug>=9) { x; }
40 /* debug the protocol by showing transferred bits */
41 36
37#ifdef DEBUG
38#define bit_dbg(level, dev, format, args...) \
39 do { \
40 if (i2c_debug >= level) \
41 dev_dbg(dev, format, ##args); \
42 } while (0)
43#else
44#define bit_dbg(level, dev, format, args...) \
45 do {} while (0)
46#endif /* DEBUG */
42 47
43/* ----- global variables --------------------------------------------- */ 48/* ----- global variables --------------------------------------------- */
44 49
45/* module parameters:
46 */
47static int i2c_debug;
48static int bit_test; /* see if the line-setting functions work */ 50static int bit_test; /* see if the line-setting functions work */
51module_param(bit_test, bool, 0);
52MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck");
53
54#ifdef DEBUG
55static int i2c_debug = 1;
56module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
57MODULE_PARM_DESC(i2c_debug,
58 "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose");
59#endif
49 60
50/* --- setting states on the bus with the right timing: --------------- */ 61/* --- setting states on the bus with the right timing: --------------- */
51 62
@@ -57,19 +68,19 @@ static int bit_test; /* see if the line-setting functions work */
57static inline void sdalo(struct i2c_algo_bit_data *adap) 68static inline void sdalo(struct i2c_algo_bit_data *adap)
58{ 69{
59 setsda(adap,0); 70 setsda(adap,0);
60 udelay(adap->udelay); 71 udelay((adap->udelay + 1) / 2);
61} 72}
62 73
63static inline void sdahi(struct i2c_algo_bit_data *adap) 74static inline void sdahi(struct i2c_algo_bit_data *adap)
64{ 75{
65 setsda(adap,1); 76 setsda(adap,1);
66 udelay(adap->udelay); 77 udelay((adap->udelay + 1) / 2);
67} 78}
68 79
69static inline void scllo(struct i2c_algo_bit_data *adap) 80static inline void scllo(struct i2c_algo_bit_data *adap)
70{ 81{
71 setscl(adap,0); 82 setscl(adap,0);
72 udelay(adap->udelay); 83 udelay(adap->udelay / 2);
73} 84}
74 85
75/* 86/*
@@ -98,7 +109,11 @@ static int sclhi(struct i2c_algo_bit_data *adap)
98 } 109 }
99 cond_resched(); 110 cond_resched();
100 } 111 }
101 DEBSTAT(printk(KERN_DEBUG "needed %ld jiffies\n", jiffies-start)); 112#ifdef DEBUG
113 if (jiffies != start && i2c_debug >= 3)
114 pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go "
115 "high\n", jiffies - start);
116#endif
102 117
103done: 118done:
104 udelay(adap->udelay); 119 udelay(adap->udelay);
@@ -110,30 +125,29 @@ done:
110static void i2c_start(struct i2c_algo_bit_data *adap) 125static void i2c_start(struct i2c_algo_bit_data *adap)
111{ 126{
112 /* assert: scl, sda are high */ 127 /* assert: scl, sda are high */
113 DEBPROTO(printk("S ")); 128 setsda(adap, 0);
114 sdalo(adap); 129 udelay(adap->udelay);
115 scllo(adap); 130 scllo(adap);
116} 131}
117 132
118static void i2c_repstart(struct i2c_algo_bit_data *adap) 133static void i2c_repstart(struct i2c_algo_bit_data *adap)
119{ 134{
120 /* scl, sda may not be high */ 135 /* assert: scl is low */
121 DEBPROTO(printk(" Sr ")); 136 sdahi(adap);
122 setsda(adap,1);
123 sclhi(adap); 137 sclhi(adap);
124 138 setsda(adap, 0);
125 sdalo(adap); 139 udelay(adap->udelay);
126 scllo(adap); 140 scllo(adap);
127} 141}
128 142
129 143
130static void i2c_stop(struct i2c_algo_bit_data *adap) 144static void i2c_stop(struct i2c_algo_bit_data *adap)
131{ 145{
132 DEBPROTO(printk("P\n"));
133 /* assert: scl is low */ 146 /* assert: scl is low */
134 sdalo(adap); 147 sdalo(adap);
135 sclhi(adap); 148 sclhi(adap);
136 sdahi(adap); 149 setsda(adap, 1);
150 udelay(adap->udelay);
137} 151}
138 152
139 153
@@ -145,7 +159,7 @@ static void i2c_stop(struct i2c_algo_bit_data *adap)
145 * 0 if the device did not ack 159 * 0 if the device did not ack
146 * -ETIMEDOUT if an error occurred (while raising the scl line) 160 * -ETIMEDOUT if an error occurred (while raising the scl line)
147 */ 161 */
148static int i2c_outb(struct i2c_adapter *i2c_adap, char c) 162static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
149{ 163{
150 int i; 164 int i;
151 int sb; 165 int sb;
@@ -154,34 +168,32 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, char c)
154 168
155 /* assert: scl is low */ 169 /* assert: scl is low */
156 for ( i=7 ; i>=0 ; i-- ) { 170 for ( i=7 ; i>=0 ; i-- ) {
157 sb = c & ( 1 << i ); 171 sb = (c >> i) & 1;
158 setsda(adap,sb); 172 setsda(adap,sb);
159 udelay(adap->udelay); 173 udelay((adap->udelay + 1) / 2);
160 DEBPROTO(printk(KERN_DEBUG "%d",sb!=0));
161 if (sclhi(adap)<0) { /* timed out */ 174 if (sclhi(adap)<0) { /* timed out */
162 sdahi(adap); /* we don't want to block the net */ 175 bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, "
163 DEB2(printk(KERN_DEBUG " i2c_outb: 0x%02x, timeout at bit #%d\n", c&0xff, i)); 176 "timeout at bit #%d\n", (int)c, i);
164 return -ETIMEDOUT; 177 return -ETIMEDOUT;
165 }; 178 };
166 /* do arbitration here: 179 /* do arbitration here:
167 * if ( sb && ! getsda(adap) ) -> ouch! Get out of here. 180 * if ( sb && ! getsda(adap) ) -> ouch! Get out of here.
168 */ 181 */
169 setscl(adap, 0 ); 182 scllo(adap);
170 udelay(adap->udelay);
171 } 183 }
172 sdahi(adap); 184 sdahi(adap);
173 if (sclhi(adap)<0){ /* timeout */ 185 if (sclhi(adap)<0){ /* timeout */
174 DEB2(printk(KERN_DEBUG " i2c_outb: 0x%02x, timeout at ack\n", c&0xff)); 186 bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, "
175 return -ETIMEDOUT; 187 "timeout at ack\n", (int)c);
188 return -ETIMEDOUT;
176 }; 189 };
177 /* read ack: SDA should be pulled down by slave */ 190 /* read ack: SDA should be pulled down by slave */
178 ack=getsda(adap); /* ack: sda is pulled low ->success. */ 191 ack = !getsda(adap); /* ack: sda is pulled low -> success */
179 DEB2(printk(KERN_DEBUG " i2c_outb: 0x%02x , getsda() = %d\n", c & 0xff, ack)); 192 bit_dbg(2, &i2c_adap->dev, "i2c_outb: 0x%02x %s\n", (int)c,
193 ack ? "A" : "NA");
180 194
181 DEBPROTO( printk(KERN_DEBUG "[%2.2x]",c&0xff) );
182 DEBPROTO(if (0==ack){ printk(KERN_DEBUG " A ");} else printk(KERN_DEBUG " NA ") );
183 scllo(adap); 195 scllo(adap);
184 return 0==ack; /* return 1 if device acked */ 196 return ack;
185 /* assert: scl is low (sda undef) */ 197 /* assert: scl is low (sda undef) */
186} 198}
187 199
@@ -198,19 +210,18 @@ static int i2c_inb(struct i2c_adapter *i2c_adap)
198 sdahi(adap); 210 sdahi(adap);
199 for (i=0;i<8;i++) { 211 for (i=0;i<8;i++) {
200 if (sclhi(adap)<0) { /* timeout */ 212 if (sclhi(adap)<0) { /* timeout */
201 DEB2(printk(KERN_DEBUG " i2c_inb: timeout at bit #%d\n", 7-i)); 213 bit_dbg(1, &i2c_adap->dev, "i2c_inb: timeout at bit "
214 "#%d\n", 7 - i);
202 return -ETIMEDOUT; 215 return -ETIMEDOUT;
203 }; 216 };
204 indata *= 2; 217 indata *= 2;
205 if ( getsda(adap) ) 218 if ( getsda(adap) )
206 indata |= 0x01; 219 indata |= 0x01;
207 scllo(adap); 220 setscl(adap, 0);
221 udelay(i == 7 ? adap->udelay / 2 : adap->udelay);
208 } 222 }
209 /* assert: scl is low */ 223 /* assert: scl is low */
210 DEB2(printk(KERN_DEBUG "i2c_inb: 0x%02x\n", indata & 0xff)); 224 return indata;
211
212 DEBPROTO(printk(KERN_DEBUG " 0x%02x", indata & 0xff));
213 return (int) (indata & 0xff);
214} 225}
215 226
216/* 227/*
@@ -221,73 +232,67 @@ static int test_bus(struct i2c_algo_bit_data *adap, char* name) {
221 int scl,sda; 232 int scl,sda;
222 233
223 if (adap->getscl==NULL) 234 if (adap->getscl==NULL)
224 printk(KERN_INFO "i2c-algo-bit.o: Testing SDA only, " 235 pr_info("%s: Testing SDA only, SCL is not readable\n", name);
225 "SCL is not readable.\n");
226 236
227 sda=getsda(adap); 237 sda=getsda(adap);
228 scl=(adap->getscl==NULL?1:getscl(adap)); 238 scl=(adap->getscl==NULL?1:getscl(adap));
229 printk(KERN_DEBUG "i2c-algo-bit.o: (0) scl=%d, sda=%d\n",scl,sda);
230 if (!scl || !sda ) { 239 if (!scl || !sda ) {
231 printk(KERN_WARNING "i2c-algo-bit.o: %s seems to be busy.\n", name); 240 printk(KERN_WARNING "%s: bus seems to be busy\n", name);
232 goto bailout; 241 goto bailout;
233 } 242 }
234 243
235 sdalo(adap); 244 sdalo(adap);
236 sda=getsda(adap); 245 sda=getsda(adap);
237 scl=(adap->getscl==NULL?1:getscl(adap)); 246 scl=(adap->getscl==NULL?1:getscl(adap));
238 printk(KERN_DEBUG "i2c-algo-bit.o: (1) scl=%d, sda=%d\n",scl,sda);
239 if ( 0 != sda ) { 247 if ( 0 != sda ) {
240 printk(KERN_WARNING "i2c-algo-bit.o: SDA stuck high!\n"); 248 printk(KERN_WARNING "%s: SDA stuck high!\n", name);
241 goto bailout; 249 goto bailout;
242 } 250 }
243 if ( 0 == scl ) { 251 if ( 0 == scl ) {
244 printk(KERN_WARNING "i2c-algo-bit.o: SCL unexpected low " 252 printk(KERN_WARNING "%s: SCL unexpected low "
245 "while pulling SDA low!\n"); 253 "while pulling SDA low!\n", name);
246 goto bailout; 254 goto bailout;
247 } 255 }
248 256
249 sdahi(adap); 257 sdahi(adap);
250 sda=getsda(adap); 258 sda=getsda(adap);
251 scl=(adap->getscl==NULL?1:getscl(adap)); 259 scl=(adap->getscl==NULL?1:getscl(adap));
252 printk(KERN_DEBUG "i2c-algo-bit.o: (2) scl=%d, sda=%d\n",scl,sda);
253 if ( 0 == sda ) { 260 if ( 0 == sda ) {
254 printk(KERN_WARNING "i2c-algo-bit.o: SDA stuck low!\n"); 261 printk(KERN_WARNING "%s: SDA stuck low!\n", name);
255 goto bailout; 262 goto bailout;
256 } 263 }
257 if ( 0 == scl ) { 264 if ( 0 == scl ) {
258 printk(KERN_WARNING "i2c-algo-bit.o: SCL unexpected low " 265 printk(KERN_WARNING "%s: SCL unexpected low "
259 "while pulling SDA high!\n"); 266 "while pulling SDA high!\n", name);
260 goto bailout; 267 goto bailout;
261 } 268 }
262 269
263 scllo(adap); 270 scllo(adap);
264 sda=getsda(adap); 271 sda=getsda(adap);
265 scl=(adap->getscl==NULL?0:getscl(adap)); 272 scl=(adap->getscl==NULL?0:getscl(adap));
266 printk(KERN_DEBUG "i2c-algo-bit.o: (3) scl=%d, sda=%d\n",scl,sda);
267 if ( 0 != scl ) { 273 if ( 0 != scl ) {
268 printk(KERN_WARNING "i2c-algo-bit.o: SCL stuck high!\n"); 274 printk(KERN_WARNING "%s: SCL stuck high!\n", name);
269 goto bailout; 275 goto bailout;
270 } 276 }
271 if ( 0 == sda ) { 277 if ( 0 == sda ) {
272 printk(KERN_WARNING "i2c-algo-bit.o: SDA unexpected low " 278 printk(KERN_WARNING "%s: SDA unexpected low "
273 "while pulling SCL low!\n"); 279 "while pulling SCL low!\n", name);
274 goto bailout; 280 goto bailout;
275 } 281 }
276 282
277 sclhi(adap); 283 sclhi(adap);
278 sda=getsda(adap); 284 sda=getsda(adap);
279 scl=(adap->getscl==NULL?1:getscl(adap)); 285 scl=(adap->getscl==NULL?1:getscl(adap));
280 printk(KERN_DEBUG "i2c-algo-bit.o: (4) scl=%d, sda=%d\n",scl,sda);
281 if ( 0 == scl ) { 286 if ( 0 == scl ) {
282 printk(KERN_WARNING "i2c-algo-bit.o: SCL stuck low!\n"); 287 printk(KERN_WARNING "%s: SCL stuck low!\n", name);
283 goto bailout; 288 goto bailout;
284 } 289 }
285 if ( 0 == sda ) { 290 if ( 0 == sda ) {
286 printk(KERN_WARNING "i2c-algo-bit.o: SDA unexpected low " 291 printk(KERN_WARNING "%s: SDA unexpected low "
287 "while pulling SCL high!\n"); 292 "while pulling SCL high!\n", name);
288 goto bailout; 293 goto bailout;
289 } 294 }
290 printk(KERN_INFO "i2c-algo-bit.o: %s passed test.\n",name); 295 pr_info("%s: Test OK\n", name);
291 return 0; 296 return 0;
292bailout: 297bailout:
293 sdahi(adap); 298 sdahi(adap);
@@ -312,44 +317,39 @@ static int try_address(struct i2c_adapter *i2c_adap,
312 int i,ret = -1; 317 int i,ret = -1;
313 for (i=0;i<=retries;i++) { 318 for (i=0;i<=retries;i++) {
314 ret = i2c_outb(i2c_adap,addr); 319 ret = i2c_outb(i2c_adap,addr);
315 if (ret==1) 320 if (ret == 1 || i == retries)
316 break; /* success! */
317 i2c_stop(adap);
318 udelay(5/*adap->udelay*/);
319 if (i==retries) /* no success */
320 break; 321 break;
321 i2c_start(adap); 322 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
323 i2c_stop(adap);
322 udelay(adap->udelay); 324 udelay(adap->udelay);
325 yield();
326 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
327 i2c_start(adap);
323 } 328 }
324 DEB2(if (i) 329 if (i && ret)
325 printk(KERN_DEBUG "i2c-algo-bit.o: Used %d tries to %s client at 0x%02x : %s\n", 330 bit_dbg(1, &i2c_adap->dev, "Used %d tries to %s client at "
326 i+1, addr & 1 ? "read" : "write", addr>>1, 331 "0x%02x: %s\n", i + 1,
327 ret==1 ? "success" : ret==0 ? "no ack" : "failed, timeout?" ) 332 addr & 1 ? "read from" : "write to", addr >> 1,
328 ); 333 ret == 1 ? "success" : "failed, timeout?");
329 return ret; 334 return ret;
330} 335}
331 336
332static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) 337static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
333{ 338{
334 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; 339 const unsigned char *temp = msg->buf;
335 char c;
336 const char *temp = msg->buf;
337 int count = msg->len; 340 int count = msg->len;
338 unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK; 341 unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK;
339 int retval; 342 int retval;
340 int wrcount=0; 343 int wrcount=0;
341 344
342 while (count > 0) { 345 while (count > 0) {
343 c = *temp; 346 retval = i2c_outb(i2c_adap, *temp);
344 DEB2(dev_dbg(&i2c_adap->dev, "sendbytes: writing %2.2X\n", c&0xff));
345 retval = i2c_outb(i2c_adap,c);
346 if ((retval>0) || (nak_ok && (retval==0))) { /* ok or ignored NAK */ 347 if ((retval>0) || (nak_ok && (retval==0))) { /* ok or ignored NAK */
347 count--; 348 count--;
348 temp++; 349 temp++;
349 wrcount++; 350 wrcount++;
350 } else { /* arbitration or no acknowledge */ 351 } else { /* arbitration or no acknowledge */
351 dev_err(&i2c_adap->dev, "sendbytes: error - bailout.\n"); 352 dev_err(&i2c_adap->dev, "sendbytes: error - bailout.\n");
352 i2c_stop(adap);
353 return (retval<0)? retval : -EFAULT; 353 return (retval<0)? retval : -EFAULT;
354 /* got a better one ?? */ 354 /* got a better one ?? */
355 } 355 }
@@ -362,7 +362,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
362 int inval; 362 int inval;
363 int rdcount=0; /* counts bytes read */ 363 int rdcount=0; /* counts bytes read */
364 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; 364 struct i2c_algo_bit_data *adap = i2c_adap->algo_data;
365 char *temp = msg->buf; 365 unsigned char *temp = msg->buf;
366 int count = msg->len; 366 int count = msg->len;
367 367
368 while (count > 0) { 368 while (count > 0) {
@@ -371,30 +371,44 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
371 *temp = inval; 371 *temp = inval;
372 rdcount++; 372 rdcount++;
373 } else { /* read timed out */ 373 } else { /* read timed out */
374 printk(KERN_ERR "i2c-algo-bit.o: readbytes: i2c_inb timed out.\n");
375 break; 374 break;
376 } 375 }
377 376
378 temp++; 377 temp++;
379 count--; 378 count--;
380 379
381 if (msg->flags & I2C_M_NO_RD_ACK) 380 if (msg->flags & I2C_M_NO_RD_ACK) {
381 bit_dbg(2, &i2c_adap->dev, "i2c_inb: 0x%02x\n",
382 inval);
382 continue; 383 continue;
383
384 if ( count > 0 ) { /* send ack */
385 sdalo(adap);
386 DEBPROTO(printk(" Am "));
387 } else {
388 sdahi(adap); /* neg. ack on last byte */
389 DEBPROTO(printk(" NAm "));
390 } 384 }
385
386 /* assert: sda is high */
387 if (count) /* send ack */
388 setsda(adap, 0);
389 udelay((adap->udelay + 1) / 2);
390 bit_dbg(2, &i2c_adap->dev, "i2c_inb: 0x%02x %s\n", inval,
391 count ? "A" : "NA");
391 if (sclhi(adap)<0) { /* timeout */ 392 if (sclhi(adap)<0) { /* timeout */
392 sdahi(adap); 393 dev_err(&i2c_adap->dev, "readbytes: timeout at ack\n");
393 printk(KERN_ERR "i2c-algo-bit.o: readbytes: Timeout at ack\n");
394 return -ETIMEDOUT; 394 return -ETIMEDOUT;
395 }; 395 };
396 scllo(adap); 396 scllo(adap);
397 sdahi(adap); 397
398 /* Some SMBus transactions require that we receive the
399 transaction length as the first read byte. */
400 if (rdcount == 1 && (msg->flags & I2C_M_RECV_LEN)) {
401 if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) {
402 dev_err(&i2c_adap->dev, "readbytes: invalid "
403 "block length (%d)\n", inval);
404 return -EREMOTEIO;
405 }
406 /* The original count value accounts for the extra
407 bytes, that is, either 1 for a regular transaction,
408 or 2 for a PEC transaction. */
409 count += inval;
410 msg->len += inval;
411 }
398 } 412 }
399 return rdcount; 413 return rdcount;
400} 414}
@@ -421,27 +435,31 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
421 if ( (flags & I2C_M_TEN) ) { 435 if ( (flags & I2C_M_TEN) ) {
422 /* a ten bit address */ 436 /* a ten bit address */
423 addr = 0xf0 | (( msg->addr >> 7) & 0x03); 437 addr = 0xf0 | (( msg->addr >> 7) & 0x03);
424 DEB2(printk(KERN_DEBUG "addr0: %d\n",addr)); 438 bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr);
425 /* try extended address code...*/ 439 /* try extended address code...*/
426 ret = try_address(i2c_adap, addr, retries); 440 ret = try_address(i2c_adap, addr, retries);
427 if ((ret != 1) && !nak_ok) { 441 if ((ret != 1) && !nak_ok) {
428 printk(KERN_ERR "died at extended address code.\n"); 442 dev_err(&i2c_adap->dev,
443 "died at extended address code\n");
429 return -EREMOTEIO; 444 return -EREMOTEIO;
430 } 445 }
431 /* the remaining 8 bit address */ 446 /* the remaining 8 bit address */
432 ret = i2c_outb(i2c_adap,msg->addr & 0x7f); 447 ret = i2c_outb(i2c_adap,msg->addr & 0x7f);
433 if ((ret != 1) && !nak_ok) { 448 if ((ret != 1) && !nak_ok) {
434 /* the chip did not ack / xmission error occurred */ 449 /* the chip did not ack / xmission error occurred */
435 printk(KERN_ERR "died at 2nd address code.\n"); 450 dev_err(&i2c_adap->dev, "died at 2nd address code\n");
436 return -EREMOTEIO; 451 return -EREMOTEIO;
437 } 452 }
438 if ( flags & I2C_M_RD ) { 453 if ( flags & I2C_M_RD ) {
454 bit_dbg(3, &i2c_adap->dev, "emitting repeated "
455 "start condition\n");
439 i2c_repstart(adap); 456 i2c_repstart(adap);
440 /* okay, now switch into reading mode */ 457 /* okay, now switch into reading mode */
441 addr |= 0x01; 458 addr |= 0x01;
442 ret = try_address(i2c_adap, addr, retries); 459 ret = try_address(i2c_adap, addr, retries);
443 if ((ret!=1) && !nak_ok) { 460 if ((ret!=1) && !nak_ok) {
444 printk(KERN_ERR "died at extended address code.\n"); 461 dev_err(&i2c_adap->dev,
462 "died at repeated address code\n");
445 return -EREMOTEIO; 463 return -EREMOTEIO;
446 } 464 }
447 } 465 }
@@ -468,44 +486,62 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
468 int i,ret; 486 int i,ret;
469 unsigned short nak_ok; 487 unsigned short nak_ok;
470 488
489 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
471 i2c_start(adap); 490 i2c_start(adap);
472 for (i=0;i<num;i++) { 491 for (i=0;i<num;i++) {
473 pmsg = &msgs[i]; 492 pmsg = &msgs[i];
474 nak_ok = pmsg->flags & I2C_M_IGNORE_NAK; 493 nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
475 if (!(pmsg->flags & I2C_M_NOSTART)) { 494 if (!(pmsg->flags & I2C_M_NOSTART)) {
476 if (i) { 495 if (i) {
496 bit_dbg(3, &i2c_adap->dev, "emitting "
497 "repeated start condition\n");
477 i2c_repstart(adap); 498 i2c_repstart(adap);
478 } 499 }
479 ret = bit_doAddress(i2c_adap, pmsg); 500 ret = bit_doAddress(i2c_adap, pmsg);
480 if ((ret != 0) && !nak_ok) { 501 if ((ret != 0) && !nak_ok) {
481 DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: NAK from device addr %2.2x msg #%d\n" 502 bit_dbg(1, &i2c_adap->dev, "NAK from "
482 ,msgs[i].addr,i)); 503 "device addr 0x%02x msg #%d\n",
483 return (ret<0) ? ret : -EREMOTEIO; 504 msgs[i].addr, i);
505 goto bailout;
484 } 506 }
485 } 507 }
486 if (pmsg->flags & I2C_M_RD ) { 508 if (pmsg->flags & I2C_M_RD ) {
487 /* read bytes into buffer*/ 509 /* read bytes into buffer*/
488 ret = readbytes(i2c_adap, pmsg); 510 ret = readbytes(i2c_adap, pmsg);
489 DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: read %d bytes.\n",ret)); 511 if (ret >= 1)
490 if (ret < pmsg->len ) { 512 bit_dbg(2, &i2c_adap->dev, "read %d byte%s\n",
491 return (ret<0)? ret : -EREMOTEIO; 513 ret, ret == 1 ? "" : "s");
514 if (ret < pmsg->len) {
515 if (ret >= 0)
516 ret = -EREMOTEIO;
517 goto bailout;
492 } 518 }
493 } else { 519 } else {
494 /* write bytes from buffer */ 520 /* write bytes from buffer */
495 ret = sendbytes(i2c_adap, pmsg); 521 ret = sendbytes(i2c_adap, pmsg);
496 DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: wrote %d bytes.\n",ret)); 522 if (ret >= 1)
497 if (ret < pmsg->len ) { 523 bit_dbg(2, &i2c_adap->dev, "wrote %d byte%s\n",
498 return (ret<0) ? ret : -EREMOTEIO; 524 ret, ret == 1 ? "" : "s");
525 if (ret < pmsg->len) {
526 if (ret >= 0)
527 ret = -EREMOTEIO;
528 goto bailout;
499 } 529 }
500 } 530 }
501 } 531 }
532 ret = i;
533
534bailout:
535 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
502 i2c_stop(adap); 536 i2c_stop(adap);
503 return num; 537 return ret;
504} 538}
505 539
506static u32 bit_func(struct i2c_adapter *adap) 540static u32 bit_func(struct i2c_adapter *adap)
507{ 541{
508 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | 542 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
543 I2C_FUNC_SMBUS_READ_BLOCK_DATA |
544 I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
509 I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; 545 I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
510} 546}
511 547
@@ -520,7 +556,7 @@ static const struct i2c_algorithm i2c_bit_algo = {
520/* 556/*
521 * registering functions to load algorithms at runtime 557 * registering functions to load algorithms at runtime
522 */ 558 */
523int i2c_bit_add_bus(struct i2c_adapter *adap) 559static int i2c_bit_prepare_bus(struct i2c_adapter *adap)
524{ 560{
525 struct i2c_algo_bit_data *bit_adap = adap->algo_data; 561 struct i2c_algo_bit_data *bit_adap = adap->algo_data;
526 562
@@ -530,25 +566,39 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
530 return -ENODEV; 566 return -ENODEV;
531 } 567 }
532 568
533 DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));
534
535 /* register new adapter to i2c module... */ 569 /* register new adapter to i2c module... */
536 adap->algo = &i2c_bit_algo; 570 adap->algo = &i2c_bit_algo;
537 571
538 adap->timeout = 100; /* default values, should */ 572 adap->timeout = 100; /* default values, should */
539 adap->retries = 3; /* be replaced by defines */ 573 adap->retries = 3; /* be replaced by defines */
540 574
575 return 0;
576}
577
578int i2c_bit_add_bus(struct i2c_adapter *adap)
579{
580 int err;
581
582 err = i2c_bit_prepare_bus(adap);
583 if (err)
584 return err;
585
541 return i2c_add_adapter(adap); 586 return i2c_add_adapter(adap);
542} 587}
543EXPORT_SYMBOL(i2c_bit_add_bus); 588EXPORT_SYMBOL(i2c_bit_add_bus);
544 589
590int i2c_bit_add_numbered_bus(struct i2c_adapter *adap)
591{
592 int err;
593
594 err = i2c_bit_prepare_bus(adap);
595 if (err)
596 return err;
597
598 return i2c_add_numbered_adapter(adap);
599}
600EXPORT_SYMBOL(i2c_bit_add_numbered_bus);
601
545MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 602MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
546MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); 603MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm");
547MODULE_LICENSE("GPL"); 604MODULE_LICENSE("GPL");
548
549module_param(bit_test, bool, 0);
550module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
551
552MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck");
553MODULE_PARM_DESC(i2c_debug,
554 "debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol");
diff --git a/drivers/i2c/algos/i2c-algo-sgi.c b/drivers/i2c/algos/i2c-algo-sgi.c
index ac2d5053078a..6eaf145e1ada 100644
--- a/drivers/i2c/algos/i2c-algo-sgi.c
+++ b/drivers/i2c/algos/i2c-algo-sgi.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * i2c-algo-sgi.c: i2c driver algorithms for SGI adapters. 2 * i2c-algo-sgi.c: i2c driver algorithm used by the VINO (SGI Indy) and
3 * 3 * MACE (SGI O2) chips.
4 *
4 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
5 * License version 2 as published by the Free Software Foundation. 6 * License version 2 as published by the Free Software Foundation.
6 * 7 *
@@ -162,8 +163,8 @@ static const struct i2c_algorithm sgi_algo = {
162 .functionality = sgi_func, 163 .functionality = sgi_func,
163}; 164};
164 165
165/* 166/*
166 * registering functions to load algorithms at runtime 167 * registering functions to load algorithms at runtime
167 */ 168 */
168int i2c_sgi_add_bus(struct i2c_adapter *adap) 169int i2c_sgi_add_bus(struct i2c_adapter *adap)
169{ 170{
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index ece31d2c6c64..838dc1c19d61 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -3,11 +3,10 @@
3# 3#
4 4
5menu "I2C Hardware Bus support" 5menu "I2C Hardware Bus support"
6 depends on I2C
7 6
8config I2C_ALI1535 7config I2C_ALI1535
9 tristate "ALI 1535" 8 tristate "ALI 1535"
10 depends on I2C && PCI 9 depends on PCI
11 help 10 help
12 If you say yes to this option, support will be included for the SMB 11 If you say yes to this option, support will be included for the SMB
13 Host controller on Acer Labs Inc. (ALI) M1535 South Bridges. The SMB 12 Host controller on Acer Labs Inc. (ALI) M1535 South Bridges. The SMB
@@ -19,7 +18,7 @@ config I2C_ALI1535
19 18
20config I2C_ALI1563 19config I2C_ALI1563
21 tristate "ALI 1563" 20 tristate "ALI 1563"
22 depends on I2C && PCI && EXPERIMENTAL 21 depends on PCI && EXPERIMENTAL
23 help 22 help
24 If you say yes to this option, support will be included for the SMB 23 If you say yes to this option, support will be included for the SMB
25 Host controller on Acer Labs Inc. (ALI) M1563 South Bridges. The SMB 24 Host controller on Acer Labs Inc. (ALI) M1563 South Bridges. The SMB
@@ -31,7 +30,7 @@ config I2C_ALI1563
31 30
32config I2C_ALI15X3 31config I2C_ALI15X3
33 tristate "ALI 15x3" 32 tristate "ALI 15x3"
34 depends on I2C && PCI 33 depends on PCI
35 help 34 help
36 If you say yes to this option, support will be included for the 35 If you say yes to this option, support will be included for the
37 Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces. 36 Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces.
@@ -41,7 +40,7 @@ config I2C_ALI15X3
41 40
42config I2C_AMD756 41config I2C_AMD756
43 tristate "AMD 756/766/768/8111 and nVidia nForce" 42 tristate "AMD 756/766/768/8111 and nVidia nForce"
44 depends on I2C && PCI 43 depends on PCI
45 help 44 help
46 If you say yes to this option, support will be included for the AMD 45 If you say yes to this option, support will be included for the AMD
47 756/766/768 mainboard I2C interfaces. The driver also includes 46 756/766/768 mainboard I2C interfaces. The driver also includes
@@ -66,7 +65,7 @@ config I2C_AMD756_S4882
66 65
67config I2C_AMD8111 66config I2C_AMD8111
68 tristate "AMD 8111" 67 tristate "AMD 8111"
69 depends on I2C && PCI 68 depends on PCI
70 help 69 help
71 If you say yes to this option, support will be included for the 70 If you say yes to this option, support will be included for the
72 second (SMBus 2.0) AMD 8111 mainboard I2C interface. 71 second (SMBus 2.0) AMD 8111 mainboard I2C interface.
@@ -76,14 +75,14 @@ config I2C_AMD8111
76 75
77config I2C_AT91 76config I2C_AT91
78 tristate "Atmel AT91 I2C Two-Wire interface (TWI)" 77 tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
79 depends on I2C && ARCH_AT91 && EXPERIMENTAL 78 depends on ARCH_AT91 && EXPERIMENTAL
80 help 79 help
81 This supports the use of the I2C interface on Atmel AT91 80 This supports the use of the I2C interface on Atmel AT91
82 processors. 81 processors.
83 82
84config I2C_AU1550 83config I2C_AU1550
85 tristate "Au1550/Au1200 SMBus interface" 84 tristate "Au1550/Au1200 SMBus interface"
86 depends on I2C && (SOC_AU1550 || SOC_AU1200) 85 depends on SOC_AU1550 || SOC_AU1200
87 help 86 help
88 If you say yes to this option, support will be included for the 87 If you say yes to this option, support will be included for the
89 Au1550 and Au1200 SMBus interface. 88 Au1550 and Au1200 SMBus interface.
@@ -91,9 +90,25 @@ config I2C_AU1550
91 This driver can also be built as a module. If so, the module 90 This driver can also be built as a module. If so, the module
92 will be called i2c-au1550. 91 will be called i2c-au1550.
93 92
93config I2C_BLACKFIN_TWI
94 tristate "Blackfin TWI I2C support"
95 depends on BF534 || BF536 || BF537
96 help
97 This is the TWI I2C device driver for Blackfin 534/536/537.
98 This driver can also be built as a module. If so, the module
99 will be called i2c-bfin-twi.
100
101config I2C_BLACKFIN_TWI_CLK_KHZ
102 int "Blackfin TWI I2C clock (kHz)"
103 depends on I2C_BLACKFIN_TWI
104 range 10 400
105 default 50
106 help
107 The unit of the TWI clock is kHz.
108
94config I2C_ELEKTOR 109config I2C_ELEKTOR
95 tristate "Elektor ISA card" 110 tristate "Elektor ISA card"
96 depends on I2C && ISA && BROKEN_ON_SMP 111 depends on ISA && BROKEN_ON_SMP
97 select I2C_ALGOPCF 112 select I2C_ALGOPCF
98 help 113 help
99 This supports the PCF8584 ISA bus I2C adapter. Say Y if you own 114 This supports the PCF8584 ISA bus I2C adapter. Say Y if you own
@@ -102,9 +117,17 @@ config I2C_ELEKTOR
102 This support is also available as a module. If so, the module 117 This support is also available as a module. If so, the module
103 will be called i2c-elektor. 118 will be called i2c-elektor.
104 119
120config I2C_GPIO
121 tristate "GPIO-based bitbanging I2C"
122 depends on GENERIC_GPIO
123 select I2C_ALGOBIT
124 help
125 This is a very simple bitbanging I2C driver utilizing the
126 arch-neutral GPIO API to control the SCL and SDA lines.
127
105config I2C_HYDRA 128config I2C_HYDRA
106 tristate "CHRP Apple Hydra Mac I/O I2C interface" 129 tristate "CHRP Apple Hydra Mac I/O I2C interface"
107 depends on I2C && PCI && PPC_CHRP && EXPERIMENTAL 130 depends on PCI && PPC_CHRP && EXPERIMENTAL
108 select I2C_ALGOBIT 131 select I2C_ALGOBIT
109 help 132 help
110 This supports the use of the I2C interface in the Apple Hydra Mac 133 This supports the use of the I2C interface in the Apple Hydra Mac
@@ -116,7 +139,7 @@ config I2C_HYDRA
116 139
117config I2C_I801 140config I2C_I801
118 tristate "Intel 82801 (ICH)" 141 tristate "Intel 82801 (ICH)"
119 depends on I2C && PCI 142 depends on PCI
120 help 143 help
121 If you say yes to this option, support will be included for the Intel 144 If you say yes to this option, support will be included for the Intel
122 801 family of mainboard I2C interfaces. Specifically, the following 145 801 family of mainboard I2C interfaces. Specifically, the following
@@ -139,7 +162,7 @@ config I2C_I801
139 162
140config I2C_I810 163config I2C_I810
141 tristate "Intel 810/815" 164 tristate "Intel 810/815"
142 depends on I2C && PCI 165 depends on PCI
143 select I2C_ALGOBIT 166 select I2C_ALGOBIT
144 help 167 help
145 If you say yes to this option, support will be included for the Intel 168 If you say yes to this option, support will be included for the Intel
@@ -156,7 +179,7 @@ config I2C_I810
156 179
157config I2C_PXA 180config I2C_PXA
158 tristate "Intel PXA2XX I2C adapter (EXPERIMENTAL)" 181 tristate "Intel PXA2XX I2C adapter (EXPERIMENTAL)"
159 depends on I2C && EXPERIMENTAL && ARCH_PXA 182 depends on EXPERIMENTAL && ARCH_PXA
160 help 183 help
161 If you have devices in the PXA I2C bus, say yes to this option. 184 If you have devices in the PXA I2C bus, say yes to this option.
162 This driver can also be built as a module. If so, the module 185 This driver can also be built as a module. If so, the module
@@ -172,7 +195,7 @@ config I2C_PXA_SLAVE
172 195
173config I2C_PIIX4 196config I2C_PIIX4
174 tristate "Intel PIIX4 and compatible (ATI/Serverworks/Broadcom/SMSC)" 197 tristate "Intel PIIX4 and compatible (ATI/Serverworks/Broadcom/SMSC)"
175 depends on I2C && PCI 198 depends on PCI
176 help 199 help
177 If you say yes to this option, support will be included for the Intel 200 If you say yes to this option, support will be included for the Intel
178 PIIX4 family of mainboard I2C interfaces. Specifically, the following 201 PIIX4 family of mainboard I2C interfaces. Specifically, the following
@@ -195,7 +218,7 @@ config I2C_PIIX4
195 218
196config I2C_IBM_IIC 219config I2C_IBM_IIC
197 tristate "IBM PPC 4xx on-chip I2C interface" 220 tristate "IBM PPC 4xx on-chip I2C interface"
198 depends on IBM_OCP && I2C 221 depends on IBM_OCP
199 help 222 help
200 Say Y here if you want to use IIC peripheral found on 223 Say Y here if you want to use IIC peripheral found on
201 embedded IBM PPC 4xx based systems. 224 embedded IBM PPC 4xx based systems.
@@ -205,7 +228,7 @@ config I2C_IBM_IIC
205 228
206config I2C_IOP3XX 229config I2C_IOP3XX
207 tristate "Intel IOPx3xx and IXP4xx on-chip I2C interface" 230 tristate "Intel IOPx3xx and IXP4xx on-chip I2C interface"
208 depends on (ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX || ARCH_IOP13XX) && I2C 231 depends on ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX || ARCH_IOP13XX
209 help 232 help
210 Say Y here if you want to use the IIC bus controller on 233 Say Y here if you want to use the IIC bus controller on
211 the Intel IOPx3xx I/O Processors or IXP4xx Network Processors. 234 the Intel IOPx3xx I/O Processors or IXP4xx Network Processors.
@@ -215,11 +238,10 @@ config I2C_IOP3XX
215 238
216config I2C_ISA 239config I2C_ISA
217 tristate 240 tristate
218 depends on I2C
219 241
220config I2C_IXP4XX 242config I2C_IXP4XX
221 tristate "IXP4xx GPIO-Based I2C Interface" 243 tristate "IXP4xx GPIO-Based I2C Interface (DEPRECATED)"
222 depends on I2C && ARCH_IXP4XX 244 depends on ARCH_IXP4XX
223 select I2C_ALGOBIT 245 select I2C_ALGOBIT
224 help 246 help
225 Say Y here if you have an Intel IXP4xx(420,421,422,425) based 247 Say Y here if you have an Intel IXP4xx(420,421,422,425) based
@@ -228,9 +250,12 @@ config I2C_IXP4XX
228 This support is also available as a module. If so, the module 250 This support is also available as a module. If so, the module
229 will be called i2c-ixp4xx. 251 will be called i2c-ixp4xx.
230 252
253 This driver is deprecated and will be dropped soon. Use i2c-gpio
254 instead.
255
231config I2C_IXP2000 256config I2C_IXP2000
232 tristate "IXP2000 GPIO-Based I2C Interface" 257 tristate "IXP2000 GPIO-Based I2C Interface (DEPRECATED)"
233 depends on I2C && ARCH_IXP2000 258 depends on ARCH_IXP2000
234 select I2C_ALGOBIT 259 select I2C_ALGOBIT
235 help 260 help
236 Say Y here if you have an Intel IXP2000(2400, 2800, 2850) based 261 Say Y here if you have an Intel IXP2000(2400, 2800, 2850) based
@@ -239,9 +264,12 @@ config I2C_IXP2000
239 This support is also available as a module. If so, the module 264 This support is also available as a module. If so, the module
240 will be called i2c-ixp2000. 265 will be called i2c-ixp2000.
241 266
267 This driver is deprecated and will be dropped soon. Use i2c-gpio
268 instead.
269
242config I2C_POWERMAC 270config I2C_POWERMAC
243 tristate "Powermac I2C interface" 271 tristate "Powermac I2C interface"
244 depends on I2C && PPC_PMAC 272 depends on PPC_PMAC
245 default y 273 default y
246 help 274 help
247 This exposes the various PowerMac i2c interfaces to the linux i2c 275 This exposes the various PowerMac i2c interfaces to the linux i2c
@@ -253,7 +281,7 @@ config I2C_POWERMAC
253 281
254config I2C_MPC 282config I2C_MPC
255 tristate "MPC107/824x/85xx/52xx/86xx" 283 tristate "MPC107/824x/85xx/52xx/86xx"
256 depends on I2C && PPC32 284 depends on PPC32
257 help 285 help
258 If you say yes to this option, support will be included for the 286 If you say yes to this option, support will be included for the
259 built-in I2C interface on the MPC107/Tsi107/MPC8240/MPC8245 and 287 built-in I2C interface on the MPC107/Tsi107/MPC8240/MPC8245 and
@@ -265,7 +293,7 @@ config I2C_MPC
265 293
266config I2C_NFORCE2 294config I2C_NFORCE2
267 tristate "Nvidia nForce2, nForce3 and nForce4" 295 tristate "Nvidia nForce2, nForce3 and nForce4"
268 depends on I2C && PCI 296 depends on PCI
269 help 297 help
270 If you say yes to this option, support will be included for the Nvidia 298 If you say yes to this option, support will be included for the Nvidia
271 nForce2, nForce3 and nForce4 families of mainboard I2C interfaces. 299 nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
@@ -275,7 +303,7 @@ config I2C_NFORCE2
275 303
276config I2C_OCORES 304config I2C_OCORES
277 tristate "OpenCores I2C Controller" 305 tristate "OpenCores I2C Controller"
278 depends on I2C && EXPERIMENTAL 306 depends on EXPERIMENTAL
279 help 307 help
280 If you say yes to this option, support will be included for the 308 If you say yes to this option, support will be included for the
281 OpenCores I2C controller. For details see 309 OpenCores I2C controller. For details see
@@ -286,7 +314,7 @@ config I2C_OCORES
286 314
287config I2C_OMAP 315config I2C_OMAP
288 tristate "OMAP I2C adapter" 316 tristate "OMAP I2C adapter"
289 depends on I2C && ARCH_OMAP 317 depends on ARCH_OMAP
290 default y if MACH_OMAP_H3 || MACH_OMAP_OSK 318 default y if MACH_OMAP_H3 || MACH_OMAP_OSK
291 help 319 help
292 If you say yes to this option, support will be included for the 320 If you say yes to this option, support will be included for the
@@ -296,7 +324,7 @@ config I2C_OMAP
296 324
297config I2C_PARPORT 325config I2C_PARPORT
298 tristate "Parallel port adapter" 326 tristate "Parallel port adapter"
299 depends on I2C && PARPORT 327 depends on PARPORT
300 select I2C_ALGOBIT 328 select I2C_ALGOBIT
301 help 329 help
302 This supports parallel port I2C adapters such as the ones made by 330 This supports parallel port I2C adapters such as the ones made by
@@ -320,7 +348,6 @@ config I2C_PARPORT
320 348
321config I2C_PARPORT_LIGHT 349config I2C_PARPORT_LIGHT
322 tristate "Parallel port adapter (light)" 350 tristate "Parallel port adapter (light)"
323 depends on I2C
324 select I2C_ALGOBIT 351 select I2C_ALGOBIT
325 help 352 help
326 This supports parallel port I2C adapters such as the ones made by 353 This supports parallel port I2C adapters such as the ones made by
@@ -344,13 +371,13 @@ config I2C_PARPORT_LIGHT
344 371
345config I2C_PASEMI 372config I2C_PASEMI
346 tristate "PA Semi SMBus interface" 373 tristate "PA Semi SMBus interface"
347 depends on PPC_PASEMI && I2C && PCI 374 depends on PPC_PASEMI && PCI
348 help 375 help
349 Supports the PA Semi PWRficient on-chip SMBus interfaces. 376 Supports the PA Semi PWRficient on-chip SMBus interfaces.
350 377
351config I2C_PROSAVAGE 378config I2C_PROSAVAGE
352 tristate "S3/VIA (Pro)Savage" 379 tristate "S3/VIA (Pro)Savage"
353 depends on I2C && PCI 380 depends on PCI
354 select I2C_ALGOBIT 381 select I2C_ALGOBIT
355 help 382 help
356 If you say yes to this option, support will be included for the 383 If you say yes to this option, support will be included for the
@@ -365,19 +392,19 @@ config I2C_PROSAVAGE
365 392
366config I2C_RPXLITE 393config I2C_RPXLITE
367 tristate "Embedded Planet RPX Lite/Classic support" 394 tristate "Embedded Planet RPX Lite/Classic support"
368 depends on (RPXLITE || RPXCLASSIC) && I2C 395 depends on RPXLITE || RPXCLASSIC
369 select I2C_ALGO8XX 396 select I2C_ALGO8XX
370 397
371config I2C_S3C2410 398config I2C_S3C2410
372 tristate "S3C2410 I2C Driver" 399 tristate "S3C2410 I2C Driver"
373 depends on I2C && ARCH_S3C2410 400 depends on ARCH_S3C2410
374 help 401 help
375 Say Y here to include support for I2C controller in the 402 Say Y here to include support for I2C controller in the
376 Samsung S3C2410 based System-on-Chip devices. 403 Samsung S3C2410 based System-on-Chip devices.
377 404
378config I2C_SAVAGE4 405config I2C_SAVAGE4
379 tristate "S3 Savage 4" 406 tristate "S3 Savage 4"
380 depends on I2C && PCI && EXPERIMENTAL 407 depends on PCI && EXPERIMENTAL
381 select I2C_ALGOBIT 408 select I2C_ALGOBIT
382 help 409 help
383 If you say yes to this option, support will be included for the 410 If you say yes to this option, support will be included for the
@@ -388,13 +415,25 @@ config I2C_SAVAGE4
388 415
389config I2C_SIBYTE 416config I2C_SIBYTE
390 tristate "SiByte SMBus interface" 417 tristate "SiByte SMBus interface"
391 depends on SIBYTE_SB1xxx_SOC && I2C 418 depends on SIBYTE_SB1xxx_SOC
392 help 419 help
393 Supports the SiByte SOC on-chip I2C interfaces (2 channels). 420 Supports the SiByte SOC on-chip I2C interfaces (2 channels).
394 421
422config I2C_SIMTEC
423 tristate "Simtec Generic I2C interface"
424 select I2C_ALGOBIT
425 help
426 If you say yes to this option, support will be inclyded for
427 the Simtec Generic I2C interface. This driver is for the
428 simple I2C bus used on newer Simtec products for general
429 I2C, such as DDC on the Simtec BBD2016A.
430
431 This driver can also be build as a module. If so, the module
432 will be called i2c-simtec.
433
395config SCx200_I2C 434config SCx200_I2C
396 tristate "NatSemi SCx200 I2C using GPIO pins" 435 tristate "NatSemi SCx200 I2C using GPIO pins (DEPRECATED)"
397 depends on SCx200_GPIO && I2C 436 depends on SCx200_GPIO
398 select I2C_ALGOBIT 437 select I2C_ALGOBIT
399 help 438 help
400 Enable the use of two GPIO pins of a SCx200 processor as an I2C bus. 439 Enable the use of two GPIO pins of a SCx200 processor as an I2C bus.
@@ -404,6 +443,9 @@ config SCx200_I2C
404 This support is also available as a module. If so, the module 443 This support is also available as a module. If so, the module
405 will be called scx200_i2c. 444 will be called scx200_i2c.
406 445
446 This driver is deprecated and will be dropped soon. Use i2c-gpio
447 (or scx200_acb) instead.
448
407config SCx200_I2C_SCL 449config SCx200_I2C_SCL
408 int "GPIO pin used for SCL" 450 int "GPIO pin used for SCL"
409 depends on SCx200_I2C 451 depends on SCx200_I2C
@@ -422,7 +464,7 @@ config SCx200_I2C_SDA
422 464
423config SCx200_ACB 465config SCx200_ACB
424 tristate "Geode ACCESS.bus support" 466 tristate "Geode ACCESS.bus support"
425 depends on X86_32 && I2C && PCI 467 depends on X86_32 && PCI
426 help 468 help
427 Enable the use of the ACCESS.bus controllers on the Geode SCx200 and 469 Enable the use of the ACCESS.bus controllers on the Geode SCx200 and
428 SC1100 processors and the CS5535 and CS5536 Geode companion devices. 470 SC1100 processors and the CS5535 and CS5536 Geode companion devices.
@@ -434,7 +476,7 @@ config SCx200_ACB
434 476
435config I2C_SIS5595 477config I2C_SIS5595
436 tristate "SiS 5595" 478 tristate "SiS 5595"
437 depends on I2C && PCI 479 depends on PCI
438 help 480 help
439 If you say yes to this option, support will be included for the 481 If you say yes to this option, support will be included for the
440 SiS5595 SMBus (a subset of I2C) interface. 482 SiS5595 SMBus (a subset of I2C) interface.
@@ -444,7 +486,7 @@ config I2C_SIS5595
444 486
445config I2C_SIS630 487config I2C_SIS630
446 tristate "SiS 630/730" 488 tristate "SiS 630/730"
447 depends on I2C && PCI 489 depends on PCI
448 help 490 help
449 If you say yes to this option, support will be included for the 491 If you say yes to this option, support will be included for the
450 SiS630 and SiS730 SMBus (a subset of I2C) interface. 492 SiS630 and SiS730 SMBus (a subset of I2C) interface.
@@ -454,7 +496,7 @@ config I2C_SIS630
454 496
455config I2C_SIS96X 497config I2C_SIS96X
456 tristate "SiS 96x" 498 tristate "SiS 96x"
457 depends on I2C && PCI 499 depends on PCI
458 help 500 help
459 If you say yes to this option, support will be included for the SiS 501 If you say yes to this option, support will be included for the SiS
460 96x SMBus (a subset of I2C) interfaces. Specifically, the following 502 96x SMBus (a subset of I2C) interfaces. Specifically, the following
@@ -472,7 +514,7 @@ config I2C_SIS96X
472 514
473config I2C_STUB 515config I2C_STUB
474 tristate "I2C/SMBus Test Stub" 516 tristate "I2C/SMBus Test Stub"
475 depends on I2C && EXPERIMENTAL && 'm' 517 depends on EXPERIMENTAL && m
476 default 'n' 518 default 'n'
477 help 519 help
478 This module may be useful to developers of SMBus client drivers, 520 This module may be useful to developers of SMBus client drivers,
@@ -483,9 +525,20 @@ config I2C_STUB
483 525
484 If you don't know what to do here, definitely say N. 526 If you don't know what to do here, definitely say N.
485 527
528config I2C_TINY_USB
529 tristate "I2C-Tiny-USB"
530 depends on USB
531 help
532 If you say yes to this option, support will be included for the
533 i2c-tiny-usb, a simple do-it-yourself USB to I2C interface. See
534 http://www.harbaum.org/till/i2c_tiny_usb for hardware details.
535
536 This driver can also be built as a module. If so, the module
537 will be called i2c-tiny-usb.
538
486config I2C_VERSATILE 539config I2C_VERSATILE
487 tristate "ARM Versatile/Realview I2C bus support" 540 tristate "ARM Versatile/Realview I2C bus support"
488 depends on I2C && (ARCH_VERSATILE || ARCH_REALVIEW) 541 depends on ARCH_VERSATILE || ARCH_REALVIEW
489 select I2C_ALGOBIT 542 select I2C_ALGOBIT
490 help 543 help
491 Say yes if you want to support the I2C serial bus on ARMs Versatile 544 Say yes if you want to support the I2C serial bus on ARMs Versatile
@@ -496,7 +549,7 @@ config I2C_VERSATILE
496 549
497config I2C_ACORN 550config I2C_ACORN
498 bool "Acorn IOC/IOMD I2C bus support" 551 bool "Acorn IOC/IOMD I2C bus support"
499 depends on I2C && ARCH_ACORN 552 depends on ARCH_ACORN
500 default y 553 default y
501 select I2C_ALGOBIT 554 select I2C_ALGOBIT
502 help 555 help
@@ -506,7 +559,7 @@ config I2C_ACORN
506 559
507config I2C_VIA 560config I2C_VIA
508 tristate "VIA 82C586B" 561 tristate "VIA 82C586B"
509 depends on I2C && PCI && EXPERIMENTAL 562 depends on PCI && EXPERIMENTAL
510 select I2C_ALGOBIT 563 select I2C_ALGOBIT
511 help 564 help
512 If you say yes to this option, support will be included for the VIA 565 If you say yes to this option, support will be included for the VIA
@@ -517,7 +570,7 @@ config I2C_VIA
517 570
518config I2C_VIAPRO 571config I2C_VIAPRO
519 tristate "VIA VT82C596/82C686/82xx and CX700" 572 tristate "VIA VT82C596/82C686/82xx and CX700"
520 depends on I2C && PCI 573 depends on PCI
521 help 574 help
522 If you say yes to this option, support will be included for the VIA 575 If you say yes to this option, support will be included for the VIA
523 VT82C596 and later SMBus interface. Specifically, the following 576 VT82C596 and later SMBus interface. Specifically, the following
@@ -536,7 +589,7 @@ config I2C_VIAPRO
536 589
537config I2C_VOODOO3 590config I2C_VOODOO3
538 tristate "Voodoo 3" 591 tristate "Voodoo 3"
539 depends on I2C && PCI 592 depends on PCI
540 select I2C_ALGOBIT 593 select I2C_ALGOBIT
541 help 594 help
542 If you say yes to this option, support will be included for the 595 If you say yes to this option, support will be included for the
@@ -547,7 +600,7 @@ config I2C_VOODOO3
547 600
548config I2C_PCA_ISA 601config I2C_PCA_ISA
549 tristate "PCA9564 on an ISA bus" 602 tristate "PCA9564 on an ISA bus"
550 depends on I2C 603 depends on ISA
551 select I2C_ALGOPCA 604 select I2C_ALGOPCA
552 default n 605 default n
553 help 606 help
@@ -564,7 +617,7 @@ config I2C_PCA_ISA
564 617
565config I2C_MV64XXX 618config I2C_MV64XXX
566 tristate "Marvell mv64xxx I2C Controller" 619 tristate "Marvell mv64xxx I2C Controller"
567 depends on I2C && MV64X60 && EXPERIMENTAL 620 depends on MV64X60 && EXPERIMENTAL
568 help 621 help
569 If you say yes to this option, support will be included for the 622 If you say yes to this option, support will be included for the
570 built-in I2C interface on the Marvell 64xxx line of host bridges. 623 built-in I2C interface on the Marvell 64xxx line of host bridges.
@@ -574,7 +627,7 @@ config I2C_MV64XXX
574 627
575config I2C_PNX 628config I2C_PNX
576 tristate "I2C bus support for Philips PNX targets" 629 tristate "I2C bus support for Philips PNX targets"
577 depends on ARCH_PNX4008 && I2C 630 depends on ARCH_PNX4008
578 help 631 help
579 This driver supports the Philips IP3204 I2C IP block master and/or 632 This driver supports the Philips IP3204 I2C IP block master and/or
580 slave controller 633 slave controller
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 290b54018354..14d1432f698b 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -10,7 +10,9 @@ obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o
10obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o 10obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
11obj-$(CONFIG_I2C_AT91) += i2c-at91.o 11obj-$(CONFIG_I2C_AT91) += i2c-at91.o
12obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o 12obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
13obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
13obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o 14obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
15obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
14obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o 16obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o
15obj-$(CONFIG_I2C_I801) += i2c-i801.o 17obj-$(CONFIG_I2C_I801) += i2c-i801.o
16obj-$(CONFIG_I2C_I810) += i2c-i810.o 18obj-$(CONFIG_I2C_I810) += i2c-i810.o
@@ -37,10 +39,12 @@ obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o
37obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o 39obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
38obj-$(CONFIG_I2C_SAVAGE4) += i2c-savage4.o 40obj-$(CONFIG_I2C_SAVAGE4) += i2c-savage4.o
39obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o 41obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
42obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o
40obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o 43obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
41obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o 44obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
42obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o 45obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o
43obj-$(CONFIG_I2C_STUB) += i2c-stub.o 46obj-$(CONFIG_I2C_STUB) += i2c-stub.o
47obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o
44obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o 48obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
45obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o 49obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
46obj-$(CONFIG_I2C_VIA) += i2c-via.o 50obj-$(CONFIG_I2C_VIA) += i2c-via.o
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 1e277ba5a9f3..f14372ac2fc5 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -497,7 +497,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
497 /* set up the sysfs linkage to our parent device */ 497 /* set up the sysfs linkage to our parent device */
498 ali1535_adapter.dev.parent = &dev->dev; 498 ali1535_adapter.dev.parent = &dev->dev;
499 499
500 snprintf(ali1535_adapter.name, I2C_NAME_SIZE, 500 snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name),
501 "SMBus ALI1535 adapter at %04x", ali1535_smba); 501 "SMBus ALI1535 adapter at %04x", ali1535_smba);
502 return i2c_add_adapter(&ali1535_adapter); 502 return i2c_add_adapter(&ali1535_adapter);
503} 503}
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index e47fe01bf42a..93bf87d70961 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -492,7 +492,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
492 /* set up the sysfs linkage to our parent device */ 492 /* set up the sysfs linkage to our parent device */
493 ali15x3_adapter.dev.parent = &dev->dev; 493 ali15x3_adapter.dev.parent = &dev->dev;
494 494
495 snprintf(ali15x3_adapter.name, I2C_NAME_SIZE, 495 snprintf(ali15x3_adapter.name, sizeof(ali15x3_adapter.name),
496 "SMBus ALI15X3 adapter at %04x", ali15x3_smba); 496 "SMBus ALI15X3 adapter at %04x", ali15x3_smba);
497 return i2c_add_adapter(&ali15x3_adapter); 497 return i2c_add_adapter(&ali15x3_adapter);
498} 498}
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0c70f8293341..c9fca7b49267 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -365,7 +365,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
365 } 365 }
366 366
367 smbus->adapter.owner = THIS_MODULE; 367 smbus->adapter.owner = THIS_MODULE;
368 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 368 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
369 "SMBus2 AMD8111 adapter at %04x", smbus->base); 369 "SMBus2 AMD8111 adapter at %04x", smbus->base);
370 smbus->adapter.id = I2C_HW_SMBUS_AMD8111; 370 smbus->adapter.id = I2C_HW_SMBUS_AMD8111;
371 smbus->adapter.class = I2C_CLASS_HWMON; 371 smbus->adapter.class = I2C_CLASS_HWMON;
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 67f91bdda089..f35156c58922 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -17,7 +17,6 @@
17#include <linux/version.h> 17#include <linux/version.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/pci.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/i2c.h> 22#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
new file mode 100644
index 000000000000..6311039dfe60
--- /dev/null
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -0,0 +1,644 @@
1/*
2 * drivers/i2c/busses/i2c-bfin-twi.c
3 *
4 * Description: Driver for Blackfin Two Wire Interface
5 *
6 * Author: sonicz <sonic.zhang@analog.com>
7 *
8 * Copyright (c) 2005-2007 Analog Devices, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/init.h>
28#include <linux/i2c.h>
29#include <linux/mm.h>
30#include <linux/timer.h>
31#include <linux/spinlock.h>
32#include <linux/completion.h>
33#include <linux/interrupt.h>
34#include <linux/platform_device.h>
35
36#include <asm/blackfin.h>
37#include <asm/irq.h>
38
39#define POLL_TIMEOUT (2 * HZ)
40
41/* SMBus mode*/
42#define TWI_I2C_MODE_STANDARD 0x01
43#define TWI_I2C_MODE_STANDARDSUB 0x02
44#define TWI_I2C_MODE_COMBINED 0x04
45
46struct bfin_twi_iface {
47 struct mutex twi_lock;
48 int irq;
49 spinlock_t lock;
50 char read_write;
51 u8 command;
52 u8 *transPtr;
53 int readNum;
54 int writeNum;
55 int cur_mode;
56 int manual_stop;
57 int result;
58 int timeout_count;
59 struct timer_list timeout_timer;
60 struct i2c_adapter adap;
61 struct completion complete;
62};
63
64static struct bfin_twi_iface twi_iface;
65
66static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface)
67{
68 unsigned short twi_int_status = bfin_read_TWI_INT_STAT();
69 unsigned short mast_stat = bfin_read_TWI_MASTER_STAT();
70
71 if (twi_int_status & XMTSERV) {
72 /* Transmit next data */
73 if (iface->writeNum > 0) {
74 bfin_write_TWI_XMT_DATA8(*(iface->transPtr++));
75 iface->writeNum--;
76 }
77 /* start receive immediately after complete sending in
78 * combine mode.
79 */
80 else if (iface->cur_mode == TWI_I2C_MODE_COMBINED) {
81 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL()
82 | MDIR | RSTART);
83 } else if (iface->manual_stop)
84 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL()
85 | STOP);
86 SSYNC();
87 /* Clear status */
88 bfin_write_TWI_INT_STAT(XMTSERV);
89 SSYNC();
90 }
91 if (twi_int_status & RCVSERV) {
92 if (iface->readNum > 0) {
93 /* Receive next data */
94 *(iface->transPtr) = bfin_read_TWI_RCV_DATA8();
95 if (iface->cur_mode == TWI_I2C_MODE_COMBINED) {
96 /* Change combine mode into sub mode after
97 * read first data.
98 */
99 iface->cur_mode = TWI_I2C_MODE_STANDARDSUB;
100 /* Get read number from first byte in block
101 * combine mode.
102 */
103 if (iface->readNum == 1 && iface->manual_stop)
104 iface->readNum = *iface->transPtr + 1;
105 }
106 iface->transPtr++;
107 iface->readNum--;
108 } else if (iface->manual_stop) {
109 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL()
110 | STOP);
111 SSYNC();
112 }
113 /* Clear interrupt source */
114 bfin_write_TWI_INT_STAT(RCVSERV);
115 SSYNC();
116 }
117 if (twi_int_status & MERR) {
118 bfin_write_TWI_INT_STAT(MERR);
119 bfin_write_TWI_INT_MASK(0);
120 bfin_write_TWI_MASTER_STAT(0x3e);
121 bfin_write_TWI_MASTER_CTL(0);
122 SSYNC();
123 iface->result = -1;
124 /* if both err and complete int stats are set, return proper
125 * results.
126 */
127 if (twi_int_status & MCOMP) {
128 bfin_write_TWI_INT_STAT(MCOMP);
129 bfin_write_TWI_INT_MASK(0);
130 bfin_write_TWI_MASTER_CTL(0);
131 SSYNC();
132 /* If it is a quick transfer, only address bug no data,
133 * not an err, return 1.
134 */
135 if (iface->writeNum == 0 && (mast_stat & BUFRDERR))
136 iface->result = 1;
137 /* If address not acknowledged return -1,
138 * else return 0.
139 */
140 else if (!(mast_stat & ANAK))
141 iface->result = 0;
142 }
143 complete(&iface->complete);
144 return;
145 }
146 if (twi_int_status & MCOMP) {
147 bfin_write_TWI_INT_STAT(MCOMP);
148 SSYNC();
149 if (iface->cur_mode == TWI_I2C_MODE_COMBINED) {
150 if (iface->readNum == 0) {
151 /* set the read number to 1 and ask for manual
152 * stop in block combine mode
153 */
154 iface->readNum = 1;
155 iface->manual_stop = 1;
156 bfin_write_TWI_MASTER_CTL(
157 bfin_read_TWI_MASTER_CTL()
158 | (0xff << 6));
159 } else {
160 /* set the readd number in other
161 * combine mode.
162 */
163 bfin_write_TWI_MASTER_CTL(
164 (bfin_read_TWI_MASTER_CTL() &
165 (~(0xff << 6))) |
166 ( iface->readNum << 6));
167 }
168 /* remove restart bit and enable master receive */
169 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() &
170 ~RSTART);
171 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() |
172 MEN | MDIR);
173 SSYNC();
174 } else {
175 iface->result = 1;
176 bfin_write_TWI_INT_MASK(0);
177 bfin_write_TWI_MASTER_CTL(0);
178 SSYNC();
179 complete(&iface->complete);
180 }
181 }
182}
183
184/* Interrupt handler */
185static irqreturn_t bfin_twi_interrupt_entry(int irq, void *dev_id)
186{
187 struct bfin_twi_iface *iface = dev_id;
188 unsigned long flags;
189
190 spin_lock_irqsave(&iface->lock, flags);
191 del_timer(&iface->timeout_timer);
192 bfin_twi_handle_interrupt(iface);
193 spin_unlock_irqrestore(&iface->lock, flags);
194 return IRQ_HANDLED;
195}
196
197static void bfin_twi_timeout(unsigned long data)
198{
199 struct bfin_twi_iface *iface = (struct bfin_twi_iface *)data;
200 unsigned long flags;
201
202 spin_lock_irqsave(&iface->lock, flags);
203 bfin_twi_handle_interrupt(iface);
204 if (iface->result == 0) {
205 iface->timeout_count--;
206 if (iface->timeout_count > 0) {
207 iface->timeout_timer.expires = jiffies + POLL_TIMEOUT;
208 add_timer(&iface->timeout_timer);
209 } else {
210 iface->result = -1;
211 complete(&iface->complete);
212 }
213 }
214 spin_unlock_irqrestore(&iface->lock, flags);
215}
216
217/*
218 * Generic i2c master transfer entrypoint
219 */
220static int bfin_twi_master_xfer(struct i2c_adapter *adap,
221 struct i2c_msg *msgs, int num)
222{
223 struct bfin_twi_iface *iface = adap->algo_data;
224 struct i2c_msg *pmsg;
225 int i, ret;
226 int rc = 0;
227
228 if (!(bfin_read_TWI_CONTROL() & TWI_ENA))
229 return -ENXIO;
230
231 mutex_lock(&iface->twi_lock);
232
233 while (bfin_read_TWI_MASTER_STAT() & BUSBUSY) {
234 mutex_unlock(&iface->twi_lock);
235 yield();
236 mutex_lock(&iface->twi_lock);
237 }
238
239 ret = 0;
240 for (i = 0; rc >= 0 && i < num; i++) {
241 pmsg = &msgs[i];
242 if (pmsg->flags & I2C_M_TEN) {
243 dev_err(&(adap->dev), "i2c-bfin-twi: 10 bits addr "
244 "not supported !\n");
245 rc = -EINVAL;
246 break;
247 }
248
249 iface->cur_mode = TWI_I2C_MODE_STANDARD;
250 iface->manual_stop = 0;
251 iface->transPtr = pmsg->buf;
252 iface->writeNum = iface->readNum = pmsg->len;
253 iface->result = 0;
254 iface->timeout_count = 10;
255 /* Set Transmit device address */
256 bfin_write_TWI_MASTER_ADDR(pmsg->addr);
257
258 /* FIFO Initiation. Data in FIFO should be
259 * discarded before start a new operation.
260 */
261 bfin_write_TWI_FIFO_CTL(0x3);
262 SSYNC();
263 bfin_write_TWI_FIFO_CTL(0);
264 SSYNC();
265
266 if (pmsg->flags & I2C_M_RD)
267 iface->read_write = I2C_SMBUS_READ;
268 else {
269 iface->read_write = I2C_SMBUS_WRITE;
270 /* Transmit first data */
271 if (iface->writeNum > 0) {
272 bfin_write_TWI_XMT_DATA8(*(iface->transPtr++));
273 iface->writeNum--;
274 SSYNC();
275 }
276 }
277
278 /* clear int stat */
279 bfin_write_TWI_INT_STAT(MERR|MCOMP|XMTSERV|RCVSERV);
280
281 /* Interrupt mask . Enable XMT, RCV interrupt */
282 bfin_write_TWI_INT_MASK(MCOMP | MERR |
283 ((iface->read_write == I2C_SMBUS_READ)?
284 RCVSERV : XMTSERV));
285 SSYNC();
286
287 if (pmsg->len > 0 && pmsg->len <= 255)
288 bfin_write_TWI_MASTER_CTL(pmsg->len << 6);
289 else if (pmsg->len > 255) {
290 bfin_write_TWI_MASTER_CTL(0xff << 6);
291 iface->manual_stop = 1;
292 } else
293 break;
294
295 iface->timeout_timer.expires = jiffies + POLL_TIMEOUT;
296 add_timer(&iface->timeout_timer);
297
298 /* Master enable */
299 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() | MEN |
300 ((iface->read_write == I2C_SMBUS_READ) ? MDIR : 0) |
301 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ>100) ? FAST : 0));
302 SSYNC();
303
304 wait_for_completion(&iface->complete);
305
306 rc = iface->result;
307 if (rc == 1)
308 ret++;
309 else if (rc == -1)
310 break;
311 }
312
313 /* Release mutex */
314 mutex_unlock(&iface->twi_lock);
315
316 return ret;
317}
318
319/*
320 * SMBus type transfer entrypoint
321 */
322
323int bfin_twi_smbus_xfer(struct i2c_adapter *adap, u16 addr,
324 unsigned short flags, char read_write,
325 u8 command, int size, union i2c_smbus_data *data)
326{
327 struct bfin_twi_iface *iface = adap->algo_data;
328 int rc = 0;
329
330 if (!(bfin_read_TWI_CONTROL() & TWI_ENA))
331 return -ENXIO;
332
333 mutex_lock(&iface->twi_lock);
334
335 while (bfin_read_TWI_MASTER_STAT() & BUSBUSY) {
336 mutex_unlock(&iface->twi_lock);
337 yield();
338 mutex_lock(&iface->twi_lock);
339 }
340
341 iface->writeNum = 0;
342 iface->readNum = 0;
343
344 /* Prepare datas & select mode */
345 switch (size) {
346 case I2C_SMBUS_QUICK:
347 iface->transPtr = NULL;
348 iface->cur_mode = TWI_I2C_MODE_STANDARD;
349 break;
350 case I2C_SMBUS_BYTE:
351 if (data == NULL)
352 iface->transPtr = NULL;
353 else {
354 if (read_write == I2C_SMBUS_READ)
355 iface->readNum = 1;
356 else
357 iface->writeNum = 1;
358 iface->transPtr = &data->byte;
359 }
360 iface->cur_mode = TWI_I2C_MODE_STANDARD;
361 break;
362 case I2C_SMBUS_BYTE_DATA:
363 if (read_write == I2C_SMBUS_READ) {
364 iface->readNum = 1;
365 iface->cur_mode = TWI_I2C_MODE_COMBINED;
366 } else {
367 iface->writeNum = 1;
368 iface->cur_mode = TWI_I2C_MODE_STANDARDSUB;
369 }
370 iface->transPtr = &data->byte;
371 break;
372 case I2C_SMBUS_WORD_DATA:
373 if (read_write == I2C_SMBUS_READ) {
374 iface->readNum = 2;
375 iface->cur_mode = TWI_I2C_MODE_COMBINED;
376 } else {
377 iface->writeNum = 2;
378 iface->cur_mode = TWI_I2C_MODE_STANDARDSUB;
379 }
380 iface->transPtr = (u8 *)&data->word;
381 break;
382 case I2C_SMBUS_PROC_CALL:
383 iface->writeNum = 2;
384 iface->readNum = 2;
385 iface->cur_mode = TWI_I2C_MODE_COMBINED;
386 iface->transPtr = (u8 *)&data->word;
387 break;
388 case I2C_SMBUS_BLOCK_DATA:
389 if (read_write == I2C_SMBUS_READ) {
390 iface->readNum = 0;
391 iface->cur_mode = TWI_I2C_MODE_COMBINED;
392 } else {
393 iface->writeNum = data->block[0] + 1;
394 iface->cur_mode = TWI_I2C_MODE_STANDARDSUB;
395 }
396 iface->transPtr = data->block;
397 break;
398 default:
399 return -1;
400 }
401
402 iface->result = 0;
403 iface->manual_stop = 0;
404 iface->read_write = read_write;
405 iface->command = command;
406 iface->timeout_count = 10;
407
408 /* FIFO Initiation. Data in FIFO should be discarded before
409 * start a new operation.
410 */
411 bfin_write_TWI_FIFO_CTL(0x3);
412 SSYNC();
413 bfin_write_TWI_FIFO_CTL(0);
414
415 /* clear int stat */
416 bfin_write_TWI_INT_STAT(MERR|MCOMP|XMTSERV|RCVSERV);
417
418 /* Set Transmit device address */
419 bfin_write_TWI_MASTER_ADDR(addr);
420 SSYNC();
421
422 iface->timeout_timer.expires = jiffies + POLL_TIMEOUT;
423 add_timer(&iface->timeout_timer);
424
425 switch (iface->cur_mode) {
426 case TWI_I2C_MODE_STANDARDSUB:
427 bfin_write_TWI_XMT_DATA8(iface->command);
428 bfin_write_TWI_INT_MASK(MCOMP | MERR |
429 ((iface->read_write == I2C_SMBUS_READ) ?
430 RCVSERV : XMTSERV));
431 SSYNC();
432
433 if (iface->writeNum + 1 <= 255)
434 bfin_write_TWI_MASTER_CTL((iface->writeNum + 1) << 6);
435 else {
436 bfin_write_TWI_MASTER_CTL(0xff << 6);
437 iface->manual_stop = 1;
438 }
439 /* Master enable */
440 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() | MEN |
441 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ>100) ? FAST : 0));
442 break;
443 case TWI_I2C_MODE_COMBINED:
444 bfin_write_TWI_XMT_DATA8(iface->command);
445 bfin_write_TWI_INT_MASK(MCOMP | MERR | RCVSERV | XMTSERV);
446 SSYNC();
447
448 if (iface->writeNum > 0)
449 bfin_write_TWI_MASTER_CTL((iface->writeNum + 1) << 6);
450 else
451 bfin_write_TWI_MASTER_CTL(0x1 << 6);
452 /* Master enable */
453 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() | MEN |
454 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ>100) ? FAST : 0));
455 break;
456 default:
457 bfin_write_TWI_MASTER_CTL(0);
458 if (size != I2C_SMBUS_QUICK) {
459 /* Don't access xmit data register when this is a
460 * read operation.
461 */
462 if (iface->read_write != I2C_SMBUS_READ) {
463 if (iface->writeNum > 0) {
464 bfin_write_TWI_XMT_DATA8(*(iface->transPtr++));
465 if (iface->writeNum <= 255)
466 bfin_write_TWI_MASTER_CTL(iface->writeNum << 6);
467 else {
468 bfin_write_TWI_MASTER_CTL(0xff << 6);
469 iface->manual_stop = 1;
470 }
471 iface->writeNum--;
472 } else {
473 bfin_write_TWI_XMT_DATA8(iface->command);
474 bfin_write_TWI_MASTER_CTL(1 << 6);
475 }
476 } else {
477 if (iface->readNum > 0 && iface->readNum <= 255)
478 bfin_write_TWI_MASTER_CTL(iface->readNum << 6);
479 else if (iface->readNum > 255) {
480 bfin_write_TWI_MASTER_CTL(0xff << 6);
481 iface->manual_stop = 1;
482 } else {
483 del_timer(&iface->timeout_timer);
484 break;
485 }
486 }
487 }
488 bfin_write_TWI_INT_MASK(MCOMP | MERR |
489 ((iface->read_write == I2C_SMBUS_READ) ?
490 RCVSERV : XMTSERV));
491 SSYNC();
492
493 /* Master enable */
494 bfin_write_TWI_MASTER_CTL(bfin_read_TWI_MASTER_CTL() | MEN |
495 ((iface->read_write == I2C_SMBUS_READ) ? MDIR : 0) |
496 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ > 100) ? FAST : 0));
497 break;
498 }
499 SSYNC();
500
501 wait_for_completion(&iface->complete);
502
503 rc = (iface->result >= 0) ? 0 : -1;
504
505 /* Release mutex */
506 mutex_unlock(&iface->twi_lock);
507
508 return rc;
509}
510
511/*
512 * Return what the adapter supports
513 */
514static u32 bfin_twi_functionality(struct i2c_adapter *adap)
515{
516 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
517 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
518 I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL |
519 I2C_FUNC_I2C;
520}
521
522
523static struct i2c_algorithm bfin_twi_algorithm = {
524 .master_xfer = bfin_twi_master_xfer,
525 .smbus_xfer = bfin_twi_smbus_xfer,
526 .functionality = bfin_twi_functionality,
527};
528
529
530static int i2c_bfin_twi_suspend(struct platform_device *dev, pm_message_t state)
531{
532/* struct bfin_twi_iface *iface = platform_get_drvdata(dev);*/
533
534 /* Disable TWI */
535 bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() & ~TWI_ENA);
536 SSYNC();
537
538 return 0;
539}
540
541static int i2c_bfin_twi_resume(struct platform_device *dev)
542{
543/* struct bfin_twi_iface *iface = platform_get_drvdata(dev);*/
544
545 /* Enable TWI */
546 bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA);
547 SSYNC();
548
549 return 0;
550}
551
552static int i2c_bfin_twi_probe(struct platform_device *dev)
553{
554 struct bfin_twi_iface *iface = &twi_iface;
555 struct i2c_adapter *p_adap;
556 int rc;
557
558 mutex_init(&(iface->twi_lock));
559 spin_lock_init(&(iface->lock));
560 init_completion(&(iface->complete));
561 iface->irq = IRQ_TWI;
562
563 init_timer(&(iface->timeout_timer));
564 iface->timeout_timer.function = bfin_twi_timeout;
565 iface->timeout_timer.data = (unsigned long)iface;
566
567 p_adap = &iface->adap;
568 p_adap->id = I2C_HW_BLACKFIN;
569 strlcpy(p_adap->name, dev->name, sizeof(p_adap->name));
570 p_adap->algo = &bfin_twi_algorithm;
571 p_adap->algo_data = iface;
572 p_adap->class = I2C_CLASS_ALL;
573 p_adap->dev.parent = &dev->dev;
574
575 rc = request_irq(iface->irq, bfin_twi_interrupt_entry,
576 IRQF_DISABLED, dev->name, iface);
577 if (rc) {
578 dev_err(&(p_adap->dev), "i2c-bfin-twi: can't get IRQ %d !\n",
579 iface->irq);
580 return -ENODEV;
581 }
582
583 /* Set TWI internal clock as 10MHz */
584 bfin_write_TWI_CONTROL(((get_sclk() / 1024 / 1024 + 5) / 10) & 0x7F);
585
586 /* Set Twi interface clock as specified */
587 bfin_write_TWI_CLKDIV((( 5*1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ )
588 << 8) | (( 5*1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ )
589 & 0xFF));
590
591 /* Enable TWI */
592 bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA);
593 SSYNC();
594
595 rc = i2c_add_adapter(p_adap);
596 if (rc < 0)
597 free_irq(iface->irq, iface);
598 else
599 platform_set_drvdata(dev, iface);
600
601 return rc;
602}
603
604static int i2c_bfin_twi_remove(struct platform_device *pdev)
605{
606 struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
607
608 platform_set_drvdata(pdev, NULL);
609
610 i2c_del_adapter(&(iface->adap));
611 free_irq(iface->irq, iface);
612
613 return 0;
614}
615
616static struct platform_driver i2c_bfin_twi_driver = {
617 .probe = i2c_bfin_twi_probe,
618 .remove = i2c_bfin_twi_remove,
619 .suspend = i2c_bfin_twi_suspend,
620 .resume = i2c_bfin_twi_resume,
621 .driver = {
622 .name = "i2c-bfin-twi",
623 .owner = THIS_MODULE,
624 },
625};
626
627static int __init i2c_bfin_twi_init(void)
628{
629 pr_info("I2C: Blackfin I2C TWI driver\n");
630
631 return platform_driver_register(&i2c_bfin_twi_driver);
632}
633
634static void __exit i2c_bfin_twi_exit(void)
635{
636 platform_driver_unregister(&i2c_bfin_twi_driver);
637}
638
639MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
640MODULE_DESCRIPTION("I2C-Bus adapter routines for Blackfin TWI");
641MODULE_LICENSE("GPL");
642
643module_init(i2c_bfin_twi_init);
644module_exit(i2c_bfin_twi_exit);
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 834967464814..804f0a551c05 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -35,6 +35,7 @@
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/wait.h> 36#include <linux/wait.h>
37 37
38#include <linux/isa.h>
38#include <linux/i2c.h> 39#include <linux/i2c.h>
39#include <linux/i2c-algo-pcf.h> 40#include <linux/i2c-algo-pcf.h>
40 41
@@ -207,7 +208,7 @@ static struct i2c_adapter pcf_isa_ops = {
207 .name = "i2c-elektor", 208 .name = "i2c-elektor",
208}; 209};
209 210
210static int __init i2c_pcfisa_init(void) 211static int __devinit elektor_match(struct device *dev, unsigned int id)
211{ 212{
212#ifdef __alpha__ 213#ifdef __alpha__
213 /* check to see we have memory mapped PCF8584 connected to the 214 /* check to see we have memory mapped PCF8584 connected to the
@@ -222,9 +223,8 @@ static int __init i2c_pcfisa_init(void)
222 /* yeap, we've found cypress, let's check config */ 223 /* yeap, we've found cypress, let's check config */
223 if (!pci_read_config_byte(cy693_dev, 0x47, &config)) { 224 if (!pci_read_config_byte(cy693_dev, 0x47, &config)) {
224 225
225 pr_debug("%s: found cy82c693, config " 226 dev_dbg(dev, "found cy82c693, config "
226 "register 0x47 = 0x%02x\n", 227 "register 0x47 = 0x%02x\n", config);
227 pcf_isa_ops.name, config);
228 228
229 /* UP2000 board has this register set to 0xe1, 229 /* UP2000 board has this register set to 0xe1,
230 but the most significant bit as seems can be 230 but the most significant bit as seems can be
@@ -244,9 +244,9 @@ static int __init i2c_pcfisa_init(void)
244 8.25 MHz (PCI/4) clock 244 8.25 MHz (PCI/4) clock
245 (this can be read from cypress) */ 245 (this can be read from cypress) */
246 clock = I2C_PCF_CLK | I2C_PCF_TRNS90; 246 clock = I2C_PCF_CLK | I2C_PCF_TRNS90;
247 pr_info("%s: found API UP2000 like " 247 dev_info(dev, "found API UP2000 like "
248 "board, will probe PCF8584 " 248 "board, will probe PCF8584 "
249 "later\n", pcf_isa_ops.name); 249 "later\n");
250 } 250 }
251 } 251 }
252 pci_dev_put(cy693_dev); 252 pci_dev_put(cy693_dev);
@@ -256,22 +256,27 @@ static int __init i2c_pcfisa_init(void)
256 256
257 /* sanity checks for mmapped I/O */ 257 /* sanity checks for mmapped I/O */
258 if (mmapped && base < 0xc8000) { 258 if (mmapped && base < 0xc8000) {
259 printk(KERN_ERR "%s: incorrect base address (%#x) specified " 259 dev_err(dev, "incorrect base address (%#x) specified "
260 "for mmapped I/O\n", pcf_isa_ops.name, base); 260 "for mmapped I/O\n", base);
261 return -ENODEV; 261 return 0;
262 } 262 }
263 263
264 if (base == 0) { 264 if (base == 0) {
265 base = DEFAULT_BASE; 265 base = DEFAULT_BASE;
266 } 266 }
267 return 1;
268}
267 269
270static int __devinit elektor_probe(struct device *dev, unsigned int id)
271{
268 init_waitqueue_head(&pcf_wait); 272 init_waitqueue_head(&pcf_wait);
269 if (pcf_isa_init()) 273 if (pcf_isa_init())
270 return -ENODEV; 274 return -ENODEV;
275 pcf_isa_ops.dev.parent = dev;
271 if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) 276 if (i2c_pcf_add_bus(&pcf_isa_ops) < 0)
272 goto fail; 277 goto fail;
273 278
274 dev_info(&pcf_isa_ops.dev, "found device at %#x\n", base); 279 dev_info(dev, "found device at %#x\n", base);
275 280
276 return 0; 281 return 0;
277 282
@@ -291,7 +296,7 @@ static int __init i2c_pcfisa_init(void)
291 return -ENODEV; 296 return -ENODEV;
292} 297}
293 298
294static void i2c_pcfisa_exit(void) 299static int __devexit elektor_remove(struct device *dev, unsigned int id)
295{ 300{
296 i2c_del_adapter(&pcf_isa_ops); 301 i2c_del_adapter(&pcf_isa_ops);
297 302
@@ -307,6 +312,28 @@ static void i2c_pcfisa_exit(void)
307 iounmap(base_iomem); 312 iounmap(base_iomem);
308 release_mem_region(base, 2); 313 release_mem_region(base, 2);
309 } 314 }
315
316 return 0;
317}
318
319static struct isa_driver i2c_elektor_driver = {
320 .match = elektor_match,
321 .probe = elektor_probe,
322 .remove = __devexit_p(elektor_remove),
323 .driver = {
324 .owner = THIS_MODULE,
325 .name = "i2c-elektor",
326 },
327};
328
329static int __init i2c_pcfisa_init(void)
330{
331 return isa_register_driver(&i2c_elektor_driver, 1);
332}
333
334static void __exit i2c_pcfisa_exit(void)
335{
336 isa_unregister_driver(&i2c_elektor_driver);
310} 337}
311 338
312MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); 339MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>");
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
new file mode 100644
index 000000000000..a7dd54654a9a
--- /dev/null
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -0,0 +1,215 @@
1/*
2 * Bitbanging I2C bus driver using the GPIO API
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/i2c.h>
11#include <linux/i2c-algo-bit.h>
12#include <linux/i2c-gpio.h>
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16
17#include <asm/gpio.h>
18
19/* Toggle SDA by changing the direction of the pin */
20static void i2c_gpio_setsda_dir(void *data, int state)
21{
22 struct i2c_gpio_platform_data *pdata = data;
23
24 if (state)
25 gpio_direction_input(pdata->sda_pin);
26 else
27 gpio_direction_output(pdata->sda_pin, 0);
28}
29
30/*
31 * Toggle SDA by changing the output value of the pin. This is only
32 * valid for pins configured as open drain (i.e. setting the value
33 * high effectively turns off the output driver.)
34 */
35static void i2c_gpio_setsda_val(void *data, int state)
36{
37 struct i2c_gpio_platform_data *pdata = data;
38
39 gpio_set_value(pdata->sda_pin, state);
40}
41
42/* Toggle SCL by changing the direction of the pin. */
43static void i2c_gpio_setscl_dir(void *data, int state)
44{
45 struct i2c_gpio_platform_data *pdata = data;
46
47 if (state)
48 gpio_direction_input(pdata->scl_pin);
49 else
50 gpio_direction_output(pdata->scl_pin, 0);
51}
52
53/*
54 * Toggle SCL by changing the output value of the pin. This is used
55 * for pins that are configured as open drain and for output-only
56 * pins. The latter case will break the i2c protocol, but it will
57 * often work in practice.
58 */
59static void i2c_gpio_setscl_val(void *data, int state)
60{
61 struct i2c_gpio_platform_data *pdata = data;
62
63 gpio_set_value(pdata->scl_pin, state);
64}
65
66int i2c_gpio_getsda(void *data)
67{
68 struct i2c_gpio_platform_data *pdata = data;
69
70 return gpio_get_value(pdata->sda_pin);
71}
72
73int i2c_gpio_getscl(void *data)
74{
75 struct i2c_gpio_platform_data *pdata = data;
76
77 return gpio_get_value(pdata->scl_pin);
78}
79
80static int __init i2c_gpio_probe(struct platform_device *pdev)
81{
82 struct i2c_gpio_platform_data *pdata;
83 struct i2c_algo_bit_data *bit_data;
84 struct i2c_adapter *adap;
85 int ret;
86
87 pdata = pdev->dev.platform_data;
88 if (!pdata)
89 return -ENXIO;
90
91 ret = -ENOMEM;
92 adap = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
93 if (!adap)
94 goto err_alloc_adap;
95 bit_data = kzalloc(sizeof(struct i2c_algo_bit_data), GFP_KERNEL);
96 if (!bit_data)
97 goto err_alloc_bit_data;
98
99 ret = gpio_request(pdata->sda_pin, "sda");
100 if (ret)
101 goto err_request_sda;
102 ret = gpio_request(pdata->scl_pin, "scl");
103 if (ret)
104 goto err_request_scl;
105
106 if (pdata->sda_is_open_drain) {
107 gpio_direction_output(pdata->sda_pin, 1);
108 bit_data->setsda = i2c_gpio_setsda_val;
109 } else {
110 gpio_direction_input(pdata->sda_pin);
111 bit_data->setsda = i2c_gpio_setsda_dir;
112 }
113
114 if (pdata->scl_is_open_drain || pdata->scl_is_output_only) {
115 gpio_direction_output(pdata->scl_pin, 1);
116 bit_data->setscl = i2c_gpio_setscl_val;
117 } else {
118 gpio_direction_input(pdata->scl_pin);
119 bit_data->setscl = i2c_gpio_setscl_dir;
120 }
121
122 if (!pdata->scl_is_output_only)
123 bit_data->getscl = i2c_gpio_getscl;
124 bit_data->getsda = i2c_gpio_getsda;
125
126 if (pdata->udelay)
127 bit_data->udelay = pdata->udelay;
128 else if (pdata->scl_is_output_only)
129 bit_data->udelay = 50; /* 10 kHz */
130 else
131 bit_data->udelay = 5; /* 100 kHz */
132
133 if (pdata->timeout)
134 bit_data->timeout = pdata->timeout;
135 else
136 bit_data->timeout = HZ / 10; /* 100 ms */
137
138 bit_data->data = pdata;
139
140 adap->owner = THIS_MODULE;
141 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
142 adap->algo_data = bit_data;
143 adap->dev.parent = &pdev->dev;
144
145 ret = i2c_bit_add_bus(adap);
146 if (ret)
147 goto err_add_bus;
148
149 platform_set_drvdata(pdev, adap);
150
151 dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
152 pdata->sda_pin, pdata->scl_pin,
153 pdata->scl_is_output_only
154 ? ", no clock stretching" : "");
155
156 return 0;
157
158err_add_bus:
159 gpio_free(pdata->scl_pin);
160err_request_scl:
161 gpio_free(pdata->sda_pin);
162err_request_sda:
163 kfree(bit_data);
164err_alloc_bit_data:
165 kfree(adap);
166err_alloc_adap:
167 return ret;
168}
169
170static int __exit i2c_gpio_remove(struct platform_device *pdev)
171{
172 struct i2c_gpio_platform_data *pdata;
173 struct i2c_adapter *adap;
174
175 adap = platform_get_drvdata(pdev);
176 pdata = pdev->dev.platform_data;
177
178 i2c_del_adapter(adap);
179 gpio_free(pdata->scl_pin);
180 gpio_free(pdata->sda_pin);
181 kfree(adap->algo_data);
182 kfree(adap);
183
184 return 0;
185}
186
187static struct platform_driver i2c_gpio_driver = {
188 .driver = {
189 .name = "i2c-gpio",
190 .owner = THIS_MODULE,
191 },
192 .remove = __exit_p(i2c_gpio_remove),
193};
194
195static int __init i2c_gpio_init(void)
196{
197 int ret;
198
199 ret = platform_driver_probe(&i2c_gpio_driver, i2c_gpio_probe);
200 if (ret)
201 printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
202
203 return ret;
204}
205module_init(i2c_gpio_init);
206
207static void __exit i2c_gpio_exit(void)
208{
209 platform_driver_unregister(&i2c_gpio_driver);
210}
211module_exit(i2c_gpio_exit);
212
213MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
214MODULE_DESCRIPTION("Platform-independent bitbanging I2C driver");
215MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index a320e7d82c1f..611b57192c96 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -527,7 +527,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
527 /* set up the sysfs linkage to our parent device */ 527 /* set up the sysfs linkage to our parent device */
528 i801_adapter.dev.parent = &dev->dev; 528 i801_adapter.dev.parent = &dev->dev;
529 529
530 snprintf(i801_adapter.name, I2C_NAME_SIZE, 530 snprintf(i801_adapter.name, sizeof(i801_adapter.name),
531 "SMBus I801 adapter at %04lx", i801_smba); 531 "SMBus I801 adapter at %04lx", i801_smba);
532 err = i2c_add_adapter(&i801_adapter); 532 err = i2c_add_adapter(&i801_adapter);
533 if (err) { 533 if (err) {
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 5f33bc9c1e02..b0e1370075de 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -41,6 +41,10 @@
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43 43
44/* Exported by i2c-core for i2c-isa only */
45extern void i2c_adapter_dev_release(struct device *dev);
46extern struct class i2c_adapter_class;
47
44static u32 isa_func(struct i2c_adapter *adapter); 48static u32 isa_func(struct i2c_adapter *adapter);
45 49
46/* This is the actual algorithm we define */ 50/* This is the actual algorithm we define */
@@ -64,16 +68,6 @@ static u32 isa_func(struct i2c_adapter *adapter)
64} 68}
65 69
66 70
67/* Copied from i2c-core */
68static ssize_t show_adapter_name(struct device *dev,
69 struct device_attribute *attr, char *buf)
70{
71 struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
72 return sprintf(buf, "%s\n", adap->name);
73}
74static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
75
76
77/* We implement an interface which resembles i2c_{add,del}_driver, 71/* We implement an interface which resembles i2c_{add,del}_driver,
78 but for i2c-isa drivers. We don't have to remember and handle lists 72 but for i2c-isa drivers. We don't have to remember and handle lists
79 of drivers and adapters so this is much more simple, of course. */ 73 of drivers and adapters so this is much more simple, of course. */
@@ -139,41 +133,18 @@ static int __init i2c_isa_init(void)
139 isa_adapter.nr = ANY_I2C_ISA_BUS; 133 isa_adapter.nr = ANY_I2C_ISA_BUS;
140 isa_adapter.dev.parent = &platform_bus; 134 isa_adapter.dev.parent = &platform_bus;
141 sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr); 135 sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr);
142 isa_adapter.dev.driver = &i2c_adapter_driver;
143 isa_adapter.dev.release = &i2c_adapter_dev_release; 136 isa_adapter.dev.release = &i2c_adapter_dev_release;
137 isa_adapter.dev.class = &i2c_adapter_class;
144 err = device_register(&isa_adapter.dev); 138 err = device_register(&isa_adapter.dev);
145 if (err) { 139 if (err) {
146 printk(KERN_ERR "i2c-isa: Failed to register device\n"); 140 printk(KERN_ERR "i2c-isa: Failed to register device\n");
147 goto exit; 141 goto exit;
148 } 142 }
149 err = device_create_file(&isa_adapter.dev, &dev_attr_name);
150 if (err) {
151 printk(KERN_ERR "i2c-isa: Failed to create name file\n");
152 goto exit_unregister;
153 }
154
155 /* Add this adapter to the i2c_adapter class */
156 memset(&isa_adapter.class_dev, 0x00, sizeof(struct class_device));
157 isa_adapter.class_dev.dev = &isa_adapter.dev;
158 isa_adapter.class_dev.class = &i2c_adapter_class;
159 strlcpy(isa_adapter.class_dev.class_id, isa_adapter.dev.bus_id,
160 BUS_ID_SIZE);
161 err = class_device_register(&isa_adapter.class_dev);
162 if (err) {
163 printk(KERN_ERR "i2c-isa: Failed to register class device\n");
164 goto exit_remove_name;
165 }
166 143
167 dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name); 144 dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name);
168 145
169 return 0; 146 return 0;
170 147
171exit_remove_name:
172 device_remove_file(&isa_adapter.dev, &dev_attr_name);
173exit_unregister:
174 init_completion(&isa_adapter.dev_released); /* Needed? */
175 device_unregister(&isa_adapter.dev);
176 wait_for_completion(&isa_adapter.dev_released);
177exit: 148exit:
178 return err; 149 return err;
179} 150}
@@ -201,15 +172,11 @@ static void __exit i2c_isa_exit(void)
201 /* Clean up the sysfs representation */ 172 /* Clean up the sysfs representation */
202 dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n"); 173 dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n");
203 init_completion(&isa_adapter.dev_released); 174 init_completion(&isa_adapter.dev_released);
204 init_completion(&isa_adapter.class_dev_released);
205 class_device_unregister(&isa_adapter.class_dev);
206 device_remove_file(&isa_adapter.dev, &dev_attr_name);
207 device_unregister(&isa_adapter.dev); 175 device_unregister(&isa_adapter.dev);
208 176
209 /* Wait for sysfs to drop all references */ 177 /* Wait for sysfs to drop all references */
210 dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n"); 178 dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n");
211 wait_for_completion(&isa_adapter.dev_released); 179 wait_for_completion(&isa_adapter.dev_released);
212 wait_for_completion(&isa_adapter.class_dev_released);
213 180
214 dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name); 181 dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name);
215} 182}
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index efa3ecc5522a..6352121a2827 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -118,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
118 118
119 drv_data->adapter.id = I2C_HW_B_IXP2000, 119 drv_data->adapter.id = I2C_HW_B_IXP2000,
120 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, 120 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
121 I2C_NAME_SIZE); 121 sizeof(drv_data->adapter.name));
122 drv_data->adapter.algo_data = &drv_data->algo_data, 122 drv_data->adapter.algo_data = &drv_data->algo_data,
123 123
124 drv_data->adapter.dev.parent = &plat_dev->dev; 124 drv_data->adapter.dev.parent = &plat_dev->dev;
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index 08e89b83984a..069ed7f3b395 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -127,7 +127,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
127 drv_data->adapter.id = I2C_HW_B_IXP4XX; 127 drv_data->adapter.id = I2C_HW_B_IXP4XX;
128 drv_data->adapter.class = I2C_CLASS_HWMON; 128 drv_data->adapter.class = I2C_CLASS_HWMON;
129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, 129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
130 I2C_NAME_SIZE); 130 sizeof(drv_data->adapter.name));
131 drv_data->adapter.algo_data = &drv_data->algo_data; 131 drv_data->adapter.algo_data = &drv_data->algo_data;
132 132
133 drv_data->adapter.dev.parent = &plat_dev->dev; 133 drv_data->adapter.dev.parent = &plat_dev->dev;
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index ee65aa1be13a..c6b6898592b1 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,7 +17,6 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/pci.h>
21#include <linux/platform_device.h> 20#include <linux/platform_device.h>
22 21
23#include <asm/io.h> 22#include <asm/io.h>
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index a3283b907eb8..a55b3335d1be 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -508,7 +508,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
508 } 508 }
509 509
510 strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", 510 strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
511 I2C_NAME_SIZE); 511 sizeof(drv_data->adapter.name));
512 512
513 init_waitqueue_head(&drv_data->waitq); 513 init_waitqueue_head(&drv_data->waitq);
514 spin_lock_init(&drv_data->lock); 514 spin_lock_init(&drv_data->lock);
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 1514ec5b77f8..3cd0d63e7b50 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -33,6 +33,8 @@
33 nForce4 MCP-04 0034 33 nForce4 MCP-04 0034
34 nForce4 MCP51 0264 34 nForce4 MCP51 0264
35 nForce4 MCP55 0368 35 nForce4 MCP55 0368
36 nForce MCP61 03EB
37 nForce MCP65 0446
36 38
37 This driver supports the 2 SMBuses that are included in the MCP of the 39 This driver supports the 2 SMBuses that are included in the MCP of the
38 nForce2/3/4/5xx chipsets. 40 nForce2/3/4/5xx chipsets.
@@ -200,6 +202,8 @@ static struct pci_device_id nforce2_ids[] = {
200 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) }, 202 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) },
201 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS) }, 203 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS) },
202 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS) }, 204 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS) },
205 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS) },
206 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS) },
203 { 0 } 207 { 0 }
204}; 208};
205 209
@@ -240,7 +244,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
240 smbus->adapter.algo = &smbus_algorithm; 244 smbus->adapter.algo = &smbus_algorithm;
241 smbus->adapter.algo_data = smbus; 245 smbus->adapter.algo_data = smbus;
242 smbus->adapter.dev.parent = &dev->dev; 246 smbus->adapter.dev.parent = &dev->dev;
243 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 247 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
244 "SMBus nForce2 adapter at %04x", smbus->base); 248 "SMBus nForce2 adapter at %04x", smbus->base);
245 249
246 error = i2c_add_adapter(&smbus->adapter); 250 error = i2c_add_adapter(&smbus->adapter);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index bcd8367cede1..e471e3bfdc1e 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -605,7 +605,8 @@ omap_i2c_probe(struct platform_device *pdev)
605 adap->dev.parent = &pdev->dev; 605 adap->dev.parent = &pdev->dev;
606 606
607 /* i2c device drivers may be active on return from add_adapter() */ 607 /* i2c device drivers may be active on return from add_adapter() */
608 r = i2c_add_adapter(adap); 608 adap->nr = pdev->id;
609 r = i2c_add_numbered_adapter(adap);
609 if (r) { 610 if (r) {
610 dev_err(dev->dev, "failure adding adapter\n"); 611 dev_err(dev->dev, "failure adding adapter\n");
611 goto err_free_irq; 612 goto err_free_irq;
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 4bc42810b9aa..49a95e2887bc 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -1,7 +1,7 @@
1/* ------------------------------------------------------------------------ * 1/* ------------------------------------------------------------------------ *
2 * i2c-parport.c I2C bus over parallel port * 2 * i2c-parport-light.c I2C bus over parallel port *
3 * ------------------------------------------------------------------------ * 3 * ------------------------------------------------------------------------ *
4 Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org> 4 Copyright (C) 2003-2007 Jean Delvare <khali@linux-fr.org>
5 5
6 Based on older i2c-velleman.c driver 6 Based on older i2c-velleman.c driver
7 Copyright (C) 1995-2000 Simon G. Vogl 7 Copyright (C) 1995-2000 Simon G. Vogl
@@ -27,6 +27,7 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/platform_device.h>
30#include <linux/ioport.h> 31#include <linux/ioport.h>
31#include <linux/i2c.h> 32#include <linux/i2c.h>
32#include <linux/i2c-algo-bit.h> 33#include <linux/i2c-algo-bit.h>
@@ -34,6 +35,9 @@
34#include "i2c-parport.h" 35#include "i2c-parport.h"
35 36
36#define DEFAULT_BASE 0x378 37#define DEFAULT_BASE 0x378
38#define DRVNAME "i2c-parport-light"
39
40static struct platform_device *pdev;
37 41
38static u16 base; 42static u16 base;
39module_param(base, ushort, 0); 43module_param(base, ushort, 0);
@@ -106,7 +110,7 @@ static struct i2c_algo_bit_data parport_algo_data = {
106 .timeout = HZ, 110 .timeout = HZ,
107}; 111};
108 112
109/* ----- I2c structure ---------------------------------------------------- */ 113/* ----- Driver registration ---------------------------------------------- */
110 114
111static struct i2c_adapter parport_adapter = { 115static struct i2c_adapter parport_adapter = {
112 .owner = THIS_MODULE, 116 .owner = THIS_MODULE,
@@ -116,55 +120,141 @@ static struct i2c_adapter parport_adapter = {
116 .name = "Parallel port adapter (light)", 120 .name = "Parallel port adapter (light)",
117}; 121};
118 122
119/* ----- Module loading, unloading and information ------------------------ */ 123static int __devinit i2c_parport_probe(struct platform_device *pdev)
124{
125 int err;
126 struct resource *res;
127
128 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
129 if (!request_region(res->start, res->end - res->start + 1, DRVNAME))
130 return -EBUSY;
131
132 /* Reset hardware to a sane state (SCL and SDA high) */
133 parport_setsda(NULL, 1);
134 parport_setscl(NULL, 1);
135 /* Other init if needed (power on...) */
136 if (adapter_parm[type].init.val)
137 line_set(1, &adapter_parm[type].init);
138
139 parport_adapter.dev.parent = &pdev->dev;
140 err = i2c_bit_add_bus(&parport_adapter);
141 if (err) {
142 dev_err(&pdev->dev, "Unable to register with I2C\n");
143 goto exit_region;
144 }
145 return 0;
146
147exit_region:
148 release_region(res->start, res->end - res->start + 1);
149 return err;
150}
151
152static int __devexit i2c_parport_remove(struct platform_device *pdev)
153{
154 struct resource *res;
155
156 i2c_del_adapter(&parport_adapter);
157
158 /* Un-init if needed (power off...) */
159 if (adapter_parm[type].init.val)
160 line_set(0, &adapter_parm[type].init);
161
162 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
163 release_region(res->start, res->end - res->start + 1);
164 return 0;
165}
166
167static struct platform_driver i2c_parport_driver = {
168 .driver = {
169 .owner = THIS_MODULE,
170 .name = DRVNAME,
171 },
172 .probe = i2c_parport_probe,
173 .remove = __devexit_p(i2c_parport_remove),
174};
175
176static int __init i2c_parport_device_add(u16 address)
177{
178 struct resource res = {
179 .start = address,
180 .end = address + 2,
181 .name = DRVNAME,
182 .flags = IORESOURCE_IO,
183 };
184 int err;
185
186 pdev = platform_device_alloc(DRVNAME, -1);
187 if (!pdev) {
188 err = -ENOMEM;
189 printk(KERN_ERR DRVNAME ": Device allocation failed\n");
190 goto exit;
191 }
192
193 err = platform_device_add_resources(pdev, &res, 1);
194 if (err) {
195 printk(KERN_ERR DRVNAME ": Device resource addition failed "
196 "(%d)\n", err);
197 goto exit_device_put;
198 }
199
200 err = platform_device_add(pdev);
201 if (err) {
202 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
203 err);
204 goto exit_device_put;
205 }
206
207 return 0;
208
209exit_device_put:
210 platform_device_put(pdev);
211exit:
212 return err;
213}
120 214
121static int __init i2c_parport_init(void) 215static int __init i2c_parport_init(void)
122{ 216{
217 int err;
218
123 if (type < 0) { 219 if (type < 0) {
124 printk(KERN_WARNING "i2c-parport: adapter type unspecified\n"); 220 printk(KERN_ERR DRVNAME ": adapter type unspecified\n");
125 return -ENODEV; 221 return -ENODEV;
126 } 222 }
127 223
128 if (type >= ARRAY_SIZE(adapter_parm)) { 224 if (type >= ARRAY_SIZE(adapter_parm)) {
129 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 225 printk(KERN_ERR DRVNAME ": invalid type (%d)\n", type);
130 return -ENODEV; 226 return -ENODEV;
131 } 227 }
132 228
133 if (base == 0) { 229 if (base == 0) {
134 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE); 230 pr_info(DRVNAME ": using default base 0x%x\n", DEFAULT_BASE);
135 base = DEFAULT_BASE; 231 base = DEFAULT_BASE;
136 } 232 }
137 233
138 if (!request_region(base, 3, "i2c-parport"))
139 return -ENODEV;
140
141 if (!adapter_parm[type].getscl.val) 234 if (!adapter_parm[type].getscl.val)
142 parport_algo_data.getscl = NULL; 235 parport_algo_data.getscl = NULL;
143 236
144 /* Reset hardware to a sane state (SCL and SDA high) */ 237 /* Sets global pdev as a side effect */
145 parport_setsda(NULL, 1); 238 err = i2c_parport_device_add(base);
146 parport_setscl(NULL, 1); 239 if (err)
147 /* Other init if needed (power on...) */ 240 goto exit;
148 if (adapter_parm[type].init.val)
149 line_set(1, &adapter_parm[type].init);
150 241
151 if (i2c_bit_add_bus(&parport_adapter) < 0) { 242 err = platform_driver_register(&i2c_parport_driver);
152 printk(KERN_ERR "i2c-parport: Unable to register with I2C\n"); 243 if (err)
153 release_region(base, 3); 244 goto exit_device;
154 return -ENODEV;
155 }
156 245
157 return 0; 246 return 0;
247
248exit_device:
249 platform_device_unregister(pdev);
250exit:
251 return err;
158} 252}
159 253
160static void __exit i2c_parport_exit(void) 254static void __exit i2c_parport_exit(void)
161{ 255{
162 /* Un-init if needed (power off...) */ 256 platform_driver_unregister(&i2c_parport_driver);
163 if (adapter_parm[type].init.val) 257 platform_device_unregister(pdev);
164 line_set(0, &adapter_parm[type].init);
165
166 i2c_del_adapter(&parport_adapter);
167 release_region(base, 3);
168} 258}
169 259
170MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); 260MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 66696a40c7b5..8c953707253f 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -1,7 +1,7 @@
1/* ------------------------------------------------------------------------ * 1/* ------------------------------------------------------------------------ *
2 * i2c-parport.c I2C bus over parallel port * 2 * i2c-parport.c I2C bus over parallel port *
3 * ------------------------------------------------------------------------ * 3 * ------------------------------------------------------------------------ *
4 Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org> 4 Copyright (C) 2003-2007 Jean Delvare <khali@linux-fr.org>
5 5
6 Based on older i2c-philips-par.c driver 6 Based on older i2c-philips-par.c driver
7 Copyright (C) 1995-2000 Simon G. Vogl 7 Copyright (C) 1995-2000 Simon G. Vogl
@@ -137,19 +137,12 @@ static struct i2c_algo_bit_data parport_algo_data = {
137 .setscl = parport_setscl, 137 .setscl = parport_setscl,
138 .getsda = parport_getsda, 138 .getsda = parport_getsda,
139 .getscl = parport_getscl, 139 .getscl = parport_getscl,
140 .udelay = 60, 140 .udelay = 10, /* ~50 kbps */
141 .timeout = HZ, 141 .timeout = HZ,
142}; 142};
143 143
144/* ----- I2c and parallel port call-back functions and structures --------- */ 144/* ----- I2c and parallel port call-back functions and structures --------- */
145 145
146static struct i2c_adapter parport_adapter = {
147 .owner = THIS_MODULE,
148 .class = I2C_CLASS_HWMON,
149 .id = I2C_HW_B_LP,
150 .name = "Parallel port adapter",
151};
152
153static void i2c_parport_attach (struct parport *port) 146static void i2c_parport_attach (struct parport *port)
154{ 147{
155 struct i2c_par *adapter; 148 struct i2c_par *adapter;
@@ -169,10 +162,17 @@ static void i2c_parport_attach (struct parport *port)
169 } 162 }
170 163
171 /* Fill the rest of the structure */ 164 /* Fill the rest of the structure */
172 adapter->adapter = parport_adapter; 165 adapter->adapter.owner = THIS_MODULE;
166 adapter->adapter.class = I2C_CLASS_HWMON;
167 adapter->adapter.id = I2C_HW_B_LP;
168 strlcpy(adapter->adapter.name, "Parallel port adapter",
169 sizeof(adapter->adapter.name));
173 adapter->algo_data = parport_algo_data; 170 adapter->algo_data = parport_algo_data;
174 if (!adapter_parm[type].getscl.val) 171 /* Slow down if we can't sense SCL */
172 if (!adapter_parm[type].getscl.val) {
175 adapter->algo_data.getscl = NULL; 173 adapter->algo_data.getscl = NULL;
174 adapter->algo_data.udelay = 50; /* ~10 kbps */
175 }
176 adapter->algo_data.data = port; 176 adapter->algo_data.data = port;
177 adapter->adapter.algo_data = &adapter->algo_data; 177 adapter->adapter.algo_data = &adapter->algo_data;
178 178
@@ -214,11 +214,12 @@ static void i2c_parport_detach (struct parport *port)
214 for (prev = NULL, adapter = adapter_list; adapter; 214 for (prev = NULL, adapter = adapter_list; adapter;
215 prev = adapter, adapter = adapter->next) { 215 prev = adapter, adapter = adapter->next) {
216 if (adapter->pdev->port == port) { 216 if (adapter->pdev->port == port) {
217 i2c_del_adapter(&adapter->adapter);
218
217 /* Un-init if needed (power off...) */ 219 /* Un-init if needed (power off...) */
218 if (adapter_parm[type].init.val) 220 if (adapter_parm[type].init.val)
219 line_set(port, 0, &adapter_parm[type].init); 221 line_set(port, 0, &adapter_parm[type].init);
220 222
221 i2c_del_adapter(&adapter->adapter);
222 parport_unregister_device(adapter->pdev); 223 parport_unregister_device(adapter->pdev);
223 if (prev) 224 if (prev)
224 prev->next = adapter->next; 225 prev->next = adapter->next;
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index bf89eeef74e9..58e32714afb5 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -358,7 +358,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
358 } 358 }
359 359
360 smbus->adapter.owner = THIS_MODULE; 360 smbus->adapter.owner = THIS_MODULE;
361 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 361 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
362 "PA Semi SMBus adapter at 0x%lx", smbus->base); 362 "PA Semi SMBus adapter at 0x%lx", smbus->base);
363 smbus->adapter.class = I2C_CLASS_HWMON; 363 smbus->adapter.class = I2C_CLASS_HWMON;
364 smbus->adapter.algo = &smbus_algorithm; 364 smbus->adapter.algo = &smbus_algorithm;
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index cc6536a19eca..5161aaf9341b 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -25,9 +25,9 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/pci.h>
29#include <linux/wait.h> 28#include <linux/wait.h>
30 29
30#include <linux/isa.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/i2c-algo-pca.h> 32#include <linux/i2c-algo-pca.h>
33 33
@@ -119,27 +119,26 @@ static struct i2c_adapter pca_isa_ops = {
119 .name = "PCA9564 ISA Adapter", 119 .name = "PCA9564 ISA Adapter",
120}; 120};
121 121
122static int __init pca_isa_init(void) 122static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
123{ 123{
124
125 init_waitqueue_head(&pca_wait); 124 init_waitqueue_head(&pca_wait);
126 125
127 printk(KERN_INFO "i2c-pca-isa: i/o base %#08lx. irq %d\n", base, irq); 126 dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
128 127
129 if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { 128 if (!request_region(base, IO_SIZE, "i2c-pca-isa")) {
130 printk(KERN_ERR "i2c-pca-isa: I/O address %#08lx is in use.\n", base); 129 dev_err(dev, "I/O address %#08lx is in use\n", base);
131 goto out; 130 goto out;
132 } 131 }
133 132
134 if (irq > -1) { 133 if (irq > -1) {
135 if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) { 134 if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) {
136 printk(KERN_ERR "i2c-pca-isa: Request irq%d failed\n", irq); 135 dev_err(dev, "Request irq%d failed\n", irq);
137 goto out_region; 136 goto out_region;
138 } 137 }
139 } 138 }
140 139
141 if (i2c_pca_add_bus(&pca_isa_ops) < 0) { 140 if (i2c_pca_add_bus(&pca_isa_ops) < 0) {
142 printk(KERN_ERR "i2c-pca-isa: Failed to add i2c bus\n"); 141 dev_err(dev, "Failed to add i2c bus\n");
143 goto out_irq; 142 goto out_irq;
144 } 143 }
145 144
@@ -154,7 +153,7 @@ static int __init pca_isa_init(void)
154 return -ENODEV; 153 return -ENODEV;
155} 154}
156 155
157static void pca_isa_exit(void) 156static int __devexit pca_isa_remove(struct device *dev, unsigned int id)
158{ 157{
159 i2c_del_adapter(&pca_isa_ops); 158 i2c_del_adapter(&pca_isa_ops);
160 159
@@ -163,6 +162,27 @@ static void pca_isa_exit(void)
163 free_irq(irq, &pca_isa_ops); 162 free_irq(irq, &pca_isa_ops);
164 } 163 }
165 release_region(base, IO_SIZE); 164 release_region(base, IO_SIZE);
165
166 return 0;
167}
168
169static struct isa_driver pca_isa_driver = {
170 .probe = pca_isa_probe,
171 .remove = __devexit_p(pca_isa_remove),
172 .driver = {
173 .owner = THIS_MODULE,
174 .name = "i2c-pca-isa",
175 }
176};
177
178static int __init pca_isa_init(void)
179{
180 return isa_register_driver(&pca_isa_driver, 1);
181}
182
183static void __exit pca_isa_exit(void)
184{
185 isa_unregister_driver(&pca_isa_driver);
166} 186}
167 187
168MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); 188MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>");
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 21b180904085..5a52bf5e3fb0 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -428,7 +428,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,
428 /* set up the sysfs linkage to our parent device */ 428 /* set up the sysfs linkage to our parent device */
429 piix4_adapter.dev.parent = &dev->dev; 429 piix4_adapter.dev.parent = &dev->dev;
430 430
431 snprintf(piix4_adapter.name, I2C_NAME_SIZE, 431 snprintf(piix4_adapter.name, sizeof(piix4_adapter.name),
432 "SMBus PIIX4 adapter at %04x", piix4_smba); 432 "SMBus PIIX4 adapter at %04x", piix4_smba);
433 433
434 if ((retval = i2c_add_adapter(&piix4_adapter))) { 434 if ((retval = i2c_add_adapter(&piix4_adapter))) {
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 14e83d0aac8c..873544ab598e 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -539,6 +539,18 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
539 writel(icr | ICR_START | ICR_TB, _ICR(i2c)); 539 writel(icr | ICR_START | ICR_TB, _ICR(i2c));
540} 540}
541 541
542static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
543{
544 u32 icr;
545
546 /*
547 * Clear the STOP and ACK flags
548 */
549 icr = readl(_ICR(i2c));
550 icr &= ~(ICR_STOP | ICR_ACKNAK);
551 writel(icr, _IRC(i2c));
552}
553
542/* 554/*
543 * We are protected by the adapter bus mutex. 555 * We are protected by the adapter bus mutex.
544 */ 556 */
@@ -581,6 +593,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
581 * The rest of the processing occurs in the interrupt handler. 593 * The rest of the processing occurs in the interrupt handler.
582 */ 594 */
583 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); 595 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
596 i2c_pxa_stop_message(i2c);
584 597
585 /* 598 /*
586 * We place the return code in i2c->msg_idx. 599 * We place the return code in i2c->msg_idx.
@@ -825,7 +838,7 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
825}; 838};
826 839
827static struct pxa_i2c i2c_pxa = { 840static struct pxa_i2c i2c_pxa = {
828 .lock = SPIN_LOCK_UNLOCKED, 841 .lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock),
829 .adap = { 842 .adap = {
830 .owner = THIS_MODULE, 843 .owner = THIS_MODULE,
831 .algo = &i2c_pxa_algorithm, 844 .algo = &i2c_pxa_algorithm,
@@ -839,9 +852,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
839{ 852{
840 struct pxa_i2c *i2c = &i2c_pxa; 853 struct pxa_i2c *i2c = &i2c_pxa;
841 struct resource *res; 854 struct resource *res;
842#ifdef CONFIG_I2C_PXA_SLAVE
843 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 855 struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
844#endif
845 int ret; 856 int ret;
846 int irq; 857 int irq;
847 858
@@ -889,14 +900,14 @@ static int i2c_pxa_probe(struct platform_device *dev)
889 pxa_gpio_mode(GPIO117_I2CSCL_MD); 900 pxa_gpio_mode(GPIO117_I2CSCL_MD);
890 pxa_gpio_mode(GPIO118_I2CSDA_MD); 901 pxa_gpio_mode(GPIO118_I2CSDA_MD);
891#endif 902#endif
892 pxa_set_cken(CKEN14_I2C, 1); 903 pxa_set_cken(CKEN_I2C, 1);
893 break; 904 break;
894#ifdef CONFIG_PXA27x 905#ifdef CONFIG_PXA27x
895 case 1: 906 case 1:
896 local_irq_disable(); 907 local_irq_disable();
897 PCFR |= PCFR_PI2CEN; 908 PCFR |= PCFR_PI2CEN;
898 local_irq_enable(); 909 local_irq_enable();
899 pxa_set_cken(CKEN15_PWRI2C, 1); 910 pxa_set_cken(CKEN_PWRI2C, 1);
900#endif 911#endif
901 } 912 }
902 913
@@ -911,6 +922,10 @@ static int i2c_pxa_probe(struct platform_device *dev)
911 i2c->adap.algo_data = i2c; 922 i2c->adap.algo_data = i2c;
912 i2c->adap.dev.parent = &dev->dev; 923 i2c->adap.dev.parent = &dev->dev;
913 924
925 if (plat) {
926 i2c->adap.class = plat->class;
927 }
928
914 ret = i2c_add_adapter(&i2c->adap); 929 ret = i2c_add_adapter(&i2c->adap);
915 if (ret < 0) { 930 if (ret < 0) {
916 printk(KERN_INFO "I2C: Failed to add bus\n"); 931 printk(KERN_INFO "I2C: Failed to add bus\n");
@@ -933,11 +948,11 @@ eadapt:
933ereqirq: 948ereqirq:
934 switch (dev->id) { 949 switch (dev->id) {
935 case 0: 950 case 0:
936 pxa_set_cken(CKEN14_I2C, 0); 951 pxa_set_cken(CKEN_I2C, 0);
937 break; 952 break;
938#ifdef CONFIG_PXA27x 953#ifdef CONFIG_PXA27x
939 case 1: 954 case 1:
940 pxa_set_cken(CKEN15_PWRI2C, 0); 955 pxa_set_cken(CKEN_PWRI2C, 0);
941 local_irq_disable(); 956 local_irq_disable();
942 PCFR &= ~PCFR_PI2CEN; 957 PCFR &= ~PCFR_PI2CEN;
943 local_irq_enable(); 958 local_irq_enable();
@@ -960,11 +975,11 @@ static int i2c_pxa_remove(struct platform_device *dev)
960 free_irq(i2c->irq, i2c); 975 free_irq(i2c->irq, i2c);
961 switch (dev->id) { 976 switch (dev->id) {
962 case 0: 977 case 0:
963 pxa_set_cken(CKEN14_I2C, 0); 978 pxa_set_cken(CKEN_I2C, 0);
964 break; 979 break;
965#ifdef CONFIG_PXA27x 980#ifdef CONFIG_PXA27x
966 case 1: 981 case 1:
967 pxa_set_cken(CKEN15_PWRI2C, 0); 982 pxa_set_cken(CKEN_PWRI2C, 0);
968 local_irq_disable(); 983 local_irq_disable();
969 PCFR &= ~PCFR_PI2CEN; 984 PCFR &= ~PCFR_PI2CEN;
970 local_irq_enable(); 985 local_irq_enable();
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 556f244aae76..e68a96f589fd 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -61,6 +61,8 @@ struct s3c24xx_i2c {
61 unsigned int msg_idx; 61 unsigned int msg_idx;
62 unsigned int msg_ptr; 62 unsigned int msg_ptr;
63 63
64 unsigned int tx_setup;
65
64 enum s3c24xx_i2c_state state; 66 enum s3c24xx_i2c_state state;
65 67
66 void __iomem *regs; 68 void __iomem *regs;
@@ -199,8 +201,11 @@ static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
199 dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr); 201 dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr);
200 writeb(addr, i2c->regs + S3C2410_IICDS); 202 writeb(addr, i2c->regs + S3C2410_IICDS);
201 203
202 // delay a bit and reset iiccon before setting start (per samsung) 204 /* delay here to ensure the data byte has gotten onto the bus
203 udelay(1); 205 * before the transaction is started */
206
207 ndelay(i2c->tx_setup);
208
204 dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon); 209 dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
205 writel(iiccon, i2c->regs + S3C2410_IICCON); 210 writel(iiccon, i2c->regs + S3C2410_IICCON);
206 211
@@ -322,7 +327,15 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
322 if (!is_msgend(i2c)) { 327 if (!is_msgend(i2c)) {
323 byte = i2c->msg->buf[i2c->msg_ptr++]; 328 byte = i2c->msg->buf[i2c->msg_ptr++];
324 writeb(byte, i2c->regs + S3C2410_IICDS); 329 writeb(byte, i2c->regs + S3C2410_IICDS);
325 330
331 /* delay after writing the byte to allow the
332 * data setup time on the bus, as writing the
333 * data to the register causes the first bit
334 * to appear on SDA, and SCL will change as
335 * soon as the interrupt is acknowledged */
336
337 ndelay(i2c->tx_setup);
338
326 } else if (!is_lastmsg(i2c)) { 339 } else if (!is_lastmsg(i2c)) {
327 /* we need to go to the next i2c message */ 340 /* we need to go to the next i2c message */
328 341
@@ -570,9 +583,10 @@ static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
570}; 583};
571 584
572static struct s3c24xx_i2c s3c24xx_i2c = { 585static struct s3c24xx_i2c s3c24xx_i2c = {
573 .lock = SPIN_LOCK_UNLOCKED, 586 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_i2c.lock),
574 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait), 587 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait),
575 .adap = { 588 .tx_setup = 50,
589 .adap = {
576 .name = "s3c2410-i2c", 590 .name = "s3c2410-i2c",
577 .owner = THIS_MODULE, 591 .owner = THIS_MODULE,
578 .algo = &s3c24xx_i2c_algorithm, 592 .algo = &s3c24xx_i2c_algorithm,
@@ -731,26 +745,6 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
731 return 0; 745 return 0;
732} 746}
733 747
734static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
735{
736 if (i2c->clk != NULL && !IS_ERR(i2c->clk)) {
737 clk_disable(i2c->clk);
738 clk_put(i2c->clk);
739 i2c->clk = NULL;
740 }
741
742 if (i2c->regs != NULL) {
743 iounmap(i2c->regs);
744 i2c->regs = NULL;
745 }
746
747 if (i2c->ioarea != NULL) {
748 release_resource(i2c->ioarea);
749 kfree(i2c->ioarea);
750 i2c->ioarea = NULL;
751 }
752}
753
754/* s3c24xx_i2c_probe 748/* s3c24xx_i2c_probe
755 * 749 *
756 * called by the bus driver when a suitable device is found 750 * called by the bus driver when a suitable device is found
@@ -769,7 +763,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
769 if (IS_ERR(i2c->clk)) { 763 if (IS_ERR(i2c->clk)) {
770 dev_err(&pdev->dev, "cannot get clock\n"); 764 dev_err(&pdev->dev, "cannot get clock\n");
771 ret = -ENOENT; 765 ret = -ENOENT;
772 goto out; 766 goto err_noclk;
773 } 767 }
774 768
775 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk); 769 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
@@ -782,7 +776,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
782 if (res == NULL) { 776 if (res == NULL) {
783 dev_err(&pdev->dev, "cannot find IO resource\n"); 777 dev_err(&pdev->dev, "cannot find IO resource\n");
784 ret = -ENOENT; 778 ret = -ENOENT;
785 goto out; 779 goto err_clk;
786 } 780 }
787 781
788 i2c->ioarea = request_mem_region(res->start, (res->end-res->start)+1, 782 i2c->ioarea = request_mem_region(res->start, (res->end-res->start)+1,
@@ -791,7 +785,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
791 if (i2c->ioarea == NULL) { 785 if (i2c->ioarea == NULL) {
792 dev_err(&pdev->dev, "cannot request IO\n"); 786 dev_err(&pdev->dev, "cannot request IO\n");
793 ret = -ENXIO; 787 ret = -ENXIO;
794 goto out; 788 goto err_clk;
795 } 789 }
796 790
797 i2c->regs = ioremap(res->start, (res->end-res->start)+1); 791 i2c->regs = ioremap(res->start, (res->end-res->start)+1);
@@ -799,7 +793,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
799 if (i2c->regs == NULL) { 793 if (i2c->regs == NULL) {
800 dev_err(&pdev->dev, "cannot map IO\n"); 794 dev_err(&pdev->dev, "cannot map IO\n");
801 ret = -ENXIO; 795 ret = -ENXIO;
802 goto out; 796 goto err_ioarea;
803 } 797 }
804 798
805 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); 799 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res);
@@ -813,7 +807,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
813 807
814 ret = s3c24xx_i2c_init(i2c); 808 ret = s3c24xx_i2c_init(i2c);
815 if (ret != 0) 809 if (ret != 0)
816 goto out; 810 goto err_iomap;
817 811
818 /* find the IRQ for this unit (note, this relies on the init call to 812 /* find the IRQ for this unit (note, this relies on the init call to
819 * ensure no current IRQs pending 813 * ensure no current IRQs pending
@@ -823,7 +817,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
823 if (res == NULL) { 817 if (res == NULL) {
824 dev_err(&pdev->dev, "cannot find IRQ\n"); 818 dev_err(&pdev->dev, "cannot find IRQ\n");
825 ret = -ENOENT; 819 ret = -ENOENT;
826 goto out; 820 goto err_iomap;
827 } 821 }
828 822
829 ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED, 823 ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED,
@@ -831,7 +825,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
831 825
832 if (ret != 0) { 826 if (ret != 0) {
833 dev_err(&pdev->dev, "cannot claim IRQ\n"); 827 dev_err(&pdev->dev, "cannot claim IRQ\n");
834 goto out; 828 goto err_iomap;
835 } 829 }
836 830
837 i2c->irq = res; 831 i2c->irq = res;
@@ -841,17 +835,29 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
841 ret = i2c_add_adapter(&i2c->adap); 835 ret = i2c_add_adapter(&i2c->adap);
842 if (ret < 0) { 836 if (ret < 0) {
843 dev_err(&pdev->dev, "failed to add bus to i2c core\n"); 837 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
844 goto out; 838 goto err_irq;
845 } 839 }
846 840
847 platform_set_drvdata(pdev, i2c); 841 platform_set_drvdata(pdev, i2c);
848 842
849 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); 843 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
844 return 0;
850 845
851 out: 846 err_irq:
852 if (ret < 0) 847 free_irq(i2c->irq->start, i2c);
853 s3c24xx_i2c_free(i2c); 848
849 err_iomap:
850 iounmap(i2c->regs);
854 851
852 err_ioarea:
853 release_resource(i2c->ioarea);
854 kfree(i2c->ioarea);
855
856 err_clk:
857 clk_disable(i2c->clk);
858 clk_put(i2c->clk);
859
860 err_noclk:
855 return ret; 861 return ret;
856} 862}
857 863
@@ -863,11 +869,17 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
863static int s3c24xx_i2c_remove(struct platform_device *pdev) 869static int s3c24xx_i2c_remove(struct platform_device *pdev)
864{ 870{
865 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); 871 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
866 872
867 if (i2c != NULL) { 873 i2c_del_adapter(&i2c->adap);
868 s3c24xx_i2c_free(i2c); 874 free_irq(i2c->irq->start, i2c);
869 platform_set_drvdata(pdev, NULL); 875
870 } 876 clk_disable(i2c->clk);
877 clk_put(i2c->clk);
878
879 iounmap(i2c->regs);
880
881 release_resource(i2c->ioarea);
882 kfree(i2c->ioarea);
871 883
872 return 0; 884 return 0;
873} 885}
diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c
new file mode 100644
index 000000000000..10af8d31e12a
--- /dev/null
+++ b/drivers/i2c/busses/i2c-simtec.c
@@ -0,0 +1,186 @@
1/*
2 * Copyright (C) 2005 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * Simtec Generic I2C Controller
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/delay.h>
25#include <linux/platform_device.h>
26
27#include <linux/i2c.h>
28#include <linux/i2c-algo-bit.h>
29
30#include <asm/io.h>
31
32struct simtec_i2c_data {
33 struct resource *ioarea;
34 void __iomem *reg;
35 struct i2c_adapter adap;
36 struct i2c_algo_bit_data bit;
37};
38
39#define CMD_SET_SDA (1<<2)
40#define CMD_SET_SCL (1<<3)
41
42#define STATE_SDA (1<<0)
43#define STATE_SCL (1<<1)
44
45/* i2c bit-bus functions */
46
47static void simtec_i2c_setsda(void *pw, int state)
48{
49 struct simtec_i2c_data *pd = pw;
50 writeb(CMD_SET_SDA | (state ? STATE_SDA : 0), pd->reg);
51}
52
53static void simtec_i2c_setscl(void *pw, int state)
54{
55 struct simtec_i2c_data *pd = pw;
56 writeb(CMD_SET_SCL | (state ? STATE_SCL : 0), pd->reg);
57}
58
59static int simtec_i2c_getsda(void *pw)
60{
61 struct simtec_i2c_data *pd = pw;
62 return readb(pd->reg) & STATE_SDA ? 1 : 0;
63}
64
65static int simtec_i2c_getscl(void *pw)
66{
67 struct simtec_i2c_data *pd = pw;
68 return readb(pd->reg) & STATE_SCL ? 1 : 0;
69}
70
71/* device registration */
72
73static int simtec_i2c_probe(struct platform_device *dev)
74{
75 struct simtec_i2c_data *pd;
76 struct resource *res;
77 int size;
78 int ret;
79
80 pd = kzalloc(sizeof(struct simtec_i2c_data), GFP_KERNEL);
81 if (pd == NULL) {
82 dev_err(&dev->dev, "cannot allocate private data\n");
83 return -ENOMEM;
84 }
85
86 platform_set_drvdata(dev, pd);
87
88 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
89 if (res == NULL) {
90 dev_err(&dev->dev, "cannot find IO resource\n");
91 ret = -ENOENT;
92 goto err;
93 }
94
95 size = (res->end-res->start)+1;
96
97 pd->ioarea = request_mem_region(res->start, size, dev->name);
98 if (pd->ioarea == NULL) {
99 dev_err(&dev->dev, "cannot request IO\n");
100 ret = -ENXIO;
101 goto err;
102 }
103
104 pd->reg = ioremap(res->start, size);
105 if (pd->reg == NULL) {
106 dev_err(&dev->dev, "cannot map IO\n");
107 ret = -ENXIO;
108 goto err_res;
109 }
110
111 /* setup the private data */
112
113 pd->adap.owner = THIS_MODULE;
114 pd->adap.algo_data = &pd->bit;
115 pd->adap.dev.parent = &dev->dev;
116
117 strlcpy(pd->adap.name, "Simtec I2C", sizeof(pd->adap.name));
118
119 pd->bit.data = pd;
120 pd->bit.setsda = simtec_i2c_setsda;
121 pd->bit.setscl = simtec_i2c_setscl;
122 pd->bit.getsda = simtec_i2c_getsda;
123 pd->bit.getscl = simtec_i2c_getscl;
124 pd->bit.timeout = HZ;
125 pd->bit.udelay = 20;
126
127 ret = i2c_bit_add_bus(&pd->adap);
128 if (ret)
129 goto err_all;
130
131 return 0;
132
133 err_all:
134 iounmap(pd->reg);
135
136 err_res:
137 release_resource(pd->ioarea);
138 kfree(pd->ioarea);
139
140 err:
141 kfree(pd);
142 return ret;
143}
144
145static int simtec_i2c_remove(struct platform_device *dev)
146{
147 struct simtec_i2c_data *pd = platform_get_drvdata(dev);
148
149 i2c_del_adapter(&pd->adap);
150
151 iounmap(pd->reg);
152 release_resource(pd->ioarea);
153 kfree(pd->ioarea);
154 kfree(pd);
155
156 return 0;
157}
158
159
160/* device driver */
161
162static struct platform_driver simtec_i2c_driver = {
163 .driver = {
164 .name = "simtec-i2c",
165 .owner = THIS_MODULE,
166 },
167 .probe = simtec_i2c_probe,
168 .remove = simtec_i2c_remove,
169};
170
171static int __init i2c_adap_simtec_init(void)
172{
173 return platform_driver_register(&simtec_i2c_driver);
174}
175
176static void __exit i2c_adap_simtec_exit(void)
177{
178 platform_driver_unregister(&simtec_i2c_driver);
179}
180
181module_init(i2c_adap_simtec_init);
182module_exit(i2c_adap_simtec_exit);
183
184MODULE_DESCRIPTION("Simtec Generic I2C Bus driver");
185MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
186MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 4157b0cd604c..dc235bb8e24d 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -300,7 +300,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
300 /* set up the sysfs linkage to our parent device */ 300 /* set up the sysfs linkage to our parent device */
301 sis96x_adapter.dev.parent = &dev->dev; 301 sis96x_adapter.dev.parent = &dev->dev;
302 302
303 snprintf(sis96x_adapter.name, I2C_NAME_SIZE, 303 snprintf(sis96x_adapter.name, sizeof(sis96x_adapter.name),
304 "SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base); 304 "SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
305 305
306 if ((retval = i2c_add_adapter(&sis96x_adapter))) { 306 if ((retval = i2c_add_adapter(&sis96x_adapter))) {
diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
new file mode 100644
index 000000000000..907999049d50
--- /dev/null
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -0,0 +1,277 @@
1/*
2 * driver for the i2c-tiny-usb adapter - 1.0
3 * http://www.harbaum.org/till/i2c_tiny_usb
4 *
5 * Copyright (C) 2006-2007 Till Harbaum (Till@Harbaum.org)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, version 2.
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/module.h>
16
17/* include interfaces to usb layer */
18#include <linux/usb.h>
19
20/* include interface to i2c layer */
21#include <linux/i2c.h>
22
23/* commands via USB, must match command ids in the firmware */
24#define CMD_ECHO 0
25#define CMD_GET_FUNC 1
26#define CMD_SET_DELAY 2
27#define CMD_GET_STATUS 3
28
29#define CMD_I2C_IO 4
30#define CMD_I2C_IO_BEGIN (1<<0)
31#define CMD_I2C_IO_END (1<<1)
32
33/* i2c bit delay, default is 10us -> 100kHz */
34static int delay = 10;
35module_param(delay, int, 0);
36MODULE_PARM_DESC(delay, "bit delay in microseconds, "
37 "e.g. 10 for 100kHz (default is 100kHz)");
38
39static int usb_read(struct i2c_adapter *adapter, int cmd,
40 int value, int index, void *data, int len);
41
42static int usb_write(struct i2c_adapter *adapter, int cmd,
43 int value, int index, void *data, int len);
44
45/* ----- begin of i2c layer ---------------------------------------------- */
46
47#define STATUS_IDLE 0
48#define STATUS_ADDRESS_ACK 1
49#define STATUS_ADDRESS_NAK 2
50
51static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
52{
53 unsigned char status;
54 struct i2c_msg *pmsg;
55 int i;
56
57 dev_dbg(&adapter->dev, "master xfer %d messages:\n", num);
58
59 for (i = 0 ; i < num ; i++) {
60 int cmd = CMD_I2C_IO;
61
62 if (i == 0)
63 cmd |= CMD_I2C_IO_BEGIN;
64
65 if (i == num-1)
66 cmd |= CMD_I2C_IO_END;
67
68 pmsg = &msgs[i];
69
70 dev_dbg(&adapter->dev,
71 " %d: %s (flags %d) %d bytes to 0x%02x\n",
72 i, pmsg->flags & I2C_M_RD ? "read" : "write",
73 pmsg->flags, pmsg->len, pmsg->addr);
74
75 /* and directly send the message */
76 if (pmsg->flags & I2C_M_RD) {
77 /* read data */
78 if (usb_read(adapter, cmd,
79 pmsg->flags, pmsg->addr,
80 pmsg->buf, pmsg->len) != pmsg->len) {
81 dev_err(&adapter->dev,
82 "failure reading data\n");
83 return -EREMOTEIO;
84 }
85 } else {
86 /* write data */
87 if (usb_write(adapter, cmd,
88 pmsg->flags, pmsg->addr,
89 pmsg->buf, pmsg->len) != pmsg->len) {
90 dev_err(&adapter->dev,
91 "failure writing data\n");
92 return -EREMOTEIO;
93 }
94 }
95
96 /* read status */
97 if (usb_read(adapter, CMD_GET_STATUS, 0, 0, &status, 1) != 1) {
98 dev_err(&adapter->dev, "failure reading status\n");
99 return -EREMOTEIO;
100 }
101
102 dev_dbg(&adapter->dev, " status = %d\n", status);
103 if (status == STATUS_ADDRESS_NAK)
104 return -EREMOTEIO;
105 }
106
107 return i;
108}
109
110static u32 usb_func(struct i2c_adapter *adapter)
111{
112 u32 func;
113
114 /* get functionality from adapter */
115 if (usb_read(adapter, CMD_GET_FUNC, 0, 0, &func, sizeof(func)) !=
116 sizeof(func)) {
117 dev_err(&adapter->dev, "failure reading functionality\n");
118 return 0;
119 }
120
121 return func;
122}
123
124/* This is the actual algorithm we define */
125static const struct i2c_algorithm usb_algorithm = {
126 .master_xfer = usb_xfer,
127 .functionality = usb_func,
128};
129
130/* ----- end of i2c layer ------------------------------------------------ */
131
132/* ----- begin of usb layer ---------------------------------------------- */
133
134/* The usb i2c interface uses a vid/pid pair donated by */
135/* Future Technology Devices International Ltd. */
136static struct usb_device_id i2c_tiny_usb_table [] = {
137 { USB_DEVICE(0x0403, 0xc631) },
138 { } /* Terminating entry */
139};
140
141MODULE_DEVICE_TABLE(usb, i2c_tiny_usb_table);
142
143/* Structure to hold all of our device specific stuff */
144struct i2c_tiny_usb {
145 struct usb_device *usb_dev; /* the usb device for this device */
146 struct usb_interface *interface; /* the interface for this device */
147 struct i2c_adapter adapter; /* i2c related things */
148};
149
150static int usb_read(struct i2c_adapter *adapter, int cmd,
151 int value, int index, void *data, int len)
152{
153 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;
154
155 /* do control transfer */
156 return usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0),
157 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
158 USB_DIR_IN, value, index, data, len, 2000);
159}
160
161static int usb_write(struct i2c_adapter *adapter, int cmd,
162 int value, int index, void *data, int len)
163{
164 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;
165
166 /* do control transfer */
167 return usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0),
168 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
169 value, index, data, len, 2000);
170}
171
172static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)
173{
174 usb_put_dev(dev->usb_dev);
175 kfree(dev);
176}
177
178static int i2c_tiny_usb_probe(struct usb_interface *interface,
179 const struct usb_device_id *id)
180{
181 struct i2c_tiny_usb *dev;
182 int retval = -ENOMEM;
183 u16 version;
184
185 dev_dbg(&interface->dev, "probing usb device\n");
186
187 /* allocate memory for our device state and initialize it */
188 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
189 if (dev == NULL) {
190 dev_err(&interface->dev, "Out of memory\n");
191 goto error;
192 }
193
194 dev->usb_dev = usb_get_dev(interface_to_usbdev(interface));
195 dev->interface = interface;
196
197 /* save our data pointer in this interface device */
198 usb_set_intfdata(interface, dev);
199
200 version = le16_to_cpu(dev->usb_dev->descriptor.bcdDevice);
201 dev_info(&interface->dev,
202 "version %x.%02x found at bus %03d address %03d\n",
203 version >> 8, version & 0xff,
204 dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
205
206 /* setup i2c adapter description */
207 dev->adapter.owner = THIS_MODULE;
208 dev->adapter.class = I2C_CLASS_HWMON;
209 dev->adapter.algo = &usb_algorithm;
210 dev->adapter.algo_data = dev;
211 snprintf(dev->adapter.name, I2C_NAME_SIZE,
212 "i2c-tiny-usb at bus %03d device %03d",
213 dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
214
215 if (usb_write(&dev->adapter, CMD_SET_DELAY,
216 cpu_to_le16(delay), 0, NULL, 0) != 0) {
217 dev_err(&dev->adapter.dev,
218 "failure setting delay to %dus\n", delay);
219 retval = -EIO;
220 goto error;
221 }
222
223 dev->adapter.dev.parent = &dev->interface->dev;
224
225 /* and finally attach to i2c layer */
226 i2c_add_adapter(&dev->adapter);
227
228 /* inform user about successful attachment to i2c layer */
229 dev_info(&dev->adapter.dev, "connected i2c-tiny-usb device\n");
230
231 return 0;
232
233 error:
234 if (dev)
235 i2c_tiny_usb_free(dev);
236
237 return retval;
238}
239
240static void i2c_tiny_usb_disconnect(struct usb_interface *interface)
241{
242 struct i2c_tiny_usb *dev = usb_get_intfdata(interface);
243
244 i2c_del_adapter(&dev->adapter);
245 usb_set_intfdata(interface, NULL);
246 i2c_tiny_usb_free(dev);
247
248 dev_dbg(&interface->dev, "disconnected\n");
249}
250
251static struct usb_driver i2c_tiny_usb_driver = {
252 .name = "i2c-tiny-usb",
253 .probe = i2c_tiny_usb_probe,
254 .disconnect = i2c_tiny_usb_disconnect,
255 .id_table = i2c_tiny_usb_table,
256};
257
258static int __init usb_i2c_tiny_usb_init(void)
259{
260 /* register this driver with the USB subsystem */
261 return usb_register(&i2c_tiny_usb_driver);
262}
263
264static void __exit usb_i2c_tiny_usb_exit(void)
265{
266 /* deregister this driver with the USB subsystem */
267 usb_deregister(&i2c_tiny_usb_driver);
268}
269
270module_init(usb_i2c_tiny_usb_init);
271module_exit(usb_i2c_tiny_usb_exit);
272
273/* ----- end of usb layer ------------------------------------------------ */
274
275MODULE_AUTHOR("Till Harbaum <Till@Harbaum.org>");
276MODULE_DESCRIPTION("i2c-tiny-usb driver v1.0");
277MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 03c5fc868548..7a2bc06304fc 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -404,7 +404,7 @@ found:
404 } 404 }
405 405
406 vt596_adapter.dev.parent = &pdev->dev; 406 vt596_adapter.dev.parent = &pdev->dev;
407 snprintf(vt596_adapter.name, I2C_NAME_SIZE, 407 snprintf(vt596_adapter.name, sizeof(vt596_adapter.name),
408 "SMBus Via Pro adapter at %04x", vt596_smba); 408 "SMBus Via Pro adapter at %04x", vt596_smba);
409 409
410 vt596_pdev = pci_dev_get(pdev); 410 vt596_pdev = pci_dev_get(pdev);
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 0b082c5a0195..0db56e7bc34e 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -441,7 +441,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text,
441 441
442 adapter = &iface->adapter; 442 adapter = &iface->adapter;
443 i2c_set_adapdata(adapter, iface); 443 i2c_set_adapdata(adapter, iface);
444 snprintf(adapter->name, I2C_NAME_SIZE, "%s ACB%d", text, index); 444 snprintf(adapter->name, sizeof(adapter->name), "%s ACB%d", text, index);
445 adapter->owner = THIS_MODULE; 445 adapter->owner = THIS_MODULE;
446 adapter->id = I2C_HW_SMBUS_SCX200; 446 adapter->id = I2C_HW_SMBUS_SCX200;
447 adapter->algo = &scx200_acb_algorithm; 447 adapter->algo = &scx200_acb_algorithm;
@@ -599,6 +599,7 @@ static __init int scx200_scan_pci(void)
599 else { 599 else {
600 int i; 600 int i;
601 601
602 pci_dev_put(pdev);
602 for (i = 0; i < MAX_DEVICES; ++i) { 603 for (i = 0; i < MAX_DEVICES; ++i) {
603 if (base[i] == 0) 604 if (base[i] == 0)
604 continue; 605 continue;
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 87ee3ce58618..ea085a006ead 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -3,11 +3,10 @@
3# 3#
4 4
5menu "Miscellaneous I2C Chip support" 5menu "Miscellaneous I2C Chip support"
6 depends on I2C
7 6
8config SENSORS_DS1337 7config SENSORS_DS1337
9 tristate "Dallas Semiconductor DS1337 and DS1339 Real Time Clock" 8 tristate "Dallas Semiconductor DS1337 and DS1339 Real Time Clock"
10 depends on I2C && EXPERIMENTAL 9 depends on EXPERIMENTAL
11 help 10 help
12 If you say yes here you get support for Dallas Semiconductor 11 If you say yes here you get support for Dallas Semiconductor
13 DS1337 and DS1339 real-time clock chips. 12 DS1337 and DS1339 real-time clock chips.
@@ -17,7 +16,7 @@ config SENSORS_DS1337
17 16
18config SENSORS_DS1374 17config SENSORS_DS1374
19 tristate "Maxim/Dallas Semiconductor DS1374 Real Time Clock" 18 tristate "Maxim/Dallas Semiconductor DS1374 Real Time Clock"
20 depends on I2C && EXPERIMENTAL 19 depends on EXPERIMENTAL
21 help 20 help
22 If you say yes here you get support for Dallas Semiconductor 21 If you say yes here you get support for Dallas Semiconductor
23 DS1374 real-time clock chips. 22 DS1374 real-time clock chips.
@@ -27,7 +26,7 @@ config SENSORS_DS1374
27 26
28config SENSORS_EEPROM 27config SENSORS_EEPROM
29 tristate "EEPROM reader" 28 tristate "EEPROM reader"
30 depends on I2C && EXPERIMENTAL 29 depends on EXPERIMENTAL
31 help 30 help
32 If you say yes here you get read-only access to the EEPROM data 31 If you say yes here you get read-only access to the EEPROM data
33 available on modern memory DIMMs and Sony Vaio laptops. Such 32 available on modern memory DIMMs and Sony Vaio laptops. Such
@@ -38,7 +37,7 @@ config SENSORS_EEPROM
38 37
39config SENSORS_PCF8574 38config SENSORS_PCF8574
40 tristate "Philips PCF8574 and PCF8574A" 39 tristate "Philips PCF8574 and PCF8574A"
41 depends on I2C && EXPERIMENTAL 40 depends on EXPERIMENTAL
42 default n 41 default n
43 help 42 help
44 If you say yes here you get support for Philips PCF8574 and 43 If you say yes here you get support for Philips PCF8574 and
@@ -52,7 +51,7 @@ config SENSORS_PCF8574
52 51
53config SENSORS_PCA9539 52config SENSORS_PCA9539
54 tristate "Philips PCA9539 16-bit I/O port" 53 tristate "Philips PCA9539 16-bit I/O port"
55 depends on I2C && EXPERIMENTAL 54 depends on EXPERIMENTAL
56 help 55 help
57 If you say yes here you get support for the Philips PCA9539 56 If you say yes here you get support for the Philips PCA9539
58 16-bit I/O port. 57 16-bit I/O port.
@@ -62,7 +61,7 @@ config SENSORS_PCA9539
62 61
63config SENSORS_PCF8591 62config SENSORS_PCF8591
64 tristate "Philips PCF8591" 63 tristate "Philips PCF8591"
65 depends on I2C && EXPERIMENTAL 64 depends on EXPERIMENTAL
66 default n 65 default n
67 help 66 help
68 If you say yes here you get support for Philips PCF8591 chips. 67 If you say yes here you get support for Philips PCF8591 chips.
@@ -75,7 +74,7 @@ config SENSORS_PCF8591
75 74
76config ISP1301_OMAP 75config ISP1301_OMAP
77 tristate "Philips ISP1301 with OMAP OTG" 76 tristate "Philips ISP1301 with OMAP OTG"
78 depends on I2C && ARCH_OMAP_OTG 77 depends on ARCH_OMAP_OTG
79 help 78 help
80 If you say yes here you get support for the Philips ISP1301 79 If you say yes here you get support for the Philips ISP1301
81 USB-On-The-Go transceiver working with the OMAP OTG controller. 80 USB-On-The-Go transceiver working with the OMAP OTG controller.
@@ -90,7 +89,7 @@ config ISP1301_OMAP
90# and having mostly OMAP-specific board support 89# and having mostly OMAP-specific board support
91config TPS65010 90config TPS65010
92 tristate "TPS6501x Power Management chips" 91 tristate "TPS6501x Power Management chips"
93 depends on I2C && ARCH_OMAP 92 depends on ARCH_OMAP
94 default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK 93 default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
95 help 94 help
96 If you say yes here you get support for the TPS6501x series of 95 If you say yes here you get support for the TPS6501x series of
@@ -103,7 +102,7 @@ config TPS65010
103 102
104config SENSORS_M41T00 103config SENSORS_M41T00
105 tristate "ST M41T00 RTC chip" 104 tristate "ST M41T00 RTC chip"
106 depends on I2C && PPC32 105 depends on PPC32
107 help 106 help
108 If you say yes here you get support for the ST M41T00 RTC chip. 107 If you say yes here you get support for the ST M41T00 RTC chip.
109 108
@@ -112,7 +111,7 @@ config SENSORS_M41T00
112 111
113config SENSORS_MAX6875 112config SENSORS_MAX6875
114 tristate "Maxim MAX6875 Power supply supervisor" 113 tristate "Maxim MAX6875 Power supply supervisor"
115 depends on I2C && EXPERIMENTAL 114 depends on EXPERIMENTAL
116 help 115 help
117 If you say yes here you get support for the Maxim MAX6875 116 If you say yes here you get support for the Maxim MAX6875
118 EEPROM-programmable, quad power-supply sequencer/supervisor. 117 EEPROM-programmable, quad power-supply sequencer/supervisor.
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index 214fbb1423c5..7ed92dc3d833 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -351,8 +351,10 @@ static void tps65010_interrupt(struct tps65010 *tps)
351#if 0 351#if 0
352 /* REVISIT: this might need its own workqueue 352 /* REVISIT: this might need its own workqueue
353 * plus tweaks including deadlock avoidance ... 353 * plus tweaks including deadlock avoidance ...
354 * also needs to get error handling and probably
355 * an #ifdef CONFIG_SOFTWARE_SUSPEND
354 */ 356 */
355 software_suspend(); 357 pm_suspend(PM_SUSPEND_DISK);
356#endif 358#endif
357 poll = 1; 359 poll = 1;
358 } 360 }
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
new file mode 100644
index 000000000000..ffb35f09df03
--- /dev/null
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -0,0 +1,90 @@
1/*
2 * i2c-boardinfo.h - collect pre-declarations of I2C devices
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#include <linux/kernel.h>
20#include <linux/i2c.h>
21
22#include "i2c-core.h"
23
24
25/* These symbols are exported ONLY FOR the i2c core.
26 * No other users will be supported.
27 */
28DEFINE_MUTEX(__i2c_board_lock);
29EXPORT_SYMBOL_GPL(__i2c_board_lock);
30
31LIST_HEAD(__i2c_board_list);
32EXPORT_SYMBOL_GPL(__i2c_board_list);
33
34int __i2c_first_dynamic_bus_num;
35EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);
36
37
38/**
39 * i2c_register_board_info - statically declare I2C devices
40 * @busnum: identifies the bus to which these devices belong
41 * @info: vector of i2c device descriptors
42 * @len: how many descriptors in the vector; may be zero to reserve
43 * the specified bus number.
44 *
45 * Systems using the Linux I2C driver stack can declare tables of board info
46 * while they initialize. This should be done in board-specific init code
47 * near arch_initcall() time, or equivalent, before any I2C adapter driver is
48 * registered. For example, mainboard init code could define several devices,
49 * as could the init code for each daughtercard in a board stack.
50 *
51 * The I2C devices will be created later, after the adapter for the relevant
52 * bus has been registered. After that moment, standard driver model tools
53 * are used to bind "new style" I2C drivers to the devices. The bus number
54 * for any device declared using this routine is not available for dynamic
55 * allocation.
56 *
57 * The board info passed can safely be __initdata, but be careful of embedded
58 * pointers (for platform_data, functions, etc) since that won't be copied.
59 */
60int __init
61i2c_register_board_info(int busnum,
62 struct i2c_board_info const *info, unsigned len)
63{
64 int status;
65
66 mutex_lock(&__i2c_board_lock);
67
68 /* dynamic bus numbers will be assigned after the last static one */
69 if (busnum >= __i2c_first_dynamic_bus_num)
70 __i2c_first_dynamic_bus_num = busnum + 1;
71
72 for (status = 0; len; len--, info++) {
73 struct i2c_devinfo *devinfo;
74
75 devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
76 if (!devinfo) {
77 pr_debug("i2c-core: can't register boardinfo!\n");
78 status = -ENOMEM;
79 break;
80 }
81
82 devinfo->busnum = busnum;
83 devinfo->board_info = *info;
84 list_add_tail(&devinfo->list, &__i2c_board_list);
85 }
86
87 mutex_unlock(&__i2c_board_lock);
88
89 return status;
90}
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 21fe1406c8b4..64f8e56d300e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -35,29 +35,92 @@
35#include <linux/completion.h> 35#include <linux/completion.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
38#include "i2c-core.h"
39
38 40
39static LIST_HEAD(adapters); 41static LIST_HEAD(adapters);
40static LIST_HEAD(drivers); 42static LIST_HEAD(drivers);
41static DEFINE_MUTEX(core_lists); 43static DEFINE_MUTEX(core_lists);
42static DEFINE_IDR(i2c_adapter_idr); 44static DEFINE_IDR(i2c_adapter_idr);
43 45
46#define is_newstyle_driver(d) ((d)->probe || (d)->remove)
44 47
45/* ------------------------------------------------------------------------- */ 48/* ------------------------------------------------------------------------- */
46 49
47/* match always succeeds, as we want the probe() to tell if we really accept this match */
48static int i2c_device_match(struct device *dev, struct device_driver *drv) 50static int i2c_device_match(struct device *dev, struct device_driver *drv)
49{ 51{
50 return 1; 52 struct i2c_client *client = to_i2c_client(dev);
53 struct i2c_driver *driver = to_i2c_driver(drv);
54
55 /* make legacy i2c drivers bypass driver model probing entirely;
56 * such drivers scan each i2c adapter/bus themselves.
57 */
58 if (!is_newstyle_driver(driver))
59 return 0;
60
61 /* new style drivers use the same kind of driver matching policy
62 * as platform devices or SPI: compare device and driver IDs.
63 */
64 return strcmp(client->driver_name, drv->name) == 0;
65}
66
67#ifdef CONFIG_HOTPLUG
68
69/* uevent helps with hotplug: modprobe -q $(MODALIAS) */
70static int i2c_device_uevent(struct device *dev, char **envp, int num_envp,
71 char *buffer, int buffer_size)
72{
73 struct i2c_client *client = to_i2c_client(dev);
74 int i = 0, length = 0;
75
76 /* by definition, legacy drivers can't hotplug */
77 if (dev->driver || !client->driver_name)
78 return 0;
79
80 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
81 "MODALIAS=%s", client->driver_name))
82 return -ENOMEM;
83 envp[i] = NULL;
84 dev_dbg(dev, "uevent\n");
85 return 0;
51} 86}
52 87
88#else
89#define i2c_device_uevent NULL
90#endif /* CONFIG_HOTPLUG */
91
53static int i2c_device_probe(struct device *dev) 92static int i2c_device_probe(struct device *dev)
54{ 93{
55 return -ENODEV; 94 struct i2c_client *client = to_i2c_client(dev);
95 struct i2c_driver *driver = to_i2c_driver(dev->driver);
96
97 if (!driver->probe)
98 return -ENODEV;
99 client->driver = driver;
100 dev_dbg(dev, "probe\n");
101 return driver->probe(client);
56} 102}
57 103
58static int i2c_device_remove(struct device *dev) 104static int i2c_device_remove(struct device *dev)
59{ 105{
60 return 0; 106 struct i2c_client *client = to_i2c_client(dev);
107 struct i2c_driver *driver;
108 int status;
109
110 if (!dev->driver)
111 return 0;
112
113 driver = to_i2c_driver(dev->driver);
114 if (driver->remove) {
115 dev_dbg(dev, "remove\n");
116 status = driver->remove(client);
117 } else {
118 dev->driver = NULL;
119 status = 0;
120 }
121 if (status == 0)
122 client->driver = NULL;
123 return status;
61} 124}
62 125
63static void i2c_device_shutdown(struct device *dev) 126static void i2c_device_shutdown(struct device *dev)
@@ -95,122 +158,184 @@ static int i2c_device_resume(struct device * dev)
95 return driver->resume(to_i2c_client(dev)); 158 return driver->resume(to_i2c_client(dev));
96} 159}
97 160
161static void i2c_client_release(struct device *dev)
162{
163 struct i2c_client *client = to_i2c_client(dev);
164 complete(&client->released);
165}
166
167static void i2c_client_dev_release(struct device *dev)
168{
169 kfree(to_i2c_client(dev));
170}
171
172static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf)
173{
174 struct i2c_client *client = to_i2c_client(dev);
175 return sprintf(buf, "%s\n", client->name);
176}
177
178static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
179{
180 struct i2c_client *client = to_i2c_client(dev);
181 return client->driver_name
182 ? sprintf(buf, "%s\n", client->driver_name)
183 : 0;
184}
185
186static struct device_attribute i2c_dev_attrs[] = {
187 __ATTR(name, S_IRUGO, show_client_name, NULL),
188 /* modalias helps coldplug: modprobe $(cat .../modalias) */
189 __ATTR(modalias, S_IRUGO, show_modalias, NULL),
190 { },
191};
192
98struct bus_type i2c_bus_type = { 193struct bus_type i2c_bus_type = {
99 .name = "i2c", 194 .name = "i2c",
195 .dev_attrs = i2c_dev_attrs,
100 .match = i2c_device_match, 196 .match = i2c_device_match,
197 .uevent = i2c_device_uevent,
101 .probe = i2c_device_probe, 198 .probe = i2c_device_probe,
102 .remove = i2c_device_remove, 199 .remove = i2c_device_remove,
103 .shutdown = i2c_device_shutdown, 200 .shutdown = i2c_device_shutdown,
104 .suspend = i2c_device_suspend, 201 .suspend = i2c_device_suspend,
105 .resume = i2c_device_resume, 202 .resume = i2c_device_resume,
106}; 203};
204EXPORT_SYMBOL_GPL(i2c_bus_type);
107 205
108/* ------------------------------------------------------------------------- */ 206/**
207 * i2c_new_device - instantiate an i2c device for use with a new style driver
208 * @adap: the adapter managing the device
209 * @info: describes one I2C device; bus_num is ignored
210 *
211 * Create a device to work with a new style i2c driver, where binding is
212 * handled through driver model probe()/remove() methods. This call is not
213 * appropriate for use by mainboad initialization logic, which usually runs
214 * during an arch_initcall() long before any i2c_adapter could exist.
215 *
216 * This returns the new i2c client, which may be saved for later use with
217 * i2c_unregister_device(); or NULL to indicate an error.
218 */
219struct i2c_client *
220i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
221{
222 struct i2c_client *client;
223 int status;
109 224
110void i2c_adapter_dev_release(struct device *dev) 225 client = kzalloc(sizeof *client, GFP_KERNEL);
226 if (!client)
227 return NULL;
228
229 client->adapter = adap;
230
231 client->dev.platform_data = info->platform_data;
232 client->flags = info->flags;
233 client->addr = info->addr;
234 client->irq = info->irq;
235
236 strlcpy(client->driver_name, info->driver_name,
237 sizeof(client->driver_name));
238 strlcpy(client->name, info->type, sizeof(client->name));
239
240 /* a new style driver may be bound to this device when we
241 * return from this function, or any later moment (e.g. maybe
242 * hotplugging will load the driver module). and the device
243 * refcount model is the standard driver model one.
244 */
245 status = i2c_attach_client(client);
246 if (status < 0) {
247 kfree(client);
248 client = NULL;
249 }
250 return client;
251}
252EXPORT_SYMBOL_GPL(i2c_new_device);
253
254
255/**
256 * i2c_unregister_device - reverse effect of i2c_new_device()
257 * @client: value returned from i2c_new_device()
258 */
259void i2c_unregister_device(struct i2c_client *client)
111{ 260{
112 struct i2c_adapter *adap = dev_to_i2c_adapter(dev); 261 struct i2c_adapter *adapter = client->adapter;
113 complete(&adap->dev_released); 262 struct i2c_driver *driver = client->driver;
263
264 if (driver && !is_newstyle_driver(driver)) {
265 dev_err(&client->dev, "can't unregister devices "
266 "with legacy drivers\n");
267 WARN_ON(1);
268 return;
269 }
270
271 mutex_lock(&adapter->clist_lock);
272 list_del(&client->list);
273 mutex_unlock(&adapter->clist_lock);
274
275 device_unregister(&client->dev);
114} 276}
277EXPORT_SYMBOL_GPL(i2c_unregister_device);
115 278
116struct device_driver i2c_adapter_driver = {
117 .owner = THIS_MODULE,
118 .name = "i2c_adapter",
119 .bus = &i2c_bus_type,
120};
121 279
122/* ------------------------------------------------------------------------- */ 280/* ------------------------------------------------------------------------- */
123 281
124/* I2C bus adapters -- one roots each I2C or SMBUS segment */ 282/* I2C bus adapters -- one roots each I2C or SMBUS segment */
125 283
126static void i2c_adapter_class_dev_release(struct class_device *dev) 284void i2c_adapter_dev_release(struct device *dev)
127{ 285{
128 struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); 286 struct i2c_adapter *adap = to_i2c_adapter(dev);
129 complete(&adap->class_dev_released); 287 complete(&adap->dev_released);
130} 288}
289EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); /* exported to i2c-isa */
131 290
132static ssize_t i2c_adapter_show_name(struct class_device *cdev, char *buf) 291static ssize_t
292show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf)
133{ 293{
134 struct i2c_adapter *adap = class_dev_to_i2c_adapter(cdev); 294 struct i2c_adapter *adap = to_i2c_adapter(dev);
135 return sprintf(buf, "%s\n", adap->name); 295 return sprintf(buf, "%s\n", adap->name);
136} 296}
137 297
138static struct class_device_attribute i2c_adapter_attrs[] = { 298static struct device_attribute i2c_adapter_attrs[] = {
139 __ATTR(name, S_IRUGO, i2c_adapter_show_name, NULL), 299 __ATTR(name, S_IRUGO, show_adapter_name, NULL),
140 { }, 300 { },
141}; 301};
142 302
143struct class i2c_adapter_class = { 303struct class i2c_adapter_class = {
144 .owner = THIS_MODULE, 304 .owner = THIS_MODULE,
145 .name = "i2c-adapter", 305 .name = "i2c-adapter",
146 .class_dev_attrs = i2c_adapter_attrs, 306 .dev_attrs = i2c_adapter_attrs,
147 .release = &i2c_adapter_class_dev_release,
148}; 307};
308EXPORT_SYMBOL_GPL(i2c_adapter_class); /* exported to i2c-isa */
149 309
150static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) 310static void i2c_scan_static_board_info(struct i2c_adapter *adapter)
151{
152 struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
153 return sprintf(buf, "%s\n", adap->name);
154}
155static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
156
157
158static void i2c_client_release(struct device *dev)
159{
160 struct i2c_client *client = to_i2c_client(dev);
161 complete(&client->released);
162}
163
164static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf)
165{ 311{
166 struct i2c_client *client = to_i2c_client(dev); 312 struct i2c_devinfo *devinfo;
167 return sprintf(buf, "%s\n", client->name); 313
314 mutex_lock(&__i2c_board_lock);
315 list_for_each_entry(devinfo, &__i2c_board_list, list) {
316 if (devinfo->busnum == adapter->nr
317 && !i2c_new_device(adapter,
318 &devinfo->board_info))
319 printk(KERN_ERR "i2c-core: can't create i2c%d-%04x\n",
320 i2c_adapter_id(adapter),
321 devinfo->board_info.addr);
322 }
323 mutex_unlock(&__i2c_board_lock);
168} 324}
169 325
170/* 326static int i2c_register_adapter(struct i2c_adapter *adap)
171 * We can't use the DEVICE_ATTR() macro here, as we used the same name for
172 * an i2c adapter attribute (above).
173 */
174static struct device_attribute dev_attr_client_name =
175 __ATTR(name, S_IRUGO, &show_client_name, NULL);
176
177
178/* ---------------------------------------------------
179 * registering functions
180 * ---------------------------------------------------
181 */
182
183/* -----
184 * i2c_add_adapter is called from within the algorithm layer,
185 * when a new hw adapter registers. A new device is register to be
186 * available for clients.
187 */
188int i2c_add_adapter(struct i2c_adapter *adap)
189{ 327{
190 int id, res = 0; 328 int res = 0;
191 struct list_head *item; 329 struct list_head *item;
192 struct i2c_driver *driver; 330 struct i2c_driver *driver;
193 331
194 mutex_lock(&core_lists);
195
196 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) {
197 res = -ENOMEM;
198 goto out_unlock;
199 }
200
201 res = idr_get_new(&i2c_adapter_idr, adap, &id);
202 if (res < 0) {
203 if (res == -EAGAIN)
204 res = -ENOMEM;
205 goto out_unlock;
206 }
207
208 adap->nr = id & MAX_ID_MASK;
209 mutex_init(&adap->bus_lock); 332 mutex_init(&adap->bus_lock);
210 mutex_init(&adap->clist_lock); 333 mutex_init(&adap->clist_lock);
211 list_add_tail(&adap->list,&adapters);
212 INIT_LIST_HEAD(&adap->clients); 334 INIT_LIST_HEAD(&adap->clients);
213 335
336 mutex_lock(&core_lists);
337 list_add_tail(&adap->list, &adapters);
338
214 /* Add the adapter to the driver core. 339 /* Add the adapter to the driver core.
215 * If the parent pointer is not set up, 340 * If the parent pointer is not set up,
216 * we add this adapter to the host bus. 341 * we add this adapter to the host bus.
@@ -221,27 +346,19 @@ int i2c_add_adapter(struct i2c_adapter *adap)
221 "physical device\n", adap->name); 346 "physical device\n", adap->name);
222 } 347 }
223 sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); 348 sprintf(adap->dev.bus_id, "i2c-%d", adap->nr);
224 adap->dev.driver = &i2c_adapter_driver;
225 adap->dev.release = &i2c_adapter_dev_release; 349 adap->dev.release = &i2c_adapter_dev_release;
350 adap->dev.class = &i2c_adapter_class;
226 res = device_register(&adap->dev); 351 res = device_register(&adap->dev);
227 if (res) 352 if (res)
228 goto out_list; 353 goto out_list;
229 res = device_create_file(&adap->dev, &dev_attr_name);
230 if (res)
231 goto out_unregister;
232
233 /* Add this adapter to the i2c_adapter class */
234 memset(&adap->class_dev, 0x00, sizeof(struct class_device));
235 adap->class_dev.dev = &adap->dev;
236 adap->class_dev.class = &i2c_adapter_class;
237 strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE);
238 res = class_device_register(&adap->class_dev);
239 if (res)
240 goto out_remove_name;
241 354
242 dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); 355 dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
243 356
244 /* inform drivers of new adapters */ 357 /* create pre-declared device nodes for new-style drivers */
358 if (adap->nr < __i2c_first_dynamic_bus_num)
359 i2c_scan_static_board_info(adap);
360
361 /* let legacy drivers scan this bus for matching devices */
245 list_for_each(item,&drivers) { 362 list_for_each(item,&drivers) {
246 driver = list_entry(item, struct i2c_driver, list); 363 driver = list_entry(item, struct i2c_driver, list);
247 if (driver->attach_adapter) 364 if (driver->attach_adapter)
@@ -253,18 +370,98 @@ out_unlock:
253 mutex_unlock(&core_lists); 370 mutex_unlock(&core_lists);
254 return res; 371 return res;
255 372
256out_remove_name:
257 device_remove_file(&adap->dev, &dev_attr_name);
258out_unregister:
259 init_completion(&adap->dev_released); /* Needed? */
260 device_unregister(&adap->dev);
261 wait_for_completion(&adap->dev_released);
262out_list: 373out_list:
263 list_del(&adap->list); 374 list_del(&adap->list);
264 idr_remove(&i2c_adapter_idr, adap->nr); 375 idr_remove(&i2c_adapter_idr, adap->nr);
265 goto out_unlock; 376 goto out_unlock;
266} 377}
267 378
379/**
380 * i2c_add_adapter - declare i2c adapter, use dynamic bus number
381 * @adapter: the adapter to add
382 *
383 * This routine is used to declare an I2C adapter when its bus number
384 * doesn't matter. Examples: for I2C adapters dynamically added by
385 * USB links or PCI plugin cards.
386 *
387 * When this returns zero, a new bus number was allocated and stored
388 * in adap->nr, and the specified adapter became available for clients.
389 * Otherwise, a negative errno value is returned.
390 */
391int i2c_add_adapter(struct i2c_adapter *adapter)
392{
393 int id, res = 0;
394
395retry:
396 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0)
397 return -ENOMEM;
398
399 mutex_lock(&core_lists);
400 /* "above" here means "above or equal to", sigh */
401 res = idr_get_new_above(&i2c_adapter_idr, adapter,
402 __i2c_first_dynamic_bus_num, &id);
403 mutex_unlock(&core_lists);
404
405 if (res < 0) {
406 if (res == -EAGAIN)
407 goto retry;
408 return res;
409 }
410
411 adapter->nr = id;
412 return i2c_register_adapter(adapter);
413}
414EXPORT_SYMBOL(i2c_add_adapter);
415
416/**
417 * i2c_add_numbered_adapter - declare i2c adapter, use static bus number
418 * @adap: the adapter to register (with adap->nr initialized)
419 *
420 * This routine is used to declare an I2C adapter when its bus number
421 * matters. Example: for I2C adapters from system-on-chip CPUs, or
422 * otherwise built in to the system's mainboard, and where i2c_board_info
423 * is used to properly configure I2C devices.
424 *
425 * If no devices have pre-been declared for this bus, then be sure to
426 * register the adapter before any dynamically allocated ones. Otherwise
427 * the required bus ID may not be available.
428 *
429 * When this returns zero, the specified adapter became available for
430 * clients using the bus number provided in adap->nr. Also, the table
431 * of I2C devices pre-declared using i2c_register_board_info() is scanned,
432 * and the appropriate driver model device nodes are created. Otherwise, a
433 * negative errno value is returned.
434 */
435int i2c_add_numbered_adapter(struct i2c_adapter *adap)
436{
437 int id;
438 int status;
439
440 if (adap->nr & ~MAX_ID_MASK)
441 return -EINVAL;
442
443retry:
444 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0)
445 return -ENOMEM;
446
447 mutex_lock(&core_lists);
448 /* "above" here means "above or equal to", sigh;
449 * we need the "equal to" result to force the result
450 */
451 status = idr_get_new_above(&i2c_adapter_idr, adap, adap->nr, &id);
452 if (status == 0 && id != adap->nr) {
453 status = -EBUSY;
454 idr_remove(&i2c_adapter_idr, id);
455 }
456 mutex_unlock(&core_lists);
457 if (status == -EAGAIN)
458 goto retry;
459
460 if (status == 0)
461 status = i2c_register_adapter(adap);
462 return status;
463}
464EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);
268 465
269int i2c_del_adapter(struct i2c_adapter *adap) 466int i2c_del_adapter(struct i2c_adapter *adap)
270{ 467{
@@ -302,9 +499,19 @@ int i2c_del_adapter(struct i2c_adapter *adap)
302 /* detach any active clients. This must be done first, because 499 /* detach any active clients. This must be done first, because
303 * it can fail; in which case we give up. */ 500 * it can fail; in which case we give up. */
304 list_for_each_safe(item, _n, &adap->clients) { 501 list_for_each_safe(item, _n, &adap->clients) {
502 struct i2c_driver *driver;
503
305 client = list_entry(item, struct i2c_client, list); 504 client = list_entry(item, struct i2c_client, list);
505 driver = client->driver;
506
507 /* new style, follow standard driver model */
508 if (!driver || is_newstyle_driver(driver)) {
509 i2c_unregister_device(client);
510 continue;
511 }
306 512
307 if ((res=client->driver->detach_client(client))) { 513 /* legacy drivers create and remove clients themselves */
514 if ((res = driver->detach_client(client))) {
308 dev_err(&adap->dev, "detach_client failed for client " 515 dev_err(&adap->dev, "detach_client failed for client "
309 "[%s] at address 0x%02x\n", client->name, 516 "[%s] at address 0x%02x\n", client->name,
310 client->addr); 517 client->addr);
@@ -314,17 +521,13 @@ int i2c_del_adapter(struct i2c_adapter *adap)
314 521
315 /* clean up the sysfs representation */ 522 /* clean up the sysfs representation */
316 init_completion(&adap->dev_released); 523 init_completion(&adap->dev_released);
317 init_completion(&adap->class_dev_released);
318 class_device_unregister(&adap->class_dev);
319 device_remove_file(&adap->dev, &dev_attr_name);
320 device_unregister(&adap->dev); 524 device_unregister(&adap->dev);
321 list_del(&adap->list); 525 list_del(&adap->list);
322 526
323 /* wait for sysfs to drop all references */ 527 /* wait for sysfs to drop all references */
324 wait_for_completion(&adap->dev_released); 528 wait_for_completion(&adap->dev_released);
325 wait_for_completion(&adap->class_dev_released);
326 529
327 /* free dynamically allocated bus id */ 530 /* free bus id */
328 idr_remove(&i2c_adapter_idr, adap->nr); 531 idr_remove(&i2c_adapter_idr, adap->nr);
329 532
330 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); 533 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
@@ -333,24 +536,42 @@ int i2c_del_adapter(struct i2c_adapter *adap)
333 mutex_unlock(&core_lists); 536 mutex_unlock(&core_lists);
334 return res; 537 return res;
335} 538}
539EXPORT_SYMBOL(i2c_del_adapter);
540
336 541
542/* ------------------------------------------------------------------------- */
337 543
338/* ----- 544/*
339 * What follows is the "upwards" interface: commands for talking to clients, 545 * An i2c_driver is used with one or more i2c_client (device) nodes to access
340 * which implement the functions to access the physical information of the 546 * i2c slave chips, on a bus instance associated with some i2c_adapter. There
341 * chips. 547 * are two models for binding the driver to its device: "new style" drivers
548 * follow the standard Linux driver model and just respond to probe() calls
549 * issued if the driver core sees they match(); "legacy" drivers create device
550 * nodes themselves.
342 */ 551 */
343 552
344int i2c_register_driver(struct module *owner, struct i2c_driver *driver) 553int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
345{ 554{
346 struct list_head *item;
347 struct i2c_adapter *adapter;
348 int res; 555 int res;
349 556
557 /* new style driver methods can't mix with legacy ones */
558 if (is_newstyle_driver(driver)) {
559 if (driver->attach_adapter || driver->detach_adapter
560 || driver->detach_client) {
561 printk(KERN_WARNING
562 "i2c-core: driver [%s] is confused\n",
563 driver->driver.name);
564 return -EINVAL;
565 }
566 }
567
350 /* add the driver to the list of i2c drivers in the driver core */ 568 /* add the driver to the list of i2c drivers in the driver core */
351 driver->driver.owner = owner; 569 driver->driver.owner = owner;
352 driver->driver.bus = &i2c_bus_type; 570 driver->driver.bus = &i2c_bus_type;
353 571
572 /* for new style drivers, when registration returns the driver core
573 * will have called probe() for all matching-but-unbound devices.
574 */
354 res = driver_register(&driver->driver); 575 res = driver_register(&driver->driver);
355 if (res) 576 if (res)
356 return res; 577 return res;
@@ -360,10 +581,11 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
360 list_add_tail(&driver->list,&drivers); 581 list_add_tail(&driver->list,&drivers);
361 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); 582 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
362 583
363 /* now look for instances of driver on our adapters */ 584 /* legacy drivers scan i2c busses directly */
364 if (driver->attach_adapter) { 585 if (driver->attach_adapter) {
365 list_for_each(item,&adapters) { 586 struct i2c_adapter *adapter;
366 adapter = list_entry(item, struct i2c_adapter, list); 587
588 list_for_each_entry(adapter, &adapters, list) {
367 driver->attach_adapter(adapter); 589 driver->attach_adapter(adapter);
368 } 590 }
369 } 591 }
@@ -373,16 +595,22 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
373} 595}
374EXPORT_SYMBOL(i2c_register_driver); 596EXPORT_SYMBOL(i2c_register_driver);
375 597
376int i2c_del_driver(struct i2c_driver *driver) 598/**
599 * i2c_del_driver - unregister I2C driver
600 * @driver: the driver being unregistered
601 */
602void i2c_del_driver(struct i2c_driver *driver)
377{ 603{
378 struct list_head *item1, *item2, *_n; 604 struct list_head *item1, *item2, *_n;
379 struct i2c_client *client; 605 struct i2c_client *client;
380 struct i2c_adapter *adap; 606 struct i2c_adapter *adap;
381 607
382 int res = 0;
383
384 mutex_lock(&core_lists); 608 mutex_lock(&core_lists);
385 609
610 /* new-style driver? */
611 if (is_newstyle_driver(driver))
612 goto unregister;
613
386 /* Have a look at each adapter, if clients of this driver are still 614 /* Have a look at each adapter, if clients of this driver are still
387 * attached. If so, detach them to be able to kill the driver 615 * attached. If so, detach them to be able to kill the driver
388 * afterwards. 616 * afterwards.
@@ -390,11 +618,10 @@ int i2c_del_driver(struct i2c_driver *driver)
390 list_for_each(item1,&adapters) { 618 list_for_each(item1,&adapters) {
391 adap = list_entry(item1, struct i2c_adapter, list); 619 adap = list_entry(item1, struct i2c_adapter, list);
392 if (driver->detach_adapter) { 620 if (driver->detach_adapter) {
393 if ((res = driver->detach_adapter(adap))) { 621 if (driver->detach_adapter(adap)) {
394 dev_err(&adap->dev, "detach_adapter failed " 622 dev_err(&adap->dev, "detach_adapter failed "
395 "for driver [%s]\n", 623 "for driver [%s]\n",
396 driver->driver.name); 624 driver->driver.name);
397 goto out_unlock;
398 } 625 }
399 } else { 626 } else {
400 list_for_each_safe(item2, _n, &adap->clients) { 627 list_for_each_safe(item2, _n, &adap->clients) {
@@ -404,25 +631,26 @@ int i2c_del_driver(struct i2c_driver *driver)
404 dev_dbg(&adap->dev, "detaching client [%s] " 631 dev_dbg(&adap->dev, "detaching client [%s] "
405 "at 0x%02x\n", client->name, 632 "at 0x%02x\n", client->name,
406 client->addr); 633 client->addr);
407 if ((res = driver->detach_client(client))) { 634 if (driver->detach_client(client)) {
408 dev_err(&adap->dev, "detach_client " 635 dev_err(&adap->dev, "detach_client "
409 "failed for client [%s] at " 636 "failed for client [%s] at "
410 "0x%02x\n", client->name, 637 "0x%02x\n", client->name,
411 client->addr); 638 client->addr);
412 goto out_unlock;
413 } 639 }
414 } 640 }
415 } 641 }
416 } 642 }
417 643
644 unregister:
418 driver_unregister(&driver->driver); 645 driver_unregister(&driver->driver);
419 list_del(&driver->list); 646 list_del(&driver->list);
420 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); 647 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
421 648
422 out_unlock:
423 mutex_unlock(&core_lists); 649 mutex_unlock(&core_lists);
424 return 0;
425} 650}
651EXPORT_SYMBOL(i2c_del_driver);
652
653/* ------------------------------------------------------------------------- */
426 654
427static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) 655static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr)
428{ 656{
@@ -447,6 +675,7 @@ int i2c_check_addr(struct i2c_adapter *adapter, int addr)
447 675
448 return rval; 676 return rval;
449} 677}
678EXPORT_SYMBOL(i2c_check_addr);
450 679
451int i2c_attach_client(struct i2c_client *client) 680int i2c_attach_client(struct i2c_client *client)
452{ 681{
@@ -463,9 +692,15 @@ int i2c_attach_client(struct i2c_client *client)
463 client->usage_count = 0; 692 client->usage_count = 0;
464 693
465 client->dev.parent = &client->adapter->dev; 694 client->dev.parent = &client->adapter->dev;
466 client->dev.driver = &client->driver->driver;
467 client->dev.bus = &i2c_bus_type; 695 client->dev.bus = &i2c_bus_type;
468 client->dev.release = &i2c_client_release; 696
697 if (client->driver)
698 client->dev.driver = &client->driver->driver;
699
700 if (client->driver && !is_newstyle_driver(client->driver))
701 client->dev.release = i2c_client_release;
702 else
703 client->dev.release = i2c_client_dev_release;
469 704
470 snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), 705 snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
471 "%d-%04x", i2c_adapter_id(adapter), client->addr); 706 "%d-%04x", i2c_adapter_id(adapter), client->addr);
@@ -474,9 +709,6 @@ int i2c_attach_client(struct i2c_client *client)
474 res = device_register(&client->dev); 709 res = device_register(&client->dev);
475 if (res) 710 if (res)
476 goto out_list; 711 goto out_list;
477 res = device_create_file(&client->dev, &dev_attr_client_name);
478 if (res)
479 goto out_unregister;
480 mutex_unlock(&adapter->clist_lock); 712 mutex_unlock(&adapter->clist_lock);
481 713
482 if (adapter->client_register) { 714 if (adapter->client_register) {
@@ -489,10 +721,6 @@ int i2c_attach_client(struct i2c_client *client)
489 721
490 return 0; 722 return 0;
491 723
492out_unregister:
493 init_completion(&client->released); /* Needed? */
494 device_unregister(&client->dev);
495 wait_for_completion(&client->released);
496out_list: 724out_list:
497 list_del(&client->list); 725 list_del(&client->list);
498 dev_err(&adapter->dev, "Failed to attach i2c client %s at 0x%02x " 726 dev_err(&adapter->dev, "Failed to attach i2c client %s at 0x%02x "
@@ -501,7 +729,7 @@ out_unlock:
501 mutex_unlock(&adapter->clist_lock); 729 mutex_unlock(&adapter->clist_lock);
502 return res; 730 return res;
503} 731}
504 732EXPORT_SYMBOL(i2c_attach_client);
505 733
506int i2c_detach_client(struct i2c_client *client) 734int i2c_detach_client(struct i2c_client *client)
507{ 735{
@@ -527,7 +755,6 @@ int i2c_detach_client(struct i2c_client *client)
527 mutex_lock(&adapter->clist_lock); 755 mutex_lock(&adapter->clist_lock);
528 list_del(&client->list); 756 list_del(&client->list);
529 init_completion(&client->released); 757 init_completion(&client->released);
530 device_remove_file(&client->dev, &dev_attr_client_name);
531 device_unregister(&client->dev); 758 device_unregister(&client->dev);
532 mutex_unlock(&adapter->clist_lock); 759 mutex_unlock(&adapter->clist_lock);
533 wait_for_completion(&client->released); 760 wait_for_completion(&client->released);
@@ -535,6 +762,7 @@ int i2c_detach_client(struct i2c_client *client)
535 out: 762 out:
536 return res; 763 return res;
537} 764}
765EXPORT_SYMBOL(i2c_detach_client);
538 766
539static int i2c_inc_use_client(struct i2c_client *client) 767static int i2c_inc_use_client(struct i2c_client *client)
540{ 768{
@@ -567,6 +795,7 @@ int i2c_use_client(struct i2c_client *client)
567 795
568 return 0; 796 return 0;
569} 797}
798EXPORT_SYMBOL(i2c_use_client);
570 799
571int i2c_release_client(struct i2c_client *client) 800int i2c_release_client(struct i2c_client *client)
572{ 801{
@@ -581,6 +810,7 @@ int i2c_release_client(struct i2c_client *client)
581 810
582 return 0; 811 return 0;
583} 812}
813EXPORT_SYMBOL(i2c_release_client);
584 814
585void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) 815void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg)
586{ 816{
@@ -601,6 +831,7 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg)
601 } 831 }
602 mutex_unlock(&adap->clist_lock); 832 mutex_unlock(&adap->clist_lock);
603} 833}
834EXPORT_SYMBOL(i2c_clients_command);
604 835
605static int __init i2c_init(void) 836static int __init i2c_init(void)
606{ 837{
@@ -609,16 +840,12 @@ static int __init i2c_init(void)
609 retval = bus_register(&i2c_bus_type); 840 retval = bus_register(&i2c_bus_type);
610 if (retval) 841 if (retval)
611 return retval; 842 return retval;
612 retval = driver_register(&i2c_adapter_driver);
613 if (retval)
614 return retval;
615 return class_register(&i2c_adapter_class); 843 return class_register(&i2c_adapter_class);
616} 844}
617 845
618static void __exit i2c_exit(void) 846static void __exit i2c_exit(void)
619{ 847{
620 class_unregister(&i2c_adapter_class); 848 class_unregister(&i2c_adapter_class);
621 driver_unregister(&i2c_adapter_driver);
622 bus_unregister(&i2c_bus_type); 849 bus_unregister(&i2c_bus_type);
623} 850}
624 851
@@ -638,8 +865,9 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num)
638#ifdef DEBUG 865#ifdef DEBUG
639 for (ret = 0; ret < num; ret++) { 866 for (ret = 0; ret < num; ret++) {
640 dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " 867 dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, "
641 "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 868 "len=%d%s\n", ret, (msgs[ret].flags & I2C_M_RD)
642 'R' : 'W', msgs[ret].addr, msgs[ret].len); 869 ? 'R' : 'W', msgs[ret].addr, msgs[ret].len,
870 (msgs[ret].flags & I2C_M_RECV_LEN) ? "+" : "");
643 } 871 }
644#endif 872#endif
645 873
@@ -653,6 +881,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num)
653 return -ENOSYS; 881 return -ENOSYS;
654 } 882 }
655} 883}
884EXPORT_SYMBOL(i2c_transfer);
656 885
657int i2c_master_send(struct i2c_client *client,const char *buf ,int count) 886int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
658{ 887{
@@ -671,6 +900,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
671 transmitted, else error code. */ 900 transmitted, else error code. */
672 return (ret == 1) ? count : ret; 901 return (ret == 1) ? count : ret;
673} 902}
903EXPORT_SYMBOL(i2c_master_send);
674 904
675int i2c_master_recv(struct i2c_client *client, char *buf ,int count) 905int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
676{ 906{
@@ -690,7 +920,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
690 transmitted, else error code. */ 920 transmitted, else error code. */
691 return (ret == 1) ? count : ret; 921 return (ret == 1) ? count : ret;
692} 922}
693 923EXPORT_SYMBOL(i2c_master_recv);
694 924
695int i2c_control(struct i2c_client *client, 925int i2c_control(struct i2c_client *client,
696 unsigned int cmd, unsigned long arg) 926 unsigned int cmd, unsigned long arg)
@@ -712,6 +942,7 @@ int i2c_control(struct i2c_client *client,
712 } 942 }
713 return ret; 943 return ret;
714} 944}
945EXPORT_SYMBOL(i2c_control);
715 946
716/* ---------------------------------------------------- 947/* ----------------------------------------------------
717 * the i2c address scanning function 948 * the i2c address scanning function
@@ -853,6 +1084,70 @@ int i2c_probe(struct i2c_adapter *adapter,
853 1084
854 return 0; 1085 return 0;
855} 1086}
1087EXPORT_SYMBOL(i2c_probe);
1088
1089struct i2c_client *
1090i2c_new_probed_device(struct i2c_adapter *adap,
1091 struct i2c_board_info *info,
1092 unsigned short const *addr_list)
1093{
1094 int i;
1095
1096 /* Stop here if the bus doesn't support probing */
1097 if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_READ_BYTE)) {
1098 dev_err(&adap->dev, "Probing not supported\n");
1099 return NULL;
1100 }
1101
1102 mutex_lock(&adap->clist_lock);
1103 for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
1104 /* Check address validity */
1105 if (addr_list[i] < 0x03 || addr_list[i] > 0x77) {
1106 dev_warn(&adap->dev, "Invalid 7-bit address "
1107 "0x%02x\n", addr_list[i]);
1108 continue;
1109 }
1110
1111 /* Check address availability */
1112 if (__i2c_check_addr(adap, addr_list[i])) {
1113 dev_dbg(&adap->dev, "Address 0x%02x already in "
1114 "use, not probing\n", addr_list[i]);
1115 continue;
1116 }
1117
1118 /* Test address responsiveness
1119 The default probe method is a quick write, but it is known
1120 to corrupt the 24RF08 EEPROMs due to a state machine bug,
1121 and could also irreversibly write-protect some EEPROMs, so
1122 for address ranges 0x30-0x37 and 0x50-0x5f, we use a byte
1123 read instead. Also, some bus drivers don't implement
1124 quick write, so we fallback to a byte read it that case
1125 too. */
1126 if ((addr_list[i] & ~0x07) == 0x30
1127 || (addr_list[i] & ~0x0f) == 0x50
1128 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) {
1129 if (i2c_smbus_xfer(adap, addr_list[i], 0,
1130 I2C_SMBUS_READ, 0,
1131 I2C_SMBUS_BYTE, NULL) >= 0)
1132 break;
1133 } else {
1134 if (i2c_smbus_xfer(adap, addr_list[i], 0,
1135 I2C_SMBUS_WRITE, 0,
1136 I2C_SMBUS_QUICK, NULL) >= 0)
1137 break;
1138 }
1139 }
1140 mutex_unlock(&adap->clist_lock);
1141
1142 if (addr_list[i] == I2C_CLIENT_END) {
1143 dev_dbg(&adap->dev, "Probing failed, no device found\n");
1144 return NULL;
1145 }
1146
1147 info->addr = addr_list[i];
1148 return i2c_new_device(adap, info);
1149}
1150EXPORT_SYMBOL_GPL(i2c_new_probed_device);
856 1151
857struct i2c_adapter* i2c_get_adapter(int id) 1152struct i2c_adapter* i2c_get_adapter(int id)
858{ 1153{
@@ -866,11 +1161,13 @@ struct i2c_adapter* i2c_get_adapter(int id)
866 mutex_unlock(&core_lists); 1161 mutex_unlock(&core_lists);
867 return adapter; 1162 return adapter;
868} 1163}
1164EXPORT_SYMBOL(i2c_get_adapter);
869 1165
870void i2c_put_adapter(struct i2c_adapter *adap) 1166void i2c_put_adapter(struct i2c_adapter *adap)
871{ 1167{
872 module_put(adap->owner); 1168 module_put(adap->owner);
873} 1169}
1170EXPORT_SYMBOL(i2c_put_adapter);
874 1171
875/* The SMBus parts */ 1172/* The SMBus parts */
876 1173
@@ -939,6 +1236,7 @@ s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value)
939 return i2c_smbus_xfer(client->adapter,client->addr,client->flags, 1236 return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
940 value,0,I2C_SMBUS_QUICK,NULL); 1237 value,0,I2C_SMBUS_QUICK,NULL);
941} 1238}
1239EXPORT_SYMBOL(i2c_smbus_write_quick);
942 1240
943s32 i2c_smbus_read_byte(struct i2c_client *client) 1241s32 i2c_smbus_read_byte(struct i2c_client *client)
944{ 1242{
@@ -949,12 +1247,14 @@ s32 i2c_smbus_read_byte(struct i2c_client *client)
949 else 1247 else
950 return data.byte; 1248 return data.byte;
951} 1249}
1250EXPORT_SYMBOL(i2c_smbus_read_byte);
952 1251
953s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) 1252s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value)
954{ 1253{
955 return i2c_smbus_xfer(client->adapter,client->addr,client->flags, 1254 return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
956 I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); 1255 I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
957} 1256}
1257EXPORT_SYMBOL(i2c_smbus_write_byte);
958 1258
959s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) 1259s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command)
960{ 1260{
@@ -965,6 +1265,7 @@ s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command)
965 else 1265 else
966 return data.byte; 1266 return data.byte;
967} 1267}
1268EXPORT_SYMBOL(i2c_smbus_read_byte_data);
968 1269
969s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) 1270s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value)
970{ 1271{
@@ -974,6 +1275,7 @@ s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value)
974 I2C_SMBUS_WRITE,command, 1275 I2C_SMBUS_WRITE,command,
975 I2C_SMBUS_BYTE_DATA,&data); 1276 I2C_SMBUS_BYTE_DATA,&data);
976} 1277}
1278EXPORT_SYMBOL(i2c_smbus_write_byte_data);
977 1279
978s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) 1280s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command)
979{ 1281{
@@ -984,6 +1286,7 @@ s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command)
984 else 1286 else
985 return data.word; 1287 return data.word;
986} 1288}
1289EXPORT_SYMBOL(i2c_smbus_read_word_data);
987 1290
988s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) 1291s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value)
989{ 1292{
@@ -993,6 +1296,23 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value)
993 I2C_SMBUS_WRITE,command, 1296 I2C_SMBUS_WRITE,command,
994 I2C_SMBUS_WORD_DATA,&data); 1297 I2C_SMBUS_WORD_DATA,&data);
995} 1298}
1299EXPORT_SYMBOL(i2c_smbus_write_word_data);
1300
1301/* Returns the number of read bytes */
1302s32 i2c_smbus_read_block_data(struct i2c_client *client, u8 command,
1303 u8 *values)
1304{
1305 union i2c_smbus_data data;
1306
1307 if (i2c_smbus_xfer(client->adapter, client->addr, client->flags,
1308 I2C_SMBUS_READ, command,
1309 I2C_SMBUS_BLOCK_DATA, &data))
1310 return -1;
1311
1312 memcpy(values, &data.block[1], data.block[0]);
1313 return data.block[0];
1314}
1315EXPORT_SYMBOL(i2c_smbus_read_block_data);
996 1316
997s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, 1317s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
998 u8 length, const u8 *values) 1318 u8 length, const u8 *values)
@@ -1007,6 +1327,7 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
1007 I2C_SMBUS_WRITE,command, 1327 I2C_SMBUS_WRITE,command,
1008 I2C_SMBUS_BLOCK_DATA,&data); 1328 I2C_SMBUS_BLOCK_DATA,&data);
1009} 1329}
1330EXPORT_SYMBOL(i2c_smbus_write_block_data);
1010 1331
1011/* Returns the number of read bytes */ 1332/* Returns the number of read bytes */
1012s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) 1333s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values)
@@ -1021,6 +1342,7 @@ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *val
1021 memcpy(values, &data.block[1], data.block[0]); 1342 memcpy(values, &data.block[1], data.block[0]);
1022 return data.block[0]; 1343 return data.block[0];
1023} 1344}
1345EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
1024 1346
1025s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, 1347s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
1026 u8 length, const u8 *values) 1348 u8 length, const u8 *values)
@@ -1035,6 +1357,7 @@ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,
1035 I2C_SMBUS_WRITE, command, 1357 I2C_SMBUS_WRITE, command,
1036 I2C_SMBUS_I2C_BLOCK_DATA, &data); 1358 I2C_SMBUS_I2C_BLOCK_DATA, &data);
1037} 1359}
1360EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);
1038 1361
1039/* Simulate a SMBus command using the i2c protocol 1362/* Simulate a SMBus command using the i2c protocol
1040 No checking of parameters is done! */ 1363 No checking of parameters is done! */
@@ -1098,9 +1421,9 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
1098 break; 1421 break;
1099 case I2C_SMBUS_BLOCK_DATA: 1422 case I2C_SMBUS_BLOCK_DATA:
1100 if (read_write == I2C_SMBUS_READ) { 1423 if (read_write == I2C_SMBUS_READ) {
1101 dev_err(&adapter->dev, "Block read not supported " 1424 msg[1].flags |= I2C_M_RECV_LEN;
1102 "under I2C emulation!\n"); 1425 msg[1].len = 1; /* block length will be added by
1103 return -1; 1426 the underlying bus driver */
1104 } else { 1427 } else {
1105 msg[0].len = data->block[0] + 2; 1428 msg[0].len = data->block[0] + 2;
1106 if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { 1429 if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) {
@@ -1114,9 +1437,21 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
1114 } 1437 }
1115 break; 1438 break;
1116 case I2C_SMBUS_BLOCK_PROC_CALL: 1439 case I2C_SMBUS_BLOCK_PROC_CALL:
1117 dev_dbg(&adapter->dev, "Block process call not supported " 1440 num = 2; /* Another special case */
1118 "under I2C emulation!\n"); 1441 read_write = I2C_SMBUS_READ;
1119 return -1; 1442 if (data->block[0] > I2C_SMBUS_BLOCK_MAX) {
1443 dev_err(&adapter->dev, "%s called with invalid "
1444 "block proc call size (%d)\n", __FUNCTION__,
1445 data->block[0]);
1446 return -1;
1447 }
1448 msg[0].len = data->block[0] + 2;
1449 for (i = 1; i < msg[0].len; i++)
1450 msgbuf0[i] = data->block[i-1];
1451 msg[1].flags |= I2C_M_RECV_LEN;
1452 msg[1].len = 1; /* block length will be added by
1453 the underlying bus driver */
1454 break;
1120 case I2C_SMBUS_I2C_BLOCK_DATA: 1455 case I2C_SMBUS_I2C_BLOCK_DATA:
1121 if (read_write == I2C_SMBUS_READ) { 1456 if (read_write == I2C_SMBUS_READ) {
1122 msg[1].len = I2C_SMBUS_BLOCK_MAX; 1457 msg[1].len = I2C_SMBUS_BLOCK_MAX;
@@ -1180,6 +1515,11 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
1180 for (i = 0; i < I2C_SMBUS_BLOCK_MAX; i++) 1515 for (i = 0; i < I2C_SMBUS_BLOCK_MAX; i++)
1181 data->block[i+1] = msgbuf1[i]; 1516 data->block[i+1] = msgbuf1[i];
1182 break; 1517 break;
1518 case I2C_SMBUS_BLOCK_DATA:
1519 case I2C_SMBUS_BLOCK_PROC_CALL:
1520 for (i = 0; i < msgbuf1[0] + 1; i++)
1521 data->block[i] = msgbuf1[i];
1522 break;
1183 } 1523 }
1184 return 0; 1524 return 0;
1185} 1525}
@@ -1204,43 +1544,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags,
1204 1544
1205 return res; 1545 return res;
1206} 1546}
1207
1208
1209/* Next four are needed by i2c-isa */
1210EXPORT_SYMBOL_GPL(i2c_adapter_dev_release);
1211EXPORT_SYMBOL_GPL(i2c_adapter_driver);
1212EXPORT_SYMBOL_GPL(i2c_adapter_class);
1213EXPORT_SYMBOL_GPL(i2c_bus_type);
1214
1215EXPORT_SYMBOL(i2c_add_adapter);
1216EXPORT_SYMBOL(i2c_del_adapter);
1217EXPORT_SYMBOL(i2c_del_driver);
1218EXPORT_SYMBOL(i2c_attach_client);
1219EXPORT_SYMBOL(i2c_detach_client);
1220EXPORT_SYMBOL(i2c_use_client);
1221EXPORT_SYMBOL(i2c_release_client);
1222EXPORT_SYMBOL(i2c_clients_command);
1223EXPORT_SYMBOL(i2c_check_addr);
1224
1225EXPORT_SYMBOL(i2c_master_send);
1226EXPORT_SYMBOL(i2c_master_recv);
1227EXPORT_SYMBOL(i2c_control);
1228EXPORT_SYMBOL(i2c_transfer);
1229EXPORT_SYMBOL(i2c_get_adapter);
1230EXPORT_SYMBOL(i2c_put_adapter);
1231EXPORT_SYMBOL(i2c_probe);
1232
1233EXPORT_SYMBOL(i2c_smbus_xfer); 1547EXPORT_SYMBOL(i2c_smbus_xfer);
1234EXPORT_SYMBOL(i2c_smbus_write_quick);
1235EXPORT_SYMBOL(i2c_smbus_read_byte);
1236EXPORT_SYMBOL(i2c_smbus_write_byte);
1237EXPORT_SYMBOL(i2c_smbus_read_byte_data);
1238EXPORT_SYMBOL(i2c_smbus_write_byte_data);
1239EXPORT_SYMBOL(i2c_smbus_read_word_data);
1240EXPORT_SYMBOL(i2c_smbus_write_word_data);
1241EXPORT_SYMBOL(i2c_smbus_write_block_data);
1242EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
1243EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);
1244 1548
1245MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 1549MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
1246MODULE_DESCRIPTION("I2C-Bus main module"); 1550MODULE_DESCRIPTION("I2C-Bus main module");
diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h
new file mode 100644
index 000000000000..cd5bff874855
--- /dev/null
+++ b/drivers/i2c/i2c-core.h
@@ -0,0 +1,31 @@
1/*
2 * i2c-core.h - interfaces internal to the I2C framework
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19struct i2c_devinfo {
20 struct list_head list;
21 int busnum;
22 struct i2c_board_info board_info;
23};
24
25/* board_lock protects board_list and first_dynamic_bus_num.
26 * only i2c core components are allowed to use these symbols.
27 */
28extern struct mutex __i2c_board_lock;
29extern struct list_head __i2c_board_list;
30extern int __i2c_first_dynamic_bus_num;
31
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 556455fbfa2b..5e8efc89255a 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -730,7 +730,7 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
730 730
731 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { 731 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
732 tune_cris_ide(drive, speed - XFER_PIO_0); 732 tune_cris_ide(drive, speed - XFER_PIO_0);
733 return 0; 733 return ide_config_drive_speed(drive, speed);
734 } 734 }
735 735
736 switch(speed) 736 switch(speed)
@@ -760,7 +760,8 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
760 hold = ATA_DMA2_HOLD; 760 hold = ATA_DMA2_HOLD;
761 break; 761 break;
762 default: 762 default:
763 return 0; 763 BUG();
764 break;
764 } 765 }
765 766
766 if (speed >= XFER_UDMA_0) 767 if (speed >= XFER_UDMA_0)
@@ -768,7 +769,7 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
768 else 769 else
769 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); 770 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
770 771
771 return 0; 772 return ide_config_drive_speed(drive, speed);
772} 773}
773 774
774void __init 775void __init
@@ -821,7 +822,6 @@ init_e100_ide (void)
821 hwif->udma_four = 0; 822 hwif->udma_four = 0;
822 hwif->ultra_mask = cris_ultra_mask; 823 hwif->ultra_mask = cris_ultra_mask;
823 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ 824 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
824 hwif->swdma_mask = 0x07; /* Singleword DMA 0-2 */
825 hwif->autodma = 1; 825 hwif->autodma = 1;
826 hwif->drives[0].autodma = 1; 826 hwif->drives[0].autodma = 1;
827 hwif->drives[1].autodma = 1; 827 hwif->drives[1].autodma = 1;
@@ -1010,7 +1010,6 @@ static int cris_config_drive_for_dma (ide_drive_t *drive)
1010 return 0; 1010 return 0;
1011 1011
1012 speed_cris_ide(drive, speed); 1012 speed_cris_ide(drive, speed);
1013 ide_config_drive_speed(drive, speed);
1014 1013
1015 return ide_dma_enable(drive); 1014 return ide_dma_enable(drive);
1016} 1015}
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index b08c37c9f956..c6522a64d7ec 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -401,6 +401,7 @@ static struct pcmcia_device_id ide_ids[] = {
401 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 401 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
402 PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), 402 PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443),
403 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), 403 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
404 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2),
404 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), 405 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
405 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 406 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
406 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), 407 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 990eafe5ea11..73bdf64dbbfc 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/ide/pci/aec62xx.c Version 0.11 March 27, 2002 2 * linux/drivers/ide/pci/aec62xx.c Version 0.21 Apr 21, 2007
3 * 3 *
4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
5 * 6 *
6 */ 7 */
7 8
@@ -193,18 +194,8 @@ static int config_chipset_for_dma (ide_drive_t *drive)
193 194
194static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 195static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
195{ 196{
196 u8 speed = 0; 197 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
197 u8 new_pio = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); 198 (void) aec62xx_tune_chipset(drive, pio + XFER_PIO_0);
198
199 switch(pio) {
200 case 5: speed = new_pio; break;
201 case 4: speed = XFER_PIO_4; break;
202 case 3: speed = XFER_PIO_3; break;
203 case 2: speed = XFER_PIO_2; break;
204 case 1: speed = XFER_PIO_1; break;
205 default: speed = XFER_PIO_0; break;
206 }
207 (void) aec62xx_tune_chipset(drive, speed);
208} 199}
209 200
210static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) 201static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
@@ -213,7 +204,7 @@ static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
213 return 0; 204 return 0;
214 205
215 if (ide_use_fast_pio(drive)) 206 if (ide_use_fast_pio(drive))
216 aec62xx_tune_drive(drive, 5); 207 aec62xx_tune_drive(drive, 255);
217 208
218 return -1; 209 return -1;
219} 210}
@@ -288,11 +279,10 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
288 279
289 hwif->ultra_mask = 0x7f; 280 hwif->ultra_mask = 0x7f;
290 hwif->mwdma_mask = 0x07; 281 hwif->mwdma_mask = 0x07;
291 hwif->swdma_mask = 0x07;
292 282
293 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; 283 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate;
294 hwif->ide_dma_lostirq = &aec62xx_irq_timeout; 284 hwif->ide_dma_lostirq = &aec62xx_irq_timeout;
295 hwif->ide_dma_timeout = &aec62xx_irq_timeout; 285
296 if (!noautodma) 286 if (!noautodma)
297 hwif->autodma = 1; 287 hwif->autodma = 1;
298 hwif->drives[0].autodma = hwif->autodma; 288 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 83e0aa65a431..946a12746cb5 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -534,7 +534,7 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
534 struct hd_driveid *id = drive->id; 534 struct hd_driveid *id = drive->id;
535 535
536 if ((m5229_revision<=0x20) && (drive->media!=ide_disk)) 536 if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
537 goto no_dma_set; 537 goto ata_pio;
538 538
539 drive->init_speed = 0; 539 drive->init_speed = 0;
540 540
@@ -555,20 +555,19 @@ try_dma_modes:
555 (id->dma_1word & hwif->swdma_mask)) { 555 (id->dma_1word & hwif->swdma_mask)) {
556 /* Force if Capable regular DMA modes */ 556 /* Force if Capable regular DMA modes */
557 if (!config_chipset_for_dma(drive)) 557 if (!config_chipset_for_dma(drive))
558 goto no_dma_set; 558 goto ata_pio;
559 } 559 }
560 } else if (__ide_dma_good_drive(drive) && 560 } else if (__ide_dma_good_drive(drive) &&
561 (id->eide_dma_time < 150)) { 561 (id->eide_dma_time < 150)) {
562 /* Consult the list of known "good" drives */ 562 /* Consult the list of known "good" drives */
563 if (!config_chipset_for_dma(drive)) 563 if (!config_chipset_for_dma(drive))
564 goto no_dma_set; 564 goto ata_pio;
565 } else { 565 } else {
566 goto ata_pio; 566 goto ata_pio;
567 } 567 }
568 } else { 568 } else {
569ata_pio: 569ata_pio:
570 hwif->tuneproc(drive, 255); 570 hwif->tuneproc(drive, 255);
571no_dma_set:
572 return -1; 571 return -1;
573 } 572 }
574 573
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 561197f7b5bb..77f51ab6d439 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,10 +1,7 @@
1/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 1/*
2 * 2 * linux/drivers/ide/pci/cmd64x.c Version 1.47 Mar 19, 2007
3 * linux/drivers/ide/pci/cmd64x.c Version 1.42 Feb 8, 2007
4 * 3 *
5 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
6 * Note, this driver is not used at all on other systems because
7 * there the "BIOS" has done all of the following already.
8 * Due to massive hardware bugs, UltraDMA is only supported 5 * Due to massive hardware bugs, UltraDMA is only supported
9 * on the 646U2 and not on the 646U. 6 * on the 646U2 and not on the 646U.
10 * 7 *
@@ -39,11 +36,12 @@
39 * CMD64x specific registers definition. 36 * CMD64x specific registers definition.
40 */ 37 */
41#define CFR 0x50 38#define CFR 0x50
42#define CFR_INTR_CH0 0x02 39#define CFR_INTR_CH0 0x04
43#define CNTRL 0x51 40#define CNTRL 0x51
44#define CNTRL_DIS_RA0 0x40 41#define CNTRL_ENA_1ST 0x04
45#define CNTRL_DIS_RA1 0x80 42#define CNTRL_ENA_2ND 0x08
46#define CNTRL_ENA_2ND 0x08 43#define CNTRL_DIS_RA0 0x40
44#define CNTRL_DIS_RA1 0x80
47 45
48#define CMDTIM 0x52 46#define CMDTIM 0x52
49#define ARTTIM0 0x53 47#define ARTTIM0 0x53
@@ -90,86 +88,67 @@ static int n_cmd_devs;
90static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) 88static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index)
91{ 89{
92 char *p = buf; 90 char *p = buf;
93
94 u8 reg53 = 0, reg54 = 0, reg55 = 0, reg56 = 0; /* primary */
95 u8 reg57 = 0, reg58 = 0, reg5b; /* secondary */
96 u8 reg72 = 0, reg73 = 0; /* primary */ 91 u8 reg72 = 0, reg73 = 0; /* primary */
97 u8 reg7a = 0, reg7b = 0; /* secondary */ 92 u8 reg7a = 0, reg7b = 0; /* secondary */
98 u8 reg50 = 0, reg71 = 0; /* extra */ 93 u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */
94 u8 rev = 0;
99 95
100 p += sprintf(p, "\nController: %d\n", index); 96 p += sprintf(p, "\nController: %d\n", index);
101 p += sprintf(p, "CMD%x Chipset.\n", dev->device); 97 p += sprintf(p, "PCI-%x Chipset.\n", dev->device);
98
102 (void) pci_read_config_byte(dev, CFR, &reg50); 99 (void) pci_read_config_byte(dev, CFR, &reg50);
103 (void) pci_read_config_byte(dev, ARTTIM0, &reg53); 100 (void) pci_read_config_byte(dev, CNTRL, &reg51);
104 (void) pci_read_config_byte(dev, DRWTIM0, &reg54); 101 (void) pci_read_config_byte(dev, ARTTIM23, &reg57);
105 (void) pci_read_config_byte(dev, ARTTIM1, &reg55);
106 (void) pci_read_config_byte(dev, DRWTIM1, &reg56);
107 (void) pci_read_config_byte(dev, ARTTIM2, &reg57);
108 (void) pci_read_config_byte(dev, DRWTIM2, &reg58);
109 (void) pci_read_config_byte(dev, DRWTIM3, &reg5b);
110 (void) pci_read_config_byte(dev, MRDMODE, &reg71); 102 (void) pci_read_config_byte(dev, MRDMODE, &reg71);
111 (void) pci_read_config_byte(dev, BMIDESR0, &reg72); 103 (void) pci_read_config_byte(dev, BMIDESR0, &reg72);
112 (void) pci_read_config_byte(dev, UDIDETCR0, &reg73); 104 (void) pci_read_config_byte(dev, UDIDETCR0, &reg73);
113 (void) pci_read_config_byte(dev, BMIDESR1, &reg7a); 105 (void) pci_read_config_byte(dev, BMIDESR1, &reg7a);
114 (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b); 106 (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b);
115 107
116 p += sprintf(p, "--------------- Primary Channel " 108 /* PCI0643/6 originally didn't have the primary channel enable bit */
117 "---------------- Secondary Channel " 109 (void) pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
118 "-------------\n"); 110 if ((dev->device == PCI_DEVICE_ID_CMD_643) ||
119 p += sprintf(p, " %sabled " 111 (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 3))
120 " %sabled\n", 112 reg51 |= CNTRL_ENA_1ST;
121 (reg72&0x80)?"dis":" en", 113
122 (reg7a&0x80)?"dis":" en"); 114 p += sprintf(p, "---------------- Primary Channel "
123 p += sprintf(p, "--------------- drive0 " 115 "---------------- Secondary Channel ------------\n");
124 "--------- drive1 -------- drive0 " 116 p += sprintf(p, " %s %s\n",
125 "---------- drive1 ------\n"); 117 (reg51 & CNTRL_ENA_1ST) ? "enabled " : "disabled",
126 p += sprintf(p, "DMA enabled: %s %s" 118 (reg51 & CNTRL_ENA_2ND) ? "enabled " : "disabled");
127 " %s %s\n", 119 p += sprintf(p, "---------------- drive0 --------- drive1 "
128 (reg72&0x20)?"yes":"no ", (reg72&0x40)?"yes":"no ", 120 "-------- drive0 --------- drive1 ------\n");
129 (reg7a&0x20)?"yes":"no ", (reg7a&0x40)?"yes":"no "); 121 p += sprintf(p, "DMA enabled: %s %s"
130 122 " %s %s\n",
131 p += sprintf(p, "DMA Mode: %s(%s) %s(%s)", 123 (reg72 & 0x20) ? "yes" : "no ", (reg72 & 0x40) ? "yes" : "no ",
132 (reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO", 124 (reg7a & 0x20) ? "yes" : "no ", (reg7a & 0x40) ? "yes" : "no ");
133 (reg72&0x20)?( 125 p += sprintf(p, "UltraDMA mode: %s (%c) %s (%c)",
134 ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"): 126 ( reg73 & 0x01) ? " on" : "off",
135 ((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"): 127 ((reg73 & 0x30) == 0x30) ? ((reg73 & 0x04) ? '3' : '0') :
136 ((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"): 128 ((reg73 & 0x30) == 0x20) ? ((reg73 & 0x04) ? '3' : '1') :
137 ((reg73&0x00)==0x00)?(((reg73&0x05)==0x05)?"5":"2"): 129 ((reg73 & 0x30) == 0x10) ? ((reg73 & 0x04) ? '4' : '2') :
138 "X"):"?", 130 ((reg73 & 0x30) == 0x00) ? ((reg73 & 0x04) ? '5' : '2') : '?',
139 (reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO", 131 ( reg73 & 0x02) ? " on" : "off",
140 (reg72&0x40)?( 132 ((reg73 & 0xC0) == 0xC0) ? ((reg73 & 0x08) ? '3' : '0') :
141 ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"): 133 ((reg73 & 0xC0) == 0x80) ? ((reg73 & 0x08) ? '3' : '1') :
142 ((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"): 134 ((reg73 & 0xC0) == 0x40) ? ((reg73 & 0x08) ? '4' : '2') :
143 ((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"): 135 ((reg73 & 0xC0) == 0x00) ? ((reg73 & 0x08) ? '5' : '2') : '?');
144 ((reg73&0x00)==0x00)?(((reg73&0x0A)==0x0A)?"5":"2"): 136 p += sprintf(p, " %s (%c) %s (%c)\n",
145 "X"):"?"); 137 ( reg7b & 0x01) ? " on" : "off",
146 p += sprintf(p, " %s(%s) %s(%s)\n", 138 ((reg7b & 0x30) == 0x30) ? ((reg7b & 0x04) ? '3' : '0') :
147 (reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO", 139 ((reg7b & 0x30) == 0x20) ? ((reg7b & 0x04) ? '3' : '1') :
148 (reg7a&0x20)?( 140 ((reg7b & 0x30) == 0x10) ? ((reg7b & 0x04) ? '4' : '2') :
149 ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"): 141 ((reg7b & 0x30) == 0x00) ? ((reg7b & 0x04) ? '5' : '2') : '?',
150 ((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"): 142 ( reg7b & 0x02) ? " on" : "off",
151 ((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"): 143 ((reg7b & 0xC0) == 0xC0) ? ((reg7b & 0x08) ? '3' : '0') :
152 ((reg7b&0x00)==0x00)?(((reg7b&0x05)==0x05)?"5":"2"): 144 ((reg7b & 0xC0) == 0x80) ? ((reg7b & 0x08) ? '3' : '1') :
153 "X"):"?", 145 ((reg7b & 0xC0) == 0x40) ? ((reg7b & 0x08) ? '4' : '2') :
154 (reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO", 146 ((reg7b & 0xC0) == 0x00) ? ((reg7b & 0x08) ? '5' : '2') : '?');
155 (reg7a&0x40)?( 147 p += sprintf(p, "Interrupt: %s, %s %s, %s\n",
156 ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"): 148 (reg71 & MRDMODE_BLK_CH0 ) ? "blocked" : "enabled",
157 ((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"): 149 (reg50 & CFR_INTR_CH0 ) ? "pending" : "clear ",
158 ((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"): 150 (reg71 & MRDMODE_BLK_CH1 ) ? "blocked" : "enabled",
159 ((reg7b&0x00)==0x00)?(((reg7b&0x0A)==0x0A)?"5":"2"): 151 (reg57 & ARTTIM23_INTR_CH1) ? "pending" : "clear ");
160 "X"):"?" );
161 p += sprintf(p, "PIO Mode: %s %s"
162 " %s %s\n",
163 "?", "?", "?", "?");
164 p += sprintf(p, " %s %s\n",
165 (reg50 & CFR_INTR_CH0) ? "interrupting" : "polling ",
166 (reg57 & ARTTIM23_INTR_CH1) ? "interrupting" : "polling");
167 p += sprintf(p, " %s %s\n",
168 (reg71 & MRDMODE_INTR_CH0) ? "pending" : "clear ",
169 (reg71 & MRDMODE_INTR_CH1) ? "pending" : "clear");
170 p += sprintf(p, " %s %s\n",
171 (reg71 & MRDMODE_BLK_CH0) ? "blocked" : "enabled",
172 (reg71 & MRDMODE_BLK_CH1) ? "blocked" : "enabled");
173 152
174 return (char *)p; 153 return (char *)p;
175} 154}
@@ -179,7 +158,6 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count)
179 char *p = buffer; 158 char *p = buffer;
180 int i; 159 int i;
181 160
182 p += sprintf(p, "\n");
183 for (i = 0; i < n_cmd_devs; i++) { 161 for (i = 0; i < n_cmd_devs; i++) {
184 struct pci_dev *dev = cmd_devs[i]; 162 struct pci_dev *dev = cmd_devs[i];
185 p = print_cmd64x_get_info(p, dev, i); 163 p = print_cmd64x_get_info(p, dev, i);
@@ -195,116 +173,103 @@ static u8 quantize_timing(int timing, int quant)
195} 173}
196 174
197/* 175/*
198 * This routine writes the prepared setup/active/recovery counts 176 * This routine calculates active/recovery counts and then writes them into
199 * for a drive into the cmd646 chipset registers to active them. 177 * the chipset registers.
200 */ 178 */
201static void program_drive_counts (ide_drive_t *drive, int setup_count, int active_count, int recovery_count) 179static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time)
202{ 180{
203 unsigned long flags; 181 struct pci_dev *dev = HWIF(drive)->pci_dev;
204 struct pci_dev *dev = HWIF(drive)->pci_dev; 182 int clock_time = 1000 / system_bus_clock();
205 ide_drive_t *drives = HWIF(drive)->drives; 183 u8 cycle_count, active_count, recovery_count, drwtim;
206 u8 temp_b; 184 static const u8 recovery_values[] =
207 static const u8 setup_counts[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
208 static const u8 recovery_counts[] =
209 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0}; 185 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0};
210 static const u8 arttim_regs[2][2] = { 186 static const u8 drwtim_regs[4] = {DRWTIM0, DRWTIM1, DRWTIM2, DRWTIM3};
211 { ARTTIM0, ARTTIM1 }, 187
212 { ARTTIM23, ARTTIM23 } 188 cmdprintk("program_cycle_times parameters: total=%d, active=%d\n",
213 }; 189 cycle_time, active_time);
214 static const u8 drwtim_regs[2][2] = { 190
215 { DRWTIM0, DRWTIM1 }, 191 cycle_count = quantize_timing( cycle_time, clock_time);
216 { DRWTIM2, DRWTIM3 } 192 active_count = quantize_timing(active_time, clock_time);
217 }; 193 recovery_count = cycle_count - active_count;
218 int channel = (int) HWIF(drive)->channel; 194
219 int slave = (drives != drive); /* Is this really the best way to determine this?? */
220
221 cmdprintk("program_drive_count parameters = s(%d),a(%d),r(%d),p(%d)\n",
222 setup_count, active_count, recovery_count, drive->present);
223 /* 195 /*
224 * Set up address setup count registers. 196 * In case we've got too long recovery phase, try to lengthen
225 * Primary interface has individual count/timing registers for 197 * the active phase
226 * each drive. Secondary interface has one common set of registers,
227 * for address setup so we merge these timings, using the slowest
228 * value.
229 */ 198 */
230 if (channel) { 199 if (recovery_count > 16) {
231 drive->drive_data = setup_count; 200 active_count += recovery_count - 16;
232 setup_count = max(drives[0].drive_data, 201 recovery_count = 16;
233 drives[1].drive_data);
234 cmdprintk("Secondary interface, setup_count = %d\n",
235 setup_count);
236 } 202 }
203 if (active_count > 16) /* shouldn't actually happen... */
204 active_count = 16;
205
206 cmdprintk("Final counts: total=%d, active=%d, recovery=%d\n",
207 cycle_count, active_count, recovery_count);
237 208
238 /* 209 /*
239 * Convert values to internal chipset representation 210 * Convert values to internal chipset representation
240 */ 211 */
241 setup_count = (setup_count > 5) ? 0xc0 : (int) setup_counts[setup_count]; 212 recovery_count = recovery_values[recovery_count];
242 active_count &= 0xf; /* Remember, max value is 16 */ 213 active_count &= 0x0f;
243 recovery_count = (int) recovery_counts[recovery_count];
244 214
245 cmdprintk("Final values = %d,%d,%d\n", 215 /* Program the active/recovery counts into the DRWTIM register */
246 setup_count, active_count, recovery_count); 216 drwtim = (active_count << 4) | recovery_count;
247 217 (void) pci_write_config_byte(dev, drwtim_regs[drive->dn], drwtim);
248 /* 218 cmdprintk("Write 0x%02x to reg 0x%x\n", drwtim, drwtim_regs[drive->dn]);
249 * Now that everything is ready, program the new timings
250 */
251 local_irq_save(flags);
252 /*
253 * Program the address_setup clocks into ARTTIM reg,
254 * and then the active/recovery counts into the DRWTIM reg
255 */
256 (void) pci_read_config_byte(dev, arttim_regs[channel][slave], &temp_b);
257 (void) pci_write_config_byte(dev, arttim_regs[channel][slave],
258 ((u8) setup_count) | (temp_b & 0x3f));
259 (void) pci_write_config_byte(dev, drwtim_regs[channel][slave],
260 (u8) ((active_count << 4) | recovery_count));
261 cmdprintk ("Write %x to %x\n",
262 ((u8) setup_count) | (temp_b & 0x3f),
263 arttim_regs[channel][slave]);
264 cmdprintk ("Write %x to %x\n",
265 (u8) ((active_count << 4) | recovery_count),
266 drwtim_regs[channel][slave]);
267 local_irq_restore(flags);
268} 219}
269 220
270/* 221/*
271 * This routine selects drive's best PIO mode, calculates setup/active/recovery 222 * This routine selects drive's best PIO mode and writes into the chipset
272 * counts, and then writes them into the chipset registers. 223 * registers setup/active/recovery timings.
273 */ 224 */
274static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) 225static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted)
275{ 226{
276 int setup_time, active_time, cycle_time; 227 ide_hwif_t *hwif = HWIF(drive);
277 u8 cycle_count, setup_count, active_count, recovery_count; 228 struct pci_dev *dev = hwif->pci_dev;
278 u8 pio_mode;
279 int clock_time = 1000 / system_bus_clock();
280 ide_pio_data_t pio; 229 ide_pio_data_t pio;
281 230 u8 pio_mode, setup_count, arttim = 0;
231 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
232 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23};
282 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); 233 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio);
283 cycle_time = pio.cycle_time;
284 234
285 setup_time = ide_pio_timings[pio_mode].setup_time; 235 cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)%s\n",
286 active_time = ide_pio_timings[pio_mode].active_time; 236 drive->name, mode_wanted, pio_mode, pio.cycle_time,
237 pio.overridden ? " (overriding vendor mode)" : "");
287 238
288 setup_count = quantize_timing( setup_time, clock_time); 239 program_cycle_times(drive, pio.cycle_time,
289 cycle_count = quantize_timing( cycle_time, clock_time); 240 ide_pio_timings[pio_mode].active_time);
290 active_count = quantize_timing(active_time, clock_time);
291 241
292 recovery_count = cycle_count - active_count; 242 setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time,
293 /* program_drive_counts() takes care of zero recovery cycles */ 243 1000 / system_bus_clock());
294 if (recovery_count > 16) { 244
295 active_count += recovery_count - 16; 245 /*
296 recovery_count = 16; 246 * The primary channel has individual address setup timing registers
247 * for each drive and the hardware selects the slowest timing itself.
248 * The secondary channel has one common register and we have to select
249 * the slowest address setup timing ourselves.
250 */
251 if (hwif->channel) {
252 ide_drive_t *drives = hwif->drives;
253
254 drive->drive_data = setup_count;
255 setup_count = max(drives[0].drive_data, drives[1].drive_data);
297 } 256 }
298 if (active_count > 16)
299 active_count = 16; /* maximum allowed by cmd64x */
300 257
301 program_drive_counts (drive, setup_count, active_count, recovery_count); 258 if (setup_count > 5) /* shouldn't actually happen... */
259 setup_count = 5;
260 cmdprintk("Final address setup count: %d\n", setup_count);
302 261
303 cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " 262 /*
304 "clocks=%d/%d/%d\n", 263 * Program the address setup clocks into the ARTTIM registers.
305 drive->name, mode_wanted, pio_mode, cycle_time, 264 * Avoid clearing the secondary channel's interrupt bit.
306 pio.overridden ? " (overriding vendor mode)" : "", 265 */
307 setup_count, active_count, recovery_count); 266 (void) pci_read_config_byte (dev, arttim_regs[drive->dn], &arttim);
267 if (hwif->channel)
268 arttim &= ~ARTTIM23_INTR_CH1;
269 arttim &= ~0xc0;
270 arttim |= setup_values[setup_count];
271 (void) pci_write_config_byte(dev, arttim_regs[drive->dn], arttim);
272 cmdprintk("Write 0x%02x to reg 0x%x\n", arttim, arttim_regs[drive->dn]);
308 273
309 return pio_mode; 274 return pio_mode;
310} 275}
@@ -376,61 +341,64 @@ static u8 cmd64x_ratemask (ide_drive_t *drive)
376 return mode; 341 return mode;
377} 342}
378 343
379static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) 344static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed)
380{ 345{
381 ide_hwif_t *hwif = HWIF(drive); 346 ide_hwif_t *hwif = HWIF(drive);
382 struct pci_dev *dev = hwif->pci_dev; 347 struct pci_dev *dev = hwif->pci_dev;
348 u8 unit = drive->dn & 0x01;
349 u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0;
383 350
384 u8 unit = (drive->select.b.unit & 0x01); 351 speed = ide_rate_filter(cmd64x_ratemask(drive), speed);
385 u8 regU = 0, pciU = (hwif->channel) ? UDIDETCR1 : UDIDETCR0;
386 u8 regD = 0, pciD = (hwif->channel) ? BMIDESR1 : BMIDESR0;
387
388 u8 speed = ide_rate_filter(cmd64x_ratemask(drive), xferspeed);
389 352
390 if (speed >= XFER_SW_DMA_0) { 353 if (speed >= XFER_SW_DMA_0) {
391 (void) pci_read_config_byte(dev, pciD, &regD);
392 (void) pci_read_config_byte(dev, pciU, &regU); 354 (void) pci_read_config_byte(dev, pciU, &regU);
393 regD &= ~(unit ? 0x40 : 0x20);
394 regU &= ~(unit ? 0xCA : 0x35); 355 regU &= ~(unit ? 0xCA : 0x35);
395 (void) pci_write_config_byte(dev, pciD, regD);
396 (void) pci_write_config_byte(dev, pciU, regU);
397 (void) pci_read_config_byte(dev, pciD, &regD);
398 (void) pci_read_config_byte(dev, pciU, &regU);
399 } 356 }
400 357
401 switch(speed) { 358 switch(speed) {
402 case XFER_UDMA_5: regU |= (unit ? 0x0A : 0x05); break; 359 case XFER_UDMA_5:
403 case XFER_UDMA_4: regU |= (unit ? 0x4A : 0x15); break; 360 regU |= unit ? 0x0A : 0x05;
404 case XFER_UDMA_3: regU |= (unit ? 0x8A : 0x25); break; 361 break;
405 case XFER_UDMA_2: regU |= (unit ? 0x42 : 0x11); break; 362 case XFER_UDMA_4:
406 case XFER_UDMA_1: regU |= (unit ? 0x82 : 0x21); break; 363 regU |= unit ? 0x4A : 0x15;
407 case XFER_UDMA_0: regU |= (unit ? 0xC2 : 0x31); break; 364 break;
408 case XFER_MW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; 365 case XFER_UDMA_3:
409 case XFER_MW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; 366 regU |= unit ? 0x8A : 0x25;
410 case XFER_MW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; 367 break;
411 case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; 368 case XFER_UDMA_2:
412 case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; 369 regU |= unit ? 0x42 : 0x11;
413 case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; 370 break;
414 case XFER_PIO_5: 371 case XFER_UDMA_1:
415 case XFER_PIO_4: 372 regU |= unit ? 0x82 : 0x21;
416 case XFER_PIO_3: 373 break;
417 case XFER_PIO_2: 374 case XFER_UDMA_0:
418 case XFER_PIO_1: 375 regU |= unit ? 0xC2 : 0x31;
419 case XFER_PIO_0: 376 break;
420 (void) cmd64x_tune_pio(drive, speed - XFER_PIO_0); 377 case XFER_MW_DMA_2:
421 break; 378 program_cycle_times(drive, 120, 70);
422 379 break;
423 default: 380 case XFER_MW_DMA_1:
424 return 1; 381 program_cycle_times(drive, 150, 80);
382 break;
383 case XFER_MW_DMA_0:
384 program_cycle_times(drive, 480, 215);
385 break;
386 case XFER_PIO_5:
387 case XFER_PIO_4:
388 case XFER_PIO_3:
389 case XFER_PIO_2:
390 case XFER_PIO_1:
391 case XFER_PIO_0:
392 (void) cmd64x_tune_pio(drive, speed - XFER_PIO_0);
393 break;
394 default:
395 return 1;
425 } 396 }
426 397
427 if (speed >= XFER_SW_DMA_0) { 398 if (speed >= XFER_SW_DMA_0)
428 (void) pci_write_config_byte(dev, pciU, regU); 399 (void) pci_write_config_byte(dev, pciU, regU);
429 regD |= (unit ? 0x40 : 0x20);
430 (void) pci_write_config_byte(dev, pciD, regD);
431 }
432 400
433 return (ide_config_drive_speed(drive, speed)); 401 return ide_config_drive_speed(drive, speed);
434} 402}
435 403
436static int config_chipset_for_dma (ide_drive_t *drive) 404static int config_chipset_for_dma (ide_drive_t *drive)
@@ -457,67 +425,80 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
457 return -1; 425 return -1;
458} 426}
459 427
460static int cmd64x_alt_dma_status (struct pci_dev *dev) 428static int cmd648_ide_dma_end (ide_drive_t *drive)
461{ 429{
462 switch(dev->device) { 430 ide_hwif_t *hwif = HWIF(drive);
463 case PCI_DEVICE_ID_CMD_648: 431 int err = __ide_dma_end(drive);
464 case PCI_DEVICE_ID_CMD_649: 432 u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
465 return 1; 433 MRDMODE_INTR_CH0;
466 default: 434 u8 mrdmode = inb(hwif->dma_master + 0x01);
467 break; 435
468 } 436 /* clear the interrupt bit */
469 return 0; 437 outb(mrdmode | irq_mask, hwif->dma_master + 0x01);
438
439 return err;
470} 440}
471 441
472static int cmd64x_ide_dma_end (ide_drive_t *drive) 442static int cmd64x_ide_dma_end (ide_drive_t *drive)
473{ 443{
474 u8 dma_stat = 0, dma_cmd = 0;
475 ide_hwif_t *hwif = HWIF(drive); 444 ide_hwif_t *hwif = HWIF(drive);
476 struct pci_dev *dev = hwif->pci_dev; 445 struct pci_dev *dev = hwif->pci_dev;
446 int irq_reg = hwif->channel ? ARTTIM23 : CFR;
447 u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
448 CFR_INTR_CH0;
449 u8 irq_stat = 0;
450 int err = __ide_dma_end(drive);
477 451
478 drive->waiting_for_dma = 0; 452 (void) pci_read_config_byte(dev, irq_reg, &irq_stat);
479 /* read DMA command state */ 453 /* clear the interrupt bit */
480 dma_cmd = inb(hwif->dma_command); 454 (void) pci_write_config_byte(dev, irq_reg, irq_stat | irq_mask);
481 /* stop DMA */ 455
482 outb(dma_cmd & ~1, hwif->dma_command); 456 return err;
483 /* get DMA status */ 457}
484 dma_stat = inb(hwif->dma_status); 458
485 /* clear the INTR & ERROR bits */ 459static int cmd648_ide_dma_test_irq (ide_drive_t *drive)
486 outb(dma_stat | 6, hwif->dma_status); 460{
487 if (cmd64x_alt_dma_status(dev)) { 461 ide_hwif_t *hwif = HWIF(drive);
488 u8 dma_intr = 0; 462 u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
489 u8 dma_mask = (hwif->channel) ? ARTTIM23_INTR_CH1 : 463 MRDMODE_INTR_CH0;
490 CFR_INTR_CH0; 464 u8 dma_stat = inb(hwif->dma_status);
491 u8 dma_reg = (hwif->channel) ? ARTTIM2 : CFR; 465 u8 mrdmode = inb(hwif->dma_master + 0x01);
492 (void) pci_read_config_byte(dev, dma_reg, &dma_intr); 466
493 /* clear the INTR bit */ 467#ifdef DEBUG
494 (void) pci_write_config_byte(dev, dma_reg, dma_intr|dma_mask); 468 printk("%s: dma_stat: 0x%02x mrdmode: 0x%02x irq_mask: 0x%02x\n",
495 } 469 drive->name, dma_stat, mrdmode, irq_mask);
496 /* purge DMA mappings */ 470#endif
497 ide_destroy_dmatable(drive); 471 if (!(mrdmode & irq_mask))
498 /* verify good DMA status */ 472 return 0;
499 return (dma_stat & 7) != 4; 473
474 /* return 1 if INTR asserted */
475 if (dma_stat & 4)
476 return 1;
477
478 return 0;
500} 479}
501 480
502static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) 481static int cmd64x_ide_dma_test_irq (ide_drive_t *drive)
503{ 482{
504 ide_hwif_t *hwif = HWIF(drive); 483 ide_hwif_t *hwif = HWIF(drive);
505 struct pci_dev *dev = hwif->pci_dev; 484 struct pci_dev *dev = hwif->pci_dev;
506 u8 dma_alt_stat = 0, mask = (hwif->channel) ? MRDMODE_INTR_CH1 : 485 int irq_reg = hwif->channel ? ARTTIM23 : CFR;
507 MRDMODE_INTR_CH0; 486 u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
508 u8 dma_stat = inb(hwif->dma_status); 487 CFR_INTR_CH0;
488 u8 dma_stat = inb(hwif->dma_status);
489 u8 irq_stat = 0;
490
491 (void) pci_read_config_byte(dev, irq_reg, &irq_stat);
509 492
510 (void) pci_read_config_byte(dev, MRDMODE, &dma_alt_stat);
511#ifdef DEBUG 493#ifdef DEBUG
512 printk("%s: dma_stat: 0x%02x dma_alt_stat: " 494 printk("%s: dma_stat: 0x%02x irq_stat: 0x%02x irq_mask: 0x%02x\n",
513 "0x%02x mask: 0x%02x\n", drive->name, 495 drive->name, dma_stat, irq_stat, irq_mask);
514 dma_stat, dma_alt_stat, mask);
515#endif 496#endif
516 if (!(dma_alt_stat & mask)) 497 if (!(irq_stat & irq_mask))
517 return 0; 498 return 0;
518 499
519 /* return 1 if INTR asserted */ 500 /* return 1 if INTR asserted */
520 if ((dma_stat & 4) == 4) 501 if (dma_stat & 4)
521 return 1; 502 return 1;
522 503
523 return 0; 504 return 0;
@@ -665,7 +646,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
665 646
666 hwif->ultra_mask = 0x3f; 647 hwif->ultra_mask = 0x3f;
667 hwif->mwdma_mask = 0x07; 648 hwif->mwdma_mask = 0x07;
668 hwif->swdma_mask = 0x07;
669 649
670 if (dev->device == PCI_DEVICE_ID_CMD_643) 650 if (dev->device == PCI_DEVICE_ID_CMD_643)
671 hwif->ultra_mask = 0x80; 651 hwif->ultra_mask = 0x80;
@@ -678,17 +658,25 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
678 if (!(hwif->udma_four)) 658 if (!(hwif->udma_four))
679 hwif->udma_four = ata66_cmd64x(hwif); 659 hwif->udma_four = ata66_cmd64x(hwif);
680 660
681 if (dev->device == PCI_DEVICE_ID_CMD_646) { 661 switch(dev->device) {
662 case PCI_DEVICE_ID_CMD_648:
663 case PCI_DEVICE_ID_CMD_649:
664 alt_irq_bits:
665 hwif->ide_dma_end = &cmd648_ide_dma_end;
666 hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq;
667 break;
668 case PCI_DEVICE_ID_CMD_646:
682 hwif->chipset = ide_cmd646; 669 hwif->chipset = ide_cmd646;
683 if (class_rev == 0x01) { 670 if (class_rev == 0x01) {
684 hwif->ide_dma_end = &cmd646_1_ide_dma_end; 671 hwif->ide_dma_end = &cmd646_1_ide_dma_end;
685 } else { 672 break;
686 hwif->ide_dma_end = &cmd64x_ide_dma_end; 673 } else if (class_rev >= 0x03)
687 hwif->ide_dma_test_irq = &cmd64x_ide_dma_test_irq; 674 goto alt_irq_bits;
688 } 675 /* fall thru */
689 } else { 676 default:
690 hwif->ide_dma_end = &cmd64x_ide_dma_end; 677 hwif->ide_dma_end = &cmd64x_ide_dma_end;
691 hwif->ide_dma_test_irq = &cmd64x_ide_dma_test_irq; 678 hwif->ide_dma_test_irq = &cmd64x_ide_dma_test_irq;
679 break;
692 } 680 }
693 681
694 682
@@ -698,42 +686,75 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
698 hwif->drives[1].autodma = hwif->autodma; 686 hwif->drives[1].autodma = hwif->autodma;
699} 687}
700 688
689static int __devinit init_setup_cmd64x(struct pci_dev *dev, ide_pci_device_t *d)
690{
691 return ide_setup_pci_device(dev, d);
692}
693
694static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d)
695{
696 u8 rev = 0;
697
698 /*
699 * The original PCI0646 didn't have the primary channel enable bit,
700 * it appeared starting with PCI0646U (i.e. revision ID 3).
701 */
702 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
703 if (rev < 3)
704 d->enablebits[0].reg = 0;
705
706 return ide_setup_pci_device(dev, d);
707}
708
701static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { 709static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
702 { /* 0 */ 710 { /* 0 */
703 .name = "CMD643", 711 .name = "CMD643",
712 .init_setup = init_setup_cmd64x,
704 .init_chipset = init_chipset_cmd64x, 713 .init_chipset = init_chipset_cmd64x,
705 .init_hwif = init_hwif_cmd64x, 714 .init_hwif = init_hwif_cmd64x,
706 .channels = 2, 715 .channels = 2,
707 .autodma = AUTODMA, 716 .autodma = AUTODMA,
717 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
708 .bootable = ON_BOARD, 718 .bootable = ON_BOARD,
709 },{ /* 1 */ 719 },{ /* 1 */
710 .name = "CMD646", 720 .name = "CMD646",
721 .init_setup = init_setup_cmd646,
711 .init_chipset = init_chipset_cmd64x, 722 .init_chipset = init_chipset_cmd64x,
712 .init_hwif = init_hwif_cmd64x, 723 .init_hwif = init_hwif_cmd64x,
713 .channels = 2, 724 .channels = 2,
714 .autodma = AUTODMA, 725 .autodma = AUTODMA,
715 .enablebits = {{0x00,0x00,0x00}, {0x51,0x80,0x80}}, 726 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
716 .bootable = ON_BOARD, 727 .bootable = ON_BOARD,
717 },{ /* 2 */ 728 },{ /* 2 */
718 .name = "CMD648", 729 .name = "CMD648",
730 .init_setup = init_setup_cmd64x,
719 .init_chipset = init_chipset_cmd64x, 731 .init_chipset = init_chipset_cmd64x,
720 .init_hwif = init_hwif_cmd64x, 732 .init_hwif = init_hwif_cmd64x,
721 .channels = 2, 733 .channels = 2,
722 .autodma = AUTODMA, 734 .autodma = AUTODMA,
735 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
723 .bootable = ON_BOARD, 736 .bootable = ON_BOARD,
724 },{ /* 3 */ 737 },{ /* 3 */
725 .name = "CMD649", 738 .name = "CMD649",
739 .init_setup = init_setup_cmd64x,
726 .init_chipset = init_chipset_cmd64x, 740 .init_chipset = init_chipset_cmd64x,
727 .init_hwif = init_hwif_cmd64x, 741 .init_hwif = init_hwif_cmd64x,
728 .channels = 2, 742 .channels = 2,
729 .autodma = AUTODMA, 743 .autodma = AUTODMA,
744 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
730 .bootable = ON_BOARD, 745 .bootable = ON_BOARD,
731 } 746 }
732}; 747};
733 748
749/*
750 * We may have to modify enablebits for PCI0646, so we'd better pass
751 * a local copy of the ide_pci_device_t structure down the call chain...
752 */
734static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 753static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
735{ 754{
736 return ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]); 755 ide_pci_device_t d = cmd64x_chipsets[id->driver_data];
756
757 return d.init_setup(dev, &d);
737} 758}
738 759
739static struct pci_device_id cmd64x_pci_tbl[] = { 760static struct pci_device_id cmd64x_pci_tbl[] = {
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index ab6fa271aeb3..cf9d344d19f8 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.02 Apr 18, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.03 May 4, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -1527,7 +1527,12 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1527 if (rev > 2) 1527 if (rev > 2)
1528 goto init_single; 1528 goto init_single;
1529 1529
1530 /*
1531 * HPT36x chips are single channel and
1532 * do not seem to have the channel enable bit...
1533 */
1530 d->channels = 1; 1534 d->channels = 1;
1535 d->enablebits[0].reg = 0;
1531 1536
1532 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) { 1537 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) {
1533 u8 pin1 = 0, pin2 = 0; 1538 u8 pin1 = 0, pin2 = 0;
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index a132767f7d90..4e1254813ee0 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -1,8 +1,9 @@
1 1
2/* 2/*
3 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 3 * linux/drivers/ide/pci/it821x.c Version 0.10 Mar 10 2007
4 * 4 *
5 * Copyright (C) 2004 Red Hat <alan@redhat.com> 5 * Copyright (C) 2004 Red Hat <alan@redhat.com>
6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
6 * 7 *
7 * May be copied or modified under the terms of the GNU General Public License 8 * May be copied or modified under the terms of the GNU General Public License
8 * Based in part on the ITE vendor provided SCSI driver. 9 * Based in part on the ITE vendor provided SCSI driver.
@@ -104,6 +105,7 @@ static int it8212_noraid;
104/** 105/**
105 * it821x_program - program the PIO/MWDMA registers 106 * it821x_program - program the PIO/MWDMA registers
106 * @drive: drive to tune 107 * @drive: drive to tune
108 * @timing: timing info
107 * 109 *
108 * Program the PIO/MWDMA timing for this channel according to the 110 * Program the PIO/MWDMA timing for this channel according to the
109 * current clock. 111 * current clock.
@@ -127,6 +129,7 @@ static void it821x_program(ide_drive_t *drive, u16 timing)
127/** 129/**
128 * it821x_program_udma - program the UDMA registers 130 * it821x_program_udma - program the UDMA registers
129 * @drive: drive to tune 131 * @drive: drive to tune
132 * @timing: timing info
130 * 133 *
131 * Program the UDMA timing for this drive according to the 134 * Program the UDMA timing for this drive according to the
132 * current clock. 135 * current clock.
@@ -153,10 +156,9 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing)
153 } 156 }
154} 157}
155 158
156
157/** 159/**
158 * it821x_clock_strategy 160 * it821x_clock_strategy
159 * @hwif: hardware interface 161 * @drive: drive to set up
160 * 162 *
161 * Select between the 50 and 66Mhz base clocks to get the best 163 * Select between the 50 and 66Mhz base clocks to get the best
162 * results for this interface. 164 * results for this interface.
@@ -182,8 +184,11 @@ static void it821x_clock_strategy(ide_drive_t *drive)
182 altclock = itdev->want[0][1]; 184 altclock = itdev->want[0][1];
183 } 185 }
184 186
185 /* Master doesn't care does the slave ? */ 187 /*
186 if(clock == ATA_ANY) 188 * if both clocks can be used for the mode with the higher priority
189 * use the clock needed by the mode with the lower priority
190 */
191 if (clock == ATA_ANY)
187 clock = altclock; 192 clock = altclock;
188 193
189 /* Nobody cares - keep the same clock */ 194 /* Nobody cares - keep the same clock */
@@ -240,37 +245,56 @@ static u8 it821x_ratemask (ide_drive_t *drive)
240} 245}
241 246
242/** 247/**
243 * it821x_tuneproc - tune a drive 248 * it821x_tunepio - tune a drive
244 * @drive: drive to tune 249 * @drive: drive to tune
245 * @mode_wanted: the target operating mode 250 * @pio: the desired PIO mode
246 *
247 * Load the timing settings for this device mode into the
248 * controller. By the time we are called the mode has been
249 * modified as neccessary to handle the absence of seperate
250 * master/slave timers for MWDMA/PIO.
251 * 251 *
252 * This code is only used in pass through mode. 252 * Try to tune the drive/host to the desired PIO mode taking into
253 * the consideration the maximum PIO mode supported by the other
254 * device on the cable.
253 */ 255 */
254 256
255static void it821x_tuneproc (ide_drive_t *drive, byte mode_wanted) 257static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
256{ 258{
257 ide_hwif_t *hwif = drive->hwif; 259 ide_hwif_t *hwif = drive->hwif;
258 struct it821x_dev *itdev = ide_get_hwifdata(hwif); 260 struct it821x_dev *itdev = ide_get_hwifdata(hwif);
259 int unit = drive->select.b.unit; 261 int unit = drive->select.b.unit;
262 ide_drive_t *pair = &hwif->drives[1 - unit];
260 263
261 /* Spec says 89 ref driver uses 88 */ 264 /* Spec says 89 ref driver uses 88 */
262 static u16 pio[] = { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 }; 265 static u16 pio[] = { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 };
263 static u8 pio_want[] = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY }; 266 static u8 pio_want[] = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY };
264 267
265 if(itdev->smart) 268 /*
266 return; 269 * Compute the best PIO mode we can for a given device. We must
270 * pick a speed that does not cause problems with the other device
271 * on the cable.
272 */
273 if (pair) {
274 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL);
275 /* trim PIO to the slowest of the master/slave */
276 if (pair_pio < set_pio)
277 set_pio = pair_pio;
278 }
279
280 if (itdev->smart)
281 goto set_drive_speed;
267 282
268 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ 283 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
269 itdev->want[unit][1] = pio_want[mode_wanted]; 284 itdev->want[unit][1] = pio_want[set_pio];
270 itdev->want[unit][0] = 1; /* PIO is lowest priority */ 285 itdev->want[unit][0] = 1; /* PIO is lowest priority */
271 itdev->pio[unit] = pio[mode_wanted]; 286 itdev->pio[unit] = pio[set_pio];
272 it821x_clock_strategy(drive); 287 it821x_clock_strategy(drive);
273 it821x_program(drive, itdev->pio[unit]); 288 it821x_program(drive, itdev->pio[unit]);
289
290set_drive_speed:
291 return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
292}
293
294static void it821x_tuneproc(ide_drive_t *drive, u8 pio)
295{
296 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
297 (void)it821x_tunepio(drive, pio);
274} 298}
275 299
276/** 300/**
@@ -354,40 +378,6 @@ static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted)
354} 378}
355 379
356/** 380/**
357 * config_it821x_chipset_for_pio - set drive timings
358 * @drive: drive to tune
359 * @speed we want
360 *
361 * Compute the best pio mode we can for a given device. We must
362 * pick a speed that does not cause problems with the other device
363 * on the cable.
364 */
365
366static void config_it821x_chipset_for_pio (ide_drive_t *drive, byte set_speed)
367{
368 u8 unit = drive->select.b.unit;
369 ide_hwif_t *hwif = drive->hwif;
370 ide_drive_t *pair = &hwif->drives[1-unit];
371 u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 255, 5, NULL);
372 u8 pair_pio;
373
374 /* We have to deal with this mess in pairs */
375 if(pair != NULL) {
376 pair_pio = ide_get_best_pio_mode(pair, 255, 5, NULL);
377 /* Trim PIO to the slowest of the master/slave */
378 if(pair_pio < set_pio)
379 set_pio = pair_pio;
380 }
381 it821x_tuneproc(drive, set_pio);
382 speed = XFER_PIO_0 + set_pio;
383 /* XXX - We trim to the lowest of the pair so the other drive
384 will always be fine at this point until we do hotplug passthru */
385
386 if (set_speed)
387 (void) ide_config_drive_speed(drive, speed);
388}
389
390/**
391 * it821x_dma_read - DMA hook 381 * it821x_dma_read - DMA hook
392 * @drive: drive for DMA 382 * @drive: drive for DMA
393 * 383 *
@@ -450,15 +440,17 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
450 struct it821x_dev *itdev = ide_get_hwifdata(hwif); 440 struct it821x_dev *itdev = ide_get_hwifdata(hwif);
451 u8 speed = ide_rate_filter(it821x_ratemask(drive), xferspeed); 441 u8 speed = ide_rate_filter(it821x_ratemask(drive), xferspeed);
452 442
453 if(!itdev->smart) { 443 switch (speed) {
454 switch(speed) { 444 case XFER_PIO_4:
455 case XFER_PIO_4: 445 case XFER_PIO_3:
456 case XFER_PIO_3: 446 case XFER_PIO_2:
457 case XFER_PIO_2: 447 case XFER_PIO_1:
458 case XFER_PIO_1: 448 case XFER_PIO_0:
459 case XFER_PIO_0: 449 return it821x_tunepio(drive, speed - XFER_PIO_0);
460 it821x_tuneproc(drive, (speed - XFER_PIO_0)); 450 }
461 break; 451
452 if (itdev->smart == 0) {
453 switch (speed) {
462 /* MWDMA tuning is really hard because our MWDMA and PIO 454 /* MWDMA tuning is really hard because our MWDMA and PIO
463 timings are kept in the same place. We can switch in the 455 timings are kept in the same place. We can switch in the
464 host dma on/off callbacks */ 456 host dma on/off callbacks */
@@ -498,14 +490,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)
498{ 490{
499 u8 speed = ide_dma_speed(drive, it821x_ratemask(drive)); 491 u8 speed = ide_dma_speed(drive, it821x_ratemask(drive));
500 492
501 if (speed) { 493 if (speed == 0)
502 config_it821x_chipset_for_pio(drive, 0); 494 return 0;
503 it821x_tune_chipset(drive, speed);
504 495
505 return ide_dma_enable(drive); 496 it821x_tune_chipset(drive, speed);
506 }
507 497
508 return 0; 498 return ide_dma_enable(drive);
509} 499}
510 500
511/** 501/**
@@ -523,7 +513,7 @@ static int it821x_config_drive_for_dma (ide_drive_t *drive)
523 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 513 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
524 return 0; 514 return 0;
525 515
526 config_it821x_chipset_for_pio(drive, 1); 516 it821x_tuneproc(drive, 255);
527 517
528 return -1; 518 return -1;
529} 519}
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index ae20fb3f6cbc..2cdd629c653d 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -255,9 +255,6 @@ static int config_chipset_for_dma(ide_drive_t *drive)
255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); 255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
256 } 256 }
257 257
258 if (drive->media != ide_disk && drive->media != ide_cdrom)
259 return 0;
260
261 if (id->capability & 4) { 258 if (id->capability & 4) {
262 /* 259 /*
263 * Set IORDY_EN & PREFETCH_EN (this seems to have 260 * Set IORDY_EN & PREFETCH_EN (this seems to have
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 71eccdf5f817..c0188de3cc66 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.11 Jan 27, 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.12 Mar 10 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -287,11 +287,6 @@ static void config_siimage_chipset_for_pio (ide_drive_t *drive, byte set_speed)
287 (void) ide_config_drive_speed(drive, speed); 287 (void) ide_config_drive_speed(drive, speed);
288} 288}
289 289
290static void config_chipset_for_pio (ide_drive_t *drive, byte set_speed)
291{
292 config_siimage_chipset_for_pio(drive, set_speed);
293}
294
295/** 290/**
296 * siimage_tune_chipset - set controller timings 291 * siimage_tune_chipset - set controller timings
297 * @drive: Drive to set up 292 * @drive: Drive to set up
@@ -396,8 +391,6 @@ static int config_chipset_for_dma (ide_drive_t *drive)
396{ 391{
397 u8 speed = ide_dma_speed(drive, siimage_ratemask(drive)); 392 u8 speed = ide_dma_speed(drive, siimage_ratemask(drive));
398 393
399 config_chipset_for_pio(drive, !speed);
400
401 if (!speed) 394 if (!speed)
402 return 0; 395 return 0;
403 396
@@ -423,7 +416,7 @@ static int siimage_config_drive_for_dma (ide_drive_t *drive)
423 return 0; 416 return 0;
424 417
425 if (ide_use_fast_pio(drive)) 418 if (ide_use_fast_pio(drive))
426 config_chipset_for_pio(drive, 1); 419 config_siimage_chipset_for_pio(drive, 1);
427 420
428 return -1; 421 return -1;
429} 422}
@@ -1015,7 +1008,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
1015 1008
1016 hwif->ultra_mask = 0x7f; 1009 hwif->ultra_mask = 0x7f;
1017 hwif->mwdma_mask = 0x07; 1010 hwif->mwdma_mask = 0x07;
1018 hwif->swdma_mask = 0x07;
1019 1011
1020 if (!is_sata(hwif)) 1012 if (!is_sata(hwif))
1021 hwif->atapi_dma = 1; 1013 hwif->atapi_dma = 1;
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 3a8a76fc78c7..fe3b4b91f854 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -11,6 +11,8 @@
11 * Merge in Russell's HW workarounds, fix various problems 11 * Merge in Russell's HW workarounds, fix various problems
12 * with the timing registers setup. 12 * with the timing registers setup.
13 * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org 13 * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org
14 *
15 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
14 */ 16 */
15 17
16#include <linux/types.h> 18#include <linux/types.h>
@@ -47,25 +49,19 @@
47#define CTRL_P0EN (1 << 0) 49#define CTRL_P0EN (1 << 0)
48 50
49/* 51/*
50 * Convert a PIO mode and cycle time to the required on/off 52 * Convert a PIO mode and cycle time to the required on/off times
51 * times for the interface. This has protection against run-away 53 * for the interface. This has protection against runaway timings.
52 * timings.
53 */ 54 */
54static unsigned int get_timing_sl82c105(ide_pio_data_t *p) 55static unsigned int get_pio_timings(ide_pio_data_t *p)
55{ 56{
56 unsigned int cmd_on; 57 unsigned int cmd_on, cmd_off;
57 unsigned int cmd_off;
58 58
59 cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; 59 cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30;
60 cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; 60 cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30;
61 61
62 if (cmd_on > 32)
63 cmd_on = 32;
64 if (cmd_on == 0) 62 if (cmd_on == 0)
65 cmd_on = 1; 63 cmd_on = 1;
66 64
67 if (cmd_off > 32)
68 cmd_off = 32;
69 if (cmd_off == 0) 65 if (cmd_off == 0)
70 cmd_off = 1; 66 cmd_off = 1;
71 67
@@ -73,100 +69,59 @@ static unsigned int get_timing_sl82c105(ide_pio_data_t *p)
73} 69}
74 70
75/* 71/*
76 * Configure the drive and chipset for PIO 72 * Configure the chipset for PIO mode.
77 */ 73 */
78static void config_for_pio(ide_drive_t *drive, int pio, int report, int chipset_only) 74static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
79{ 75{
80 ide_hwif_t *hwif = HWIF(drive); 76 struct pci_dev *dev = HWIF(drive)->pci_dev;
81 struct pci_dev *dev = hwif->pci_dev; 77 int reg = 0x44 + drive->dn * 4;
82 ide_pio_data_t p; 78 ide_pio_data_t p;
83 u16 drv_ctrl = 0x909; 79 u16 drv_ctrl;
84 unsigned int xfer_mode, reg;
85 80
86 DBG(("config_for_pio(drive:%s, pio:%d, report:%d, chipset_only:%d)\n", 81 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio));
87 drive->name, pio, report, chipset_only));
88
89 reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
90 82
91 pio = ide_get_best_pio_mode(drive, pio, 5, &p); 83 pio = ide_get_best_pio_mode(drive, pio, 5, &p);
92 84
93 xfer_mode = XFER_PIO_0 + pio; 85 drive->drive_data = drv_ctrl = get_pio_timings(&p);
94
95 if (chipset_only || ide_config_drive_speed(drive, xfer_mode) == 0) {
96 drv_ctrl = get_timing_sl82c105(&p);
97 drive->pio_speed = xfer_mode;
98 } else
99 drive->pio_speed = XFER_PIO_0;
100 86
101 if (drive->using_dma == 0) { 87 if (!drive->using_dma) {
102 /* 88 /*
103 * If we are actually using MW DMA, then we can not 89 * If we are actually using MW DMA, then we can not
104 * reprogram the interface drive control register. 90 * reprogram the interface drive control register.
105 */ 91 */
106 pci_write_config_word(dev, reg, drv_ctrl); 92 pci_write_config_word(dev, reg, drv_ctrl);
107 pci_read_config_word(dev, reg, &drv_ctrl); 93 pci_read_config_word (dev, reg, &drv_ctrl);
108
109 if (report) {
110 printk("%s: selected %s (%dns) (%04X)\n", drive->name,
111 ide_xfer_verbose(xfer_mode), p.cycle_time, drv_ctrl);
112 }
113 } 94 }
95
96 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name,
97 ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl);
98
99 return pio;
114} 100}
115 101
116/* 102/*
117 * Configure the drive and the chipset for DMA 103 * Configure the drive for DMA.
104 * We'll program the chipset only when DMA is actually turned on.
118 */ 105 */
119static int config_for_dma (ide_drive_t *drive) 106static int config_for_dma(ide_drive_t *drive)
120{ 107{
121 ide_hwif_t *hwif = HWIF(drive);
122 struct pci_dev *dev = hwif->pci_dev;
123 unsigned int reg;
124
125 DBG(("config_for_dma(drive:%s)\n", drive->name)); 108 DBG(("config_for_dma(drive:%s)\n", drive->name));
126 109
127 reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
128
129 if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) 110 if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0)
130 return 1; 111 return 0;
131 112
132 pci_write_config_word(dev, reg, 0x0240); 113 return ide_dma_enable(drive);
133
134 return 0;
135} 114}
136 115
137/* 116/*
138 * Check to see if the drive and 117 * Check to see if the drive and chipset are capable of DMA mode.
139 * chipset is capable of DMA mode
140 */ 118 */
141 119static int sl82c105_ide_dma_check(ide_drive_t *drive)
142static int sl82c105_check_drive (ide_drive_t *drive)
143{ 120{
144 ide_hwif_t *hwif = HWIF(drive); 121 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name));
145
146 DBG(("sl82c105_check_drive(drive:%s)\n", drive->name));
147
148 do {
149 struct hd_driveid *id = drive->id;
150
151 if (!drive->autodma)
152 break;
153
154 if (!id || !(id->capability & 1))
155 break;
156 122
157 /* Consult the list of known "bad" drives */ 123 if (ide_use_dma(drive) && config_for_dma(drive))
158 if (__ide_dma_bad_drive(drive)) 124 return 0;
159 break;
160
161 if (id->field_valid & 2) {
162 if ((id->dma_mword & hwif->mwdma_mask) ||
163 (id->dma_1word & hwif->swdma_mask))
164 return 0;
165 }
166
167 if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)
168 return 0;
169 } while (0);
170 125
171 return -1; 126 return -1;
172} 127}
@@ -195,14 +150,14 @@ static inline void sl82c105_reset_host(struct pci_dev *dev)
195 * This function is called when the IDE timer expires, the drive 150 * This function is called when the IDE timer expires, the drive
196 * indicates that it is READY, and we were waiting for DMA to complete. 151 * indicates that it is READY, and we were waiting for DMA to complete.
197 */ 152 */
198static int sl82c105_ide_dma_lost_irq(ide_drive_t *drive) 153static int sl82c105_ide_dma_lostirq(ide_drive_t *drive)
199{ 154{
200 ide_hwif_t *hwif = HWIF(drive); 155 ide_hwif_t *hwif = HWIF(drive);
201 struct pci_dev *dev = hwif->pci_dev; 156 struct pci_dev *dev = hwif->pci_dev;
202 u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; 157 u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA;
203 unsigned long dma_base = hwif->dma_base; 158 u8 dma_cmd;
204 159
205 printk("sl82c105: lost IRQ: resetting host\n"); 160 printk("sl82c105: lost IRQ, resetting host\n");
206 161
207 /* 162 /*
208 * Check the raw interrupt from the drive. 163 * Check the raw interrupt from the drive.
@@ -215,15 +170,15 @@ static int sl82c105_ide_dma_lost_irq(ide_drive_t *drive)
215 * Was DMA enabled? If so, disable it - we're resetting the 170 * Was DMA enabled? If so, disable it - we're resetting the
216 * host. The IDE layer will be handling the drive for us. 171 * host. The IDE layer will be handling the drive for us.
217 */ 172 */
218 val = inb(dma_base); 173 dma_cmd = inb(hwif->dma_command);
219 if (val & 1) { 174 if (dma_cmd & 1) {
220 outb(val & ~1, dma_base); 175 outb(dma_cmd & ~1, hwif->dma_command);
221 printk("sl82c105: DMA was enabled\n"); 176 printk("sl82c105: DMA was enabled\n");
222 } 177 }
223 178
224 sl82c105_reset_host(dev); 179 sl82c105_reset_host(dev);
225 180
226 /* ide_dmaproc would return 1, so we do as well */ 181 /* __ide_dma_lostirq would return 1, so we do as well */
227 return 1; 182 return 1;
228} 183}
229 184
@@ -235,10 +190,10 @@ static int sl82c105_ide_dma_lost_irq(ide_drive_t *drive)
235 * The generic IDE core will have disabled the BMEN bit before this 190 * The generic IDE core will have disabled the BMEN bit before this
236 * function is called. 191 * function is called.
237 */ 192 */
238static void sl82c105_ide_dma_start(ide_drive_t *drive) 193static void sl82c105_dma_start(ide_drive_t *drive)
239{ 194{
240 ide_hwif_t *hwif = HWIF(drive); 195 ide_hwif_t *hwif = HWIF(drive);
241 struct pci_dev *dev = hwif->pci_dev; 196 struct pci_dev *dev = hwif->pci_dev;
242 197
243 sl82c105_reset_host(dev); 198 sl82c105_reset_host(dev);
244 ide_dma_start(drive); 199 ide_dma_start(drive);
@@ -246,8 +201,8 @@ static void sl82c105_ide_dma_start(ide_drive_t *drive)
246 201
247static int sl82c105_ide_dma_timeout(ide_drive_t *drive) 202static int sl82c105_ide_dma_timeout(ide_drive_t *drive)
248{ 203{
249 ide_hwif_t *hwif = HWIF(drive); 204 ide_hwif_t *hwif = HWIF(drive);
250 struct pci_dev *dev = hwif->pci_dev; 205 struct pci_dev *dev = hwif->pci_dev;
251 206
252 DBG(("sl82c105_ide_dma_timeout(drive:%s)\n", drive->name)); 207 DBG(("sl82c105_ide_dma_timeout(drive:%s)\n", drive->name));
253 208
@@ -255,26 +210,32 @@ static int sl82c105_ide_dma_timeout(ide_drive_t *drive)
255 return __ide_dma_timeout(drive); 210 return __ide_dma_timeout(drive);
256} 211}
257 212
258static int sl82c105_ide_dma_on (ide_drive_t *drive) 213static int sl82c105_ide_dma_on(ide_drive_t *drive)
259{ 214{
215 struct pci_dev *dev = HWIF(drive)->pci_dev;
216 int rc, reg = 0x44 + drive->dn * 4;
217
260 DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name)); 218 DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name));
261 219
262 if (config_for_dma(drive)) 220 rc = __ide_dma_on(drive);
263 return 1; 221 if (rc == 0) {
264 printk(KERN_INFO "%s: DMA enabled\n", drive->name); 222 pci_write_config_word(dev, reg, 0x0200);
265 return __ide_dma_on(drive); 223
224 printk(KERN_INFO "%s: DMA enabled\n", drive->name);
225 }
226 return rc;
266} 227}
267 228
268static void sl82c105_dma_off_quietly(ide_drive_t *drive) 229static void sl82c105_dma_off_quietly(ide_drive_t *drive)
269{ 230{
270 u8 speed = XFER_PIO_0; 231 struct pci_dev *dev = HWIF(drive)->pci_dev;
232 int reg = 0x44 + drive->dn * 4;
271 233
272 DBG(("sl82c105_dma_off_quietly(drive:%s)\n", drive->name)); 234 DBG(("sl82c105_dma_off_quietly(drive:%s)\n", drive->name));
273 235
236 pci_write_config_word(dev, reg, drive->drive_data);
237
274 ide_dma_off_quietly(drive); 238 ide_dma_off_quietly(drive);
275 if (drive->pio_speed)
276 speed = drive->pio_speed - XFER_PIO_0;
277 config_for_pio(drive, speed, 0, 1);
278} 239}
279 240
280/* 241/*
@@ -286,8 +247,8 @@ static void sl82c105_dma_off_quietly(ide_drive_t *drive)
286 */ 247 */
287static void sl82c105_selectproc(ide_drive_t *drive) 248static void sl82c105_selectproc(ide_drive_t *drive)
288{ 249{
289 ide_hwif_t *hwif = HWIF(drive); 250 ide_hwif_t *hwif = HWIF(drive);
290 struct pci_dev *dev = hwif->pci_dev; 251 struct pci_dev *dev = hwif->pci_dev;
291 u32 val, old, mask; 252 u32 val, old, mask;
292 253
293 //DBG(("sl82c105_selectproc(drive:%s)\n", drive->name)); 254 //DBG(("sl82c105_selectproc(drive:%s)\n", drive->name));
@@ -323,18 +284,12 @@ static void sl82c105_resetproc(ide_drive_t *drive)
323 * We only deal with PIO mode here - DMA mode 'using_dma' is not 284 * We only deal with PIO mode here - DMA mode 'using_dma' is not
324 * initialised at the point that this function is called. 285 * initialised at the point that this function is called.
325 */ 286 */
326static void tune_sl82c105(ide_drive_t *drive, u8 pio) 287static void sl82c105_tune_drive(ide_drive_t *drive, u8 pio)
327{ 288{
328 DBG(("tune_sl82c105(drive:%s)\n", drive->name)); 289 DBG(("sl82c105_tune_drive(drive:%s, pio:%u)\n", drive->name, pio));
329
330 config_for_pio(drive, pio, 1, 0);
331 290
332 /* 291 pio = sl82c105_tune_pio(drive, pio);
333 * We support 32-bit I/O on this interface, and it 292 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
334 * doesn't have problems with interrupts.
335 */
336 drive->io_32bit = 1;
337 drive->unmask = 1;
338} 293}
339 294
340/* 295/*
@@ -393,7 +348,7 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c
393} 348}
394 349
395/* 350/*
396 * Initialise the chip 351 * Initialise IDE channel
397 */ 352 */
398static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) 353static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
399{ 354{
@@ -401,24 +356,22 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
401 356
402 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); 357 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index));
403 358
404 hwif->tuneproc = tune_sl82c105; 359 hwif->tuneproc = &sl82c105_tune_drive;
405 hwif->selectproc = sl82c105_selectproc; 360 hwif->selectproc = &sl82c105_selectproc;
406 hwif->resetproc = sl82c105_resetproc; 361 hwif->resetproc = &sl82c105_resetproc;
362
363 /*
364 * We support 32-bit I/O on this interface, and
365 * it doesn't have problems with interrupts.
366 */
367 hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1;
368 hwif->drives[0].unmask = hwif->drives[1].unmask = 1;
407 369
408 /* 370 /*
409 * Default to PIO 0 for fallback unless tuned otherwise.
410 * We always autotune PIO, this is done before DMA is checked, 371 * We always autotune PIO, this is done before DMA is checked,
411 * so there's no risk of accidentally disabling DMA 372 * so there's no risk of accidentally disabling DMA
412 */ 373 */
413 hwif->drives[0].pio_speed = XFER_PIO_0; 374 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
414 hwif->drives[0].autotune = 1;
415 hwif->drives[1].pio_speed = XFER_PIO_0;
416 hwif->drives[1].autotune = 1;
417
418 hwif->atapi_dma = 0;
419 hwif->mwdma_mask = 0;
420 hwif->swdma_mask = 0;
421 hwif->autodma = 0;
422 375
423 if (!hwif->dma_base) 376 if (!hwif->dma_base)
424 return; 377 return;
@@ -429,27 +382,27 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
429 * Never ever EVER under any circumstances enable 382 * Never ever EVER under any circumstances enable
430 * DMA when the bridge is this old. 383 * DMA when the bridge is this old.
431 */ 384 */
432 printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", 385 printk(" %s: Winbond W83C553 bridge revision %d, "
433 hwif->name, rev); 386 "BM-DMA disabled\n", hwif->name, rev);
434 } else { 387 return;
435 hwif->atapi_dma = 1;
436 hwif->mwdma_mask = 0x04;
437
438 hwif->ide_dma_check = &sl82c105_check_drive;
439 hwif->ide_dma_on = &sl82c105_ide_dma_on;
440 hwif->dma_off_quietly = &sl82c105_dma_off_quietly;
441 hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
442 hwif->dma_start = &sl82c105_ide_dma_start;
443 hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
444
445 if (!noautodma)
446 hwif->autodma = 1;
447 hwif->drives[0].autodma = hwif->autodma;
448 hwif->drives[1].autodma = hwif->autodma;
449
450 if (hwif->mate)
451 hwif->serialized = hwif->mate->serialized = 1;
452 } 388 }
389
390 hwif->atapi_dma = 1;
391 hwif->mwdma_mask = 0x04;
392
393 hwif->ide_dma_check = &sl82c105_ide_dma_check;
394 hwif->ide_dma_on = &sl82c105_ide_dma_on;
395 hwif->dma_off_quietly = &sl82c105_dma_off_quietly;
396 hwif->ide_dma_lostirq = &sl82c105_ide_dma_lostirq;
397 hwif->dma_start = &sl82c105_dma_start;
398 hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
399
400 if (!noautodma)
401 hwif->autodma = 1;
402 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
403
404 if (hwif->mate)
405 hwif->serialized = hwif->mate->serialized = 1;
453} 406}
454 407
455static ide_pci_device_t sl82c105_chipset __devinitdata = { 408static ide_pci_device_t sl82c105_chipset __devinitdata = {
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
index 6164a9a83396..bd0755c789c5 100644
--- a/drivers/ieee1394/hosts.c
+++ b/drivers/ieee1394/hosts.c
@@ -15,7 +15,6 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pci.h>
19#include <linux/timer.h> 18#include <linux/timer.h>
20#include <linux/jiffies.h> 19#include <linux/jiffies.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 842cd0b53e91..eff591deeb46 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -40,7 +40,6 @@
40#include <linux/err.h> 40#include <linux/err.h>
41#include <linux/idr.h> 41#include <linux/idr.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/pci.h>
44#include <linux/random.h> 43#include <linux/random.h>
45#include <linux/rbtree.h> 44#include <linux/rbtree.h>
46#include <linux/spinlock.h> 45#include <linux/spinlock.h>
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 1d796e7c8199..a06bcc65a871 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -43,6 +43,8 @@
43 43
44#include "core_priv.h" 44#include "core_priv.h"
45 45
46#define PFX "fmr_pool: "
47
46enum { 48enum {
47 IB_FMR_MAX_REMAPS = 32, 49 IB_FMR_MAX_REMAPS = 32,
48 50
@@ -150,7 +152,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
150 152
151#ifdef DEBUG 153#ifdef DEBUG
152 if (fmr->ref_count !=0) { 154 if (fmr->ref_count !=0) {
153 printk(KERN_WARNING "Unmapping FMR 0x%08x with ref count %d", 155 printk(KERN_WARNING PFX "Unmapping FMR 0x%08x with ref count %d",
154 fmr, fmr->ref_count); 156 fmr, fmr->ref_count);
155 } 157 }
156#endif 158#endif
@@ -168,7 +170,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
168 170
169 ret = ib_unmap_fmr(&fmr_list); 171 ret = ib_unmap_fmr(&fmr_list);
170 if (ret) 172 if (ret)
171 printk(KERN_WARNING "ib_unmap_fmr returned %d", ret); 173 printk(KERN_WARNING PFX "ib_unmap_fmr returned %d", ret);
172 174
173 spin_lock_irq(&pool->pool_lock); 175 spin_lock_irq(&pool->pool_lock);
174 list_splice(&unmap_list, &pool->free_list); 176 list_splice(&unmap_list, &pool->free_list);
@@ -226,20 +228,20 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
226 device = pd->device; 228 device = pd->device;
227 if (!device->alloc_fmr || !device->dealloc_fmr || 229 if (!device->alloc_fmr || !device->dealloc_fmr ||
228 !device->map_phys_fmr || !device->unmap_fmr) { 230 !device->map_phys_fmr || !device->unmap_fmr) {
229 printk(KERN_WARNING "Device %s does not support fast memory regions", 231 printk(KERN_INFO PFX "Device %s does not support FMRs\n",
230 device->name); 232 device->name);
231 return ERR_PTR(-ENOSYS); 233 return ERR_PTR(-ENOSYS);
232 } 234 }
233 235
234 attr = kmalloc(sizeof *attr, GFP_KERNEL); 236 attr = kmalloc(sizeof *attr, GFP_KERNEL);
235 if (!attr) { 237 if (!attr) {
236 printk(KERN_WARNING "couldn't allocate device attr struct"); 238 printk(KERN_WARNING PFX "couldn't allocate device attr struct");
237 return ERR_PTR(-ENOMEM); 239 return ERR_PTR(-ENOMEM);
238 } 240 }
239 241
240 ret = ib_query_device(device, attr); 242 ret = ib_query_device(device, attr);
241 if (ret) { 243 if (ret) {
242 printk(KERN_WARNING "couldn't query device"); 244 printk(KERN_WARNING PFX "couldn't query device: %d", ret);
243 kfree(attr); 245 kfree(attr);
244 return ERR_PTR(ret); 246 return ERR_PTR(ret);
245 } 247 }
@@ -253,7 +255,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
253 255
254 pool = kmalloc(sizeof *pool, GFP_KERNEL); 256 pool = kmalloc(sizeof *pool, GFP_KERNEL);
255 if (!pool) { 257 if (!pool) {
256 printk(KERN_WARNING "couldn't allocate pool struct"); 258 printk(KERN_WARNING PFX "couldn't allocate pool struct");
257 return ERR_PTR(-ENOMEM); 259 return ERR_PTR(-ENOMEM);
258 } 260 }
259 261
@@ -270,7 +272,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
270 kmalloc(IB_FMR_HASH_SIZE * sizeof *pool->cache_bucket, 272 kmalloc(IB_FMR_HASH_SIZE * sizeof *pool->cache_bucket,
271 GFP_KERNEL); 273 GFP_KERNEL);
272 if (!pool->cache_bucket) { 274 if (!pool->cache_bucket) {
273 printk(KERN_WARNING "Failed to allocate cache in pool"); 275 printk(KERN_WARNING PFX "Failed to allocate cache in pool");
274 ret = -ENOMEM; 276 ret = -ENOMEM;
275 goto out_free_pool; 277 goto out_free_pool;
276 } 278 }
@@ -294,7 +296,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
294 "ib_fmr(%s)", 296 "ib_fmr(%s)",
295 device->name); 297 device->name);
296 if (IS_ERR(pool->thread)) { 298 if (IS_ERR(pool->thread)) {
297 printk(KERN_WARNING "couldn't start cleanup thread"); 299 printk(KERN_WARNING PFX "couldn't start cleanup thread");
298 ret = PTR_ERR(pool->thread); 300 ret = PTR_ERR(pool->thread);
299 goto out_free_pool; 301 goto out_free_pool;
300 } 302 }
@@ -311,8 +313,8 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
311 fmr = kmalloc(sizeof *fmr + params->max_pages_per_fmr * sizeof (u64), 313 fmr = kmalloc(sizeof *fmr + params->max_pages_per_fmr * sizeof (u64),
312 GFP_KERNEL); 314 GFP_KERNEL);
313 if (!fmr) { 315 if (!fmr) {
314 printk(KERN_WARNING "failed to allocate fmr struct " 316 printk(KERN_WARNING PFX "failed to allocate fmr "
315 "for FMR %d", i); 317 "struct for FMR %d", i);
316 goto out_fail; 318 goto out_fail;
317 } 319 }
318 320
@@ -323,7 +325,8 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
323 325
324 fmr->fmr = ib_alloc_fmr(pd, params->access, &fmr_attr); 326 fmr->fmr = ib_alloc_fmr(pd, params->access, &fmr_attr);
325 if (IS_ERR(fmr->fmr)) { 327 if (IS_ERR(fmr->fmr)) {
326 printk(KERN_WARNING "fmr_create failed for FMR %d", i); 328 printk(KERN_WARNING PFX "fmr_create failed "
329 "for FMR %d", i);
327 kfree(fmr); 330 kfree(fmr);
328 goto out_fail; 331 goto out_fail;
329 } 332 }
@@ -378,7 +381,7 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
378 } 381 }
379 382
380 if (i < pool->pool_size) 383 if (i < pool->pool_size)
381 printk(KERN_WARNING "pool still has %d regions registered", 384 printk(KERN_WARNING PFX "pool still has %d regions registered",
382 pool->pool_size - i); 385 pool->pool_size - i);
383 386
384 kfree(pool->cache_bucket); 387 kfree(pool->cache_bucket);
@@ -463,8 +466,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
463 list_add(&fmr->list, &pool->free_list); 466 list_add(&fmr->list, &pool->free_list);
464 spin_unlock_irqrestore(&pool->pool_lock, flags); 467 spin_unlock_irqrestore(&pool->pool_lock, flags);
465 468
466 printk(KERN_WARNING "fmr_map returns %d\n", 469 printk(KERN_WARNING PFX "fmr_map returns %d\n", result);
467 result);
468 470
469 return ERR_PTR(result); 471 return ERR_PTR(result);
470 } 472 }
@@ -516,7 +518,7 @@ int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr)
516 518
517#ifdef DEBUG 519#ifdef DEBUG
518 if (fmr->ref_count < 0) 520 if (fmr->ref_count < 0)
519 printk(KERN_WARNING "FMR %p has ref count %d < 0", 521 printk(KERN_WARNING PFX "FMR %p has ref count %d < 0",
520 fmr, fmr->ref_count); 522 fmr, fmr->ref_count);
521#endif 523#endif
522 524
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 891d1fa7b2eb..223b1aa7d92b 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -39,7 +39,6 @@
39#include <linux/err.h> 39#include <linux/err.h>
40#include <linux/idr.h> 40#include <linux/idr.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/pci.h>
43#include <linux/rbtree.h> 42#include <linux/rbtree.h>
44#include <linux/spinlock.h> 43#include <linux/spinlock.h>
45#include <linux/workqueue.h> 44#include <linux/workqueue.h>
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 6edfecf1be72..85ccf13b8041 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2771,7 +2771,7 @@ static int ib_mad_port_open(struct ib_device *device,
2771 cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2; 2771 cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2;
2772 port_priv->cq = ib_create_cq(port_priv->device, 2772 port_priv->cq = ib_create_cq(port_priv->device,
2773 ib_mad_thread_completion_handler, 2773 ib_mad_thread_completion_handler,
2774 NULL, port_priv, cq_size); 2774 NULL, port_priv, cq_size, 0);
2775 if (IS_ERR(port_priv->cq)) { 2775 if (IS_ERR(port_priv->cq)) {
2776 printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n"); 2776 printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n");
2777 ret = PTR_ERR(port_priv->cq); 2777 ret = PTR_ERR(port_priv->cq);
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
index de89717f49fe..9be5cc00a3a9 100644
--- a/drivers/infiniband/core/mad_priv.h
+++ b/drivers/infiniband/core/mad_priv.h
@@ -39,7 +39,6 @@
39 39
40#include <linux/completion.h> 40#include <linux/completion.h>
41#include <linux/err.h> 41#include <linux/err.h>
42#include <linux/pci.h>
43#include <linux/workqueue.h> 42#include <linux/workqueue.h>
44#include <rdma/ib_mad.h> 43#include <rdma/ib_mad.h>
45#include <rdma/ib_smi.h> 44#include <rdma/ib_smi.h>
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
index 4a579b3a1c90..1e13ab42b70b 100644
--- a/drivers/infiniband/core/multicast.c
+++ b/drivers/infiniband/core/multicast.c
@@ -34,7 +34,6 @@
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/pci.h>
38#include <linux/bitops.h> 37#include <linux/bitops.h>
39#include <linux/random.h> 38#include <linux/random.h>
40 39
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 9a7eaadb1688..6469406ea9d8 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -40,7 +40,6 @@
40#include <linux/random.h> 40#include <linux/random.h>
41#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/pci.h>
44#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
45#include <linux/kref.h> 44#include <linux/kref.h>
46#include <linux/idr.h> 45#include <linux/idr.h>
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 8199b83052a9..d97ded25c4ff 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -40,7 +40,6 @@
40#include <linux/err.h> 40#include <linux/err.h>
41#include <linux/fs.h> 41#include <linux/fs.h>
42#include <linux/cdev.h> 42#include <linux/cdev.h>
43#include <linux/pci.h>
44#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
45#include <linux/poll.h> 44#include <linux/poll.h>
46#include <linux/rwsem.h> 45#include <linux/rwsem.h>
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4fd75afa6a3a..bab66769be14 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -802,6 +802,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
802 INIT_LIST_HEAD(&obj->async_list); 802 INIT_LIST_HEAD(&obj->async_list);
803 803
804 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe, 804 cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe,
805 cmd.comp_vector,
805 file->ucontext, &udata); 806 file->ucontext, &udata);
806 if (IS_ERR(cq)) { 807 if (IS_ERR(cq)) {
807 ret = PTR_ERR(cq); 808 ret = PTR_ERR(cq);
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index f8bc822a3cc3..d44e54799651 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -752,7 +752,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
752 spin_unlock(&map_lock); 752 spin_unlock(&map_lock);
753 753
754 uverbs_dev->ib_dev = device; 754 uverbs_dev->ib_dev = device;
755 uverbs_dev->num_comp_vectors = 1; 755 uverbs_dev->num_comp_vectors = device->num_comp_vectors;
756 756
757 uverbs_dev->dev = cdev_alloc(); 757 uverbs_dev->dev = cdev_alloc();
758 if (!uverbs_dev->dev) 758 if (!uverbs_dev->dev)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index ccdf93d30b01..86ed8af9c7e6 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -609,11 +609,11 @@ EXPORT_SYMBOL(ib_destroy_qp);
609struct ib_cq *ib_create_cq(struct ib_device *device, 609struct ib_cq *ib_create_cq(struct ib_device *device,
610 ib_comp_handler comp_handler, 610 ib_comp_handler comp_handler,
611 void (*event_handler)(struct ib_event *, void *), 611 void (*event_handler)(struct ib_event *, void *),
612 void *cq_context, int cqe) 612 void *cq_context, int cqe, int comp_vector)
613{ 613{
614 struct ib_cq *cq; 614 struct ib_cq *cq;
615 615
616 cq = device->create_cq(device, cqe, NULL, NULL); 616 cq = device->create_cq(device, cqe, comp_vector, NULL, NULL);
617 617
618 if (!IS_ERR(cq)) { 618 if (!IS_ERR(cq)) {
619 cq->device = device; 619 cq->device = device;
diff --git a/drivers/infiniband/hw/amso1100/c2.h b/drivers/infiniband/hw/amso1100/c2.h
index 04a9db5de881..fa58200217a1 100644
--- a/drivers/infiniband/hw/amso1100/c2.h
+++ b/drivers/infiniband/hw/amso1100/c2.h
@@ -519,7 +519,7 @@ extern void c2_free_cq(struct c2_dev *c2dev, struct c2_cq *cq);
519extern void c2_cq_event(struct c2_dev *c2dev, u32 mq_index); 519extern void c2_cq_event(struct c2_dev *c2dev, u32 mq_index);
520extern void c2_cq_clean(struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index); 520extern void c2_cq_clean(struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index);
521extern int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry); 521extern int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
522extern int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify); 522extern int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
523 523
524/* CM */ 524/* CM */
525extern int c2_llp_connect(struct iw_cm_id *cm_id, 525extern int c2_llp_connect(struct iw_cm_id *cm_id,
diff --git a/drivers/infiniband/hw/amso1100/c2_cq.c b/drivers/infiniband/hw/amso1100/c2_cq.c
index 5175c99ee586..d2b3366786d6 100644
--- a/drivers/infiniband/hw/amso1100/c2_cq.c
+++ b/drivers/infiniband/hw/amso1100/c2_cq.c
@@ -217,17 +217,19 @@ int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
217 return npolled; 217 return npolled;
218} 218}
219 219
220int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) 220int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
221{ 221{
222 struct c2_mq_shared __iomem *shared; 222 struct c2_mq_shared __iomem *shared;
223 struct c2_cq *cq; 223 struct c2_cq *cq;
224 unsigned long flags;
225 int ret = 0;
224 226
225 cq = to_c2cq(ibcq); 227 cq = to_c2cq(ibcq);
226 shared = cq->mq.peer; 228 shared = cq->mq.peer;
227 229
228 if (notify == IB_CQ_NEXT_COMP) 230 if ((notify_flags & IB_CQ_SOLICITED_MASK) == IB_CQ_NEXT_COMP)
229 writeb(C2_CQ_NOTIFICATION_TYPE_NEXT, &shared->notification_type); 231 writeb(C2_CQ_NOTIFICATION_TYPE_NEXT, &shared->notification_type);
230 else if (notify == IB_CQ_SOLICITED) 232 else if ((notify_flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED)
231 writeb(C2_CQ_NOTIFICATION_TYPE_NEXT_SE, &shared->notification_type); 233 writeb(C2_CQ_NOTIFICATION_TYPE_NEXT_SE, &shared->notification_type);
232 else 234 else
233 return -EINVAL; 235 return -EINVAL;
@@ -241,7 +243,13 @@ int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
241 */ 243 */
242 readb(&shared->armed); 244 readb(&shared->armed);
243 245
244 return 0; 246 if (notify_flags & IB_CQ_REPORT_MISSED_EVENTS) {
247 spin_lock_irqsave(&cq->lock, flags);
248 ret = !c2_mq_empty(&cq->mq);
249 spin_unlock_irqrestore(&cq->lock, flags);
250 }
251
252 return ret;
245} 253}
246 254
247static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq) 255static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq)
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index 607c09bf764c..109166223c09 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -290,7 +290,7 @@ static int c2_destroy_qp(struct ib_qp *ib_qp)
290 return 0; 290 return 0;
291} 291}
292 292
293static struct ib_cq *c2_create_cq(struct ib_device *ibdev, int entries, 293static struct ib_cq *c2_create_cq(struct ib_device *ibdev, int entries, int vector,
294 struct ib_ucontext *context, 294 struct ib_ucontext *context,
295 struct ib_udata *udata) 295 struct ib_udata *udata)
296{ 296{
@@ -795,6 +795,7 @@ int c2_register_device(struct c2_dev *dev)
795 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid)); 795 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
796 memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6); 796 memcpy(&dev->ibdev.node_guid, dev->pseudo_netdev->dev_addr, 6);
797 dev->ibdev.phys_port_cnt = 1; 797 dev->ibdev.phys_port_cnt = 1;
798 dev->ibdev.num_comp_vectors = 1;
798 dev->ibdev.dma_device = &dev->pcidev->dev; 799 dev->ibdev.dma_device = &dev->pcidev->dev;
799 dev->ibdev.query_device = c2_query_device; 800 dev->ibdev.query_device = c2_query_device;
800 dev->ibdev.query_port = c2_query_port; 801 dev->ibdev.query_port = c2_query_port;
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index f5e9aeec6f6e..76049afc7655 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -114,7 +114,10 @@ int cxio_hal_cq_op(struct cxio_rdev *rdev_p, struct t3_cq *cq,
114 return -EIO; 114 return -EIO;
115 } 115 }
116 } 116 }
117
118 return 1;
117 } 119 }
120
118 return 0; 121 return 0;
119} 122}
120 123
diff --git a/drivers/infiniband/hw/cxgb3/cxio_wr.h b/drivers/infiniband/hw/cxgb3/cxio_wr.h
index 90d7b8972cb4..ff7290eacefb 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_wr.h
+++ b/drivers/infiniband/hw/cxgb3/cxio_wr.h
@@ -38,6 +38,7 @@
38#include "firmware_exports.h" 38#include "firmware_exports.h"
39 39
40#define T3_MAX_SGE 4 40#define T3_MAX_SGE 4
41#define T3_MAX_INLINE 64
41 42
42#define Q_EMPTY(rptr,wptr) ((rptr)==(wptr)) 43#define Q_EMPTY(rptr,wptr) ((rptr)==(wptr))
43#define Q_FULL(rptr,wptr,size_log2) ( (((wptr)-(rptr))>>(size_log2)) && \ 44#define Q_FULL(rptr,wptr,size_log2) ( (((wptr)-(rptr))>>(size_log2)) && \
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index 3b4b0acd707f..b2faff5abce8 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -1109,6 +1109,15 @@ static int abort_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1109 1109
1110 PDBG("%s ep %p\n", __FUNCTION__, ep); 1110 PDBG("%s ep %p\n", __FUNCTION__, ep);
1111 1111
1112 /*
1113 * We get 2 abort replies from the HW. The first one must
1114 * be ignored except for scribbling that we need one more.
1115 */
1116 if (!(ep->flags & ABORT_REQ_IN_PROGRESS)) {
1117 ep->flags |= ABORT_REQ_IN_PROGRESS;
1118 return CPL_RET_BUF_DONE;
1119 }
1120
1112 close_complete_upcall(ep); 1121 close_complete_upcall(ep);
1113 state_set(&ep->com, DEAD); 1122 state_set(&ep->com, DEAD);
1114 release_ep_resources(ep); 1123 release_ep_resources(ep);
@@ -1189,6 +1198,7 @@ static int listen_stop(struct iwch_listen_ep *ep)
1189 } 1198 }
1190 req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req)); 1199 req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req));
1191 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 1200 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
1201 req->cpu_idx = 0;
1192 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); 1202 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid));
1193 skb->priority = 1; 1203 skb->priority = 1;
1194 ep->com.tdev->send(ep->com.tdev, skb); 1204 ep->com.tdev->send(ep->com.tdev, skb);
@@ -1475,6 +1485,15 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1475 int ret; 1485 int ret;
1476 int state; 1486 int state;
1477 1487
1488 /*
1489 * We get 2 peer aborts from the HW. The first one must
1490 * be ignored except for scribbling that we need one more.
1491 */
1492 if (!(ep->flags & PEER_ABORT_IN_PROGRESS)) {
1493 ep->flags |= PEER_ABORT_IN_PROGRESS;
1494 return CPL_RET_BUF_DONE;
1495 }
1496
1478 if (is_neg_adv_abort(req->status)) { 1497 if (is_neg_adv_abort(req->status)) {
1479 PDBG("%s neg_adv_abort ep %p tid %d\n", __FUNCTION__, ep, 1498 PDBG("%s neg_adv_abort ep %p tid %d\n", __FUNCTION__, ep,
1480 ep->hwtid); 1499 ep->hwtid);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.h b/drivers/infiniband/hw/cxgb3/iwch_cm.h
index 0c6f281bd4a0..21a388c313cf 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.h
@@ -143,6 +143,11 @@ enum iwch_ep_state {
143 DEAD, 143 DEAD,
144}; 144};
145 145
146enum iwch_ep_flags {
147 PEER_ABORT_IN_PROGRESS = (1 << 0),
148 ABORT_REQ_IN_PROGRESS = (1 << 1),
149};
150
146struct iwch_ep_common { 151struct iwch_ep_common {
147 struct iw_cm_id *cm_id; 152 struct iw_cm_id *cm_id;
148 struct iwch_qp *qp; 153 struct iwch_qp *qp;
@@ -181,6 +186,7 @@ struct iwch_ep {
181 u16 plen; 186 u16 plen;
182 u32 ird; 187 u32 ird;
183 u32 ord; 188 u32 ord;
189 u32 flags;
184}; 190};
185 191
186static inline struct iwch_ep *to_ep(struct iw_cm_id *cm_id) 192static inline struct iwch_ep *to_ep(struct iw_cm_id *cm_id)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index af28a317016d..a891493fd340 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -139,7 +139,7 @@ static int iwch_destroy_cq(struct ib_cq *ib_cq)
139 return 0; 139 return 0;
140} 140}
141 141
142static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, 142static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int vector,
143 struct ib_ucontext *ib_context, 143 struct ib_ucontext *ib_context,
144 struct ib_udata *udata) 144 struct ib_udata *udata)
145{ 145{
@@ -292,7 +292,7 @@ static int iwch_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata)
292#endif 292#endif
293} 293}
294 294
295static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) 295static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
296{ 296{
297 struct iwch_dev *rhp; 297 struct iwch_dev *rhp;
298 struct iwch_cq *chp; 298 struct iwch_cq *chp;
@@ -303,7 +303,7 @@ static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
303 303
304 chp = to_iwch_cq(ibcq); 304 chp = to_iwch_cq(ibcq);
305 rhp = chp->rhp; 305 rhp = chp->rhp;
306 if (notify == IB_CQ_SOLICITED) 306 if ((flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED)
307 cq_op = CQ_ARM_SE; 307 cq_op = CQ_ARM_SE;
308 else 308 else
309 cq_op = CQ_ARM_AN; 309 cq_op = CQ_ARM_AN;
@@ -317,9 +317,11 @@ static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
317 PDBG("%s rptr 0x%x\n", __FUNCTION__, chp->cq.rptr); 317 PDBG("%s rptr 0x%x\n", __FUNCTION__, chp->cq.rptr);
318 err = cxio_hal_cq_op(&rhp->rdev, &chp->cq, cq_op, 0); 318 err = cxio_hal_cq_op(&rhp->rdev, &chp->cq, cq_op, 0);
319 spin_unlock_irqrestore(&chp->lock, flag); 319 spin_unlock_irqrestore(&chp->lock, flag);
320 if (err) 320 if (err < 0)
321 printk(KERN_ERR MOD "Error %d rearming CQID 0x%x\n", err, 321 printk(KERN_ERR MOD "Error %d rearming CQID 0x%x\n", err,
322 chp->cq.cqid); 322 chp->cq.cqid);
323 if (err > 0 && !(flags & IB_CQ_REPORT_MISSED_EVENTS))
324 err = 0;
323 return err; 325 return err;
324} 326}
325 327
@@ -780,6 +782,9 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
780 if (rqsize > T3_MAX_RQ_SIZE) 782 if (rqsize > T3_MAX_RQ_SIZE)
781 return ERR_PTR(-EINVAL); 783 return ERR_PTR(-EINVAL);
782 784
785 if (attrs->cap.max_inline_data > T3_MAX_INLINE)
786 return ERR_PTR(-EINVAL);
787
783 /* 788 /*
784 * NOTE: The SQ and total WQ sizes don't need to be 789 * NOTE: The SQ and total WQ sizes don't need to be
785 * a power of two. However, all the code assumes 790 * a power of two. However, all the code assumes
@@ -1107,6 +1112,7 @@ int iwch_register_device(struct iwch_dev *dev)
1107 dev->ibdev.node_type = RDMA_NODE_RNIC; 1112 dev->ibdev.node_type = RDMA_NODE_RNIC;
1108 memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC)); 1113 memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC));
1109 dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports; 1114 dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports;
1115 dev->ibdev.num_comp_vectors = 1;
1110 dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev); 1116 dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
1111 dev->ibdev.query_device = iwch_query_device; 1117 dev->ibdev.query_device = iwch_query_device;
1112 dev->ibdev.query_port = iwch_query_port; 1118 dev->ibdev.query_port = iwch_query_port;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
index 0a472c9b44db..714dddbc9a98 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -471,43 +471,62 @@ int iwch_bind_mw(struct ib_qp *qp,
471 return err; 471 return err;
472} 472}
473 473
474static void build_term_codes(int t3err, u8 *layer_type, u8 *ecode, int tagged) 474static inline void build_term_codes(struct respQ_msg_t *rsp_msg,
475 u8 *layer_type, u8 *ecode)
475{ 476{
476 switch (t3err) { 477 int status = TPT_ERR_INTERNAL_ERR;
478 int tagged = 0;
479 int opcode = -1;
480 int rqtype = 0;
481 int send_inv = 0;
482
483 if (rsp_msg) {
484 status = CQE_STATUS(rsp_msg->cqe);
485 opcode = CQE_OPCODE(rsp_msg->cqe);
486 rqtype = RQ_TYPE(rsp_msg->cqe);
487 send_inv = (opcode == T3_SEND_WITH_INV) ||
488 (opcode == T3_SEND_WITH_SE_INV);
489 tagged = (opcode == T3_RDMA_WRITE) ||
490 (rqtype && (opcode == T3_READ_RESP));
491 }
492
493 switch (status) {
477 case TPT_ERR_STAG: 494 case TPT_ERR_STAG:
478 if (tagged == 1) { 495 if (send_inv) {
479 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 496 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_OP;
480 *ecode = DDPT_INV_STAG; 497 *ecode = RDMAP_CANT_INV_STAG;
481 } else if (tagged == 2) { 498 } else {
482 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 499 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
483 *ecode = RDMAP_INV_STAG; 500 *ecode = RDMAP_INV_STAG;
484 } 501 }
485 break; 502 break;
486 case TPT_ERR_PDID: 503 case TPT_ERR_PDID:
504 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
505 if ((opcode == T3_SEND_WITH_INV) ||
506 (opcode == T3_SEND_WITH_SE_INV))
507 *ecode = RDMAP_CANT_INV_STAG;
508 else
509 *ecode = RDMAP_STAG_NOT_ASSOC;
510 break;
487 case TPT_ERR_QPID: 511 case TPT_ERR_QPID:
512 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
513 *ecode = RDMAP_STAG_NOT_ASSOC;
514 break;
488 case TPT_ERR_ACCESS: 515 case TPT_ERR_ACCESS:
489 if (tagged == 1) { 516 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
490 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 517 *ecode = RDMAP_ACC_VIOL;
491 *ecode = DDPT_STAG_NOT_ASSOC;
492 } else if (tagged == 2) {
493 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
494 *ecode = RDMAP_STAG_NOT_ASSOC;
495 }
496 break; 518 break;
497 case TPT_ERR_WRAP: 519 case TPT_ERR_WRAP:
498 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 520 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
499 *ecode = RDMAP_TO_WRAP; 521 *ecode = RDMAP_TO_WRAP;
500 break; 522 break;
501 case TPT_ERR_BOUND: 523 case TPT_ERR_BOUND:
502 if (tagged == 1) { 524 if (tagged) {
503 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 525 *layer_type = LAYER_DDP|DDP_TAGGED_ERR;
504 *ecode = DDPT_BASE_BOUNDS; 526 *ecode = DDPT_BASE_BOUNDS;
505 } else if (tagged == 2) { 527 } else {
506 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 528 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
507 *ecode = RDMAP_BASE_BOUNDS; 529 *ecode = RDMAP_BASE_BOUNDS;
508 } else {
509 *layer_type = LAYER_DDP|DDP_UNTAGGED_ERR;
510 *ecode = DDPU_MSG_TOOBIG;
511 } 530 }
512 break; 531 break;
513 case TPT_ERR_INVALIDATE_SHARED_MR: 532 case TPT_ERR_INVALIDATE_SHARED_MR:
@@ -591,8 +610,6 @@ int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg)
591{ 610{
592 union t3_wr *wqe; 611 union t3_wr *wqe;
593 struct terminate_message *term; 612 struct terminate_message *term;
594 int status;
595 int tagged = 0;
596 struct sk_buff *skb; 613 struct sk_buff *skb;
597 614
598 PDBG("%s %d\n", __FUNCTION__, __LINE__); 615 PDBG("%s %d\n", __FUNCTION__, __LINE__);
@@ -610,17 +627,7 @@ int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg)
610 627
611 /* immediate data starts here. */ 628 /* immediate data starts here. */
612 term = (struct terminate_message *)wqe->send.sgl; 629 term = (struct terminate_message *)wqe->send.sgl;
613 if (rsp_msg) { 630 build_term_codes(rsp_msg, &term->layer_etype, &term->ecode);
614 status = CQE_STATUS(rsp_msg->cqe);
615 if (CQE_OPCODE(rsp_msg->cqe) == T3_RDMA_WRITE)
616 tagged = 1;
617 if ((CQE_OPCODE(rsp_msg->cqe) == T3_READ_REQ) ||
618 (CQE_OPCODE(rsp_msg->cqe) == T3_READ_RESP))
619 tagged = 2;
620 } else {
621 status = TPT_ERR_INTERNAL_ERR;
622 }
623 build_term_codes(status, &term->layer_etype, &term->ecode, tagged);
624 build_fw_riwrh((void *)wqe, T3_WR_SEND, 631 build_fw_riwrh((void *)wqe, T3_WR_SEND,
625 T3_COMPLETION_FLAG | T3_NOTIFY_FLAG, 1, 632 T3_COMPLETION_FLAG | T3_NOTIFY_FLAG, 1,
626 qhp->ep->hwtid, 5); 633 qhp->ep->hwtid, 5);
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index e2cdc1a16fe9..67f0670fe3b1 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -113,7 +113,7 @@ struct ehca_qp* ehca_cq_get_qp(struct ehca_cq *cq, int real_qp_num)
113 return ret; 113 return ret;
114} 114}
115 115
116struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, 116struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
117 struct ib_ucontext *context, 117 struct ib_ucontext *context,
118 struct ib_udata *udata) 118 struct ib_udata *udata)
119{ 119{
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index 95fd59fb4528..e14b029332c8 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -123,7 +123,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
123void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq); 123void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
124 124
125 125
126struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, 126struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
127 struct ib_ucontext *context, 127 struct ib_ucontext *context,
128 struct ib_udata *udata); 128 struct ib_udata *udata);
129 129
@@ -135,7 +135,7 @@ int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
135 135
136int ehca_peek_cq(struct ib_cq *cq, int wc_cnt); 136int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);
137 137
138int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify); 138int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags);
139 139
140struct ib_qp *ehca_create_qp(struct ib_pd *pd, 140struct ib_qp *ehca_create_qp(struct ib_pd *pd,
141 struct ib_qp_init_attr *init_attr, 141 struct ib_qp_init_attr *init_attr,
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 50e426592d02..fe90e7454560 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -313,6 +313,7 @@ int ehca_init_device(struct ehca_shca *shca)
313 313
314 shca->ib_device.node_type = RDMA_NODE_IB_CA; 314 shca->ib_device.node_type = RDMA_NODE_IB_CA;
315 shca->ib_device.phys_port_cnt = shca->num_ports; 315 shca->ib_device.phys_port_cnt = shca->num_ports;
316 shca->ib_device.num_comp_vectors = 1;
316 shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; 317 shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev;
317 shca->ib_device.query_device = ehca_query_device; 318 shca->ib_device.query_device = ehca_query_device;
318 shca->ib_device.query_port = ehca_query_port; 319 shca->ib_device.query_port = ehca_query_port;
@@ -375,7 +376,7 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
375 return -EPERM; 376 return -EPERM;
376 } 377 }
377 378
378 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void*)(-1), 10); 379 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void*)(-1), 10, 0);
379 if (IS_ERR(ibcq)) { 380 if (IS_ERR(ibcq)) {
380 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ."); 381 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ.");
381 return PTR_ERR(ibcq); 382 return PTR_ERR(ibcq);
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c
index 08d3f892d9f3..caec9dee09e1 100644
--- a/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ b/drivers/infiniband/hw/ehca/ehca_reqs.c
@@ -634,11 +634,13 @@ poll_cq_exit0:
634 return ret; 634 return ret;
635} 635}
636 636
637int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify) 637int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags)
638{ 638{
639 struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq); 639 struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq);
640 unsigned long spl_flags;
641 int ret = 0;
640 642
641 switch (cq_notify) { 643 switch (notify_flags & IB_CQ_SOLICITED_MASK) {
642 case IB_CQ_SOLICITED: 644 case IB_CQ_SOLICITED:
643 hipz_set_cqx_n0(my_cq, 1); 645 hipz_set_cqx_n0(my_cq, 1);
644 break; 646 break;
@@ -649,5 +651,11 @@ int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify)
649 return -EINVAL; 651 return -EINVAL;
650 } 652 }
651 653
652 return 0; 654 if (notify_flags & IB_CQ_REPORT_MISSED_EVENTS) {
655 spin_lock_irqsave(&my_cq->spinlock, spl_flags);
656 ret = ipz_qeit_is_valid(&my_cq->ipz_queue);
657 spin_unlock_irqrestore(&my_cq->spinlock, spl_flags);
658 }
659
660 return ret;
653} 661}
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.h b/drivers/infiniband/hw/ehca/ipz_pt_fn.h
index 8199c45768a3..57f141a36bce 100644
--- a/drivers/infiniband/hw/ehca/ipz_pt_fn.h
+++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.h
@@ -140,6 +140,14 @@ static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue)
140 return cqe; 140 return cqe;
141} 141}
142 142
143static inline int ipz_qeit_is_valid(struct ipz_queue *queue)
144{
145 struct ehca_cqe *cqe = ipz_qeit_get(queue);
146 u32 cqe_flags = cqe->cqe_flags;
147
148 return cqe_flags >> 7 == (queue->toggle_state & 1);
149}
150
143/* 151/*
144 * returns and resets Queue Entry iterator 152 * returns and resets Queue Entry iterator
145 * returns address (kv) of first Queue Entry 153 * returns address (kv) of first Queue Entry
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c
index ea78e6dddc90..3e9241badba0 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -204,7 +204,7 @@ static void send_complete(unsigned long data)
204 * 204 *
205 * Called by ib_create_cq() in the generic verbs code. 205 * Called by ib_create_cq() in the generic verbs code.
206 */ 206 */
207struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, 207struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
208 struct ib_ucontext *context, 208 struct ib_ucontext *context,
209 struct ib_udata *udata) 209 struct ib_udata *udata)
210{ 210{
@@ -243,33 +243,21 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
243 * See ipath_mmap() for details. 243 * See ipath_mmap() for details.
244 */ 244 */
245 if (udata && udata->outlen >= sizeof(__u64)) { 245 if (udata && udata->outlen >= sizeof(__u64)) {
246 struct ipath_mmap_info *ip;
247 __u64 offset = (__u64) wc;
248 int err; 246 int err;
247 u32 s = sizeof *wc + sizeof(struct ib_wc) * entries;
249 248
250 err = ib_copy_to_udata(udata, &offset, sizeof(offset)); 249 cq->ip = ipath_create_mmap_info(dev, s, context, wc);
251 if (err) { 250 if (!cq->ip) {
252 ret = ERR_PTR(err); 251 ret = ERR_PTR(-ENOMEM);
253 goto bail_wc; 252 goto bail_wc;
254 } 253 }
255 254
256 /* Allocate info for ipath_mmap(). */ 255 err = ib_copy_to_udata(udata, &cq->ip->offset,
257 ip = kmalloc(sizeof(*ip), GFP_KERNEL); 256 sizeof(cq->ip->offset));
258 if (!ip) { 257 if (err) {
259 ret = ERR_PTR(-ENOMEM); 258 ret = ERR_PTR(err);
260 goto bail_wc; 259 goto bail_ip;
261 } 260 }
262 cq->ip = ip;
263 ip->context = context;
264 ip->obj = wc;
265 kref_init(&ip->ref);
266 ip->mmap_cnt = 0;
267 ip->size = PAGE_ALIGN(sizeof(*wc) +
268 sizeof(struct ib_wc) * entries);
269 spin_lock_irq(&dev->pending_lock);
270 ip->next = dev->pending_mmaps;
271 dev->pending_mmaps = ip;
272 spin_unlock_irq(&dev->pending_lock);
273 } else 261 } else
274 cq->ip = NULL; 262 cq->ip = NULL;
275 263
@@ -277,12 +265,18 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
277 if (dev->n_cqs_allocated == ib_ipath_max_cqs) { 265 if (dev->n_cqs_allocated == ib_ipath_max_cqs) {
278 spin_unlock(&dev->n_cqs_lock); 266 spin_unlock(&dev->n_cqs_lock);
279 ret = ERR_PTR(-ENOMEM); 267 ret = ERR_PTR(-ENOMEM);
280 goto bail_wc; 268 goto bail_ip;
281 } 269 }
282 270
283 dev->n_cqs_allocated++; 271 dev->n_cqs_allocated++;
284 spin_unlock(&dev->n_cqs_lock); 272 spin_unlock(&dev->n_cqs_lock);
285 273
274 if (cq->ip) {
275 spin_lock_irq(&dev->pending_lock);
276 list_add(&cq->ip->pending_mmaps, &dev->pending_mmaps);
277 spin_unlock_irq(&dev->pending_lock);
278 }
279
286 /* 280 /*
287 * ib_create_cq() will initialize cq->ibcq except for cq->ibcq.cqe. 281 * ib_create_cq() will initialize cq->ibcq except for cq->ibcq.cqe.
288 * The number of entries should be >= the number requested or return 282 * The number of entries should be >= the number requested or return
@@ -301,12 +295,12 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
301 295
302 goto done; 296 goto done;
303 297
298bail_ip:
299 kfree(cq->ip);
304bail_wc: 300bail_wc:
305 vfree(wc); 301 vfree(wc);
306
307bail_cq: 302bail_cq:
308 kfree(cq); 303 kfree(cq);
309
310done: 304done:
311 return ret; 305 return ret;
312} 306}
@@ -340,17 +334,18 @@ int ipath_destroy_cq(struct ib_cq *ibcq)
340/** 334/**
341 * ipath_req_notify_cq - change the notification type for a completion queue 335 * ipath_req_notify_cq - change the notification type for a completion queue
342 * @ibcq: the completion queue 336 * @ibcq: the completion queue
343 * @notify: the type of notification to request 337 * @notify_flags: the type of notification to request
344 * 338 *
345 * Returns 0 for success. 339 * Returns 0 for success.
346 * 340 *
347 * This may be called from interrupt context. Also called by 341 * This may be called from interrupt context. Also called by
348 * ib_req_notify_cq() in the generic verbs code. 342 * ib_req_notify_cq() in the generic verbs code.
349 */ 343 */
350int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) 344int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
351{ 345{
352 struct ipath_cq *cq = to_icq(ibcq); 346 struct ipath_cq *cq = to_icq(ibcq);
353 unsigned long flags; 347 unsigned long flags;
348 int ret = 0;
354 349
355 spin_lock_irqsave(&cq->lock, flags); 350 spin_lock_irqsave(&cq->lock, flags);
356 /* 351 /*
@@ -358,9 +353,15 @@ int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
358 * any other transitions (see C11-31 and C11-32 in ch. 11.4.2.2). 353 * any other transitions (see C11-31 and C11-32 in ch. 11.4.2.2).
359 */ 354 */
360 if (cq->notify != IB_CQ_NEXT_COMP) 355 if (cq->notify != IB_CQ_NEXT_COMP)
361 cq->notify = notify; 356 cq->notify = notify_flags & IB_CQ_SOLICITED_MASK;
357
358 if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) &&
359 cq->queue->head != cq->queue->tail)
360 ret = 1;
361
362 spin_unlock_irqrestore(&cq->lock, flags); 362 spin_unlock_irqrestore(&cq->lock, flags);
363 return 0; 363
364 return ret;
364} 365}
365 366
366/** 367/**
@@ -443,13 +444,12 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
443 if (cq->ip) { 444 if (cq->ip) {
444 struct ipath_ibdev *dev = to_idev(ibcq->device); 445 struct ipath_ibdev *dev = to_idev(ibcq->device);
445 struct ipath_mmap_info *ip = cq->ip; 446 struct ipath_mmap_info *ip = cq->ip;
447 u32 s = sizeof *wc + sizeof(struct ib_wc) * cqe;
446 448
447 ip->obj = wc; 449 ipath_update_mmap_info(dev, ip, s, wc);
448 ip->size = PAGE_ALIGN(sizeof(*wc) +
449 sizeof(struct ib_wc) * cqe);
450 spin_lock_irq(&dev->pending_lock); 450 spin_lock_irq(&dev->pending_lock);
451 ip->next = dev->pending_mmaps; 451 if (list_empty(&ip->pending_mmaps))
452 dev->pending_mmaps = ip; 452 list_add(&ip->pending_mmaps, &dev->pending_mmaps);
453 spin_unlock_irq(&dev->pending_lock); 453 spin_unlock_irq(&dev->pending_lock);
454 } 454 }
455 455
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index ed55979bfd34..036ed1ef1796 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -38,7 +38,6 @@
38#include <linux/pagemap.h> 38#include <linux/pagemap.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/namei.h> 40#include <linux/namei.h>
41#include <linux/pci.h>
42 41
43#include "ipath_kernel.h" 42#include "ipath_kernel.h"
44 43
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c
index e46aa4ed2a7e..05a1d2b01d9d 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.c
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c
@@ -37,7 +37,6 @@
37 */ 37 */
38 38
39#include <linux/io.h> 39#include <linux/io.h>
40#include <linux/pci.h>
41#include <asm/byteorder.h> 40#include <asm/byteorder.h>
42 41
43#include "ipath_kernel.h" 42#include "ipath_kernel.h"
diff --git a/drivers/infiniband/hw/ipath/ipath_mmap.c b/drivers/infiniband/hw/ipath/ipath_mmap.c
index a82157db4689..937bc3396b53 100644
--- a/drivers/infiniband/hw/ipath/ipath_mmap.c
+++ b/drivers/infiniband/hw/ipath/ipath_mmap.c
@@ -46,6 +46,11 @@ void ipath_release_mmap_info(struct kref *ref)
46{ 46{
47 struct ipath_mmap_info *ip = 47 struct ipath_mmap_info *ip =
48 container_of(ref, struct ipath_mmap_info, ref); 48 container_of(ref, struct ipath_mmap_info, ref);
49 struct ipath_ibdev *dev = to_idev(ip->context->device);
50
51 spin_lock_irq(&dev->pending_lock);
52 list_del(&ip->pending_mmaps);
53 spin_unlock_irq(&dev->pending_lock);
49 54
50 vfree(ip->obj); 55 vfree(ip->obj);
51 kfree(ip); 56 kfree(ip);
@@ -60,14 +65,12 @@ static void ipath_vma_open(struct vm_area_struct *vma)
60 struct ipath_mmap_info *ip = vma->vm_private_data; 65 struct ipath_mmap_info *ip = vma->vm_private_data;
61 66
62 kref_get(&ip->ref); 67 kref_get(&ip->ref);
63 ip->mmap_cnt++;
64} 68}
65 69
66static void ipath_vma_close(struct vm_area_struct *vma) 70static void ipath_vma_close(struct vm_area_struct *vma)
67{ 71{
68 struct ipath_mmap_info *ip = vma->vm_private_data; 72 struct ipath_mmap_info *ip = vma->vm_private_data;
69 73
70 ip->mmap_cnt--;
71 kref_put(&ip->ref, ipath_release_mmap_info); 74 kref_put(&ip->ref, ipath_release_mmap_info);
72} 75}
73 76
@@ -87,7 +90,7 @@ int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
87 struct ipath_ibdev *dev = to_idev(context->device); 90 struct ipath_ibdev *dev = to_idev(context->device);
88 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 91 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
89 unsigned long size = vma->vm_end - vma->vm_start; 92 unsigned long size = vma->vm_end - vma->vm_start;
90 struct ipath_mmap_info *ip, **pp; 93 struct ipath_mmap_info *ip, *pp;
91 int ret = -EINVAL; 94 int ret = -EINVAL;
92 95
93 /* 96 /*
@@ -96,15 +99,16 @@ int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
96 * CQ, QP, or SRQ is soon followed by a call to mmap(). 99 * CQ, QP, or SRQ is soon followed by a call to mmap().
97 */ 100 */
98 spin_lock_irq(&dev->pending_lock); 101 spin_lock_irq(&dev->pending_lock);
99 for (pp = &dev->pending_mmaps; (ip = *pp); pp = &ip->next) { 102 list_for_each_entry_safe(ip, pp, &dev->pending_mmaps,
103 pending_mmaps) {
100 /* Only the creator is allowed to mmap the object */ 104 /* Only the creator is allowed to mmap the object */
101 if (context != ip->context || (void *) offset != ip->obj) 105 if (context != ip->context || (__u64) offset != ip->offset)
102 continue; 106 continue;
103 /* Don't allow a mmap larger than the object. */ 107 /* Don't allow a mmap larger than the object. */
104 if (size > ip->size) 108 if (size > ip->size)
105 break; 109 break;
106 110
107 *pp = ip->next; 111 list_del_init(&ip->pending_mmaps);
108 spin_unlock_irq(&dev->pending_lock); 112 spin_unlock_irq(&dev->pending_lock);
109 113
110 ret = remap_vmalloc_range(vma, ip->obj, 0); 114 ret = remap_vmalloc_range(vma, ip->obj, 0);
@@ -119,3 +123,51 @@ int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
119done: 123done:
120 return ret; 124 return ret;
121} 125}
126
127/*
128 * Allocate information for ipath_mmap
129 */
130struct ipath_mmap_info *ipath_create_mmap_info(struct ipath_ibdev *dev,
131 u32 size,
132 struct ib_ucontext *context,
133 void *obj) {
134 struct ipath_mmap_info *ip;
135
136 ip = kmalloc(sizeof *ip, GFP_KERNEL);
137 if (!ip)
138 goto bail;
139
140 size = PAGE_ALIGN(size);
141
142 spin_lock_irq(&dev->mmap_offset_lock);
143 if (dev->mmap_offset == 0)
144 dev->mmap_offset = PAGE_SIZE;
145 ip->offset = dev->mmap_offset;
146 dev->mmap_offset += size;
147 spin_unlock_irq(&dev->mmap_offset_lock);
148
149 INIT_LIST_HEAD(&ip->pending_mmaps);
150 ip->size = size;
151 ip->context = context;
152 ip->obj = obj;
153 kref_init(&ip->ref);
154
155bail:
156 return ip;
157}
158
159void ipath_update_mmap_info(struct ipath_ibdev *dev,
160 struct ipath_mmap_info *ip,
161 u32 size, void *obj) {
162 size = PAGE_ALIGN(size);
163
164 spin_lock_irq(&dev->mmap_offset_lock);
165 if (dev->mmap_offset == 0)
166 dev->mmap_offset = PAGE_SIZE;
167 ip->offset = dev->mmap_offset;
168 dev->mmap_offset += size;
169 spin_unlock_irq(&dev->mmap_offset_lock);
170
171 ip->size = size;
172 ip->obj = obj;
173}
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 16db9ac0b402..bfef08ecd342 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -844,34 +844,36 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
844 * See ipath_mmap() for details. 844 * See ipath_mmap() for details.
845 */ 845 */
846 if (udata && udata->outlen >= sizeof(__u64)) { 846 if (udata && udata->outlen >= sizeof(__u64)) {
847 struct ipath_mmap_info *ip;
848 __u64 offset = (__u64) qp->r_rq.wq;
849 int err; 847 int err;
850 848
851 err = ib_copy_to_udata(udata, &offset, sizeof(offset)); 849 if (!qp->r_rq.wq) {
852 if (err) { 850 __u64 offset = 0;
853 ret = ERR_PTR(err);
854 goto bail_rwq;
855 }
856 851
857 if (qp->r_rq.wq) { 852 err = ib_copy_to_udata(udata, &offset,
858 /* Allocate info for ipath_mmap(). */ 853 sizeof(offset));
859 ip = kmalloc(sizeof(*ip), GFP_KERNEL); 854 if (err) {
860 if (!ip) { 855 ret = ERR_PTR(err);
856 goto bail_rwq;
857 }
858 } else {
859 u32 s = sizeof(struct ipath_rwq) +
860 qp->r_rq.size * sz;
861
862 qp->ip =
863 ipath_create_mmap_info(dev, s,
864 ibpd->uobject->context,
865 qp->r_rq.wq);
866 if (!qp->ip) {
861 ret = ERR_PTR(-ENOMEM); 867 ret = ERR_PTR(-ENOMEM);
862 goto bail_rwq; 868 goto bail_rwq;
863 } 869 }
864 qp->ip = ip; 870
865 ip->context = ibpd->uobject->context; 871 err = ib_copy_to_udata(udata, &(qp->ip->offset),
866 ip->obj = qp->r_rq.wq; 872 sizeof(qp->ip->offset));
867 kref_init(&ip->ref); 873 if (err) {
868 ip->mmap_cnt = 0; 874 ret = ERR_PTR(err);
869 ip->size = PAGE_ALIGN(sizeof(struct ipath_rwq) + 875 goto bail_ip;
870 qp->r_rq.size * sz); 876 }
871 spin_lock_irq(&dev->pending_lock);
872 ip->next = dev->pending_mmaps;
873 dev->pending_mmaps = ip;
874 spin_unlock_irq(&dev->pending_lock);
875 } 877 }
876 } 878 }
877 879
@@ -885,6 +887,12 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
885 dev->n_qps_allocated++; 887 dev->n_qps_allocated++;
886 spin_unlock(&dev->n_qps_lock); 888 spin_unlock(&dev->n_qps_lock);
887 889
890 if (qp->ip) {
891 spin_lock_irq(&dev->pending_lock);
892 list_add(&qp->ip->pending_mmaps, &dev->pending_mmaps);
893 spin_unlock_irq(&dev->pending_lock);
894 }
895
888 ret = &qp->ibqp; 896 ret = &qp->ibqp;
889 goto bail; 897 goto bail;
890 898
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index b4b88d0b53f5..1915771fd038 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -98,13 +98,21 @@ static int ipath_make_rc_ack(struct ipath_qp *qp,
98 case OP(RDMA_READ_RESPONSE_LAST): 98 case OP(RDMA_READ_RESPONSE_LAST):
99 case OP(RDMA_READ_RESPONSE_ONLY): 99 case OP(RDMA_READ_RESPONSE_ONLY):
100 case OP(ATOMIC_ACKNOWLEDGE): 100 case OP(ATOMIC_ACKNOWLEDGE):
101 qp->s_ack_state = OP(ACKNOWLEDGE); 101 /*
102 * We can increment the tail pointer now that the last
103 * response has been sent instead of only being
104 * constructed.
105 */
106 if (++qp->s_tail_ack_queue > IPATH_MAX_RDMA_ATOMIC)
107 qp->s_tail_ack_queue = 0;
102 /* FALLTHROUGH */ 108 /* FALLTHROUGH */
109 case OP(SEND_ONLY):
103 case OP(ACKNOWLEDGE): 110 case OP(ACKNOWLEDGE):
104 /* Check for no next entry in the queue. */ 111 /* Check for no next entry in the queue. */
105 if (qp->r_head_ack_queue == qp->s_tail_ack_queue) { 112 if (qp->r_head_ack_queue == qp->s_tail_ack_queue) {
106 if (qp->s_flags & IPATH_S_ACK_PENDING) 113 if (qp->s_flags & IPATH_S_ACK_PENDING)
107 goto normal; 114 goto normal;
115 qp->s_ack_state = OP(ACKNOWLEDGE);
108 goto bail; 116 goto bail;
109 } 117 }
110 118
@@ -117,12 +125,8 @@ static int ipath_make_rc_ack(struct ipath_qp *qp,
117 if (len > pmtu) { 125 if (len > pmtu) {
118 len = pmtu; 126 len = pmtu;
119 qp->s_ack_state = OP(RDMA_READ_RESPONSE_FIRST); 127 qp->s_ack_state = OP(RDMA_READ_RESPONSE_FIRST);
120 } else { 128 } else
121 qp->s_ack_state = OP(RDMA_READ_RESPONSE_ONLY); 129 qp->s_ack_state = OP(RDMA_READ_RESPONSE_ONLY);
122 if (++qp->s_tail_ack_queue >
123 IPATH_MAX_RDMA_ATOMIC)
124 qp->s_tail_ack_queue = 0;
125 }
126 ohdr->u.aeth = ipath_compute_aeth(qp); 130 ohdr->u.aeth = ipath_compute_aeth(qp);
127 hwords++; 131 hwords++;
128 qp->s_ack_rdma_psn = e->psn; 132 qp->s_ack_rdma_psn = e->psn;
@@ -139,8 +143,6 @@ static int ipath_make_rc_ack(struct ipath_qp *qp,
139 cpu_to_be32(e->atomic_data); 143 cpu_to_be32(e->atomic_data);
140 hwords += sizeof(ohdr->u.at) / sizeof(u32); 144 hwords += sizeof(ohdr->u.at) / sizeof(u32);
141 bth2 = e->psn; 145 bth2 = e->psn;
142 if (++qp->s_tail_ack_queue > IPATH_MAX_RDMA_ATOMIC)
143 qp->s_tail_ack_queue = 0;
144 } 146 }
145 bth0 = qp->s_ack_state << 24; 147 bth0 = qp->s_ack_state << 24;
146 break; 148 break;
@@ -156,8 +158,6 @@ static int ipath_make_rc_ack(struct ipath_qp *qp,
156 ohdr->u.aeth = ipath_compute_aeth(qp); 158 ohdr->u.aeth = ipath_compute_aeth(qp);
157 hwords++; 159 hwords++;
158 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST); 160 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST);
159 if (++qp->s_tail_ack_queue > IPATH_MAX_RDMA_ATOMIC)
160 qp->s_tail_ack_queue = 0;
161 } 161 }
162 bth0 = qp->s_ack_state << 24; 162 bth0 = qp->s_ack_state << 24;
163 bth2 = qp->s_ack_rdma_psn++ & IPATH_PSN_MASK; 163 bth2 = qp->s_ack_rdma_psn++ & IPATH_PSN_MASK;
@@ -171,7 +171,7 @@ static int ipath_make_rc_ack(struct ipath_qp *qp,
171 * the ACK before setting s_ack_state to ACKNOWLEDGE 171 * the ACK before setting s_ack_state to ACKNOWLEDGE
172 * (see above). 172 * (see above).
173 */ 173 */
174 qp->s_ack_state = OP(ATOMIC_ACKNOWLEDGE); 174 qp->s_ack_state = OP(SEND_ONLY);
175 qp->s_flags &= ~IPATH_S_ACK_PENDING; 175 qp->s_flags &= ~IPATH_S_ACK_PENDING;
176 qp->s_cur_sge = NULL; 176 qp->s_cur_sge = NULL;
177 if (qp->s_nak_state) 177 if (qp->s_nak_state)
@@ -223,23 +223,18 @@ int ipath_make_rc_req(struct ipath_qp *qp,
223 /* Sending responses has higher priority over sending requests. */ 223 /* Sending responses has higher priority over sending requests. */
224 if ((qp->r_head_ack_queue != qp->s_tail_ack_queue || 224 if ((qp->r_head_ack_queue != qp->s_tail_ack_queue ||
225 (qp->s_flags & IPATH_S_ACK_PENDING) || 225 (qp->s_flags & IPATH_S_ACK_PENDING) ||
226 qp->s_ack_state != IB_OPCODE_RC_ACKNOWLEDGE) && 226 qp->s_ack_state != OP(ACKNOWLEDGE)) &&
227 ipath_make_rc_ack(qp, ohdr, pmtu, bth0p, bth2p)) 227 ipath_make_rc_ack(qp, ohdr, pmtu, bth0p, bth2p))
228 goto done; 228 goto done;
229 229
230 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK) || 230 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK) ||
231 qp->s_rnr_timeout) 231 qp->s_rnr_timeout || qp->s_wait_credit)
232 goto bail; 232 goto bail;
233 233
234 /* Limit the number of packets sent without an ACK. */ 234 /* Limit the number of packets sent without an ACK. */
235 if (ipath_cmp24(qp->s_psn, qp->s_last_psn + IPATH_PSN_CREDIT) > 0) { 235 if (ipath_cmp24(qp->s_psn, qp->s_last_psn + IPATH_PSN_CREDIT) > 0) {
236 qp->s_wait_credit = 1; 236 qp->s_wait_credit = 1;
237 dev->n_rc_stalls++; 237 dev->n_rc_stalls++;
238 spin_lock(&dev->pending_lock);
239 if (list_empty(&qp->timerwait))
240 list_add_tail(&qp->timerwait,
241 &dev->pending[dev->pending_index]);
242 spin_unlock(&dev->pending_lock);
243 goto bail; 238 goto bail;
244 } 239 }
245 240
@@ -587,9 +582,12 @@ static void send_rc_ack(struct ipath_qp *qp)
587 u32 hwords; 582 u32 hwords;
588 struct ipath_ib_header hdr; 583 struct ipath_ib_header hdr;
589 struct ipath_other_headers *ohdr; 584 struct ipath_other_headers *ohdr;
585 unsigned long flags;
590 586
591 /* Don't send ACK or NAK if a RDMA read or atomic is pending. */ 587 /* Don't send ACK or NAK if a RDMA read or atomic is pending. */
592 if (qp->r_head_ack_queue != qp->s_tail_ack_queue) 588 if (qp->r_head_ack_queue != qp->s_tail_ack_queue ||
589 (qp->s_flags & IPATH_S_ACK_PENDING) ||
590 qp->s_ack_state != OP(ACKNOWLEDGE))
593 goto queue_ack; 591 goto queue_ack;
594 592
595 /* Construct the header. */ 593 /* Construct the header. */
@@ -640,11 +638,11 @@ static void send_rc_ack(struct ipath_qp *qp)
640 dev->n_rc_qacks++; 638 dev->n_rc_qacks++;
641 639
642queue_ack: 640queue_ack:
643 spin_lock_irq(&qp->s_lock); 641 spin_lock_irqsave(&qp->s_lock, flags);
644 qp->s_flags |= IPATH_S_ACK_PENDING; 642 qp->s_flags |= IPATH_S_ACK_PENDING;
645 qp->s_nak_state = qp->r_nak_state; 643 qp->s_nak_state = qp->r_nak_state;
646 qp->s_ack_psn = qp->r_ack_psn; 644 qp->s_ack_psn = qp->r_ack_psn;
647 spin_unlock_irq(&qp->s_lock); 645 spin_unlock_irqrestore(&qp->s_lock, flags);
648 646
649 /* Call ipath_do_rc_send() in another thread. */ 647 /* Call ipath_do_rc_send() in another thread. */
650 tasklet_hi_schedule(&qp->s_task); 648 tasklet_hi_schedule(&qp->s_task);
@@ -1261,6 +1259,7 @@ ack_err:
1261 wc.dlid_path_bits = 0; 1259 wc.dlid_path_bits = 0;
1262 wc.port_num = 0; 1260 wc.port_num = 0;
1263 ipath_sqerror_qp(qp, &wc); 1261 ipath_sqerror_qp(qp, &wc);
1262 spin_unlock_irqrestore(&qp->s_lock, flags);
1264bail: 1263bail:
1265 return; 1264 return;
1266} 1265}
@@ -1294,6 +1293,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1294 struct ipath_ack_entry *e; 1293 struct ipath_ack_entry *e;
1295 u8 i, prev; 1294 u8 i, prev;
1296 int old_req; 1295 int old_req;
1296 unsigned long flags;
1297 1297
1298 if (diff > 0) { 1298 if (diff > 0) {
1299 /* 1299 /*
@@ -1327,7 +1327,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1327 psn &= IPATH_PSN_MASK; 1327 psn &= IPATH_PSN_MASK;
1328 e = NULL; 1328 e = NULL;
1329 old_req = 1; 1329 old_req = 1;
1330 spin_lock_irq(&qp->s_lock); 1330 spin_lock_irqsave(&qp->s_lock, flags);
1331 for (i = qp->r_head_ack_queue; ; i = prev) { 1331 for (i = qp->r_head_ack_queue; ; i = prev) {
1332 if (i == qp->s_tail_ack_queue) 1332 if (i == qp->s_tail_ack_queue)
1333 old_req = 0; 1333 old_req = 0;
@@ -1425,7 +1425,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1425 * after all the previous RDMA reads and atomics. 1425 * after all the previous RDMA reads and atomics.
1426 */ 1426 */
1427 if (i == qp->r_head_ack_queue) { 1427 if (i == qp->r_head_ack_queue) {
1428 spin_unlock_irq(&qp->s_lock); 1428 spin_unlock_irqrestore(&qp->s_lock, flags);
1429 qp->r_nak_state = 0; 1429 qp->r_nak_state = 0;
1430 qp->r_ack_psn = qp->r_psn - 1; 1430 qp->r_ack_psn = qp->r_psn - 1;
1431 goto send_ack; 1431 goto send_ack;
@@ -1439,11 +1439,10 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1439 break; 1439 break;
1440 } 1440 }
1441 qp->r_nak_state = 0; 1441 qp->r_nak_state = 0;
1442 spin_unlock_irq(&qp->s_lock);
1443 tasklet_hi_schedule(&qp->s_task); 1442 tasklet_hi_schedule(&qp->s_task);
1444 1443
1445unlock_done: 1444unlock_done:
1446 spin_unlock_irq(&qp->s_lock); 1445 spin_unlock_irqrestore(&qp->s_lock, flags);
1447done: 1446done:
1448 return 1; 1447 return 1;
1449 1448
@@ -1453,10 +1452,12 @@ send_ack:
1453 1452
1454static void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err) 1453static void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err)
1455{ 1454{
1456 spin_lock_irq(&qp->s_lock); 1455 unsigned long flags;
1456
1457 spin_lock_irqsave(&qp->s_lock, flags);
1457 qp->state = IB_QPS_ERR; 1458 qp->state = IB_QPS_ERR;
1458 ipath_error_qp(qp, err); 1459 ipath_error_qp(qp, err);
1459 spin_unlock_irq(&qp->s_lock); 1460 spin_unlock_irqrestore(&qp->s_lock, flags);
1460} 1461}
1461 1462
1462/** 1463/**
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c
index 94033503400c..03acae66ba81 100644
--- a/drivers/infiniband/hw/ipath/ipath_srq.c
+++ b/drivers/infiniband/hw/ipath/ipath_srq.c
@@ -139,33 +139,24 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
139 * See ipath_mmap() for details. 139 * See ipath_mmap() for details.
140 */ 140 */
141 if (udata && udata->outlen >= sizeof(__u64)) { 141 if (udata && udata->outlen >= sizeof(__u64)) {
142 struct ipath_mmap_info *ip;
143 __u64 offset = (__u64) srq->rq.wq;
144 int err; 142 int err;
143 u32 s = sizeof(struct ipath_rwq) + srq->rq.size * sz;
145 144
146 err = ib_copy_to_udata(udata, &offset, sizeof(offset)); 145 srq->ip =
147 if (err) { 146 ipath_create_mmap_info(dev, s,
148 ret = ERR_PTR(err); 147 ibpd->uobject->context,
148 srq->rq.wq);
149 if (!srq->ip) {
150 ret = ERR_PTR(-ENOMEM);
149 goto bail_wq; 151 goto bail_wq;
150 } 152 }
151 153
152 /* Allocate info for ipath_mmap(). */ 154 err = ib_copy_to_udata(udata, &srq->ip->offset,
153 ip = kmalloc(sizeof(*ip), GFP_KERNEL); 155 sizeof(srq->ip->offset));
154 if (!ip) { 156 if (err) {
155 ret = ERR_PTR(-ENOMEM); 157 ret = ERR_PTR(err);
156 goto bail_wq; 158 goto bail_ip;
157 } 159 }
158 srq->ip = ip;
159 ip->context = ibpd->uobject->context;
160 ip->obj = srq->rq.wq;
161 kref_init(&ip->ref);
162 ip->mmap_cnt = 0;
163 ip->size = PAGE_ALIGN(sizeof(struct ipath_rwq) +
164 srq->rq.size * sz);
165 spin_lock_irq(&dev->pending_lock);
166 ip->next = dev->pending_mmaps;
167 dev->pending_mmaps = ip;
168 spin_unlock_irq(&dev->pending_lock);
169 } else 160 } else
170 srq->ip = NULL; 161 srq->ip = NULL;
171 162
@@ -181,21 +172,27 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
181 if (dev->n_srqs_allocated == ib_ipath_max_srqs) { 172 if (dev->n_srqs_allocated == ib_ipath_max_srqs) {
182 spin_unlock(&dev->n_srqs_lock); 173 spin_unlock(&dev->n_srqs_lock);
183 ret = ERR_PTR(-ENOMEM); 174 ret = ERR_PTR(-ENOMEM);
184 goto bail_wq; 175 goto bail_ip;
185 } 176 }
186 177
187 dev->n_srqs_allocated++; 178 dev->n_srqs_allocated++;
188 spin_unlock(&dev->n_srqs_lock); 179 spin_unlock(&dev->n_srqs_lock);
189 180
181 if (srq->ip) {
182 spin_lock_irq(&dev->pending_lock);
183 list_add(&srq->ip->pending_mmaps, &dev->pending_mmaps);
184 spin_unlock_irq(&dev->pending_lock);
185 }
186
190 ret = &srq->ibsrq; 187 ret = &srq->ibsrq;
191 goto done; 188 goto done;
192 189
190bail_ip:
191 kfree(srq->ip);
193bail_wq: 192bail_wq:
194 vfree(srq->rq.wq); 193 vfree(srq->rq.wq);
195
196bail_srq: 194bail_srq:
197 kfree(srq); 195 kfree(srq);
198
199done: 196done:
200 return ret; 197 return ret;
201} 198}
@@ -312,13 +309,13 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
312 if (srq->ip) { 309 if (srq->ip) {
313 struct ipath_mmap_info *ip = srq->ip; 310 struct ipath_mmap_info *ip = srq->ip;
314 struct ipath_ibdev *dev = to_idev(srq->ibsrq.device); 311 struct ipath_ibdev *dev = to_idev(srq->ibsrq.device);
312 u32 s = sizeof(struct ipath_rwq) + size * sz;
315 313
316 ip->obj = wq; 314 ipath_update_mmap_info(dev, ip, s, wq);
317 ip->size = PAGE_ALIGN(sizeof(struct ipath_rwq) +
318 size * sz);
319 spin_lock_irq(&dev->pending_lock); 315 spin_lock_irq(&dev->pending_lock);
320 ip->next = dev->pending_mmaps; 316 if (list_empty(&ip->pending_mmaps))
321 dev->pending_mmaps = ip; 317 list_add(&ip->pending_mmaps,
318 &dev->pending_mmaps);
322 spin_unlock_irq(&dev->pending_lock); 319 spin_unlock_irq(&dev->pending_lock);
323 } 320 }
324 } else if (attr_mask & IB_SRQ_LIMIT) { 321 } else if (attr_mask & IB_SRQ_LIMIT) {
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c
index 9307f7187ca5..d8b5e4cefe25 100644
--- a/drivers/infiniband/hw/ipath/ipath_stats.c
+++ b/drivers/infiniband/hw/ipath/ipath_stats.c
@@ -31,8 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/pci.h>
35
36#include "ipath_kernel.h" 34#include "ipath_kernel.h"
37 35
38struct infinipath_stats ipath_stats; 36struct infinipath_stats ipath_stats;
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index ffa6318ad0cc..4dc398d5e011 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -32,7 +32,6 @@
32 */ 32 */
33 33
34#include <linux/ctype.h> 34#include <linux/ctype.h>
35#include <linux/pci.h>
36 35
37#include "ipath_kernel.h" 36#include "ipath_kernel.h"
38#include "ipath_common.h" 37#include "ipath_common.h"
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 18c6df2052c2..12933e77c7e9 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1476,7 +1476,10 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
1476 ret = -ENOMEM; 1476 ret = -ENOMEM;
1477 goto err_lk; 1477 goto err_lk;
1478 } 1478 }
1479 INIT_LIST_HEAD(&idev->pending_mmaps);
1479 spin_lock_init(&idev->pending_lock); 1480 spin_lock_init(&idev->pending_lock);
1481 idev->mmap_offset = PAGE_SIZE;
1482 spin_lock_init(&idev->mmap_offset_lock);
1480 INIT_LIST_HEAD(&idev->pending[0]); 1483 INIT_LIST_HEAD(&idev->pending[0]);
1481 INIT_LIST_HEAD(&idev->pending[1]); 1484 INIT_LIST_HEAD(&idev->pending[1]);
1482 INIT_LIST_HEAD(&idev->pending[2]); 1485 INIT_LIST_HEAD(&idev->pending[2]);
@@ -1558,6 +1561,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
1558 (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); 1561 (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
1559 dev->node_type = RDMA_NODE_IB_CA; 1562 dev->node_type = RDMA_NODE_IB_CA;
1560 dev->phys_port_cnt = 1; 1563 dev->phys_port_cnt = 1;
1564 dev->num_comp_vectors = 1;
1561 dev->dma_device = &dd->pcidev->dev; 1565 dev->dma_device = &dd->pcidev->dev;
1562 dev->query_device = ipath_query_device; 1566 dev->query_device = ipath_query_device;
1563 dev->modify_device = ipath_modify_device; 1567 dev->modify_device = ipath_modify_device;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 7c4929f1cb5b..7064fc222727 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -173,12 +173,12 @@ struct ipath_ah {
173 * this as its vm_private_data. 173 * this as its vm_private_data.
174 */ 174 */
175struct ipath_mmap_info { 175struct ipath_mmap_info {
176 struct ipath_mmap_info *next; 176 struct list_head pending_mmaps;
177 struct ib_ucontext *context; 177 struct ib_ucontext *context;
178 void *obj; 178 void *obj;
179 __u64 offset;
179 struct kref ref; 180 struct kref ref;
180 unsigned size; 181 unsigned size;
181 unsigned mmap_cnt;
182}; 182};
183 183
184/* 184/*
@@ -422,7 +422,7 @@ struct ipath_qp {
422#define IPATH_S_RDMAR_PENDING 0x04 422#define IPATH_S_RDMAR_PENDING 0x04
423#define IPATH_S_ACK_PENDING 0x08 423#define IPATH_S_ACK_PENDING 0x08
424 424
425#define IPATH_PSN_CREDIT 2048 425#define IPATH_PSN_CREDIT 512
426 426
427/* 427/*
428 * Since struct ipath_swqe is not a fixed size, we can't simply index into 428 * Since struct ipath_swqe is not a fixed size, we can't simply index into
@@ -485,9 +485,10 @@ struct ipath_opcode_stats {
485 485
486struct ipath_ibdev { 486struct ipath_ibdev {
487 struct ib_device ibdev; 487 struct ib_device ibdev;
488 struct list_head dev_list;
489 struct ipath_devdata *dd; 488 struct ipath_devdata *dd;
490 struct ipath_mmap_info *pending_mmaps; 489 struct list_head pending_mmaps;
490 spinlock_t mmap_offset_lock;
491 u32 mmap_offset;
491 int ib_unit; /* This is the device number */ 492 int ib_unit; /* This is the device number */
492 u16 sm_lid; /* in host order */ 493 u16 sm_lid; /* in host order */
493 u8 sm_sl; 494 u8 sm_sl;
@@ -734,13 +735,13 @@ int ipath_destroy_srq(struct ib_srq *ibsrq);
734 735
735int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry); 736int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
736 737
737struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, 738struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
738 struct ib_ucontext *context, 739 struct ib_ucontext *context,
739 struct ib_udata *udata); 740 struct ib_udata *udata);
740 741
741int ipath_destroy_cq(struct ib_cq *ibcq); 742int ipath_destroy_cq(struct ib_cq *ibcq);
742 743
743int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify notify); 744int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags);
744 745
745int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata); 746int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
746 747
@@ -768,6 +769,15 @@ int ipath_dealloc_fmr(struct ib_fmr *ibfmr);
768 769
769void ipath_release_mmap_info(struct kref *ref); 770void ipath_release_mmap_info(struct kref *ref);
770 771
772struct ipath_mmap_info *ipath_create_mmap_info(struct ipath_ibdev *dev,
773 u32 size,
774 struct ib_ucontext *context,
775 void *obj);
776
777void ipath_update_mmap_info(struct ipath_ibdev *dev,
778 struct ipath_mmap_info *ip,
779 u32 size, void *obj);
780
771int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); 781int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
772 782
773void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev); 783void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev);
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index efd79ef109a6..cf0868f6e965 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -726,11 +726,12 @@ repoll:
726 return err == 0 || err == -EAGAIN ? npolled : err; 726 return err == 0 || err == -EAGAIN ? npolled : err;
727} 727}
728 728
729int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify) 729int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags)
730{ 730{
731 __be32 doorbell[2]; 731 __be32 doorbell[2];
732 732
733 doorbell[0] = cpu_to_be32((notify == IB_CQ_SOLICITED ? 733 doorbell[0] = cpu_to_be32(((flags & IB_CQ_SOLICITED_MASK) ==
734 IB_CQ_SOLICITED ?
734 MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL : 735 MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL :
735 MTHCA_TAVOR_CQ_DB_REQ_NOT) | 736 MTHCA_TAVOR_CQ_DB_REQ_NOT) |
736 to_mcq(cq)->cqn); 737 to_mcq(cq)->cqn);
@@ -743,7 +744,7 @@ int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify)
743 return 0; 744 return 0;
744} 745}
745 746
746int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) 747int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
747{ 748{
748 struct mthca_cq *cq = to_mcq(ibcq); 749 struct mthca_cq *cq = to_mcq(ibcq);
749 __be32 doorbell[2]; 750 __be32 doorbell[2];
@@ -755,7 +756,8 @@ int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
755 756
756 doorbell[0] = ci; 757 doorbell[0] = ci;
757 doorbell[1] = cpu_to_be32((cq->cqn << 8) | (2 << 5) | (sn << 3) | 758 doorbell[1] = cpu_to_be32((cq->cqn << 8) | (2 << 5) | (sn << 3) |
758 (notify == IB_CQ_SOLICITED ? 1 : 2)); 759 ((flags & IB_CQ_SOLICITED_MASK) ==
760 IB_CQ_SOLICITED ? 1 : 2));
759 761
760 mthca_write_db_rec(doorbell, cq->arm_db); 762 mthca_write_db_rec(doorbell, cq->arm_db);
761 763
@@ -766,7 +768,7 @@ int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
766 wmb(); 768 wmb();
767 769
768 doorbell[0] = cpu_to_be32((sn << 28) | 770 doorbell[0] = cpu_to_be32((sn << 28) |
769 (notify == IB_CQ_SOLICITED ? 771 ((flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ?
770 MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL : 772 MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL :
771 MTHCA_ARBEL_CQ_DB_REQ_NOT) | 773 MTHCA_ARBEL_CQ_DB_REQ_NOT) |
772 cq->cqn); 774 cq->cqn);
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index b7e42efaf43d..9bae3cc60603 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -495,8 +495,8 @@ void mthca_unmap_eq_icm(struct mthca_dev *dev);
495 495
496int mthca_poll_cq(struct ib_cq *ibcq, int num_entries, 496int mthca_poll_cq(struct ib_cq *ibcq, int num_entries,
497 struct ib_wc *entry); 497 struct ib_wc *entry);
498int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify); 498int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
499int mthca_arbel_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify); 499int mthca_arbel_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
500int mthca_init_cq(struct mthca_dev *dev, int nent, 500int mthca_init_cq(struct mthca_dev *dev, int nent,
501 struct mthca_ucontext *ctx, u32 pdn, 501 struct mthca_ucontext *ctx, u32 pdn,
502 struct mthca_cq *cq); 502 struct mthca_cq *cq);
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h
index 594144145f45..a1ab06847b75 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.h
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.h
@@ -38,7 +38,6 @@
38#define MTHCA_MEMFREE_H 38#define MTHCA_MEMFREE_H
39 39
40#include <linux/list.h> 40#include <linux/list.h>
41#include <linux/pci.h>
42#include <linux/mutex.h> 41#include <linux/mutex.h>
43 42
44#define MTHCA_ICM_CHUNK_LEN \ 43#define MTHCA_ICM_CHUNK_LEN \
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 47e6fd46d9c2..1c05486c3c68 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -663,6 +663,7 @@ static int mthca_destroy_qp(struct ib_qp *qp)
663} 663}
664 664
665static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries, 665static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
666 int comp_vector,
666 struct ib_ucontext *context, 667 struct ib_ucontext *context,
667 struct ib_udata *udata) 668 struct ib_udata *udata)
668{ 669{
@@ -1292,6 +1293,7 @@ int mthca_register_device(struct mthca_dev *dev)
1292 (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); 1293 (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
1293 dev->ib_dev.node_type = RDMA_NODE_IB_CA; 1294 dev->ib_dev.node_type = RDMA_NODE_IB_CA;
1294 dev->ib_dev.phys_port_cnt = dev->limits.num_ports; 1295 dev->ib_dev.phys_port_cnt = dev->limits.num_ports;
1296 dev->ib_dev.num_comp_vectors = 1;
1295 dev->ib_dev.dma_device = &dev->pdev->dev; 1297 dev->ib_dev.dma_device = &dev->pdev->dev;
1296 dev->ib_dev.query_device = mthca_query_device; 1298 dev->ib_dev.query_device = mthca_query_device;
1297 dev->ib_dev.query_port = mthca_query_port; 1299 dev->ib_dev.query_port = mthca_query_port;
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 8fe6fee7a97a..fee60c852d14 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -701,6 +701,19 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
701 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH); 701 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH);
702 } 702 }
703 703
704 if (ibqp->qp_type == IB_QPT_RC &&
705 cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
706 u8 sched_queue = ibqp->uobject ? 0x2 : 0x1;
707
708 if (mthca_is_memfree(dev))
709 qp_context->rlkey_arbel_sched_queue |= sched_queue;
710 else
711 qp_context->tavor_sched_queue |= cpu_to_be32(sched_queue);
712
713 qp_param->opt_param_mask |=
714 cpu_to_be32(MTHCA_QP_OPTPAR_SCHED_QUEUE);
715 }
716
704 if (attr_mask & IB_QP_TIMEOUT) { 717 if (attr_mask & IB_QP_TIMEOUT) {
705 qp_context->pri_path.ackto = attr->timeout << 3; 718 qp_context->pri_path.ackto = attr->timeout << 3;
706 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_ACK_TIMEOUT); 719 qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_ACK_TIMEOUT);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index fd558267d1cb..87310eeb6df0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -41,7 +41,6 @@
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <linux/netdevice.h> 42#include <linux/netdevice.h>
43#include <linux/workqueue.h> 43#include <linux/workqueue.h>
44#include <linux/pci.h>
45#include <linux/kref.h> 44#include <linux/kref.h>
46#include <linux/if_infiniband.h> 45#include <linux/if_infiniband.h>
47#include <linux/mutex.h> 46#include <linux/mutex.h>
@@ -311,6 +310,7 @@ extern struct workqueue_struct *ipoib_workqueue;
311 310
312/* functions */ 311/* functions */
313 312
313int ipoib_poll(struct net_device *dev, int *budget);
314void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); 314void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr);
315 315
316struct ipoib_ah *ipoib_create_ah(struct net_device *dev, 316struct ipoib_ah *ipoib_create_ah(struct net_device *dev,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 0c4e59b906cd..785bc8505f2a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -370,7 +370,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
370 370
371 if (!likely(wr_id & IPOIB_CM_RX_UPDATE_MASK)) { 371 if (!likely(wr_id & IPOIB_CM_RX_UPDATE_MASK)) {
372 p = wc->qp->qp_context; 372 p = wc->qp->qp_context;
373 if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) { 373 if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) {
374 spin_lock_irqsave(&priv->lock, flags); 374 spin_lock_irqsave(&priv->lock, flags);
375 p->jiffies = jiffies; 375 p->jiffies = jiffies;
376 /* Move this entry to list head, but do 376 /* Move this entry to list head, but do
@@ -416,7 +416,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
416 skb->dev = dev; 416 skb->dev = dev;
417 /* XXX get correct PACKET_ type here */ 417 /* XXX get correct PACKET_ type here */
418 skb->pkt_type = PACKET_HOST; 418 skb->pkt_type = PACKET_HOST;
419 netif_rx_ni(skb); 419 netif_receive_skb(skb);
420 420
421repost: 421repost:
422 if (unlikely(ipoib_cm_post_receive(dev, wr_id))) 422 if (unlikely(ipoib_cm_post_receive(dev, wr_id)))
@@ -592,7 +592,9 @@ int ipoib_cm_dev_open(struct net_device *dev)
592 priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); 592 priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev);
593 if (IS_ERR(priv->cm.id)) { 593 if (IS_ERR(priv->cm.id)) {
594 printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); 594 printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name);
595 return IS_ERR(priv->cm.id); 595 ret = PTR_ERR(priv->cm.id);
596 priv->cm.id = NULL;
597 return ret;
596 } 598 }
597 599
598 ret = ib_cm_listen(priv->cm.id, cpu_to_be64(IPOIB_CM_IETF_ID | priv->qp->qp_num), 600 ret = ib_cm_listen(priv->cm.id, cpu_to_be64(IPOIB_CM_IETF_ID | priv->qp->qp_num),
@@ -601,6 +603,7 @@ int ipoib_cm_dev_open(struct net_device *dev)
601 printk(KERN_WARNING "%s: failed to listen on ID 0x%llx\n", priv->ca->name, 603 printk(KERN_WARNING "%s: failed to listen on ID 0x%llx\n", priv->ca->name,
602 IPOIB_CM_IETF_ID | priv->qp->qp_num); 604 IPOIB_CM_IETF_ID | priv->qp->qp_num);
603 ib_destroy_cm_id(priv->cm.id); 605 ib_destroy_cm_id(priv->cm.id);
606 priv->cm.id = NULL;
604 return ret; 607 return ret;
605 } 608 }
606 return 0; 609 return 0;
@@ -611,10 +614,11 @@ void ipoib_cm_dev_stop(struct net_device *dev)
611 struct ipoib_dev_priv *priv = netdev_priv(dev); 614 struct ipoib_dev_priv *priv = netdev_priv(dev);
612 struct ipoib_cm_rx *p; 615 struct ipoib_cm_rx *p;
613 616
614 if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) 617 if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id)
615 return; 618 return;
616 619
617 ib_destroy_cm_id(priv->cm.id); 620 ib_destroy_cm_id(priv->cm.id);
621 priv->cm.id = NULL;
618 spin_lock_irq(&priv->lock); 622 spin_lock_irq(&priv->lock);
619 while (!list_empty(&priv->cm.passive_ids)) { 623 while (!list_empty(&priv->cm.passive_ids)) {
620 p = list_entry(priv->cm.passive_ids.next, typeof(*p), list); 624 p = list_entry(priv->cm.passive_ids.next, typeof(*p), list);
@@ -789,7 +793,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
789 } 793 }
790 794
791 p->cq = ib_create_cq(priv->ca, ipoib_cm_tx_completion, NULL, p, 795 p->cq = ib_create_cq(priv->ca, ipoib_cm_tx_completion, NULL, p,
792 ipoib_sendq_size + 1); 796 ipoib_sendq_size + 1, 0);
793 if (IS_ERR(p->cq)) { 797 if (IS_ERR(p->cq)) {
794 ret = PTR_ERR(p->cq); 798 ret = PTR_ERR(p->cq);
795 ipoib_warn(priv, "failed to allocate tx cq: %d\n", ret); 799 ipoib_warn(priv, "failed to allocate tx cq: %d\n", ret);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 1bdb9101911a..68d72c6f7ffb 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -226,7 +226,7 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
226 skb->dev = dev; 226 skb->dev = dev;
227 /* XXX get correct PACKET_ type here */ 227 /* XXX get correct PACKET_ type here */
228 skb->pkt_type = PACKET_HOST; 228 skb->pkt_type = PACKET_HOST;
229 netif_rx_ni(skb); 229 netif_receive_skb(skb);
230 } else { 230 } else {
231 ipoib_dbg_data(priv, "dropping loopback packet\n"); 231 ipoib_dbg_data(priv, "dropping loopback packet\n");
232 dev_kfree_skb_any(skb); 232 dev_kfree_skb_any(skb);
@@ -280,28 +280,63 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
280 wc->status, wr_id, wc->vendor_err); 280 wc->status, wr_id, wc->vendor_err);
281} 281}
282 282
283static void ipoib_ib_handle_wc(struct net_device *dev, struct ib_wc *wc) 283int ipoib_poll(struct net_device *dev, int *budget)
284{ 284{
285 if (wc->wr_id & IPOIB_CM_OP_SRQ) 285 struct ipoib_dev_priv *priv = netdev_priv(dev);
286 ipoib_cm_handle_rx_wc(dev, wc); 286 int max = min(*budget, dev->quota);
287 else if (wc->wr_id & IPOIB_OP_RECV) 287 int done;
288 ipoib_ib_handle_rx_wc(dev, wc); 288 int t;
289 else 289 int empty;
290 ipoib_ib_handle_tx_wc(dev, wc); 290 int n, i;
291
292 done = 0;
293 empty = 0;
294
295 while (max) {
296 t = min(IPOIB_NUM_WC, max);
297 n = ib_poll_cq(priv->cq, t, priv->ibwc);
298
299 for (i = 0; i < n; ++i) {
300 struct ib_wc *wc = priv->ibwc + i;
301
302 if (wc->wr_id & IPOIB_CM_OP_SRQ) {
303 ++done;
304 --max;
305 ipoib_cm_handle_rx_wc(dev, wc);
306 } else if (wc->wr_id & IPOIB_OP_RECV) {
307 ++done;
308 --max;
309 ipoib_ib_handle_rx_wc(dev, wc);
310 } else
311 ipoib_ib_handle_tx_wc(dev, wc);
312 }
313
314 if (n != t) {
315 empty = 1;
316 break;
317 }
318 }
319
320 dev->quota -= done;
321 *budget -= done;
322
323 if (empty) {
324 netif_rx_complete(dev);
325 if (unlikely(ib_req_notify_cq(priv->cq,
326 IB_CQ_NEXT_COMP |
327 IB_CQ_REPORT_MISSED_EVENTS)) &&
328 netif_rx_reschedule(dev, 0))
329 return 1;
330
331 return 0;
332 }
333
334 return 1;
291} 335}
292 336
293void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr) 337void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
294{ 338{
295 struct net_device *dev = (struct net_device *) dev_ptr; 339 netif_rx_schedule(dev_ptr);
296 struct ipoib_dev_priv *priv = netdev_priv(dev);
297 int n, i;
298
299 ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
300 do {
301 n = ib_poll_cq(cq, IPOIB_NUM_WC, priv->ibwc);
302 for (i = 0; i < n; ++i)
303 ipoib_ib_handle_wc(dev, priv->ibwc + i);
304 } while (n == IPOIB_NUM_WC);
305} 340}
306 341
307static inline int post_send(struct ipoib_dev_priv *priv, 342static inline int post_send(struct ipoib_dev_priv *priv,
@@ -514,9 +549,10 @@ int ipoib_ib_dev_stop(struct net_device *dev)
514 struct ib_qp_attr qp_attr; 549 struct ib_qp_attr qp_attr;
515 unsigned long begin; 550 unsigned long begin;
516 struct ipoib_tx_buf *tx_req; 551 struct ipoib_tx_buf *tx_req;
517 int i; 552 int i, n;
518 553
519 clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); 554 clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags);
555 netif_poll_disable(dev);
520 556
521 ipoib_cm_dev_stop(dev); 557 ipoib_cm_dev_stop(dev);
522 558
@@ -568,6 +604,18 @@ int ipoib_ib_dev_stop(struct net_device *dev)
568 goto timeout; 604 goto timeout;
569 } 605 }
570 606
607 do {
608 n = ib_poll_cq(priv->cq, IPOIB_NUM_WC, priv->ibwc);
609 for (i = 0; i < n; ++i) {
610 if (priv->ibwc[i].wr_id & IPOIB_CM_OP_SRQ)
611 ipoib_cm_handle_rx_wc(dev, priv->ibwc + i);
612 else if (priv->ibwc[i].wr_id & IPOIB_OP_RECV)
613 ipoib_ib_handle_rx_wc(dev, priv->ibwc + i);
614 else
615 ipoib_ib_handle_tx_wc(dev, priv->ibwc + i);
616 }
617 } while (n == IPOIB_NUM_WC);
618
571 msleep(1); 619 msleep(1);
572 } 620 }
573 621
@@ -596,6 +644,9 @@ timeout:
596 msleep(1); 644 msleep(1);
597 } 645 }
598 646
647 netif_poll_enable(dev);
648 ib_req_notify_cq(priv->cq, IB_CQ_NEXT_COMP);
649
599 return 0; 650 return 0;
600} 651}
601 652
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index b4c380c5a3ba..0a428f2b05c7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -948,6 +948,8 @@ static void ipoib_setup(struct net_device *dev)
948 dev->hard_header = ipoib_hard_header; 948 dev->hard_header = ipoib_hard_header;
949 dev->set_multicast_list = ipoib_set_mcast_list; 949 dev->set_multicast_list = ipoib_set_mcast_list;
950 dev->neigh_setup = ipoib_neigh_setup_dev; 950 dev->neigh_setup = ipoib_neigh_setup_dev;
951 dev->poll = ipoib_poll;
952 dev->weight = 100;
951 953
952 dev->watchdog_timeo = HZ; 954 dev->watchdog_timeo = HZ;
953 955
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 7f3ec205e35f..5c3c6a43a52b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -187,7 +187,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
187 if (!ret) 187 if (!ret)
188 size += ipoib_recvq_size; 188 size += ipoib_recvq_size;
189 189
190 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size); 190 priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size, 0);
191 if (IS_ERR(priv->cq)) { 191 if (IS_ERR(priv->cq)) {
192 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name); 192 printk(KERN_WARNING "%s: failed to create CQ\n", ca->name);
193 goto out_free_mr; 193 goto out_free_mr;
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 278fcbccc2d9..3651072f6c1f 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -201,7 +201,7 @@ static int iser_post_receive_control(struct iscsi_conn *conn)
201 * what's common for both schemes is that the connection is not started 201 * what's common for both schemes is that the connection is not started
202 */ 202 */
203 if (conn->c_stage != ISCSI_CONN_STARTED) 203 if (conn->c_stage != ISCSI_CONN_STARTED)
204 rx_data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; 204 rx_data_size = ISCSI_DEF_MAX_RECV_SEG_LEN;
205 else /* FIXME till user space sets conn->max_recv_dlength correctly */ 205 else /* FIXME till user space sets conn->max_recv_dlength correctly */
206 rx_data_size = 128; 206 rx_data_size = 128;
207 207
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 1fc967464a28..89d6008bb673 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -76,7 +76,7 @@ static int iser_create_device_ib_res(struct iser_device *device)
76 iser_cq_callback, 76 iser_cq_callback,
77 iser_cq_event_callback, 77 iser_cq_event_callback,
78 (void *)device, 78 (void *)device,
79 ISER_MAX_CQ_LEN); 79 ISER_MAX_CQ_LEN, 0);
80 if (IS_ERR(device->cq)) 80 if (IS_ERR(device->cq))
81 goto cq_err; 81 goto cq_err;
82 82
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 5e8ac577f0ad..39bf057fbc43 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -197,7 +197,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
197 return -ENOMEM; 197 return -ENOMEM;
198 198
199 target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion, 199 target->cq = ib_create_cq(target->srp_host->dev->dev, srp_completion,
200 NULL, target, SRP_CQ_SIZE); 200 NULL, target, SRP_CQ_SIZE, 0);
201 if (IS_ERR(target->cq)) { 201 if (IS_ERR(target->cq)) {
202 ret = PTR_ERR(target->cq); 202 ret = PTR_ERR(target->cq);
203 goto out; 203 goto out;
@@ -1468,6 +1468,25 @@ static ssize_t show_dgid(struct class_device *cdev, char *buf)
1468 be16_to_cpu(((__be16 *) target->path.dgid.raw)[7])); 1468 be16_to_cpu(((__be16 *) target->path.dgid.raw)[7]));
1469} 1469}
1470 1470
1471static ssize_t show_orig_dgid(struct class_device *cdev, char *buf)
1472{
1473 struct srp_target_port *target = host_to_target(class_to_shost(cdev));
1474
1475 if (target->state == SRP_TARGET_DEAD ||
1476 target->state == SRP_TARGET_REMOVED)
1477 return -ENODEV;
1478
1479 return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
1480 be16_to_cpu(target->orig_dgid[0]),
1481 be16_to_cpu(target->orig_dgid[1]),
1482 be16_to_cpu(target->orig_dgid[2]),
1483 be16_to_cpu(target->orig_dgid[3]),
1484 be16_to_cpu(target->orig_dgid[4]),
1485 be16_to_cpu(target->orig_dgid[5]),
1486 be16_to_cpu(target->orig_dgid[6]),
1487 be16_to_cpu(target->orig_dgid[7]));
1488}
1489
1471static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf) 1490static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
1472{ 1491{
1473 struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1492 struct srp_target_port *target = host_to_target(class_to_shost(cdev));
@@ -1498,6 +1517,7 @@ static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL);
1498static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL); 1517static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL);
1499static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); 1518static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
1500static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL); 1519static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL);
1520static CLASS_DEVICE_ATTR(orig_dgid, S_IRUGO, show_orig_dgid, NULL);
1501static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL); 1521static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
1502static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL); 1522static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL);
1503static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL); 1523static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL);
@@ -1508,6 +1528,7 @@ static struct class_device_attribute *srp_host_attrs[] = {
1508 &class_device_attr_service_id, 1528 &class_device_attr_service_id,
1509 &class_device_attr_pkey, 1529 &class_device_attr_pkey,
1510 &class_device_attr_dgid, 1530 &class_device_attr_dgid,
1531 &class_device_attr_orig_dgid,
1511 &class_device_attr_zero_req_lim, 1532 &class_device_attr_zero_req_lim,
1512 &class_device_attr_local_ib_port, 1533 &class_device_attr_local_ib_port,
1513 &class_device_attr_local_ib_device, 1534 &class_device_attr_local_ib_device,
@@ -1516,7 +1537,8 @@ static struct class_device_attribute *srp_host_attrs[] = {
1516 1537
1517static struct scsi_host_template srp_template = { 1538static struct scsi_host_template srp_template = {
1518 .module = THIS_MODULE, 1539 .module = THIS_MODULE,
1519 .name = DRV_NAME, 1540 .name = "InfiniBand SRP initiator",
1541 .proc_name = DRV_NAME,
1520 .info = srp_target_info, 1542 .info = srp_target_info,
1521 .queuecommand = srp_queuecommand, 1543 .queuecommand = srp_queuecommand,
1522 .eh_abort_handler = srp_abort, 1544 .eh_abort_handler = srp_abort,
@@ -1662,6 +1684,7 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1662 target->path.dgid.raw[i] = simple_strtoul(dgid, NULL, 16); 1684 target->path.dgid.raw[i] = simple_strtoul(dgid, NULL, 16);
1663 } 1685 }
1664 kfree(p); 1686 kfree(p);
1687 memcpy(target->orig_dgid, target->path.dgid.raw, 16);
1665 break; 1688 break;
1666 1689
1667 case SRP_OPT_PKEY: 1690 case SRP_OPT_PKEY:
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index 2f3319c719a5..1d53c7bc368f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -129,6 +129,7 @@ struct srp_target_port {
129 unsigned int scsi_id; 129 unsigned int scsi_id;
130 130
131 struct ib_sa_path_rec path; 131 struct ib_sa_path_rec path;
132 __be16 orig_dgid[8];
132 struct ib_sa_query *path_query; 133 struct ib_sa_query *path_query;
133 int path_query_id; 134 int path_query_id;
134 135
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index da575deb3c7a..b4cd10653c4f 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
13obj-$(CONFIG_INPUT_JOYDEV) += joydev.o 13obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
14obj-$(CONFIG_INPUT_EVDEV) += evdev.o 14obj-$(CONFIG_INPUT_EVDEV) += evdev.o
15obj-$(CONFIG_INPUT_TSDEV) += tsdev.o 15obj-$(CONFIG_INPUT_TSDEV) += tsdev.o
16obj-$(CONFIG_INPUT_POWER) += power.o
17obj-$(CONFIG_INPUT_EVBUG) += evbug.o 16obj-$(CONFIG_INPUT_EVBUG) += evbug.o
18 17
19obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/ 18obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c
index 5a9653c3128a..c21f2f127234 100644
--- a/drivers/input/evbug.c
+++ b/drivers/input/evbug.c
@@ -38,31 +38,43 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
38MODULE_DESCRIPTION("Input driver event debug module"); 38MODULE_DESCRIPTION("Input driver event debug module");
39MODULE_LICENSE("GPL"); 39MODULE_LICENSE("GPL");
40 40
41static char evbug_name[] = "evbug";
42
43static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) 41static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
44{ 42{
45 printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", 43 printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n",
46 handle->dev->phys, type, code, value); 44 handle->dev->phys, type, code, value);
47} 45}
48 46
49static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, 47static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
50 const struct input_device_id *id) 48 const struct input_device_id *id)
51{ 49{
52 struct input_handle *handle; 50 struct input_handle *handle;
51 int error;
53 52
54 if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) 53 handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
55 return NULL; 54 if (!handle)
55 return -ENOMEM;
56 56
57 handle->dev = dev; 57 handle->dev = dev;
58 handle->handler = handler; 58 handle->handler = handler;
59 handle->name = evbug_name; 59 handle->name = "evbug";
60
61 error = input_register_handle(handle);
62 if (error)
63 goto err_free_handle;
60 64
61 input_open_device(handle); 65 error = input_open_device(handle);
66 if (error)
67 goto err_unregister_handle;
62 68
63 printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); 69 printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys);
64 70
65 return handle; 71 return 0;
72
73 err_unregister_handle:
74 input_unregister_handle(handle);
75 err_free_handle:
76 kfree(handle);
77 return error;
66} 78}
67 79
68static void evbug_disconnect(struct input_handle *handle) 80static void evbug_disconnect(struct input_handle *handle)
@@ -70,7 +82,7 @@ static void evbug_disconnect(struct input_handle *handle)
70 printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); 82 printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys);
71 83
72 input_close_device(handle); 84 input_close_device(handle);
73 85 input_unregister_handle(handle);
74 kfree(handle); 86 kfree(handle);
75} 87}
76 88
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 6439f378f6cc..1f6fcec0c6fc 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -29,11 +29,11 @@ struct evdev {
29 char name[16]; 29 char name[16];
30 struct input_handle handle; 30 struct input_handle handle;
31 wait_queue_head_t wait; 31 wait_queue_head_t wait;
32 struct evdev_list *grab; 32 struct evdev_client *grab;
33 struct list_head list; 33 struct list_head client_list;
34}; 34};
35 35
36struct evdev_list { 36struct evdev_client {
37 struct input_event buffer[EVDEV_BUFFER_SIZE]; 37 struct input_event buffer[EVDEV_BUFFER_SIZE];
38 int head; 38 int head;
39 int tail; 39 int tail;
@@ -47,28 +47,28 @@ static struct evdev *evdev_table[EVDEV_MINORS];
47static void evdev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) 47static void evdev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
48{ 48{
49 struct evdev *evdev = handle->private; 49 struct evdev *evdev = handle->private;
50 struct evdev_list *list; 50 struct evdev_client *client;
51 51
52 if (evdev->grab) { 52 if (evdev->grab) {
53 list = evdev->grab; 53 client = evdev->grab;
54 54
55 do_gettimeofday(&list->buffer[list->head].time); 55 do_gettimeofday(&client->buffer[client->head].time);
56 list->buffer[list->head].type = type; 56 client->buffer[client->head].type = type;
57 list->buffer[list->head].code = code; 57 client->buffer[client->head].code = code;
58 list->buffer[list->head].value = value; 58 client->buffer[client->head].value = value;
59 list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1); 59 client->head = (client->head + 1) & (EVDEV_BUFFER_SIZE - 1);
60 60
61 kill_fasync(&list->fasync, SIGIO, POLL_IN); 61 kill_fasync(&client->fasync, SIGIO, POLL_IN);
62 } else 62 } else
63 list_for_each_entry(list, &evdev->list, node) { 63 list_for_each_entry(client, &evdev->client_list, node) {
64 64
65 do_gettimeofday(&list->buffer[list->head].time); 65 do_gettimeofday(&client->buffer[client->head].time);
66 list->buffer[list->head].type = type; 66 client->buffer[client->head].type = type;
67 list->buffer[list->head].code = code; 67 client->buffer[client->head].code = code;
68 list->buffer[list->head].value = value; 68 client->buffer[client->head].value = value;
69 list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1); 69 client->head = (client->head + 1) & (EVDEV_BUFFER_SIZE - 1);
70 70
71 kill_fasync(&list->fasync, SIGIO, POLL_IN); 71 kill_fasync(&client->fasync, SIGIO, POLL_IN);
72 } 72 }
73 73
74 wake_up_interruptible(&evdev->wait); 74 wake_up_interruptible(&evdev->wait);
@@ -76,22 +76,23 @@ static void evdev_event(struct input_handle *handle, unsigned int type, unsigned
76 76
77static int evdev_fasync(int fd, struct file *file, int on) 77static int evdev_fasync(int fd, struct file *file, int on)
78{ 78{
79 struct evdev_client *client = file->private_data;
79 int retval; 80 int retval;
80 struct evdev_list *list = file->private_data;
81 81
82 retval = fasync_helper(fd, file, on, &list->fasync); 82 retval = fasync_helper(fd, file, on, &client->fasync);
83 83
84 return retval < 0 ? retval : 0; 84 return retval < 0 ? retval : 0;
85} 85}
86 86
87static int evdev_flush(struct file *file, fl_owner_t id) 87static int evdev_flush(struct file *file, fl_owner_t id)
88{ 88{
89 struct evdev_list *list = file->private_data; 89 struct evdev_client *client = file->private_data;
90 struct evdev *evdev = client->evdev;
90 91
91 if (!list->evdev->exist) 92 if (!evdev->exist)
92 return -ENODEV; 93 return -ENODEV;
93 94
94 return input_flush_device(&list->evdev->handle, file); 95 return input_flush_device(&evdev->handle, file);
95} 96}
96 97
97static void evdev_free(struct evdev *evdev) 98static void evdev_free(struct evdev *evdev)
@@ -100,48 +101,62 @@ static void evdev_free(struct evdev *evdev)
100 kfree(evdev); 101 kfree(evdev);
101} 102}
102 103
103static int evdev_release(struct inode * inode, struct file * file) 104static int evdev_release(struct inode *inode, struct file *file)
104{ 105{
105 struct evdev_list *list = file->private_data; 106 struct evdev_client *client = file->private_data;
107 struct evdev *evdev = client->evdev;
106 108
107 if (list->evdev->grab == list) { 109 if (evdev->grab == client) {
108 input_release_device(&list->evdev->handle); 110 input_release_device(&evdev->handle);
109 list->evdev->grab = NULL; 111 evdev->grab = NULL;
110 } 112 }
111 113
112 evdev_fasync(-1, file, 0); 114 evdev_fasync(-1, file, 0);
113 list_del(&list->node); 115 list_del(&client->node);
116 kfree(client);
114 117
115 if (!--list->evdev->open) { 118 if (!--evdev->open) {
116 if (list->evdev->exist) 119 if (evdev->exist)
117 input_close_device(&list->evdev->handle); 120 input_close_device(&evdev->handle);
118 else 121 else
119 evdev_free(list->evdev); 122 evdev_free(evdev);
120 } 123 }
121 124
122 kfree(list);
123 return 0; 125 return 0;
124} 126}
125 127
126static int evdev_open(struct inode * inode, struct file * file) 128static int evdev_open(struct inode *inode, struct file *file)
127{ 129{
128 struct evdev_list *list; 130 struct evdev_client *client;
131 struct evdev *evdev;
129 int i = iminor(inode) - EVDEV_MINOR_BASE; 132 int i = iminor(inode) - EVDEV_MINOR_BASE;
133 int error;
130 134
131 if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) 135 if (i >= EVDEV_MINORS)
132 return -ENODEV; 136 return -ENODEV;
133 137
134 if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) 138 evdev = evdev_table[i];
139
140 if (!evdev || !evdev->exist)
141 return -ENODEV;
142
143 client = kzalloc(sizeof(struct evdev_client), GFP_KERNEL);
144 if (!client)
135 return -ENOMEM; 145 return -ENOMEM;
136 146
137 list->evdev = evdev_table[i]; 147 client->evdev = evdev;
138 list_add_tail(&list->node, &evdev_table[i]->list); 148 list_add_tail(&client->node, &evdev->client_list);
139 file->private_data = list;
140 149
141 if (!list->evdev->open++) 150 if (!evdev->open++ && evdev->exist) {
142 if (list->evdev->exist) 151 error = input_open_device(&evdev->handle);
143 input_open_device(&list->evdev->handle); 152 if (error) {
153 list_del(&client->node);
154 kfree(client);
155 return error;
156 }
157 }
144 158
159 file->private_data = client;
145 return 0; 160 return 0;
146} 161}
147 162
@@ -243,54 +258,55 @@ static int evdev_event_to_user(char __user *buffer, const struct input_event *ev
243 258
244#endif /* CONFIG_COMPAT */ 259#endif /* CONFIG_COMPAT */
245 260
246static ssize_t evdev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) 261static ssize_t evdev_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
247{ 262{
248 struct evdev_list *list = file->private_data; 263 struct evdev_client *client = file->private_data;
264 struct evdev *evdev = client->evdev;
249 struct input_event event; 265 struct input_event event;
250 int retval = 0; 266 int retval = 0;
251 267
252 if (!list->evdev->exist) 268 if (!evdev->exist)
253 return -ENODEV; 269 return -ENODEV;
254 270
255 while (retval < count) { 271 while (retval < count) {
256 272
257 if (evdev_event_from_user(buffer + retval, &event)) 273 if (evdev_event_from_user(buffer + retval, &event))
258 return -EFAULT; 274 return -EFAULT;
259 input_inject_event(&list->evdev->handle, event.type, event.code, event.value); 275 input_inject_event(&evdev->handle, event.type, event.code, event.value);
260 retval += evdev_event_size(); 276 retval += evdev_event_size();
261 } 277 }
262 278
263 return retval; 279 return retval;
264} 280}
265 281
266static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) 282static ssize_t evdev_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
267{ 283{
268 struct evdev_list *list = file->private_data; 284 struct evdev_client *client = file->private_data;
285 struct evdev *evdev = client->evdev;
269 int retval; 286 int retval;
270 287
271 if (count < evdev_event_size()) 288 if (count < evdev_event_size())
272 return -EINVAL; 289 return -EINVAL;
273 290
274 if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK)) 291 if (client->head == client->tail && evdev->exist && (file->f_flags & O_NONBLOCK))
275 return -EAGAIN; 292 return -EAGAIN;
276 293
277 retval = wait_event_interruptible(list->evdev->wait, 294 retval = wait_event_interruptible(evdev->wait,
278 list->head != list->tail || (!list->evdev->exist)); 295 client->head != client->tail || !evdev->exist);
279
280 if (retval) 296 if (retval)
281 return retval; 297 return retval;
282 298
283 if (!list->evdev->exist) 299 if (!evdev->exist)
284 return -ENODEV; 300 return -ENODEV;
285 301
286 while (list->head != list->tail && retval + evdev_event_size() <= count) { 302 while (client->head != client->tail && retval + evdev_event_size() <= count) {
287 303
288 struct input_event *event = (struct input_event *) list->buffer + list->tail; 304 struct input_event *event = (struct input_event *) client->buffer + client->tail;
289 305
290 if (evdev_event_to_user(buffer + retval, event)) 306 if (evdev_event_to_user(buffer + retval, event))
291 return -EFAULT; 307 return -EFAULT;
292 308
293 list->tail = (list->tail + 1) & (EVDEV_BUFFER_SIZE - 1); 309 client->tail = (client->tail + 1) & (EVDEV_BUFFER_SIZE - 1);
294 retval += evdev_event_size(); 310 retval += evdev_event_size();
295 } 311 }
296 312
@@ -300,11 +316,12 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count
300/* No kernel lock - fine */ 316/* No kernel lock - fine */
301static unsigned int evdev_poll(struct file *file, poll_table *wait) 317static unsigned int evdev_poll(struct file *file, poll_table *wait)
302{ 318{
303 struct evdev_list *list = file->private_data; 319 struct evdev_client *client = file->private_data;
320 struct evdev *evdev = client->evdev;
304 321
305 poll_wait(file, &list->evdev->wait, wait); 322 poll_wait(file, &evdev->wait, wait);
306 return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | 323 return ((client->head == client->tail) ? 0 : (POLLIN | POLLRDNORM)) |
307 (list->evdev->exist ? 0 : (POLLHUP | POLLERR)); 324 (evdev->exist ? 0 : (POLLHUP | POLLERR));
308} 325}
309 326
310#ifdef CONFIG_COMPAT 327#ifdef CONFIG_COMPAT
@@ -387,8 +404,8 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p)
387static long evdev_ioctl_handler(struct file *file, unsigned int cmd, 404static long evdev_ioctl_handler(struct file *file, unsigned int cmd,
388 void __user *p, int compat_mode) 405 void __user *p, int compat_mode)
389{ 406{
390 struct evdev_list *list = file->private_data; 407 struct evdev_client *client = file->private_data;
391 struct evdev *evdev = list->evdev; 408 struct evdev *evdev = client->evdev;
392 struct input_dev *dev = evdev->handle.dev; 409 struct input_dev *dev = evdev->handle.dev;
393 struct input_absinfo abs; 410 struct input_absinfo abs;
394 struct ff_effect effect; 411 struct ff_effect effect;
@@ -434,32 +451,21 @@ static long evdev_ioctl_handler(struct file *file, unsigned int cmd,
434 case EVIOCGKEYCODE: 451 case EVIOCGKEYCODE:
435 if (get_user(t, ip)) 452 if (get_user(t, ip))
436 return -EFAULT; 453 return -EFAULT;
437 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) 454
438 return -EINVAL; 455 error = dev->getkeycode(dev, t, &v);
439 if (put_user(INPUT_KEYCODE(dev, t), ip + 1)) 456 if (error)
457 return error;
458
459 if (put_user(v, ip + 1))
440 return -EFAULT; 460 return -EFAULT;
461
441 return 0; 462 return 0;
442 463
443 case EVIOCSKEYCODE: 464 case EVIOCSKEYCODE:
444 if (get_user(t, ip)) 465 if (get_user(t, ip) || get_user(v, ip + 1))
445 return -EFAULT; 466 return -EFAULT;
446 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize)
447 return -EINVAL;
448 if (get_user(v, ip + 1))
449 return -EFAULT;
450 if (v < 0 || v > KEY_MAX)
451 return -EINVAL;
452 if (dev->keycodesize < sizeof(v) && (v >> (dev->keycodesize * 8)))
453 return -EINVAL;
454
455 u = SET_INPUT_KEYCODE(dev, t, v);
456 clear_bit(u, dev->keybit);
457 set_bit(v, dev->keybit);
458 for (i = 0; i < dev->keycodemax; i++)
459 if (INPUT_KEYCODE(dev, i) == u)
460 set_bit(u, dev->keybit);
461 467
462 return 0; 468 return dev->setkeycode(dev, t, v);
463 469
464 case EVIOCSFF: 470 case EVIOCSFF:
465 if (copy_from_user(&effect, p, sizeof(effect))) 471 if (copy_from_user(&effect, p, sizeof(effect)))
@@ -487,10 +493,10 @@ static long evdev_ioctl_handler(struct file *file, unsigned int cmd,
487 return -EBUSY; 493 return -EBUSY;
488 if (input_grab_device(&evdev->handle)) 494 if (input_grab_device(&evdev->handle))
489 return -EBUSY; 495 return -EBUSY;
490 evdev->grab = list; 496 evdev->grab = client;
491 return 0; 497 return 0;
492 } else { 498 } else {
493 if (evdev->grab != list) 499 if (evdev->grab != client)
494 return -EINVAL; 500 return -EINVAL;
495 input_release_device(&evdev->handle); 501 input_release_device(&evdev->handle);
496 evdev->grab = NULL; 502 evdev->grab = NULL;
@@ -616,23 +622,26 @@ static const struct file_operations evdev_fops = {
616 .flush = evdev_flush 622 .flush = evdev_flush
617}; 623};
618 624
619static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, 625static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
620 const struct input_device_id *id) 626 const struct input_device_id *id)
621{ 627{
622 struct evdev *evdev; 628 struct evdev *evdev;
623 struct class_device *cdev; 629 struct class_device *cdev;
630 dev_t devt;
624 int minor; 631 int minor;
632 int error;
625 633
626 for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++); 634 for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++);
627 if (minor == EVDEV_MINORS) { 635 if (minor == EVDEV_MINORS) {
628 printk(KERN_ERR "evdev: no more free evdev devices\n"); 636 printk(KERN_ERR "evdev: no more free evdev devices\n");
629 return NULL; 637 return -ENFILE;
630 } 638 }
631 639
632 if (!(evdev = kzalloc(sizeof(struct evdev), GFP_KERNEL))) 640 evdev = kzalloc(sizeof(struct evdev), GFP_KERNEL);
633 return NULL; 641 if (!evdev)
642 return -ENOMEM;
634 643
635 INIT_LIST_HEAD(&evdev->list); 644 INIT_LIST_HEAD(&evdev->client_list);
636 init_waitqueue_head(&evdev->wait); 645 init_waitqueue_head(&evdev->wait);
637 646
638 evdev->exist = 1; 647 evdev->exist = 1;
@@ -645,23 +654,45 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct
645 654
646 evdev_table[minor] = evdev; 655 evdev_table[minor] = evdev;
647 656
648 cdev = class_device_create(&input_class, &dev->cdev, 657 devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
649 MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), 658
650 dev->cdev.dev, evdev->name); 659 cdev = class_device_create(&input_class, &dev->cdev, devt,
660 dev->cdev.dev, evdev->name);
661 if (IS_ERR(cdev)) {
662 error = PTR_ERR(cdev);
663 goto err_free_evdev;
664 }
651 665
652 /* temporary symlink to keep userspace happy */ 666 /* temporary symlink to keep userspace happy */
653 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 667 error = sysfs_create_link(&input_class.subsys.kobj,
654 evdev->name); 668 &cdev->kobj, evdev->name);
669 if (error)
670 goto err_cdev_destroy;
671
672 error = input_register_handle(&evdev->handle);
673 if (error)
674 goto err_remove_link;
655 675
656 return &evdev->handle; 676 return 0;
677
678 err_remove_link:
679 sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
680 err_cdev_destroy:
681 class_device_destroy(&input_class, devt);
682 err_free_evdev:
683 kfree(evdev);
684 evdev_table[minor] = NULL;
685 return error;
657} 686}
658 687
659static void evdev_disconnect(struct input_handle *handle) 688static void evdev_disconnect(struct input_handle *handle)
660{ 689{
661 struct evdev *evdev = handle->private; 690 struct evdev *evdev = handle->private;
662 struct evdev_list *list; 691 struct evdev_client *client;
692
693 input_unregister_handle(handle);
663 694
664 sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name); 695 sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
665 class_device_destroy(&input_class, 696 class_device_destroy(&input_class,
666 MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); 697 MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
667 evdev->exist = 0; 698 evdev->exist = 0;
@@ -670,8 +701,8 @@ static void evdev_disconnect(struct input_handle *handle)
670 input_flush_device(handle, NULL); 701 input_flush_device(handle, NULL);
671 input_close_device(handle); 702 input_close_device(handle);
672 wake_up_interruptible(&evdev->wait); 703 wake_up_interruptible(&evdev->wait);
673 list_for_each_entry(list, &evdev->list, node) 704 list_for_each_entry(client, &evdev->client_list, node)
674 kill_fasync(&list->fasync, SIGIO, POLL_HUP); 705 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
675 } else 706 } else
676 evdev_free(evdev); 707 evdev_free(evdev);
677} 708}
diff --git a/drivers/input/input.c b/drivers/input/input.c
index a9a706f8fff9..915e9ab7cab0 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -299,12 +299,87 @@ void input_close_device(struct input_handle *handle)
299} 299}
300EXPORT_SYMBOL(input_close_device); 300EXPORT_SYMBOL(input_close_device);
301 301
302static void input_link_handle(struct input_handle *handle) 302static int input_fetch_keycode(struct input_dev *dev, int scancode)
303{ 303{
304 list_add_tail(&handle->d_node, &handle->dev->h_list); 304 switch (dev->keycodesize) {
305 list_add_tail(&handle->h_node, &handle->handler->h_list); 305 case 1:
306 return ((u8 *)dev->keycode)[scancode];
307
308 case 2:
309 return ((u16 *)dev->keycode)[scancode];
310
311 default:
312 return ((u32 *)dev->keycode)[scancode];
313 }
314}
315
316static int input_default_getkeycode(struct input_dev *dev,
317 int scancode, int *keycode)
318{
319 if (!dev->keycodesize)
320 return -EINVAL;
321
322 if (scancode < 0 || scancode >= dev->keycodemax)
323 return -EINVAL;
324
325 *keycode = input_fetch_keycode(dev, scancode);
326
327 return 0;
328}
329
330static int input_default_setkeycode(struct input_dev *dev,
331 int scancode, int keycode)
332{
333 int old_keycode;
334 int i;
335
336 if (scancode < 0 || scancode >= dev->keycodemax)
337 return -EINVAL;
338
339 if (keycode < 0 || keycode > KEY_MAX)
340 return -EINVAL;
341
342 if (!dev->keycodesize)
343 return -EINVAL;
344
345 if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
346 return -EINVAL;
347
348 switch (dev->keycodesize) {
349 case 1: {
350 u8 *k = (u8 *)dev->keycode;
351 old_keycode = k[scancode];
352 k[scancode] = keycode;
353 break;
354 }
355 case 2: {
356 u16 *k = (u16 *)dev->keycode;
357 old_keycode = k[scancode];
358 k[scancode] = keycode;
359 break;
360 }
361 default: {
362 u32 *k = (u32 *)dev->keycode;
363 old_keycode = k[scancode];
364 k[scancode] = keycode;
365 break;
366 }
367 }
368
369 clear_bit(old_keycode, dev->keybit);
370 set_bit(keycode, dev->keybit);
371
372 for (i = 0; i < dev->keycodemax; i++) {
373 if (input_fetch_keycode(dev, i) == old_keycode) {
374 set_bit(old_keycode, dev->keybit);
375 break; /* Setting the bit twice is useless, so break */
376 }
377 }
378
379 return 0;
306} 380}
307 381
382
308#define MATCH_BIT(bit, max) \ 383#define MATCH_BIT(bit, max) \
309 for (i = 0; i < NBITS(max); i++) \ 384 for (i = 0; i < NBITS(max); i++) \
310 if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \ 385 if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
@@ -351,6 +426,29 @@ static const struct input_device_id *input_match_device(const struct input_devic
351 return NULL; 426 return NULL;
352} 427}
353 428
429static int input_attach_handler(struct input_dev *dev, struct input_handler *handler)
430{
431 const struct input_device_id *id;
432 int error;
433
434 if (handler->blacklist && input_match_device(handler->blacklist, dev))
435 return -ENODEV;
436
437 id = input_match_device(handler->id_table, dev);
438 if (!id)
439 return -ENODEV;
440
441 error = handler->connect(handler, dev, id);
442 if (error && error != -ENODEV)
443 printk(KERN_ERR
444 "input: failed to attach handler %s to device %s, "
445 "error: %d\n",
446 handler->name, kobject_name(&dev->cdev.kobj), error);
447
448 return error;
449}
450
451
354#ifdef CONFIG_PROC_FS 452#ifdef CONFIG_PROC_FS
355 453
356static struct proc_dir_entry *proc_bus_input_dir; 454static struct proc_dir_entry *proc_bus_input_dir;
@@ -439,6 +537,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
439 seq_printf(seq, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); 537 seq_printf(seq, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
440 seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : ""); 538 seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : "");
441 seq_printf(seq, "S: Sysfs=%s\n", path ? path : ""); 539 seq_printf(seq, "S: Sysfs=%s\n", path ? path : "");
540 seq_printf(seq, "U: Uniq=%s\n", dev->uniq ? dev->uniq : "");
442 seq_printf(seq, "H: Handlers="); 541 seq_printf(seq, "H: Handlers=");
443 542
444 list_for_each_entry(handle, &dev->h_list, d_node) 543 list_for_each_entry(handle, &dev->h_list, d_node)
@@ -753,6 +852,13 @@ static struct attribute_group input_dev_caps_attr_group = {
753 .attrs = input_dev_caps_attrs, 852 .attrs = input_dev_caps_attrs,
754}; 853};
755 854
855static struct attribute_group *input_dev_attr_groups[] = {
856 &input_dev_attr_group,
857 &input_dev_id_attr_group,
858 &input_dev_caps_attr_group,
859 NULL
860};
861
756static void input_dev_release(struct class_device *class_dev) 862static void input_dev_release(struct class_device *class_dev)
757{ 863{
758 struct input_dev *dev = to_input_dev(class_dev); 864 struct input_dev *dev = to_input_dev(class_dev);
@@ -906,6 +1012,7 @@ struct input_dev *input_allocate_device(void)
906 dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); 1012 dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
907 if (dev) { 1013 if (dev) {
908 dev->cdev.class = &input_class; 1014 dev->cdev.class = &input_class;
1015 dev->cdev.groups = input_dev_attr_groups;
909 class_device_initialize(&dev->cdev); 1016 class_device_initialize(&dev->cdev);
910 mutex_init(&dev->mutex); 1017 mutex_init(&dev->mutex);
911 INIT_LIST_HEAD(&dev->h_list); 1018 INIT_LIST_HEAD(&dev->h_list);
@@ -934,23 +1041,71 @@ EXPORT_SYMBOL(input_allocate_device);
934 */ 1041 */
935void input_free_device(struct input_dev *dev) 1042void input_free_device(struct input_dev *dev)
936{ 1043{
937 if (dev) { 1044 if (dev)
938
939 mutex_lock(&dev->mutex);
940 dev->name = dev->phys = dev->uniq = NULL;
941 mutex_unlock(&dev->mutex);
942
943 input_put_device(dev); 1045 input_put_device(dev);
944 }
945} 1046}
946EXPORT_SYMBOL(input_free_device); 1047EXPORT_SYMBOL(input_free_device);
947 1048
1049/**
1050 * input_set_capability - mark device as capable of a certain event
1051 * @dev: device that is capable of emitting or accepting event
1052 * @type: type of the event (EV_KEY, EV_REL, etc...)
1053 * @code: event code
1054 *
1055 * In addition to setting up corresponding bit in appropriate capability
1056 * bitmap the function also adjusts dev->evbit.
1057 */
1058void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code)
1059{
1060 switch (type) {
1061 case EV_KEY:
1062 __set_bit(code, dev->keybit);
1063 break;
1064
1065 case EV_REL:
1066 __set_bit(code, dev->relbit);
1067 break;
1068
1069 case EV_ABS:
1070 __set_bit(code, dev->absbit);
1071 break;
1072
1073 case EV_MSC:
1074 __set_bit(code, dev->mscbit);
1075 break;
1076
1077 case EV_SW:
1078 __set_bit(code, dev->swbit);
1079 break;
1080
1081 case EV_LED:
1082 __set_bit(code, dev->ledbit);
1083 break;
1084
1085 case EV_SND:
1086 __set_bit(code, dev->sndbit);
1087 break;
1088
1089 case EV_FF:
1090 __set_bit(code, dev->ffbit);
1091 break;
1092
1093 default:
1094 printk(KERN_ERR
1095 "input_set_capability: unknown type %u (code %u)\n",
1096 type, code);
1097 dump_stack();
1098 return;
1099 }
1100
1101 __set_bit(type, dev->evbit);
1102}
1103EXPORT_SYMBOL(input_set_capability);
1104
948int input_register_device(struct input_dev *dev) 1105int input_register_device(struct input_dev *dev)
949{ 1106{
950 static atomic_t input_no = ATOMIC_INIT(0); 1107 static atomic_t input_no = ATOMIC_INIT(0);
951 struct input_handle *handle;
952 struct input_handler *handler; 1108 struct input_handler *handler;
953 const struct input_device_id *id;
954 const char *path; 1109 const char *path;
955 int error; 1110 int error;
956 1111
@@ -969,55 +1124,41 @@ int input_register_device(struct input_dev *dev)
969 dev->rep[REP_PERIOD] = 33; 1124 dev->rep[REP_PERIOD] = 33;
970 } 1125 }
971 1126
1127 if (!dev->getkeycode)
1128 dev->getkeycode = input_default_getkeycode;
1129
1130 if (!dev->setkeycode)
1131 dev->setkeycode = input_default_setkeycode;
1132
972 list_add_tail(&dev->node, &input_dev_list); 1133 list_add_tail(&dev->node, &input_dev_list);
973 1134
974 snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), 1135 snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id),
975 "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); 1136 "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1);
976 1137
1138 if (!dev->cdev.dev)
1139 dev->cdev.dev = dev->dev.parent;
1140
977 error = class_device_add(&dev->cdev); 1141 error = class_device_add(&dev->cdev);
978 if (error) 1142 if (error)
979 return error; 1143 return error;
980 1144
981 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group);
982 if (error)
983 goto fail1;
984
985 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group);
986 if (error)
987 goto fail2;
988
989 error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
990 if (error)
991 goto fail3;
992
993 path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); 1145 path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL);
994 printk(KERN_INFO "input: %s as %s\n", 1146 printk(KERN_INFO "input: %s as %s\n",
995 dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); 1147 dev->name ? dev->name : "Unspecified device", path ? path : "N/A");
996 kfree(path); 1148 kfree(path);
997 1149
998 list_for_each_entry(handler, &input_handler_list, node) 1150 list_for_each_entry(handler, &input_handler_list, node)
999 if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) 1151 input_attach_handler(dev, handler);
1000 if ((id = input_match_device(handler->id_table, dev)))
1001 if ((handle = handler->connect(handler, dev, id))) {
1002 input_link_handle(handle);
1003 if (handler->start)
1004 handler->start(handle);
1005 }
1006 1152
1007 input_wakeup_procfs_readers(); 1153 input_wakeup_procfs_readers();
1008 1154
1009 return 0; 1155 return 0;
1010
1011 fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
1012 fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
1013 fail1: class_device_del(&dev->cdev);
1014 return error;
1015} 1156}
1016EXPORT_SYMBOL(input_register_device); 1157EXPORT_SYMBOL(input_register_device);
1017 1158
1018void input_unregister_device(struct input_dev *dev) 1159void input_unregister_device(struct input_dev *dev)
1019{ 1160{
1020 struct list_head *node, *next; 1161 struct input_handle *handle, *next;
1021 int code; 1162 int code;
1022 1163
1023 for (code = 0; code <= KEY_MAX; code++) 1164 for (code = 0; code <= KEY_MAX; code++)
@@ -1027,19 +1168,12 @@ void input_unregister_device(struct input_dev *dev)
1027 1168
1028 del_timer_sync(&dev->timer); 1169 del_timer_sync(&dev->timer);
1029 1170
1030 list_for_each_safe(node, next, &dev->h_list) { 1171 list_for_each_entry_safe(handle, next, &dev->h_list, d_node)
1031 struct input_handle * handle = to_handle(node);
1032 list_del_init(&handle->d_node);
1033 list_del_init(&handle->h_node);
1034 handle->handler->disconnect(handle); 1172 handle->handler->disconnect(handle);
1035 } 1173 WARN_ON(!list_empty(&dev->h_list));
1036 1174
1037 list_del_init(&dev->node); 1175 list_del_init(&dev->node);
1038 1176
1039 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
1040 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
1041 sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
1042
1043 class_device_unregister(&dev->cdev); 1177 class_device_unregister(&dev->cdev);
1044 1178
1045 input_wakeup_procfs_readers(); 1179 input_wakeup_procfs_readers();
@@ -1049,8 +1183,6 @@ EXPORT_SYMBOL(input_unregister_device);
1049int input_register_handler(struct input_handler *handler) 1183int input_register_handler(struct input_handler *handler)
1050{ 1184{
1051 struct input_dev *dev; 1185 struct input_dev *dev;
1052 struct input_handle *handle;
1053 const struct input_device_id *id;
1054 1186
1055 INIT_LIST_HEAD(&handler->h_list); 1187 INIT_LIST_HEAD(&handler->h_list);
1056 1188
@@ -1064,13 +1196,7 @@ int input_register_handler(struct input_handler *handler)
1064 list_add_tail(&handler->node, &input_handler_list); 1196 list_add_tail(&handler->node, &input_handler_list);
1065 1197
1066 list_for_each_entry(dev, &input_dev_list, node) 1198 list_for_each_entry(dev, &input_dev_list, node)
1067 if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) 1199 input_attach_handler(dev, handler);
1068 if ((id = input_match_device(handler->id_table, dev)))
1069 if ((handle = handler->connect(handler, dev, id))) {
1070 input_link_handle(handle);
1071 if (handler->start)
1072 handler->start(handle);
1073 }
1074 1200
1075 input_wakeup_procfs_readers(); 1201 input_wakeup_procfs_readers();
1076 return 0; 1202 return 0;
@@ -1079,14 +1205,11 @@ EXPORT_SYMBOL(input_register_handler);
1079 1205
1080void input_unregister_handler(struct input_handler *handler) 1206void input_unregister_handler(struct input_handler *handler)
1081{ 1207{
1082 struct list_head *node, *next; 1208 struct input_handle *handle, *next;
1083 1209
1084 list_for_each_safe(node, next, &handler->h_list) { 1210 list_for_each_entry_safe(handle, next, &handler->h_list, h_node)
1085 struct input_handle * handle = to_handle_h(node);
1086 list_del_init(&handle->h_node);
1087 list_del_init(&handle->d_node);
1088 handler->disconnect(handle); 1211 handler->disconnect(handle);
1089 } 1212 WARN_ON(!list_empty(&handler->h_list));
1090 1213
1091 list_del_init(&handler->node); 1214 list_del_init(&handler->node);
1092 1215
@@ -1097,6 +1220,27 @@ void input_unregister_handler(struct input_handler *handler)
1097} 1220}
1098EXPORT_SYMBOL(input_unregister_handler); 1221EXPORT_SYMBOL(input_unregister_handler);
1099 1222
1223int input_register_handle(struct input_handle *handle)
1224{
1225 struct input_handler *handler = handle->handler;
1226
1227 list_add_tail(&handle->d_node, &handle->dev->h_list);
1228 list_add_tail(&handle->h_node, &handler->h_list);
1229
1230 if (handler->start)
1231 handler->start(handle);
1232
1233 return 0;
1234}
1235EXPORT_SYMBOL(input_register_handle);
1236
1237void input_unregister_handle(struct input_handle *handle)
1238{
1239 list_del_init(&handle->h_node);
1240 list_del_init(&handle->d_node);
1241}
1242EXPORT_SYMBOL(input_unregister_handle);
1243
1100static int input_open_file(struct inode *inode, struct file *file) 1244static int input_open_file(struct inode *inode, struct file *file)
1101{ 1245{
1102 struct input_handler *handler = input_table[iminor(inode) >> 5]; 1246 struct input_handler *handler = input_table[iminor(inode) >> 5];
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 9f3529ad3fda..9bcc5425049b 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -43,7 +43,7 @@ struct joydev {
43 char name[16]; 43 char name[16];
44 struct input_handle handle; 44 struct input_handle handle;
45 wait_queue_head_t wait; 45 wait_queue_head_t wait;
46 struct list_head list; 46 struct list_head client_list;
47 struct js_corr corr[ABS_MAX + 1]; 47 struct js_corr corr[ABS_MAX + 1];
48 struct JS_DATA_SAVE_TYPE glue; 48 struct JS_DATA_SAVE_TYPE glue;
49 int nabs; 49 int nabs;
@@ -55,7 +55,7 @@ struct joydev {
55 __s16 abs[ABS_MAX + 1]; 55 __s16 abs[ABS_MAX + 1];
56}; 56};
57 57
58struct joydev_list { 58struct joydev_client {
59 struct js_event buffer[JOYDEV_BUFFER_SIZE]; 59 struct js_event buffer[JOYDEV_BUFFER_SIZE];
60 int head; 60 int head;
61 int tail; 61 int tail;
@@ -87,7 +87,7 @@ static int joydev_correct(int value, struct js_corr *corr)
87static void joydev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) 87static void joydev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
88{ 88{
89 struct joydev *joydev = handle->private; 89 struct joydev *joydev = handle->private;
90 struct joydev_list *list; 90 struct joydev_client *client;
91 struct js_event event; 91 struct js_event event;
92 92
93 switch (type) { 93 switch (type) {
@@ -115,15 +115,15 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
115 115
116 event.time = jiffies_to_msecs(jiffies); 116 event.time = jiffies_to_msecs(jiffies);
117 117
118 list_for_each_entry(list, &joydev->list, node) { 118 list_for_each_entry(client, &joydev->client_list, node) {
119 119
120 memcpy(list->buffer + list->head, &event, sizeof(struct js_event)); 120 memcpy(client->buffer + client->head, &event, sizeof(struct js_event));
121 121
122 if (list->startup == joydev->nabs + joydev->nkey) 122 if (client->startup == joydev->nabs + joydev->nkey)
123 if (list->tail == (list->head = (list->head + 1) & (JOYDEV_BUFFER_SIZE - 1))) 123 if (client->tail == (client->head = (client->head + 1) & (JOYDEV_BUFFER_SIZE - 1)))
124 list->startup = 0; 124 client->startup = 0;
125 125
126 kill_fasync(&list->fasync, SIGIO, POLL_IN); 126 kill_fasync(&client->fasync, SIGIO, POLL_IN);
127 } 127 }
128 128
129 wake_up_interruptible(&joydev->wait); 129 wake_up_interruptible(&joydev->wait);
@@ -132,9 +132,9 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
132static int joydev_fasync(int fd, struct file *file, int on) 132static int joydev_fasync(int fd, struct file *file, int on)
133{ 133{
134 int retval; 134 int retval;
135 struct joydev_list *list = file->private_data; 135 struct joydev_client *client = file->private_data;
136 136
137 retval = fasync_helper(fd, file, on, &list->fasync); 137 retval = fasync_helper(fd, file, on, &client->fasync);
138 138
139 return retval < 0 ? retval : 0; 139 return retval < 0 ? retval : 0;
140} 140}
@@ -145,60 +145,73 @@ static void joydev_free(struct joydev *joydev)
145 kfree(joydev); 145 kfree(joydev);
146} 146}
147 147
148static int joydev_release(struct inode * inode, struct file * file) 148static int joydev_release(struct inode *inode, struct file *file)
149{ 149{
150 struct joydev_list *list = file->private_data; 150 struct joydev_client *client = file->private_data;
151 struct joydev *joydev = client->joydev;
151 152
152 joydev_fasync(-1, file, 0); 153 joydev_fasync(-1, file, 0);
153 154
154 list_del(&list->node); 155 list_del(&client->node);
156 kfree(client);
155 157
156 if (!--list->joydev->open) { 158 if (!--joydev->open) {
157 if (list->joydev->exist) 159 if (joydev->exist)
158 input_close_device(&list->joydev->handle); 160 input_close_device(&joydev->handle);
159 else 161 else
160 joydev_free(list->joydev); 162 joydev_free(joydev);
161 } 163 }
162 164
163 kfree(list);
164 return 0; 165 return 0;
165} 166}
166 167
167static int joydev_open(struct inode *inode, struct file *file) 168static int joydev_open(struct inode *inode, struct file *file)
168{ 169{
169 struct joydev_list *list; 170 struct joydev_client *client;
171 struct joydev *joydev;
170 int i = iminor(inode) - JOYDEV_MINOR_BASE; 172 int i = iminor(inode) - JOYDEV_MINOR_BASE;
173 int error;
174
175 if (i >= JOYDEV_MINORS)
176 return -ENODEV;
171 177
172 if (i >= JOYDEV_MINORS || !joydev_table[i]) 178 joydev = joydev_table[i];
179 if (!joydev || !joydev->exist)
173 return -ENODEV; 180 return -ENODEV;
174 181
175 if (!(list = kzalloc(sizeof(struct joydev_list), GFP_KERNEL))) 182 client = kzalloc(sizeof(struct joydev_client), GFP_KERNEL);
183 if (!client)
176 return -ENOMEM; 184 return -ENOMEM;
177 185
178 list->joydev = joydev_table[i]; 186 client->joydev = joydev;
179 list_add_tail(&list->node, &joydev_table[i]->list); 187 list_add_tail(&client->node, &joydev->client_list);
180 file->private_data = list;
181 188
182 if (!list->joydev->open++) 189 if (!joydev->open++ && joydev->exist) {
183 if (list->joydev->exist) 190 error = input_open_device(&joydev->handle);
184 input_open_device(&list->joydev->handle); 191 if (error) {
192 list_del(&client->node);
193 kfree(client);
194 return error;
195 }
196 }
185 197
198 file->private_data = client;
186 return 0; 199 return 0;
187} 200}
188 201
189static ssize_t joydev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) 202static ssize_t joydev_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
190{ 203{
191 return -EINVAL; 204 return -EINVAL;
192} 205}
193 206
194static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 207static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
195{ 208{
196 struct joydev_list *list = file->private_data; 209 struct joydev_client *client = file->private_data;
197 struct joydev *joydev = list->joydev; 210 struct joydev *joydev = client->joydev;
198 struct input_dev *input = joydev->handle.dev; 211 struct input_dev *input = joydev->handle.dev;
199 int retval = 0; 212 int retval = 0;
200 213
201 if (!list->joydev->exist) 214 if (!joydev->exist)
202 return -ENODEV; 215 return -ENODEV;
203 216
204 if (count < sizeof(struct js_event)) 217 if (count < sizeof(struct js_event))
@@ -217,56 +230,55 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo
217 if (copy_to_user(buf, &data, sizeof(struct JS_DATA_TYPE))) 230 if (copy_to_user(buf, &data, sizeof(struct JS_DATA_TYPE)))
218 return -EFAULT; 231 return -EFAULT;
219 232
220 list->startup = 0; 233 client->startup = 0;
221 list->tail = list->head; 234 client->tail = client->head;
222 235
223 return sizeof(struct JS_DATA_TYPE); 236 return sizeof(struct JS_DATA_TYPE);
224 } 237 }
225 238
226 if (list->startup == joydev->nabs + joydev->nkey && 239 if (client->startup == joydev->nabs + joydev->nkey &&
227 list->head == list->tail && (file->f_flags & O_NONBLOCK)) 240 client->head == client->tail && (file->f_flags & O_NONBLOCK))
228 return -EAGAIN; 241 return -EAGAIN;
229 242
230 retval = wait_event_interruptible(list->joydev->wait, 243 retval = wait_event_interruptible(joydev->wait,
231 !list->joydev->exist || 244 !joydev->exist ||
232 list->startup < joydev->nabs + joydev->nkey || 245 client->startup < joydev->nabs + joydev->nkey ||
233 list->head != list->tail); 246 client->head != client->tail);
234
235 if (retval) 247 if (retval)
236 return retval; 248 return retval;
237 249
238 if (!list->joydev->exist) 250 if (!joydev->exist)
239 return -ENODEV; 251 return -ENODEV;
240 252
241 while (list->startup < joydev->nabs + joydev->nkey && retval + sizeof(struct js_event) <= count) { 253 while (client->startup < joydev->nabs + joydev->nkey && retval + sizeof(struct js_event) <= count) {
242 254
243 struct js_event event; 255 struct js_event event;
244 256
245 event.time = jiffies_to_msecs(jiffies); 257 event.time = jiffies_to_msecs(jiffies);
246 258
247 if (list->startup < joydev->nkey) { 259 if (client->startup < joydev->nkey) {
248 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; 260 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT;
249 event.number = list->startup; 261 event.number = client->startup;
250 event.value = !!test_bit(joydev->keypam[event.number], input->key); 262 event.value = !!test_bit(joydev->keypam[event.number], input->key);
251 } else { 263 } else {
252 event.type = JS_EVENT_AXIS | JS_EVENT_INIT; 264 event.type = JS_EVENT_AXIS | JS_EVENT_INIT;
253 event.number = list->startup - joydev->nkey; 265 event.number = client->startup - joydev->nkey;
254 event.value = joydev->abs[event.number]; 266 event.value = joydev->abs[event.number];
255 } 267 }
256 268
257 if (copy_to_user(buf + retval, &event, sizeof(struct js_event))) 269 if (copy_to_user(buf + retval, &event, sizeof(struct js_event)))
258 return -EFAULT; 270 return -EFAULT;
259 271
260 list->startup++; 272 client->startup++;
261 retval += sizeof(struct js_event); 273 retval += sizeof(struct js_event);
262 } 274 }
263 275
264 while (list->head != list->tail && retval + sizeof(struct js_event) <= count) { 276 while (client->head != client->tail && retval + sizeof(struct js_event) <= count) {
265 277
266 if (copy_to_user(buf + retval, list->buffer + list->tail, sizeof(struct js_event))) 278 if (copy_to_user(buf + retval, client->buffer + client->tail, sizeof(struct js_event)))
267 return -EFAULT; 279 return -EFAULT;
268 280
269 list->tail = (list->tail + 1) & (JOYDEV_BUFFER_SIZE - 1); 281 client->tail = (client->tail + 1) & (JOYDEV_BUFFER_SIZE - 1);
270 retval += sizeof(struct js_event); 282 retval += sizeof(struct js_event);
271 } 283 }
272 284
@@ -276,11 +288,12 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo
276/* No kernel lock - fine */ 288/* No kernel lock - fine */
277static unsigned int joydev_poll(struct file *file, poll_table *wait) 289static unsigned int joydev_poll(struct file *file, poll_table *wait)
278{ 290{
279 struct joydev_list *list = file->private_data; 291 struct joydev_client *client = file->private_data;
292 struct joydev *joydev = client->joydev;
280 293
281 poll_wait(file, &list->joydev->wait, wait); 294 poll_wait(file, &joydev->wait, wait);
282 return ((list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey) ? 295 return ((client->head != client->tail || client->startup < joydev->nabs + joydev->nkey) ?
283 (POLLIN | POLLRDNORM) : 0) | (list->joydev->exist ? 0 : (POLLHUP | POLLERR)); 296 (POLLIN | POLLRDNORM) : 0) | (joydev->exist ? 0 : (POLLHUP | POLLERR));
284} 297}
285 298
286static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __user *argp) 299static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __user *argp)
@@ -374,8 +387,8 @@ static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __u
374#ifdef CONFIG_COMPAT 387#ifdef CONFIG_COMPAT
375static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 388static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
376{ 389{
377 struct joydev_list *list = file->private_data; 390 struct joydev_client *client = file->private_data;
378 struct joydev *joydev = list->joydev; 391 struct joydev *joydev = client->joydev;
379 void __user *argp = (void __user *)arg; 392 void __user *argp = (void __user *)arg;
380 s32 tmp32; 393 s32 tmp32;
381 struct JS_DATA_SAVE_TYPE_32 ds32; 394 struct JS_DATA_SAVE_TYPE_32 ds32;
@@ -428,8 +441,8 @@ static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo
428 441
429static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 442static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
430{ 443{
431 struct joydev_list *list = file->private_data; 444 struct joydev_client *client = file->private_data;
432 struct joydev *joydev = list->joydev; 445 struct joydev *joydev = client->joydev;
433 void __user *argp = (void __user *)arg; 446 void __user *argp = (void __user *)arg;
434 447
435 if (!joydev->exist) 448 if (!joydev->exist)
@@ -465,23 +478,26 @@ static const struct file_operations joydev_fops = {
465 .fasync = joydev_fasync, 478 .fasync = joydev_fasync,
466}; 479};
467 480
468static struct input_handle *joydev_connect(struct input_handler *handler, struct input_dev *dev, 481static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
469 const struct input_device_id *id) 482 const struct input_device_id *id)
470{ 483{
471 struct joydev *joydev; 484 struct joydev *joydev;
472 struct class_device *cdev; 485 struct class_device *cdev;
486 dev_t devt;
473 int i, j, t, minor; 487 int i, j, t, minor;
488 int error;
474 489
475 for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); 490 for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++);
476 if (minor == JOYDEV_MINORS) { 491 if (minor == JOYDEV_MINORS) {
477 printk(KERN_ERR "joydev: no more free joydev devices\n"); 492 printk(KERN_ERR "joydev: no more free joydev devices\n");
478 return NULL; 493 return -ENFILE;
479 } 494 }
480 495
481 if (!(joydev = kzalloc(sizeof(struct joydev), GFP_KERNEL))) 496 joydev = kzalloc(sizeof(struct joydev), GFP_KERNEL);
482 return NULL; 497 if (!joydev)
498 return -ENOMEM;
483 499
484 INIT_LIST_HEAD(&joydev->list); 500 INIT_LIST_HEAD(&joydev->client_list);
485 init_waitqueue_head(&joydev->wait); 501 init_waitqueue_head(&joydev->wait);
486 502
487 joydev->minor = minor; 503 joydev->minor = minor;
@@ -534,31 +550,54 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
534 550
535 joydev_table[minor] = joydev; 551 joydev_table[minor] = joydev;
536 552
537 cdev = class_device_create(&input_class, &dev->cdev, 553 devt = MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor),
538 MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), 554
539 dev->cdev.dev, joydev->name); 555 cdev = class_device_create(&input_class, &dev->cdev, devt,
556 dev->cdev.dev, joydev->name);
557 if (IS_ERR(cdev)) {
558 error = PTR_ERR(cdev);
559 goto err_free_joydev;
560 }
540 561
541 /* temporary symlink to keep userspace happy */ 562 /* temporary symlink to keep userspace happy */
542 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 563 error = sysfs_create_link(&input_class.subsys.kobj,
543 joydev->name); 564 &cdev->kobj, joydev->name);
565 if (error)
566 goto err_cdev_destroy;
567
568 error = input_register_handle(&joydev->handle);
569 if (error)
570 goto err_remove_link;
571
572 return 0;
544 573
545 return &joydev->handle; 574 err_remove_link:
575 sysfs_remove_link(&input_class.subsys.kobj, joydev->name);
576 err_cdev_destroy:
577 class_device_destroy(&input_class, devt);
578 err_free_joydev:
579 joydev_table[minor] = NULL;
580 kfree(joydev);
581 return error;
546} 582}
547 583
584
548static void joydev_disconnect(struct input_handle *handle) 585static void joydev_disconnect(struct input_handle *handle)
549{ 586{
550 struct joydev *joydev = handle->private; 587 struct joydev *joydev = handle->private;
551 struct joydev_list *list; 588 struct joydev_client *client;
589
590 input_unregister_handle(handle);
552 591
553 sysfs_remove_link(&input_class.subsys.kset.kobj, joydev->name); 592 sysfs_remove_link(&input_class.subsys.kobj, joydev->name);
554 class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); 593 class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
555 joydev->exist = 0; 594 joydev->exist = 0;
556 595
557 if (joydev->open) { 596 if (joydev->open) {
558 input_close_device(handle); 597 input_close_device(handle);
559 wake_up_interruptible(&joydev->wait); 598 wake_up_interruptible(&joydev->wait);
560 list_for_each_entry(list, &joydev->list, node) 599 list_for_each_entry(client, &joydev->client_list, node)
561 kill_fasync(&list->fasync, SIGIO, POLL_HUP); 600 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
562 } else 601 } else
563 joydev_free(joydev); 602 joydev_free(joydev);
564} 603}
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
index b11a4bbc84c4..ff701ab10d74 100644
--- a/drivers/input/joystick/a3d.c
+++ b/drivers/input/joystick/a3d.c
@@ -241,7 +241,7 @@ static void a3d_adc_close(struct gameport *gameport)
241 241
242static int a3d_open(struct input_dev *dev) 242static int a3d_open(struct input_dev *dev)
243{ 243{
244 struct a3d *a3d = dev->private; 244 struct a3d *a3d = input_get_drvdata(dev);
245 245
246 gameport_start_polling(a3d->gameport); 246 gameport_start_polling(a3d->gameport);
247 return 0; 247 return 0;
@@ -253,7 +253,7 @@ static int a3d_open(struct input_dev *dev)
253 253
254static void a3d_close(struct input_dev *dev) 254static void a3d_close(struct input_dev *dev)
255{ 255{
256 struct a3d *a3d = dev->private; 256 struct a3d *a3d = input_get_drvdata(dev);
257 257
258 gameport_stop_polling(a3d->gameport); 258 gameport_stop_polling(a3d->gameport);
259} 259}
@@ -314,11 +314,12 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
314 input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; 314 input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ;
315 input_dev->id.product = a3d->mode; 315 input_dev->id.product = a3d->mode;
316 input_dev->id.version = 0x0100; 316 input_dev->id.version = 0x0100;
317 input_dev->cdev.dev = &gameport->dev; 317 input_dev->dev.parent = &gameport->dev;
318 input_dev->private = a3d;
319 input_dev->open = a3d_open; 318 input_dev->open = a3d_open;
320 input_dev->close = a3d_close; 319 input_dev->close = a3d_close;
321 320
321 input_set_drvdata(input_dev, a3d);
322
322 if (a3d->mode == A3D_MODE_PXL) { 323 if (a3d->mode == A3D_MODE_PXL) {
323 324
324 int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER }; 325 int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER };
diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c
index 6279ced8a35b..28140c4a110d 100644
--- a/drivers/input/joystick/adi.c
+++ b/drivers/input/joystick/adi.c
@@ -290,7 +290,7 @@ static void adi_poll(struct gameport *gameport)
290 290
291static int adi_open(struct input_dev *dev) 291static int adi_open(struct input_dev *dev)
292{ 292{
293 struct adi_port *port = dev->private; 293 struct adi_port *port = input_get_drvdata(dev);
294 294
295 gameport_start_polling(port->gameport); 295 gameport_start_polling(port->gameport);
296 return 0; 296 return 0;
@@ -302,7 +302,7 @@ static int adi_open(struct input_dev *dev)
302 302
303static void adi_close(struct input_dev *dev) 303static void adi_close(struct input_dev *dev)
304{ 304{
305 struct adi_port *port = dev->private; 305 struct adi_port *port = input_get_drvdata(dev);
306 306
307 gameport_stop_polling(port->gameport); 307 gameport_stop_polling(port->gameport);
308} 308}
@@ -424,8 +424,9 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half)
424 input_dev->id.vendor = GAMEPORT_ID_VENDOR_LOGITECH; 424 input_dev->id.vendor = GAMEPORT_ID_VENDOR_LOGITECH;
425 input_dev->id.product = adi->id; 425 input_dev->id.product = adi->id;
426 input_dev->id.version = 0x0100; 426 input_dev->id.version = 0x0100;
427 input_dev->cdev.dev = &port->gameport->dev; 427 input_dev->dev.parent = &port->gameport->dev;
428 input_dev->private = port; 428
429 input_set_drvdata(input_dev, port);
429 430
430 input_dev->open = adi_open; 431 input_dev->open = adi_open;
431 input_dev->close = adi_close; 432 input_dev->close = adi_close;
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 51f1e4bfff3e..1c1afb5d4684 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -343,7 +343,7 @@ static void analog_poll(struct gameport *gameport)
343 343
344static int analog_open(struct input_dev *dev) 344static int analog_open(struct input_dev *dev)
345{ 345{
346 struct analog_port *port = dev->private; 346 struct analog_port *port = input_get_drvdata(dev);
347 347
348 gameport_start_polling(port->gameport); 348 gameport_start_polling(port->gameport);
349 return 0; 349 return 0;
@@ -355,7 +355,7 @@ static int analog_open(struct input_dev *dev)
355 355
356static void analog_close(struct input_dev *dev) 356static void analog_close(struct input_dev *dev)
357{ 357{
358 struct analog_port *port = dev->private; 358 struct analog_port *port = input_get_drvdata(dev);
359 359
360 gameport_stop_polling(port->gameport); 360 gameport_stop_polling(port->gameport);
361} 361}
@@ -449,10 +449,13 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
449 input_dev->id.vendor = GAMEPORT_ID_VENDOR_ANALOG; 449 input_dev->id.vendor = GAMEPORT_ID_VENDOR_ANALOG;
450 input_dev->id.product = analog->mask >> 4; 450 input_dev->id.product = analog->mask >> 4;
451 input_dev->id.version = 0x0100; 451 input_dev->id.version = 0x0100;
452 input_dev->dev.parent = &port->gameport->dev;
453
454 input_set_drvdata(input_dev, port);
452 455
453 input_dev->open = analog_open; 456 input_dev->open = analog_open;
454 input_dev->close = analog_close; 457 input_dev->close = analog_close;
455 input_dev->private = port; 458
456 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 459 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
457 460
458 for (i = j = 0; i < 4; i++) 461 for (i = j = 0; i < 4; i++)
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
index 034ec39c251d..d3352a849b85 100644
--- a/drivers/input/joystick/cobra.c
+++ b/drivers/input/joystick/cobra.c
@@ -142,7 +142,7 @@ static void cobra_poll(struct gameport *gameport)
142 142
143static int cobra_open(struct input_dev *dev) 143static int cobra_open(struct input_dev *dev)
144{ 144{
145 struct cobra *cobra = dev->private; 145 struct cobra *cobra = input_get_drvdata(dev);
146 146
147 gameport_start_polling(cobra->gameport); 147 gameport_start_polling(cobra->gameport);
148 return 0; 148 return 0;
@@ -150,7 +150,7 @@ static int cobra_open(struct input_dev *dev)
150 150
151static void cobra_close(struct input_dev *dev) 151static void cobra_close(struct input_dev *dev)
152{ 152{
153 struct cobra *cobra = dev->private; 153 struct cobra *cobra = input_get_drvdata(dev);
154 154
155 gameport_stop_polling(cobra->gameport); 155 gameport_stop_polling(cobra->gameport);
156} 156}
@@ -211,8 +211,9 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
211 input_dev->id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; 211 input_dev->id.vendor = GAMEPORT_ID_VENDOR_CREATIVE;
212 input_dev->id.product = 0x0008; 212 input_dev->id.product = 0x0008;
213 input_dev->id.version = 0x0100; 213 input_dev->id.version = 0x0100;
214 input_dev->cdev.dev = &gameport->dev; 214 input_dev->dev.parent = &gameport->dev;
215 input_dev->private = cobra; 215
216 input_set_drvdata(input_dev, cobra);
216 217
217 input_dev->open = cobra_open; 218 input_dev->open = cobra_open;
218 input_dev->close = cobra_close; 219 input_dev->close = cobra_close;
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index b41bd2eb37dd..c27593bf9978 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -518,7 +518,7 @@ static void db9_timer(unsigned long private)
518 518
519static int db9_open(struct input_dev *dev) 519static int db9_open(struct input_dev *dev)
520{ 520{
521 struct db9 *db9 = dev->private; 521 struct db9 *db9 = input_get_drvdata(dev);
522 struct parport *port = db9->pd->port; 522 struct parport *port = db9->pd->port;
523 int err; 523 int err;
524 524
@@ -542,7 +542,7 @@ static int db9_open(struct input_dev *dev)
542 542
543static void db9_close(struct input_dev *dev) 543static void db9_close(struct input_dev *dev)
544{ 544{
545 struct db9 *db9 = dev->private; 545 struct db9 *db9 = input_get_drvdata(dev);
546 struct parport *port = db9->pd->port; 546 struct parport *port = db9->pd->port;
547 547
548 mutex_lock(&db9->mutex); 548 mutex_lock(&db9->mutex);
@@ -625,7 +625,8 @@ static struct db9 __init *db9_probe(int parport, int mode)
625 input_dev->id.vendor = 0x0002; 625 input_dev->id.vendor = 0x0002;
626 input_dev->id.product = mode; 626 input_dev->id.product = mode;
627 input_dev->id.version = 0x0100; 627 input_dev->id.version = 0x0100;
628 input_dev->private = db9; 628
629 input_set_drvdata(input_dev, db9);
629 630
630 input_dev->open = db9_open; 631 input_dev->open = db9_open;
631 input_dev->close = db9_close; 632 input_dev->close = db9_close;
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index 711e4b3e9e61..c71b58fe225d 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -591,7 +591,7 @@ static void gc_timer(unsigned long private)
591 591
592static int gc_open(struct input_dev *dev) 592static int gc_open(struct input_dev *dev)
593{ 593{
594 struct gc *gc = dev->private; 594 struct gc *gc = input_get_drvdata(dev);
595 int err; 595 int err;
596 596
597 err = mutex_lock_interruptible(&gc->mutex); 597 err = mutex_lock_interruptible(&gc->mutex);
@@ -610,7 +610,7 @@ static int gc_open(struct input_dev *dev)
610 610
611static void gc_close(struct input_dev *dev) 611static void gc_close(struct input_dev *dev)
612{ 612{
613 struct gc *gc = dev->private; 613 struct gc *gc = input_get_drvdata(dev);
614 614
615 mutex_lock(&gc->mutex); 615 mutex_lock(&gc->mutex);
616 if (!--gc->used) { 616 if (!--gc->used) {
@@ -646,7 +646,8 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
646 input_dev->id.vendor = 0x0001; 646 input_dev->id.vendor = 0x0001;
647 input_dev->id.product = pad_type; 647 input_dev->id.product = pad_type;
648 input_dev->id.version = 0x0100; 648 input_dev->id.version = 0x0100;
649 input_dev->private = gc; 649
650 input_set_drvdata(input_dev, gc);
650 651
651 input_dev->open = gc_open; 652 input_dev->open = gc_open;
652 input_dev->close = gc_close; 653 input_dev->close = gc_close;
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index bacbab5d1b6f..d514aebf7554 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -220,7 +220,7 @@ static void gf2k_poll(struct gameport *gameport)
220 220
221static int gf2k_open(struct input_dev *dev) 221static int gf2k_open(struct input_dev *dev)
222{ 222{
223 struct gf2k *gf2k = dev->private; 223 struct gf2k *gf2k = input_get_drvdata(dev);
224 224
225 gameport_start_polling(gf2k->gameport); 225 gameport_start_polling(gf2k->gameport);
226 return 0; 226 return 0;
@@ -228,7 +228,7 @@ static int gf2k_open(struct input_dev *dev)
228 228
229static void gf2k_close(struct input_dev *dev) 229static void gf2k_close(struct input_dev *dev)
230{ 230{
231 struct gf2k *gf2k = dev->private; 231 struct gf2k *gf2k = input_get_drvdata(dev);
232 232
233 gameport_stop_polling(gf2k->gameport); 233 gameport_stop_polling(gf2k->gameport);
234} 234}
@@ -308,11 +308,13 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
308 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS; 308 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS;
309 input_dev->id.product = gf2k->id; 309 input_dev->id.product = gf2k->id;
310 input_dev->id.version = 0x0100; 310 input_dev->id.version = 0x0100;
311 input_dev->cdev.dev = &gameport->dev; 311 input_dev->dev.parent = &gameport->dev;
312 input_dev->private = gf2k; 312
313 input_set_drvdata(input_dev, gf2k);
313 314
314 input_dev->open = gf2k_open; 315 input_dev->open = gf2k_open;
315 input_dev->close = gf2k_close; 316 input_dev->close = gf2k_close;
317
316 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 318 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
317 319
318 for (i = 0; i < gf2k_axes[gf2k->id]; i++) 320 for (i = 0; i < gf2k_axes[gf2k->id]; i++)
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
index 17a90c436de8..73eb5ab6f140 100644
--- a/drivers/input/joystick/grip.c
+++ b/drivers/input/joystick/grip.c
@@ -285,7 +285,7 @@ static void grip_poll(struct gameport *gameport)
285 285
286static int grip_open(struct input_dev *dev) 286static int grip_open(struct input_dev *dev)
287{ 287{
288 struct grip *grip = dev->private; 288 struct grip *grip = input_get_drvdata(dev);
289 289
290 gameport_start_polling(grip->gameport); 290 gameport_start_polling(grip->gameport);
291 return 0; 291 return 0;
@@ -293,7 +293,7 @@ static int grip_open(struct input_dev *dev)
293 293
294static void grip_close(struct input_dev *dev) 294static void grip_close(struct input_dev *dev)
295{ 295{
296 struct grip *grip = dev->private; 296 struct grip *grip = input_get_drvdata(dev);
297 297
298 gameport_stop_polling(grip->gameport); 298 gameport_stop_polling(grip->gameport);
299} 299}
@@ -363,8 +363,9 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
363 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; 363 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS;
364 input_dev->id.product = grip->mode[i]; 364 input_dev->id.product = grip->mode[i];
365 input_dev->id.version = 0x0100; 365 input_dev->id.version = 0x0100;
366 input_dev->cdev.dev = &gameport->dev; 366 input_dev->dev.parent = &gameport->dev;
367 input_dev->private = grip; 367
368 input_set_drvdata(input_dev, grip);
368 369
369 input_dev->open = grip_open; 370 input_dev->open = grip_open;
370 input_dev->close = grip_close; 371 input_dev->close = grip_close;
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
index 8120a9c40773..555319e6378c 100644
--- a/drivers/input/joystick/grip_mp.c
+++ b/drivers/input/joystick/grip_mp.c
@@ -562,7 +562,7 @@ static void grip_poll(struct gameport *gameport)
562 562
563static int grip_open(struct input_dev *dev) 563static int grip_open(struct input_dev *dev)
564{ 564{
565 struct grip_mp *grip = dev->private; 565 struct grip_mp *grip = input_get_drvdata(dev);
566 566
567 gameport_start_polling(grip->gameport); 567 gameport_start_polling(grip->gameport);
568 return 0; 568 return 0;
@@ -574,9 +574,9 @@ static int grip_open(struct input_dev *dev)
574 574
575static void grip_close(struct input_dev *dev) 575static void grip_close(struct input_dev *dev)
576{ 576{
577 struct grip_mp *grip = dev->private; 577 struct grip_mp *grip = input_get_drvdata(dev);
578 578
579 gameport_start_polling(grip->gameport); 579 gameport_stop_polling(grip->gameport);
580} 580}
581 581
582/* 582/*
@@ -599,8 +599,9 @@ static int register_slot(int slot, struct grip_mp *grip)
599 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; 599 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS;
600 input_dev->id.product = 0x0100 + port->mode; 600 input_dev->id.product = 0x0100 + port->mode;
601 input_dev->id.version = 0x0100; 601 input_dev->id.version = 0x0100;
602 input_dev->cdev.dev = &grip->gameport->dev; 602 input_dev->dev.parent = &grip->gameport->dev;
603 input_dev->private = grip; 603
604 input_set_drvdata(input_dev, grip);
604 605
605 input_dev->open = grip_open; 606 input_dev->open = grip_open;
606 input_dev->close = grip_close; 607 input_dev->close = grip_close;
diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c
index dbc5d92858b8..d4e8073caf27 100644
--- a/drivers/input/joystick/guillemot.c
+++ b/drivers/input/joystick/guillemot.c
@@ -156,7 +156,7 @@ static void guillemot_poll(struct gameport *gameport)
156 156
157static int guillemot_open(struct input_dev *dev) 157static int guillemot_open(struct input_dev *dev)
158{ 158{
159 struct guillemot *guillemot = dev->private; 159 struct guillemot *guillemot = input_get_drvdata(dev);
160 160
161 gameport_start_polling(guillemot->gameport); 161 gameport_start_polling(guillemot->gameport);
162 return 0; 162 return 0;
@@ -168,7 +168,7 @@ static int guillemot_open(struct input_dev *dev)
168 168
169static void guillemot_close(struct input_dev *dev) 169static void guillemot_close(struct input_dev *dev)
170{ 170{
171 struct guillemot *guillemot = dev->private; 171 struct guillemot *guillemot = input_get_drvdata(dev);
172 172
173 gameport_stop_polling(guillemot->gameport); 173 gameport_stop_polling(guillemot->gameport);
174} 174}
@@ -231,8 +231,9 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
231 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT; 231 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT;
232 input_dev->id.product = guillemot_type[i].id; 232 input_dev->id.product = guillemot_type[i].id;
233 input_dev->id.version = (int)data[14] << 8 | data[15]; 233 input_dev->id.version = (int)data[14] << 8 | data[15];
234 input_dev->cdev.dev = &gameport->dev; 234 input_dev->dev.parent = &gameport->dev;
235 input_dev->private = guillemot; 235
236 input_set_drvdata(input_dev, guillemot);
236 237
237 input_dev->open = guillemot_open; 238 input_dev->open = guillemot_open;
238 input_dev->close = guillemot_close; 239 input_dev->close = guillemot_close;
diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c
index 8fb0c19cc60e..f2a4381d0ab8 100644
--- a/drivers/input/joystick/iforce/iforce-ff.c
+++ b/drivers/input/joystick/iforce/iforce-ff.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ 2 * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
205 int i; 205 int i;
206 206
207 if (new->type != FF_SPRING && new->type != FF_FRICTION) { 207 if (new->type != FF_SPRING && new->type != FF_FRICTION) {
208 printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); 208 warn("bad effect type in need_condition_modifier");
209 return 0; 209 return 0;
210 } 210 }
211 211
@@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
227static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) 227static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect)
228{ 228{
229 if (effect->type != FF_CONSTANT) { 229 if (effect->type != FF_CONSTANT) {
230 printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); 230 warn("bad effect type in need_envelope_modifier");
231 return 0; 231 return 0;
232 } 232 }
233 233
@@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
258 break; 258 break;
259 259
260 default: 260 default:
261 printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); 261 warn("bad effect type in need_envelope_modifier");
262 } 262 }
263 263
264 return 0; 264 return 0;
@@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
271static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) 271static int need_period_modifier(struct ff_effect *old, struct ff_effect *new)
272{ 272{
273 if (new->type != FF_PERIODIC) { 273 if (new->type != FF_PERIODIC) {
274 printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); 274 warn("bad effect type in need_period_modifier");
275 return 0; 275 return 0;
276 } 276 }
277 return (old->u.periodic.period != new->u.periodic.period 277 return (old->u.periodic.period != new->u.periodic.period
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index 3393a37fec39..fb129c479a66 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -29,7 +29,7 @@
29 29
30#include "iforce.h" 30#include "iforce.h"
31 31
32MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <deneux@ifrance.com>"); 32MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
33MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); 33MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
35 35
@@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev)
220 /* Check: no effects should be present in memory */ 220 /* Check: no effects should be present in memory */
221 for (i = 0; i < dev->ff->max_effects; i++) { 221 for (i = 0; i < dev->ff->max_effects; i++) {
222 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { 222 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) {
223 printk(KERN_WARNING "iforce_release: Device still owns effects\n"); 223 warn("iforce_release: Device still owns effects");
224 break; 224 break;
225 } 225 }
226 } 226 }
@@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev)
232 switch (iforce->bus) { 232 switch (iforce->bus) {
233#ifdef CONFIG_JOYSTICK_IFORCE_USB 233#ifdef CONFIG_JOYSTICK_IFORCE_USB
234 case IFORCE_USB: 234 case IFORCE_USB:
235 usb_unlink_urb(iforce->irq); 235 usb_kill_urb(iforce->irq);
236 236
237 /* The device was unplugged before the file 237 /* The device was unplugged before the file
238 * was released */ 238 * was released */
@@ -287,13 +287,13 @@ int iforce_init_device(struct iforce *iforce)
287#ifdef CONFIG_JOYSTICK_IFORCE_USB 287#ifdef CONFIG_JOYSTICK_IFORCE_USB
288 case IFORCE_USB: 288 case IFORCE_USB:
289 input_dev->id.bustype = BUS_USB; 289 input_dev->id.bustype = BUS_USB;
290 input_dev->cdev.dev = &iforce->usbdev->dev; 290 input_dev->dev.parent = &iforce->usbdev->dev;
291 break; 291 break;
292#endif 292#endif
293#ifdef CONFIG_JOYSTICK_IFORCE_232 293#ifdef CONFIG_JOYSTICK_IFORCE_232
294 case IFORCE_232: 294 case IFORCE_232:
295 input_dev->id.bustype = BUS_RS232; 295 input_dev->id.bustype = BUS_RS232;
296 input_dev->cdev.dev = &iforce->serio->dev; 296 input_dev->dev.parent = &iforce->serio->dev;
297 break; 297 break;
298#endif 298#endif
299 } 299 }
@@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce)
324 break; 324 break;
325 325
326 if (i == 20) { /* 5 seconds */ 326 if (i == 20) { /* 5 seconds */
327 printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); 327 err("Timeout waiting for response from device.");
328 error = -ENODEV; 328 error = -ENODEV;
329 goto fail; 329 goto fail;
330 } 330 }
@@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce)
336 if (!iforce_get_id_packet(iforce, "M")) 336 if (!iforce_get_id_packet(iforce, "M"))
337 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; 337 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1];
338 else 338 else
339 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); 339 warn("Device does not respond to id packet M");
340 340
341 if (!iforce_get_id_packet(iforce, "P")) 341 if (!iforce_get_id_packet(iforce, "P"))
342 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; 342 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1];
343 else 343 else
344 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); 344 warn("Device does not respond to id packet P");
345 345
346 if (!iforce_get_id_packet(iforce, "B")) 346 if (!iforce_get_id_packet(iforce, "B"))
347 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; 347 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1];
348 else 348 else
349 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); 349 warn("Device does not respond to id packet B");
350 350
351 if (!iforce_get_id_packet(iforce, "N")) 351 if (!iforce_get_id_packet(iforce, "N"))
352 ff_effects = iforce->edata[1]; 352 ff_effects = iforce->edata[1];
353 else 353 else
354 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); 354 warn("Device does not respond to id packet N");
355 355
356 /* Check if the device can store more effects than the driver can really handle */ 356 /* Check if the device can store more effects than the driver can really handle */
357 if (ff_effects > IFORCE_EFFECTS_MAX) { 357 if (ff_effects > IFORCE_EFFECTS_MAX) {
358 printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", 358 warn("Limiting number of effects to %d (device reports %d)",
359 IFORCE_EFFECTS_MAX, ff_effects); 359 IFORCE_EFFECTS_MAX, ff_effects);
360 ff_effects = IFORCE_EFFECTS_MAX; 360 ff_effects = IFORCE_EFFECTS_MAX;
361 } 361 }
@@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce)
457 if (error) 457 if (error)
458 goto fail; 458 goto fail;
459 459
460 printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open);
461
462 return 0; 460 return 0;
463 461
464 fail: input_free_device(input_dev); 462 fail: input_free_device(input_dev);
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
index 808f05932a6f..21c4e13d3a50 100644
--- a/drivers/input/joystick/iforce/iforce-packets.c
+++ b/drivers/input/joystick/iforce/iforce-packets.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data)
39{ 39{
40 int i; 40 int i;
41 41
42 printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); 42 printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd);
43 for (i = 0; i < LO(cmd); i++) 43 for (i = 0; i < LO(cmd); i++)
44 printk("%02x ", data[i]); 44 printk("%02x ", data[i]);
45 printk(")\n"); 45 printk("\n");
46} 46}
47 47
48/* 48/*
@@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
65 head = iforce->xmit.head; 65 head = iforce->xmit.head;
66 tail = iforce->xmit.tail; 66 tail = iforce->xmit.tail;
67 67
68
68 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { 69 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
69 printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); 70 warn("not enough space in xmit buffer to send new packet");
70 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 71 spin_unlock_irqrestore(&iforce->xmit_lock, flags);
71 return -1; 72 return -1;
72 } 73 }
@@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value)
126{ 127{
127 unsigned char data[3]; 128 unsigned char data[3];
128 129
129printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value);
130
131 data[0] = LO(id); 130 data[0] = LO(id);
132 data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; 131 data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0;
133 data[2] = LO(value); 132 data[2] = LO(value);
@@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr)
151 return 0; 150 return 0;
152 } 151 }
153 } 152 }
154 printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); 153 warn("unused effect %04x updated !!!", addr);
155 return -1; 154 return -1;
156} 155}
157 156
@@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
162 static int being_used = 0; 161 static int being_used = 0;
163 162
164 if (being_used) 163 if (being_used)
165 printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); 164 warn("re-entrant call to iforce_process %d", being_used);
166 being_used++; 165 being_used++;
167 166
168#ifdef CONFIG_JOYSTICK_IFORCE_232 167#ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
266 return -1; 265 return -1;
267 } 266 }
268#else 267#else
269 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); 268 err("iforce_get_id_packet: iforce->bus = USB!");
270#endif 269#endif
271 break; 270 break;
272 271
@@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
284 return -1; 283 return -1;
285 } 284 }
286#else 285#else
287 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); 286 err("iforce_get_id_packet: iforce->bus = SERIO!");
288#endif 287#endif
289 break; 288 break;
290 289
291 default: 290 default:
292 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", 291 err("iforce_get_id_packet: iforce->bus = %d", iforce->bus);
293 iforce->bus);
294 break; 292 break;
295 } 293 }
296 294
diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c
index ec4be535f483..7b4bc19cef27 100644
--- a/drivers/input/joystick/iforce/iforce-serio.c
+++ b/drivers/input/joystick/iforce/iforce-serio.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ 2 * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 80cdebcbcb99..750099d8e3c6 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ 2 * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce)
65 XMIT_INC(iforce->xmit.tail, n); 65 XMIT_INC(iforce->xmit.tail, n);
66 66
67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { 67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) {
68 printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); 68 warn("usb_submit_urb failed %d\n", n);
69 } 69 }
70 70
71 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. 71 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended.
@@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb)
110 struct iforce *iforce = urb->context; 110 struct iforce *iforce = urb->context;
111 111
112 if (urb->status) { 112 if (urb->status) {
113 printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); 113 dbg("urb->status %d, exiting", urb->status);
114 return; 114 return;
115 } 115 }
116 116
@@ -190,10 +190,9 @@ fail:
190/* Called by iforce_delete() */ 190/* Called by iforce_delete() */
191void iforce_usb_delete(struct iforce* iforce) 191void iforce_usb_delete(struct iforce* iforce)
192{ 192{
193 usb_unlink_urb(iforce->irq); 193 usb_kill_urb(iforce->irq);
194/* Is it ok to unlink those ? */ 194 usb_kill_urb(iforce->out);
195 usb_unlink_urb(iforce->out); 195 usb_kill_urb(iforce->ctrl);
196 usb_unlink_urb(iforce->ctrl);
197 196
198 usb_free_urb(iforce->irq); 197 usb_free_urb(iforce->irq);
199 usb_free_urb(iforce->out); 198 usb_free_urb(iforce->out);
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index ffaeaefa1a42..dadcf4fb92ae 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -2,7 +2,7 @@
2 * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c
index fec8b3d0967d..1aec1e9d7c59 100644
--- a/drivers/input/joystick/interact.c
+++ b/drivers/input/joystick/interact.c
@@ -185,7 +185,7 @@ static void interact_poll(struct gameport *gameport)
185 185
186static int interact_open(struct input_dev *dev) 186static int interact_open(struct input_dev *dev)
187{ 187{
188 struct interact *interact = dev->private; 188 struct interact *interact = input_get_drvdata(dev);
189 189
190 gameport_start_polling(interact->gameport); 190 gameport_start_polling(interact->gameport);
191 return 0; 191 return 0;
@@ -197,7 +197,7 @@ static int interact_open(struct input_dev *dev)
197 197
198static void interact_close(struct input_dev *dev) 198static void interact_close(struct input_dev *dev)
199{ 199{
200 struct interact *interact = dev->private; 200 struct interact *interact = input_get_drvdata(dev);
201 201
202 gameport_stop_polling(interact->gameport); 202 gameport_stop_polling(interact->gameport);
203} 203}
@@ -262,7 +262,9 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
262 input_dev->id.vendor = GAMEPORT_ID_VENDOR_INTERACT; 262 input_dev->id.vendor = GAMEPORT_ID_VENDOR_INTERACT;
263 input_dev->id.product = interact_type[i].id; 263 input_dev->id.product = interact_type[i].id;
264 input_dev->id.version = 0x0100; 264 input_dev->id.version = 0x0100;
265 input_dev->private = interact; 265 input_dev->dev.parent = &gameport->dev;
266
267 input_set_drvdata(input_dev, interact);
266 268
267 input_dev->open = interact_open; 269 input_dev->open = interact_open;
268 input_dev->close = interact_close; 270 input_dev->close = interact_close;
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index 4112789f1196..b35604ee43ae 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -168,8 +168,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
168 input_dev->id.vendor = SERIO_MAGELLAN; 168 input_dev->id.vendor = SERIO_MAGELLAN;
169 input_dev->id.product = 0x0001; 169 input_dev->id.product = 0x0001;
170 input_dev->id.version = 0x0100; 170 input_dev->id.version = 0x0100;
171 input_dev->cdev.dev = &serio->dev; 171 input_dev->dev.parent = &serio->dev;
172 input_dev->private = magellan;
173 172
174 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 173 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
175 174
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
index e58b22c018e4..2adf73f63c94 100644
--- a/drivers/input/joystick/sidewinder.c
+++ b/drivers/input/joystick/sidewinder.c
@@ -509,7 +509,7 @@ static void sw_poll(struct gameport *gameport)
509 509
510static int sw_open(struct input_dev *dev) 510static int sw_open(struct input_dev *dev)
511{ 511{
512 struct sw *sw = dev->private; 512 struct sw *sw = input_get_drvdata(dev);
513 513
514 gameport_start_polling(sw->gameport); 514 gameport_start_polling(sw->gameport);
515 return 0; 515 return 0;
@@ -517,7 +517,7 @@ static int sw_open(struct input_dev *dev)
517 517
518static void sw_close(struct input_dev *dev) 518static void sw_close(struct input_dev *dev)
519{ 519{
520 struct sw *sw = dev->private; 520 struct sw *sw = input_get_drvdata(dev);
521 521
522 gameport_stop_polling(sw->gameport); 522 gameport_stop_polling(sw->gameport);
523} 523}
@@ -751,8 +751,9 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
751 input_dev->id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT; 751 input_dev->id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT;
752 input_dev->id.product = sw->type; 752 input_dev->id.product = sw->type;
753 input_dev->id.version = 0x0100; 753 input_dev->id.version = 0x0100;
754 input_dev->cdev.dev = &gameport->dev; 754 input_dev->dev.parent = &gameport->dev;
755 input_dev->private = sw; 755
756 input_set_drvdata(input_dev, sw);
756 757
757 input_dev->open = sw_open; 758 input_dev->open = sw_open;
758 input_dev->close = sw_close; 759 input_dev->close = sw_close;
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index 08bf113e62eb..abb7c4cf54ad 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -226,8 +226,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
226 input_dev->id.vendor = SERIO_SPACEBALL; 226 input_dev->id.vendor = SERIO_SPACEBALL;
227 input_dev->id.product = id; 227 input_dev->id.product = id;
228 input_dev->id.version = 0x0100; 228 input_dev->id.version = 0x0100;
229 input_dev->cdev.dev = &serio->dev; 229 input_dev->dev.parent = &serio->dev;
230 input_dev->private = spaceball;
231 230
232 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 231 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
233 232
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
index c9c79211af71..c4937f1e837c 100644
--- a/drivers/input/joystick/spaceorb.c
+++ b/drivers/input/joystick/spaceorb.c
@@ -183,8 +183,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
183 input_dev->id.vendor = SERIO_SPACEORB; 183 input_dev->id.vendor = SERIO_SPACEORB;
184 input_dev->id.product = 0x0001; 184 input_dev->id.product = 0x0001;
185 input_dev->id.version = 0x0100; 185 input_dev->id.version = 0x0100;
186 input_dev->cdev.dev = &serio->dev; 186 input_dev->dev.parent = &serio->dev;
187 input_dev->private = spaceorb;
188 187
189 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 188 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
190 189
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
index ecb0916215fa..8581ee991d4e 100644
--- a/drivers/input/joystick/stinger.c
+++ b/drivers/input/joystick/stinger.c
@@ -154,8 +154,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
154 input_dev->id.vendor = SERIO_STINGER; 154 input_dev->id.vendor = SERIO_STINGER;
155 input_dev->id.product = 0x0001; 155 input_dev->id.product = 0x0001;
156 input_dev->id.version = 0x0100; 156 input_dev->id.version = 0x0100;
157 input_dev->cdev.dev = &serio->dev; 157 input_dev->dev.parent = &serio->dev;
158 input_dev->private = stinger;
159 158
160 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 159 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
161 input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | 160 input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) |
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c
index bb23ed2a04a6..3b36ee04f726 100644
--- a/drivers/input/joystick/tmdc.c
+++ b/drivers/input/joystick/tmdc.c
@@ -265,7 +265,7 @@ static void tmdc_poll(struct gameport *gameport)
265 265
266static int tmdc_open(struct input_dev *dev) 266static int tmdc_open(struct input_dev *dev)
267{ 267{
268 struct tmdc *tmdc = dev->private; 268 struct tmdc *tmdc = input_get_drvdata(dev);
269 269
270 gameport_start_polling(tmdc->gameport); 270 gameport_start_polling(tmdc->gameport);
271 return 0; 271 return 0;
@@ -273,7 +273,7 @@ static int tmdc_open(struct input_dev *dev)
273 273
274static void tmdc_close(struct input_dev *dev) 274static void tmdc_close(struct input_dev *dev)
275{ 275{
276 struct tmdc *tmdc = dev->private; 276 struct tmdc *tmdc = input_get_drvdata(dev);
277 277
278 gameport_stop_polling(tmdc->gameport); 278 gameport_stop_polling(tmdc->gameport);
279} 279}
@@ -326,8 +326,9 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data)
326 input_dev->id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; 326 input_dev->id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER;
327 input_dev->id.product = model->id; 327 input_dev->id.product = model->id;
328 input_dev->id.version = 0x0100; 328 input_dev->id.version = 0x0100;
329 input_dev->cdev.dev = &tmdc->gameport->dev; 329 input_dev->dev.parent = &tmdc->gameport->dev;
330 input_dev->private = tmdc; 330
331 input_set_drvdata(input_dev, tmdc);
331 332
332 input_dev->open = tmdc_open; 333 input_dev->open = tmdc_open;
333 input_dev->close = tmdc_close; 334 input_dev->close = tmdc_close;
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 037d3487fcc7..0f2c60823b0b 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -122,7 +122,7 @@ static void tgfx_timer(unsigned long private)
122 122
123static int tgfx_open(struct input_dev *dev) 123static int tgfx_open(struct input_dev *dev)
124{ 124{
125 struct tgfx *tgfx = dev->private; 125 struct tgfx *tgfx = input_get_drvdata(dev);
126 int err; 126 int err;
127 127
128 err = mutex_lock_interruptible(&tgfx->sem); 128 err = mutex_lock_interruptible(&tgfx->sem);
@@ -141,7 +141,7 @@ static int tgfx_open(struct input_dev *dev)
141 141
142static void tgfx_close(struct input_dev *dev) 142static void tgfx_close(struct input_dev *dev)
143{ 143{
144 struct tgfx *tgfx = dev->private; 144 struct tgfx *tgfx = input_get_drvdata(dev);
145 145
146 mutex_lock(&tgfx->sem); 146 mutex_lock(&tgfx->sem);
147 if (!--tgfx->used) { 147 if (!--tgfx->used) {
@@ -224,7 +224,8 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
224 input_dev->id.product = n_buttons[i]; 224 input_dev->id.product = n_buttons[i];
225 input_dev->id.version = 0x0100; 225 input_dev->id.version = 0x0100;
226 226
227 input_dev->private = tgfx; 227 input_set_drvdata(input_dev, tgfx);
228
228 input_dev->open = tgfx_open; 229 input_dev->open = tgfx_open;
229 input_dev->close = tgfx_close; 230 input_dev->close = tgfx_close;
230 231
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
index 9cf17d6ced82..c91504ec38eb 100644
--- a/drivers/input/joystick/twidjoy.c
+++ b/drivers/input/joystick/twidjoy.c
@@ -205,11 +205,9 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
205 input_dev->id.vendor = SERIO_TWIDJOY; 205 input_dev->id.vendor = SERIO_TWIDJOY;
206 input_dev->id.product = 0x0001; 206 input_dev->id.product = 0x0001;
207 input_dev->id.version = 0x0100; 207 input_dev->id.version = 0x0100;
208 input_dev->cdev.dev = &serio->dev; 208 input_dev->dev.parent = &serio->dev;
209 input_dev->private = twidjoy;
210 209
211 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 210 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
212 input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
213 input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4); 211 input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4);
214 input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4); 212 input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4);
215 213
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index 29d339acf430..4e85f72eefd7 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -160,8 +160,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
160 input_dev->id.vendor = SERIO_WARRIOR; 160 input_dev->id.vendor = SERIO_WARRIOR;
161 input_dev->id.product = 0x0001; 161 input_dev->id.product = 0x0001;
162 input_dev->id.version = 0x0100; 162 input_dev->id.version = 0x0100;
163 input_dev->cdev.dev = &serio->dev; 163 input_dev->dev.parent = &serio->dev;
164 input_dev->private = warrior;
165 164
166 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); 165 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
167 input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2); 166 input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2);
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index f17e9c7d4b36..9f42e4d3649e 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -164,6 +164,17 @@ config KEYBOARD_AMIGA
164 To compile this driver as a module, choose M here: the 164 To compile this driver as a module, choose M here: the
165 module will be called amikbd. 165 module will be called amikbd.
166 166
167config KEYBOARD_ATARI
168 tristate "Atari keyboard"
169 depends on ATARI
170 select ATARI_KBD_CORE
171 help
172 Say Y here if you are running Linux on any Atari and have a keyboard
173 attached.
174
175 To compile this driver as a module, choose M here: the
176 module will be called atakbd.
177
167config KEYBOARD_HIL_OLD 178config KEYBOARD_HIL_OLD
168 tristate "HP HIL keyboard support (simple driver)" 179 tristate "HP HIL keyboard support (simple driver)"
169 depends on GSC || HP300 180 depends on GSC || HP300
@@ -203,6 +214,15 @@ config KEYBOARD_OMAP
203 To compile this driver as a module, choose M here: the 214 To compile this driver as a module, choose M here: the
204 module will be called omap-keypad. 215 module will be called omap-keypad.
205 216
217config KEYBOARD_PXA27x
218 tristate "PXA27x keyboard support"
219 depends on PXA27x
220 help
221 Enable support for PXA27x matrix keyboard controller
222
223 To compile this driver as a module, choose M here: the
224 module will be called pxa27x_keyboard.
225
206config KEYBOARD_AAED2000 226config KEYBOARD_AAED2000
207 tristate "AAED-2000 keyboard" 227 tristate "AAED-2000 keyboard"
208 depends on MACH_AAED2000 228 depends on MACH_AAED2000
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 586a0fe53be6..28d211b87b14 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o
9obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o 9obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o
10obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o 10obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
11obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o 11obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
12obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
12obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o 13obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o
13obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o 14obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o
14obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o 15obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o
@@ -17,6 +18,7 @@ obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o
17obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o 18obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
18obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o 19obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
19obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o 20obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
21obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o
20obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o 22obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
21obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 23obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
22 24
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c
index 65fcb6af63a8..3a37505f067c 100644
--- a/drivers/input/keyboard/aaed2000_kbd.c
+++ b/drivers/input/keyboard/aaed2000_kbd.c
@@ -97,7 +97,7 @@ static void aaedkbd_work(void *data)
97 97
98static int aaedkbd_open(struct input_dev *indev) 98static int aaedkbd_open(struct input_dev *indev)
99{ 99{
100 struct aaedkbd *aaedkbd = indev->private; 100 struct aaedkbd *aaedkbd = input_get_drvdata(indev);
101 101
102 schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL)); 102 schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL));
103 103
@@ -106,7 +106,7 @@ static int aaedkbd_open(struct input_dev *indev)
106 106
107static void aaedkbd_close(struct input_dev *indev) 107static void aaedkbd_close(struct input_dev *indev)
108{ 108{
109 struct aaedkbd *aaedkbd = indev->private; 109 struct aaedkbd *aaedkbd = input_get_drvdata(indev);
110 110
111 cancel_delayed_work(&aaedkbd->workq); 111 cancel_delayed_work(&aaedkbd->workq);
112 flush_scheduled_work(); 112 flush_scheduled_work();
@@ -141,8 +141,9 @@ static int __devinit aaedkbd_probe(struct platform_device *pdev)
141 input_dev->id.vendor = 0x0001; 141 input_dev->id.vendor = 0x0001;
142 input_dev->id.product = 0x0001; 142 input_dev->id.product = 0x0001;
143 input_dev->id.version = 0x0100; 143 input_dev->id.version = 0x0100;
144 input_dev->cdev.dev = &pdev->dev; 144 input_dev->dev.parent = &pdev->dev;
145 input_dev->private = aaedkbd; 145
146 input_set_drvdata(input_dev, aaedkbd);
146 147
147 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 148 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
148 input_dev->keycode = aaedkbd->keycode; 149 input_dev->keycode = aaedkbd->keycode;
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c
new file mode 100644
index 000000000000..ded1d6ac6ff3
--- /dev/null
+++ b/drivers/input/keyboard/atakbd.c
@@ -0,0 +1,134 @@
1/*
2 * atakbd.c
3 *
4 * Copyright (c) 2005 Michael Schmitz
5 *
6 * Based on amikbd.c, which is
7 *
8 * Copyright (c) 2000-2001 Vojtech Pavlik
9 *
10 * Based on the work of:
11 * Hamish Macdonald
12 */
13
14/*
15 * Atari keyboard driver for Linux/m68k
16 *
17 * The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c
18 * (the keyboard ACIA also handles the mouse and joystick data, and the keyboard
19 * interrupt is shared with the MIDI ACIA so MIDI data also get handled there).
20 * This driver only deals with handing key events off to the input layer.
21 */
22
23/*
24 * This program is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2 of the License, or
27 * (at your option) any later version.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37 *
38 * Should you need to contact me, the author, you can do so either by
39 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
40 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
41 */
42
43#include <linux/module.h>
44#include <linux/init.h>
45#include <linux/input.h>
46#include <linux/delay.h>
47#include <linux/interrupt.h>
48
49#include <asm/atariints.h>
50#include <asm/atarihw.h>
51#include <asm/atarikb.h>
52#include <asm/irq.h>
53
54MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
55MODULE_DESCRIPTION("Atari keyboard driver");
56MODULE_LICENSE("GPL");
57
58static unsigned char atakbd_keycode[0x72];
59
60static struct input_dev *atakbd_dev;
61
62static void atakbd_interrupt(unsigned char scancode, char down)
63{
64
65 if (scancode < 0x72) { /* scancodes < 0xf2 are keys */
66
67 // report raw events here?
68
69 scancode = atakbd_keycode[scancode];
70
71 if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
72 input_report_key(atakbd_dev, scancode, 1);
73 input_report_key(atakbd_dev, scancode, 0);
74 input_sync(atakbd_dev);
75 } else {
76 input_report_key(atakbd_dev, scancode, down);
77 input_sync(atakbd_dev);
78 }
79 } else /* scancodes >= 0xf2 are mouse data, most likely */
80 printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
81
82 return;
83}
84
85static int __init atakbd_init(void)
86{
87 int i;
88
89 if (!ATARIHW_PRESENT(ST_MFP))
90 return -EIO;
91
92 // TODO: request_mem_region if not done in arch code
93
94 if (!(atakbd_dev = input_allocate_device()))
95 return -ENOMEM;
96
97 // need to init core driver if not already done so
98 if (atari_keyb_init())
99 return -ENODEV;
100
101 atakbd_dev->name = "Atari Keyboard";
102 atakbd_dev->phys = "atakbd/input0";
103 atakbd_dev->id.bustype = BUS_ATARI;
104 atakbd_dev->id.vendor = 0x0001;
105 atakbd_dev->id.product = 0x0001;
106 atakbd_dev->id.version = 0x0100;
107
108 atakbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
109 atakbd_dev->keycode = atakbd_keycode;
110 atakbd_dev->keycodesize = sizeof(unsigned char);
111 atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode);
112
113 for (i = 1; i < 0x72; i++) {
114 atakbd_keycode[i] = i;
115 set_bit(atakbd_keycode[i], atakbd_dev->keybit);
116 }
117
118 input_register_device(atakbd_dev);
119
120 atari_input_keyboard_interrupt_hook = atakbd_interrupt;
121
122 printk(KERN_INFO "input: %s at IKBD ACIA\n", atakbd_dev->name);
123
124 return 0;
125}
126
127static void __exit atakbd_exit(void)
128{
129 atari_input_keyboard_interrupt_hook = NULL;
130 input_unregister_device(atakbd_dev);
131}
132
133module_init(atakbd_init);
134module_exit(atakbd_exit);
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 663877076bc7..be1fe46cd308 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -586,7 +586,7 @@ static void atkbd_event_work(struct work_struct *work)
586 586
587static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 587static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
588{ 588{
589 struct atkbd *atkbd = dev->private; 589 struct atkbd *atkbd = input_get_drvdata(dev);
590 590
591 if (!atkbd->write) 591 if (!atkbd->write)
592 return -1; 592 return -1;
@@ -883,8 +883,9 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
883 input_dev->id.product = atkbd->translated ? 1 : atkbd->set; 883 input_dev->id.product = atkbd->translated ? 1 : atkbd->set;
884 input_dev->id.version = atkbd->id; 884 input_dev->id.version = atkbd->id;
885 input_dev->event = atkbd_event; 885 input_dev->event = atkbd_event;
886 input_dev->private = atkbd; 886 input_dev->dev.parent = &atkbd->ps2dev.serio->dev;
887 input_dev->cdev.dev = &atkbd->ps2dev.serio->dev; 887
888 input_set_drvdata(input_dev, atkbd);
888 889
889 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); 890 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC);
890 891
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 1016c94e65db..6578bfff644b 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -323,8 +323,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
323 input_dev->id.vendor = 0x0001; 323 input_dev->id.vendor = 0x0001;
324 input_dev->id.product = 0x0001; 324 input_dev->id.product = 0x0001;
325 input_dev->id.version = 0x0100; 325 input_dev->id.version = 0x0100;
326 input_dev->cdev.dev = &pdev->dev; 326 input_dev->dev.parent = &pdev->dev;
327 input_dev->private = corgikbd;
328 327
329 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); 328 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
330 input_dev->keycode = corgikbd->keycode; 329 input_dev->keycode = corgikbd->keycode;
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ccf6df387b62..739212252b09 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -35,11 +35,14 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
35 struct input_dev *input = platform_get_drvdata(pdev); 35 struct input_dev *input = platform_get_drvdata(pdev);
36 36
37 for (i = 0; i < pdata->nbuttons; i++) { 37 for (i = 0; i < pdata->nbuttons; i++) {
38 int gpio = pdata->buttons[i].gpio; 38 struct gpio_keys_button *button = &pdata->buttons[i];
39 int gpio = button->gpio;
40
39 if (irq == gpio_to_irq(gpio)) { 41 if (irq == gpio_to_irq(gpio)) {
40 int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low); 42 unsigned int type = button->type ?: EV_KEY;
43 int state = (gpio_get_value(gpio) ? 1 : 0) ^ button->active_low;
41 44
42 input_report_key(input, pdata->buttons[i].keycode, state); 45 input_event(input, type, button->code, !!state);
43 input_sync(input); 46 input_sync(input);
44 } 47 }
45 } 48 }
@@ -63,8 +66,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
63 66
64 input->name = pdev->name; 67 input->name = pdev->name;
65 input->phys = "gpio-keys/input0"; 68 input->phys = "gpio-keys/input0";
66 input->cdev.dev = &pdev->dev; 69 input->dev.parent = &pdev->dev;
67 input->private = pdata;
68 70
69 input->id.bustype = BUS_HOST; 71 input->id.bustype = BUS_HOST;
70 input->id.vendor = 0x0001; 72 input->id.vendor = 0x0001;
@@ -72,19 +74,21 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
72 input->id.version = 0x0100; 74 input->id.version = 0x0100;
73 75
74 for (i = 0; i < pdata->nbuttons; i++) { 76 for (i = 0; i < pdata->nbuttons; i++) {
75 int code = pdata->buttons[i].keycode; 77 struct gpio_keys_button *button = &pdata->buttons[i];
76 int irq = gpio_to_irq(pdata->buttons[i].gpio); 78 int irq = gpio_to_irq(button->gpio);
79 unsigned int type = button->type ?: EV_KEY;
77 80
78 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); 81 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
79 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, 82 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
80 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", 83 button->desc ? button->desc : "gpio_keys",
81 pdev); 84 pdev);
82 if (error) { 85 if (error) {
83 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", 86 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
84 irq, error); 87 irq, error);
85 goto fail; 88 goto fail;
86 } 89 }
87 set_bit(code, input->keybit); 90
91 input_set_capability(input, type, button->code);
88 } 92 }
89 93
90 error = input_register_device(input); 94 error = input_register_device(input);
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index 7cc9728b04df..cdd254f2e6c7 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -51,7 +51,7 @@ MODULE_LICENSE("Dual BSD/GPL");
51 51
52#define HIL_KBD_SET1_UPBIT 0x01 52#define HIL_KBD_SET1_UPBIT 0x01
53#define HIL_KBD_SET1_SHIFT 1 53#define HIL_KBD_SET1_SHIFT 1
54static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] = 54static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly =
55 { HIL_KEYCODES_SET1 }; 55 { HIL_KEYCODES_SET1 };
56 56
57#define HIL_KBD_SET2_UPBIT 0x01 57#define HIL_KBD_SET2_UPBIT 0x01
@@ -60,10 +60,10 @@ static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] =
60 60
61#define HIL_KBD_SET3_UPBIT 0x80 61#define HIL_KBD_SET3_UPBIT 0x80
62#define HIL_KBD_SET3_SHIFT 0 62#define HIL_KBD_SET3_SHIFT 0
63static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] = 63static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] __read_mostly =
64 { HIL_KEYCODES_SET3 }; 64 { HIL_KEYCODES_SET3 };
65 65
66static char hil_language[][16] = { HIL_LOCALE_MAP }; 66static const char hil_language[][16] = { HIL_LOCALE_MAP };
67 67
68struct hil_kbd { 68struct hil_kbd {
69 struct input_dev *dev; 69 struct input_dev *dev;
@@ -94,10 +94,12 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
94 idx = kbd->idx4/4; 94 idx = kbd->idx4/4;
95 p = data[idx - 1]; 95 p = data[idx - 1];
96 96
97 if ((p & ~HIL_CMDCT_POL) == 97 if ((p & ~HIL_CMDCT_POL) ==
98 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) goto report; 98 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL))
99 if ((p & ~HIL_CMDCT_RPL) == 99 goto report;
100 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) goto report; 100 if ((p & ~HIL_CMDCT_RPL) ==
101 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL))
102 goto report;
101 103
102 /* Not a poll response. See if we are loading config records. */ 104 /* Not a poll response. See if we are loading config records. */
103 switch (p & HIL_PKT_DATA_MASK) { 105 switch (p & HIL_PKT_DATA_MASK) {
@@ -107,27 +109,32 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
107 for (; i < HIL_KBD_MAX_LENGTH; i++) 109 for (; i < HIL_KBD_MAX_LENGTH; i++)
108 kbd->idd[i] = 0; 110 kbd->idd[i] = 0;
109 break; 111 break;
112
110 case HIL_CMD_RSC: 113 case HIL_CMD_RSC:
111 for (i = 0; i < idx; i++) 114 for (i = 0; i < idx; i++)
112 kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK; 115 kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
113 for (; i < HIL_KBD_MAX_LENGTH; i++) 116 for (; i < HIL_KBD_MAX_LENGTH; i++)
114 kbd->rsc[i] = 0; 117 kbd->rsc[i] = 0;
115 break; 118 break;
119
116 case HIL_CMD_EXD: 120 case HIL_CMD_EXD:
117 for (i = 0; i < idx; i++) 121 for (i = 0; i < idx; i++)
118 kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK; 122 kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
119 for (; i < HIL_KBD_MAX_LENGTH; i++) 123 for (; i < HIL_KBD_MAX_LENGTH; i++)
120 kbd->exd[i] = 0; 124 kbd->exd[i] = 0;
121 break; 125 break;
126
122 case HIL_CMD_RNM: 127 case HIL_CMD_RNM:
123 for (i = 0; i < idx; i++) 128 for (i = 0; i < idx; i++)
124 kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK; 129 kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
125 for (; i < HIL_KBD_MAX_LENGTH + 1; i++) 130 for (; i < HIL_KBD_MAX_LENGTH + 1; i++)
126 kbd->rnm[i] = '\0'; 131 kbd->rnm[i] = '\0';
127 break; 132 break;
133
128 default: 134 default:
129 /* These occur when device isn't present */ 135 /* These occur when device isn't present */
130 if (p == (HIL_ERR_INT | HIL_PKT_CMD)) break; 136 if (p == (HIL_ERR_INT | HIL_PKT_CMD))
137 break;
131 /* Anything else we'd like to know about. */ 138 /* Anything else we'd like to know about. */
132 printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); 139 printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p);
133 break; 140 break;
@@ -139,16 +146,19 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
139 switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) { 146 switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) {
140 case HIL_POL_CHARTYPE_NONE: 147 case HIL_POL_CHARTYPE_NONE:
141 break; 148 break;
149
142 case HIL_POL_CHARTYPE_ASCII: 150 case HIL_POL_CHARTYPE_ASCII:
143 while (cnt < idx - 1) 151 while (cnt < idx - 1)
144 input_report_key(dev, kbd->data[cnt++] & 0x7f, 1); 152 input_report_key(dev, kbd->data[cnt++] & 0x7f, 1);
145 break; 153 break;
154
146 case HIL_POL_CHARTYPE_RSVD1: 155 case HIL_POL_CHARTYPE_RSVD1:
147 case HIL_POL_CHARTYPE_RSVD2: 156 case HIL_POL_CHARTYPE_RSVD2:
148 case HIL_POL_CHARTYPE_BINARY: 157 case HIL_POL_CHARTYPE_BINARY:
149 while (cnt < idx - 1) 158 while (cnt < idx - 1)
150 input_report_key(dev, kbd->data[cnt++], 1); 159 input_report_key(dev, kbd->data[cnt++], 1);
151 break; 160 break;
161
152 case HIL_POL_CHARTYPE_SET1: 162 case HIL_POL_CHARTYPE_SET1:
153 while (cnt < idx - 1) { 163 while (cnt < idx - 1) {
154 unsigned int key; 164 unsigned int key;
@@ -161,6 +171,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
161 input_report_key(dev, key, !up); 171 input_report_key(dev, key, !up);
162 } 172 }
163 break; 173 break;
174
164 case HIL_POL_CHARTYPE_SET2: 175 case HIL_POL_CHARTYPE_SET2:
165 while (cnt < idx - 1) { 176 while (cnt < idx - 1) {
166 unsigned int key; 177 unsigned int key;
@@ -173,6 +184,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
173 input_report_key(dev, key, !up); 184 input_report_key(dev, key, !up);
174 } 185 }
175 break; 186 break;
187
176 case HIL_POL_CHARTYPE_SET3: 188 case HIL_POL_CHARTYPE_SET3:
177 while (cnt < idx - 1) { 189 while (cnt < idx - 1) {
178 unsigned int key; 190 unsigned int key;
@@ -191,42 +203,43 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
191 up(&kbd->sem); 203 up(&kbd->sem);
192} 204}
193 205
194static void hil_kbd_process_err(struct hil_kbd *kbd) { 206static void hil_kbd_process_err(struct hil_kbd *kbd)
207{
195 printk(KERN_WARNING PREFIX "errored HIL packet\n"); 208 printk(KERN_WARNING PREFIX "errored HIL packet\n");
196 kbd->idx4 = 0; 209 kbd->idx4 = 0;
197 up(&kbd->sem); 210 up(&kbd->sem);
198} 211}
199 212
200static irqreturn_t hil_kbd_interrupt(struct serio *serio, 213static irqreturn_t hil_kbd_interrupt(struct serio *serio,
201 unsigned char data, unsigned int flags) 214 unsigned char data, unsigned int flags)
202{ 215{
203 struct hil_kbd *kbd; 216 struct hil_kbd *kbd;
204 hil_packet packet; 217 hil_packet packet;
205 int idx; 218 int idx;
206 219
207 kbd = serio_get_drvdata(serio); 220 kbd = serio_get_drvdata(serio);
208 if (kbd == NULL) { 221 BUG_ON(kbd == NULL);
209 BUG();
210 return IRQ_HANDLED;
211 }
212 222
213 if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) { 223 if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) {
214 hil_kbd_process_err(kbd); 224 hil_kbd_process_err(kbd);
215 return IRQ_HANDLED; 225 return IRQ_HANDLED;
216 } 226 }
217 idx = kbd->idx4/4; 227 idx = kbd->idx4/4;
218 if (!(kbd->idx4 % 4)) kbd->data[idx] = 0; 228 if (!(kbd->idx4 % 4))
229 kbd->data[idx] = 0;
219 packet = kbd->data[idx]; 230 packet = kbd->data[idx];
220 packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8); 231 packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8);
221 kbd->data[idx] = packet; 232 kbd->data[idx] = packet;
222 233
223 /* Records of N 4-byte hil_packets must terminate with a command. */ 234 /* Records of N 4-byte hil_packets must terminate with a command. */
224 if ((++(kbd->idx4)) % 4) return IRQ_HANDLED; 235 if ((++(kbd->idx4)) % 4)
236 return IRQ_HANDLED;
225 if ((packet & 0xffff0000) != HIL_ERR_INT) { 237 if ((packet & 0xffff0000) != HIL_ERR_INT) {
226 hil_kbd_process_err(kbd); 238 hil_kbd_process_err(kbd);
227 return IRQ_HANDLED; 239 return IRQ_HANDLED;
228 } 240 }
229 if (packet & HIL_PKT_CMD) hil_kbd_process_record(kbd); 241 if (packet & HIL_PKT_CMD)
242 hil_kbd_process_record(kbd);
230 return IRQ_HANDLED; 243 return IRQ_HANDLED;
231} 244}
232 245
@@ -235,10 +248,7 @@ static void hil_kbd_disconnect(struct serio *serio)
235 struct hil_kbd *kbd; 248 struct hil_kbd *kbd;
236 249
237 kbd = serio_get_drvdata(serio); 250 kbd = serio_get_drvdata(serio);
238 if (kbd == NULL) { 251 BUG_ON(kbd == NULL);
239 BUG();
240 return;
241 }
242 252
243 serio_close(serio); 253 serio_close(serio);
244 input_unregister_device(kbd->dev); 254 input_unregister_device(kbd->dev);
@@ -259,42 +269,40 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
259 if (!kbd->dev) 269 if (!kbd->dev)
260 goto bail0; 270 goto bail0;
261 271
262 kbd->dev->private = kbd;
263
264 if (serio_open(serio, drv)) 272 if (serio_open(serio, drv))
265 goto bail1; 273 goto bail1;
266 274
267 serio_set_drvdata(serio, kbd); 275 serio_set_drvdata(serio, kbd);
268 kbd->serio = serio; 276 kbd->serio = serio;
269 277
270 init_MUTEX_LOCKED(&(kbd->sem)); 278 init_MUTEX_LOCKED(&kbd->sem);
271 279
272 /* Get device info. MLC driver supplies devid/status/etc. */ 280 /* Get device info. MLC driver supplies devid/status/etc. */
273 serio->write(serio, 0); 281 serio->write(serio, 0);
274 serio->write(serio, 0); 282 serio->write(serio, 0);
275 serio->write(serio, HIL_PKT_CMD >> 8); 283 serio->write(serio, HIL_PKT_CMD >> 8);
276 serio->write(serio, HIL_CMD_IDD); 284 serio->write(serio, HIL_CMD_IDD);
277 down(&(kbd->sem)); 285 down(&kbd->sem);
278 286
279 serio->write(serio, 0); 287 serio->write(serio, 0);
280 serio->write(serio, 0); 288 serio->write(serio, 0);
281 serio->write(serio, HIL_PKT_CMD >> 8); 289 serio->write(serio, HIL_PKT_CMD >> 8);
282 serio->write(serio, HIL_CMD_RSC); 290 serio->write(serio, HIL_CMD_RSC);
283 down(&(kbd->sem)); 291 down(&kbd->sem);
284 292
285 serio->write(serio, 0); 293 serio->write(serio, 0);
286 serio->write(serio, 0); 294 serio->write(serio, 0);
287 serio->write(serio, HIL_PKT_CMD >> 8); 295 serio->write(serio, HIL_PKT_CMD >> 8);
288 serio->write(serio, HIL_CMD_RNM); 296 serio->write(serio, HIL_CMD_RNM);
289 down(&(kbd->sem)); 297 down(&kbd->sem);
290 298
291 serio->write(serio, 0); 299 serio->write(serio, 0);
292 serio->write(serio, 0); 300 serio->write(serio, 0);
293 serio->write(serio, HIL_PKT_CMD >> 8); 301 serio->write(serio, HIL_PKT_CMD >> 8);
294 serio->write(serio, HIL_CMD_EXD); 302 serio->write(serio, HIL_CMD_EXD);
295 down(&(kbd->sem)); 303 down(&kbd->sem);
296 304
297 up(&(kbd->sem)); 305 up(&kbd->sem);
298 306
299 did = kbd->idd[0]; 307 did = kbd->idd[0];
300 idd = kbd->idd + 1; 308 idd = kbd->idd + 1;
@@ -310,12 +318,11 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
310 goto bail2; 318 goto bail2;
311 } 319 }
312 320
313 if(HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) { 321 if (HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) {
314 printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n"); 322 printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n");
315 goto bail2; 323 goto bail2;
316 } 324 }
317 325
318
319 kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 326 kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
320 kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); 327 kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL);
321 kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; 328 kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE;
@@ -328,7 +335,7 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
328 kbd->dev->id.vendor = PCI_VENDOR_ID_HP; 335 kbd->dev->id.vendor = PCI_VENDOR_ID_HP;
329 kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */ 336 kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */
330 kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */ 337 kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */
331 kbd->dev->cdev.dev = &serio->dev; 338 kbd->dev->dev.parent = &serio->dev;
332 339
333 for (i = 0; i < 128; i++) { 340 for (i = 0; i < 128; i++) {
334 set_bit(hil_kbd_set1[i], kbd->dev->keybit); 341 set_bit(hil_kbd_set1[i], kbd->dev->keybit);
@@ -344,8 +351,8 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
344 serio->write(serio, 0); 351 serio->write(serio, 0);
345 serio->write(serio, HIL_PKT_CMD >> 8); 352 serio->write(serio, HIL_PKT_CMD >> 8);
346 serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ 353 serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */
347 down(&(kbd->sem)); 354 down(&kbd->sem);
348 up(&(kbd->sem)); 355 up(&kbd->sem);
349 356
350 return 0; 357 return 0;
351 bail2: 358 bail2:
@@ -368,26 +375,26 @@ static struct serio_device_id hil_kbd_ids[] = {
368 { 0 } 375 { 0 }
369}; 376};
370 377
371struct serio_driver hil_kbd_serio_drv = { 378static struct serio_driver hil_kbd_serio_drv = {
372 .driver = { 379 .driver = {
373 .name = "hil_kbd", 380 .name = "hil_kbd",
374 }, 381 },
375 .description = "HP HIL keyboard driver", 382 .description = "HP HIL keyboard driver",
376 .id_table = hil_kbd_ids, 383 .id_table = hil_kbd_ids,
377 .connect = hil_kbd_connect, 384 .connect = hil_kbd_connect,
378 .disconnect = hil_kbd_disconnect, 385 .disconnect = hil_kbd_disconnect,
379 .interrupt = hil_kbd_interrupt 386 .interrupt = hil_kbd_interrupt
380}; 387};
381 388
382static int __init hil_kbd_init(void) 389static int __init hil_kbd_init(void)
383{ 390{
384 return serio_register_driver(&hil_kbd_serio_drv); 391 return serio_register_driver(&hil_kbd_serio_drv);
385} 392}
386 393
387static void __exit hil_kbd_exit(void) 394static void __exit hil_kbd_exit(void)
388{ 395{
389 serio_unregister_driver(&hil_kbd_serio_drv); 396 serio_unregister_driver(&hil_kbd_serio_drv);
390} 397}
391 398
392module_init(hil_kbd_init); 399module_init(hil_kbd_init);
393module_exit(hil_kbd_exit); 400module_exit(hil_kbd_exit);
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index 4de4dc297d50..499b6974457f 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 1998 Philip Blundell <philb@gnu.org> 4 * Copyright (C) 1998 Philip Blundell <philb@gnu.org>
5 * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> 5 * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai>
6 * Copyright (C) 1999-2006 Helge Deller <deller@gmx.de> 6 * Copyright (C) 1999-2007 Helge Deller <deller@gmx.de>
7 * 7 *
8 * Very basic HP Human Interface Loop (HIL) driver. 8 * Very basic HP Human Interface Loop (HIL) driver.
9 * This driver handles the keyboard on HP300 (m68k) and on some 9 * This driver handles the keyboard on HP300 (m68k) and on some
@@ -52,7 +52,7 @@ MODULE_LICENSE("GPL v2");
52 52
53#elif defined(CONFIG_HP300) 53#elif defined(CONFIG_HP300)
54 54
55 #define HILBASE 0xf0428000 /* HP300 (m86k) port address */ 55 #define HILBASE 0xf0428000UL /* HP300 (m68k) port address */
56 #define HIL_DATA 0x1 56 #define HIL_DATA 0x1
57 #define HIL_CMD 0x3 57 #define HIL_CMD 0x3
58 #define HIL_IRQ 2 58 #define HIL_IRQ 2
@@ -89,7 +89,7 @@ MODULE_LICENSE("GPL v2");
89#define HIL_READKBDSADR 0xF9 89#define HIL_READKBDSADR 0xF9
90#define HIL_WRITEKBDSADR 0xE9 90#define HIL_WRITEKBDSADR 0xE9
91 91
92static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] = 92static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly =
93 { HIL_KEYCODES_SET1 }; 93 { HIL_KEYCODES_SET1 };
94 94
95/* HIL structure */ 95/* HIL structure */
@@ -211,10 +211,10 @@ hil_keyb_init(void)
211 return -ENODEV; /* already initialized */ 211 return -ENODEV; /* already initialized */
212 } 212 }
213 213
214 spin_lock_init(&hil_dev.lock);
214 hil_dev.dev = input_allocate_device(); 215 hil_dev.dev = input_allocate_device();
215 if (!hil_dev.dev) 216 if (!hil_dev.dev)
216 return -ENOMEM; 217 return -ENOMEM;
217 hil_dev.dev->private = &hil_dev;
218 218
219#if defined(CONFIG_HP300) 219#if defined(CONFIG_HP300)
220 if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { 220 if (!hwreg_present((void *)(HILBASE + HIL_DATA))) {
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
index 3d4d0a0ede28..1b08f4e79dd2 100644
--- a/drivers/input/keyboard/lkkbd.c
+++ b/drivers/input/keyboard/lkkbd.c
@@ -515,7 +515,7 @@ static int
515lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, 515lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
516 int value) 516 int value)
517{ 517{
518 struct lkkbd *lk = dev->private; 518 struct lkkbd *lk = input_get_drvdata (dev);
519 unsigned char leds_on = 0; 519 unsigned char leds_on = 0;
520 unsigned char leds_off = 0; 520 unsigned char leds_off = 0;
521 521
@@ -666,9 +666,10 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
666 input_dev->id.vendor = SERIO_LKKBD; 666 input_dev->id.vendor = SERIO_LKKBD;
667 input_dev->id.product = 0; 667 input_dev->id.product = 0;
668 input_dev->id.version = 0x0100; 668 input_dev->id.version = 0x0100;
669 input_dev->cdev.dev = &serio->dev; 669 input_dev->dev.parent = &serio->dev;
670 input_dev->event = lkkbd_event; 670 input_dev->event = lkkbd_event;
671 input_dev->private = lk; 671
672 input_set_drvdata (input_dev, lk);
672 673
673 set_bit (EV_KEY, input_dev->evbit); 674 set_bit (EV_KEY, input_dev->evbit);
674 set_bit (EV_LED, input_dev->evbit); 675 set_bit (EV_LED, input_dev->evbit);
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 2ade5186cc41..7a41b271f222 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -231,7 +231,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
231 input_dev->id.vendor = 0x0001; 231 input_dev->id.vendor = 0x0001;
232 input_dev->id.product = 0x0001; 232 input_dev->id.product = 0x0001;
233 input_dev->id.version = 0x0100; 233 input_dev->id.version = 0x0100;
234 input_dev->private = locomokbd; 234 input_dev->dev.parent = &dev->dev;
235 235
236 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 236 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
237 input_dev->keycode = locomokbd->keycode; 237 input_dev->keycode = locomokbd->keycode;
diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
index aa29b50765c9..b97a41e3ee56 100644
--- a/drivers/input/keyboard/newtonkbd.c
+++ b/drivers/input/keyboard/newtonkbd.c
@@ -104,8 +104,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
104 input_dev->id.vendor = SERIO_NEWTON; 104 input_dev->id.vendor = SERIO_NEWTON;
105 input_dev->id.product = 0x0001; 105 input_dev->id.product = 0x0001;
106 input_dev->id.version = 0x0100; 106 input_dev->id.version = 0x0100;
107 input_dev->cdev.dev = &serio->dev; 107 input_dev->dev.parent = &serio->dev;
108 input_dev->private = nkbd;
109 108
110 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 109 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
111 input_dev->keycode = nkbd->keycode; 110 input_dev->keycode = nkbd->keycode;
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 5680a6d95b2b..3a228634f101 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -370,8 +370,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
370 set_bit(keymap[i] & KEY_MAX, input_dev->keybit); 370 set_bit(keymap[i] & KEY_MAX, input_dev->keybit);
371 input_dev->name = "omap-keypad"; 371 input_dev->name = "omap-keypad";
372 input_dev->phys = "omap-keypad/input0"; 372 input_dev->phys = "omap-keypad/input0";
373 input_dev->cdev.dev = &pdev->dev; 373 input_dev->dev.parent = &pdev->dev;
374 input_dev->private = omap_kp;
375 374
376 input_dev->id.bustype = BUS_HOST; 375 input_dev->id.bustype = BUS_HOST;
377 input_dev->id.vendor = 0x0001; 376 input_dev->id.vendor = 0x0001;
diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c
new file mode 100644
index 000000000000..06eaf766d9d2
--- /dev/null
+++ b/drivers/input/keyboard/pxa27x_keyboard.c
@@ -0,0 +1,258 @@
1/*
2 * linux/drivers/input/keyboard/pxa27x_keyboard.c
3 *
4 * Driver for the pxa27x matrix keyboard controller.
5 *
6 * Created: Feb 22, 2007
7 * Author: Rodolfo Giometti <giometti@linux.it>
8 *
9 * Based on a previous implementations by Kevin O'Connor
10 * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and
11 * on some suggestions by Nicolas Pitre <nico@cam.org>.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/input.h>
24#include <linux/device.h>
25#include <linux/platform_device.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include <asm/arch/hardware.h>
32#include <asm/arch/pxa-regs.h>
33#include <asm/arch/irqs.h>
34#include <asm/arch/pxa27x_keyboard.h>
35
36#define DRIVER_NAME "pxa27x-keyboard"
37
38#define KPASMKP(col) (col/2 == 0 ? KPASMKP0 : \
39 col/2 == 1 ? KPASMKP1 : \
40 col/2 == 2 ? KPASMKP2 : KPASMKP3)
41#define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2)))
42
43static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id)
44{
45 struct platform_device *pdev = dev_id;
46 struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
47 struct input_dev *input_dev = platform_get_drvdata(pdev);
48 unsigned long kpc = KPC;
49 int p, row, col, rel;
50
51 if (kpc & KPC_DI) {
52 unsigned long kpdk = KPDK;
53
54 if (!(kpdk & KPDK_DKP)) {
55 /* better luck next time */
56 } else if (kpc & KPC_REE0) {
57 unsigned long kprec = KPREC;
58 KPREC = 0x7f;
59
60 if (kprec & KPREC_OF0)
61 rel = (kprec & 0xff) + 0x7f;
62 else if (kprec & KPREC_UF0)
63 rel = (kprec & 0xff) - 0x7f - 0xff;
64 else
65 rel = (kprec & 0xff) - 0x7f;
66
67 if (rel) {
68 input_report_rel(input_dev, REL_WHEEL, rel);
69 input_sync(input_dev);
70 }
71 }
72 }
73
74 if (kpc & KPC_MI) {
75 /* report the status of every button */
76 for (row = 0; row < pdata->nr_rows; row++) {
77 for (col = 0; col < pdata->nr_cols; col++) {
78 p = KPASMKP(col) & KPASMKPx_MKC(row, col) ?
79 1 : 0;
80 pr_debug("keycode %x - pressed %x\n",
81 pdata->keycodes[row][col], p);
82 input_report_key(input_dev,
83 pdata->keycodes[row][col], p);
84 }
85 }
86 input_sync(input_dev);
87 }
88
89 return IRQ_HANDLED;
90}
91
92static int pxakbd_open(struct input_dev *dev)
93{
94 /* Set keypad control register */
95 KPC |= (KPC_ASACT |
96 KPC_MS_ALL |
97 (2 << 6) | KPC_REE0 | KPC_DK_DEB_SEL |
98 KPC_ME | KPC_MIE | KPC_DE | KPC_DIE);
99
100 KPC &= ~KPC_AS; /* disable automatic scan */
101 KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */
102
103 /* Set rotary count to mid-point value */
104 KPREC = 0x7F;
105
106 /* Enable unit clock */
107 pxa_set_cken(CKEN19_KEYPAD, 1);
108
109 return 0;
110}
111
112static void pxakbd_close(struct input_dev *dev)
113{
114 /* Disable clock unit */
115 pxa_set_cken(CKEN19_KEYPAD, 0);
116}
117
118#ifdef CONFIG_PM
119static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state)
120{
121 struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
122
123 /* Save controller status */
124 pdata->reg_kpc = KPC;
125 pdata->reg_kprec = KPREC;
126
127 return 0;
128}
129
130static int pxakbd_resume(struct platform_device *pdev)
131{
132 struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
133 struct input_dev *input_dev = platform_get_drvdata(pdev);
134
135 mutex_lock(&input_dev->mutex);
136
137 if (input_dev->users) {
138 /* Restore controller status */
139 KPC = pdata->reg_kpc;
140 KPREC = pdata->reg_kprec;
141
142 /* Enable unit clock */
143 pxa_set_cken(CKEN19_KEYPAD, 1);
144 }
145
146 mutex_unlock(&input_dev->mutex);
147
148 return 0;
149}
150#else
151#define pxakbd_suspend NULL
152#define pxakbd_resume NULL
153#endif
154
155static int __devinit pxakbd_probe(struct platform_device *pdev)
156{
157 struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
158 struct input_dev *input_dev;
159 int i, row, col, error;
160
161 /* Create and register the input driver. */
162 input_dev = input_allocate_device();
163 if (!input_dev) {
164 printk(KERN_ERR "Cannot request keypad device\n");
165 return -ENOMEM;
166 }
167
168 input_dev->name = DRIVER_NAME;
169 input_dev->id.bustype = BUS_HOST;
170 input_dev->open = pxakbd_open;
171 input_dev->close = pxakbd_close;
172 input_dev->dev.parent = &pdev->dev;
173
174 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
175 input_dev->relbit[LONG(REL_WHEEL)] = BIT(REL_WHEEL);
176 for (row = 0; row < pdata->nr_rows; row++) {
177 for (col = 0; col < pdata->nr_cols; col++) {
178 int code = pdata->keycodes[row][col];
179 if (code > 0)
180 set_bit(code, input_dev->keybit);
181 }
182 }
183
184 error = request_irq(IRQ_KEYPAD, pxakbd_irq_handler, IRQF_DISABLED,
185 DRIVER_NAME, pdev);
186 if (error) {
187 printk(KERN_ERR "Cannot request keypad IRQ\n");
188 pxa_set_cken(CKEN19_KEYPAD, 0);
189 goto err_free_dev;
190 }
191
192 platform_set_drvdata(pdev, input_dev);
193
194 /* Register the input device */
195 error = input_register_device(input_dev);
196 if (error)
197 goto err_free_irq;
198
199 /* Setup GPIOs. */
200 for (i = 0; i < pdata->nr_rows + pdata->nr_cols; i++)
201 pxa_gpio_mode(pdata->gpio_modes[i]);
202
203 /*
204 * Store rows/cols info into keyboard registers.
205 */
206
207 KPC |= (pdata->nr_rows - 1) << 26;
208 KPC |= (pdata->nr_cols - 1) << 23;
209
210 for (col = 0; col < pdata->nr_cols; col++)
211 KPC |= KPC_MS0 << col;
212
213 return 0;
214
215 err_free_irq:
216 platform_set_drvdata(pdev, NULL);
217 free_irq(IRQ_KEYPAD, pdev);
218 err_free_dev:
219 input_free_device(input_dev);
220 return error;
221}
222
223static int __devexit pxakbd_remove(struct platform_device *pdev)
224{
225 struct input_dev *input_dev = platform_get_drvdata(pdev);
226
227 input_unregister_device(input_dev);
228 free_irq(IRQ_KEYPAD, pdev);
229 platform_set_drvdata(pdev, NULL);
230
231 return 0;
232}
233
234static struct platform_driver pxakbd_driver = {
235 .probe = pxakbd_probe,
236 .remove = __devexit_p(pxakbd_remove),
237 .suspend = pxakbd_suspend,
238 .resume = pxakbd_resume,
239 .driver = {
240 .name = DRIVER_NAME,
241 },
242};
243
244static int __init pxakbd_init(void)
245{
246 return platform_driver_register(&pxakbd_driver);
247}
248
249static void __exit pxakbd_exit(void)
250{
251 platform_driver_unregister(&pxakbd_driver);
252}
253
254module_init(pxakbd_init);
255module_exit(pxakbd_exit);
256
257MODULE_DESCRIPTION("PXA27x Matrix Keyboard Driver");
258MODULE_LICENSE("GPL");
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 8a2166c77ff4..41b80385476c 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -372,10 +372,9 @@ static int __init spitzkbd_probe(struct platform_device *dev)
372 372
373 spitzkbd->input = input_dev; 373 spitzkbd->input = input_dev;
374 374
375 input_dev->private = spitzkbd;
376 input_dev->name = "Spitz Keyboard"; 375 input_dev->name = "Spitz Keyboard";
377 input_dev->phys = spitzkbd->phys; 376 input_dev->phys = spitzkbd->phys;
378 input_dev->cdev.dev = &dev->dev; 377 input_dev->dev.parent = &dev->dev;
379 378
380 input_dev->id.bustype = BUS_HOST; 379 input_dev->id.bustype = BUS_HOST;
381 input_dev->id.vendor = 0x0001; 380 input_dev->id.vendor = 0x0001;
diff --git a/drivers/input/keyboard/stowaway.c b/drivers/input/keyboard/stowaway.c
index f7b5c5b81451..b44b0684d543 100644
--- a/drivers/input/keyboard/stowaway.c
+++ b/drivers/input/keyboard/stowaway.c
@@ -108,8 +108,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv)
108 input_dev->id.vendor = SERIO_STOWAWAY; 108 input_dev->id.vendor = SERIO_STOWAWAY;
109 input_dev->id.product = 0x0001; 109 input_dev->id.product = 0x0001;
110 input_dev->id.version = 0x0100; 110 input_dev->id.version = 0x0100;
111 input_dev->cdev.dev = &serio->dev; 111 input_dev->dev.parent = &serio->dev;
112 input_dev->private = skbd;
113 112
114 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 113 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
115 input_dev->keycode = skbd->keycode; 114 input_dev->keycode = skbd->keycode;
diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
index cc0238366414..1d4e39624cfe 100644
--- a/drivers/input/keyboard/sunkbd.c
+++ b/drivers/input/keyboard/sunkbd.c
@@ -146,7 +146,7 @@ out:
146 146
147static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 147static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
148{ 148{
149 struct sunkbd *sunkbd = dev->private; 149 struct sunkbd *sunkbd = input_get_drvdata(dev);
150 150
151 switch (type) { 151 switch (type) {
152 152
@@ -271,8 +271,10 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
271 input_dev->id.vendor = SERIO_SUNKBD; 271 input_dev->id.vendor = SERIO_SUNKBD;
272 input_dev->id.product = sunkbd->type; 272 input_dev->id.product = sunkbd->type;
273 input_dev->id.version = 0x0100; 273 input_dev->id.version = 0x0100;
274 input_dev->cdev.dev = &serio->dev; 274 input_dev->dev.parent = &serio->dev;
275 input_dev->private = sunkbd; 275
276 input_set_drvdata(input_dev, sunkbd);
277
276 input_dev->event = sunkbd_event; 278 input_dev->event = sunkbd_event;
277 279
278 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP); 280 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP);
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
index a82093432138..f3a56eb58ed1 100644
--- a/drivers/input/keyboard/xtkbd.c
+++ b/drivers/input/keyboard/xtkbd.c
@@ -108,8 +108,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
108 input_dev->id.vendor = 0x0001; 108 input_dev->id.vendor = 0x0001;
109 input_dev->id.product = 0x0001; 109 input_dev->id.product = 0x0001;
110 input_dev->id.version = 0x0100; 110 input_dev->id.version = 0x0100;
111 input_dev->cdev.dev = &serio->dev; 111 input_dev->dev.parent = &serio->dev;
112 input_dev->private = xtkbd;
113 112
114 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 113 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
115 input_dev->keycode = xtkbd->keycode; 114 input_dev->keycode = xtkbd->keycode;
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 41b42587f5e9..1d0d3e765db6 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP
40 tristate "M68k Beeper support" 40 tristate "M68k Beeper support"
41 depends on M68K 41 depends on M68K
42 42
43config INPUT_COBALT_BTNS
44 tristate "Cobalt button interface"
45 depends on MIPS_COBALT
46 select INPUT_POLLDEV
47 help
48 Say Y here if you want to support MIPS Cobalt button interface.
49
50 To compile this driver as a module, choose M here: the
51 module will be called cobalt_btns.
52
43config INPUT_WISTRON_BTNS 53config INPUT_WISTRON_BTNS
44 tristate "x86 Wistron laptop button interface" 54 tristate "x86 Wistron laptop button interface"
45 depends on X86 && !X86_64 55 depends on X86 && !X86_64
@@ -81,8 +91,19 @@ config INPUT_UINPUT
81 To compile this driver as a module, choose M here: the 91 To compile this driver as a module, choose M here: the
82 module will be called uinput. 92 module will be called uinput.
83 93
94config INPUT_POLLDEV
95 tristate "Polled input device skeleton"
96 help
97 Say Y here if you are using a driver for an input
98 device that periodically polls hardware state. This
99 option is only useful for out-of-tree drivers since
100 in-tree drivers select it automatically.
101
102 To compile this driver as a module, choose M here: the
103 module will be called input-polldev.
104
84config HP_SDC_RTC 105config HP_SDC_RTC
85 tristate "HP SDC Real Time Clock" 106 tristate "HP SDC Real Time Clock"
86 depends on GSC || HP300 107 depends on GSC || HP300
87 select HP_SDC 108 select HP_SDC
88 help 109 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index e0a8d58c9e9b..21e3cca0d33e 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -4,10 +4,12 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
7obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 8obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
8obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 9obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 10obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
10obj-$(CONFIG_INPUT_UINPUT) += uinput.o 11obj-$(CONFIG_INPUT_UINPUT) += uinput.o
12obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o
11obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 13obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
12obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o 14obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
13obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 15obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c
new file mode 100644
index 000000000000..064b07936019
--- /dev/null
+++ b/drivers/input/misc/cobalt_btns.c
@@ -0,0 +1,172 @@
1/*
2 * Cobalt button interface driver.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/init.h>
21#include <linux/input-polldev.h>
22#include <linux/ioport.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25
26#define BUTTONS_POLL_INTERVAL 30 /* msec */
27#define BUTTONS_COUNT_THRESHOLD 3
28#define BUTTONS_STATUS_MASK 0xfe000000
29
30struct buttons_dev {
31 struct input_polled_dev *poll_dev;
32 void __iomem *reg;
33};
34
35struct buttons_map {
36 uint32_t mask;
37 int keycode;
38 int count;
39};
40
41static struct buttons_map buttons_map[] = {
42 { 0x02000000, KEY_RESTART, },
43 { 0x04000000, KEY_LEFT, },
44 { 0x08000000, KEY_UP, },
45 { 0x10000000, KEY_DOWN, },
46 { 0x20000000, KEY_RIGHT, },
47 { 0x40000000, KEY_ENTER, },
48 { 0x80000000, KEY_SELECT, },
49};
50
51static void handle_buttons(struct input_polled_dev *dev)
52{
53 struct buttons_map *button = buttons_map;
54 struct buttons_dev *bdev = dev->private;
55 struct input_dev *input = dev->input;
56 uint32_t status;
57 int i;
58
59 status = readl(bdev->reg);
60 status = ~status & BUTTONS_STATUS_MASK;
61
62 for (i = 0; i < ARRAY_SIZE(buttons_map); i++) {
63 if (status & button->mask) {
64 button->count++;
65 } else {
66 if (button->count >= BUTTONS_COUNT_THRESHOLD) {
67 input_report_key(input, button->keycode, 0);
68 input_sync(input);
69 }
70 button->count = 0;
71 }
72
73 if (button->count == BUTTONS_COUNT_THRESHOLD) {
74 input_report_key(input, button->keycode, 1);
75 input_sync(input);
76 }
77
78 button++;
79 }
80}
81
82static int __devinit cobalt_buttons_probe(struct platform_device *pdev)
83{
84 struct buttons_dev *bdev;
85 struct input_polled_dev *poll_dev;
86 struct input_dev *input;
87 struct resource *res;
88 int error, i;
89
90 bdev = kzalloc(sizeof(struct buttons_dev), GFP_KERNEL);
91 poll_dev = input_allocate_polled_device();
92 if (!bdev || !poll_dev) {
93 error = -ENOMEM;
94 goto err_free_mem;
95 }
96
97 poll_dev->private = bdev;
98 poll_dev->poll = handle_buttons;
99 poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
100
101 input = poll_dev->input;
102 input->name = "Cobalt buttons";
103 input->phys = "cobalt/input0";
104 input->id.bustype = BUS_HOST;
105 input->cdev.dev = &pdev->dev;
106
107 input->evbit[0] = BIT(EV_KEY);
108 for (i = 0; i < ARRAY_SIZE(buttons_map); i++) {
109 set_bit(buttons_map[i].keycode, input->keybit);
110 buttons_map[i].count = 0;
111 }
112
113 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
114 if (!res) {
115 error = -EBUSY;
116 goto err_free_mem;
117 }
118
119 bdev->poll_dev = poll_dev;
120 bdev->reg = ioremap(res->start, res->end - res->start + 1);
121 dev_set_drvdata(&pdev->dev, bdev);
122
123 error = input_register_polled_device(poll_dev);
124 if (error)
125 goto err_iounmap;
126
127 return 0;
128
129 err_iounmap:
130 iounmap(bdev->reg);
131 err_free_mem:
132 input_free_polled_device(poll_dev);
133 kfree(bdev);
134 dev_set_drvdata(&pdev->dev, NULL);
135 return error;
136}
137
138static int __devexit cobalt_buttons_remove(struct platform_device *pdev)
139{
140 struct device *dev = &pdev->dev;
141 struct buttons_dev *bdev = dev_get_drvdata(dev);
142
143 input_unregister_polled_device(bdev->poll_dev);
144 input_free_polled_device(bdev->poll_dev);
145 iounmap(bdev->reg);
146 kfree(bdev);
147 dev_set_drvdata(dev, NULL);
148
149 return 0;
150}
151
152static struct platform_driver cobalt_buttons_driver = {
153 .probe = cobalt_buttons_probe,
154 .remove = __devexit_p(cobalt_buttons_remove),
155 .driver = {
156 .name = "Cobalt buttons",
157 .owner = THIS_MODULE,
158 },
159};
160
161static int __init cobalt_buttons_init(void)
162{
163 return platform_driver_register(&cobalt_buttons_driver);
164}
165
166static void __exit cobalt_buttons_exit(void)
167{
168 platform_driver_unregister(&cobalt_buttons_driver);
169}
170
171module_init(cobalt_buttons_init);
172module_exit(cobalt_buttons_exit);
diff --git a/drivers/input/misc/input-polldev.c b/drivers/input/misc/input-polldev.c
new file mode 100644
index 000000000000..1b2b9c9c5d88
--- /dev/null
+++ b/drivers/input/misc/input-polldev.c
@@ -0,0 +1,171 @@
1/*
2 * Generic implementation of a polled input device
3
4 * Copyright (c) 2007 Dmitry Torokhov
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#include <linux/jiffies.h>
12#include <linux/mutex.h>
13#include <linux/input-polldev.h>
14
15static DEFINE_MUTEX(polldev_mutex);
16static int polldev_users;
17static struct workqueue_struct *polldev_wq;
18
19static int input_polldev_start_workqueue(void)
20{
21 int retval;
22
23 retval = mutex_lock_interruptible(&polldev_mutex);
24 if (retval)
25 return retval;
26
27 if (!polldev_users) {
28 polldev_wq = create_singlethread_workqueue("ipolldevd");
29 if (!polldev_wq) {
30 printk(KERN_ERR "input-polldev: failed to create "
31 "ipolldevd workqueue\n");
32 retval = -ENOMEM;
33 goto out;
34 }
35 }
36
37 polldev_users++;
38
39 out:
40 mutex_unlock(&polldev_mutex);
41 return retval;
42}
43
44static void input_polldev_stop_workqueue(void)
45{
46 mutex_lock(&polldev_mutex);
47
48 if (!--polldev_users)
49 destroy_workqueue(polldev_wq);
50
51 mutex_unlock(&polldev_mutex);
52}
53
54static void input_polled_device_work(struct work_struct *work)
55{
56 struct input_polled_dev *dev =
57 container_of(work, struct input_polled_dev, work.work);
58
59 dev->poll(dev);
60 queue_delayed_work(polldev_wq, &dev->work,
61 msecs_to_jiffies(dev->poll_interval));
62}
63
64static int input_open_polled_device(struct input_dev *input)
65{
66 struct input_polled_dev *dev = input->private;
67 int error;
68
69 error = input_polldev_start_workqueue();
70 if (error)
71 return error;
72
73 if (dev->flush)
74 dev->flush(dev);
75
76 queue_delayed_work(polldev_wq, &dev->work,
77 msecs_to_jiffies(dev->poll_interval));
78
79 return 0;
80}
81
82static void input_close_polled_device(struct input_dev *input)
83{
84 struct input_polled_dev *dev = input->private;
85
86 cancel_rearming_delayed_workqueue(polldev_wq, &dev->work);
87 input_polldev_stop_workqueue();
88}
89
90/**
91 * input_allocate_polled_device - allocated memory polled device
92 *
93 * The function allocates memory for a polled device and also
94 * for an input device associated with this polled device.
95 */
96struct input_polled_dev *input_allocate_polled_device(void)
97{
98 struct input_polled_dev *dev;
99
100 dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL);
101 if (!dev)
102 return NULL;
103
104 dev->input = input_allocate_device();
105 if (!dev->input) {
106 kfree(dev);
107 return NULL;
108 }
109
110 return dev;
111}
112EXPORT_SYMBOL(input_allocate_polled_device);
113
114/**
115 * input_free_polled_device - free memory allocated for polled device
116 * @dev: device to free
117 *
118 * The function frees memory allocated for polling device and drops
119 * reference to the associated input device (if present).
120 */
121void input_free_polled_device(struct input_polled_dev *dev)
122{
123 if (dev) {
124 input_free_device(dev->input);
125 kfree(dev);
126 }
127}
128EXPORT_SYMBOL(input_free_polled_device);
129
130/**
131 * input_register_polled_device - register polled device
132 * @dev: device to register
133 *
134 * The function registers previously initialized polled input device
135 * with input layer. The device should be allocated with call to
136 * input_allocate_polled_device(). Callers should also set up poll()
137 * method and set up capabilities (id, name, phys, bits) of the
138 * corresponing input_dev structure.
139 */
140int input_register_polled_device(struct input_polled_dev *dev)
141{
142 struct input_dev *input = dev->input;
143
144 INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
145 if (!dev->poll_interval)
146 dev->poll_interval = 500;
147 input->private = dev;
148 input->open = input_open_polled_device;
149 input->close = input_close_polled_device;
150
151 return input_register_device(input);
152}
153EXPORT_SYMBOL(input_register_polled_device);
154
155/**
156 * input_unregister_polled_device - unregister polled device
157 * @dev: device to unregister
158 *
159 * The function unregisters previously registered polled input
160 * device from input layer. Polling is stopped and device is
161 * ready to be freed with call to input_free_polled_device().
162 * Callers should not attempt to access dev->input pointer
163 * after calling this function.
164 */
165void input_unregister_polled_device(struct input_polled_dev *dev)
166{
167 input_unregister_device(dev->input);
168 dev->input = NULL;
169}
170EXPORT_SYMBOL(input_unregister_polled_device);
171
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 105c6fc27823..3d4b619dadab 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -51,7 +51,7 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
51 51
52static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 52static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
53{ 53{
54 unsigned int pin = (unsigned int) dev->private; 54 unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
55 unsigned int count = 0; 55 unsigned int count = 0;
56 56
57 if (type != EV_SND) 57 if (type != EV_SND)
@@ -99,14 +99,15 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
99 if (!input_dev) 99 if (!input_dev)
100 return -ENOMEM; 100 return -ENOMEM;
101 101
102 input_dev->private = (void *) dev->id; 102 input_set_drvdata(input_dev, (void *) dev->id);
103
103 input_dev->name = "ixp4xx beeper", 104 input_dev->name = "ixp4xx beeper",
104 input_dev->phys = "ixp4xx/gpio"; 105 input_dev->phys = "ixp4xx/gpio";
105 input_dev->id.bustype = BUS_HOST; 106 input_dev->id.bustype = BUS_HOST;
106 input_dev->id.vendor = 0x001f; 107 input_dev->id.vendor = 0x001f;
107 input_dev->id.product = 0x0001; 108 input_dev->id.product = 0x0001;
108 input_dev->id.version = 0x0100; 109 input_dev->id.version = 0x0100;
109 input_dev->cdev.dev = &dev->dev; 110 input_dev->dev.parent = &dev->dev;
110 111
111 input_dev->evbit[0] = BIT(EV_SND); 112 input_dev->evbit[0] = BIT(EV_SND);
112 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 113 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
@@ -136,7 +137,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
136static int __devexit ixp4xx_spkr_remove(struct platform_device *dev) 137static int __devexit ixp4xx_spkr_remove(struct platform_device *dev)
137{ 138{
138 struct input_dev *input_dev = platform_get_drvdata(dev); 139 struct input_dev *input_dev = platform_get_drvdata(dev);
139 unsigned int pin = (unsigned int) input_dev->private; 140 unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
140 141
141 input_unregister_device(input_dev); 142 input_unregister_device(input_dev);
142 platform_set_drvdata(dev, NULL); 143 platform_set_drvdata(dev, NULL);
@@ -153,7 +154,7 @@ static int __devexit ixp4xx_spkr_remove(struct platform_device *dev)
153static void ixp4xx_spkr_shutdown(struct platform_device *dev) 154static void ixp4xx_spkr_shutdown(struct platform_device *dev)
154{ 155{
155 struct input_dev *input_dev = platform_get_drvdata(dev); 156 struct input_dev *input_dev = platform_get_drvdata(dev);
156 unsigned int pin = (unsigned int) input_dev->private; 157 unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
157 158
158 /* turn off the speaker */ 159 /* turn off the speaker */
159 disable_irq(IRQ_IXP4XX_TIMER2); 160 disable_irq(IRQ_IXP4XX_TIMER2);
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c
index 8d6c3837badb..e9f26e766b4d 100644
--- a/drivers/input/misc/m68kspkr.c
+++ b/drivers/input/misc/m68kspkr.c
@@ -63,7 +63,7 @@ static int __devinit m68kspkr_probe(struct platform_device *dev)
63 input_dev->id.vendor = 0x001f; 63 input_dev->id.vendor = 0x001f;
64 input_dev->id.product = 0x0001; 64 input_dev->id.product = 0x0001;
65 input_dev->id.version = 0x0100; 65 input_dev->id.version = 0x0100;
66 input_dev->cdev.dev = &dev->dev; 66 input_dev->dev.parent = &dev->dev;
67 67
68 input_dev->evbit[0] = BIT(EV_SND); 68 input_dev->evbit[0] = BIT(EV_SND);
69 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 69 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index afd322185bbf..31989dcd922c 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -78,7 +78,7 @@ static int __devinit pcspkr_probe(struct platform_device *dev)
78 pcspkr_dev->id.vendor = 0x001f; 78 pcspkr_dev->id.vendor = 0x001f;
79 pcspkr_dev->id.product = 0x0001; 79 pcspkr_dev->id.product = 0x0001;
80 pcspkr_dev->id.version = 0x0100; 80 pcspkr_dev->id.version = 0x0100;
81 pcspkr_dev->cdev.dev = &dev->dev; 81 pcspkr_dev->dev.parent = &dev->dev;
82 82
83 pcspkr_dev->evbit[0] = BIT(EV_SND); 83 pcspkr_dev->evbit[0] = BIT(EV_SND);
84 pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 84 pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index 106c94f33b93..e36ec1d92be8 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -28,7 +28,7 @@ struct sparcspkr_state {
28 28
29static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 29static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
30{ 30{
31 struct sparcspkr_state *state = dev_get_drvdata(dev->cdev.dev); 31 struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
32 unsigned int count = 0; 32 unsigned int count = 0;
33 unsigned long flags; 33 unsigned long flags;
34 34
@@ -61,7 +61,7 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in
61 61
62static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 62static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
63{ 63{
64 struct sparcspkr_state *state = dev_get_drvdata(dev->cdev.dev); 64 struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
65 unsigned int count = 0; 65 unsigned int count = 0;
66 unsigned long flags; 66 unsigned long flags;
67 67
@@ -113,7 +113,7 @@ static int __devinit sparcspkr_probe(struct device *dev)
113 input_dev->id.vendor = 0x001f; 113 input_dev->id.vendor = 0x001f;
114 input_dev->id.product = 0x0001; 114 input_dev->id.product = 0x0001;
115 input_dev->id.version = 0x0100; 115 input_dev->id.version = 0x0100;
116 input_dev->cdev.dev = dev; 116 input_dev->dev.parent = dev;
117 117
118 input_dev->evbit[0] = BIT(EV_SND); 118 input_dev->evbit[0] = BIT(EV_SND);
119 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 119 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 42556232c523..031467eadd31 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -41,9 +41,7 @@
41 41
42static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 42static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
43{ 43{
44 struct uinput_device *udev; 44 struct uinput_device *udev = input_get_drvdata(dev);
45
46 udev = dev->private;
47 45
48 udev->buff[udev->head].type = type; 46 udev->buff[udev->head].type = type;
49 udev->buff[udev->head].code = code; 47 udev->buff[udev->head].code = code;
@@ -136,7 +134,7 @@ static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *eff
136 request.u.upload.effect = effect; 134 request.u.upload.effect = effect;
137 request.u.upload.old = old; 135 request.u.upload.old = old;
138 136
139 retval = uinput_request_reserve_slot(dev->private, &request); 137 retval = uinput_request_reserve_slot(input_get_drvdata(dev), &request);
140 if (!retval) 138 if (!retval)
141 retval = uinput_request_submit(dev, &request); 139 retval = uinput_request_submit(dev, &request);
142 140
@@ -156,7 +154,7 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
156 request.code = UI_FF_ERASE; 154 request.code = UI_FF_ERASE;
157 request.u.effect_id = effect_id; 155 request.u.effect_id = effect_id;
158 156
159 retval = uinput_request_reserve_slot(dev->private, &request); 157 retval = uinput_request_reserve_slot(input_get_drvdata(dev), &request);
160 if (!retval) 158 if (!retval)
161 retval = uinput_request_submit(dev, &request); 159 retval = uinput_request_submit(dev, &request);
162 160
@@ -274,7 +272,7 @@ static int uinput_allocate_device(struct uinput_device *udev)
274 return -ENOMEM; 272 return -ENOMEM;
275 273
276 udev->dev->event = uinput_dev_event; 274 udev->dev->event = uinput_dev_event;
277 udev->dev->private = udev; 275 input_set_drvdata(udev->dev, udev);
278 276
279 return 0; 277 return 0;
280} 278}
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index e1183aeb8ed5..961aad7a0476 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -50,7 +50,7 @@
50MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); 50MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
51MODULE_DESCRIPTION("Wistron laptop button driver"); 51MODULE_DESCRIPTION("Wistron laptop button driver");
52MODULE_LICENSE("GPL v2"); 52MODULE_LICENSE("GPL v2");
53MODULE_VERSION("0.1"); 53MODULE_VERSION("0.2");
54 54
55static int force; /* = 0; */ 55static int force; /* = 0; */
56module_param(force, bool, 0); 56module_param(force, bool, 0);
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(force, "Load even if computer is not in database");
58 58
59static char *keymap_name; /* = NULL; */ 59static char *keymap_name; /* = NULL; */
60module_param_named(keymap, keymap_name, charp, 0); 60module_param_named(keymap, keymap_name, charp, 0);
61MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); 61MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected [generic, 1557/MS2141]");
62 62
63static struct platform_device *wistron_device; 63static struct platform_device *wistron_device;
64 64
@@ -233,10 +233,20 @@ static void bios_set_state(u8 subsys, int enable)
233struct key_entry { 233struct key_entry {
234 char type; /* See KE_* below */ 234 char type; /* See KE_* below */
235 u8 code; 235 u8 code;
236 unsigned keycode; /* For KE_KEY */ 236 union {
237 u16 keycode; /* For KE_KEY */
238 struct { /* For KE_SW */
239 u8 code;
240 u8 value;
241 } sw;
242 };
237}; 243};
238 244
239enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH }; 245enum { KE_END, KE_KEY, KE_SW, KE_WIFI, KE_BLUETOOTH };
246
247#define FE_MAIL_LED 0x01
248#define FE_WIFI_LED 0x02
249#define FE_UNTESTED 0x80
240 250
241static const struct key_entry *keymap; /* = NULL; Current key map */ 251static const struct key_entry *keymap; /* = NULL; Current key map */
242static int have_wifi; 252static int have_wifi;
@@ -256,93 +266,341 @@ static int __init dmi_matched(struct dmi_system_id *dmi)
256 return 1; 266 return 1;
257} 267}
258 268
259static struct key_entry keymap_empty[] = { 269static struct key_entry keymap_empty[] __initdata = {
260 { KE_END, 0 } 270 { KE_END, 0 }
261}; 271};
262 272
263static struct key_entry keymap_fs_amilo_pro_v2000[] = { 273static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = {
264 { KE_KEY, 0x01, KEY_HELP }, 274 { KE_KEY, 0x01, {KEY_HELP} },
265 { KE_KEY, 0x11, KEY_PROG1 }, 275 { KE_KEY, 0x11, {KEY_PROG1} },
266 { KE_KEY, 0x12, KEY_PROG2 }, 276 { KE_KEY, 0x12, {KEY_PROG2} },
267 { KE_WIFI, 0x30, 0 }, 277 { KE_WIFI, 0x30 },
268 { KE_KEY, 0x31, KEY_MAIL }, 278 { KE_KEY, 0x31, {KEY_MAIL} },
269 { KE_KEY, 0x36, KEY_WWW }, 279 { KE_KEY, 0x36, {KEY_WWW} },
270 { KE_END, 0 } 280 { KE_END, 0 }
271}; 281};
272 282
273static struct key_entry keymap_fujitsu_n3510[] = { 283static struct key_entry keymap_fujitsu_n3510[] __initdata = {
274 { KE_KEY, 0x11, KEY_PROG1 }, 284 { KE_KEY, 0x11, {KEY_PROG1} },
275 { KE_KEY, 0x12, KEY_PROG2 }, 285 { KE_KEY, 0x12, {KEY_PROG2} },
276 { KE_KEY, 0x36, KEY_WWW }, 286 { KE_KEY, 0x36, {KEY_WWW} },
277 { KE_KEY, 0x31, KEY_MAIL }, 287 { KE_KEY, 0x31, {KEY_MAIL} },
278 { KE_KEY, 0x71, KEY_STOPCD }, 288 { KE_KEY, 0x71, {KEY_STOPCD} },
279 { KE_KEY, 0x72, KEY_PLAYPAUSE }, 289 { KE_KEY, 0x72, {KEY_PLAYPAUSE} },
280 { KE_KEY, 0x74, KEY_REWIND }, 290 { KE_KEY, 0x74, {KEY_REWIND} },
281 { KE_KEY, 0x78, KEY_FORWARD }, 291 { KE_KEY, 0x78, {KEY_FORWARD} },
282 { KE_END, 0 } 292 { KE_END, 0 }
283}; 293};
284 294
285static struct key_entry keymap_wistron_ms2111[] = { 295static struct key_entry keymap_wistron_ms2111[] __initdata = {
286 { KE_KEY, 0x11, KEY_PROG1 }, 296 { KE_KEY, 0x11, {KEY_PROG1} },
287 { KE_KEY, 0x12, KEY_PROG2 }, 297 { KE_KEY, 0x12, {KEY_PROG2} },
288 { KE_KEY, 0x13, KEY_PROG3 }, 298 { KE_KEY, 0x13, {KEY_PROG3} },
289 { KE_KEY, 0x31, KEY_MAIL }, 299 { KE_KEY, 0x31, {KEY_MAIL} },
290 { KE_KEY, 0x36, KEY_WWW }, 300 { KE_KEY, 0x36, {KEY_WWW} },
291 { KE_END, 0 } 301 { KE_END, FE_MAIL_LED }
302};
303
304static struct key_entry keymap_wistron_md40100[] __initdata = {
305 { KE_KEY, 0x01, {KEY_HELP} },
306 { KE_KEY, 0x02, {KEY_CONFIG} },
307 { KE_KEY, 0x31, {KEY_MAIL} },
308 { KE_KEY, 0x36, {KEY_WWW} },
309 { KE_KEY, 0x37, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
310 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
292}; 311};
293 312
294static struct key_entry keymap_wistron_ms2141[] = { 313static struct key_entry keymap_wistron_ms2141[] __initdata = {
295 { KE_KEY, 0x11, KEY_PROG1 }, 314 { KE_KEY, 0x11, {KEY_PROG1} },
296 { KE_KEY, 0x12, KEY_PROG2 }, 315 { KE_KEY, 0x12, {KEY_PROG2} },
297 { KE_WIFI, 0x30, 0 }, 316 { KE_WIFI, 0x30 },
298 { KE_KEY, 0x22, KEY_REWIND }, 317 { KE_KEY, 0x22, {KEY_REWIND} },
299 { KE_KEY, 0x23, KEY_FORWARD }, 318 { KE_KEY, 0x23, {KEY_FORWARD} },
300 { KE_KEY, 0x24, KEY_PLAYPAUSE }, 319 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
301 { KE_KEY, 0x25, KEY_STOPCD }, 320 { KE_KEY, 0x25, {KEY_STOPCD} },
302 { KE_KEY, 0x31, KEY_MAIL }, 321 { KE_KEY, 0x31, {KEY_MAIL} },
303 { KE_KEY, 0x36, KEY_WWW }, 322 { KE_KEY, 0x36, {KEY_WWW} },
304 { KE_END, 0 } 323 { KE_END, 0 }
305}; 324};
306 325
307static struct key_entry keymap_acer_aspire_1500[] = { 326static struct key_entry keymap_acer_aspire_1500[] __initdata = {
308 { KE_KEY, 0x11, KEY_PROG1 }, 327 { KE_KEY, 0x01, {KEY_HELP} },
309 { KE_KEY, 0x12, KEY_PROG2 }, 328 { KE_KEY, 0x03, {KEY_POWER} },
310 { KE_WIFI, 0x30, 0 }, 329 { KE_KEY, 0x11, {KEY_PROG1} },
311 { KE_KEY, 0x31, KEY_MAIL }, 330 { KE_KEY, 0x12, {KEY_PROG2} },
312 { KE_KEY, 0x36, KEY_WWW }, 331 { KE_WIFI, 0x30 },
313 { KE_BLUETOOTH, 0x44, 0 }, 332 { KE_KEY, 0x31, {KEY_MAIL} },
314 { KE_END, 0 } 333 { KE_KEY, 0x36, {KEY_WWW} },
334 { KE_KEY, 0x49, {KEY_CONFIG} },
335 { KE_BLUETOOTH, 0x44 },
336 { KE_END, FE_UNTESTED }
315}; 337};
316 338
317static struct key_entry keymap_acer_travelmate_240[] = { 339static struct key_entry keymap_acer_aspire_1600[] __initdata = {
318 { KE_KEY, 0x31, KEY_MAIL }, 340 { KE_KEY, 0x01, {KEY_HELP} },
319 { KE_KEY, 0x36, KEY_WWW }, 341 { KE_KEY, 0x03, {KEY_POWER} },
320 { KE_KEY, 0x11, KEY_PROG1 }, 342 { KE_KEY, 0x08, {KEY_MUTE} },
321 { KE_KEY, 0x12, KEY_PROG2 }, 343 { KE_KEY, 0x11, {KEY_PROG1} },
322 { KE_BLUETOOTH, 0x44, 0 }, 344 { KE_KEY, 0x12, {KEY_PROG2} },
323 { KE_WIFI, 0x30, 0 }, 345 { KE_KEY, 0x13, {KEY_PROG3} },
324 { KE_END, 0 } 346 { KE_KEY, 0x31, {KEY_MAIL} },
347 { KE_KEY, 0x36, {KEY_WWW} },
348 { KE_KEY, 0x49, {KEY_CONFIG} },
349 { KE_WIFI, 0x30 },
350 { KE_BLUETOOTH, 0x44 },
351 { KE_END, FE_MAIL_LED | FE_UNTESTED }
352};
353
354/* 3020 has been tested */
355static struct key_entry keymap_acer_aspire_5020[] __initdata = {
356 { KE_KEY, 0x01, {KEY_HELP} },
357 { KE_KEY, 0x03, {KEY_POWER} },
358 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
359 { KE_KEY, 0x11, {KEY_PROG1} },
360 { KE_KEY, 0x12, {KEY_PROG2} },
361 { KE_KEY, 0x31, {KEY_MAIL} },
362 { KE_KEY, 0x36, {KEY_WWW} },
363 { KE_KEY, 0x6a, {KEY_CONFIG} },
364 { KE_WIFI, 0x30 },
365 { KE_BLUETOOTH, 0x44 },
366 { KE_END, FE_MAIL_LED | FE_UNTESTED }
367};
368
369static struct key_entry keymap_acer_travelmate_2410[] __initdata = {
370 { KE_KEY, 0x01, {KEY_HELP} },
371 { KE_KEY, 0x6d, {KEY_POWER} },
372 { KE_KEY, 0x11, {KEY_PROG1} },
373 { KE_KEY, 0x12, {KEY_PROG2} },
374 { KE_KEY, 0x31, {KEY_MAIL} },
375 { KE_KEY, 0x36, {KEY_WWW} },
376 { KE_KEY, 0x6a, {KEY_CONFIG} },
377 { KE_WIFI, 0x30 },
378 { KE_BLUETOOTH, 0x44 },
379 { KE_END, FE_MAIL_LED | FE_UNTESTED }
380};
381
382static struct key_entry keymap_acer_travelmate_110[] __initdata = {
383 { KE_KEY, 0x01, {KEY_HELP} },
384 { KE_KEY, 0x02, {KEY_CONFIG} },
385 { KE_KEY, 0x03, {KEY_POWER} },
386 { KE_KEY, 0x08, {KEY_MUTE} },
387 { KE_KEY, 0x11, {KEY_PROG1} },
388 { KE_KEY, 0x12, {KEY_PROG2} },
389 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
390 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
391 { KE_KEY, 0x31, {KEY_MAIL} },
392 { KE_KEY, 0x36, {KEY_WWW} },
393 { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */
394 { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */
395 { KE_WIFI, 0x30 },
396 { KE_END, FE_MAIL_LED | FE_UNTESTED }
397};
398
399static struct key_entry keymap_acer_travelmate_300[] __initdata = {
400 { KE_KEY, 0x01, {KEY_HELP} },
401 { KE_KEY, 0x02, {KEY_CONFIG} },
402 { KE_KEY, 0x03, {KEY_POWER} },
403 { KE_KEY, 0x08, {KEY_MUTE} },
404 { KE_KEY, 0x11, {KEY_PROG1} },
405 { KE_KEY, 0x12, {KEY_PROG2} },
406 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
407 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
408 { KE_KEY, 0x31, {KEY_MAIL} },
409 { KE_KEY, 0x36, {KEY_WWW} },
410 { KE_WIFI, 0x30 },
411 { KE_BLUETOOTH, 0x44 },
412 { KE_END, FE_MAIL_LED | FE_UNTESTED }
325}; 413};
326 414
327static struct key_entry keymap_aopen_1559as[] = { 415static struct key_entry keymap_acer_travelmate_380[] __initdata = {
328 { KE_KEY, 0x01, KEY_HELP }, 416 { KE_KEY, 0x01, {KEY_HELP} },
329 { KE_KEY, 0x06, KEY_PROG3 }, 417 { KE_KEY, 0x02, {KEY_CONFIG} },
330 { KE_KEY, 0x11, KEY_PROG1 }, 418 { KE_KEY, 0x03, {KEY_POWER} }, /* not 370 */
331 { KE_KEY, 0x12, KEY_PROG2 }, 419 { KE_KEY, 0x11, {KEY_PROG1} },
332 { KE_WIFI, 0x30, 0 }, 420 { KE_KEY, 0x12, {KEY_PROG2} },
333 { KE_KEY, 0x31, KEY_MAIL }, 421 { KE_KEY, 0x13, {KEY_PROG3} },
334 { KE_KEY, 0x36, KEY_WWW }, 422 { KE_KEY, 0x31, {KEY_MAIL} },
423 { KE_KEY, 0x36, {KEY_WWW} },
424 { KE_WIFI, 0x30 },
425 { KE_END, FE_MAIL_LED | FE_UNTESTED }
426};
427
428/* unusual map */
429static struct key_entry keymap_acer_travelmate_220[] __initdata = {
430 { KE_KEY, 0x01, {KEY_HELP} },
431 { KE_KEY, 0x02, {KEY_CONFIG} },
432 { KE_KEY, 0x11, {KEY_MAIL} },
433 { KE_KEY, 0x12, {KEY_WWW} },
434 { KE_KEY, 0x13, {KEY_PROG2} },
435 { KE_KEY, 0x31, {KEY_PROG1} },
436 { KE_END, FE_WIFI_LED | FE_UNTESTED }
437};
438
439static struct key_entry keymap_acer_travelmate_230[] __initdata = {
440 { KE_KEY, 0x01, {KEY_HELP} },
441 { KE_KEY, 0x02, {KEY_CONFIG} },
442 { KE_KEY, 0x11, {KEY_PROG1} },
443 { KE_KEY, 0x12, {KEY_PROG2} },
444 { KE_KEY, 0x31, {KEY_MAIL} },
445 { KE_KEY, 0x36, {KEY_WWW} },
446 { KE_END, FE_WIFI_LED | FE_UNTESTED }
447};
448
449static struct key_entry keymap_acer_travelmate_240[] __initdata = {
450 { KE_KEY, 0x01, {KEY_HELP} },
451 { KE_KEY, 0x02, {KEY_CONFIG} },
452 { KE_KEY, 0x03, {KEY_POWER} },
453 { KE_KEY, 0x08, {KEY_MUTE} },
454 { KE_KEY, 0x31, {KEY_MAIL} },
455 { KE_KEY, 0x36, {KEY_WWW} },
456 { KE_KEY, 0x11, {KEY_PROG1} },
457 { KE_KEY, 0x12, {KEY_PROG2} },
458 { KE_BLUETOOTH, 0x44 },
459 { KE_WIFI, 0x30 },
460 { KE_END, FE_UNTESTED }
461};
462
463static struct key_entry keymap_acer_travelmate_350[] __initdata = {
464 { KE_KEY, 0x01, {KEY_HELP} },
465 { KE_KEY, 0x02, {KEY_CONFIG} },
466 { KE_KEY, 0x11, {KEY_PROG1} },
467 { KE_KEY, 0x12, {KEY_PROG2} },
468 { KE_KEY, 0x13, {KEY_MAIL} },
469 { KE_KEY, 0x14, {KEY_PROG3} },
470 { KE_KEY, 0x15, {KEY_WWW} },
471 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
472};
473
474static struct key_entry keymap_acer_travelmate_360[] __initdata = {
475 { KE_KEY, 0x01, {KEY_HELP} },
476 { KE_KEY, 0x02, {KEY_CONFIG} },
477 { KE_KEY, 0x11, {KEY_PROG1} },
478 { KE_KEY, 0x12, {KEY_PROG2} },
479 { KE_KEY, 0x13, {KEY_MAIL} },
480 { KE_KEY, 0x14, {KEY_PROG3} },
481 { KE_KEY, 0x15, {KEY_WWW} },
482 { KE_KEY, 0x40, {KEY_WLAN} },
483 { KE_END, FE_WIFI_LED | FE_UNTESTED } /* no mail led */
484};
485
486/* Wifi subsystem only activates the led. Therefore we need to pass
487 * wifi event as a normal key, then userspace can really change the wifi state.
488 * TODO we need to export led state to userspace (wifi and mail) */
489static struct key_entry keymap_acer_travelmate_610[] __initdata = {
490 { KE_KEY, 0x01, {KEY_HELP} },
491 { KE_KEY, 0x02, {KEY_CONFIG} },
492 { KE_KEY, 0x11, {KEY_PROG1} },
493 { KE_KEY, 0x12, {KEY_PROG2} },
494 { KE_KEY, 0x13, {KEY_PROG3} },
495 { KE_KEY, 0x14, {KEY_MAIL} },
496 { KE_KEY, 0x15, {KEY_WWW} },
497 { KE_KEY, 0x40, {KEY_WLAN} },
498 { KE_END, FE_MAIL_LED | FE_WIFI_LED }
499};
500
501static struct key_entry keymap_acer_travelmate_630[] __initdata = {
502 { KE_KEY, 0x01, {KEY_HELP} },
503 { KE_KEY, 0x02, {KEY_CONFIG} },
504 { KE_KEY, 0x03, {KEY_POWER} },
505 { KE_KEY, 0x08, {KEY_MUTE} }, /* not 620 */
506 { KE_KEY, 0x11, {KEY_PROG1} },
507 { KE_KEY, 0x12, {KEY_PROG2} },
508 { KE_KEY, 0x13, {KEY_PROG3} },
509 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
510 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
511 { KE_KEY, 0x31, {KEY_MAIL} },
512 { KE_KEY, 0x36, {KEY_WWW} },
513 { KE_WIFI, 0x30 },
514 { KE_END, FE_MAIL_LED | FE_UNTESTED }
515};
516
517static struct key_entry keymap_aopen_1559as[] __initdata = {
518 { KE_KEY, 0x01, {KEY_HELP} },
519 { KE_KEY, 0x06, {KEY_PROG3} },
520 { KE_KEY, 0x11, {KEY_PROG1} },
521 { KE_KEY, 0x12, {KEY_PROG2} },
522 { KE_WIFI, 0x30 },
523 { KE_KEY, 0x31, {KEY_MAIL} },
524 { KE_KEY, 0x36, {KEY_WWW} },
335 { KE_END, 0 }, 525 { KE_END, 0 },
336}; 526};
337 527
338static struct key_entry keymap_fs_amilo_d88x0[] = { 528static struct key_entry keymap_fs_amilo_d88x0[] __initdata = {
339 { KE_KEY, 0x01, KEY_HELP }, 529 { KE_KEY, 0x01, {KEY_HELP} },
340 { KE_KEY, 0x08, KEY_MUTE }, 530 { KE_KEY, 0x08, {KEY_MUTE} },
341 { KE_KEY, 0x31, KEY_MAIL }, 531 { KE_KEY, 0x31, {KEY_MAIL} },
342 { KE_KEY, 0x36, KEY_WWW }, 532 { KE_KEY, 0x36, {KEY_WWW} },
343 { KE_KEY, 0x11, KEY_PROG1 }, 533 { KE_KEY, 0x11, {KEY_PROG1} },
344 { KE_KEY, 0x12, KEY_PROG2 }, 534 { KE_KEY, 0x12, {KEY_PROG2} },
345 { KE_KEY, 0x13, KEY_PROG3 }, 535 { KE_KEY, 0x13, {KEY_PROG3} },
536 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
537};
538
539static struct key_entry keymap_wistron_md2900[] __initdata = {
540 { KE_KEY, 0x01, {KEY_HELP} },
541 { KE_KEY, 0x02, {KEY_CONFIG} },
542 { KE_KEY, 0x11, {KEY_PROG1} },
543 { KE_KEY, 0x12, {KEY_PROG2} },
544 { KE_KEY, 0x31, {KEY_MAIL} },
545 { KE_KEY, 0x36, {KEY_WWW} },
546 { KE_WIFI, 0x30 },
547 { KE_END, FE_MAIL_LED | FE_UNTESTED }
548};
549
550static struct key_entry keymap_wistron_md96500[] __initdata = {
551 { KE_KEY, 0x01, {KEY_HELP} },
552 { KE_KEY, 0x02, {KEY_CONFIG} },
553 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
554 { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
555 { KE_KEY, 0x08, {KEY_MUTE} },
556 { KE_KEY, 0x11, {KEY_PROG1} },
557 { KE_KEY, 0x12, {KEY_PROG2} },
558 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
559 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
560 { KE_KEY, 0x22, {KEY_REWIND} },
561 { KE_KEY, 0x23, {KEY_FORWARD} },
562 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
563 { KE_KEY, 0x25, {KEY_STOPCD} },
564 { KE_KEY, 0x31, {KEY_MAIL} },
565 { KE_KEY, 0x36, {KEY_WWW} },
566 { KE_WIFI, 0x30 },
567 { KE_BLUETOOTH, 0x44 },
568 { KE_END, FE_UNTESTED }
569};
570
571static struct key_entry keymap_wistron_generic[] __initdata = {
572 { KE_KEY, 0x01, {KEY_HELP} },
573 { KE_KEY, 0x02, {KEY_CONFIG} },
574 { KE_KEY, 0x03, {KEY_POWER} },
575 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
576 { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
577 { KE_KEY, 0x08, {KEY_MUTE} },
578 { KE_KEY, 0x11, {KEY_PROG1} },
579 { KE_KEY, 0x12, {KEY_PROG2} },
580 { KE_KEY, 0x13, {KEY_PROG3} },
581 { KE_KEY, 0x14, {KEY_MAIL} },
582 { KE_KEY, 0x15, {KEY_WWW} },
583 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
584 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
585 { KE_KEY, 0x22, {KEY_REWIND} },
586 { KE_KEY, 0x23, {KEY_FORWARD} },
587 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
588 { KE_KEY, 0x25, {KEY_STOPCD} },
589 { KE_KEY, 0x31, {KEY_MAIL} },
590 { KE_KEY, 0x36, {KEY_WWW} },
591 { KE_KEY, 0x37, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
592 { KE_KEY, 0x40, {KEY_WLAN} },
593 { KE_KEY, 0x49, {KEY_CONFIG} },
594 { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */
595 { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */
596 { KE_KEY, 0x6a, {KEY_CONFIG} },
597 { KE_KEY, 0x6d, {KEY_POWER} },
598 { KE_KEY, 0x71, {KEY_STOPCD} },
599 { KE_KEY, 0x72, {KEY_PLAYPAUSE} },
600 { KE_KEY, 0x74, {KEY_REWIND} },
601 { KE_KEY, 0x78, {KEY_FORWARD} },
602 { KE_WIFI, 0x30 },
603 { KE_BLUETOOTH, 0x44 },
346 { KE_END, 0 } 604 { KE_END, 0 }
347}; 605};
348 606
@@ -390,6 +648,133 @@ static struct dmi_system_id dmi_ids[] __initdata = {
390 }, 648 },
391 { 649 {
392 .callback = dmi_matched, 650 .callback = dmi_matched,
651 .ident = "Acer Aspire 1600",
652 .matches = {
653 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
654 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1600"),
655 },
656 .driver_data = keymap_acer_aspire_1600
657 },
658 {
659 .callback = dmi_matched,
660 .ident = "Acer Aspire 3020",
661 .matches = {
662 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
663 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3020"),
664 },
665 .driver_data = keymap_acer_aspire_5020
666 },
667 {
668 .callback = dmi_matched,
669 .ident = "Acer Aspire 5020",
670 .matches = {
671 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
672 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5020"),
673 },
674 .driver_data = keymap_acer_aspire_5020
675 },
676 {
677 .callback = dmi_matched,
678 .ident = "Acer TravelMate 2100",
679 .matches = {
680 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
681 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2100"),
682 },
683 .driver_data = keymap_acer_aspire_5020
684 },
685 {
686 .callback = dmi_matched,
687 .ident = "Acer TravelMate 2410",
688 .matches = {
689 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
690 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2410"),
691 },
692 .driver_data = keymap_acer_travelmate_2410
693 },
694 {
695 .callback = dmi_matched,
696 .ident = "Acer TravelMate C300",
697 .matches = {
698 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
699 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C300"),
700 },
701 .driver_data = keymap_acer_travelmate_300
702 },
703 {
704 .callback = dmi_matched,
705 .ident = "Acer TravelMate C100",
706 .matches = {
707 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
708 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C100"),
709 },
710 .driver_data = keymap_acer_travelmate_300
711 },
712 {
713 .callback = dmi_matched,
714 .ident = "Acer TravelMate C110",
715 .matches = {
716 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
717 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C110"),
718 },
719 .driver_data = keymap_acer_travelmate_110
720 },
721 {
722 .callback = dmi_matched,
723 .ident = "Acer TravelMate 380",
724 .matches = {
725 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
726 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 380"),
727 },
728 .driver_data = keymap_acer_travelmate_380
729 },
730 {
731 .callback = dmi_matched,
732 .ident = "Acer TravelMate 370",
733 .matches = {
734 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
735 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 370"),
736 },
737 .driver_data = keymap_acer_travelmate_380 /* keyboard minus 1 key */
738 },
739 {
740 .callback = dmi_matched,
741 .ident = "Acer TravelMate 220",
742 .matches = {
743 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
744 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 220"),
745 },
746 .driver_data = keymap_acer_travelmate_220
747 },
748 {
749 .callback = dmi_matched,
750 .ident = "Acer TravelMate 260",
751 .matches = {
752 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
753 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 260"),
754 },
755 .driver_data = keymap_acer_travelmate_220
756 },
757 {
758 .callback = dmi_matched,
759 .ident = "Acer TravelMate 230",
760 .matches = {
761 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
762 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 230"),
763 /* acerhk looks for "TravelMate F4..." ?! */
764 },
765 .driver_data = keymap_acer_travelmate_230
766 },
767 {
768 .callback = dmi_matched,
769 .ident = "Acer TravelMate 280",
770 .matches = {
771 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
772 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 280"),
773 },
774 .driver_data = keymap_acer_travelmate_230
775 },
776 {
777 .callback = dmi_matched,
393 .ident = "Acer TravelMate 240", 778 .ident = "Acer TravelMate 240",
394 .matches = { 779 .matches = {
395 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 780 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -399,6 +784,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
399 }, 784 },
400 { 785 {
401 .callback = dmi_matched, 786 .callback = dmi_matched,
787 .ident = "Acer TravelMate 250",
788 .matches = {
789 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
790 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 250"),
791 },
792 .driver_data = keymap_acer_travelmate_240
793 },
794 {
795 .callback = dmi_matched,
402 .ident = "Acer TravelMate 2424NWXCi", 796 .ident = "Acer TravelMate 2424NWXCi",
403 .matches = { 797 .matches = {
404 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 798 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -408,6 +802,51 @@ static struct dmi_system_id dmi_ids[] __initdata = {
408 }, 802 },
409 { 803 {
410 .callback = dmi_matched, 804 .callback = dmi_matched,
805 .ident = "Acer TravelMate 350",
806 .matches = {
807 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
808 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 350"),
809 },
810 .driver_data = keymap_acer_travelmate_350
811 },
812 {
813 .callback = dmi_matched,
814 .ident = "Acer TravelMate 360",
815 .matches = {
816 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
817 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
818 },
819 .driver_data = keymap_acer_travelmate_360
820 },
821 {
822 .callback = dmi_matched,
823 .ident = "Acer TravelMate 610",
824 .matches = {
825 DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
826 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 610"),
827 },
828 .driver_data = keymap_acer_travelmate_610
829 },
830 {
831 .callback = dmi_matched,
832 .ident = "Acer TravelMate 620",
833 .matches = {
834 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
835 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 620"),
836 },
837 .driver_data = keymap_acer_travelmate_630
838 },
839 {
840 .callback = dmi_matched,
841 .ident = "Acer TravelMate 630",
842 .matches = {
843 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
844 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 630"),
845 },
846 .driver_data = keymap_acer_travelmate_630
847 },
848 {
849 .callback = dmi_matched,
411 .ident = "AOpen 1559AS", 850 .ident = "AOpen 1559AS",
412 .matches = { 851 .matches = {
413 DMI_MATCH(DMI_PRODUCT_NAME, "E2U"), 852 DMI_MATCH(DMI_PRODUCT_NAME, "E2U"),
@@ -426,6 +865,51 @@ static struct dmi_system_id dmi_ids[] __initdata = {
426 }, 865 },
427 { 866 {
428 .callback = dmi_matched, 867 .callback = dmi_matched,
868 .ident = "Medion MD 40100",
869 .matches = {
870 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
871 DMI_MATCH(DMI_PRODUCT_NAME, "WID2000"),
872 },
873 .driver_data = keymap_wistron_md40100
874 },
875 {
876 .callback = dmi_matched,
877 .ident = "Medion MD 2900",
878 .matches = {
879 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
880 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2000"),
881 },
882 .driver_data = keymap_wistron_md2900
883 },
884 {
885 .callback = dmi_matched,
886 .ident = "Medion MD 96500",
887 .matches = {
888 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"),
889 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2040"),
890 },
891 .driver_data = keymap_wistron_md96500
892 },
893 {
894 .callback = dmi_matched,
895 .ident = "Medion MD 95400",
896 .matches = {
897 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"),
898 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2050"),
899 },
900 .driver_data = keymap_wistron_md96500
901 },
902 {
903 .callback = dmi_matched,
904 .ident = "Fujitsu Siemens Amilo D7820",
905 .matches = {
906 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), /* not sure */
907 DMI_MATCH(DMI_PRODUCT_NAME, "Amilo D"),
908 },
909 .driver_data = keymap_fs_amilo_d88x0
910 },
911 {
912 .callback = dmi_matched,
429 .ident = "Fujitsu Siemens Amilo D88x0", 913 .ident = "Fujitsu Siemens Amilo D88x0",
430 .matches = { 914 .matches = {
431 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 915 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
@@ -436,17 +920,39 @@ static struct dmi_system_id dmi_ids[] __initdata = {
436 { NULL, } 920 { NULL, }
437}; 921};
438 922
923/* Copy the good keymap, as the original ones are free'd */
924static int __init copy_keymap(void)
925{
926 const struct key_entry *key;
927 struct key_entry *new_keymap;
928 unsigned int length = 1;
929
930 for (key = keymap; key->type != KE_END; key++)
931 length++;
932
933 new_keymap = kmalloc(length * sizeof(struct key_entry), GFP_KERNEL);
934 if (!new_keymap)
935 return -ENOMEM;
936
937 memcpy(new_keymap, keymap, length * sizeof(struct key_entry));
938 keymap = new_keymap;
939
940 return 0;
941}
942
439static int __init select_keymap(void) 943static int __init select_keymap(void)
440{ 944{
945 dmi_check_system(dmi_ids);
441 if (keymap_name != NULL) { 946 if (keymap_name != NULL) {
442 if (strcmp (keymap_name, "1557/MS2141") == 0) 947 if (strcmp (keymap_name, "1557/MS2141") == 0)
443 keymap = keymap_wistron_ms2141; 948 keymap = keymap_wistron_ms2141;
949 else if (strcmp (keymap_name, "generic") == 0)
950 keymap = keymap_wistron_generic;
444 else { 951 else {
445 printk(KERN_ERR "wistron_btns: Keymap unknown\n"); 952 printk(KERN_ERR "wistron_btns: Keymap unknown\n");
446 return -EINVAL; 953 return -EINVAL;
447 } 954 }
448 } 955 }
449 dmi_check_system(dmi_ids);
450 if (keymap == NULL) { 956 if (keymap == NULL) {
451 if (!force) { 957 if (!force) {
452 printk(KERN_ERR "wistron_btns: System unknown\n"); 958 printk(KERN_ERR "wistron_btns: System unknown\n");
@@ -454,7 +960,8 @@ static int __init select_keymap(void)
454 } 960 }
455 keymap = keymap_empty; 961 keymap = keymap_empty;
456 } 962 }
457 return 0; 963
964 return copy_keymap();
458} 965}
459 966
460 /* Input layer interface */ 967 /* Input layer interface */
@@ -476,12 +983,28 @@ static int __devinit setup_input_dev(void)
476 input_dev->cdev.dev = &wistron_device->dev; 983 input_dev->cdev.dev = &wistron_device->dev;
477 984
478 for (key = keymap; key->type != KE_END; key++) { 985 for (key = keymap; key->type != KE_END; key++) {
479 if (key->type == KE_KEY) { 986 switch (key->type) {
480 input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); 987 case KE_KEY:
481 set_bit(key->keycode, input_dev->keybit); 988 set_bit(EV_KEY, input_dev->evbit);
989 set_bit(key->keycode, input_dev->keybit);
990 break;
991
992 case KE_SW:
993 set_bit(EV_SW, input_dev->evbit);
994 set_bit(key->sw.code, input_dev->swbit);
995 break;
996
997 default:
998 ;
482 } 999 }
483 } 1000 }
484 1001
1002 /* reads information flags on KE_END */
1003 if (key->code & FE_UNTESTED)
1004 printk(KERN_WARNING "Untested laptop multimedia keys, "
1005 "please report success or failure to eric.piel"
1006 "@tremplin-utc.net\n");
1007
485 error = input_register_device(input_dev); 1008 error = input_register_device(input_dev);
486 if (error) { 1009 if (error) {
487 input_free_device(input_dev); 1010 input_free_device(input_dev);
@@ -499,6 +1022,12 @@ static void report_key(unsigned keycode)
499 input_sync(input_dev); 1022 input_sync(input_dev);
500} 1023}
501 1024
1025static void report_switch(unsigned code, int value)
1026{
1027 input_report_switch(input_dev, code, value);
1028 input_sync(input_dev);
1029}
1030
502 /* Driver core */ 1031 /* Driver core */
503 1032
504static int wifi_enabled; 1033static int wifi_enabled;
@@ -519,6 +1048,10 @@ static void handle_key(u8 code)
519 report_key(key->keycode); 1048 report_key(key->keycode);
520 break; 1049 break;
521 1050
1051 case KE_SW:
1052 report_switch(key->sw.code, key->sw.value);
1053 break;
1054
522 case KE_WIFI: 1055 case KE_WIFI:
523 if (have_wifi) { 1056 if (have_wifi) {
524 wifi_enabled = !wifi_enabled; 1057 wifi_enabled = !wifi_enabled;
@@ -534,6 +1067,7 @@ static void handle_key(u8 code)
534 break; 1067 break;
535 1068
536 case KE_END: 1069 case KE_END:
1070 break;
537 default: 1071 default:
538 BUG(); 1072 BUG();
539 } 1073 }
@@ -690,6 +1224,7 @@ static void __exit wb_module_exit(void)
690 platform_device_unregister(wistron_device); 1224 platform_device_unregister(wistron_device);
691 platform_driver_unregister(&wistron_driver); 1225 platform_driver_unregister(&wistron_driver);
692 unmap_bios(); 1226 unmap_bios();
1227 kfree(keymap);
693} 1228}
694 1229
695module_init(wb_module_init); 1230module_init(wb_module_init);
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 35d998c3e578..81dd8c7211a7 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -37,6 +37,65 @@ config MOUSE_PS2
37 To compile this driver as a module, choose M here: the 37 To compile this driver as a module, choose M here: the
38 module will be called psmouse. 38 module will be called psmouse.
39 39
40config MOUSE_PS2_ALPS
41 bool "ALPS PS/2 mouse protocol extension" if EMBEDDED
42 default y
43 depends on MOUSE_PS2
44 ---help---
45 Say Y here if you have an ALPS PS/2 touchpad connected to
46 your system.
47
48 If unsure, say Y.
49
50config MOUSE_PS2_LOGIPS2PP
51 bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED
52 default y
53 depends on MOUSE_PS2
54 ---help---
55 Say Y here if you have a Logictech PS/2++ mouse connected to
56 your system.
57
58 If unsure, say Y.
59
60config MOUSE_PS2_SYNAPTICS
61 bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED
62 default y
63 depends on MOUSE_PS2
64 ---help---
65 Say Y here if you have a Synaptics PS/2 TouchPad connected to
66 your system.
67
68 If unsure, say Y.
69
70config MOUSE_PS2_LIFEBOOK
71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
72 default y
73 depends on MOUSE_PS2
74 ---help---
75 Say Y here if you have a Fujitsu B-series Lifebook PS/2
76 TouchScreen connected to your system.
77
78 If unsure, say Y.
79
80config MOUSE_PS2_TRACKPOINT
81 bool "IBM Trackpoint PS/2 mouse protocol extension" if EMBEDDED
82 default y
83 depends on MOUSE_PS2
84 ---help---
85 Say Y here if you have an IBM Trackpoint PS/2 mouse connected
86 to your system.
87
88 If unsure, say Y.
89
90config MOUSE_PS2_TOUCHKIT
91 bool "eGalax TouchKit PS/2 protocol extension"
92 depends on MOUSE_PS2
93 ---help---
94 Say Y here if you have an eGalax TouchKit PS/2 touchscreen
95 connected to your system.
96
97 If unsure, say N.
98
40config MOUSE_SERIAL 99config MOUSE_SERIAL
41 tristate "Serial mouse" 100 tristate "Serial mouse"
42 select SERIO 101 select SERIO
@@ -96,6 +155,17 @@ config MOUSE_AMIGA
96 To compile this driver as a module, choose M here: the 155 To compile this driver as a module, choose M here: the
97 module will be called amimouse. 156 module will be called amimouse.
98 157
158config MOUSE_ATARI
159 tristate "Atari mouse"
160 depends on ATARI
161 select ATARI_KBD_CORE
162 help
163 Say Y here if you have an Atari and want its native mouse
164 supported by the kernel.
165
166 To compile this driver as a module, choose M here: the
167 module will be called atarimouse.
168
99config MOUSE_RISCPC 169config MOUSE_RISCPC
100 tristate "Acorn RiscPC mouse" 170 tristate "Acorn RiscPC mouse"
101 depends on ARCH_ACORN 171 depends on ARCH_ACORN
@@ -118,7 +188,7 @@ config MOUSE_VSXXXAA
118 digitizer (VSXXX-AB) DEC produced. 188 digitizer (VSXXX-AB) DEC produced.
119 189
120config MOUSE_HIL 190config MOUSE_HIL
121 tristate "HIL pointers (mice etc)." 191 tristate "HIL pointers (mice etc)."
122 depends on GSC || HP300 192 depends on GSC || HP300
123 select HP_SDC 193 select HP_SDC
124 select HIL_MLC 194 select HIL_MLC
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
index 21a1de61a79b..6a8f622927f2 100644
--- a/drivers/input/mouse/Makefile
+++ b/drivers/input/mouse/Makefile
@@ -5,6 +5,7 @@
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o 7obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o
8obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o
8obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o 9obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o
9obj-$(CONFIG_MOUSE_INPORT) += inport.o 10obj-$(CONFIG_MOUSE_INPORT) += inport.o
10obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o 11obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o
@@ -14,4 +15,10 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o
14obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o 15obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o
15obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o 16obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o
16 17
17psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o 18psmouse-objs := psmouse-base.o synaptics.o
19
20psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o
21psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o
22psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o
23psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o
24psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4e71a66fc7fc..cf3e4664e72b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -424,14 +424,15 @@ int alps_init(struct psmouse *psmouse)
424 struct input_dev *dev1 = psmouse->dev, *dev2; 424 struct input_dev *dev1 = psmouse->dev, *dev2;
425 int version; 425 int version;
426 426
427 psmouse->private = priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); 427 priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
428 dev2 = input_allocate_device(); 428 dev2 = input_allocate_device();
429 if (!priv || !dev2) 429 if (!priv || !dev2)
430 goto init_fail; 430 goto init_fail;
431 431
432 priv->dev2 = dev2; 432 priv->dev2 = dev2;
433 433
434 if (!(priv->i = alps_get_model(psmouse, &version))) 434 priv->i = alps_get_model(psmouse, &version);
435 if (!priv->i)
435 goto init_fail; 436 goto init_fail;
436 437
437 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 438 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
@@ -480,7 +481,8 @@ int alps_init(struct psmouse *psmouse)
480 dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y); 481 dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
481 dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 482 dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
482 483
483 input_register_device(priv->dev2); 484 if (input_register_device(priv->dev2))
485 goto init_fail;
484 486
485 psmouse->protocol_handler = alps_process_byte; 487 psmouse->protocol_handler = alps_process_byte;
486 psmouse->poll = alps_poll; 488 psmouse->poll = alps_poll;
@@ -491,9 +493,11 @@ int alps_init(struct psmouse *psmouse)
491 /* We are having trouble resyncing ALPS touchpads so disable it for now */ 493 /* We are having trouble resyncing ALPS touchpads so disable it for now */
492 psmouse->resync_time = 0; 494 psmouse->resync_time = 0;
493 495
496 psmouse->private = priv;
494 return 0; 497 return 0;
495 498
496init_fail: 499init_fail:
500 psmouse_reset(psmouse);
497 input_free_device(dev2); 501 input_free_device(dev2);
498 kfree(priv); 502 kfree(priv);
499 return -1; 503 return -1;
@@ -504,7 +508,8 @@ int alps_detect(struct psmouse *psmouse, int set_properties)
504 int version; 508 int version;
505 const struct alps_model_info *model; 509 const struct alps_model_info *model;
506 510
507 if (!(model = alps_get_model(psmouse, &version))) 511 model = alps_get_model(psmouse, &version);
512 if (!model)
508 return -1; 513 return -1;
509 514
510 if (set_properties) { 515 if (set_properties) {
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 69db7325a494..4bbddc99962b 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -12,9 +12,6 @@
12#ifndef _ALPS_H 12#ifndef _ALPS_H
13#define _ALPS_H 13#define _ALPS_H
14 14
15int alps_detect(struct psmouse *psmouse, int set_properties);
16int alps_init(struct psmouse *psmouse);
17
18struct alps_model_info { 15struct alps_model_info {
19 unsigned char signature[3]; 16 unsigned char signature[3];
20 unsigned char byte0, mask0; 17 unsigned char byte0, mask0;
@@ -23,10 +20,23 @@ struct alps_model_info {
23 20
24struct alps_data { 21struct alps_data {
25 struct input_dev *dev2; /* Relative device */ 22 struct input_dev *dev2; /* Relative device */
26 char name[32]; /* Name */
27 char phys[32]; /* Phys */ 23 char phys[32]; /* Phys */
28 const struct alps_model_info *i;/* Info */ 24 const struct alps_model_info *i;/* Info */
29 int prev_fin; /* Finger bit from previous packet */ 25 int prev_fin; /* Finger bit from previous packet */
30}; 26};
31 27
28#ifdef CONFIG_MOUSE_PS2_ALPS
29int alps_detect(struct psmouse *psmouse, int set_properties);
30int alps_init(struct psmouse *psmouse);
31#else
32inline int alps_detect(struct psmouse *psmouse, int set_properties)
33{
34 return -ENOSYS;
35}
36inline int alps_init(struct psmouse *psmouse)
37{
38 return -ENOSYS;
39}
40#endif /* CONFIG_MOUSE_PS2_ALPS */
41
32#endif 42#endif
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
new file mode 100644
index 000000000000..43ab6566fb65
--- /dev/null
+++ b/drivers/input/mouse/atarimouse.c
@@ -0,0 +1,160 @@
1/*
2 * Atari mouse driver for Linux/m68k
3 *
4 * Copyright (c) 2005 Michael Schmitz
5 *
6 * Based on:
7 * Amiga mouse driver for Linux/m68k
8 *
9 * Copyright (c) 2000-2002 Vojtech Pavlik
10 *
11 */
12/*
13 * The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c
14 * (the keyboard ACIA also handles the mouse and joystick data, and the keyboard
15 * interrupt is shared with the MIDI ACIA so MIDI data also get handled there).
16 * This driver only deals with handing key events off to the input layer.
17 *
18 * Largely based on the old:
19 *
20 * Atari Mouse Driver for Linux
21 * by Robert de Vries (robert@and.nl) 19Jul93
22 *
23 * 16 Nov 1994 Andreas Schwab
24 * Compatibility with busmouse
25 * Support for three button mouse (shamelessly stolen from MiNT)
26 * third button wired to one of the joystick directions on joystick 1
27 *
28 * 1996/02/11 Andreas Schwab
29 * Module support
30 * Allow multiple open's
31 *
32 * Converted to use new generic busmouse code. 5 Apr 1998
33 * Russell King <rmk@arm.uk.linux.org>
34 */
35
36
37/*
38 * This program is free software; you can redistribute it and/or modify it
39 * under the terms of the GNU General Public License version 2 as published by
40 * the Free Software Foundation
41 */
42
43#include <linux/module.h>
44#include <linux/init.h>
45#include <linux/input.h>
46#include <linux/interrupt.h>
47
48#include <asm/irq.h>
49#include <asm/setup.h>
50#include <asm/system.h>
51#include <asm/uaccess.h>
52#include <asm/atarihw.h>
53#include <asm/atarikb.h>
54#include <asm/atariints.h>
55
56MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
57MODULE_DESCRIPTION("Atari mouse driver");
58MODULE_LICENSE("GPL");
59
60static int mouse_threshold[2] = {2,2};
61
62#ifdef __MODULE__
63MODULE_PARM(mouse_threshold, "2i");
64#endif
65#ifdef FIXED_ATARI_JOYSTICK
66extern int atari_mouse_buttons;
67#endif
68static int atamouse_used = 0;
69
70static struct input_dev *atamouse_dev;
71
72static void atamouse_interrupt(char *buf)
73{
74 int buttons, dx, dy;
75
76/* ikbd_mouse_disable(); */
77
78 buttons = (buf[0] & 1) | ((buf[0] & 2) << 1);
79#ifdef FIXED_ATARI_JOYSTICK
80 buttons |= atari_mouse_buttons & 2;
81 atari_mouse_buttons = buttons;
82#endif
83/* ikbd_mouse_rel_pos(); */
84
85 /* only relative events get here */
86 dx = buf[1];
87 dy = -buf[2];
88
89 input_report_rel(atamouse_dev, REL_X, dx);
90 input_report_rel(atamouse_dev, REL_Y, dy);
91
92 input_report_key(atamouse_dev, BTN_LEFT, buttons & 0x1);
93 input_report_key(atamouse_dev, BTN_MIDDLE, buttons & 0x2);
94 input_report_key(atamouse_dev, BTN_RIGHT, buttons & 0x4);
95
96 input_sync(atamouse_dev);
97
98 return;
99}
100
101static int atamouse_open(struct input_dev *dev)
102{
103 if (atamouse_used++)
104 return 0;
105
106#ifdef FIXED_ATARI_JOYSTICK
107 atari_mouse_buttons = 0;
108#endif
109 ikbd_mouse_y0_top();
110 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]);
111 ikbd_mouse_rel_pos();
112 atari_input_mouse_interrupt_hook = atamouse_interrupt;
113 return 0;
114}
115
116static void atamouse_close(struct input_dev *dev)
117{
118 if (!--atamouse_used) {
119 ikbd_mouse_disable();
120 atari_mouse_interrupt_hook = NULL;
121 }
122}
123
124static int __init atamouse_init(void)
125{
126 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
127 return -ENODEV;
128
129 if (!(atamouse_dev = input_allocate_device()))
130 return -ENOMEM;
131
132 if (!(atari_keyb_init()))
133 return -ENODEV;
134
135 atamouse_dev->name = "Atari mouse";
136 atamouse_dev->phys = "atamouse/input0";
137 atamouse_dev->id.bustype = BUS_ATARI;
138 atamouse_dev->id.vendor = 0x0001;
139 atamouse_dev->id.product = 0x0002;
140 atamouse_dev->id.version = 0x0100;
141
142 atamouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
143 atamouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
144 atamouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
145 atamouse_dev->open = atamouse_open;
146 atamouse_dev->close = atamouse_close;
147
148 input_register_device(atamouse_dev);
149
150 printk(KERN_INFO "input: %s at keyboard ACIA\n", atamouse_dev->name);
151 return 0;
152}
153
154static void __exit atamouse_exit(void)
155{
156 input_unregister_device(atamouse_dev);
157}
158
159module_init(atamouse_init);
160module_exit(atamouse_exit);
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c
index bfb174fe3230..449bf4dcbbcc 100644
--- a/drivers/input/mouse/hil_ptr.c
+++ b/drivers/input/mouse/hil_ptr.c
@@ -88,10 +88,12 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
88 idx = ptr->idx4/4; 88 idx = ptr->idx4/4;
89 p = data[idx - 1]; 89 p = data[idx - 1];
90 90
91 if ((p & ~HIL_CMDCT_POL) == 91 if ((p & ~HIL_CMDCT_POL) ==
92 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) goto report; 92 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL))
93 if ((p & ~HIL_CMDCT_RPL) == 93 goto report;
94 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) goto report; 94 if ((p & ~HIL_CMDCT_RPL) ==
95 (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL))
96 goto report;
95 97
96 /* Not a poll response. See if we are loading config records. */ 98 /* Not a poll response. See if we are loading config records. */
97 switch (p & HIL_PKT_DATA_MASK) { 99 switch (p & HIL_PKT_DATA_MASK) {
@@ -101,27 +103,32 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
101 for (; i < HIL_PTR_MAX_LENGTH; i++) 103 for (; i < HIL_PTR_MAX_LENGTH; i++)
102 ptr->idd[i] = 0; 104 ptr->idd[i] = 0;
103 break; 105 break;
106
104 case HIL_CMD_RSC: 107 case HIL_CMD_RSC:
105 for (i = 0; i < idx; i++) 108 for (i = 0; i < idx; i++)
106 ptr->rsc[i] = ptr->data[i] & HIL_PKT_DATA_MASK; 109 ptr->rsc[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
107 for (; i < HIL_PTR_MAX_LENGTH; i++) 110 for (; i < HIL_PTR_MAX_LENGTH; i++)
108 ptr->rsc[i] = 0; 111 ptr->rsc[i] = 0;
109 break; 112 break;
113
110 case HIL_CMD_EXD: 114 case HIL_CMD_EXD:
111 for (i = 0; i < idx; i++) 115 for (i = 0; i < idx; i++)
112 ptr->exd[i] = ptr->data[i] & HIL_PKT_DATA_MASK; 116 ptr->exd[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
113 for (; i < HIL_PTR_MAX_LENGTH; i++) 117 for (; i < HIL_PTR_MAX_LENGTH; i++)
114 ptr->exd[i] = 0; 118 ptr->exd[i] = 0;
115 break; 119 break;
120
116 case HIL_CMD_RNM: 121 case HIL_CMD_RNM:
117 for (i = 0; i < idx; i++) 122 for (i = 0; i < idx; i++)
118 ptr->rnm[i] = ptr->data[i] & HIL_PKT_DATA_MASK; 123 ptr->rnm[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
119 for (; i < HIL_PTR_MAX_LENGTH + 1; i++) 124 for (; i < HIL_PTR_MAX_LENGTH + 1; i++)
120 ptr->rnm[i] = '\0'; 125 ptr->rnm[i] = 0;
121 break; 126 break;
127
122 default: 128 default:
123 /* These occur when device isn't present */ 129 /* These occur when device isn't present */
124 if (p == (HIL_ERR_INT | HIL_PKT_CMD)) break; 130 if (p == (HIL_ERR_INT | HIL_PKT_CMD))
131 break;
125 /* Anything else we'd like to know about. */ 132 /* Anything else we'd like to know about. */
126 printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); 133 printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p);
127 break; 134 break;
@@ -130,7 +137,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
130 137
131 report: 138 report:
132 if ((p & HIL_CMDCT_POL) != idx - 1) { 139 if ((p & HIL_CMDCT_POL) != idx - 1) {
133 printk(KERN_WARNING PREFIX "Malformed poll packet %x (idx = %i)\n", p, idx); 140 printk(KERN_WARNING PREFIX
141 "Malformed poll packet %x (idx = %i)\n", p, idx);
134 goto out; 142 goto out;
135 } 143 }
136 144
@@ -139,7 +147,7 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
139 laxis += i; 147 laxis += i;
140 148
141 ax16 = ptr->idd[1] & HIL_IDD_HEADER_16BIT; /* 8 or 16bit resolution */ 149 ax16 = ptr->idd[1] & HIL_IDD_HEADER_16BIT; /* 8 or 16bit resolution */
142 absdev = ptr->idd[1] & HIL_IDD_HEADER_ABS; 150 absdev = ptr->idd[1] & HIL_IDD_HEADER_ABS;
143 151
144 for (cnt = 1; i < laxis; i++) { 152 for (cnt = 1; i < laxis; i++) {
145 unsigned int lo,hi,val; 153 unsigned int lo,hi,val;
@@ -157,7 +165,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
157 input_report_abs(dev, ABS_X + i, val); 165 input_report_abs(dev, ABS_X + i, val);
158 } else { 166 } else {
159 val = (int) (((int8_t)lo) | ((int8_t)hi<<8)); 167 val = (int) (((int8_t)lo) | ((int8_t)hi<<8));
160 if (i%3) val *= -1; 168 if (i%3)
169 val *= -1;
161 input_report_rel(dev, REL_X + i, val); 170 input_report_rel(dev, REL_X + i, val);
162 } 171 }
163 } 172 }
@@ -168,10 +177,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
168 btn = ptr->data[cnt++]; 177 btn = ptr->data[cnt++];
169 up = btn & 1; 178 up = btn & 1;
170 btn &= 0xfe; 179 btn &= 0xfe;
171 if (btn == 0x8e) { 180 if (btn == 0x8e)
172 continue; /* TODO: proximity == touch? */ 181 continue; /* TODO: proximity == touch? */
173 } 182 else
174 else if ((btn > 0x8c) || (btn < 0x80)) continue; 183 if ((btn > 0x8c) || (btn < 0x80))
184 continue;
175 btn = (btn - 0x80) >> 1; 185 btn = (btn - 0x80) >> 1;
176 btn = ptr->btnmap[btn]; 186 btn = ptr->btnmap[btn];
177 input_report_key(dev, btn, !up); 187 input_report_key(dev, btn, !up);
@@ -182,14 +192,14 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
182 up(&ptr->sem); 192 up(&ptr->sem);
183} 193}
184 194
185static void hil_ptr_process_err(struct hil_ptr *ptr) { 195static void hil_ptr_process_err(struct hil_ptr *ptr)
196{
186 printk(KERN_WARNING PREFIX "errored HIL packet\n"); 197 printk(KERN_WARNING PREFIX "errored HIL packet\n");
187 ptr->idx4 = 0; 198 ptr->idx4 = 0;
188 up(&ptr->sem); 199 up(&ptr->sem);
189 return;
190} 200}
191 201
192static irqreturn_t hil_ptr_interrupt(struct serio *serio, 202static irqreturn_t hil_ptr_interrupt(struct serio *serio,
193 unsigned char data, unsigned int flags) 203 unsigned char data, unsigned int flags)
194{ 204{
195 struct hil_ptr *ptr; 205 struct hil_ptr *ptr;
@@ -197,29 +207,29 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio,
197 int idx; 207 int idx;
198 208
199 ptr = serio_get_drvdata(serio); 209 ptr = serio_get_drvdata(serio);
200 if (ptr == NULL) { 210 BUG_ON(ptr == NULL);
201 BUG();
202 return IRQ_HANDLED;
203 }
204 211
205 if (ptr->idx4 >= (HIL_PTR_MAX_LENGTH * sizeof(hil_packet))) { 212 if (ptr->idx4 >= (HIL_PTR_MAX_LENGTH * sizeof(hil_packet))) {
206 hil_ptr_process_err(ptr); 213 hil_ptr_process_err(ptr);
207 return IRQ_HANDLED; 214 return IRQ_HANDLED;
208 } 215 }
209 idx = ptr->idx4/4; 216 idx = ptr->idx4/4;
210 if (!(ptr->idx4 % 4)) ptr->data[idx] = 0; 217 if (!(ptr->idx4 % 4))
218 ptr->data[idx] = 0;
211 packet = ptr->data[idx]; 219 packet = ptr->data[idx];
212 packet |= ((hil_packet)data) << ((3 - (ptr->idx4 % 4)) * 8); 220 packet |= ((hil_packet)data) << ((3 - (ptr->idx4 % 4)) * 8);
213 ptr->data[idx] = packet; 221 ptr->data[idx] = packet;
214 222
215 /* Records of N 4-byte hil_packets must terminate with a command. */ 223 /* Records of N 4-byte hil_packets must terminate with a command. */
216 if ((++(ptr->idx4)) % 4) return IRQ_HANDLED; 224 if ((++(ptr->idx4)) % 4)
225 return IRQ_HANDLED;
217 if ((packet & 0xffff0000) != HIL_ERR_INT) { 226 if ((packet & 0xffff0000) != HIL_ERR_INT) {
218 hil_ptr_process_err(ptr); 227 hil_ptr_process_err(ptr);
219 return IRQ_HANDLED; 228 return IRQ_HANDLED;
220 } 229 }
221 if (packet & HIL_PKT_CMD) 230 if (packet & HIL_PKT_CMD)
222 hil_ptr_process_record(ptr); 231 hil_ptr_process_record(ptr);
232
223 return IRQ_HANDLED; 233 return IRQ_HANDLED;
224} 234}
225 235
@@ -228,10 +238,7 @@ static void hil_ptr_disconnect(struct serio *serio)
228 struct hil_ptr *ptr; 238 struct hil_ptr *ptr;
229 239
230 ptr = serio_get_drvdata(serio); 240 ptr = serio_get_drvdata(serio);
231 if (ptr == NULL) { 241 BUG_ON(ptr == NULL);
232 BUG();
233 return;
234 }
235 242
236 serio_close(serio); 243 serio_close(serio);
237 input_unregister_device(ptr->dev); 244 input_unregister_device(ptr->dev);
@@ -241,7 +248,7 @@ static void hil_ptr_disconnect(struct serio *serio)
241static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) 248static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
242{ 249{
243 struct hil_ptr *ptr; 250 struct hil_ptr *ptr;
244 char *txt; 251 const char *txt;
245 unsigned int i, naxsets, btntype; 252 unsigned int i, naxsets, btntype;
246 uint8_t did, *idd; 253 uint8_t did, *idd;
247 254
@@ -252,42 +259,40 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
252 if (!ptr->dev) 259 if (!ptr->dev)
253 goto bail0; 260 goto bail0;
254 261
255 ptr->dev->private = ptr;
256
257 if (serio_open(serio, driver)) 262 if (serio_open(serio, driver))
258 goto bail1; 263 goto bail1;
259 264
260 serio_set_drvdata(serio, ptr); 265 serio_set_drvdata(serio, ptr);
261 ptr->serio = serio; 266 ptr->serio = serio;
262 267
263 init_MUTEX_LOCKED(&(ptr->sem)); 268 init_MUTEX_LOCKED(&ptr->sem);
264 269
265 /* Get device info. MLC driver supplies devid/status/etc. */ 270 /* Get device info. MLC driver supplies devid/status/etc. */
266 serio->write(serio, 0); 271 serio->write(serio, 0);
267 serio->write(serio, 0); 272 serio->write(serio, 0);
268 serio->write(serio, HIL_PKT_CMD >> 8); 273 serio->write(serio, HIL_PKT_CMD >> 8);
269 serio->write(serio, HIL_CMD_IDD); 274 serio->write(serio, HIL_CMD_IDD);
270 down(&(ptr->sem)); 275 down(&ptr->sem);
271 276
272 serio->write(serio, 0); 277 serio->write(serio, 0);
273 serio->write(serio, 0); 278 serio->write(serio, 0);
274 serio->write(serio, HIL_PKT_CMD >> 8); 279 serio->write(serio, HIL_PKT_CMD >> 8);
275 serio->write(serio, HIL_CMD_RSC); 280 serio->write(serio, HIL_CMD_RSC);
276 down(&(ptr->sem)); 281 down(&ptr->sem);
277 282
278 serio->write(serio, 0); 283 serio->write(serio, 0);
279 serio->write(serio, 0); 284 serio->write(serio, 0);
280 serio->write(serio, HIL_PKT_CMD >> 8); 285 serio->write(serio, HIL_PKT_CMD >> 8);
281 serio->write(serio, HIL_CMD_RNM); 286 serio->write(serio, HIL_CMD_RNM);
282 down(&(ptr->sem)); 287 down(&ptr->sem);
283 288
284 serio->write(serio, 0); 289 serio->write(serio, 0);
285 serio->write(serio, 0); 290 serio->write(serio, 0);
286 serio->write(serio, HIL_PKT_CMD >> 8); 291 serio->write(serio, HIL_PKT_CMD >> 8);
287 serio->write(serio, HIL_CMD_EXD); 292 serio->write(serio, HIL_CMD_EXD);
288 down(&(ptr->sem)); 293 down(&ptr->sem);
289 294
290 up(&(ptr->sem)); 295 up(&ptr->sem);
291 296
292 did = ptr->idd[0]; 297 did = ptr->idd[0];
293 idd = ptr->idd + 1; 298 idd = ptr->idd + 1;
@@ -301,12 +306,12 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
301 ptr->dev->evbit[0] = BIT(EV_ABS); 306 ptr->dev->evbit[0] = BIT(EV_ABS);
302 txt = "absolute"; 307 txt = "absolute";
303 } 308 }
304 if (!ptr->dev->evbit[0]) { 309 if (!ptr->dev->evbit[0])
305 goto bail2; 310 goto bail2;
306 }
307 311
308 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd); 312 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
309 if (ptr->nbtn) ptr->dev->evbit[0] |= BIT(EV_KEY); 313 if (ptr->nbtn)
314 ptr->dev->evbit[0] |= BIT(EV_KEY);
310 315
311 naxsets = HIL_IDD_NUM_AXSETS(*idd); 316 naxsets = HIL_IDD_NUM_AXSETS(*idd);
312 ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd); 317 ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd);
@@ -315,7 +320,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
315 did, txt); 320 did, txt);
316 printk(KERN_INFO PREFIX "HIL pointer has %i buttons and %i sets of %i axes\n", 321 printk(KERN_INFO PREFIX "HIL pointer has %i buttons and %i sets of %i axes\n",
317 ptr->nbtn, naxsets, ptr->naxes); 322 ptr->nbtn, naxsets, ptr->naxes);
318 323
319 btntype = BTN_MISC; 324 btntype = BTN_MISC;
320 if ((did & HIL_IDD_DID_ABS_TABLET_MASK) == HIL_IDD_DID_ABS_TABLET) 325 if ((did & HIL_IDD_DID_ABS_TABLET_MASK) == HIL_IDD_DID_ABS_TABLET)
321#ifdef TABLET_SIMULATES_MOUSE 326#ifdef TABLET_SIMULATES_MOUSE
@@ -325,7 +330,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
325#endif 330#endif
326 if ((did & HIL_IDD_DID_ABS_TSCREEN_MASK) == HIL_IDD_DID_ABS_TSCREEN) 331 if ((did & HIL_IDD_DID_ABS_TSCREEN_MASK) == HIL_IDD_DID_ABS_TSCREEN)
327 btntype = BTN_TOUCH; 332 btntype = BTN_TOUCH;
328 333
329 if ((did & HIL_IDD_DID_REL_MOUSE_MASK) == HIL_IDD_DID_REL_MOUSE) 334 if ((did & HIL_IDD_DID_REL_MOUSE_MASK) == HIL_IDD_DID_REL_MOUSE)
330 btntype = BTN_MOUSE; 335 btntype = BTN_MOUSE;
331 336
@@ -341,12 +346,10 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
341 } 346 }
342 347
343 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) { 348 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
344 for (i = 0; i < ptr->naxes; i++) { 349 for (i = 0; i < ptr->naxes; i++)
345 set_bit(REL_X + i, ptr->dev->relbit); 350 set_bit(REL_X + i, ptr->dev->relbit);
346 } 351 for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++)
347 for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {
348 set_bit(REL_X + i, ptr->dev->relbit); 352 set_bit(REL_X + i, ptr->dev->relbit);
349 }
350 } else { 353 } else {
351 for (i = 0; i < ptr->naxes; i++) { 354 for (i = 0; i < ptr->naxes; i++) {
352 set_bit(ABS_X + i, ptr->dev->absbit); 355 set_bit(ABS_X + i, ptr->dev->absbit);
@@ -375,7 +378,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
375 ptr->dev->id.vendor = PCI_VENDOR_ID_HP; 378 ptr->dev->id.vendor = PCI_VENDOR_ID_HP;
376 ptr->dev->id.product = 0x0001; /* TODO: get from ptr->rsc */ 379 ptr->dev->id.product = 0x0001; /* TODO: get from ptr->rsc */
377 ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */ 380 ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */
378 ptr->dev->cdev.dev = &serio->dev; 381 ptr->dev->dev.parent = &serio->dev;
379 382
380 input_register_device(ptr->dev); 383 input_register_device(ptr->dev);
381 printk(KERN_INFO "input: %s (%s), ID: %d\n", 384 printk(KERN_INFO "input: %s (%s), ID: %d\n",
@@ -419,11 +422,11 @@ static int __init hil_ptr_init(void)
419{ 422{
420 return serio_register_driver(&hil_ptr_serio_driver); 423 return serio_register_driver(&hil_ptr_serio_driver);
421} 424}
422 425
423static void __exit hil_ptr_exit(void) 426static void __exit hil_ptr_exit(void)
424{ 427{
425 serio_unregister_driver(&hil_ptr_serio_driver); 428 serio_unregister_driver(&hil_ptr_serio_driver);
426} 429}
427 430
428module_init(hil_ptr_init); 431module_init(hil_ptr_init);
429module_exit(hil_ptr_exit); 432module_exit(hil_ptr_exit);
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 29542f0631cb..1740cadd9594 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -20,6 +20,27 @@
20#include "psmouse.h" 20#include "psmouse.h"
21#include "lifebook.h" 21#include "lifebook.h"
22 22
23struct lifebook_data {
24 struct input_dev *dev2; /* Relative device */
25 char phys[32];
26};
27
28static const char *desired_serio_phys;
29
30static int lifebook_set_serio_phys(struct dmi_system_id *d)
31{
32 desired_serio_phys = d->driver_data;
33 return 0;
34}
35
36static unsigned char lifebook_use_6byte_proto;
37
38static int lifebook_set_6byte_proto(struct dmi_system_id *d)
39{
40 lifebook_use_6byte_proto = 1;
41 return 0;
42}
43
23static struct dmi_system_id lifebook_dmi_table[] = { 44static struct dmi_system_id lifebook_dmi_table[] = {
24 { 45 {
25 .ident = "FLORA-ie 55mi", 46 .ident = "FLORA-ie 55mi",
@@ -56,6 +77,24 @@ static struct dmi_system_id lifebook_dmi_table[] = {
56 .matches = { 77 .matches = {
57 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), 78 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
58 }, 79 },
80 .callback = lifebook_set_serio_phys,
81 .driver_data = "isa0060/serio3",
82 },
83 {
84 .ident = "Panasonic CF-28",
85 .matches = {
86 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
87 DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"),
88 },
89 .callback = lifebook_set_6byte_proto,
90 },
91 {
92 .ident = "Panasonic CF-29",
93 .matches = {
94 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
95 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
96 },
97 .callback = lifebook_set_6byte_proto,
59 }, 98 },
60 { 99 {
61 .ident = "Lifebook B142", 100 .ident = "Lifebook B142",
@@ -68,30 +107,70 @@ static struct dmi_system_id lifebook_dmi_table[] = {
68 107
69static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) 108static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
70{ 109{
110 struct lifebook_data *priv = psmouse->private;
111 struct input_dev *dev1 = psmouse->dev;
112 struct input_dev *dev2 = priv->dev2;
71 unsigned char *packet = psmouse->packet; 113 unsigned char *packet = psmouse->packet;
72 struct input_dev *dev = psmouse->dev; 114 int relative_packet = packet[0] & 0x08;
73 115
74 if (psmouse->pktcnt != 3) 116 if (relative_packet || !lifebook_use_6byte_proto) {
75 return PSMOUSE_GOOD_DATA; 117 if (psmouse->pktcnt != 3)
118 return PSMOUSE_GOOD_DATA;
119 } else {
120 switch (psmouse->pktcnt) {
121 case 1:
122 return (packet[0] & 0xf8) == 0x00 ?
123 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
124 case 2:
125 return PSMOUSE_GOOD_DATA;
126 case 3:
127 return ((packet[2] & 0x30) << 2) == (packet[2] & 0xc0) ?
128 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
129 case 4:
130 return (packet[3] & 0xf8) == 0xc0 ?
131 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
132 case 5:
133 return (packet[4] & 0xc0) == (packet[2] & 0xc0) ?
134 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
135 case 6:
136 if (((packet[5] & 0x30) << 2) != (packet[5] & 0xc0))
137 return PSMOUSE_BAD_DATA;
138 if ((packet[5] & 0xc0) != (packet[1] & 0xc0))
139 return PSMOUSE_BAD_DATA;
140 break; /* report data */
141 }
142 }
76 143
77 /* calculate X and Y */ 144 if (relative_packet) {
78 if ((packet[0] & 0x08) == 0x00) { 145 if (!dev2)
79 input_report_abs(dev, ABS_X, 146 printk(KERN_WARNING "lifebook.c: got relative packet "
147 "but no relative device set up\n");
148 } else if (lifebook_use_6byte_proto) {
149 input_report_abs(dev1, ABS_X,
150 ((packet[1] & 0x3f) << 6) | (packet[2] & 0x3f));
151 input_report_abs(dev1, ABS_Y,
152 4096 - (((packet[4] & 0x3f) << 6) | (packet[5] & 0x3f)));
153 } else {
154 input_report_abs(dev1, ABS_X,
80 (packet[1] | ((packet[0] & 0x30) << 4))); 155 (packet[1] | ((packet[0] & 0x30) << 4)));
81 input_report_abs(dev, ABS_Y, 156 input_report_abs(dev1, ABS_Y,
82 1024 - (packet[2] | ((packet[0] & 0xC0) << 2))); 157 1024 - (packet[2] | ((packet[0] & 0xC0) << 2)));
83 } else {
84 input_report_rel(dev, REL_X,
85 ((packet[0] & 0x10) ? packet[1] - 256 : packet[1]));
86 input_report_rel(dev, REL_Y,
87 -(int)((packet[0] & 0x20) ? packet[2] - 256 : packet[2]));
88 } 158 }
89 159
90 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 160 input_report_key(dev1, BTN_TOUCH, packet[0] & 0x04);
91 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); 161 input_sync(dev1);
92 input_report_key(dev, BTN_TOUCH, packet[0] & 0x04);
93 162
94 input_sync(dev); 163 if (dev2) {
164 if (relative_packet) {
165 input_report_rel(dev2, REL_X,
166 ((packet[0] & 0x10) ? packet[1] - 256 : packet[1]));
167 input_report_rel(dev2, REL_Y,
168 -(int)((packet[0] & 0x20) ? packet[2] - 256 : packet[2]));
169 }
170 input_report_key(dev2, BTN_LEFT, packet[0] & 0x01);
171 input_report_key(dev2, BTN_RIGHT, packet[0] & 0x02);
172 input_sync(dev2);
173 }
95 174
96 return PSMOUSE_FULL_PACKET; 175 return PSMOUSE_FULL_PACKET;
97} 176}
@@ -109,12 +188,20 @@ static int lifebook_absolute_mode(struct psmouse *psmouse)
109 you leave this call out the touchsreen will never send 188 you leave this call out the touchsreen will never send
110 absolute coordinates 189 absolute coordinates
111 */ 190 */
112 param = 0x07; 191 param = lifebook_use_6byte_proto ? 0x08 : 0x07;
113 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES); 192 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES);
114 193
115 return 0; 194 return 0;
116} 195}
117 196
197static void lifebook_relative_mode(struct psmouse *psmouse)
198{
199 struct ps2dev *ps2dev = &psmouse->ps2dev;
200 unsigned char param = 0x06;
201
202 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES);
203}
204
118static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution) 205static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution)
119{ 206{
120 static const unsigned char params[] = { 0, 1, 2, 2, 3 }; 207 static const unsigned char params[] = { 0, 1, 2, 2, 3 };
@@ -131,6 +218,8 @@ static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolu
131static void lifebook_disconnect(struct psmouse *psmouse) 218static void lifebook_disconnect(struct psmouse *psmouse)
132{ 219{
133 psmouse_reset(psmouse); 220 psmouse_reset(psmouse);
221 kfree(psmouse->private);
222 psmouse->private = NULL;
134} 223}
135 224
136int lifebook_detect(struct psmouse *psmouse, int set_properties) 225int lifebook_detect(struct psmouse *psmouse, int set_properties)
@@ -138,6 +227,10 @@ int lifebook_detect(struct psmouse *psmouse, int set_properties)
138 if (!dmi_check_system(lifebook_dmi_table)) 227 if (!dmi_check_system(lifebook_dmi_table))
139 return -1; 228 return -1;
140 229
230 if (desired_serio_phys &&
231 strcmp(psmouse->ps2dev.serio->phys, desired_serio_phys))
232 return -1;
233
141 if (set_properties) { 234 if (set_properties) {
142 psmouse->vendor = "Fujitsu"; 235 psmouse->vendor = "Fujitsu";
143 psmouse->name = "Lifebook TouchScreen"; 236 psmouse->name = "Lifebook TouchScreen";
@@ -146,24 +239,78 @@ int lifebook_detect(struct psmouse *psmouse, int set_properties)
146 return 0; 239 return 0;
147} 240}
148 241
242static int lifebook_create_relative_device(struct psmouse *psmouse)
243{
244 struct input_dev *dev2;
245 struct lifebook_data *priv;
246 int error = -ENOMEM;
247
248 priv = kzalloc(sizeof(struct lifebook_data), GFP_KERNEL);
249 dev2 = input_allocate_device();
250 if (!priv || !dev2)
251 goto err_out;
252
253 priv->dev2 = dev2;
254 snprintf(priv->phys, sizeof(priv->phys),
255 "%s/input1", psmouse->ps2dev.serio->phys);
256
257 dev2->phys = priv->phys;
258 dev2->name = "PS/2 Touchpad";
259 dev2->id.bustype = BUS_I8042;
260 dev2->id.vendor = 0x0002;
261 dev2->id.product = PSMOUSE_LIFEBOOK;
262 dev2->id.version = 0x0000;
263 dev2->dev.parent = &psmouse->ps2dev.serio->dev;
264
265 dev2->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
266 dev2->relbit[LONG(REL_X)] = BIT(REL_X) | BIT(REL_Y);
267 dev2->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
268
269 error = input_register_device(priv->dev2);
270 if (error)
271 goto err_out;
272
273 psmouse->private = priv;
274 return 0;
275
276 err_out:
277 input_free_device(dev2);
278 kfree(priv);
279 return error;
280}
281
149int lifebook_init(struct psmouse *psmouse) 282int lifebook_init(struct psmouse *psmouse)
150{ 283{
151 struct input_dev *input_dev = psmouse->dev; 284 struct input_dev *dev1 = psmouse->dev;
285 int max_coord = lifebook_use_6byte_proto ? 1024 : 4096;
152 286
153 if (lifebook_absolute_mode(psmouse)) 287 if (lifebook_absolute_mode(psmouse))
154 return -1; 288 return -1;
155 289
156 input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL); 290 dev1->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY);
157 input_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 291 dev1->relbit[0] = 0;
158 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 292 dev1->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
159 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 293 input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0);
160 input_set_abs_params(input_dev, ABS_X, 0, 1024, 0, 0); 294 input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0);
161 input_set_abs_params(input_dev, ABS_Y, 0, 1024, 0, 0); 295
296 if (!desired_serio_phys) {
297 if (lifebook_create_relative_device(psmouse)) {
298 lifebook_relative_mode(psmouse);
299 return -1;
300 }
301 }
162 302
163 psmouse->protocol_handler = lifebook_process_byte; 303 psmouse->protocol_handler = lifebook_process_byte;
164 psmouse->set_resolution = lifebook_set_resolution; 304 psmouse->set_resolution = lifebook_set_resolution;
165 psmouse->disconnect = lifebook_disconnect; 305 psmouse->disconnect = lifebook_disconnect;
166 psmouse->reconnect = lifebook_absolute_mode; 306 psmouse->reconnect = lifebook_absolute_mode;
307
308 psmouse->model = lifebook_use_6byte_proto ? 6 : 3;
309
310 /*
311 * Use packet size = 3 even when using 6-byte protocol because
312 * that's what POLL will return on Lifebooks (according to spec).
313 */
167 psmouse->pktsize = 3; 314 psmouse->pktsize = 3;
168 315
169 return 0; 316 return 0;
diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h
index be1c0943825d..c1647cf036c2 100644
--- a/drivers/input/mouse/lifebook.h
+++ b/drivers/input/mouse/lifebook.h
@@ -11,7 +11,18 @@
11#ifndef _LIFEBOOK_H 11#ifndef _LIFEBOOK_H
12#define _LIFEBOOK_H 12#define _LIFEBOOK_H
13 13
14#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
14int lifebook_detect(struct psmouse *psmouse, int set_properties); 15int lifebook_detect(struct psmouse *psmouse, int set_properties);
15int lifebook_init(struct psmouse *psmouse); 16int lifebook_init(struct psmouse *psmouse);
17#else
18inline int lifebook_detect(struct psmouse *psmouse, int set_properties)
19{
20 return -ENOSYS;
21}
22inline int lifebook_init(struct psmouse *psmouse)
23{
24 return -ENOSYS;
25}
26#endif
16 27
17#endif 28#endif
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index d3ddea26b8ca..9df74b72e6c4 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -200,6 +200,7 @@ static void ps2pp_disconnect(struct psmouse *psmouse)
200static const struct ps2pp_info *get_model_info(unsigned char model) 200static const struct ps2pp_info *get_model_info(unsigned char model)
201{ 201{
202 static const struct ps2pp_info ps2pp_list[] = { 202 static const struct ps2pp_info ps2pp_list[] = {
203 { 1, 0, 0 }, /* Simple 2-button mouse */
203 { 12, 0, PS2PP_SIDE_BTN}, 204 { 12, 0, PS2PP_SIDE_BTN},
204 { 13, 0, 0 }, 205 { 13, 0, 0 },
205 { 15, PS2PP_KIND_MX, /* MX1000 */ 206 { 15, PS2PP_KIND_MX, /* MX1000 */
@@ -338,12 +339,12 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
338 param[1] = 0; 339 param[1] = 0;
339 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); 340 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
340 341
341 if (!param[1])
342 return -1;
343
344 model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); 342 model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
345 buttons = param[1]; 343 buttons = param[1];
346 344
345 if (!model || !buttons)
346 return -1;
347
347 if ((model_info = get_model_info(model)) != NULL) { 348 if ((model_info = get_model_info(model)) != NULL) {
348 349
349/* 350/*
diff --git a/drivers/input/mouse/logips2pp.h b/drivers/input/mouse/logips2pp.h
index 64a8ec52ea6d..6e5712525fd6 100644
--- a/drivers/input/mouse/logips2pp.h
+++ b/drivers/input/mouse/logips2pp.h
@@ -11,6 +11,13 @@
11#ifndef _LOGIPS2PP_H 11#ifndef _LOGIPS2PP_H
12#define _LOGIPS2PP_H 12#define _LOGIPS2PP_H
13 13
14#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
14int ps2pp_init(struct psmouse *psmouse, int set_properties); 15int ps2pp_init(struct psmouse *psmouse, int set_properties);
16#else
17inline int ps2pp_init(struct psmouse *psmouse, int set_properties)
18{
19 return -ENOSYS;
20}
21#endif /* CONFIG_MOUSE_PS2_LOGIPS2PP */
15 22
16#endif 23#endif
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 0fe5869d7d4c..f15f695777f8 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -28,6 +28,7 @@
28#include "alps.h" 28#include "alps.h"
29#include "lifebook.h" 29#include "lifebook.h"
30#include "trackpoint.h" 30#include "trackpoint.h"
31#include "touchkit_ps2.h"
31 32
32#define DRIVER_DESC "PS/2 mouse driver" 33#define DRIVER_DESC "PS/2 mouse driver"
33 34
@@ -569,7 +570,9 @@ static int psmouse_extensions(struct psmouse *psmouse,
569 return PSMOUSE_THINKPS; 570 return PSMOUSE_THINKPS;
570 571
571/* 572/*
572 * Try Synaptics TouchPad 573 * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol
574 * support is disabled in config - we need to know if it is synaptics so we
575 * can reset it properly after probing for intellimouse.
573 */ 576 */
574 if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { 577 if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) {
575 synaptics_hardware = 1; 578 synaptics_hardware = 1;
@@ -605,14 +608,20 @@ static int psmouse_extensions(struct psmouse *psmouse,
605 } 608 }
606 } 609 }
607 610
608 if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse, set_properties) == 0) 611 if (max_proto > PSMOUSE_IMEX) {
609 return PSMOUSE_GENPS; 612
613 if (genius_detect(psmouse, set_properties) == 0)
614 return PSMOUSE_GENPS;
610 615
611 if (max_proto > PSMOUSE_IMEX && ps2pp_init(psmouse, set_properties) == 0) 616 if (ps2pp_init(psmouse, set_properties) == 0)
612 return PSMOUSE_PS2PP; 617 return PSMOUSE_PS2PP;
613 618
614 if (max_proto > PSMOUSE_IMEX && trackpoint_detect(psmouse, set_properties) == 0) 619 if (trackpoint_detect(psmouse, set_properties) == 0)
615 return PSMOUSE_TRACKPOINT; 620 return PSMOUSE_TRACKPOINT;
621
622 if (touchkit_ps2_detect(psmouse, set_properties) == 0)
623 return PSMOUSE_TOUCHKIT_PS2;
624 }
616 625
617/* 626/*
618 * Reset to defaults in case the device got confused by extended 627 * Reset to defaults in case the device got confused by extended
@@ -654,12 +663,14 @@ static const struct psmouse_protocol psmouse_protocols[] = {
654 .maxproto = 1, 663 .maxproto = 1,
655 .detect = ps2bare_detect, 664 .detect = ps2bare_detect,
656 }, 665 },
666#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
657 { 667 {
658 .type = PSMOUSE_PS2PP, 668 .type = PSMOUSE_PS2PP,
659 .name = "PS2++", 669 .name = "PS2++",
660 .alias = "logitech", 670 .alias = "logitech",
661 .detect = ps2pp_init, 671 .detect = ps2pp_init,
662 }, 672 },
673#endif
663 { 674 {
664 .type = PSMOUSE_THINKPS, 675 .type = PSMOUSE_THINKPS,
665 .name = "ThinkPS/2", 676 .name = "ThinkPS/2",
@@ -686,6 +697,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
686 .maxproto = 1, 697 .maxproto = 1,
687 .detect = im_explorer_detect, 698 .detect = im_explorer_detect,
688 }, 699 },
700#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
689 { 701 {
690 .type = PSMOUSE_SYNAPTICS, 702 .type = PSMOUSE_SYNAPTICS,
691 .name = "SynPS/2", 703 .name = "SynPS/2",
@@ -693,6 +705,8 @@ static const struct psmouse_protocol psmouse_protocols[] = {
693 .detect = synaptics_detect, 705 .detect = synaptics_detect,
694 .init = synaptics_init, 706 .init = synaptics_init,
695 }, 707 },
708#endif
709#ifdef CONFIG_MOUSE_PS2_ALPS
696 { 710 {
697 .type = PSMOUSE_ALPS, 711 .type = PSMOUSE_ALPS,
698 .name = "AlpsPS/2", 712 .name = "AlpsPS/2",
@@ -700,18 +714,31 @@ static const struct psmouse_protocol psmouse_protocols[] = {
700 .detect = alps_detect, 714 .detect = alps_detect,
701 .init = alps_init, 715 .init = alps_init,
702 }, 716 },
717#endif
718#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
703 { 719 {
704 .type = PSMOUSE_LIFEBOOK, 720 .type = PSMOUSE_LIFEBOOK,
705 .name = "LBPS/2", 721 .name = "LBPS/2",
706 .alias = "lifebook", 722 .alias = "lifebook",
707 .init = lifebook_init, 723 .init = lifebook_init,
708 }, 724 },
725#endif
726#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
709 { 727 {
710 .type = PSMOUSE_TRACKPOINT, 728 .type = PSMOUSE_TRACKPOINT,
711 .name = "TPPS/2", 729 .name = "TPPS/2",
712 .alias = "trackpoint", 730 .alias = "trackpoint",
713 .detect = trackpoint_detect, 731 .detect = trackpoint_detect,
714 }, 732 },
733#endif
734#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
735 {
736 .type = PSMOUSE_TOUCHKIT_PS2,
737 .name = "touchkitPS/2",
738 .alias = "touchkit",
739 .detect = touchkit_ps2_detect,
740 },
741#endif
715 { 742 {
716 .type = PSMOUSE_AUTO, 743 .type = PSMOUSE_AUTO,
717 .name = "auto", 744 .name = "auto",
@@ -823,12 +850,6 @@ static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
823static void psmouse_initialize(struct psmouse *psmouse) 850static void psmouse_initialize(struct psmouse *psmouse)
824{ 851{
825/* 852/*
826 * We set the mouse into streaming mode.
827 */
828
829 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM);
830
831/*
832 * We set the mouse report rate, resolution and scaling. 853 * We set the mouse report rate, resolution and scaling.
833 */ 854 */
834 855
@@ -1062,8 +1083,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse
1062{ 1083{
1063 struct input_dev *input_dev = psmouse->dev; 1084 struct input_dev *input_dev = psmouse->dev;
1064 1085
1065 input_dev->private = psmouse; 1086 input_dev->dev.parent = &psmouse->ps2dev.serio->dev;
1066 input_dev->cdev.dev = &psmouse->ps2dev.serio->dev;
1067 1087
1068 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 1088 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
1069 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 1089 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index cf1de95b6f27..3964e8acbc54 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -87,6 +87,7 @@ enum psmouse_type {
87 PSMOUSE_ALPS, 87 PSMOUSE_ALPS,
88 PSMOUSE_LIFEBOOK, 88 PSMOUSE_LIFEBOOK,
89 PSMOUSE_TRACKPOINT, 89 PSMOUSE_TRACKPOINT,
90 PSMOUSE_TOUCHKIT_PS2,
90 PSMOUSE_AUTO /* This one should always be last */ 91 PSMOUSE_AUTO /* This one should always be last */
91}; 92};
92 93
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index a85d74710b44..77b8ee2b9651 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -69,7 +69,8 @@ static void sermouse_process_msc(struct sermouse *sermouse, signed char data)
69 switch (sermouse->count) { 69 switch (sermouse->count) {
70 70
71 case 0: 71 case 0:
72 if ((data & 0xf8) != 0x80) return; 72 if ((data & 0xf8) != 0x80)
73 return;
73 input_report_key(dev, BTN_LEFT, !(data & 4)); 74 input_report_key(dev, BTN_LEFT, !(data & 4));
74 input_report_key(dev, BTN_RIGHT, !(data & 1)); 75 input_report_key(dev, BTN_RIGHT, !(data & 1));
75 input_report_key(dev, BTN_MIDDLE, !(data & 2)); 76 input_report_key(dev, BTN_MIDDLE, !(data & 2));
@@ -107,7 +108,10 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
107 struct input_dev *dev = sermouse->dev; 108 struct input_dev *dev = sermouse->dev;
108 signed char *buf = sermouse->buf; 109 signed char *buf = sermouse->buf;
109 110
110 if (data & 0x40) sermouse->count = 0; 111 if (data & 0x40)
112 sermouse->count = 0;
113 else if (sermouse->count == 0)
114 return;
111 115
112 switch (sermouse->count) { 116 switch (sermouse->count) {
113 117
@@ -169,7 +173,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
169 173
170 case 5: 174 case 5:
171 case 7: /* Ignore anything besides MZ++ */ 175 case 7: /* Ignore anything besides MZ++ */
172 if (sermouse->type != SERIO_MZPP) break; 176 if (sermouse->type != SERIO_MZPP)
177 break;
173 178
174 switch (buf[1]) { 179 switch (buf[1]) {
175 180
@@ -206,13 +211,16 @@ static irqreturn_t sermouse_interrupt(struct serio *serio,
206{ 211{
207 struct sermouse *sermouse = serio_get_drvdata(serio); 212 struct sermouse *sermouse = serio_get_drvdata(serio);
208 213
209 if (time_after(jiffies, sermouse->last + HZ/10)) sermouse->count = 0; 214 if (time_after(jiffies, sermouse->last + HZ/10))
215 sermouse->count = 0;
216
210 sermouse->last = jiffies; 217 sermouse->last = jiffies;
211 218
212 if (sermouse->type > SERIO_SUN) 219 if (sermouse->type > SERIO_SUN)
213 sermouse_process_ms(sermouse, data); 220 sermouse_process_ms(sermouse, data);
214 else 221 else
215 sermouse_process_msc(sermouse, data); 222 sermouse_process_msc(sermouse, data);
223
216 return IRQ_HANDLED; 224 return IRQ_HANDLED;
217} 225}
218 226
@@ -258,12 +266,11 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
258 input_dev->id.vendor = sermouse->type; 266 input_dev->id.vendor = sermouse->type;
259 input_dev->id.product = c; 267 input_dev->id.product = c;
260 input_dev->id.version = 0x0100; 268 input_dev->id.version = 0x0100;
261 input_dev->cdev.dev = &serio->dev; 269 input_dev->dev.parent = &serio->dev;
262 270
263 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 271 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
264 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 272 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
265 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 273 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
266 input_dev->private = sermouse;
267 274
268 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); 275 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit);
269 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); 276 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f0f9413d762c..c77788bf932d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -40,33 +40,70 @@
40#define YMIN_NOMINAL 1408 40#define YMIN_NOMINAL 1408
41#define YMAX_NOMINAL 4448 41#define YMAX_NOMINAL 4448
42 42
43
43/***************************************************************************** 44/*****************************************************************************
44 * Synaptics communications functions 45 * Stuff we need even when we do not want native Synaptics support
45 ****************************************************************************/ 46 ****************************************************************************/
46 47
47/* 48/*
48 * Send a command to the synpatics touchpad by special commands 49 * Set the synaptics touchpad mode byte by special commands
49 */ 50 */
50static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) 51static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
51{ 52{
52 if (psmouse_sliced_command(psmouse, c)) 53 unsigned char param[1];
54
55 if (psmouse_sliced_command(psmouse, mode))
53 return -1; 56 return -1;
54 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) 57 param[0] = SYN_PS_SET_MODE2;
58 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
55 return -1; 59 return -1;
56 return 0; 60 return 0;
57} 61}
58 62
63int synaptics_detect(struct psmouse *psmouse, int set_properties)
64{
65 struct ps2dev *ps2dev = &psmouse->ps2dev;
66 unsigned char param[4];
67
68 param[0] = 0;
69
70 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
71 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
72 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
73 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
74 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
75
76 if (param[1] != 0x47)
77 return -ENODEV;
78
79 if (set_properties) {
80 psmouse->vendor = "Synaptics";
81 psmouse->name = "TouchPad";
82 }
83
84 return 0;
85}
86
87void synaptics_reset(struct psmouse *psmouse)
88{
89 /* reset touchpad back to relative mode, gestures enabled */
90 synaptics_mode_cmd(psmouse, 0);
91}
92
93#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
94
95/*****************************************************************************
96 * Synaptics communications functions
97 ****************************************************************************/
98
59/* 99/*
60 * Set the synaptics touchpad mode byte by special commands 100 * Send a command to the synpatics touchpad by special commands
61 */ 101 */
62static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) 102static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param)
63{ 103{
64 unsigned char param[1]; 104 if (psmouse_sliced_command(psmouse, c))
65
66 if (psmouse_sliced_command(psmouse, mode))
67 return -1; 105 return -1;
68 param[0] = SYN_PS_SET_MODE2; 106 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO))
69 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
70 return -1; 107 return -1;
71 return 0; 108 return 0;
72} 109}
@@ -529,12 +566,6 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
529 clear_bit(REL_Y, dev->relbit); 566 clear_bit(REL_Y, dev->relbit);
530} 567}
531 568
532void synaptics_reset(struct psmouse *psmouse)
533{
534 /* reset touchpad back to relative mode, gestures enabled */
535 synaptics_mode_cmd(psmouse, 0);
536}
537
538static void synaptics_disconnect(struct psmouse *psmouse) 569static void synaptics_disconnect(struct psmouse *psmouse)
539{ 570{
540 synaptics_reset(psmouse); 571 synaptics_reset(psmouse);
@@ -569,30 +600,6 @@ static int synaptics_reconnect(struct psmouse *psmouse)
569 return 0; 600 return 0;
570} 601}
571 602
572int synaptics_detect(struct psmouse *psmouse, int set_properties)
573{
574 struct ps2dev *ps2dev = &psmouse->ps2dev;
575 unsigned char param[4];
576
577 param[0] = 0;
578
579 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
580 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
581 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
582 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
583 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
584
585 if (param[1] != 0x47)
586 return -1;
587
588 if (set_properties) {
589 psmouse->vendor = "Synaptics";
590 psmouse->name = "TouchPad";
591 }
592
593 return 0;
594}
595
596#if defined(__i386__) 603#if defined(__i386__)
597#include <linux/dmi.h> 604#include <linux/dmi.h>
598static struct dmi_system_id toshiba_dmi_table[] = { 605static struct dmi_system_id toshiba_dmi_table[] = {
@@ -648,6 +655,16 @@ int synaptics_init(struct psmouse *psmouse)
648 655
649 set_input_params(psmouse->dev, priv); 656 set_input_params(psmouse->dev, priv);
650 657
658 /*
659 * Encode touchpad model so that it can be used to set
660 * input device->id.version and be visible to userspace.
661 * Because version is __u16 we have to drop something.
662 * Hardware info bits seem to be good candidates as they
663 * are documented to be for Synaptics corp. internal use.
664 */
665 psmouse->model = ((priv->model_id & 0x00ff0000) >> 8) |
666 (priv->model_id & 0x000000ff);
667
651 psmouse->protocol_handler = synaptics_process_byte; 668 psmouse->protocol_handler = synaptics_process_byte;
652 psmouse->set_rate = synaptics_set_rate; 669 psmouse->set_rate = synaptics_set_rate;
653 psmouse->disconnect = synaptics_disconnect; 670 psmouse->disconnect = synaptics_disconnect;
@@ -680,4 +697,12 @@ int synaptics_init(struct psmouse *psmouse)
680 return -1; 697 return -1;
681} 698}
682 699
700#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
701
702int synaptics_init(struct psmouse *psmouse)
703{
704 return -ENOSYS;
705}
706
707#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
683 708
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 68fff1dcd7de..02aa4cf7bc77 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -9,10 +9,6 @@
9#ifndef _SYNAPTICS_H 9#ifndef _SYNAPTICS_H
10#define _SYNAPTICS_H 10#define _SYNAPTICS_H
11 11
12extern int synaptics_detect(struct psmouse *psmouse, int set_properties);
13extern int synaptics_init(struct psmouse *psmouse);
14extern void synaptics_reset(struct psmouse *psmouse);
15
16/* synaptics queries */ 12/* synaptics queries */
17#define SYN_QUE_IDENTIFY 0x00 13#define SYN_QUE_IDENTIFY 0x00
18#define SYN_QUE_MODES 0x01 14#define SYN_QUE_MODES 0x01
@@ -62,9 +58,9 @@ extern void synaptics_reset(struct psmouse *psmouse);
62#define SYN_MODE_WMODE(m) ((m) & (1 << 0)) 58#define SYN_MODE_WMODE(m) ((m) & (1 << 0))
63 59
64/* synaptics identify query bits */ 60/* synaptics identify query bits */
65#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) 61#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f)
66#define SYN_ID_MAJOR(i) ((i) & 0x0f) 62#define SYN_ID_MAJOR(i) ((i) & 0x0f)
67#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) 63#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff)
68#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) 64#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47)
69 65
70/* synaptics special commands */ 66/* synaptics special commands */
@@ -98,8 +94,8 @@ struct synaptics_hw_state {
98struct synaptics_data { 94struct synaptics_data {
99 /* Data read from the touchpad */ 95 /* Data read from the touchpad */
100 unsigned long int model_id; /* Model-ID */ 96 unsigned long int model_id; /* Model-ID */
101 unsigned long int capabilities; /* Capabilities */ 97 unsigned long int capabilities; /* Capabilities */
102 unsigned long int ext_cap; /* Extended Capabilities */ 98 unsigned long int ext_cap; /* Extended Capabilities */
103 unsigned long int identity; /* Identification */ 99 unsigned long int identity; /* Identification */
104 100
105 unsigned char pkt_type; /* packet type - old, new, etc */ 101 unsigned char pkt_type; /* packet type - old, new, etc */
@@ -107,4 +103,8 @@ struct synaptics_data {
107 int scroll; 103 int scroll;
108}; 104};
109 105
106int synaptics_detect(struct psmouse *psmouse, int set_properties);
107int synaptics_init(struct psmouse *psmouse);
108void synaptics_reset(struct psmouse *psmouse);
109
110#endif /* _SYNAPTICS_H */ 110#endif /* _SYNAPTICS_H */
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c
new file mode 100644
index 000000000000..7b977fd23571
--- /dev/null
+++ b/drivers/input/mouse/touchkit_ps2.c
@@ -0,0 +1,100 @@
1/* ----------------------------------------------------------------------------
2 * touchkit_ps2.c -- Driver for eGalax TouchKit PS/2 Touchscreens
3 *
4 * Copyright (C) 2005 by Stefan Lucke
5 * Copyright (C) 2004 by Daniel Ritz
6 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Based upon touchkitusb.c
23 *
24 * Vendor documentation is available in support section of:
25 * http://www.egalax.com.tw/
26 */
27
28#include <linux/kernel.h>
29#include <linux/slab.h>
30
31#include <linux/input.h>
32#include <linux/serio.h>
33#include <linux/libps2.h>
34
35#include "psmouse.h"
36#include "touchkit_ps2.h"
37
38#define TOUCHKIT_MAX_XC 0x07ff
39#define TOUCHKIT_MAX_YC 0x07ff
40
41#define TOUCHKIT_CMD 0x0a
42#define TOUCHKIT_CMD_LENGTH 1
43
44#define TOUCHKIT_CMD_ACTIVE 'A'
45#define TOUCHKIT_CMD_FIRMWARE_VERSION 'D'
46#define TOUCHKIT_CMD_CONTROLLER_TYPE 'E'
47
48#define TOUCHKIT_SEND_PARMS(s, r, c) ((s) << 12 | (r) << 8 | (c))
49
50#define TOUCHKIT_GET_TOUCHED(packet) (((packet)[0]) & 0x01)
51#define TOUCHKIT_GET_X(packet) (((packet)[1] << 7) | (packet)[2])
52#define TOUCHKIT_GET_Y(packet) (((packet)[3] << 7) | (packet)[4])
53
54static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse)
55{
56 unsigned char *packet = psmouse->packet;
57 struct input_dev *dev = psmouse->dev;
58
59 if (psmouse->pktcnt != 5)
60 return PSMOUSE_GOOD_DATA;
61
62 input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet));
63 input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet));
64 input_report_key(dev, BTN_TOUCH, TOUCHKIT_GET_TOUCHED(packet));
65 input_sync(dev);
66
67 return PSMOUSE_FULL_PACKET;
68}
69
70int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties)
71{
72 struct input_dev *dev = psmouse->dev;
73 unsigned char param[3];
74 int command;
75
76 param[0] = TOUCHKIT_CMD_LENGTH;
77 param[1] = TOUCHKIT_CMD_ACTIVE;
78 command = TOUCHKIT_SEND_PARMS(2, 3, TOUCHKIT_CMD);
79
80 if (ps2_command(&psmouse->ps2dev, param, command))
81 return -ENODEV;
82
83 if (param[0] != TOUCHKIT_CMD || param[1] != 0x01 ||
84 param[2] != TOUCHKIT_CMD_ACTIVE)
85 return -ENODEV;
86
87 if (set_properties) {
88 dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
89 set_bit(BTN_TOUCH, dev->keybit);
90 input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0);
91 input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0);
92
93 psmouse->vendor = "eGalax";
94 psmouse->name = "Touchscreen";
95 psmouse->protocol_handler = touchkit_ps2_process_byte;
96 psmouse->pktsize = 5;
97 }
98
99 return 0;
100}
diff --git a/drivers/input/mouse/touchkit_ps2.h b/drivers/input/mouse/touchkit_ps2.h
new file mode 100644
index 000000000000..61e9dfd8419f
--- /dev/null
+++ b/drivers/input/mouse/touchkit_ps2.h
@@ -0,0 +1,24 @@
1/* ----------------------------------------------------------------------------
2 * touchkit_ps2.h -- Driver for eGalax TouchKit PS/2 Touchscreens
3 *
4 * Copyright (C) 2005 by Stefan Lucke
5 * Copyright (c) 2005 Vojtech Pavlik
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#ifndef _TOUCHKIT_PS2_H
13#define _TOUCHKIT_PS2_H
14
15#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
16int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties);
17#else
18inline int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties)
19{
20 return -ENOSYS;
21}
22#endif /* CONFIG_MOUSE_PS2_TOUCHKIT */
23
24#endif
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
index 050298b1a09d..c10a6e7d0101 100644
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -142,6 +142,13 @@ struct trackpoint_data
142 unsigned char ext_dev; 142 unsigned char ext_dev;
143}; 143};
144 144
145extern int trackpoint_detect(struct psmouse *psmouse, int set_properties); 145#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
146int trackpoint_detect(struct psmouse *psmouse, int set_properties);
147#else
148inline int trackpoint_detect(struct psmouse *psmouse, int set_properties)
149{
150 return -ENOSYS;
151}
152#endif /* CONFIG_MOUSE_PS2_TRACKPOINT */
146 153
147#endif /* _TRACKPOINT_H */ 154#endif /* _TRACKPOINT_H */
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index c3d64fcc858d..4a321576f345 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -508,8 +508,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
508 input_dev->name = mouse->name; 508 input_dev->name = mouse->name;
509 input_dev->phys = mouse->phys; 509 input_dev->phys = mouse->phys;
510 input_dev->id.bustype = BUS_RS232; 510 input_dev->id.bustype = BUS_RS232;
511 input_dev->cdev.dev = &serio->dev; 511 input_dev->dev.parent = &serio->dev;
512 input_dev->private = mouse;
513 512
514 set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ 513 set_bit (EV_KEY, input_dev->evbit); /* We have buttons */
515 set_bit (EV_REL, input_dev->evbit); 514 set_bit (EV_REL, input_dev->evbit);
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 664bcc8116fc..7678e9876550 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -63,9 +63,12 @@ struct mousedev {
63 int minor; 63 int minor;
64 char name[16]; 64 char name[16];
65 wait_queue_head_t wait; 65 wait_queue_head_t wait;
66 struct list_head list; 66 struct list_head client_list;
67 struct input_handle handle; 67 struct input_handle handle;
68 68
69 struct list_head mixdev_node;
70 int mixdev_open;
71
69 struct mousedev_hw_data packet; 72 struct mousedev_hw_data packet;
70 unsigned int pkt_count; 73 unsigned int pkt_count;
71 int old_x[4], old_y[4]; 74 int old_x[4], old_y[4];
@@ -85,7 +88,7 @@ struct mousedev_motion {
85}; 88};
86 89
87#define PACKET_QUEUE_LEN 16 90#define PACKET_QUEUE_LEN 16
88struct mousedev_list { 91struct mousedev_client {
89 struct fasync_struct *fasync; 92 struct fasync_struct *fasync;
90 struct mousedev *mousedev; 93 struct mousedev *mousedev;
91 struct list_head node; 94 struct list_head node;
@@ -111,6 +114,7 @@ static struct input_handler mousedev_handler;
111 114
112static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; 115static struct mousedev *mousedev_table[MOUSEDEV_MINORS];
113static struct mousedev mousedev_mix; 116static struct mousedev mousedev_mix;
117static LIST_HEAD(mousedev_mix_list);
114 118
115#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) 119#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
116#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) 120#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
@@ -120,32 +124,33 @@ static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mous
120 int size, tmp; 124 int size, tmp;
121 enum { FRACTION_DENOM = 128 }; 125 enum { FRACTION_DENOM = 128 };
122 126
123 if (mousedev->touch) { 127 switch (code) {
124 size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; 128 case ABS_X:
125 if (size == 0) 129 fx(0) = value;
126 size = 256 * 2; 130 if (mousedev->touch && mousedev->pkt_count >= 2) {
127 131 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
128 switch (code) { 132 if (size == 0)
129 case ABS_X: 133 size = 256 * 2;
130 fx(0) = value; 134 tmp = ((value - fx(2)) * (256 * FRACTION_DENOM)) / size;
131 if (mousedev->pkt_count >= 2) { 135 tmp += mousedev->frac_dx;
132 tmp = ((value - fx(2)) * (256 * FRACTION_DENOM)) / size; 136 mousedev->packet.dx = tmp / FRACTION_DENOM;
133 tmp += mousedev->frac_dx; 137 mousedev->frac_dx = tmp - mousedev->packet.dx * FRACTION_DENOM;
134 mousedev->packet.dx = tmp / FRACTION_DENOM; 138 }
135 mousedev->frac_dx = tmp - mousedev->packet.dx * FRACTION_DENOM; 139 break;
136 }
137 break;
138 140
139 case ABS_Y: 141 case ABS_Y:
140 fy(0) = value; 142 fy(0) = value;
141 if (mousedev->pkt_count >= 2) { 143 if (mousedev->touch && mousedev->pkt_count >= 2) {
142 tmp = -((value - fy(2)) * (256 * FRACTION_DENOM)) / size; 144 /* use X size to keep the same scale */
143 tmp += mousedev->frac_dy; 145 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
144 mousedev->packet.dy = tmp / FRACTION_DENOM; 146 if (size == 0)
145 mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM; 147 size = 256 * 2;
146 } 148 tmp = -((value - fy(2)) * (256 * FRACTION_DENOM)) / size;
147 break; 149 tmp += mousedev->frac_dy;
148 } 150 mousedev->packet.dy = tmp / FRACTION_DENOM;
151 mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM;
152 }
153 break;
149 } 154 }
150} 155}
151 156
@@ -223,47 +228,47 @@ static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int
223 228
224static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet) 229static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet)
225{ 230{
226 struct mousedev_list *list; 231 struct mousedev_client *client;
227 struct mousedev_motion *p; 232 struct mousedev_motion *p;
228 unsigned long flags; 233 unsigned long flags;
229 int wake_readers = 0; 234 int wake_readers = 0;
230 235
231 list_for_each_entry(list, &mousedev->list, node) { 236 list_for_each_entry(client, &mousedev->client_list, node) {
232 spin_lock_irqsave(&list->packet_lock, flags); 237 spin_lock_irqsave(&client->packet_lock, flags);
233 238
234 p = &list->packets[list->head]; 239 p = &client->packets[client->head];
235 if (list->ready && p->buttons != mousedev->packet.buttons) { 240 if (client->ready && p->buttons != mousedev->packet.buttons) {
236 unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; 241 unsigned int new_head = (client->head + 1) % PACKET_QUEUE_LEN;
237 if (new_head != list->tail) { 242 if (new_head != client->tail) {
238 p = &list->packets[list->head = new_head]; 243 p = &client->packets[client->head = new_head];
239 memset(p, 0, sizeof(struct mousedev_motion)); 244 memset(p, 0, sizeof(struct mousedev_motion));
240 } 245 }
241 } 246 }
242 247
243 if (packet->abs_event) { 248 if (packet->abs_event) {
244 p->dx += packet->x - list->pos_x; 249 p->dx += packet->x - client->pos_x;
245 p->dy += packet->y - list->pos_y; 250 p->dy += packet->y - client->pos_y;
246 list->pos_x = packet->x; 251 client->pos_x = packet->x;
247 list->pos_y = packet->y; 252 client->pos_y = packet->y;
248 } 253 }
249 254
250 list->pos_x += packet->dx; 255 client->pos_x += packet->dx;
251 list->pos_x = list->pos_x < 0 ? 0 : (list->pos_x >= xres ? xres : list->pos_x); 256 client->pos_x = client->pos_x < 0 ? 0 : (client->pos_x >= xres ? xres : client->pos_x);
252 list->pos_y += packet->dy; 257 client->pos_y += packet->dy;
253 list->pos_y = list->pos_y < 0 ? 0 : (list->pos_y >= yres ? yres : list->pos_y); 258 client->pos_y = client->pos_y < 0 ? 0 : (client->pos_y >= yres ? yres : client->pos_y);
254 259
255 p->dx += packet->dx; 260 p->dx += packet->dx;
256 p->dy += packet->dy; 261 p->dy += packet->dy;
257 p->dz += packet->dz; 262 p->dz += packet->dz;
258 p->buttons = mousedev->packet.buttons; 263 p->buttons = mousedev->packet.buttons;
259 264
260 if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons) 265 if (p->dx || p->dy || p->dz || p->buttons != client->last_buttons)
261 list->ready = 1; 266 client->ready = 1;
262 267
263 spin_unlock_irqrestore(&list->packet_lock, flags); 268 spin_unlock_irqrestore(&client->packet_lock, flags);
264 269
265 if (list->ready) { 270 if (client->ready) {
266 kill_fasync(&list->fasync, SIGIO, POLL_IN); 271 kill_fasync(&client->fasync, SIGIO, POLL_IN);
267 wake_readers = 1; 272 wake_readers = 1;
268 } 273 }
269 } 274 }
@@ -351,9 +356,9 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
351static int mousedev_fasync(int fd, struct file *file, int on) 356static int mousedev_fasync(int fd, struct file *file, int on)
352{ 357{
353 int retval; 358 int retval;
354 struct mousedev_list *list = file->private_data; 359 struct mousedev_client *client = file->private_data;
355 360
356 retval = fasync_helper(fd, file, on, &list->fasync); 361 retval = fasync_helper(fd, file, on, &client->fasync);
357 362
358 return retval < 0 ? retval : 0; 363 return retval < 0 ? retval : 0;
359} 364}
@@ -364,50 +369,95 @@ static void mousedev_free(struct mousedev *mousedev)
364 kfree(mousedev); 369 kfree(mousedev);
365} 370}
366 371
367static void mixdev_release(void) 372static int mixdev_add_device(struct mousedev *mousedev)
368{ 373{
369 struct input_handle *handle; 374 int error;
370 375
371 list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { 376 if (mousedev_mix.open) {
372 struct mousedev *mousedev = handle->private; 377 error = input_open_device(&mousedev->handle);
378 if (error)
379 return error;
373 380
374 if (!mousedev->open) { 381 mousedev->open++;
375 if (mousedev->exist) 382 mousedev->mixdev_open++;
376 input_close_device(&mousedev->handle); 383 }
377 else 384
378 mousedev_free(mousedev); 385 list_add_tail(&mousedev->mixdev_node, &mousedev_mix_list);
386
387 return 0;
388}
389
390static void mixdev_remove_device(struct mousedev *mousedev)
391{
392 if (mousedev->mixdev_open) {
393 mousedev->mixdev_open = 0;
394 if (!--mousedev->open && mousedev->exist)
395 input_close_device(&mousedev->handle);
396 }
397
398 list_del_init(&mousedev->mixdev_node);
399}
400
401static void mixdev_open_devices(void)
402{
403 struct mousedev *mousedev;
404
405 list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
406 if (mousedev->exist && !mousedev->open) {
407 if (input_open_device(&mousedev->handle))
408 continue;
409
410 mousedev->open++;
411 mousedev->mixdev_open++;
412 }
413 }
414}
415
416static void mixdev_close_devices(void)
417{
418 struct mousedev *mousedev, *next;
419
420 list_for_each_entry_safe(mousedev, next, &mousedev_mix_list, mixdev_node) {
421 if (mousedev->mixdev_open) {
422 mousedev->mixdev_open = 0;
423 if (!--mousedev->open) {
424 if (mousedev->exist)
425 input_close_device(&mousedev->handle);
426 else
427 mousedev_free(mousedev);
428 }
379 } 429 }
380 } 430 }
381} 431}
382 432
383static int mousedev_release(struct inode * inode, struct file * file) 433static int mousedev_release(struct inode *inode, struct file *file)
384{ 434{
385 struct mousedev_list *list = file->private_data; 435 struct mousedev_client *client = file->private_data;
436 struct mousedev *mousedev = client->mousedev;
386 437
387 mousedev_fasync(-1, file, 0); 438 mousedev_fasync(-1, file, 0);
388 439
389 list_del(&list->node); 440 list_del(&client->node);
441 kfree(client);
390 442
391 if (!--list->mousedev->open) { 443 if (!--mousedev->open) {
392 if (list->mousedev->minor == MOUSEDEV_MIX) 444 if (mousedev->minor == MOUSEDEV_MIX)
393 mixdev_release(); 445 mixdev_close_devices();
394 else if (!mousedev_mix.open) { 446 else if (mousedev->exist)
395 if (list->mousedev->exist) 447 input_close_device(&mousedev->handle);
396 input_close_device(&list->mousedev->handle); 448 else
397 else 449 mousedev_free(mousedev);
398 mousedev_free(list->mousedev);
399 }
400 } 450 }
401 451
402 kfree(list);
403 return 0; 452 return 0;
404} 453}
405 454
406static int mousedev_open(struct inode * inode, struct file * file) 455
456static int mousedev_open(struct inode *inode, struct file *file)
407{ 457{
408 struct mousedev_list *list; 458 struct mousedev_client *client;
409 struct input_handle *handle;
410 struct mousedev *mousedev; 459 struct mousedev *mousedev;
460 int error;
411 int i; 461 int i;
412 462
413#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX 463#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
@@ -417,31 +467,37 @@ static int mousedev_open(struct inode * inode, struct file * file)
417#endif 467#endif
418 i = iminor(inode) - MOUSEDEV_MINOR_BASE; 468 i = iminor(inode) - MOUSEDEV_MINOR_BASE;
419 469
420 if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) 470 if (i >= MOUSEDEV_MINORS)
471 return -ENODEV;
472
473 mousedev = mousedev_table[i];
474 if (!mousedev)
421 return -ENODEV; 475 return -ENODEV;
422 476
423 if (!(list = kzalloc(sizeof(struct mousedev_list), GFP_KERNEL))) 477 client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
478 if (!client)
424 return -ENOMEM; 479 return -ENOMEM;
425 480
426 spin_lock_init(&list->packet_lock); 481 spin_lock_init(&client->packet_lock);
427 list->pos_x = xres / 2; 482 client->pos_x = xres / 2;
428 list->pos_y = yres / 2; 483 client->pos_y = yres / 2;
429 list->mousedev = mousedev_table[i]; 484 client->mousedev = mousedev;
430 list_add_tail(&list->node, &mousedev_table[i]->list); 485 list_add_tail(&client->node, &mousedev->client_list);
431 file->private_data = list; 486
432 487 if (!mousedev->open++) {
433 if (!list->mousedev->open++) { 488 if (mousedev->minor == MOUSEDEV_MIX)
434 if (list->mousedev->minor == MOUSEDEV_MIX) { 489 mixdev_open_devices();
435 list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { 490 else if (mousedev->exist) {
436 mousedev = handle->private; 491 error = input_open_device(&mousedev->handle);
437 if (!mousedev->open && mousedev->exist) 492 if (error) {
438 input_open_device(handle); 493 list_del(&client->node);
494 kfree(client);
495 return error;
439 } 496 }
440 } else 497 }
441 if (!mousedev_mix.open && list->mousedev->exist)
442 input_open_device(&list->mousedev->handle);
443 } 498 }
444 499
500 file->private_data = client;
445 return 0; 501 return 0;
446} 502}
447 503
@@ -450,13 +506,13 @@ static inline int mousedev_limit_delta(int delta, int limit)
450 return delta > limit ? limit : (delta < -limit ? -limit : delta); 506 return delta > limit ? limit : (delta < -limit ? -limit : delta);
451} 507}
452 508
453static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) 509static void mousedev_packet(struct mousedev_client *client, signed char *ps2_data)
454{ 510{
455 struct mousedev_motion *p; 511 struct mousedev_motion *p;
456 unsigned long flags; 512 unsigned long flags;
457 513
458 spin_lock_irqsave(&list->packet_lock, flags); 514 spin_lock_irqsave(&client->packet_lock, flags);
459 p = &list->packets[list->tail]; 515 p = &client->packets[client->tail];
460 516
461 ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); 517 ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07);
462 ps2_data[1] = mousedev_limit_delta(p->dx, 127); 518 ps2_data[1] = mousedev_limit_delta(p->dx, 127);
@@ -464,44 +520,44 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data)
464 p->dx -= ps2_data[1]; 520 p->dx -= ps2_data[1];
465 p->dy -= ps2_data[2]; 521 p->dy -= ps2_data[2];
466 522
467 switch (list->mode) { 523 switch (client->mode) {
468 case MOUSEDEV_EMUL_EXPS: 524 case MOUSEDEV_EMUL_EXPS:
469 ps2_data[3] = mousedev_limit_delta(p->dz, 7); 525 ps2_data[3] = mousedev_limit_delta(p->dz, 7);
470 p->dz -= ps2_data[3]; 526 p->dz -= ps2_data[3];
471 ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); 527 ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1);
472 list->bufsiz = 4; 528 client->bufsiz = 4;
473 break; 529 break;
474 530
475 case MOUSEDEV_EMUL_IMPS: 531 case MOUSEDEV_EMUL_IMPS:
476 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); 532 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1);
477 ps2_data[3] = mousedev_limit_delta(p->dz, 127); 533 ps2_data[3] = mousedev_limit_delta(p->dz, 127);
478 p->dz -= ps2_data[3]; 534 p->dz -= ps2_data[3];
479 list->bufsiz = 4; 535 client->bufsiz = 4;
480 break; 536 break;
481 537
482 case MOUSEDEV_EMUL_PS2: 538 case MOUSEDEV_EMUL_PS2:
483 default: 539 default:
484 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); 540 ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1);
485 p->dz = 0; 541 p->dz = 0;
486 list->bufsiz = 3; 542 client->bufsiz = 3;
487 break; 543 break;
488 } 544 }
489 545
490 if (!p->dx && !p->dy && !p->dz) { 546 if (!p->dx && !p->dy && !p->dz) {
491 if (list->tail == list->head) { 547 if (client->tail == client->head) {
492 list->ready = 0; 548 client->ready = 0;
493 list->last_buttons = p->buttons; 549 client->last_buttons = p->buttons;
494 } else 550 } else
495 list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; 551 client->tail = (client->tail + 1) % PACKET_QUEUE_LEN;
496 } 552 }
497 553
498 spin_unlock_irqrestore(&list->packet_lock, flags); 554 spin_unlock_irqrestore(&client->packet_lock, flags);
499} 555}
500 556
501 557
502static ssize_t mousedev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) 558static ssize_t mousedev_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
503{ 559{
504 struct mousedev_list *list = file->private_data; 560 struct mousedev_client *client = file->private_data;
505 unsigned char c; 561 unsigned char c;
506 unsigned int i; 562 unsigned int i;
507 563
@@ -510,95 +566,95 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si
510 if (get_user(c, buffer + i)) 566 if (get_user(c, buffer + i))
511 return -EFAULT; 567 return -EFAULT;
512 568
513 if (c == mousedev_imex_seq[list->imexseq]) { 569 if (c == mousedev_imex_seq[client->imexseq]) {
514 if (++list->imexseq == MOUSEDEV_SEQ_LEN) { 570 if (++client->imexseq == MOUSEDEV_SEQ_LEN) {
515 list->imexseq = 0; 571 client->imexseq = 0;
516 list->mode = MOUSEDEV_EMUL_EXPS; 572 client->mode = MOUSEDEV_EMUL_EXPS;
517 } 573 }
518 } else 574 } else
519 list->imexseq = 0; 575 client->imexseq = 0;
520 576
521 if (c == mousedev_imps_seq[list->impsseq]) { 577 if (c == mousedev_imps_seq[client->impsseq]) {
522 if (++list->impsseq == MOUSEDEV_SEQ_LEN) { 578 if (++client->impsseq == MOUSEDEV_SEQ_LEN) {
523 list->impsseq = 0; 579 client->impsseq = 0;
524 list->mode = MOUSEDEV_EMUL_IMPS; 580 client->mode = MOUSEDEV_EMUL_IMPS;
525 } 581 }
526 } else 582 } else
527 list->impsseq = 0; 583 client->impsseq = 0;
528 584
529 list->ps2[0] = 0xfa; 585 client->ps2[0] = 0xfa;
530 586
531 switch (c) { 587 switch (c) {
532 588
533 case 0xeb: /* Poll */ 589 case 0xeb: /* Poll */
534 mousedev_packet(list, &list->ps2[1]); 590 mousedev_packet(client, &client->ps2[1]);
535 list->bufsiz++; /* account for leading ACK */ 591 client->bufsiz++; /* account for leading ACK */
536 break; 592 break;
537 593
538 case 0xf2: /* Get ID */ 594 case 0xf2: /* Get ID */
539 switch (list->mode) { 595 switch (client->mode) {
540 case MOUSEDEV_EMUL_PS2: list->ps2[1] = 0; break; 596 case MOUSEDEV_EMUL_PS2: client->ps2[1] = 0; break;
541 case MOUSEDEV_EMUL_IMPS: list->ps2[1] = 3; break; 597 case MOUSEDEV_EMUL_IMPS: client->ps2[1] = 3; break;
542 case MOUSEDEV_EMUL_EXPS: list->ps2[1] = 4; break; 598 case MOUSEDEV_EMUL_EXPS: client->ps2[1] = 4; break;
543 } 599 }
544 list->bufsiz = 2; 600 client->bufsiz = 2;
545 break; 601 break;
546 602
547 case 0xe9: /* Get info */ 603 case 0xe9: /* Get info */
548 list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200; 604 client->ps2[1] = 0x60; client->ps2[2] = 3; client->ps2[3] = 200;
549 list->bufsiz = 4; 605 client->bufsiz = 4;
550 break; 606 break;
551 607
552 case 0xff: /* Reset */ 608 case 0xff: /* Reset */
553 list->impsseq = list->imexseq = 0; 609 client->impsseq = client->imexseq = 0;
554 list->mode = MOUSEDEV_EMUL_PS2; 610 client->mode = MOUSEDEV_EMUL_PS2;
555 list->ps2[1] = 0xaa; list->ps2[2] = 0x00; 611 client->ps2[1] = 0xaa; client->ps2[2] = 0x00;
556 list->bufsiz = 3; 612 client->bufsiz = 3;
557 break; 613 break;
558 614
559 default: 615 default:
560 list->bufsiz = 1; 616 client->bufsiz = 1;
561 break; 617 break;
562 } 618 }
563 619
564 list->buffer = list->bufsiz; 620 client->buffer = client->bufsiz;
565 } 621 }
566 622
567 kill_fasync(&list->fasync, SIGIO, POLL_IN); 623 kill_fasync(&client->fasync, SIGIO, POLL_IN);
568 624
569 wake_up_interruptible(&list->mousedev->wait); 625 wake_up_interruptible(&client->mousedev->wait);
570 626
571 return count; 627 return count;
572} 628}
573 629
574static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) 630static ssize_t mousedev_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
575{ 631{
576 struct mousedev_list *list = file->private_data; 632 struct mousedev_client *client = file->private_data;
577 int retval = 0; 633 int retval = 0;
578 634
579 if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK)) 635 if (!client->ready && !client->buffer && (file->f_flags & O_NONBLOCK))
580 return -EAGAIN; 636 return -EAGAIN;
581 637
582 retval = wait_event_interruptible(list->mousedev->wait, 638 retval = wait_event_interruptible(client->mousedev->wait,
583 !list->mousedev->exist || list->ready || list->buffer); 639 !client->mousedev->exist || client->ready || client->buffer);
584 640
585 if (retval) 641 if (retval)
586 return retval; 642 return retval;
587 643
588 if (!list->mousedev->exist) 644 if (!client->mousedev->exist)
589 return -ENODEV; 645 return -ENODEV;
590 646
591 if (!list->buffer && list->ready) { 647 if (!client->buffer && client->ready) {
592 mousedev_packet(list, list->ps2); 648 mousedev_packet(client, client->ps2);
593 list->buffer = list->bufsiz; 649 client->buffer = client->bufsiz;
594 } 650 }
595 651
596 if (count > list->buffer) 652 if (count > client->buffer)
597 count = list->buffer; 653 count = client->buffer;
598 654
599 list->buffer -= count; 655 client->buffer -= count;
600 656
601 if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count)) 657 if (copy_to_user(buffer, client->ps2 + client->bufsiz - client->buffer - count, count))
602 return -EFAULT; 658 return -EFAULT;
603 659
604 return count; 660 return count;
@@ -607,11 +663,12 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co
607/* No kernel lock - fine */ 663/* No kernel lock - fine */
608static unsigned int mousedev_poll(struct file *file, poll_table *wait) 664static unsigned int mousedev_poll(struct file *file, poll_table *wait)
609{ 665{
610 struct mousedev_list *list = file->private_data; 666 struct mousedev_client *client = file->private_data;
667 struct mousedev *mousedev = client->mousedev;
611 668
612 poll_wait(file, &list->mousedev->wait, wait); 669 poll_wait(file, &mousedev->wait, wait);
613 return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | 670 return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) |
614 (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); 671 (mousedev->exist ? 0 : (POLLHUP | POLLERR));
615} 672}
616 673
617static const struct file_operations mousedev_fops = { 674static const struct file_operations mousedev_fops = {
@@ -624,23 +681,27 @@ static const struct file_operations mousedev_fops = {
624 .fasync = mousedev_fasync, 681 .fasync = mousedev_fasync,
625}; 682};
626 683
627static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, 684static int mousedev_connect(struct input_handler *handler, struct input_dev *dev,
628 const struct input_device_id *id) 685 const struct input_device_id *id)
629{ 686{
630 struct mousedev *mousedev; 687 struct mousedev *mousedev;
631 struct class_device *cdev; 688 struct class_device *cdev;
632 int minor = 0; 689 dev_t devt;
690 int minor;
691 int error;
633 692
634 for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); 693 for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++);
635 if (minor == MOUSEDEV_MINORS) { 694 if (minor == MOUSEDEV_MINORS) {
636 printk(KERN_ERR "mousedev: no more free mousedev devices\n"); 695 printk(KERN_ERR "mousedev: no more free mousedev devices\n");
637 return NULL; 696 return -ENFILE;
638 } 697 }
639 698
640 if (!(mousedev = kzalloc(sizeof(struct mousedev), GFP_KERNEL))) 699 mousedev = kzalloc(sizeof(struct mousedev), GFP_KERNEL);
641 return NULL; 700 if (!mousedev)
701 return -ENOMEM;
642 702
643 INIT_LIST_HEAD(&mousedev->list); 703 INIT_LIST_HEAD(&mousedev->client_list);
704 INIT_LIST_HEAD(&mousedev->mixdev_node);
644 init_waitqueue_head(&mousedev->wait); 705 init_waitqueue_head(&mousedev->wait);
645 706
646 mousedev->minor = minor; 707 mousedev->minor = minor;
@@ -651,42 +712,66 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru
651 mousedev->handle.private = mousedev; 712 mousedev->handle.private = mousedev;
652 sprintf(mousedev->name, "mouse%d", minor); 713 sprintf(mousedev->name, "mouse%d", minor);
653 714
654 if (mousedev_mix.open)
655 input_open_device(&mousedev->handle);
656
657 mousedev_table[minor] = mousedev; 715 mousedev_table[minor] = mousedev;
658 716
659 cdev = class_device_create(&input_class, &dev->cdev, 717 devt = MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor),
660 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), 718
661 dev->cdev.dev, mousedev->name); 719 cdev = class_device_create(&input_class, &dev->cdev, devt,
720 dev->cdev.dev, mousedev->name);
721 if (IS_ERR(cdev)) {
722 error = PTR_ERR(cdev);
723 goto err_free_mousedev;
724 }
662 725
663 /* temporary symlink to keep userspace happy */ 726 /* temporary symlink to keep userspace happy */
664 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 727 error = sysfs_create_link(&input_class.subsys.kobj,
665 mousedev->name); 728 &cdev->kobj, mousedev->name);
729 if (error)
730 goto err_cdev_destroy;
731
732 error = input_register_handle(&mousedev->handle);
733 if (error)
734 goto err_remove_link;
735
736 error = mixdev_add_device(mousedev);
737 if (error)
738 goto err_unregister_handle;
739
740 return 0;
666 741
667 return &mousedev->handle; 742 err_unregister_handle:
743 input_unregister_handle(&mousedev->handle);
744 err_remove_link:
745 sysfs_remove_link(&input_class.subsys.kobj, mousedev->name);
746 err_cdev_destroy:
747 class_device_destroy(&input_class, devt);
748 err_free_mousedev:
749 mousedev_table[minor] = NULL;
750 kfree(mousedev);
751 return error;
668} 752}
669 753
670static void mousedev_disconnect(struct input_handle *handle) 754static void mousedev_disconnect(struct input_handle *handle)
671{ 755{
672 struct mousedev *mousedev = handle->private; 756 struct mousedev *mousedev = handle->private;
673 struct mousedev_list *list; 757 struct mousedev_client *client;
674 758
675 sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); 759 input_unregister_handle(handle);
760
761 sysfs_remove_link(&input_class.subsys.kobj, mousedev->name);
676 class_device_destroy(&input_class, 762 class_device_destroy(&input_class,
677 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); 763 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
678 mousedev->exist = 0; 764 mousedev->exist = 0;
679 765
766 mixdev_remove_device(mousedev);
767
680 if (mousedev->open) { 768 if (mousedev->open) {
681 input_close_device(handle); 769 input_close_device(handle);
682 wake_up_interruptible(&mousedev->wait); 770 wake_up_interruptible(&mousedev->wait);
683 list_for_each_entry(list, &mousedev->list, node) 771 list_for_each_entry(client, &mousedev->client_list, node)
684 kill_fasync(&list->fasync, SIGIO, POLL_HUP); 772 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
685 } else { 773 } else
686 if (mousedev_mix.open)
687 input_close_device(handle);
688 mousedev_free(mousedev); 774 mousedev_free(mousedev);
689 }
690} 775}
691 776
692static const struct input_device_id mousedev_ids[] = { 777static const struct input_device_id mousedev_ids[] = {
@@ -714,7 +799,7 @@ static const struct input_device_id mousedev_ids[] = {
714 .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) }, 799 .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) },
715 }, /* A touchpad */ 800 }, /* A touchpad */
716 801
717 { }, /* Terminating entry */ 802 { }, /* Terminating entry */
718}; 803};
719 804
720MODULE_DEVICE_TABLE(input, mousedev_ids); 805MODULE_DEVICE_TABLE(input, mousedev_ids);
@@ -746,7 +831,7 @@ static int __init mousedev_init(void)
746 return error; 831 return error;
747 832
748 memset(&mousedev_mix, 0, sizeof(struct mousedev)); 833 memset(&mousedev_mix, 0, sizeof(struct mousedev));
749 INIT_LIST_HEAD(&mousedev_mix.list); 834 INIT_LIST_HEAD(&mousedev_mix.client_list);
750 init_waitqueue_head(&mousedev_mix.wait); 835 init_waitqueue_head(&mousedev_mix.wait);
751 mousedev_table[MOUSEDEV_MIX] = &mousedev_mix; 836 mousedev_table[MOUSEDEV_MIX] = &mousedev_mix;
752 mousedev_mix.exist = 1; 837 mousedev_mix.exist = 1;
diff --git a/drivers/input/power.c b/drivers/input/power.c
deleted file mode 100644
index ee82464a2fa7..000000000000
--- a/drivers/input/power.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * $Id: power.c,v 1.10 2001/09/25 09:17:15 vojtech Exp $
3 *
4 * Copyright (c) 2001 "Crazy" James Simmons
5 *
6 * Input driver Power Management.
7 *
8 * Sponsored by Transvirtual Technology.
9 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Should you need to contact me, the author, you can do so by
27 * e-mail - mail your message to <jsimmons@transvirtual.com>.
28 */
29
30#include <linux/module.h>
31#include <linux/input.h>
32#include <linux/slab.h>
33#include <linux/init.h>
34#include <linux/tty.h>
35#include <linux/delay.h>
36#include <linux/pm.h>
37
38static struct input_handler power_handler;
39
40/*
41 * Power management can't be done in a interrupt context. So we have to
42 * use keventd.
43 */
44static int suspend_button_pushed = 0;
45static void suspend_button_task_handler(void *data)
46{
47 udelay(200); /* debounce */
48 suspend_button_pushed = 0;
49}
50
51static DECLARE_WORK(suspend_button_task, suspend_button_task_handler, NULL);
52
53static void power_event(struct input_handle *handle, unsigned int type,
54 unsigned int code, int down)
55{
56 struct input_dev *dev = handle->dev;
57
58 printk("Entering power_event\n");
59
60 if (type == EV_PWR) {
61 switch (code) {
62 case KEY_SUSPEND:
63 printk("Powering down entire device\n");
64
65 if (!suspend_button_pushed) {
66 suspend_button_pushed = 1;
67 schedule_work(&suspend_button_task);
68 }
69 break;
70 case KEY_POWER:
71 /* Hum power down the machine. */
72 break;
73 default:
74 return;
75 }
76 }
77
78 if (type == EV_KEY) {
79 switch (code) {
80 case KEY_SUSPEND:
81 printk("Powering down input device\n");
82 /* This is risky. See pm.h for details. */
83 if (dev->state != PM_RESUME)
84 dev->state = PM_RESUME;
85 else
86 dev->state = PM_SUSPEND;
87 pm_send(dev->pm_dev, dev->state, dev);
88 break;
89 case KEY_POWER:
90 /* Turn the input device off completely ? */
91 break;
92 default:
93 return;
94 }
95 }
96 return;
97}
98
99static struct input_handle *power_connect(struct input_handler *handler,
100 struct input_dev *dev,
101 const struct input_device_id *id)
102{
103 struct input_handle *handle;
104
105 if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL)))
106 return NULL;
107
108 handle->dev = dev;
109 handle->handler = handler;
110
111 input_open_device(handle);
112
113 printk(KERN_INFO "power.c: Adding power management to input layer\n");
114 return handle;
115}
116
117static void power_disconnect(struct input_handle *handle)
118{
119 input_close_device(handle);
120 kfree(handle);
121}
122
123static const struct input_device_id power_ids[] = {
124 {
125 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
126 .evbit = { BIT(EV_KEY) },
127 .keybit = { [LONG(KEY_SUSPEND)] = BIT(KEY_SUSPEND) }
128 },
129 {
130 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
131 .evbit = { BIT(EV_KEY) },
132 .keybit = { [LONG(KEY_POWER)] = BIT(KEY_POWER) }
133 },
134 {
135 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
136 .evbit = { BIT(EV_PWR) },
137 },
138 { }, /* Terminating entry */
139};
140
141MODULE_DEVICE_TABLE(input, power_ids);
142
143static struct input_handler power_handler = {
144 .event = power_event,
145 .connect = power_connect,
146 .disconnect = power_disconnect,
147 .name = "power",
148 .id_table = power_ids,
149};
150
151static int __init power_init(void)
152{
153 return input_register_handler(&power_handler);
154}
155
156static void __exit power_exit(void)
157{
158 input_unregister_handler(&power_handler);
159}
160
161module_init(power_init);
162module_exit(power_exit);
163
164MODULE_AUTHOR("James Simmons <jsimmons@transvirtual.com>");
165MODULE_DESCRIPTION("Input Power Management driver");
166MODULE_LICENSE("GPL");
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 4fa93ff30919..93a1a6ba216a 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -32,11 +32,11 @@
32 * 32 *
33 * Driver theory of operation: 33 * Driver theory of operation:
34 * 34 *
35 * Some access methods and an ISR is defined by the sub-driver 35 * Some access methods and an ISR is defined by the sub-driver
36 * (e.g. hp_sdc_mlc.c). These methods are expected to provide a 36 * (e.g. hp_sdc_mlc.c). These methods are expected to provide a
37 * few bits of logic in addition to raw access to the HIL MLC, 37 * few bits of logic in addition to raw access to the HIL MLC,
38 * specifically, the ISR, which is entirely registered by the 38 * specifically, the ISR, which is entirely registered by the
39 * sub-driver and invoked directly, must check for record 39 * sub-driver and invoked directly, must check for record
40 * termination or packet match, at which point a semaphore must 40 * termination or packet match, at which point a semaphore must
41 * be cleared and then the hil_mlcs_tasklet must be scheduled. 41 * be cleared and then the hil_mlcs_tasklet must be scheduled.
42 * 42 *
@@ -47,7 +47,7 @@
47 * itself if output is pending. (This rescheduling should be replaced 47 * itself if output is pending. (This rescheduling should be replaced
48 * at some point with a sub-driver-specific mechanism.) 48 * at some point with a sub-driver-specific mechanism.)
49 * 49 *
50 * A timer task prods the tasklet once per second to prevent 50 * A timer task prods the tasklet once per second to prevent
51 * hangups when attached devices do not return expected data 51 * hangups when attached devices do not return expected data
52 * and to initiate probes of the loop for new devices. 52 * and to initiate probes of the loop for new devices.
53 */ 53 */
@@ -83,69 +83,85 @@ DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
83 83
84/********************** Device info/instance management **********************/ 84/********************** Device info/instance management **********************/
85 85
86static void hil_mlc_clear_di_map (hil_mlc *mlc, int val) { 86static void hil_mlc_clear_di_map(hil_mlc *mlc, int val)
87{
87 int j; 88 int j;
88 for (j = val; j < 7 ; j++) { 89
90 for (j = val; j < 7 ; j++)
89 mlc->di_map[j] = -1; 91 mlc->di_map[j] = -1;
90 }
91} 92}
92 93
93static void hil_mlc_clear_di_scratch (hil_mlc *mlc) { 94static void hil_mlc_clear_di_scratch(hil_mlc *mlc)
94 memset(&(mlc->di_scratch), 0, sizeof(mlc->di_scratch)); 95{
96 memset(&mlc->di_scratch, 0, sizeof(mlc->di_scratch));
95} 97}
96 98
97static void hil_mlc_copy_di_scratch (hil_mlc *mlc, int idx) { 99static void hil_mlc_copy_di_scratch(hil_mlc *mlc, int idx)
98 memcpy(&(mlc->di[idx]), &(mlc->di_scratch), sizeof(mlc->di_scratch)); 100{
101 memcpy(&mlc->di[idx], &mlc->di_scratch, sizeof(mlc->di_scratch));
99} 102}
100 103
101static int hil_mlc_match_di_scratch (hil_mlc *mlc) { 104static int hil_mlc_match_di_scratch(hil_mlc *mlc)
105{
102 int idx; 106 int idx;
103 107
104 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) { 108 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) {
105 int j, found; 109 int j, found = 0;
106 110
107 /* In-use slots are not eligible. */ 111 /* In-use slots are not eligible. */
108 found = 0; 112 for (j = 0; j < 7 ; j++)
109 for (j = 0; j < 7 ; j++) { 113 if (mlc->di_map[j] == idx)
110 if (mlc->di_map[j] == idx) found++; 114 found++;
111 } 115
112 if (found) continue; 116 if (found)
113 if (!memcmp(mlc->di + idx, 117 continue;
114 &(mlc->di_scratch), 118
115 sizeof(mlc->di_scratch))) break; 119 if (!memcmp(mlc->di + idx, &mlc->di_scratch,
120 sizeof(mlc->di_scratch)))
121 break;
116 } 122 }
117 return((idx >= HIL_MLC_DEVMEM) ? -1 : idx); 123 return idx >= HIL_MLC_DEVMEM ? -1 : idx;
118} 124}
119 125
120static int hil_mlc_find_free_di(hil_mlc *mlc) { 126static int hil_mlc_find_free_di(hil_mlc *mlc)
127{
121 int idx; 128 int idx;
122 /* TODO: Pick all-zero slots first, failing that, 129
123 * randomize the slot picked among those eligible. 130 /* TODO: Pick all-zero slots first, failing that,
131 * randomize the slot picked among those eligible.
124 */ 132 */
125 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) { 133 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) {
126 int j, found; 134 int j, found = 0;
127 found = 0; 135
128 for (j = 0; j < 7 ; j++) { 136 for (j = 0; j < 7 ; j++)
129 if (mlc->di_map[j] == idx) found++; 137 if (mlc->di_map[j] == idx)
130 } 138 found++;
131 if (!found) break; 139
140 if (!found)
141 break;
132 } 142 }
133 return(idx); /* Note: It is guaranteed at least one above will match */ 143
144 return idx; /* Note: It is guaranteed at least one above will match */
134} 145}
135 146
136static inline void hil_mlc_clean_serio_map(hil_mlc *mlc) { 147static inline void hil_mlc_clean_serio_map(hil_mlc *mlc)
148{
137 int idx; 149 int idx;
150
138 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) { 151 for (idx = 0; idx < HIL_MLC_DEVMEM; idx++) {
139 int j, found; 152 int j, found = 0;
140 found = 0; 153
141 for (j = 0; j < 7 ; j++) { 154 for (j = 0; j < 7 ; j++)
142 if (mlc->di_map[j] == idx) found++; 155 if (mlc->di_map[j] == idx)
143 } 156 found++;
144 if (!found) mlc->serio_map[idx].di_revmap = -1; 157
158 if (!found)
159 mlc->serio_map[idx].di_revmap = -1;
145 } 160 }
146} 161}
147 162
148static void hil_mlc_send_polls(hil_mlc *mlc) { 163static void hil_mlc_send_polls(hil_mlc *mlc)
164{
149 int did, i, cnt; 165 int did, i, cnt;
150 struct serio *serio; 166 struct serio *serio;
151 struct serio_driver *drv; 167 struct serio_driver *drv;
@@ -157,26 +173,31 @@ static void hil_mlc_send_polls(hil_mlc *mlc) {
157 173
158 while (mlc->icount < 15 - i) { 174 while (mlc->icount < 15 - i) {
159 hil_packet p; 175 hil_packet p;
176
160 p = mlc->ipacket[i]; 177 p = mlc->ipacket[i];
161 if (did != (p & HIL_PKT_ADDR_MASK) >> 8) { 178 if (did != (p & HIL_PKT_ADDR_MASK) >> 8) {
162 if (drv == NULL || drv->interrupt == NULL) goto skip; 179 if (drv && drv->interrupt) {
180 drv->interrupt(serio, 0, 0);
181 drv->interrupt(serio, HIL_ERR_INT >> 16, 0);
182 drv->interrupt(serio, HIL_PKT_CMD >> 8, 0);
183 drv->interrupt(serio, HIL_CMD_POL + cnt, 0);
184 }
163 185
164 drv->interrupt(serio, 0, 0);
165 drv->interrupt(serio, HIL_ERR_INT >> 16, 0);
166 drv->interrupt(serio, HIL_PKT_CMD >> 8, 0);
167 drv->interrupt(serio, HIL_CMD_POL + cnt, 0);
168 skip:
169 did = (p & HIL_PKT_ADDR_MASK) >> 8; 186 did = (p & HIL_PKT_ADDR_MASK) >> 8;
170 serio = did ? mlc->serio[mlc->di_map[did-1]] : NULL; 187 serio = did ? mlc->serio[mlc->di_map[did-1]] : NULL;
171 drv = (serio != NULL) ? serio->drv : NULL; 188 drv = (serio != NULL) ? serio->drv : NULL;
172 cnt = 0; 189 cnt = 0;
173 } 190 }
174 cnt++; i++; 191
175 if (drv == NULL || drv->interrupt == NULL) continue; 192 cnt++;
176 drv->interrupt(serio, (p >> 24), 0); 193 i++;
177 drv->interrupt(serio, (p >> 16) & 0xff, 0); 194
178 drv->interrupt(serio, (p >> 8) & ~HIL_PKT_ADDR_MASK, 0); 195 if (drv && drv->interrupt) {
179 drv->interrupt(serio, p & 0xff, 0); 196 drv->interrupt(serio, (p >> 24), 0);
197 drv->interrupt(serio, (p >> 16) & 0xff, 0);
198 drv->interrupt(serio, (p >> 8) & ~HIL_PKT_ADDR_MASK, 0);
199 drv->interrupt(serio, p & 0xff, 0);
200 }
180 } 201 }
181} 202}
182 203
@@ -215,12 +236,16 @@ static void hil_mlc_send_polls(hil_mlc *mlc) {
215#define HILSEN_DOZE (HILSEN_SAME | HILSEN_SCHED | HILSEN_BREAK) 236#define HILSEN_DOZE (HILSEN_SAME | HILSEN_SCHED | HILSEN_BREAK)
216#define HILSEN_SLEEP (HILSEN_SAME | HILSEN_BREAK) 237#define HILSEN_SLEEP (HILSEN_SAME | HILSEN_BREAK)
217 238
218static int hilse_match(hil_mlc *mlc, int unused) { 239static int hilse_match(hil_mlc *mlc, int unused)
240{
219 int rc; 241 int rc;
242
220 rc = hil_mlc_match_di_scratch(mlc); 243 rc = hil_mlc_match_di_scratch(mlc);
221 if (rc == -1) { 244 if (rc == -1) {
222 rc = hil_mlc_find_free_di(mlc); 245 rc = hil_mlc_find_free_di(mlc);
223 if (rc == -1) goto err; 246 if (rc == -1)
247 goto err;
248
224#ifdef HIL_MLC_DEBUG 249#ifdef HIL_MLC_DEBUG
225 printk(KERN_DEBUG PREFIX "new in slot %i\n", rc); 250 printk(KERN_DEBUG PREFIX "new in slot %i\n", rc);
226#endif 251#endif
@@ -231,6 +256,7 @@ static int hilse_match(hil_mlc *mlc, int unused) {
231 serio_rescan(mlc->serio[rc]); 256 serio_rescan(mlc->serio[rc]);
232 return -1; 257 return -1;
233 } 258 }
259
234 mlc->di_map[mlc->ddi] = rc; 260 mlc->di_map[mlc->ddi] = rc;
235#ifdef HIL_MLC_DEBUG 261#ifdef HIL_MLC_DEBUG
236 printk(KERN_DEBUG PREFIX "same in slot %i\n", rc); 262 printk(KERN_DEBUG PREFIX "same in slot %i\n", rc);
@@ -238,152 +264,177 @@ static int hilse_match(hil_mlc *mlc, int unused) {
238 mlc->serio_map[rc].di_revmap = mlc->ddi; 264 mlc->serio_map[rc].di_revmap = mlc->ddi;
239 hil_mlc_clean_serio_map(mlc); 265 hil_mlc_clean_serio_map(mlc);
240 return 0; 266 return 0;
267
241 err: 268 err:
242 printk(KERN_ERR PREFIX "Residual device slots exhausted, close some serios!\n"); 269 printk(KERN_ERR PREFIX "Residual device slots exhausted, close some serios!\n");
243 return 1; 270 return 1;
244} 271}
245 272
246/* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */ 273/* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */
247static int hilse_init_lcv(hil_mlc *mlc, int unused) { 274static int hilse_init_lcv(hil_mlc *mlc, int unused)
275{
248 struct timeval tv; 276 struct timeval tv;
249 277
250 do_gettimeofday(&tv); 278 do_gettimeofday(&tv);
251 279
252 if(mlc->lcv == 0) goto restart; /* First init, no need to dally */ 280 if (mlc->lcv && (tv.tv_sec - mlc->lcv_tv.tv_sec) < 5)
253 if(tv.tv_sec - mlc->lcv_tv.tv_sec < 5) return -1; 281 return -1;
254 restart: 282
255 mlc->lcv_tv = tv; 283 mlc->lcv_tv = tv;
256 mlc->lcv = 0; 284 mlc->lcv = 0;
285
257 return 0; 286 return 0;
258} 287}
259 288
260static int hilse_inc_lcv(hil_mlc *mlc, int lim) { 289static int hilse_inc_lcv(hil_mlc *mlc, int lim)
261 if (mlc->lcv++ >= lim) return -1; 290{
262 return 0; 291 return mlc->lcv++ >= lim ? -1 : 0;
263} 292}
264 293
265#if 0 294#if 0
266static int hilse_set_lcv(hil_mlc *mlc, int val) { 295static int hilse_set_lcv(hil_mlc *mlc, int val)
296{
267 mlc->lcv = val; 297 mlc->lcv = val;
298
268 return 0; 299 return 0;
269} 300}
270#endif 301#endif
271 302
272/* Management of the discovered device index (zero based, -1 means no devs) */ 303/* Management of the discovered device index (zero based, -1 means no devs) */
273static int hilse_set_ddi(hil_mlc *mlc, int val) { 304static int hilse_set_ddi(hil_mlc *mlc, int val)
305{
274 mlc->ddi = val; 306 mlc->ddi = val;
275 hil_mlc_clear_di_map(mlc, val + 1); 307 hil_mlc_clear_di_map(mlc, val + 1);
308
276 return 0; 309 return 0;
277} 310}
278 311
279static int hilse_dec_ddi(hil_mlc *mlc, int unused) { 312static int hilse_dec_ddi(hil_mlc *mlc, int unused)
313{
280 mlc->ddi--; 314 mlc->ddi--;
281 if (mlc->ddi <= -1) { 315 if (mlc->ddi <= -1) {
282 mlc->ddi = -1; 316 mlc->ddi = -1;
283 hil_mlc_clear_di_map(mlc, 0); 317 hil_mlc_clear_di_map(mlc, 0);
284 return -1; 318 return -1;
285 } 319 }
286 hil_mlc_clear_di_map(mlc, mlc->ddi + 1); 320 hil_mlc_clear_di_map(mlc, mlc->ddi + 1);
321
287 return 0; 322 return 0;
288} 323}
289 324
290static int hilse_inc_ddi(hil_mlc *mlc, int unused) { 325static int hilse_inc_ddi(hil_mlc *mlc, int unused)
291 if (mlc->ddi >= 6) { 326{
292 BUG(); 327 BUG_ON(mlc->ddi >= 6);
293 return -1;
294 }
295 mlc->ddi++; 328 mlc->ddi++;
329
296 return 0; 330 return 0;
297} 331}
298 332
299static int hilse_take_idd(hil_mlc *mlc, int unused) { 333static int hilse_take_idd(hil_mlc *mlc, int unused)
334{
300 int i; 335 int i;
301 336
302 /* Help the state engine: 337 /* Help the state engine:
303 * Is this a real IDD response or just an echo? 338 * Is this a real IDD response or just an echo?
304 * 339 *
305 * Real IDD response does not start with a command. 340 * Real IDD response does not start with a command.
306 */ 341 */
307 if (mlc->ipacket[0] & HIL_PKT_CMD) goto bail; 342 if (mlc->ipacket[0] & HIL_PKT_CMD)
343 goto bail;
344
308 /* Should have the command echoed further down. */ 345 /* Should have the command echoed further down. */
309 for (i = 1; i < 16; i++) { 346 for (i = 1; i < 16; i++) {
310 if (((mlc->ipacket[i] & HIL_PKT_ADDR_MASK) == 347 if (((mlc->ipacket[i] & HIL_PKT_ADDR_MASK) ==
311 (mlc->ipacket[0] & HIL_PKT_ADDR_MASK)) && 348 (mlc->ipacket[0] & HIL_PKT_ADDR_MASK)) &&
312 (mlc->ipacket[i] & HIL_PKT_CMD) && 349 (mlc->ipacket[i] & HIL_PKT_CMD) &&
313 ((mlc->ipacket[i] & HIL_PKT_DATA_MASK) == HIL_CMD_IDD)) 350 ((mlc->ipacket[i] & HIL_PKT_DATA_MASK) == HIL_CMD_IDD))
314 break; 351 break;
315 } 352 }
316 if (i > 15) goto bail; 353 if (i > 15)
354 goto bail;
355
317 /* And the rest of the packets should still be clear. */ 356 /* And the rest of the packets should still be clear. */
318 while (++i < 16) { 357 while (++i < 16)
319 if (mlc->ipacket[i]) break; 358 if (mlc->ipacket[i])
320 } 359 break;
321 if (i < 16) goto bail; 360
322 for (i = 0; i < 16; i++) { 361 if (i < 16)
323 mlc->di_scratch.idd[i] = 362 goto bail;
363
364 for (i = 0; i < 16; i++)
365 mlc->di_scratch.idd[i] =
324 mlc->ipacket[i] & HIL_PKT_DATA_MASK; 366 mlc->ipacket[i] & HIL_PKT_DATA_MASK;
325 } 367
326 /* Next step is to see if RSC supported */ 368 /* Next step is to see if RSC supported */
327 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_RSC) 369 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_RSC)
328 return HILSEN_NEXT; 370 return HILSEN_NEXT;
329 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_EXD) 371
372 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_EXD)
330 return HILSEN_DOWN | 4; 373 return HILSEN_DOWN | 4;
374
331 return 0; 375 return 0;
376
332 bail: 377 bail:
333 mlc->ddi--; 378 mlc->ddi--;
379
334 return -1; /* This should send us off to ACF */ 380 return -1; /* This should send us off to ACF */
335} 381}
336 382
337static int hilse_take_rsc(hil_mlc *mlc, int unused) { 383static int hilse_take_rsc(hil_mlc *mlc, int unused)
384{
338 int i; 385 int i;
339 386
340 for (i = 0; i < 16; i++) { 387 for (i = 0; i < 16; i++)
341 mlc->di_scratch.rsc[i] = 388 mlc->di_scratch.rsc[i] =
342 mlc->ipacket[i] & HIL_PKT_DATA_MASK; 389 mlc->ipacket[i] & HIL_PKT_DATA_MASK;
343 } 390
344 /* Next step is to see if EXD supported (IDD has already been read) */ 391 /* Next step is to see if EXD supported (IDD has already been read) */
345 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_EXD) 392 if (mlc->di_scratch.idd[1] & HIL_IDD_HEADER_EXD)
346 return HILSEN_NEXT; 393 return HILSEN_NEXT;
394
347 return 0; 395 return 0;
348} 396}
349 397
350static int hilse_take_exd(hil_mlc *mlc, int unused) { 398static int hilse_take_exd(hil_mlc *mlc, int unused)
399{
351 int i; 400 int i;
352 401
353 for (i = 0; i < 16; i++) { 402 for (i = 0; i < 16; i++)
354 mlc->di_scratch.exd[i] = 403 mlc->di_scratch.exd[i] =
355 mlc->ipacket[i] & HIL_PKT_DATA_MASK; 404 mlc->ipacket[i] & HIL_PKT_DATA_MASK;
356 } 405
357 /* Next step is to see if RNM supported. */ 406 /* Next step is to see if RNM supported. */
358 if (mlc->di_scratch.exd[0] & HIL_EXD_HEADER_RNM) 407 if (mlc->di_scratch.exd[0] & HIL_EXD_HEADER_RNM)
359 return HILSEN_NEXT; 408 return HILSEN_NEXT;
409
360 return 0; 410 return 0;
361} 411}
362 412
363static int hilse_take_rnm(hil_mlc *mlc, int unused) { 413static int hilse_take_rnm(hil_mlc *mlc, int unused)
414{
364 int i; 415 int i;
365 416
366 for (i = 0; i < 16; i++) { 417 for (i = 0; i < 16; i++)
367 mlc->di_scratch.rnm[i] = 418 mlc->di_scratch.rnm[i] =
368 mlc->ipacket[i] & HIL_PKT_DATA_MASK; 419 mlc->ipacket[i] & HIL_PKT_DATA_MASK;
369 } 420
370 do { 421 printk(KERN_INFO PREFIX "Device name gotten: %16s\n",
371 char nam[17]; 422 mlc->di_scratch.rnm);
372 snprintf(nam, 16, "%s", mlc->di_scratch.rnm); 423
373 nam[16] = '\0';
374 printk(KERN_INFO PREFIX "Device name gotten: %s\n", nam);
375 } while (0);
376 return 0; 424 return 0;
377} 425}
378 426
379static int hilse_operate(hil_mlc *mlc, int repoll) { 427static int hilse_operate(hil_mlc *mlc, int repoll)
428{
380 429
381 if (mlc->opercnt == 0) hil_mlcs_probe = 0; 430 if (mlc->opercnt == 0)
431 hil_mlcs_probe = 0;
382 mlc->opercnt = 1; 432 mlc->opercnt = 1;
383 433
384 hil_mlc_send_polls(mlc); 434 hil_mlc_send_polls(mlc);
385 435
386 if (!hil_mlcs_probe) return 0; 436 if (!hil_mlcs_probe)
437 return 0;
387 hil_mlcs_probe = 0; 438 hil_mlcs_probe = 0;
388 mlc->opercnt = 0; 439 mlc->opercnt = 0;
389 return 1; 440 return 1;
@@ -408,7 +459,7 @@ static int hilse_operate(hil_mlc *mlc, int repoll) {
408#define OUT_LAST(pack) \ 459#define OUT_LAST(pack) \
409{ HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, 460{ HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 },
410 461
411struct hilse_node hil_mlc_se[HILSEN_END] = { 462const struct hilse_node hil_mlc_se[HILSEN_END] = {
412 463
413 /* 0 HILSEN_START */ 464 /* 0 HILSEN_START */
414 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) 465 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0)
@@ -428,7 +479,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
428 EXPECT(HIL_ERR_INT | TEST_PACKET(0xa), 479 EXPECT(HIL_ERR_INT | TEST_PACKET(0xa),
429 2000, HILSEN_NEXT, HILSEN_RESTART, HILSEN_RESTART) 480 2000, HILSEN_NEXT, HILSEN_RESTART, HILSEN_RESTART)
430 OUT(HIL_CTRL_ONLY | 0) /* Disable test mode */ 481 OUT(HIL_CTRL_ONLY | 0) /* Disable test mode */
431 482
432 /* 9 HILSEN_DHR */ 483 /* 9 HILSEN_DHR */
433 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) 484 FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0)
434 485
@@ -439,7 +490,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
439 IN(300000, HILSEN_DHR2, HILSEN_DHR2, HILSEN_NEXT) 490 IN(300000, HILSEN_DHR2, HILSEN_DHR2, HILSEN_NEXT)
440 491
441 /* 14 HILSEN_IFC */ 492 /* 14 HILSEN_IFC */
442 OUT(HIL_PKT_CMD | HIL_CMD_IFC) 493 OUT(HIL_PKT_CMD | HIL_CMD_IFC)
443 EXPECT(HIL_PKT_CMD | HIL_CMD_IFC | HIL_ERR_INT, 494 EXPECT(HIL_PKT_CMD | HIL_CMD_IFC | HIL_ERR_INT,
444 20000, HILSEN_DISC, HILSEN_DHR2, HILSEN_NEXT ) 495 20000, HILSEN_DISC, HILSEN_DHR2, HILSEN_NEXT )
445 496
@@ -455,7 +506,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
455 506
456 /* 18 HILSEN_HEAL */ 507 /* 18 HILSEN_HEAL */
457 OUT_LAST(HIL_CMD_ELB) 508 OUT_LAST(HIL_CMD_ELB)
458 EXPECT_LAST(HIL_CMD_ELB | HIL_ERR_INT, 509 EXPECT_LAST(HIL_CMD_ELB | HIL_ERR_INT,
459 20000, HILSEN_REPOLL, HILSEN_DSR, HILSEN_NEXT) 510 20000, HILSEN_REPOLL, HILSEN_DSR, HILSEN_NEXT)
460 FUNC(hilse_dec_ddi, 0, HILSEN_HEAL, HILSEN_NEXT, 0) 511 FUNC(hilse_dec_ddi, 0, HILSEN_HEAL, HILSEN_NEXT, 0)
461 512
@@ -503,7 +554,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
503 554
504 /* 44 HILSEN_PROBE */ 555 /* 44 HILSEN_PROBE */
505 OUT_LAST(HIL_PKT_CMD | HIL_CMD_EPT) 556 OUT_LAST(HIL_PKT_CMD | HIL_CMD_EPT)
506 IN(10000, HILSEN_DISC, HILSEN_DSR, HILSEN_NEXT) 557 IN(10000, HILSEN_DISC, HILSEN_DSR, HILSEN_NEXT)
507 OUT_DISC(HIL_PKT_CMD | HIL_CMD_ELB) 558 OUT_DISC(HIL_PKT_CMD | HIL_CMD_ELB)
508 IN(10000, HILSEN_DISC, HILSEN_DSR, HILSEN_NEXT) 559 IN(10000, HILSEN_DISC, HILSEN_DSR, HILSEN_NEXT)
509 OUT(HIL_PKT_CMD | HIL_CMD_ACF | 1) 560 OUT(HIL_PKT_CMD | HIL_CMD_ACF | 1)
@@ -514,7 +565,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
514 /* 52 HILSEN_DSR */ 565 /* 52 HILSEN_DSR */
515 FUNC(hilse_set_ddi, -1, HILSEN_NEXT, 0, 0) 566 FUNC(hilse_set_ddi, -1, HILSEN_NEXT, 0, 0)
516 OUT(HIL_PKT_CMD | HIL_CMD_DSR) 567 OUT(HIL_PKT_CMD | HIL_CMD_DSR)
517 IN(20000, HILSEN_DHR, HILSEN_DHR, HILSEN_IFC) 568 IN(20000, HILSEN_DHR, HILSEN_DHR, HILSEN_IFC)
518 569
519 /* 55 HILSEN_REPOLL */ 570 /* 55 HILSEN_REPOLL */
520 OUT(HIL_PKT_CMD | HIL_CMD_RPL) 571 OUT(HIL_PKT_CMD | HIL_CMD_RPL)
@@ -523,14 +574,15 @@ struct hilse_node hil_mlc_se[HILSEN_END] = {
523 FUNC(hilse_operate, 1, HILSEN_OPERATE, HILSEN_IFC, HILSEN_PROBE) 574 FUNC(hilse_operate, 1, HILSEN_OPERATE, HILSEN_IFC, HILSEN_PROBE)
524 575
525 /* 58 HILSEN_IFCACF */ 576 /* 58 HILSEN_IFCACF */
526 OUT(HIL_PKT_CMD | HIL_CMD_IFC) 577 OUT(HIL_PKT_CMD | HIL_CMD_IFC)
527 EXPECT(HIL_PKT_CMD | HIL_CMD_IFC | HIL_ERR_INT, 578 EXPECT(HIL_PKT_CMD | HIL_CMD_IFC | HIL_ERR_INT,
528 20000, HILSEN_ACF2, HILSEN_DHR2, HILSEN_HEAL) 579 20000, HILSEN_ACF2, HILSEN_DHR2, HILSEN_HEAL)
529 580
530 /* 60 HILSEN_END */ 581 /* 60 HILSEN_END */
531}; 582};
532 583
533static inline void hilse_setup_input(hil_mlc *mlc, struct hilse_node *node) { 584static inline void hilse_setup_input(hil_mlc *mlc, const struct hilse_node *node)
585{
534 586
535 switch (node->act) { 587 switch (node->act) {
536 case HILSE_EXPECT_DISC: 588 case HILSE_EXPECT_DISC:
@@ -555,29 +607,27 @@ static inline void hilse_setup_input(hil_mlc *mlc, struct hilse_node *node) {
555 do_gettimeofday(&(mlc->instart)); 607 do_gettimeofday(&(mlc->instart));
556 mlc->icount = 15; 608 mlc->icount = 15;
557 memset(mlc->ipacket, 0, 16 * sizeof(hil_packet)); 609 memset(mlc->ipacket, 0, 16 * sizeof(hil_packet));
558 BUG_ON(down_trylock(&(mlc->isem))); 610 BUG_ON(down_trylock(&mlc->isem));
559
560 return;
561} 611}
562 612
563#ifdef HIL_MLC_DEBUG 613#ifdef HIL_MLC_DEBUG
564static int doze = 0; 614static int doze;
565static int seidx; /* For debug */ 615static int seidx; /* For debug */
566static int kick = 1;
567#endif 616#endif
568 617
569static int hilse_donode (hil_mlc *mlc) { 618static int hilse_donode(hil_mlc *mlc)
570 struct hilse_node *node; 619{
620 const struct hilse_node *node;
571 int nextidx = 0; 621 int nextidx = 0;
572 int sched_long = 0; 622 int sched_long = 0;
573 unsigned long flags; 623 unsigned long flags;
574 624
575#ifdef HIL_MLC_DEBUG 625#ifdef HIL_MLC_DEBUG
576 if (mlc->seidx && (mlc->seidx != seidx) && mlc->seidx != 41 && mlc->seidx != 42 && mlc->seidx != 43) { 626 if (mlc->seidx && mlc->seidx != seidx &&
577 printk(KERN_DEBUG PREFIX "z%i \n%s {%i}", doze, kick ? "K" : "", mlc->seidx); 627 mlc->seidx != 41 && mlc->seidx != 42 && mlc->seidx != 43) {
628 printk(KERN_DEBUG PREFIX "z%i \n {%i}", doze, mlc->seidx);
578 doze = 0; 629 doze = 0;
579 } 630 }
580 kick = 0;
581 631
582 seidx = mlc->seidx; 632 seidx = mlc->seidx;
583#endif 633#endif
@@ -588,52 +638,61 @@ static int hilse_donode (hil_mlc *mlc) {
588 hil_packet pack; 638 hil_packet pack;
589 639
590 case HILSE_FUNC: 640 case HILSE_FUNC:
591 if (node->object.func == NULL) break; 641 BUG_ON(node->object.func == NULL);
592 rc = node->object.func(mlc, node->arg); 642 rc = node->object.func(mlc, node->arg);
593 nextidx = (rc > 0) ? node->ugly : 643 nextidx = (rc > 0) ? node->ugly :
594 ((rc < 0) ? node->bad : node->good); 644 ((rc < 0) ? node->bad : node->good);
595 if (nextidx == HILSEN_FOLLOW) nextidx = rc; 645 if (nextidx == HILSEN_FOLLOW)
646 nextidx = rc;
596 break; 647 break;
648
597 case HILSE_EXPECT_LAST: 649 case HILSE_EXPECT_LAST:
598 case HILSE_EXPECT_DISC: 650 case HILSE_EXPECT_DISC:
599 case HILSE_EXPECT: 651 case HILSE_EXPECT:
600 case HILSE_IN: 652 case HILSE_IN:
601 /* Already set up from previous HILSE_OUT_* */ 653 /* Already set up from previous HILSE_OUT_* */
602 write_lock_irqsave(&(mlc->lock), flags); 654 write_lock_irqsave(&mlc->lock, flags);
603 rc = mlc->in(mlc, node->arg); 655 rc = mlc->in(mlc, node->arg);
604 if (rc == 2) { 656 if (rc == 2) {
605 nextidx = HILSEN_DOZE; 657 nextidx = HILSEN_DOZE;
606 sched_long = 1; 658 sched_long = 1;
607 write_unlock_irqrestore(&(mlc->lock), flags); 659 write_unlock_irqrestore(&mlc->lock, flags);
608 break; 660 break;
609 } 661 }
610 if (rc == 1) nextidx = node->ugly; 662 if (rc == 1)
611 else if (rc == 0) nextidx = node->good; 663 nextidx = node->ugly;
612 else nextidx = node->bad; 664 else if (rc == 0)
665 nextidx = node->good;
666 else
667 nextidx = node->bad;
613 mlc->istarted = 0; 668 mlc->istarted = 0;
614 write_unlock_irqrestore(&(mlc->lock), flags); 669 write_unlock_irqrestore(&mlc->lock, flags);
615 break; 670 break;
671
616 case HILSE_OUT_LAST: 672 case HILSE_OUT_LAST:
617 write_lock_irqsave(&(mlc->lock), flags); 673 write_lock_irqsave(&mlc->lock, flags);
618 pack = node->object.packet; 674 pack = node->object.packet;
619 pack |= ((mlc->ddi + 1) << HIL_PKT_ADDR_SHIFT); 675 pack |= ((mlc->ddi + 1) << HIL_PKT_ADDR_SHIFT);
620 goto out; 676 goto out;
677
621 case HILSE_OUT_DISC: 678 case HILSE_OUT_DISC:
622 write_lock_irqsave(&(mlc->lock), flags); 679 write_lock_irqsave(&mlc->lock, flags);
623 pack = node->object.packet; 680 pack = node->object.packet;
624 pack |= ((mlc->ddi + 2) << HIL_PKT_ADDR_SHIFT); 681 pack |= ((mlc->ddi + 2) << HIL_PKT_ADDR_SHIFT);
625 goto out; 682 goto out;
683
626 case HILSE_OUT: 684 case HILSE_OUT:
627 write_lock_irqsave(&(mlc->lock), flags); 685 write_lock_irqsave(&mlc->lock, flags);
628 pack = node->object.packet; 686 pack = node->object.packet;
629 out: 687 out:
630 if (mlc->istarted) goto out2; 688 if (mlc->istarted)
689 goto out2;
631 /* Prepare to receive input */ 690 /* Prepare to receive input */
632 if ((node + 1)->act & HILSE_IN) 691 if ((node + 1)->act & HILSE_IN)
633 hilse_setup_input(mlc, node + 1); 692 hilse_setup_input(mlc, node + 1);
634 693
635 out2: 694 out2:
636 write_unlock_irqrestore(&(mlc->lock), flags); 695 write_unlock_irqrestore(&mlc->lock, flags);
637 696
638 if (down_trylock(&mlc->osem)) { 697 if (down_trylock(&mlc->osem)) {
639 nextidx = HILSEN_DOZE; 698 nextidx = HILSEN_DOZE;
@@ -641,60 +700,71 @@ static int hilse_donode (hil_mlc *mlc) {
641 } 700 }
642 up(&mlc->osem); 701 up(&mlc->osem);
643 702
644 write_lock_irqsave(&(mlc->lock), flags); 703 write_lock_irqsave(&mlc->lock, flags);
645 if (!(mlc->ostarted)) { 704 if (!mlc->ostarted) {
646 mlc->ostarted = 1; 705 mlc->ostarted = 1;
647 mlc->opacket = pack; 706 mlc->opacket = pack;
648 mlc->out(mlc); 707 mlc->out(mlc);
649 nextidx = HILSEN_DOZE; 708 nextidx = HILSEN_DOZE;
650 write_unlock_irqrestore(&(mlc->lock), flags); 709 write_unlock_irqrestore(&mlc->lock, flags);
651 break; 710 break;
652 } 711 }
653 mlc->ostarted = 0; 712 mlc->ostarted = 0;
654 do_gettimeofday(&(mlc->instart)); 713 do_gettimeofday(&(mlc->instart));
655 write_unlock_irqrestore(&(mlc->lock), flags); 714 write_unlock_irqrestore(&mlc->lock, flags);
656 nextidx = HILSEN_NEXT; 715 nextidx = HILSEN_NEXT;
657 break; 716 break;
717
658 case HILSE_CTS: 718 case HILSE_CTS:
719 write_lock_irqsave(&mlc->lock, flags);
659 nextidx = mlc->cts(mlc) ? node->bad : node->good; 720 nextidx = mlc->cts(mlc) ? node->bad : node->good;
721 write_unlock_irqrestore(&mlc->lock, flags);
660 break; 722 break;
723
661 default: 724 default:
662 BUG(); 725 BUG();
663 nextidx = 0;
664 break;
665 } 726 }
666 727
667#ifdef HIL_MLC_DEBUG 728#ifdef HIL_MLC_DEBUG
668 if (nextidx == HILSEN_DOZE) doze++; 729 if (nextidx == HILSEN_DOZE)
730 doze++;
669#endif 731#endif
670 732
671 while (nextidx & HILSEN_SCHED) { 733 while (nextidx & HILSEN_SCHED) {
672 struct timeval tv; 734 struct timeval tv;
673 735
674 if (!sched_long) goto sched; 736 if (!sched_long)
737 goto sched;
675 738
676 do_gettimeofday(&tv); 739 do_gettimeofday(&tv);
677 tv.tv_usec += 1000000 * (tv.tv_sec - mlc->instart.tv_sec); 740 tv.tv_usec += USEC_PER_SEC * (tv.tv_sec - mlc->instart.tv_sec);
678 tv.tv_usec -= mlc->instart.tv_usec; 741 tv.tv_usec -= mlc->instart.tv_usec;
679 if (tv.tv_usec >= mlc->intimeout) goto sched; 742 if (tv.tv_usec >= mlc->intimeout) goto sched;
680 tv.tv_usec = (mlc->intimeout - tv.tv_usec) * HZ / 1000000; 743 tv.tv_usec = (mlc->intimeout - tv.tv_usec) * HZ / USEC_PER_SEC;
681 if (!tv.tv_usec) goto sched; 744 if (!tv.tv_usec) goto sched;
682 mod_timer(&hil_mlcs_kicker, jiffies + tv.tv_usec); 745 mod_timer(&hil_mlcs_kicker, jiffies + tv.tv_usec);
683 break; 746 break;
684 sched: 747 sched:
685 tasklet_schedule(&hil_mlcs_tasklet); 748 tasklet_schedule(&hil_mlcs_tasklet);
686 break; 749 break;
687 } 750 }
688 if (nextidx & HILSEN_DOWN) mlc->seidx += nextidx & HILSEN_MASK; 751
689 else if (nextidx & HILSEN_UP) mlc->seidx -= nextidx & HILSEN_MASK; 752 if (nextidx & HILSEN_DOWN)
690 else mlc->seidx = nextidx & HILSEN_MASK; 753 mlc->seidx += nextidx & HILSEN_MASK;
754 else if (nextidx & HILSEN_UP)
755 mlc->seidx -= nextidx & HILSEN_MASK;
756 else
757 mlc->seidx = nextidx & HILSEN_MASK;
758
759 if (nextidx & HILSEN_BREAK)
760 return 1;
691 761
692 if (nextidx & HILSEN_BREAK) return 1;
693 return 0; 762 return 0;
694} 763}
695 764
696/******************** tasklet context functions **************************/ 765/******************** tasklet context functions **************************/
697static void hil_mlcs_process(unsigned long unused) { 766static void hil_mlcs_process(unsigned long unused)
767{
698 struct list_head *tmp; 768 struct list_head *tmp;
699 769
700 read_lock(&hil_mlcs_lock); 770 read_lock(&hil_mlcs_lock);
@@ -702,19 +772,20 @@ static void hil_mlcs_process(unsigned long unused) {
702 struct hil_mlc *mlc = list_entry(tmp, hil_mlc, list); 772 struct hil_mlc *mlc = list_entry(tmp, hil_mlc, list);
703 while (hilse_donode(mlc) == 0) { 773 while (hilse_donode(mlc) == 0) {
704#ifdef HIL_MLC_DEBUG 774#ifdef HIL_MLC_DEBUG
705 if (mlc->seidx != 41 && 775 if (mlc->seidx != 41 &&
706 mlc->seidx != 42 && 776 mlc->seidx != 42 &&
707 mlc->seidx != 43) 777 mlc->seidx != 43)
708 printk(KERN_DEBUG PREFIX " + "); 778 printk(KERN_DEBUG PREFIX " + ");
709#endif 779#endif
710 }; 780 }
711 } 781 }
712 read_unlock(&hil_mlcs_lock); 782 read_unlock(&hil_mlcs_lock);
713} 783}
714 784
715/************************* Keepalive timer task *********************/ 785/************************* Keepalive timer task *********************/
716 786
717void hil_mlcs_timer (unsigned long data) { 787void hil_mlcs_timer(unsigned long data)
788{
718 hil_mlcs_probe = 1; 789 hil_mlcs_probe = 1;
719 tasklet_schedule(&hil_mlcs_tasklet); 790 tasklet_schedule(&hil_mlcs_tasklet);
720 /* Re-insert the periodic task. */ 791 /* Re-insert the periodic task. */
@@ -724,28 +795,25 @@ void hil_mlcs_timer (unsigned long data) {
724 795
725/******************** user/kernel context functions **********************/ 796/******************** user/kernel context functions **********************/
726 797
727static int hil_mlc_serio_write(struct serio *serio, unsigned char c) { 798static int hil_mlc_serio_write(struct serio *serio, unsigned char c)
799{
728 struct hil_mlc_serio_map *map; 800 struct hil_mlc_serio_map *map;
729 struct hil_mlc *mlc; 801 struct hil_mlc *mlc;
730 struct serio_driver *drv; 802 struct serio_driver *drv;
731 uint8_t *idx, *last; 803 uint8_t *idx, *last;
732 804
733 map = serio->port_data; 805 map = serio->port_data;
734 if (map == NULL) { 806 BUG_ON(map == NULL);
735 BUG(); 807
736 return -EIO;
737 }
738 mlc = map->mlc; 808 mlc = map->mlc;
739 if (mlc == NULL) { 809 BUG_ON(mlc == NULL);
740 BUG(); 810
741 return -EIO; 811 mlc->serio_opacket[map->didx] |=
742 }
743 mlc->serio_opacket[map->didx] |=
744 ((hil_packet)c) << (8 * (3 - mlc->serio_oidx[map->didx])); 812 ((hil_packet)c) << (8 * (3 - mlc->serio_oidx[map->didx]));
745 813
746 if (mlc->serio_oidx[map->didx] >= 3) { 814 if (mlc->serio_oidx[map->didx] >= 3) {
747 /* for now only commands */ 815 /* for now only commands */
748 if (!(mlc->serio_opacket[map->didx] & HIL_PKT_CMD)) 816 if (!(mlc->serio_opacket[map->didx] & HIL_PKT_CMD))
749 return -EIO; 817 return -EIO;
750 switch (mlc->serio_opacket[map->didx] & HIL_PKT_DATA_MASK) { 818 switch (mlc->serio_opacket[map->didx] & HIL_PKT_DATA_MASK) {
751 case HIL_CMD_IDD: 819 case HIL_CMD_IDD:
@@ -771,12 +839,11 @@ static int hil_mlc_serio_write(struct serio *serio, unsigned char c) {
771 return -EIO; 839 return -EIO;
772 emu: 840 emu:
773 drv = serio->drv; 841 drv = serio->drv;
774 if (drv == NULL) { 842 BUG_ON(drv == NULL);
775 BUG(); 843
776 return -EIO;
777 }
778 last = idx + 15; 844 last = idx + 15;
779 while ((last != idx) && (*last == 0)) last--; 845 while ((last != idx) && (*last == 0))
846 last--;
780 847
781 while (idx != last) { 848 while (idx != last) {
782 drv->interrupt(serio, 0, 0); 849 drv->interrupt(serio, 0, 0);
@@ -789,14 +856,15 @@ static int hil_mlc_serio_write(struct serio *serio, unsigned char c) {
789 drv->interrupt(serio, HIL_ERR_INT >> 16, 0); 856 drv->interrupt(serio, HIL_ERR_INT >> 16, 0);
790 drv->interrupt(serio, HIL_PKT_CMD >> 8, 0); 857 drv->interrupt(serio, HIL_PKT_CMD >> 8, 0);
791 drv->interrupt(serio, *idx, 0); 858 drv->interrupt(serio, *idx, 0);
792 859
793 mlc->serio_oidx[map->didx] = 0; 860 mlc->serio_oidx[map->didx] = 0;
794 mlc->serio_opacket[map->didx] = 0; 861 mlc->serio_opacket[map->didx] = 0;
795 862
796 return 0; 863 return 0;
797} 864}
798 865
799static int hil_mlc_serio_open(struct serio *serio) { 866static int hil_mlc_serio_open(struct serio *serio)
867{
800 struct hil_mlc_serio_map *map; 868 struct hil_mlc_serio_map *map;
801 struct hil_mlc *mlc; 869 struct hil_mlc *mlc;
802 870
@@ -804,67 +872,57 @@ static int hil_mlc_serio_open(struct serio *serio) {
804 return -EBUSY; 872 return -EBUSY;
805 873
806 map = serio->port_data; 874 map = serio->port_data;
807 if (map == NULL) { 875 BUG_ON(map == NULL);
808 BUG(); 876
809 return -ENODEV;
810 }
811 mlc = map->mlc; 877 mlc = map->mlc;
812 if (mlc == NULL) { 878 BUG_ON(mlc == NULL);
813 BUG();
814 return -ENODEV;
815 }
816 879
817 return 0; 880 return 0;
818} 881}
819 882
820static void hil_mlc_serio_close(struct serio *serio) { 883static void hil_mlc_serio_close(struct serio *serio)
884{
821 struct hil_mlc_serio_map *map; 885 struct hil_mlc_serio_map *map;
822 struct hil_mlc *mlc; 886 struct hil_mlc *mlc;
823 887
824 map = serio->port_data; 888 map = serio->port_data;
825 if (map == NULL) { 889 BUG_ON(map == NULL);
826 BUG(); 890
827 return;
828 }
829 mlc = map->mlc; 891 mlc = map->mlc;
830 if (mlc == NULL) { 892 BUG_ON(mlc == NULL);
831 BUG();
832 return;
833 }
834 893
835 serio_set_drvdata(serio, NULL); 894 serio_set_drvdata(serio, NULL);
836 serio->drv = NULL; 895 serio->drv = NULL;
837 /* TODO wake up interruptable */ 896 /* TODO wake up interruptable */
838} 897}
839 898
840static struct serio_device_id hil_mlc_serio_id = { 899static const struct serio_device_id hil_mlc_serio_id = {
841 .type = SERIO_HIL_MLC, 900 .type = SERIO_HIL_MLC,
842 .proto = SERIO_HIL, 901 .proto = SERIO_HIL,
843 .extra = SERIO_ANY, 902 .extra = SERIO_ANY,
844 .id = SERIO_ANY, 903 .id = SERIO_ANY,
845}; 904};
846 905
847int hil_mlc_register(hil_mlc *mlc) { 906int hil_mlc_register(hil_mlc *mlc)
907{
848 int i; 908 int i;
849 unsigned long flags; 909 unsigned long flags;
850 910
851 if (mlc == NULL) { 911 BUG_ON(mlc == NULL);
852 return -EINVAL;
853 }
854 912
855 mlc->istarted = 0; 913 mlc->istarted = 0;
856 mlc->ostarted = 0; 914 mlc->ostarted = 0;
857 915
858 rwlock_init(&mlc->lock); 916 rwlock_init(&mlc->lock);
859 init_MUTEX(&(mlc->osem)); 917 init_MUTEX(&mlc->osem);
860 918
861 init_MUTEX(&(mlc->isem)); 919 init_MUTEX(&mlc->isem);
862 mlc->icount = -1; 920 mlc->icount = -1;
863 mlc->imatch = 0; 921 mlc->imatch = 0;
864 922
865 mlc->opercnt = 0; 923 mlc->opercnt = 0;
866 924
867 init_MUTEX_LOCKED(&(mlc->csem)); 925 init_MUTEX_LOCKED(&(mlc->csem));
868 926
869 hil_mlc_clear_di_scratch(mlc); 927 hil_mlc_clear_di_scratch(mlc);
870 hil_mlc_clear_di_map(mlc, 0); 928 hil_mlc_clear_di_map(mlc, 0);
@@ -873,6 +931,8 @@ int hil_mlc_register(hil_mlc *mlc) {
873 hil_mlc_copy_di_scratch(mlc, i); 931 hil_mlc_copy_di_scratch(mlc, i);
874 mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL); 932 mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL);
875 mlc->serio[i] = mlc_serio; 933 mlc->serio[i] = mlc_serio;
934 snprintf(mlc_serio->name, sizeof(mlc_serio->name)-1, "HIL_SERIO%d", i);
935 snprintf(mlc_serio->phys, sizeof(mlc_serio->phys)-1, "HIL%d", i);
876 mlc_serio->id = hil_mlc_serio_id; 936 mlc_serio->id = hil_mlc_serio_id;
877 mlc_serio->write = hil_mlc_serio_write; 937 mlc_serio->write = hil_mlc_serio_write;
878 mlc_serio->open = hil_mlc_serio_open; 938 mlc_serio->open = hil_mlc_serio_open;
@@ -897,19 +957,18 @@ int hil_mlc_register(hil_mlc *mlc) {
897 return 0; 957 return 0;
898} 958}
899 959
900int hil_mlc_unregister(hil_mlc *mlc) { 960int hil_mlc_unregister(hil_mlc *mlc)
961{
901 struct list_head *tmp; 962 struct list_head *tmp;
902 unsigned long flags; 963 unsigned long flags;
903 int i; 964 int i;
904 965
905 if (mlc == NULL) 966 BUG_ON(mlc == NULL);
906 return -EINVAL;
907 967
908 write_lock_irqsave(&hil_mlcs_lock, flags); 968 write_lock_irqsave(&hil_mlcs_lock, flags);
909 list_for_each(tmp, &hil_mlcs) { 969 list_for_each(tmp, &hil_mlcs)
910 if (list_entry(tmp, hil_mlc, list) == mlc) 970 if (list_entry(tmp, hil_mlc, list) == mlc)
911 goto found; 971 goto found;
912 }
913 972
914 /* not found in list */ 973 /* not found in list */
915 write_unlock_irqrestore(&hil_mlcs_lock, flags); 974 write_unlock_irqrestore(&hil_mlcs_lock, flags);
@@ -918,7 +977,7 @@ int hil_mlc_unregister(hil_mlc *mlc) {
918 977
919 found: 978 found:
920 list_del(tmp); 979 list_del(tmp);
921 write_unlock_irqrestore(&hil_mlcs_lock, flags); 980 write_unlock_irqrestore(&hil_mlcs_lock, flags);
922 981
923 for (i = 0; i < HIL_MLC_DEVMEM; i++) { 982 for (i = 0; i < HIL_MLC_DEVMEM; i++) {
924 serio_unregister_port(mlc->serio[i]); 983 serio_unregister_port(mlc->serio[i]);
@@ -942,7 +1001,7 @@ static int __init hil_mlc_init(void)
942 1001
943 return 0; 1002 return 0;
944} 1003}
945 1004
946static void __exit hil_mlc_exit(void) 1005static void __exit hil_mlc_exit(void)
947{ 1006{
948 del_timer(&hil_mlcs_kicker); 1007 del_timer(&hil_mlcs_kicker);
@@ -950,6 +1009,6 @@ static void __exit hil_mlc_exit(void)
950 tasklet_disable(&hil_mlcs_tasklet); 1009 tasklet_disable(&hil_mlcs_tasklet);
951 tasklet_kill(&hil_mlcs_tasklet); 1010 tasklet_kill(&hil_mlcs_tasklet);
952} 1011}
953 1012
954module_init(hil_mlc_init); 1013module_init(hil_mlc_init);
955module_exit(hil_mlc_exit); 1014module_exit(hil_mlc_exit);
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index b57370dc4e3d..6af199805ffc 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -34,27 +34,27 @@
34 * 34 *
35 * Driver theory of operation: 35 * Driver theory of operation:
36 * 36 *
37 * hp_sdc_put does all writing to the SDC. ISR can run on a different 37 * hp_sdc_put does all writing to the SDC. ISR can run on a different
38 * CPU than hp_sdc_put, but only one CPU runs hp_sdc_put at a time 38 * CPU than hp_sdc_put, but only one CPU runs hp_sdc_put at a time
39 * (it cannot really benefit from SMP anyway.) A tasket fit this perfectly. 39 * (it cannot really benefit from SMP anyway.) A tasket fit this perfectly.
40 * 40 *
41 * All data coming back from the SDC is sent via interrupt and can be read 41 * All data coming back from the SDC is sent via interrupt and can be read
42 * fully in the ISR, so there are no latency/throughput problems there. 42 * fully in the ISR, so there are no latency/throughput problems there.
43 * The problem is with output, due to the slow clock speed of the SDC 43 * The problem is with output, due to the slow clock speed of the SDC
44 * compared to the CPU. This should not be too horrible most of the time, 44 * compared to the CPU. This should not be too horrible most of the time,
45 * but if used with HIL devices that support the multibyte transfer command, 45 * but if used with HIL devices that support the multibyte transfer command,
46 * keeping outbound throughput flowing at the 6500KBps that the HIL is 46 * keeping outbound throughput flowing at the 6500KBps that the HIL is
47 * capable of is more than can be done at HZ=100. 47 * capable of is more than can be done at HZ=100.
48 * 48 *
49 * Busy polling for IBF clear wastes CPU cycles and bus cycles. hp_sdc.ibf 49 * Busy polling for IBF clear wastes CPU cycles and bus cycles. hp_sdc.ibf
50 * is set to 0 when the IBF flag in the status register has cleared. ISR 50 * is set to 0 when the IBF flag in the status register has cleared. ISR
51 * may do this, and may also access the parts of queued transactions related 51 * may do this, and may also access the parts of queued transactions related
52 * to reading data back from the SDC, but otherwise will not touch the 52 * to reading data back from the SDC, but otherwise will not touch the
53 * hp_sdc state. Whenever a register is written hp_sdc.ibf is set to 1. 53 * hp_sdc state. Whenever a register is written hp_sdc.ibf is set to 1.
54 * 54 *
55 * The i8042 write index and the values in the 4-byte input buffer 55 * The i8042 write index and the values in the 4-byte input buffer
56 * starting at 0x70 are kept track of in hp_sdc.wi, and .r7[], respectively, 56 * starting at 0x70 are kept track of in hp_sdc.wi, and .r7[], respectively,
57 * to minimize the amount of IO needed to the SDC. However these values 57 * to minimize the amount of IO needed to the SDC. However these values
58 * do not need to be locked since they are only ever accessed by hp_sdc_put. 58 * do not need to be locked since they are only ever accessed by hp_sdc_put.
59 * 59 *
60 * A timer task schedules the tasklet once per second just to make 60 * A timer task schedules the tasklet once per second just to make
@@ -100,39 +100,46 @@ EXPORT_SYMBOL(hp_sdc_release_timer_irq);
100EXPORT_SYMBOL(hp_sdc_release_hil_irq); 100EXPORT_SYMBOL(hp_sdc_release_hil_irq);
101EXPORT_SYMBOL(hp_sdc_release_cooked_irq); 101EXPORT_SYMBOL(hp_sdc_release_cooked_irq);
102 102
103EXPORT_SYMBOL(__hp_sdc_enqueue_transaction);
103EXPORT_SYMBOL(hp_sdc_enqueue_transaction); 104EXPORT_SYMBOL(hp_sdc_enqueue_transaction);
104EXPORT_SYMBOL(hp_sdc_dequeue_transaction); 105EXPORT_SYMBOL(hp_sdc_dequeue_transaction);
105 106
106static hp_i8042_sdc hp_sdc; /* All driver state is kept in here. */ 107static hp_i8042_sdc hp_sdc; /* All driver state is kept in here. */
107 108
108/*************** primitives for use in any context *********************/ 109/*************** primitives for use in any context *********************/
109static inline uint8_t hp_sdc_status_in8 (void) { 110static inline uint8_t hp_sdc_status_in8(void)
111{
110 uint8_t status; 112 uint8_t status;
111 unsigned long flags; 113 unsigned long flags;
112 114
113 write_lock_irqsave(&hp_sdc.ibf_lock, flags); 115 write_lock_irqsave(&hp_sdc.ibf_lock, flags);
114 status = sdc_readb(hp_sdc.status_io); 116 status = sdc_readb(hp_sdc.status_io);
115 if (!(status & HP_SDC_STATUS_IBF)) hp_sdc.ibf = 0; 117 if (!(status & HP_SDC_STATUS_IBF))
118 hp_sdc.ibf = 0;
116 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags); 119 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags);
117 120
118 return status; 121 return status;
119} 122}
120 123
121static inline uint8_t hp_sdc_data_in8 (void) { 124static inline uint8_t hp_sdc_data_in8(void)
122 return sdc_readb(hp_sdc.data_io); 125{
126 return sdc_readb(hp_sdc.data_io);
123} 127}
124 128
125static inline void hp_sdc_status_out8 (uint8_t val) { 129static inline void hp_sdc_status_out8(uint8_t val)
130{
126 unsigned long flags; 131 unsigned long flags;
127 132
128 write_lock_irqsave(&hp_sdc.ibf_lock, flags); 133 write_lock_irqsave(&hp_sdc.ibf_lock, flags);
129 hp_sdc.ibf = 1; 134 hp_sdc.ibf = 1;
130 if ((val & 0xf0) == 0xe0) hp_sdc.wi = 0xff; 135 if ((val & 0xf0) == 0xe0)
136 hp_sdc.wi = 0xff;
131 sdc_writeb(val, hp_sdc.status_io); 137 sdc_writeb(val, hp_sdc.status_io);
132 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags); 138 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags);
133} 139}
134 140
135static inline void hp_sdc_data_out8 (uint8_t val) { 141static inline void hp_sdc_data_out8(uint8_t val)
142{
136 unsigned long flags; 143 unsigned long flags;
137 144
138 write_lock_irqsave(&hp_sdc.ibf_lock, flags); 145 write_lock_irqsave(&hp_sdc.ibf_lock, flags);
@@ -141,11 +148,12 @@ static inline void hp_sdc_data_out8 (uint8_t val) {
141 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags); 148 write_unlock_irqrestore(&hp_sdc.ibf_lock, flags);
142} 149}
143 150
144/* Care must be taken to only invoke hp_sdc_spin_ibf when 151/* Care must be taken to only invoke hp_sdc_spin_ibf when
145 * absolutely needed, or in rarely invoked subroutines. 152 * absolutely needed, or in rarely invoked subroutines.
146 * Not only does it waste CPU cycles, it also wastes bus cycles. 153 * Not only does it waste CPU cycles, it also wastes bus cycles.
147 */ 154 */
148static inline void hp_sdc_spin_ibf(void) { 155static inline void hp_sdc_spin_ibf(void)
156{
149 unsigned long flags; 157 unsigned long flags;
150 rwlock_t *lock; 158 rwlock_t *lock;
151 159
@@ -158,19 +166,21 @@ static inline void hp_sdc_spin_ibf(void) {
158 } 166 }
159 read_unlock(lock); 167 read_unlock(lock);
160 write_lock(lock); 168 write_lock(lock);
161 while (sdc_readb(hp_sdc.status_io) & HP_SDC_STATUS_IBF) {}; 169 while (sdc_readb(hp_sdc.status_io) & HP_SDC_STATUS_IBF)
170 { }
162 hp_sdc.ibf = 0; 171 hp_sdc.ibf = 0;
163 write_unlock_irqrestore(lock, flags); 172 write_unlock_irqrestore(lock, flags);
164} 173}
165 174
166 175
167/************************ Interrupt context functions ************************/ 176/************************ Interrupt context functions ************************/
168static void hp_sdc_take (int irq, void *dev_id, uint8_t status, uint8_t data) { 177static void hp_sdc_take(int irq, void *dev_id, uint8_t status, uint8_t data)
178{
169 hp_sdc_transaction *curr; 179 hp_sdc_transaction *curr;
170 180
171 read_lock(&hp_sdc.rtq_lock); 181 read_lock(&hp_sdc.rtq_lock);
172 if (hp_sdc.rcurr < 0) { 182 if (hp_sdc.rcurr < 0) {
173 read_unlock(&hp_sdc.rtq_lock); 183 read_unlock(&hp_sdc.rtq_lock);
174 return; 184 return;
175 } 185 }
176 curr = hp_sdc.tq[hp_sdc.rcurr]; 186 curr = hp_sdc.tq[hp_sdc.rcurr];
@@ -183,25 +193,27 @@ static void hp_sdc_take (int irq, void *dev_id, uint8_t status, uint8_t data) {
183 193
184 if (hp_sdc.rqty <= 0) { 194 if (hp_sdc.rqty <= 0) {
185 /* All data has been gathered. */ 195 /* All data has been gathered. */
186 if(curr->seq[curr->actidx] & HP_SDC_ACT_SEMAPHORE) { 196 if (curr->seq[curr->actidx] & HP_SDC_ACT_SEMAPHORE)
187 if (curr->act.semaphore) up(curr->act.semaphore); 197 if (curr->act.semaphore)
188 } 198 up(curr->act.semaphore);
189 if(curr->seq[curr->actidx] & HP_SDC_ACT_CALLBACK) { 199
200 if (curr->seq[curr->actidx] & HP_SDC_ACT_CALLBACK)
190 if (curr->act.irqhook) 201 if (curr->act.irqhook)
191 curr->act.irqhook(irq, dev_id, status, data); 202 curr->act.irqhook(irq, dev_id, status, data);
192 } 203
193 curr->actidx = curr->idx; 204 curr->actidx = curr->idx;
194 curr->idx++; 205 curr->idx++;
195 /* Return control of this transaction */ 206 /* Return control of this transaction */
196 write_lock(&hp_sdc.rtq_lock); 207 write_lock(&hp_sdc.rtq_lock);
197 hp_sdc.rcurr = -1; 208 hp_sdc.rcurr = -1;
198 hp_sdc.rqty = 0; 209 hp_sdc.rqty = 0;
199 write_unlock(&hp_sdc.rtq_lock); 210 write_unlock(&hp_sdc.rtq_lock);
200 tasklet_schedule(&hp_sdc.task); 211 tasklet_schedule(&hp_sdc.task);
201 } 212 }
202} 213}
203 214
204static irqreturn_t hp_sdc_isr(int irq, void *dev_id) { 215static irqreturn_t hp_sdc_isr(int irq, void *dev_id)
216{
205 uint8_t status, data; 217 uint8_t status, data;
206 218
207 status = hp_sdc_status_in8(); 219 status = hp_sdc_status_in8();
@@ -209,67 +221,74 @@ static irqreturn_t hp_sdc_isr(int irq, void *dev_id) {
209 data = hp_sdc_data_in8(); 221 data = hp_sdc_data_in8();
210 222
211 /* For now we are ignoring these until we get the SDC to behave. */ 223 /* For now we are ignoring these until we get the SDC to behave. */
212 if (((status & 0xf1) == 0x51) && data == 0x82) { 224 if (((status & 0xf1) == 0x51) && data == 0x82)
213 return IRQ_HANDLED; 225 return IRQ_HANDLED;
214 }
215 226
216 switch(status & HP_SDC_STATUS_IRQMASK) { 227 switch (status & HP_SDC_STATUS_IRQMASK) {
217 case 0: /* This case is not documented. */ 228 case 0: /* This case is not documented. */
218 break; 229 break;
219 case HP_SDC_STATUS_USERTIMER: 230
220 case HP_SDC_STATUS_PERIODIC: 231 case HP_SDC_STATUS_USERTIMER:
221 case HP_SDC_STATUS_TIMER: 232 case HP_SDC_STATUS_PERIODIC:
233 case HP_SDC_STATUS_TIMER:
222 read_lock(&hp_sdc.hook_lock); 234 read_lock(&hp_sdc.hook_lock);
223 if (hp_sdc.timer != NULL) 235 if (hp_sdc.timer != NULL)
224 hp_sdc.timer(irq, dev_id, status, data); 236 hp_sdc.timer(irq, dev_id, status, data);
225 read_unlock(&hp_sdc.hook_lock); 237 read_unlock(&hp_sdc.hook_lock);
226 break; 238 break;
227 case HP_SDC_STATUS_REG: 239
240 case HP_SDC_STATUS_REG:
228 hp_sdc_take(irq, dev_id, status, data); 241 hp_sdc_take(irq, dev_id, status, data);
229 break; 242 break;
230 case HP_SDC_STATUS_HILCMD: 243
231 case HP_SDC_STATUS_HILDATA: 244 case HP_SDC_STATUS_HILCMD:
245 case HP_SDC_STATUS_HILDATA:
232 read_lock(&hp_sdc.hook_lock); 246 read_lock(&hp_sdc.hook_lock);
233 if (hp_sdc.hil != NULL) 247 if (hp_sdc.hil != NULL)
234 hp_sdc.hil(irq, dev_id, status, data); 248 hp_sdc.hil(irq, dev_id, status, data);
235 read_unlock(&hp_sdc.hook_lock); 249 read_unlock(&hp_sdc.hook_lock);
236 break; 250 break;
237 case HP_SDC_STATUS_PUP: 251
252 case HP_SDC_STATUS_PUP:
238 read_lock(&hp_sdc.hook_lock); 253 read_lock(&hp_sdc.hook_lock);
239 if (hp_sdc.pup != NULL) 254 if (hp_sdc.pup != NULL)
240 hp_sdc.pup(irq, dev_id, status, data); 255 hp_sdc.pup(irq, dev_id, status, data);
241 else printk(KERN_INFO PREFIX "HP SDC reports successful PUP.\n"); 256 else
257 printk(KERN_INFO PREFIX "HP SDC reports successful PUP.\n");
242 read_unlock(&hp_sdc.hook_lock); 258 read_unlock(&hp_sdc.hook_lock);
243 break; 259 break;
244 default: 260
261 default:
245 read_lock(&hp_sdc.hook_lock); 262 read_lock(&hp_sdc.hook_lock);
246 if (hp_sdc.cooked != NULL) 263 if (hp_sdc.cooked != NULL)
247 hp_sdc.cooked(irq, dev_id, status, data); 264 hp_sdc.cooked(irq, dev_id, status, data);
248 read_unlock(&hp_sdc.hook_lock); 265 read_unlock(&hp_sdc.hook_lock);
249 break; 266 break;
250 } 267 }
268
251 return IRQ_HANDLED; 269 return IRQ_HANDLED;
252} 270}
253 271
254 272
255static irqreturn_t hp_sdc_nmisr(int irq, void *dev_id) { 273static irqreturn_t hp_sdc_nmisr(int irq, void *dev_id)
274{
256 int status; 275 int status;
257 276
258 status = hp_sdc_status_in8(); 277 status = hp_sdc_status_in8();
259 printk(KERN_WARNING PREFIX "NMI !\n"); 278 printk(KERN_WARNING PREFIX "NMI !\n");
260 279
261#if 0 280#if 0
262 if (status & HP_SDC_NMISTATUS_FHS) { 281 if (status & HP_SDC_NMISTATUS_FHS) {
263 read_lock(&hp_sdc.hook_lock); 282 read_lock(&hp_sdc.hook_lock);
264 if (hp_sdc.timer != NULL) 283 if (hp_sdc.timer != NULL)
265 hp_sdc.timer(irq, dev_id, status, 0); 284 hp_sdc.timer(irq, dev_id, status, 0);
266 read_unlock(&hp_sdc.hook_lock); 285 read_unlock(&hp_sdc.hook_lock);
267 } 286 } else {
268 else {
269 /* TODO: pass this on to the HIL handler, or do SAK here? */ 287 /* TODO: pass this on to the HIL handler, or do SAK here? */
270 printk(KERN_WARNING PREFIX "HIL NMI\n"); 288 printk(KERN_WARNING PREFIX "HIL NMI\n");
271 } 289 }
272#endif 290#endif
291
273 return IRQ_HANDLED; 292 return IRQ_HANDLED;
274} 293}
275 294
@@ -278,13 +297,17 @@ static irqreturn_t hp_sdc_nmisr(int irq, void *dev_id) {
278 297
279unsigned long hp_sdc_put(void); 298unsigned long hp_sdc_put(void);
280 299
281static void hp_sdc_tasklet(unsigned long foo) { 300static void hp_sdc_tasklet(unsigned long foo)
282 301{
283 write_lock_irq(&hp_sdc.rtq_lock); 302 write_lock_irq(&hp_sdc.rtq_lock);
303
284 if (hp_sdc.rcurr >= 0) { 304 if (hp_sdc.rcurr >= 0) {
285 struct timeval tv; 305 struct timeval tv;
306
286 do_gettimeofday(&tv); 307 do_gettimeofday(&tv);
287 if (tv.tv_sec > hp_sdc.rtv.tv_sec) tv.tv_usec += 1000000; 308 if (tv.tv_sec > hp_sdc.rtv.tv_sec)
309 tv.tv_usec += USEC_PER_SEC;
310
288 if (tv.tv_usec - hp_sdc.rtv.tv_usec > HP_SDC_MAX_REG_DELAY) { 311 if (tv.tv_usec - hp_sdc.rtv.tv_usec > HP_SDC_MAX_REG_DELAY) {
289 hp_sdc_transaction *curr; 312 hp_sdc_transaction *curr;
290 uint8_t tmp; 313 uint8_t tmp;
@@ -300,27 +323,29 @@ static void hp_sdc_tasklet(unsigned long foo) {
300 hp_sdc.rqty = 0; 323 hp_sdc.rqty = 0;
301 tmp = curr->seq[curr->actidx]; 324 tmp = curr->seq[curr->actidx];
302 curr->seq[curr->actidx] |= HP_SDC_ACT_DEAD; 325 curr->seq[curr->actidx] |= HP_SDC_ACT_DEAD;
303 if(tmp & HP_SDC_ACT_SEMAPHORE) { 326 if (tmp & HP_SDC_ACT_SEMAPHORE)
304 if (curr->act.semaphore) 327 if (curr->act.semaphore)
305 up(curr->act.semaphore); 328 up(curr->act.semaphore);
306 } 329
307 if(tmp & HP_SDC_ACT_CALLBACK) { 330 if (tmp & HP_SDC_ACT_CALLBACK) {
308 /* Note this means that irqhooks may be called 331 /* Note this means that irqhooks may be called
309 * in tasklet/bh context. 332 * in tasklet/bh context.
310 */ 333 */
311 if (curr->act.irqhook) 334 if (curr->act.irqhook)
312 curr->act.irqhook(0, NULL, 0, 0); 335 curr->act.irqhook(0, NULL, 0, 0);
313 } 336 }
337
314 curr->actidx = curr->idx; 338 curr->actidx = curr->idx;
315 curr->idx++; 339 curr->idx++;
316 hp_sdc.rcurr = -1; 340 hp_sdc.rcurr = -1;
317 } 341 }
318 } 342 }
319 write_unlock_irq(&hp_sdc.rtq_lock); 343 write_unlock_irq(&hp_sdc.rtq_lock);
320 hp_sdc_put(); 344 hp_sdc_put();
321} 345}
322 346
323unsigned long hp_sdc_put(void) { 347unsigned long hp_sdc_put(void)
348{
324 hp_sdc_transaction *curr; 349 hp_sdc_transaction *curr;
325 uint8_t act; 350 uint8_t act;
326 int idx, curridx; 351 int idx, curridx;
@@ -333,19 +358,24 @@ unsigned long hp_sdc_put(void) {
333 requires output, so we skip to the administrativa. */ 358 requires output, so we skip to the administrativa. */
334 if (hp_sdc.ibf) { 359 if (hp_sdc.ibf) {
335 hp_sdc_status_in8(); 360 hp_sdc_status_in8();
336 if (hp_sdc.ibf) goto finish; 361 if (hp_sdc.ibf)
362 goto finish;
337 } 363 }
338 364
339 anew: 365 anew:
340 /* See if we are in the middle of a sequence. */ 366 /* See if we are in the middle of a sequence. */
341 if (hp_sdc.wcurr < 0) hp_sdc.wcurr = 0; 367 if (hp_sdc.wcurr < 0)
368 hp_sdc.wcurr = 0;
342 read_lock_irq(&hp_sdc.rtq_lock); 369 read_lock_irq(&hp_sdc.rtq_lock);
343 if (hp_sdc.rcurr == hp_sdc.wcurr) hp_sdc.wcurr++; 370 if (hp_sdc.rcurr == hp_sdc.wcurr)
371 hp_sdc.wcurr++;
344 read_unlock_irq(&hp_sdc.rtq_lock); 372 read_unlock_irq(&hp_sdc.rtq_lock);
345 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN) hp_sdc.wcurr = 0; 373 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN)
374 hp_sdc.wcurr = 0;
346 curridx = hp_sdc.wcurr; 375 curridx = hp_sdc.wcurr;
347 376
348 if (hp_sdc.tq[curridx] != NULL) goto start; 377 if (hp_sdc.tq[curridx] != NULL)
378 goto start;
349 379
350 while (++curridx != hp_sdc.wcurr) { 380 while (++curridx != hp_sdc.wcurr) {
351 if (curridx >= HP_SDC_QUEUE_LEN) { 381 if (curridx >= HP_SDC_QUEUE_LEN) {
@@ -358,7 +388,8 @@ unsigned long hp_sdc_put(void) {
358 continue; 388 continue;
359 } 389 }
360 read_unlock_irq(&hp_sdc.rtq_lock); 390 read_unlock_irq(&hp_sdc.rtq_lock);
361 if (hp_sdc.tq[curridx] != NULL) break; /* Found one. */ 391 if (hp_sdc.tq[curridx] != NULL)
392 break; /* Found one. */
362 } 393 }
363 if (curridx == hp_sdc.wcurr) { /* There's nothing queued to do. */ 394 if (curridx == hp_sdc.wcurr) { /* There's nothing queued to do. */
364 curridx = -1; 395 curridx = -1;
@@ -374,7 +405,8 @@ unsigned long hp_sdc_put(void) {
374 goto finish; 405 goto finish;
375 } 406 }
376 407
377 if (hp_sdc.wcurr == -1) goto done; 408 if (hp_sdc.wcurr == -1)
409 goto done;
378 410
379 curr = hp_sdc.tq[curridx]; 411 curr = hp_sdc.tq[curridx];
380 idx = curr->actidx; 412 idx = curr->actidx;
@@ -383,20 +415,23 @@ unsigned long hp_sdc_put(void) {
383 hp_sdc.tq[curridx] = NULL; 415 hp_sdc.tq[curridx] = NULL;
384 /* Interleave outbound data between the transactions. */ 416 /* Interleave outbound data between the transactions. */
385 hp_sdc.wcurr++; 417 hp_sdc.wcurr++;
386 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN) hp_sdc.wcurr = 0; 418 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN)
387 goto finish; 419 hp_sdc.wcurr = 0;
420 goto finish;
388 } 421 }
389 422
390 act = curr->seq[idx]; 423 act = curr->seq[idx];
391 idx++; 424 idx++;
392 425
393 if (curr->idx >= curr->endidx) { 426 if (curr->idx >= curr->endidx) {
394 if (act & HP_SDC_ACT_DEALLOC) kfree(curr); 427 if (act & HP_SDC_ACT_DEALLOC)
428 kfree(curr);
395 hp_sdc.tq[curridx] = NULL; 429 hp_sdc.tq[curridx] = NULL;
396 /* Interleave outbound data between the transactions. */ 430 /* Interleave outbound data between the transactions. */
397 hp_sdc.wcurr++; 431 hp_sdc.wcurr++;
398 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN) hp_sdc.wcurr = 0; 432 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN)
399 goto finish; 433 hp_sdc.wcurr = 0;
434 goto finish;
400 } 435 }
401 436
402 while (act & HP_SDC_ACT_PRECMD) { 437 while (act & HP_SDC_ACT_PRECMD) {
@@ -409,9 +444,10 @@ unsigned long hp_sdc_put(void) {
409 curr->idx++; 444 curr->idx++;
410 /* act finished? */ 445 /* act finished? */
411 if ((act & HP_SDC_ACT_DURING) == HP_SDC_ACT_PRECMD) 446 if ((act & HP_SDC_ACT_DURING) == HP_SDC_ACT_PRECMD)
412 goto actdone; 447 goto actdone;
413 /* skip quantity field if data-out sequence follows. */ 448 /* skip quantity field if data-out sequence follows. */
414 if (act & HP_SDC_ACT_DATAOUT) curr->idx++; 449 if (act & HP_SDC_ACT_DATAOUT)
450 curr->idx++;
415 goto finish; 451 goto finish;
416 } 452 }
417 if (act & HP_SDC_ACT_DATAOUT) { 453 if (act & HP_SDC_ACT_DATAOUT) {
@@ -423,15 +459,15 @@ unsigned long hp_sdc_put(void) {
423 hp_sdc_data_out8(curr->seq[curr->idx]); 459 hp_sdc_data_out8(curr->seq[curr->idx]);
424 curr->idx++; 460 curr->idx++;
425 /* act finished? */ 461 /* act finished? */
426 if ((curr->idx - idx >= qty) && 462 if (curr->idx - idx >= qty &&
427 ((act & HP_SDC_ACT_DURING) == HP_SDC_ACT_DATAOUT)) 463 (act & HP_SDC_ACT_DURING) == HP_SDC_ACT_DATAOUT)
428 goto actdone; 464 goto actdone;
429 goto finish; 465 goto finish;
430 } 466 }
431 idx += qty; 467 idx += qty;
432 act &= ~HP_SDC_ACT_DATAOUT; 468 act &= ~HP_SDC_ACT_DATAOUT;
433 } 469 } else
434 else while (act & HP_SDC_ACT_DATAREG) { 470 while (act & HP_SDC_ACT_DATAREG) {
435 int mask; 471 int mask;
436 uint8_t w7[4]; 472 uint8_t w7[4];
437 473
@@ -445,26 +481,30 @@ unsigned long hp_sdc_put(void) {
445 act &= ~HP_SDC_ACT_DATAREG; 481 act &= ~HP_SDC_ACT_DATAREG;
446 break; 482 break;
447 } 483 }
448 484
449 w7[0] = (mask & 1) ? curr->seq[++idx] : hp_sdc.r7[0]; 485 w7[0] = (mask & 1) ? curr->seq[++idx] : hp_sdc.r7[0];
450 w7[1] = (mask & 2) ? curr->seq[++idx] : hp_sdc.r7[1]; 486 w7[1] = (mask & 2) ? curr->seq[++idx] : hp_sdc.r7[1];
451 w7[2] = (mask & 4) ? curr->seq[++idx] : hp_sdc.r7[2]; 487 w7[2] = (mask & 4) ? curr->seq[++idx] : hp_sdc.r7[2];
452 w7[3] = (mask & 8) ? curr->seq[++idx] : hp_sdc.r7[3]; 488 w7[3] = (mask & 8) ? curr->seq[++idx] : hp_sdc.r7[3];
453 489
454 if (hp_sdc.wi > 0x73 || hp_sdc.wi < 0x70 || 490 if (hp_sdc.wi > 0x73 || hp_sdc.wi < 0x70 ||
455 w7[hp_sdc.wi-0x70] == hp_sdc.r7[hp_sdc.wi-0x70]) { 491 w7[hp_sdc.wi - 0x70] == hp_sdc.r7[hp_sdc.wi - 0x70]) {
456 int i = 0; 492 int i = 0;
457 493
458 /* Need to point the write index register */ 494 /* Need to point the write index register */
459 while ((i < 4) && w7[i] == hp_sdc.r7[i]) i++; 495 while (i < 4 && w7[i] == hp_sdc.r7[i])
496 i++;
497
460 if (i < 4) { 498 if (i < 4) {
461 hp_sdc_status_out8(HP_SDC_CMD_SET_D0 + i); 499 hp_sdc_status_out8(HP_SDC_CMD_SET_D0 + i);
462 hp_sdc.wi = 0x70 + i; 500 hp_sdc.wi = 0x70 + i;
463 goto finish; 501 goto finish;
464 } 502 }
503
465 idx++; 504 idx++;
466 if ((act & HP_SDC_ACT_DURING) == HP_SDC_ACT_DATAREG) 505 if ((act & HP_SDC_ACT_DURING) == HP_SDC_ACT_DATAREG)
467 goto actdone; 506 goto actdone;
507
468 curr->idx = idx; 508 curr->idx = idx;
469 act &= ~HP_SDC_ACT_DATAREG; 509 act &= ~HP_SDC_ACT_DATAREG;
470 break; 510 break;
@@ -476,12 +516,13 @@ unsigned long hp_sdc_put(void) {
476 { 516 {
477 int i = 0; 517 int i = 0;
478 518
479 while ((i < 4) && w7[i] == hp_sdc.r7[i]) i++; 519 while ((i < 4) && w7[i] == hp_sdc.r7[i])
520 i++;
480 if (i >= 4) { 521 if (i >= 4) {
481 curr->idx = idx + 1; 522 curr->idx = idx + 1;
482 if ((act & HP_SDC_ACT_DURING) == 523 if ((act & HP_SDC_ACT_DURING) ==
483 HP_SDC_ACT_DATAREG) 524 HP_SDC_ACT_DATAREG)
484 goto actdone; 525 goto actdone;
485 } 526 }
486 } 527 }
487 goto finish; 528 goto finish;
@@ -497,7 +538,7 @@ unsigned long hp_sdc_put(void) {
497 538
498 539
499 if (act & HP_SDC_ACT_POSTCMD) { 540 if (act & HP_SDC_ACT_POSTCMD) {
500 uint8_t postcmd; 541 uint8_t postcmd;
501 542
502 /* curr->idx should == idx at this point. */ 543 /* curr->idx should == idx at this point. */
503 postcmd = curr->seq[idx]; 544 postcmd = curr->seq[idx];
@@ -505,12 +546,12 @@ unsigned long hp_sdc_put(void) {
505 if (act & HP_SDC_ACT_DATAIN) { 546 if (act & HP_SDC_ACT_DATAIN) {
506 547
507 /* Start a new read */ 548 /* Start a new read */
508 hp_sdc.rqty = curr->seq[curr->idx]; 549 hp_sdc.rqty = curr->seq[curr->idx];
509 do_gettimeofday(&hp_sdc.rtv); 550 do_gettimeofday(&hp_sdc.rtv);
510 curr->idx++; 551 curr->idx++;
511 /* Still need to lock here in case of spurious irq. */ 552 /* Still need to lock here in case of spurious irq. */
512 write_lock_irq(&hp_sdc.rtq_lock); 553 write_lock_irq(&hp_sdc.rtq_lock);
513 hp_sdc.rcurr = curridx; 554 hp_sdc.rcurr = curridx;
514 write_unlock_irq(&hp_sdc.rtq_lock); 555 write_unlock_irq(&hp_sdc.rtq_lock);
515 hp_sdc_status_out8(postcmd); 556 hp_sdc_status_out8(postcmd);
516 goto finish; 557 goto finish;
@@ -519,75 +560,86 @@ unsigned long hp_sdc_put(void) {
519 goto actdone; 560 goto actdone;
520 } 561 }
521 562
522actdone: 563 actdone:
523 if (act & HP_SDC_ACT_SEMAPHORE) { 564 if (act & HP_SDC_ACT_SEMAPHORE)
524 up(curr->act.semaphore); 565 up(curr->act.semaphore);
525 } 566 else if (act & HP_SDC_ACT_CALLBACK)
526 else if (act & HP_SDC_ACT_CALLBACK) {
527 curr->act.irqhook(0,NULL,0,0); 567 curr->act.irqhook(0,NULL,0,0);
528 } 568
529 if (curr->idx >= curr->endidx) { /* This transaction is over. */ 569 if (curr->idx >= curr->endidx) { /* This transaction is over. */
530 if (act & HP_SDC_ACT_DEALLOC) kfree(curr); 570 if (act & HP_SDC_ACT_DEALLOC)
571 kfree(curr);
531 hp_sdc.tq[curridx] = NULL; 572 hp_sdc.tq[curridx] = NULL;
532 } 573 } else {
533 else {
534 curr->actidx = idx + 1; 574 curr->actidx = idx + 1;
535 curr->idx = idx + 2; 575 curr->idx = idx + 2;
536 } 576 }
537 /* Interleave outbound data between the transactions. */ 577 /* Interleave outbound data between the transactions. */
538 hp_sdc.wcurr++; 578 hp_sdc.wcurr++;
539 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN) hp_sdc.wcurr = 0; 579 if (hp_sdc.wcurr >= HP_SDC_QUEUE_LEN)
580 hp_sdc.wcurr = 0;
540 581
541 finish: 582 finish:
542 /* If by some quirk IBF has cleared and our ISR has run to 583 /* If by some quirk IBF has cleared and our ISR has run to
543 see that that has happened, do it all again. */ 584 see that that has happened, do it all again. */
544 if (!hp_sdc.ibf && limit++ < 20) goto anew; 585 if (!hp_sdc.ibf && limit++ < 20)
586 goto anew;
545 587
546 done: 588 done:
547 if (hp_sdc.wcurr >= 0) tasklet_schedule(&hp_sdc.task); 589 if (hp_sdc.wcurr >= 0)
590 tasklet_schedule(&hp_sdc.task);
548 write_unlock(&hp_sdc.lock); 591 write_unlock(&hp_sdc.lock);
592
549 return 0; 593 return 0;
550} 594}
551 595
552/******* Functions called in either user or kernel context ****/ 596/******* Functions called in either user or kernel context ****/
553int hp_sdc_enqueue_transaction(hp_sdc_transaction *this) { 597int __hp_sdc_enqueue_transaction(hp_sdc_transaction *this)
554 unsigned long flags; 598{
555 int i; 599 int i;
556 600
557 if (this == NULL) { 601 if (this == NULL) {
558 tasklet_schedule(&hp_sdc.task); 602 BUG();
559 return -EINVAL; 603 return -EINVAL;
560 }; 604 }
561
562 write_lock_irqsave(&hp_sdc.lock, flags);
563 605
564 /* Can't have same transaction on queue twice */ 606 /* Can't have same transaction on queue twice */
565 for (i=0; i < HP_SDC_QUEUE_LEN; i++) 607 for (i = 0; i < HP_SDC_QUEUE_LEN; i++)
566 if (hp_sdc.tq[i] == this) goto fail; 608 if (hp_sdc.tq[i] == this)
609 goto fail;
567 610
568 this->actidx = 0; 611 this->actidx = 0;
569 this->idx = 1; 612 this->idx = 1;
570 613
571 /* Search for empty slot */ 614 /* Search for empty slot */
572 for (i=0; i < HP_SDC_QUEUE_LEN; i++) { 615 for (i = 0; i < HP_SDC_QUEUE_LEN; i++)
573 if (hp_sdc.tq[i] == NULL) { 616 if (hp_sdc.tq[i] == NULL) {
574 hp_sdc.tq[i] = this; 617 hp_sdc.tq[i] = this;
575 write_unlock_irqrestore(&hp_sdc.lock, flags);
576 tasklet_schedule(&hp_sdc.task); 618 tasklet_schedule(&hp_sdc.task);
577 return 0; 619 return 0;
578 } 620 }
579 } 621
580 write_unlock_irqrestore(&hp_sdc.lock, flags);
581 printk(KERN_WARNING PREFIX "No free slot to add transaction.\n"); 622 printk(KERN_WARNING PREFIX "No free slot to add transaction.\n");
582 return -EBUSY; 623 return -EBUSY;
583 624
584 fail: 625 fail:
585 write_unlock_irqrestore(&hp_sdc.lock,flags);
586 printk(KERN_WARNING PREFIX "Transaction add failed: transaction already queued?\n"); 626 printk(KERN_WARNING PREFIX "Transaction add failed: transaction already queued?\n");
587 return -EINVAL; 627 return -EINVAL;
588} 628}
589 629
590int hp_sdc_dequeue_transaction(hp_sdc_transaction *this) { 630int hp_sdc_enqueue_transaction(hp_sdc_transaction *this) {
631 unsigned long flags;
632 int ret;
633
634 write_lock_irqsave(&hp_sdc.lock, flags);
635 ret = __hp_sdc_enqueue_transaction(this);
636 write_unlock_irqrestore(&hp_sdc.lock,flags);
637
638 return ret;
639}
640
641int hp_sdc_dequeue_transaction(hp_sdc_transaction *this)
642{
591 unsigned long flags; 643 unsigned long flags;
592 int i; 644 int i;
593 645
@@ -595,8 +647,9 @@ int hp_sdc_dequeue_transaction(hp_sdc_transaction *this) {
595 647
596 /* TODO: don't remove it if it's not done. */ 648 /* TODO: don't remove it if it's not done. */
597 649
598 for (i=0; i < HP_SDC_QUEUE_LEN; i++) 650 for (i = 0; i < HP_SDC_QUEUE_LEN; i++)
599 if (hp_sdc.tq[i] == this) hp_sdc.tq[i] = NULL; 651 if (hp_sdc.tq[i] == this)
652 hp_sdc.tq[i] = NULL;
600 653
601 write_unlock_irqrestore(&hp_sdc.lock, flags); 654 write_unlock_irqrestore(&hp_sdc.lock, flags);
602 return 0; 655 return 0;
@@ -605,11 +658,11 @@ int hp_sdc_dequeue_transaction(hp_sdc_transaction *this) {
605 658
606 659
607/********************** User context functions **************************/ 660/********************** User context functions **************************/
608int hp_sdc_request_timer_irq(hp_sdc_irqhook *callback) { 661int hp_sdc_request_timer_irq(hp_sdc_irqhook *callback)
609 662{
610 if (callback == NULL || hp_sdc.dev == NULL) { 663 if (callback == NULL || hp_sdc.dev == NULL)
611 return -EINVAL; 664 return -EINVAL;
612 } 665
613 write_lock_irq(&hp_sdc.hook_lock); 666 write_lock_irq(&hp_sdc.hook_lock);
614 if (hp_sdc.timer != NULL) { 667 if (hp_sdc.timer != NULL) {
615 write_unlock_irq(&hp_sdc.hook_lock); 668 write_unlock_irq(&hp_sdc.hook_lock);
@@ -629,11 +682,11 @@ int hp_sdc_request_timer_irq(hp_sdc_irqhook *callback) {
629 return 0; 682 return 0;
630} 683}
631 684
632int hp_sdc_request_hil_irq(hp_sdc_irqhook *callback) { 685int hp_sdc_request_hil_irq(hp_sdc_irqhook *callback)
633 686{
634 if (callback == NULL || hp_sdc.dev == NULL) { 687 if (callback == NULL || hp_sdc.dev == NULL)
635 return -EINVAL; 688 return -EINVAL;
636 } 689
637 write_lock_irq(&hp_sdc.hook_lock); 690 write_lock_irq(&hp_sdc.hook_lock);
638 if (hp_sdc.hil != NULL) { 691 if (hp_sdc.hil != NULL) {
639 write_unlock_irq(&hp_sdc.hook_lock); 692 write_unlock_irq(&hp_sdc.hook_lock);
@@ -650,11 +703,11 @@ int hp_sdc_request_hil_irq(hp_sdc_irqhook *callback) {
650 return 0; 703 return 0;
651} 704}
652 705
653int hp_sdc_request_cooked_irq(hp_sdc_irqhook *callback) { 706int hp_sdc_request_cooked_irq(hp_sdc_irqhook *callback)
654 707{
655 if (callback == NULL || hp_sdc.dev == NULL) { 708 if (callback == NULL || hp_sdc.dev == NULL)
656 return -EINVAL; 709 return -EINVAL;
657 } 710
658 write_lock_irq(&hp_sdc.hook_lock); 711 write_lock_irq(&hp_sdc.hook_lock);
659 if (hp_sdc.cooked != NULL) { 712 if (hp_sdc.cooked != NULL) {
660 write_unlock_irq(&hp_sdc.hook_lock); 713 write_unlock_irq(&hp_sdc.hook_lock);
@@ -672,9 +725,8 @@ int hp_sdc_request_cooked_irq(hp_sdc_irqhook *callback) {
672 return 0; 725 return 0;
673} 726}
674 727
675int hp_sdc_release_timer_irq(hp_sdc_irqhook *callback) { 728int hp_sdc_release_timer_irq(hp_sdc_irqhook *callback)
676 729{
677
678 write_lock_irq(&hp_sdc.hook_lock); 730 write_lock_irq(&hp_sdc.hook_lock);
679 if ((callback != hp_sdc.timer) || 731 if ((callback != hp_sdc.timer) ||
680 (hp_sdc.timer == NULL)) { 732 (hp_sdc.timer == NULL)) {
@@ -694,8 +746,8 @@ int hp_sdc_release_timer_irq(hp_sdc_irqhook *callback) {
694 return 0; 746 return 0;
695} 747}
696 748
697int hp_sdc_release_hil_irq(hp_sdc_irqhook *callback) { 749int hp_sdc_release_hil_irq(hp_sdc_irqhook *callback)
698 750{
699 write_lock_irq(&hp_sdc.hook_lock); 751 write_lock_irq(&hp_sdc.hook_lock);
700 if ((callback != hp_sdc.hil) || 752 if ((callback != hp_sdc.hil) ||
701 (hp_sdc.hil == NULL)) { 753 (hp_sdc.hil == NULL)) {
@@ -715,8 +767,8 @@ int hp_sdc_release_hil_irq(hp_sdc_irqhook *callback) {
715 return 0; 767 return 0;
716} 768}
717 769
718int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback) { 770int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback)
719 771{
720 write_lock_irq(&hp_sdc.hook_lock); 772 write_lock_irq(&hp_sdc.hook_lock);
721 if ((callback != hp_sdc.cooked) || 773 if ((callback != hp_sdc.cooked) ||
722 (hp_sdc.cooked == NULL)) { 774 (hp_sdc.cooked == NULL)) {
@@ -738,7 +790,8 @@ int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback) {
738 790
739/************************* Keepalive timer task *********************/ 791/************************* Keepalive timer task *********************/
740 792
741void hp_sdc_kicker (unsigned long data) { 793void hp_sdc_kicker (unsigned long data)
794{
742 tasklet_schedule(&hp_sdc.task); 795 tasklet_schedule(&hp_sdc.task);
743 /* Re-insert the periodic task. */ 796 /* Re-insert the periodic task. */
744 mod_timer(&hp_sdc.kicker, jiffies + HZ); 797 mod_timer(&hp_sdc.kicker, jiffies + HZ);
@@ -748,12 +801,12 @@ void hp_sdc_kicker (unsigned long data) {
748 801
749#if defined(__hppa__) 802#if defined(__hppa__)
750 803
751static struct parisc_device_id hp_sdc_tbl[] = { 804static const struct parisc_device_id hp_sdc_tbl[] = {
752 { 805 {
753 .hw_type = HPHW_FIO, 806 .hw_type = HPHW_FIO,
754 .hversion_rev = HVERSION_REV_ANY_ID, 807 .hversion_rev = HVERSION_REV_ANY_ID,
755 .hversion = HVERSION_ANY_ID, 808 .hversion = HVERSION_ANY_ID,
756 .sversion = 0x73, 809 .sversion = 0x73,
757 }, 810 },
758 { 0, } 811 { 0, }
759}; 812};
@@ -772,16 +825,15 @@ static struct parisc_driver hp_sdc_driver = {
772 825
773static int __init hp_sdc_init(void) 826static int __init hp_sdc_init(void)
774{ 827{
775 int i;
776 char *errstr; 828 char *errstr;
777 hp_sdc_transaction t_sync; 829 hp_sdc_transaction t_sync;
778 uint8_t ts_sync[6]; 830 uint8_t ts_sync[6];
779 struct semaphore s_sync; 831 struct semaphore s_sync;
780 832
781 rwlock_init(&hp_sdc.lock); 833 rwlock_init(&hp_sdc.lock);
782 rwlock_init(&hp_sdc.ibf_lock); 834 rwlock_init(&hp_sdc.ibf_lock);
783 rwlock_init(&hp_sdc.rtq_lock); 835 rwlock_init(&hp_sdc.rtq_lock);
784 rwlock_init(&hp_sdc.hook_lock); 836 rwlock_init(&hp_sdc.hook_lock);
785 837
786 hp_sdc.timer = NULL; 838 hp_sdc.timer = NULL;
787 hp_sdc.hil = NULL; 839 hp_sdc.hil = NULL;
@@ -796,7 +848,8 @@ static int __init hp_sdc_init(void)
796 hp_sdc.r7[3] = 0xff; 848 hp_sdc.r7[3] = 0xff;
797 hp_sdc.ibf = 1; 849 hp_sdc.ibf = 1;
798 850
799 for (i = 0; i < HP_SDC_QUEUE_LEN; i++) hp_sdc.tq[i] = NULL; 851 memset(&hp_sdc.tq, 0, sizeof(hp_sdc.tq));
852
800 hp_sdc.wcurr = -1; 853 hp_sdc.wcurr = -1;
801 hp_sdc.rcurr = -1; 854 hp_sdc.rcurr = -1;
802 hp_sdc.rqty = 0; 855 hp_sdc.rqty = 0;
@@ -804,27 +857,32 @@ static int __init hp_sdc_init(void)
804 hp_sdc.dev_err = -ENODEV; 857 hp_sdc.dev_err = -ENODEV;
805 858
806 errstr = "IO not found for"; 859 errstr = "IO not found for";
807 if (!hp_sdc.base_io) goto err0; 860 if (!hp_sdc.base_io)
861 goto err0;
808 862
809 errstr = "IRQ not found for"; 863 errstr = "IRQ not found for";
810 if (!hp_sdc.irq) goto err0; 864 if (!hp_sdc.irq)
865 goto err0;
811 866
812 hp_sdc.dev_err = -EBUSY; 867 hp_sdc.dev_err = -EBUSY;
813 868
814#if defined(__hppa__) 869#if defined(__hppa__)
815 errstr = "IO not available for"; 870 errstr = "IO not available for";
816 if (request_region(hp_sdc.data_io, 2, hp_sdc_driver.name)) goto err0; 871 if (request_region(hp_sdc.data_io, 2, hp_sdc_driver.name))
817#endif 872 goto err0;
873#endif
818 874
819 errstr = "IRQ not available for"; 875 errstr = "IRQ not available for";
820 if(request_irq(hp_sdc.irq, &hp_sdc_isr, 0, "HP SDC", 876 if (request_irq(hp_sdc.irq, &hp_sdc_isr, IRQF_SHARED|IRQF_SAMPLE_RANDOM,
821 (void *) hp_sdc.base_io)) goto err1; 877 "HP SDC", &hp_sdc))
878 goto err1;
822 879
823 errstr = "NMI not available for"; 880 errstr = "NMI not available for";
824 if (request_irq(hp_sdc.nmi, &hp_sdc_nmisr, 0, "HP SDC NMI", 881 if (request_irq(hp_sdc.nmi, &hp_sdc_nmisr, IRQF_SHARED,
825 (void *) hp_sdc.base_io)) goto err2; 882 "HP SDC NMI", &hp_sdc))
883 goto err2;
826 884
827 printk(KERN_INFO PREFIX "HP SDC at 0x%p, IRQ %d (NMI IRQ %d)\n", 885 printk(KERN_INFO PREFIX "HP SDC at 0x%p, IRQ %d (NMI IRQ %d)\n",
828 (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi); 886 (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi);
829 887
830 hp_sdc_status_in8(); 888 hp_sdc_status_in8();
@@ -854,13 +912,14 @@ static int __init hp_sdc_init(void)
854 hp_sdc.dev_err = 0; 912 hp_sdc.dev_err = 0;
855 return 0; 913 return 0;
856 err2: 914 err2:
857 free_irq(hp_sdc.irq, NULL); 915 free_irq(hp_sdc.irq, &hp_sdc);
858 err1: 916 err1:
859 release_region(hp_sdc.data_io, 2); 917 release_region(hp_sdc.data_io, 2);
860 err0: 918 err0:
861 printk(KERN_WARNING PREFIX ": %s SDC IO=0x%p IRQ=0x%x NMI=0x%x\n", 919 printk(KERN_WARNING PREFIX ": %s SDC IO=0x%p IRQ=0x%x NMI=0x%x\n",
862 errstr, (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi); 920 errstr, (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi);
863 hp_sdc.dev = NULL; 921 hp_sdc.dev = NULL;
922
864 return hp_sdc.dev_err; 923 return hp_sdc.dev_err;
865} 924}
866 925
@@ -868,8 +927,10 @@ static int __init hp_sdc_init(void)
868 927
869static int __init hp_sdc_init_hppa(struct parisc_device *d) 928static int __init hp_sdc_init_hppa(struct parisc_device *d)
870{ 929{
871 if (!d) return 1; 930 if (!d)
872 if (hp_sdc.dev != NULL) return 1; /* We only expect one SDC */ 931 return 1;
932 if (hp_sdc.dev != NULL)
933 return 1; /* We only expect one SDC */
873 934
874 hp_sdc.dev = d; 935 hp_sdc.dev = d;
875 hp_sdc.irq = d->irq; 936 hp_sdc.irq = d->irq;
@@ -898,18 +959,16 @@ static void hp_sdc_exit(void)
898 /* Wait until we know this has been processed by the i8042 */ 959 /* Wait until we know this has been processed by the i8042 */
899 hp_sdc_spin_ibf(); 960 hp_sdc_spin_ibf();
900 961
901 free_irq(hp_sdc.nmi, NULL); 962 free_irq(hp_sdc.nmi, &hp_sdc);
902 free_irq(hp_sdc.irq, NULL); 963 free_irq(hp_sdc.irq, &hp_sdc);
903 write_unlock_irq(&hp_sdc.lock); 964 write_unlock_irq(&hp_sdc.lock);
904 965
905 del_timer(&hp_sdc.kicker); 966 del_timer(&hp_sdc.kicker);
906 967
907 tasklet_kill(&hp_sdc.task); 968 tasklet_kill(&hp_sdc.task);
908 969
909/* release_region(hp_sdc.data_io, 2); */
910
911#if defined(__hppa__) 970#if defined(__hppa__)
912 if (unregister_parisc_driver(&hp_sdc_driver)) 971 if (unregister_parisc_driver(&hp_sdc_driver))
913 printk(KERN_WARNING PREFIX "Error unregistering HP SDC"); 972 printk(KERN_WARNING PREFIX "Error unregistering HP SDC");
914#endif 973#endif
915} 974}
@@ -923,7 +982,7 @@ static int __init hp_sdc_register(void)
923 mm_segment_t fs; 982 mm_segment_t fs;
924 unsigned char i; 983 unsigned char i;
925#endif 984#endif
926 985
927 hp_sdc.dev = NULL; 986 hp_sdc.dev = NULL;
928 hp_sdc.dev_err = 0; 987 hp_sdc.dev_err = 0;
929#if defined(__hppa__) 988#if defined(__hppa__)
@@ -960,8 +1019,8 @@ static int __init hp_sdc_register(void)
960 tq_init.seq = tq_init_seq; 1019 tq_init.seq = tq_init_seq;
961 tq_init.act.semaphore = &tq_init_sem; 1020 tq_init.act.semaphore = &tq_init_sem;
962 1021
963 tq_init_seq[0] = 1022 tq_init_seq[0] =
964 HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN | HP_SDC_ACT_SEMAPHORE; 1023 HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN | HP_SDC_ACT_SEMAPHORE;
965 tq_init_seq[1] = HP_SDC_CMD_READ_KCC; 1024 tq_init_seq[1] = HP_SDC_CMD_READ_KCC;
966 tq_init_seq[2] = 1; 1025 tq_init_seq[2] = 1;
967 tq_init_seq[3] = 0; 1026 tq_init_seq[3] = 0;
@@ -979,13 +1038,13 @@ static int __init hp_sdc_register(void)
979 } 1038 }
980 hp_sdc.r11 = tq_init_seq[4]; 1039 hp_sdc.r11 = tq_init_seq[4];
981 if (hp_sdc.r11 & HP_SDC_CFG_NEW) { 1040 if (hp_sdc.r11 & HP_SDC_CFG_NEW) {
982 char *str; 1041 const char *str;
983 printk(KERN_INFO PREFIX "New style SDC\n"); 1042 printk(KERN_INFO PREFIX "New style SDC\n");
984 tq_init_seq[1] = HP_SDC_CMD_READ_XTD; 1043 tq_init_seq[1] = HP_SDC_CMD_READ_XTD;
985 tq_init.actidx = 0; 1044 tq_init.actidx = 0;
986 tq_init.idx = 1; 1045 tq_init.idx = 1;
987 down(&tq_init_sem); 1046 down(&tq_init_sem);
988 hp_sdc_enqueue_transaction(&tq_init); 1047 hp_sdc_enqueue_transaction(&tq_init);
989 down(&tq_init_sem); 1048 down(&tq_init_sem);
990 up(&tq_init_sem); 1049 up(&tq_init_sem);
991 if ((tq_init_seq[0] & HP_SDC_ACT_DEAD) == HP_SDC_ACT_DEAD) { 1050 if ((tq_init_seq[0] & HP_SDC_ACT_DEAD) == HP_SDC_ACT_DEAD) {
@@ -995,15 +1054,13 @@ static int __init hp_sdc_register(void)
995 hp_sdc.r7e = tq_init_seq[4]; 1054 hp_sdc.r7e = tq_init_seq[4];
996 HP_SDC_XTD_REV_STRINGS(hp_sdc.r7e & HP_SDC_XTD_REV, str) 1055 HP_SDC_XTD_REV_STRINGS(hp_sdc.r7e & HP_SDC_XTD_REV, str)
997 printk(KERN_INFO PREFIX "Revision: %s\n", str); 1056 printk(KERN_INFO PREFIX "Revision: %s\n", str);
998 if (hp_sdc.r7e & HP_SDC_XTD_BEEPER) { 1057 if (hp_sdc.r7e & HP_SDC_XTD_BEEPER)
999 printk(KERN_INFO PREFIX "TI SN76494 beeper present\n"); 1058 printk(KERN_INFO PREFIX "TI SN76494 beeper present\n");
1000 } 1059 if (hp_sdc.r7e & HP_SDC_XTD_BBRTC)
1001 if (hp_sdc.r7e & HP_SDC_XTD_BBRTC) {
1002 printk(KERN_INFO PREFIX "OKI MSM-58321 BBRTC present\n"); 1060 printk(KERN_INFO PREFIX "OKI MSM-58321 BBRTC present\n");
1003 }
1004 printk(KERN_INFO PREFIX "Spunking the self test register to force PUP " 1061 printk(KERN_INFO PREFIX "Spunking the self test register to force PUP "
1005 "on next firmware reset.\n"); 1062 "on next firmware reset.\n");
1006 tq_init_seq[0] = HP_SDC_ACT_PRECMD | 1063 tq_init_seq[0] = HP_SDC_ACT_PRECMD |
1007 HP_SDC_ACT_DATAOUT | HP_SDC_ACT_SEMAPHORE; 1064 HP_SDC_ACT_DATAOUT | HP_SDC_ACT_SEMAPHORE;
1008 tq_init_seq[1] = HP_SDC_CMD_SET_STR; 1065 tq_init_seq[1] = HP_SDC_CMD_SET_STR;
1009 tq_init_seq[2] = 1; 1066 tq_init_seq[2] = 1;
@@ -1012,14 +1069,12 @@ static int __init hp_sdc_register(void)
1012 tq_init.idx = 1; 1069 tq_init.idx = 1;
1013 tq_init.endidx = 4; 1070 tq_init.endidx = 4;
1014 down(&tq_init_sem); 1071 down(&tq_init_sem);
1015 hp_sdc_enqueue_transaction(&tq_init); 1072 hp_sdc_enqueue_transaction(&tq_init);
1016 down(&tq_init_sem); 1073 down(&tq_init_sem);
1017 up(&tq_init_sem); 1074 up(&tq_init_sem);
1018 } 1075 } else
1019 else { 1076 printk(KERN_INFO PREFIX "Old style SDC (1820-%s).\n",
1020 printk(KERN_INFO PREFIX "Old style SDC (1820-%s).\n",
1021 (hp_sdc.r11 & HP_SDC_CFG_REV) ? "3300" : "2564/3087"); 1077 (hp_sdc.r11 & HP_SDC_CFG_REV) ? "3300" : "2564/3087");
1022 }
1023 1078
1024 return 0; 1079 return 0;
1025} 1080}
@@ -1027,13 +1082,13 @@ static int __init hp_sdc_register(void)
1027module_init(hp_sdc_register); 1082module_init(hp_sdc_register);
1028module_exit(hp_sdc_exit); 1083module_exit(hp_sdc_exit);
1029 1084
1030/* Timing notes: These measurements taken on my 64MHz 7100-LC (715/64) 1085/* Timing notes: These measurements taken on my 64MHz 7100-LC (715/64)
1031 * cycles cycles-adj time 1086 * cycles cycles-adj time
1032 * between two consecutive mfctl(16)'s: 4 n/a 63ns 1087 * between two consecutive mfctl(16)'s: 4 n/a 63ns
1033 * hp_sdc_spin_ibf when idle: 119 115 1.7us 1088 * hp_sdc_spin_ibf when idle: 119 115 1.7us
1034 * gsc_writeb status register: 83 79 1.2us 1089 * gsc_writeb status register: 83 79 1.2us
1035 * IBF to clear after sending SET_IM: 6204 6006 93us 1090 * IBF to clear after sending SET_IM: 6204 6006 93us
1036 * IBF to clear after sending LOAD_RT: 4467 4352 68us 1091 * IBF to clear after sending LOAD_RT: 4467 4352 68us
1037 * IBF to clear after sending two LOAD_RTs: 18974 18859 295us 1092 * IBF to clear after sending two LOAD_RTs: 18974 18859 295us
1038 * READ_T1, read status/data, IRQ, call handler: 35564 n/a 556us 1093 * READ_T1, read status/data, IRQ, call handler: 35564 n/a 556us
1039 * cmd to ~IBF READ_T1 2nd time right after: 5158403 n/a 81ms 1094 * cmd to ~IBF READ_T1 2nd time right after: 5158403 n/a 81ms
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c
index aa4a8a4ccfdb..c45ea74d53e4 100644
--- a/drivers/input/serio/hp_sdc_mlc.c
+++ b/drivers/input/serio/hp_sdc_mlc.c
@@ -58,12 +58,13 @@ struct hp_sdc_mlc_priv_s {
58} hp_sdc_mlc_priv; 58} hp_sdc_mlc_priv;
59 59
60/************************* Interrupt context ******************************/ 60/************************* Interrupt context ******************************/
61static void hp_sdc_mlc_isr (int irq, void *dev_id, 61static void hp_sdc_mlc_isr (int irq, void *dev_id,
62 uint8_t status, uint8_t data) { 62 uint8_t status, uint8_t data)
63 int idx; 63{
64 int idx;
64 hil_mlc *mlc = &hp_sdc_mlc; 65 hil_mlc *mlc = &hp_sdc_mlc;
65 66
66 write_lock(&(mlc->lock)); 67 write_lock(&mlc->lock);
67 if (mlc->icount < 0) { 68 if (mlc->icount < 0) {
68 printk(KERN_WARNING PREFIX "HIL Overflow!\n"); 69 printk(KERN_WARNING PREFIX "HIL Overflow!\n");
69 up(&mlc->isem); 70 up(&mlc->isem);
@@ -73,239 +74,232 @@ static void hp_sdc_mlc_isr (int irq, void *dev_id,
73 if ((status & HP_SDC_STATUS_IRQMASK) == HP_SDC_STATUS_HILDATA) { 74 if ((status & HP_SDC_STATUS_IRQMASK) == HP_SDC_STATUS_HILDATA) {
74 mlc->ipacket[idx] |= data | HIL_ERR_INT; 75 mlc->ipacket[idx] |= data | HIL_ERR_INT;
75 mlc->icount--; 76 mlc->icount--;
76 if (hp_sdc_mlc_priv.got5x) goto check; 77 if (hp_sdc_mlc_priv.got5x || !idx)
77 if (!idx) goto check; 78 goto check;
78 if ((mlc->ipacket[idx-1] & HIL_PKT_ADDR_MASK) != 79 if ((mlc->ipacket[idx - 1] & HIL_PKT_ADDR_MASK) !=
79 (mlc->ipacket[idx] & HIL_PKT_ADDR_MASK)) { 80 (mlc->ipacket[idx] & HIL_PKT_ADDR_MASK)) {
80 mlc->ipacket[idx] &= ~HIL_PKT_ADDR_MASK; 81 mlc->ipacket[idx] &= ~HIL_PKT_ADDR_MASK;
81 mlc->ipacket[idx] |= (mlc->ipacket[idx-1] 82 mlc->ipacket[idx] |= (mlc->ipacket[idx - 1]
82 & HIL_PKT_ADDR_MASK); 83 & HIL_PKT_ADDR_MASK);
83 } 84 }
84 goto check; 85 goto check;
85 } 86 }
86 /* We know status is 5X */ 87 /* We know status is 5X */
87 if (data & HP_SDC_HIL_ISERR) goto err; 88 if (data & HP_SDC_HIL_ISERR)
88 mlc->ipacket[idx] = 89 goto err;
90 mlc->ipacket[idx] =
89 (data & HP_SDC_HIL_R1MASK) << HIL_PKT_ADDR_SHIFT; 91 (data & HP_SDC_HIL_R1MASK) << HIL_PKT_ADDR_SHIFT;
90 hp_sdc_mlc_priv.got5x = 1; 92 hp_sdc_mlc_priv.got5x = 1;
91 goto out; 93 goto out;
92 94
93 check: 95 check:
94 hp_sdc_mlc_priv.got5x = 0; 96 hp_sdc_mlc_priv.got5x = 0;
95 if (mlc->imatch == 0) goto done; 97 if (mlc->imatch == 0)
96 if ((mlc->imatch == (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) 98 goto done;
97 && (mlc->ipacket[idx] == (mlc->imatch | idx))) goto done; 99 if ((mlc->imatch == (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL))
98 if (mlc->ipacket[idx] == mlc->imatch) goto done; 100 && (mlc->ipacket[idx] == (mlc->imatch | idx)))
101 goto done;
102 if (mlc->ipacket[idx] == mlc->imatch)
103 goto done;
99 goto out; 104 goto out;
100 105
101 err: 106 err:
102 printk(KERN_DEBUG PREFIX "err code %x\n", data); 107 printk(KERN_DEBUG PREFIX "err code %x\n", data);
108
103 switch (data) { 109 switch (data) {
104 case HP_SDC_HIL_RC_DONE: 110 case HP_SDC_HIL_RC_DONE:
105 printk(KERN_WARNING PREFIX "Bastard SDC reconfigured loop!\n"); 111 printk(KERN_WARNING PREFIX "Bastard SDC reconfigured loop!\n");
106 break; 112 break;
113
107 case HP_SDC_HIL_ERR: 114 case HP_SDC_HIL_ERR:
108 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_PERR | 115 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_PERR |
109 HIL_ERR_FERR | HIL_ERR_FOF; 116 HIL_ERR_FERR | HIL_ERR_FOF;
110 break; 117 break;
118
111 case HP_SDC_HIL_TO: 119 case HP_SDC_HIL_TO:
112 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_LERR; 120 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_LERR;
113 break; 121 break;
122
114 case HP_SDC_HIL_RC: 123 case HP_SDC_HIL_RC:
115 printk(KERN_WARNING PREFIX "Bastard SDC decided to reconfigure loop!\n"); 124 printk(KERN_WARNING PREFIX "Bastard SDC decided to reconfigure loop!\n");
116 break; 125 break;
126
117 default: 127 default:
118 printk(KERN_WARNING PREFIX "Unkown HIL Error status (%x)!\n", data); 128 printk(KERN_WARNING PREFIX "Unkown HIL Error status (%x)!\n", data);
119 break; 129 break;
120 } 130 }
131
121 /* No more data will be coming due to an error. */ 132 /* No more data will be coming due to an error. */
122 done: 133 done:
123 tasklet_schedule(mlc->tasklet); 134 tasklet_schedule(mlc->tasklet);
124 up(&(mlc->isem)); 135 up(&mlc->isem);
125 out: 136 out:
126 write_unlock(&(mlc->lock)); 137 write_unlock(&mlc->lock);
127} 138}
128 139
129 140
130/******************** Tasklet or userspace context functions ****************/ 141/******************** Tasklet or userspace context functions ****************/
131 142
132static int hp_sdc_mlc_in (hil_mlc *mlc, suseconds_t timeout) { 143static int hp_sdc_mlc_in(hil_mlc *mlc, suseconds_t timeout)
133 unsigned long flags; 144{
134 struct hp_sdc_mlc_priv_s *priv; 145 struct hp_sdc_mlc_priv_s *priv;
135 int rc = 2; 146 int rc = 2;
136 147
137 priv = mlc->priv; 148 priv = mlc->priv;
138 149
139 write_lock_irqsave(&(mlc->lock), flags);
140
141 /* Try to down the semaphore */ 150 /* Try to down the semaphore */
142 if (down_trylock(&(mlc->isem))) { 151 if (down_trylock(&mlc->isem)) {
143 struct timeval tv; 152 struct timeval tv;
144 if (priv->emtestmode) { 153 if (priv->emtestmode) {
145 mlc->ipacket[0] = 154 mlc->ipacket[0] =
146 HIL_ERR_INT | (mlc->opacket & 155 HIL_ERR_INT | (mlc->opacket &
147 (HIL_PKT_CMD | 156 (HIL_PKT_CMD |
148 HIL_PKT_ADDR_MASK | 157 HIL_PKT_ADDR_MASK |
149 HIL_PKT_DATA_MASK)); 158 HIL_PKT_DATA_MASK));
150 mlc->icount = 14; 159 mlc->icount = 14;
151 /* printk(KERN_DEBUG PREFIX ">[%x]\n", mlc->ipacket[0]); */ 160 /* printk(KERN_DEBUG PREFIX ">[%x]\n", mlc->ipacket[0]); */
152 goto wasup; 161 goto wasup;
153 } 162 }
154 do_gettimeofday(&tv); 163 do_gettimeofday(&tv);
155 tv.tv_usec += 1000000 * (tv.tv_sec - mlc->instart.tv_sec); 164 tv.tv_usec += USEC_PER_SEC * (tv.tv_sec - mlc->instart.tv_sec);
156 if (tv.tv_usec - mlc->instart.tv_usec > mlc->intimeout) { 165 if (tv.tv_usec - mlc->instart.tv_usec > mlc->intimeout) {
157 /* printk("!%i %i", 166 /* printk("!%i %i",
158 tv.tv_usec - mlc->instart.tv_usec, 167 tv.tv_usec - mlc->instart.tv_usec,
159 mlc->intimeout); 168 mlc->intimeout);
160 */ 169 */
161 rc = 1; 170 rc = 1;
162 up(&(mlc->isem)); 171 up(&mlc->isem);
163 } 172 }
164 goto done; 173 goto done;
165 } 174 }
166 wasup: 175 wasup:
167 up(&(mlc->isem)); 176 up(&mlc->isem);
168 rc = 0; 177 rc = 0;
169 goto done;
170 done: 178 done:
171 write_unlock_irqrestore(&(mlc->lock), flags);
172 return rc; 179 return rc;
173} 180}
174 181
175static int hp_sdc_mlc_cts (hil_mlc *mlc) { 182static int hp_sdc_mlc_cts(hil_mlc *mlc)
183{
176 struct hp_sdc_mlc_priv_s *priv; 184 struct hp_sdc_mlc_priv_s *priv;
177 unsigned long flags;
178 185
179 priv = mlc->priv; 186 priv = mlc->priv;
180
181 write_lock_irqsave(&(mlc->lock), flags);
182 187
183 /* Try to down the semaphores -- they should be up. */ 188 /* Try to down the semaphores -- they should be up. */
184 if (down_trylock(&(mlc->isem))) { 189 BUG_ON(down_trylock(&mlc->isem));
185 BUG(); 190 BUG_ON(down_trylock(&mlc->osem));
186 goto busy; 191
187 } 192 up(&mlc->isem);
188 if (down_trylock(&(mlc->osem))) { 193 up(&mlc->osem);
189 BUG();
190 up(&(mlc->isem));
191 goto busy;
192 }
193 up(&(mlc->isem));
194 up(&(mlc->osem));
195 194
196 if (down_trylock(&(mlc->csem))) { 195 if (down_trylock(&mlc->csem)) {
197 if (priv->trans.act.semaphore != &(mlc->csem)) goto poll; 196 if (priv->trans.act.semaphore != &mlc->csem)
198 goto busy; 197 goto poll;
198 else
199 goto busy;
199 } 200 }
200 if (!(priv->tseq[4] & HP_SDC_USE_LOOP)) goto done; 201
202 if (!(priv->tseq[4] & HP_SDC_USE_LOOP))
203 goto done;
201 204
202 poll: 205 poll:
203 priv->trans.act.semaphore = &(mlc->csem); 206 priv->trans.act.semaphore = &mlc->csem;
204 priv->trans.actidx = 0; 207 priv->trans.actidx = 0;
205 priv->trans.idx = 1; 208 priv->trans.idx = 1;
206 priv->trans.endidx = 5; 209 priv->trans.endidx = 5;
207 priv->tseq[0] = 210 priv->tseq[0] =
208 HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN | HP_SDC_ACT_SEMAPHORE; 211 HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN | HP_SDC_ACT_SEMAPHORE;
209 priv->tseq[1] = HP_SDC_CMD_READ_USE; 212 priv->tseq[1] = HP_SDC_CMD_READ_USE;
210 priv->tseq[2] = 1; 213 priv->tseq[2] = 1;
211 priv->tseq[3] = 0; 214 priv->tseq[3] = 0;
212 priv->tseq[4] = 0; 215 priv->tseq[4] = 0;
213 hp_sdc_enqueue_transaction(&(priv->trans)); 216 __hp_sdc_enqueue_transaction(&priv->trans);
214 busy: 217 busy:
215 write_unlock_irqrestore(&(mlc->lock), flags);
216 return 1; 218 return 1;
217 done: 219 done:
218 priv->trans.act.semaphore = &(mlc->osem); 220 priv->trans.act.semaphore = &mlc->osem;
219 up(&(mlc->csem)); 221 up(&mlc->csem);
220 write_unlock_irqrestore(&(mlc->lock), flags);
221 return 0; 222 return 0;
222} 223}
223 224
224static void hp_sdc_mlc_out (hil_mlc *mlc) { 225static void hp_sdc_mlc_out(hil_mlc *mlc)
226{
225 struct hp_sdc_mlc_priv_s *priv; 227 struct hp_sdc_mlc_priv_s *priv;
226 unsigned long flags;
227 228
228 priv = mlc->priv; 229 priv = mlc->priv;
229 230
230 write_lock_irqsave(&(mlc->lock), flags);
231
232 /* Try to down the semaphore -- it should be up. */ 231 /* Try to down the semaphore -- it should be up. */
233 if (down_trylock(&(mlc->osem))) { 232 BUG_ON(down_trylock(&mlc->osem));
234 BUG();
235 goto done;
236 }
237 233
238 if (mlc->opacket & HIL_DO_ALTER_CTRL) goto do_control; 234 if (mlc->opacket & HIL_DO_ALTER_CTRL)
235 goto do_control;
239 236
240 do_data: 237 do_data:
241 if (priv->emtestmode) { 238 if (priv->emtestmode) {
242 up(&(mlc->osem)); 239 up(&mlc->osem);
243 goto done; 240 return;
244 } 241 }
245 /* Shouldn't be sending commands when loop may be busy */ 242 /* Shouldn't be sending commands when loop may be busy */
246 if (down_trylock(&(mlc->csem))) { 243 BUG_ON(down_trylock(&mlc->csem));
247 BUG(); 244 up(&mlc->csem);
248 goto done;
249 }
250 up(&(mlc->csem));
251 245
252 priv->trans.actidx = 0; 246 priv->trans.actidx = 0;
253 priv->trans.idx = 1; 247 priv->trans.idx = 1;
254 priv->trans.act.semaphore = &(mlc->osem); 248 priv->trans.act.semaphore = &mlc->osem;
255 priv->trans.endidx = 6; 249 priv->trans.endidx = 6;
256 priv->tseq[0] = 250 priv->tseq[0] =
257 HP_SDC_ACT_DATAREG | HP_SDC_ACT_POSTCMD | HP_SDC_ACT_SEMAPHORE; 251 HP_SDC_ACT_DATAREG | HP_SDC_ACT_POSTCMD | HP_SDC_ACT_SEMAPHORE;
258 priv->tseq[1] = 0x7; 252 priv->tseq[1] = 0x7;
259 priv->tseq[2] = 253 priv->tseq[2] =
260 (mlc->opacket & 254 (mlc->opacket &
261 (HIL_PKT_ADDR_MASK | HIL_PKT_CMD)) 255 (HIL_PKT_ADDR_MASK | HIL_PKT_CMD))
262 >> HIL_PKT_ADDR_SHIFT; 256 >> HIL_PKT_ADDR_SHIFT;
263 priv->tseq[3] = 257 priv->tseq[3] =
264 (mlc->opacket & HIL_PKT_DATA_MASK) 258 (mlc->opacket & HIL_PKT_DATA_MASK)
265 >> HIL_PKT_DATA_SHIFT; 259 >> HIL_PKT_DATA_SHIFT;
266 priv->tseq[4] = 0; /* No timeout */ 260 priv->tseq[4] = 0; /* No timeout */
267 if (priv->tseq[3] == HIL_CMD_DHR) priv->tseq[4] = 1; 261 if (priv->tseq[3] == HIL_CMD_DHR)
262 priv->tseq[4] = 1;
268 priv->tseq[5] = HP_SDC_CMD_DO_HIL; 263 priv->tseq[5] = HP_SDC_CMD_DO_HIL;
269 goto enqueue; 264 goto enqueue;
270 265
271 do_control: 266 do_control:
272 priv->emtestmode = mlc->opacket & HIL_CTRL_TEST; 267 priv->emtestmode = mlc->opacket & HIL_CTRL_TEST;
273 268
274 /* we cannot emulate this, it should not be used. */ 269 /* we cannot emulate this, it should not be used. */
275 BUG_ON((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE); 270 BUG_ON((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE);
276 271
277 if ((mlc->opacket & HIL_CTRL_ONLY) == HIL_CTRL_ONLY) goto control_only; 272 if ((mlc->opacket & HIL_CTRL_ONLY) == HIL_CTRL_ONLY)
278 if (mlc->opacket & HIL_CTRL_APE) { 273 goto control_only;
279 BUG(); /* Should not send command/data after engaging APE */ 274
280 goto done; 275 /* Should not send command/data after engaging APE */
281 } 276 BUG_ON(mlc->opacket & HIL_CTRL_APE);
282 /* Disengaging APE this way would not be valid either since 277
278 /* Disengaging APE this way would not be valid either since
283 * the loop must be allowed to idle. 279 * the loop must be allowed to idle.
284 * 280 *
285 * So, it works out that we really never actually send control 281 * So, it works out that we really never actually send control
286 * and data when using SDC, we just send the data. 282 * and data when using SDC, we just send the data.
287 */ 283 */
288 goto do_data; 284 goto do_data;
289 285
290 control_only: 286 control_only:
291 priv->trans.actidx = 0; 287 priv->trans.actidx = 0;
292 priv->trans.idx = 1; 288 priv->trans.idx = 1;
293 priv->trans.act.semaphore = &(mlc->osem); 289 priv->trans.act.semaphore = &mlc->osem;
294 priv->trans.endidx = 4; 290 priv->trans.endidx = 4;
295 priv->tseq[0] = 291 priv->tseq[0] =
296 HP_SDC_ACT_PRECMD | HP_SDC_ACT_DATAOUT | HP_SDC_ACT_SEMAPHORE; 292 HP_SDC_ACT_PRECMD | HP_SDC_ACT_DATAOUT | HP_SDC_ACT_SEMAPHORE;
297 priv->tseq[1] = HP_SDC_CMD_SET_LPC; 293 priv->tseq[1] = HP_SDC_CMD_SET_LPC;
298 priv->tseq[2] = 1; 294 priv->tseq[2] = 1;
299 // priv->tseq[3] = (mlc->ddc + 1) | HP_SDC_LPS_ACSUCC; 295 /* priv->tseq[3] = (mlc->ddc + 1) | HP_SDC_LPS_ACSUCC; */
300 priv->tseq[3] = 0; 296 priv->tseq[3] = 0;
301 if (mlc->opacket & HIL_CTRL_APE) { 297 if (mlc->opacket & HIL_CTRL_APE) {
302 priv->tseq[3] |= HP_SDC_LPC_APE_IPF; 298 priv->tseq[3] |= HP_SDC_LPC_APE_IPF;
303 down_trylock(&(mlc->csem)); 299 down_trylock(&mlc->csem);
304 } 300 }
305 enqueue: 301 enqueue:
306 hp_sdc_enqueue_transaction(&(priv->trans)); 302 hp_sdc_enqueue_transaction(&priv->trans);
307 done:
308 write_unlock_irqrestore(&(mlc->lock), flags);
309} 303}
310 304
311static int __init hp_sdc_mlc_init(void) 305static int __init hp_sdc_mlc_init(void)
@@ -316,18 +310,18 @@ static int __init hp_sdc_mlc_init(void)
316 310
317 hp_sdc_mlc_priv.emtestmode = 0; 311 hp_sdc_mlc_priv.emtestmode = 0;
318 hp_sdc_mlc_priv.trans.seq = hp_sdc_mlc_priv.tseq; 312 hp_sdc_mlc_priv.trans.seq = hp_sdc_mlc_priv.tseq;
319 hp_sdc_mlc_priv.trans.act.semaphore = &(mlc->osem); 313 hp_sdc_mlc_priv.trans.act.semaphore = &mlc->osem;
320 hp_sdc_mlc_priv.got5x = 0; 314 hp_sdc_mlc_priv.got5x = 0;
321 315
322 mlc->cts = &hp_sdc_mlc_cts; 316 mlc->cts = &hp_sdc_mlc_cts;
323 mlc->in = &hp_sdc_mlc_in; 317 mlc->in = &hp_sdc_mlc_in;
324 mlc->out = &hp_sdc_mlc_out; 318 mlc->out = &hp_sdc_mlc_out;
319 mlc->priv = &hp_sdc_mlc_priv;
325 320
326 if (hil_mlc_register(mlc)) { 321 if (hil_mlc_register(mlc)) {
327 printk(KERN_WARNING PREFIX "Failed to register MLC structure with hil_mlc\n"); 322 printk(KERN_WARNING PREFIX "Failed to register MLC structure with hil_mlc\n");
328 goto err0; 323 goto err0;
329 } 324 }
330 mlc->priv = &hp_sdc_mlc_priv;
331 325
332 if (hp_sdc_request_hil_irq(&hp_sdc_mlc_isr)) { 326 if (hp_sdc_request_hil_irq(&hp_sdc_mlc_isr)) {
333 printk(KERN_WARNING PREFIX "Request for raw HIL ISR hook denied\n"); 327 printk(KERN_WARNING PREFIX "Request for raw HIL ISR hook denied\n");
@@ -335,10 +329,9 @@ static int __init hp_sdc_mlc_init(void)
335 } 329 }
336 return 0; 330 return 0;
337 err1: 331 err1:
338 if (hil_mlc_unregister(mlc)) { 332 if (hil_mlc_unregister(mlc))
339 printk(KERN_ERR PREFIX "Failed to unregister MLC structure with hil_mlc.\n" 333 printk(KERN_ERR PREFIX "Failed to unregister MLC structure with hil_mlc.\n"
340 "This is bad. Could cause an oops.\n"); 334 "This is bad. Could cause an oops.\n");
341 }
342 err0: 335 err0:
343 return -EBUSY; 336 return -EBUSY;
344} 337}
@@ -346,14 +339,14 @@ static int __init hp_sdc_mlc_init(void)
346static void __exit hp_sdc_mlc_exit(void) 339static void __exit hp_sdc_mlc_exit(void)
347{ 340{
348 hil_mlc *mlc = &hp_sdc_mlc; 341 hil_mlc *mlc = &hp_sdc_mlc;
349 if (hp_sdc_release_hil_irq(&hp_sdc_mlc_isr)) { 342
343 if (hp_sdc_release_hil_irq(&hp_sdc_mlc_isr))
350 printk(KERN_ERR PREFIX "Failed to release the raw HIL ISR hook.\n" 344 printk(KERN_ERR PREFIX "Failed to release the raw HIL ISR hook.\n"
351 "This is bad. Could cause an oops.\n"); 345 "This is bad. Could cause an oops.\n");
352 } 346
353 if (hil_mlc_unregister(mlc)) { 347 if (hil_mlc_unregister(mlc))
354 printk(KERN_ERR PREFIX "Failed to unregister MLC structure with hil_mlc.\n" 348 printk(KERN_ERR PREFIX "Failed to unregister MLC structure with hil_mlc.\n"
355 "This is bad. Could cause an oops.\n"); 349 "This is bad. Could cause an oops.\n");
356 }
357} 350}
358 351
359module_init(hp_sdc_mlc_init); 352module_init(hp_sdc_mlc_init);
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index d36bd5475b6d..6858bc58f0fd 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -160,6 +160,28 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
160 }, 160 },
161 }, 161 },
162 { 162 {
163 /*
164 * No data is coming from the touchscreen unless KBC
165 * is in legacy mode.
166 */
167 .ident = "Panasonic CF-29",
168 .matches = {
169 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
170 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
171 },
172 },
173 {
174 /*
175 * Errors on MUX ports are reported without raising AUXDATA
176 * causing "spurious NAK" messages.
177 */
178 .ident = "HP Pavilion DV4017EA",
179 .matches = {
180 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
181 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
182 },
183 },
184 {
163 .ident = "Toshiba P10", 185 .ident = "Toshiba P10",
164 .matches = { 186 .matches = {
165 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 187 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -280,6 +302,8 @@ static struct pnp_driver i8042_pnp_kbd_driver = {
280}; 302};
281 303
282static struct pnp_device_id pnp_aux_devids[] = { 304static struct pnp_device_id pnp_aux_devids[] = {
305 { .id = "FJC6000", .driver_data = 0 },
306 { .id = "FJC6001", .driver_data = 0 },
283 { .id = "PNP0f03", .driver_data = 0 }, 307 { .id = "PNP0f03", .driver_data = 0 },
284 { .id = "PNP0f0b", .driver_data = 0 }, 308 { .id = "PNP0f0b", .driver_data = 0 },
285 { .id = "PNP0f0e", .driver_data = 0 }, 309 { .id = "PNP0f0e", .driver_data = 0 },
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index db9cca3b65e0..7c17377a65b9 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -768,6 +768,13 @@ static void i8042_controller_reset(void)
768 i8042_flush(); 768 i8042_flush();
769 769
770/* 770/*
771 * Disable both KBD and AUX interfaces so they don't get in the way
772 */
773
774 i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS;
775 i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT);
776
777/*
771 * Disable MUX mode if present. 778 * Disable MUX mode if present.
772 */ 779 */
773 780
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 0a26e0663542..693e3b2a65a3 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -39,7 +39,8 @@
39/* 39/*
40 * This code has been heavily tested on a Nokia 770, and lightly 40 * This code has been heavily tested on a Nokia 770, and lightly
41 * tested on other ads7846 devices (OSK/Mistral, Lubbock). 41 * tested on other ads7846 devices (OSK/Mistral, Lubbock).
42 * Support for ads7843 and ads7845 has only been stubbed in. 42 * Support for ads7843 tested on Atmel at91sam926x-EK.
43 * Support for ads7845 has only been stubbed in.
43 * 44 *
44 * IRQ handling needs a workaround because of a shortcoming in handling 45 * IRQ handling needs a workaround because of a shortcoming in handling
45 * edge triggered IRQs on some platforms like the OMAP1/2. These 46 * edge triggered IRQs on some platforms like the OMAP1/2. These
@@ -246,18 +247,16 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
246 247
247 /* REVISIT: take a few more samples, and compare ... */ 248 /* REVISIT: take a few more samples, and compare ... */
248 249
249 /* maybe off internal vREF */ 250 /* converter in low power mode & enable PENIRQ */
250 if (use_internal) { 251 req->ref_off = PWRDOWN;
251 req->ref_off = REF_OFF; 252 req->xfer[4].tx_buf = &req->ref_off;
252 req->xfer[4].tx_buf = &req->ref_off; 253 req->xfer[4].len = 1;
253 req->xfer[4].len = 1; 254 spi_message_add_tail(&req->xfer[4], &req->msg);
254 spi_message_add_tail(&req->xfer[4], &req->msg); 255
255 256 req->xfer[5].rx_buf = &req->scratch;
256 req->xfer[5].rx_buf = &req->scratch; 257 req->xfer[5].len = 2;
257 req->xfer[5].len = 2; 258 CS_CHANGE(req->xfer[5]);
258 CS_CHANGE(req->xfer[5]); 259 spi_message_add_tail(&req->xfer[5], &req->msg);
259 spi_message_add_tail(&req->xfer[5], &req->msg);
260 }
261 260
262 ts->irq_disabled = 1; 261 ts->irq_disabled = 1;
263 disable_irq(spi->irq); 262 disable_irq(spi->irq);
@@ -536,6 +535,9 @@ static void ads7846_rx(void *ads)
536 } else 535 } else
537 Rt = 0; 536 Rt = 0;
538 537
538 if (ts->model == 7843)
539 Rt = ts->pressure_max / 2;
540
539 /* Sample found inconsistent by debouncing or pressure is beyond 541 /* Sample found inconsistent by debouncing or pressure is beyond
540 * the maximum. Don't report it to user space, repeat at least 542 * the maximum. Don't report it to user space, repeat at least
541 * once more the measurement 543 * once more the measurement
@@ -897,7 +899,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
897 899
898 input_dev->name = "ADS784x Touchscreen"; 900 input_dev->name = "ADS784x Touchscreen";
899 input_dev->phys = ts->phys; 901 input_dev->phys = ts->phys;
900 input_dev->cdev.dev = &spi->dev; 902 input_dev->dev.parent = &spi->dev;
901 903
902 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 904 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
903 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 905 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index e2945582828e..e6a31d118786 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -300,8 +300,7 @@ static int __init corgits_probe(struct platform_device *pdev)
300 input_dev->id.vendor = 0x0001; 300 input_dev->id.vendor = 0x0001;
301 input_dev->id.product = 0x0002; 301 input_dev->id.product = 0x0002;
302 input_dev->id.version = 0x0100; 302 input_dev->id.version = 0x0100;
303 input_dev->cdev.dev = &pdev->dev; 303 input_dev->dev.parent = &pdev->dev;
304 input_dev->private = corgi_ts;
305 304
306 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 305 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
307 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 306 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 9d61cd133d01..557d781719f1 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -312,14 +312,13 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
312 init_completion(&elo->cmd_done); 312 init_completion(&elo->cmd_done);
313 snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); 313 snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys);
314 314
315 input_dev->private = elo;
316 input_dev->name = "Elo Serial TouchScreen"; 315 input_dev->name = "Elo Serial TouchScreen";
317 input_dev->phys = elo->phys; 316 input_dev->phys = elo->phys;
318 input_dev->id.bustype = BUS_RS232; 317 input_dev->id.bustype = BUS_RS232;
319 input_dev->id.vendor = SERIO_ELO; 318 input_dev->id.vendor = SERIO_ELO;
320 input_dev->id.product = elo->id; 319 input_dev->id.product = elo->id;
321 input_dev->id.version = 0x0100; 320 input_dev->id.version = 0x0100;
322 input_dev->cdev.dev = &serio->dev; 321 input_dev->dev.parent = &serio->dev;
323 322
324 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 323 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
325 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 324 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 9157eb148e84..39d602600d7c 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -130,13 +130,13 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
130 gunze->dev = input_dev; 130 gunze->dev = input_dev;
131 snprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys); 131 snprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys);
132 132
133 input_dev->private = gunze;
134 input_dev->name = "Gunze AHL-51S TouchScreen"; 133 input_dev->name = "Gunze AHL-51S TouchScreen";
135 input_dev->phys = gunze->phys; 134 input_dev->phys = gunze->phys;
136 input_dev->id.bustype = BUS_RS232; 135 input_dev->id.bustype = BUS_RS232;
137 input_dev->id.vendor = SERIO_GUNZE; 136 input_dev->id.vendor = SERIO_GUNZE;
138 input_dev->id.product = 0x0051; 137 input_dev->id.product = 0x0051;
139 input_dev->id.version = 0x0100; 138 input_dev->id.version = 0x0100;
139 input_dev->dev.parent = &serio->dev;
140 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 140 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
141 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 141 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
142 input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0); 142 input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0);
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index c4116d4f64e7..09ed7803cb8f 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -147,7 +147,7 @@ enum flite_pwr {
147unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) 147unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr)
148{ 148{
149 unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness; 149 unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness;
150 struct h3600_dev *ts = dev->private; 150 struct h3600_dev *ts = input_get_drvdata(dev);
151 151
152 /* Must be in this order */ 152 /* Must be in this order */
153 ts->serio->write(ts->serio, 1); 153 ts->serio->write(ts->serio, 1);
@@ -260,7 +260,7 @@ static int h3600ts_event(struct input_dev *dev, unsigned int type,
260 unsigned int code, int value) 260 unsigned int code, int value)
261{ 261{
262#if 0 262#if 0
263 struct h3600_dev *ts = dev->private; 263 struct h3600_dev *ts = input_get_drvdata(dev);
264 264
265 switch (type) { 265 switch (type) {
266 case EV_LED: { 266 case EV_LED: {
@@ -367,8 +367,9 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
367 input_dev->id.vendor = SERIO_H3600; 367 input_dev->id.vendor = SERIO_H3600;
368 input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */ 368 input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */
369 input_dev->id.version = 0x0100; 369 input_dev->id.version = 0x0100;
370 input_dev->cdev.dev = &serio->dev; 370 input_dev->dev.parent = &serio->dev;
371 input_dev->private = ts; 371
372 input_set_drvdata(input_dev, ts);
372 373
373 input_dev->event = h3600ts_event; 374 input_dev->event = h3600ts_event;
374 375
diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c
index 249087472740..61c15024c2a0 100644
--- a/drivers/input/touchscreen/hp680_ts_input.c
+++ b/drivers/input/touchscreen/hp680_ts_input.c
@@ -21,7 +21,7 @@
21static void do_softint(void *data); 21static void do_softint(void *data);
22 22
23static struct input_dev *hp680_ts_dev; 23static struct input_dev *hp680_ts_dev;
24static DECLARE_WORK(work, do_softint, 0); 24static DECLARE_WORK(work, do_softint);
25 25
26static void do_softint(void *data) 26static void do_softint(void *data)
27{ 27{
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index c3c2d735d0ec..4ec3b1f940c8 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -144,13 +144,13 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
144 mtouch->dev = input_dev; 144 mtouch->dev = input_dev;
145 snprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys); 145 snprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys);
146 146
147 input_dev->private = mtouch;
148 input_dev->name = "MicroTouch Serial TouchScreen"; 147 input_dev->name = "MicroTouch Serial TouchScreen";
149 input_dev->phys = mtouch->phys; 148 input_dev->phys = mtouch->phys;
150 input_dev->id.bustype = BUS_RS232; 149 input_dev->id.bustype = BUS_RS232;
151 input_dev->id.vendor = SERIO_MICROTOUCH; 150 input_dev->id.vendor = SERIO_MICROTOUCH;
152 input_dev->id.product = 0; 151 input_dev->id.product = 0;
153 input_dev->id.version = 0x0100; 152 input_dev->id.version = 0x0100;
153 input_dev->dev.parent = &serio->dev;
154 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 154 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
155 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 155 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
156 input_set_abs_params(mtouch->dev, ABS_X, MTOUCH_MIN_XC, MTOUCH_MAX_XC, 0, 0); 156 input_set_abs_params(mtouch->dev, ABS_X, MTOUCH_MIN_XC, MTOUCH_MAX_XC, 0, 0);
diff --git a/drivers/input/touchscreen/penmount.c b/drivers/input/touchscreen/penmount.c
index bd2767991ae9..f2c0d3c7149c 100644
--- a/drivers/input/touchscreen/penmount.c
+++ b/drivers/input/touchscreen/penmount.c
@@ -105,14 +105,13 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv)
105 pm->dev = input_dev; 105 pm->dev = input_dev;
106 snprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys); 106 snprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys);
107 107
108 input_dev->private = pm;
109 input_dev->name = "Penmount Serial TouchScreen"; 108 input_dev->name = "Penmount Serial TouchScreen";
110 input_dev->phys = pm->phys; 109 input_dev->phys = pm->phys;
111 input_dev->id.bustype = BUS_RS232; 110 input_dev->id.bustype = BUS_RS232;
112 input_dev->id.vendor = SERIO_PENMOUNT; 111 input_dev->id.vendor = SERIO_PENMOUNT;
113 input_dev->id.product = 0; 112 input_dev->id.product = 0;
114 input_dev->id.version = 0x0100; 113 input_dev->id.version = 0x0100;
115 input_dev->cdev.dev = &serio->dev; 114 input_dev->dev.parent = &serio->dev;
116 115
117 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 116 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
118 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 117 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
diff --git a/drivers/input/touchscreen/touchright.c b/drivers/input/touchscreen/touchright.c
index 35ba46c6ad2d..3def7bb1df44 100644
--- a/drivers/input/touchscreen/touchright.c
+++ b/drivers/input/touchscreen/touchright.c
@@ -118,13 +118,13 @@ static int tr_connect(struct serio *serio, struct serio_driver *drv)
118 tr->dev = input_dev; 118 tr->dev = input_dev;
119 snprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys); 119 snprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys);
120 120
121 input_dev->private = tr;
122 input_dev->name = "Touchright Serial TouchScreen"; 121 input_dev->name = "Touchright Serial TouchScreen";
123 input_dev->phys = tr->phys; 122 input_dev->phys = tr->phys;
124 input_dev->id.bustype = BUS_RS232; 123 input_dev->id.bustype = BUS_RS232;
125 input_dev->id.vendor = SERIO_TOUCHRIGHT; 124 input_dev->id.vendor = SERIO_TOUCHRIGHT;
126 input_dev->id.product = 0; 125 input_dev->id.product = 0;
127 input_dev->id.version = 0x0100; 126 input_dev->id.version = 0x0100;
127 input_dev->dev.parent = &serio->dev;
128 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 128 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
129 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 129 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
130 input_set_abs_params(tr->dev, ABS_X, TR_MIN_XC, TR_MAX_XC, 0, 0); 130 input_set_abs_params(tr->dev, ABS_X, TR_MIN_XC, TR_MAX_XC, 0, 0);
diff --git a/drivers/input/touchscreen/touchwin.c b/drivers/input/touchscreen/touchwin.c
index 4dc073dacabb..ac4bdcf18666 100644
--- a/drivers/input/touchscreen/touchwin.c
+++ b/drivers/input/touchscreen/touchwin.c
@@ -125,13 +125,13 @@ static int tw_connect(struct serio *serio, struct serio_driver *drv)
125 tw->dev = input_dev; 125 tw->dev = input_dev;
126 snprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys); 126 snprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys);
127 127
128 input_dev->private = tw;
129 input_dev->name = "Touchwindow Serial TouchScreen"; 128 input_dev->name = "Touchwindow Serial TouchScreen";
130 input_dev->phys = tw->phys; 129 input_dev->phys = tw->phys;
131 input_dev->id.bustype = BUS_RS232; 130 input_dev->id.bustype = BUS_RS232;
132 input_dev->id.vendor = SERIO_TOUCHWIN; 131 input_dev->id.vendor = SERIO_TOUCHWIN;
133 input_dev->id.product = 0; 132 input_dev->id.product = 0;
134 input_dev->id.version = 0x0100; 133 input_dev->id.version = 0x0100;
134 input_dev->dev.parent = &serio->dev;
135 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 135 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
136 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 136 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
137 input_set_abs_params(tw->dev, ABS_X, TW_MIN_XC, TW_MAX_XC, 0, 0); 137 input_set_abs_params(tw->dev, ABS_X, TW_MIN_XC, TW_MAX_XC, 0, 0);
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index e8606c48c9c3..6582816a0477 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -97,6 +97,8 @@ struct ucb1400 {
97}; 97};
98 98
99static int adcsync; 99static int adcsync;
100static int ts_delay = 55; /* us */
101static int ts_delay_pressure; /* us */
100 102
101static inline u16 ucb1400_reg_read(struct ucb1400 *ucb, u16 reg) 103static inline u16 ucb1400_reg_read(struct ucb1400 *ucb, u16 reg)
102{ 104{
@@ -159,6 +161,7 @@ static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400 *ucb)
159 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | 161 UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
160 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | 162 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
161 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); 163 UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
164 udelay(ts_delay_pressure);
162 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY); 165 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY);
163} 166}
164 167
@@ -180,7 +183,7 @@ static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400 *ucb)
180 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | 183 UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
181 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); 184 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
182 185
183 udelay(55); 186 udelay(ts_delay);
184 187
185 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY); 188 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY);
186} 189}
@@ -203,7 +206,7 @@ static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400 *ucb)
203 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | 206 UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
204 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); 207 UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
205 208
206 udelay(55); 209 udelay(ts_delay);
207 210
208 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPX); 211 return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPX);
209} 212}
@@ -369,7 +372,7 @@ static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid)
369 372
370static int ucb1400_ts_open(struct input_dev *idev) 373static int ucb1400_ts_open(struct input_dev *idev)
371{ 374{
372 struct ucb1400 *ucb = idev->private; 375 struct ucb1400 *ucb = input_get_drvdata(idev);
373 int ret = 0; 376 int ret = 0;
374 377
375 BUG_ON(ucb->ts_task); 378 BUG_ON(ucb->ts_task);
@@ -385,7 +388,7 @@ static int ucb1400_ts_open(struct input_dev *idev)
385 388
386static void ucb1400_ts_close(struct input_dev *idev) 389static void ucb1400_ts_close(struct input_dev *idev)
387{ 390{
388 struct ucb1400 *ucb = idev->private; 391 struct ucb1400 *ucb = input_get_drvdata(idev);
389 392
390 if (ucb->ts_task) 393 if (ucb->ts_task)
391 kthread_stop(ucb->ts_task); 394 kthread_stop(ucb->ts_task);
@@ -507,8 +510,9 @@ static int ucb1400_ts_probe(struct device *dev)
507 } 510 }
508 printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq); 511 printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq);
509 512
510 idev->private = ucb; 513 input_set_drvdata(idev, ucb);
511 idev->cdev.dev = dev; 514
515 idev->dev.parent = dev;
512 idev->name = "UCB1400 touchscreen interface"; 516 idev->name = "UCB1400 touchscreen interface";
513 idev->id.vendor = ucb1400_reg_read(ucb, AC97_VENDOR_ID1); 517 idev->id.vendor = ucb1400_reg_read(ucb, AC97_VENDOR_ID1);
514 idev->id.product = id; 518 idev->id.product = id;
@@ -571,7 +575,15 @@ static void __exit ucb1400_ts_exit(void)
571 driver_unregister(&ucb1400_ts_driver); 575 driver_unregister(&ucb1400_ts_driver);
572} 576}
573 577
574module_param(adcsync, int, 0444); 578module_param(adcsync, bool, 0444);
579MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin.");
580
581module_param(ts_delay, int, 0444);
582MODULE_PARM_DESC(ts_delay, "Delay between panel setup and position read. Default = 55us.");
583
584module_param(ts_delay_pressure, int, 0444);
585MODULE_PARM_DESC(ts_delay_pressure,
586 "delay between panel setup and pressure read. Default = 0us.");
575 587
576module_init(ucb1400_ts_init); 588module_init(ucb1400_ts_init);
577module_exit(ucb1400_ts_exit); 589module_exit(ucb1400_ts_exit);
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 0300dca8591d..5e5b5c91d75b 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -111,13 +111,13 @@ struct tsdev {
111 int minor; 111 int minor;
112 char name[8]; 112 char name[8];
113 wait_queue_head_t wait; 113 wait_queue_head_t wait;
114 struct list_head list; 114 struct list_head client_list;
115 struct input_handle handle; 115 struct input_handle handle;
116 int x, y, pressure; 116 int x, y, pressure;
117 struct ts_calibration cal; 117 struct ts_calibration cal;
118}; 118};
119 119
120struct tsdev_list { 120struct tsdev_client {
121 struct fasync_struct *fasync; 121 struct fasync_struct *fasync;
122 struct list_head node; 122 struct list_head node;
123 struct tsdev *tsdev; 123 struct tsdev *tsdev;
@@ -139,38 +139,49 @@ static struct tsdev *tsdev_table[TSDEV_MINORS/2];
139 139
140static int tsdev_fasync(int fd, struct file *file, int on) 140static int tsdev_fasync(int fd, struct file *file, int on)
141{ 141{
142 struct tsdev_list *list = file->private_data; 142 struct tsdev_client *client = file->private_data;
143 int retval; 143 int retval;
144 144
145 retval = fasync_helper(fd, file, on, &list->fasync); 145 retval = fasync_helper(fd, file, on, &client->fasync);
146 return retval < 0 ? retval : 0; 146 return retval < 0 ? retval : 0;
147} 147}
148 148
149static int tsdev_open(struct inode *inode, struct file *file) 149static int tsdev_open(struct inode *inode, struct file *file)
150{ 150{
151 int i = iminor(inode) - TSDEV_MINOR_BASE; 151 int i = iminor(inode) - TSDEV_MINOR_BASE;
152 struct tsdev_list *list; 152 struct tsdev_client *client;
153 struct tsdev *tsdev;
154 int error;
153 155
154 printk(KERN_WARNING "tsdev (compaq touchscreen emulation) is scheduled " 156 printk(KERN_WARNING "tsdev (compaq touchscreen emulation) is scheduled "
155 "for removal.\nSee Documentation/feature-removal-schedule.txt " 157 "for removal.\nSee Documentation/feature-removal-schedule.txt "
156 "for details.\n"); 158 "for details.\n");
157 159
158 if (i >= TSDEV_MINORS || !tsdev_table[i & TSDEV_MINOR_MASK]) 160 if (i >= TSDEV_MINORS)
161 return -ENODEV;
162
163 tsdev = tsdev_table[i & TSDEV_MINOR_MASK];
164 if (!tsdev || !tsdev->exist)
159 return -ENODEV; 165 return -ENODEV;
160 166
161 if (!(list = kzalloc(sizeof(struct tsdev_list), GFP_KERNEL))) 167 client = kzalloc(sizeof(struct tsdev_client), GFP_KERNEL);
168 if (!client)
162 return -ENOMEM; 169 return -ENOMEM;
163 170
164 list->raw = (i >= TSDEV_MINORS/2) ? 1 : 0; 171 client->tsdev = tsdev;
172 client->raw = (i >= TSDEV_MINORS / 2) ? 1 : 0;
173 list_add_tail(&client->node, &tsdev->client_list);
165 174
166 i &= TSDEV_MINOR_MASK; 175 if (!tsdev->open++ && tsdev->exist) {
167 list->tsdev = tsdev_table[i]; 176 error = input_open_device(&tsdev->handle);
168 list_add_tail(&list->node, &tsdev_table[i]->list); 177 if (error) {
169 file->private_data = list; 178 list_del(&client->node);
179 kfree(client);
180 return error;
181 }
182 }
170 183
171 if (!list->tsdev->open++) 184 file->private_data = client;
172 if (list->tsdev->exist)
173 input_open_device(&list->tsdev->handle);
174 return 0; 185 return 0;
175} 186}
176 187
@@ -182,45 +193,48 @@ static void tsdev_free(struct tsdev *tsdev)
182 193
183static int tsdev_release(struct inode *inode, struct file *file) 194static int tsdev_release(struct inode *inode, struct file *file)
184{ 195{
185 struct tsdev_list *list = file->private_data; 196 struct tsdev_client *client = file->private_data;
197 struct tsdev *tsdev = client->tsdev;
186 198
187 tsdev_fasync(-1, file, 0); 199 tsdev_fasync(-1, file, 0);
188 list_del(&list->node);
189 200
190 if (!--list->tsdev->open) { 201 list_del(&client->node);
191 if (list->tsdev->exist) 202 kfree(client);
192 input_close_device(&list->tsdev->handle); 203
204 if (!--tsdev->open) {
205 if (tsdev->exist)
206 input_close_device(&tsdev->handle);
193 else 207 else
194 tsdev_free(list->tsdev); 208 tsdev_free(tsdev);
195 } 209 }
196 kfree(list); 210
197 return 0; 211 return 0;
198} 212}
199 213
200static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count, 214static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count,
201 loff_t * ppos) 215 loff_t *ppos)
202{ 216{
203 struct tsdev_list *list = file->private_data; 217 struct tsdev_client *client = file->private_data;
218 struct tsdev *tsdev = client->tsdev;
204 int retval = 0; 219 int retval = 0;
205 220
206 if (list->head == list->tail && list->tsdev->exist && (file->f_flags & O_NONBLOCK)) 221 if (client->head == client->tail && tsdev->exist && (file->f_flags & O_NONBLOCK))
207 return -EAGAIN; 222 return -EAGAIN;
208 223
209 retval = wait_event_interruptible(list->tsdev->wait, 224 retval = wait_event_interruptible(tsdev->wait,
210 list->head != list->tail || !list->tsdev->exist); 225 client->head != client->tail || !tsdev->exist);
211
212 if (retval) 226 if (retval)
213 return retval; 227 return retval;
214 228
215 if (!list->tsdev->exist) 229 if (!tsdev->exist)
216 return -ENODEV; 230 return -ENODEV;
217 231
218 while (list->head != list->tail && 232 while (client->head != client->tail &&
219 retval + sizeof (struct ts_event) <= count) { 233 retval + sizeof (struct ts_event) <= count) {
220 if (copy_to_user (buffer + retval, list->event + list->tail, 234 if (copy_to_user (buffer + retval, client->event + client->tail,
221 sizeof (struct ts_event))) 235 sizeof (struct ts_event)))
222 return -EFAULT; 236 return -EFAULT;
223 list->tail = (list->tail + 1) & (TSDEV_BUFFER_SIZE - 1); 237 client->tail = (client->tail + 1) & (TSDEV_BUFFER_SIZE - 1);
224 retval += sizeof (struct ts_event); 238 retval += sizeof (struct ts_event);
225 } 239 }
226 240
@@ -228,32 +242,33 @@ static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count,
228} 242}
229 243
230/* No kernel lock - fine */ 244/* No kernel lock - fine */
231static unsigned int tsdev_poll(struct file *file, poll_table * wait) 245static unsigned int tsdev_poll(struct file *file, poll_table *wait)
232{ 246{
233 struct tsdev_list *list = file->private_data; 247 struct tsdev_client *client = file->private_data;
248 struct tsdev *tsdev = client->tsdev;
234 249
235 poll_wait(file, &list->tsdev->wait, wait); 250 poll_wait(file, &tsdev->wait, wait);
236 return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | 251 return ((client->head == client->tail) ? 0 : (POLLIN | POLLRDNORM)) |
237 (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); 252 (tsdev->exist ? 0 : (POLLHUP | POLLERR));
238} 253}
239 254
240static int tsdev_ioctl(struct inode *inode, struct file *file, 255static int tsdev_ioctl(struct inode *inode, struct file *file,
241 unsigned int cmd, unsigned long arg) 256 unsigned int cmd, unsigned long arg)
242{ 257{
243 struct tsdev_list *list = file->private_data; 258 struct tsdev_client *client = file->private_data;
244 struct tsdev *tsdev = list->tsdev; 259 struct tsdev *tsdev = client->tsdev;
245 int retval = 0; 260 int retval = 0;
246 261
247 switch (cmd) { 262 switch (cmd) {
248 case TS_GET_CAL: 263 case TS_GET_CAL:
249 if (copy_to_user ((void __user *)arg, &tsdev->cal, 264 if (copy_to_user((void __user *)arg, &tsdev->cal,
250 sizeof (struct ts_calibration))) 265 sizeof (struct ts_calibration)))
251 retval = -EFAULT; 266 retval = -EFAULT;
252 break; 267 break;
253 268
254 case TS_SET_CAL: 269 case TS_SET_CAL:
255 if (copy_from_user (&tsdev->cal, (void __user *)arg, 270 if (copy_from_user(&tsdev->cal, (void __user *)arg,
256 sizeof (struct ts_calibration))) 271 sizeof (struct ts_calibration)))
257 retval = -EFAULT; 272 retval = -EFAULT;
258 break; 273 break;
259 274
@@ -279,7 +294,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
279 unsigned int code, int value) 294 unsigned int code, int value)
280{ 295{
281 struct tsdev *tsdev = handle->private; 296 struct tsdev *tsdev = handle->private;
282 struct tsdev_list *list; 297 struct tsdev_client *client;
283 struct timeval time; 298 struct timeval time;
284 299
285 switch (type) { 300 switch (type) {
@@ -343,18 +358,18 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
343 if (type != EV_SYN || code != SYN_REPORT) 358 if (type != EV_SYN || code != SYN_REPORT)
344 return; 359 return;
345 360
346 list_for_each_entry(list, &tsdev->list, node) { 361 list_for_each_entry(client, &tsdev->client_list, node) {
347 int x, y, tmp; 362 int x, y, tmp;
348 363
349 do_gettimeofday(&time); 364 do_gettimeofday(&time);
350 list->event[list->head].millisecs = time.tv_usec / 100; 365 client->event[client->head].millisecs = time.tv_usec / 100;
351 list->event[list->head].pressure = tsdev->pressure; 366 client->event[client->head].pressure = tsdev->pressure;
352 367
353 x = tsdev->x; 368 x = tsdev->x;
354 y = tsdev->y; 369 y = tsdev->y;
355 370
356 /* Calibration */ 371 /* Calibration */
357 if (!list->raw) { 372 if (!client->raw) {
358 x = ((x * tsdev->cal.xscale) >> 8) + tsdev->cal.xtrans; 373 x = ((x * tsdev->cal.xscale) >> 8) + tsdev->cal.xtrans;
359 y = ((y * tsdev->cal.yscale) >> 8) + tsdev->cal.ytrans; 374 y = ((y * tsdev->cal.yscale) >> 8) + tsdev->cal.ytrans;
360 if (tsdev->cal.xyswap) { 375 if (tsdev->cal.xyswap) {
@@ -362,33 +377,35 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
362 } 377 }
363 } 378 }
364 379
365 list->event[list->head].x = x; 380 client->event[client->head].x = x;
366 list->event[list->head].y = y; 381 client->event[client->head].y = y;
367 list->head = (list->head + 1) & (TSDEV_BUFFER_SIZE - 1); 382 client->head = (client->head + 1) & (TSDEV_BUFFER_SIZE - 1);
368 kill_fasync(&list->fasync, SIGIO, POLL_IN); 383 kill_fasync(&client->fasync, SIGIO, POLL_IN);
369 } 384 }
370 wake_up_interruptible(&tsdev->wait); 385 wake_up_interruptible(&tsdev->wait);
371} 386}
372 387
373static struct input_handle *tsdev_connect(struct input_handler *handler, 388static int tsdev_connect(struct input_handler *handler, struct input_dev *dev,
374 struct input_dev *dev, 389 const struct input_device_id *id)
375 const struct input_device_id *id)
376{ 390{
377 struct tsdev *tsdev; 391 struct tsdev *tsdev;
378 struct class_device *cdev; 392 struct class_device *cdev;
393 dev_t devt;
379 int minor, delta; 394 int minor, delta;
395 int error;
380 396
381 for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); 397 for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++);
382 if (minor >= TSDEV_MINORS / 2) { 398 if (minor >= TSDEV_MINORS / 2) {
383 printk(KERN_ERR 399 printk(KERN_ERR
384 "tsdev: You have way too many touchscreens\n"); 400 "tsdev: You have way too many touchscreens\n");
385 return NULL; 401 return -ENFILE;
386 } 402 }
387 403
388 if (!(tsdev = kzalloc(sizeof(struct tsdev), GFP_KERNEL))) 404 tsdev = kzalloc(sizeof(struct tsdev), GFP_KERNEL);
389 return NULL; 405 if (!tsdev)
406 return -ENOMEM;
390 407
391 INIT_LIST_HEAD(&tsdev->list); 408 INIT_LIST_HEAD(&tsdev->client_list);
392 init_waitqueue_head(&tsdev->wait); 409 init_waitqueue_head(&tsdev->wait);
393 410
394 sprintf(tsdev->name, "ts%d", minor); 411 sprintf(tsdev->name, "ts%d", minor);
@@ -415,23 +432,45 @@ static struct input_handle *tsdev_connect(struct input_handler *handler,
415 432
416 tsdev_table[minor] = tsdev; 433 tsdev_table[minor] = tsdev;
417 434
418 cdev = class_device_create(&input_class, &dev->cdev, 435 devt = MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor),
419 MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), 436
420 dev->cdev.dev, tsdev->name); 437 cdev = class_device_create(&input_class, &dev->cdev, devt,
438 dev->cdev.dev, tsdev->name);
439 if (IS_ERR(cdev)) {
440 error = PTR_ERR(cdev);
441 goto err_free_tsdev;
442 }
421 443
422 /* temporary symlink to keep userspace happy */ 444 /* temporary symlink to keep userspace happy */
423 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 445 error = sysfs_create_link(&input_class.subsys.kobj,
424 tsdev->name); 446 &cdev->kobj, tsdev->name);
447 if (error)
448 goto err_cdev_destroy;
449
450 error = input_register_handle(&tsdev->handle);
451 if (error)
452 goto err_remove_link;
425 453
426 return &tsdev->handle; 454 return 0;
455
456 err_remove_link:
457 sysfs_remove_link(&input_class.subsys.kobj, tsdev->name);
458 err_cdev_destroy:
459 class_device_destroy(&input_class, devt);
460 err_free_tsdev:
461 tsdev_table[minor] = NULL;
462 kfree(tsdev);
463 return error;
427} 464}
428 465
429static void tsdev_disconnect(struct input_handle *handle) 466static void tsdev_disconnect(struct input_handle *handle)
430{ 467{
431 struct tsdev *tsdev = handle->private; 468 struct tsdev *tsdev = handle->private;
432 struct tsdev_list *list; 469 struct tsdev_client *client;
470
471 input_unregister_handle(handle);
433 472
434 sysfs_remove_link(&input_class.subsys.kset.kobj, tsdev->name); 473 sysfs_remove_link(&input_class.subsys.kobj, tsdev->name);
435 class_device_destroy(&input_class, 474 class_device_destroy(&input_class,
436 MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); 475 MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
437 tsdev->exist = 0; 476 tsdev->exist = 0;
@@ -439,8 +478,8 @@ static void tsdev_disconnect(struct input_handle *handle)
439 if (tsdev->open) { 478 if (tsdev->open) {
440 input_close_device(handle); 479 input_close_device(handle);
441 wake_up_interruptible(&tsdev->wait); 480 wake_up_interruptible(&tsdev->wait);
442 list_for_each_entry(list, &tsdev->list, node) 481 list_for_each_entry(client, &tsdev->client_list, node)
443 kill_fasync(&list->fasync, SIGIO, POLL_HUP); 482 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
444 } else 483 } else
445 tsdev_free(tsdev); 484 tsdev_free(tsdev);
446} 485}
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index 38f648f9b0ed..02c6fbaeccf8 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -19,7 +19,6 @@
19#include "isac.h" 19#include "isac.h"
20#include "hscx.h" 20#include "hscx.h"
21#include "isdnl1.h" 21#include "isdnl1.h"
22#include <linux/pci.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/ppp_defs.h> 23#include <linux/ppp_defs.h>
25#include <asm/io.h> 24#include <asm/io.h>
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index f7e83a86f444..4c7dedac0e51 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/poll.h> 14#include <linux/poll.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/pci.h>
17#include <linux/smp_lock.h> 16#include <linux/smp_lock.h>
18 17
19#include "hysdn_defs.h" 18#include "hysdn_defs.h"
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 0d122bf889db..41634fde8e13 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -51,16 +51,19 @@
51#define UNMAPPED_GVA (~(gpa_t)0) 51#define UNMAPPED_GVA (~(gpa_t)0)
52 52
53#define KVM_MAX_VCPUS 1 53#define KVM_MAX_VCPUS 1
54#define KVM_ALIAS_SLOTS 4
54#define KVM_MEMORY_SLOTS 4 55#define KVM_MEMORY_SLOTS 4
55#define KVM_NUM_MMU_PAGES 256 56#define KVM_NUM_MMU_PAGES 256
56#define KVM_MIN_FREE_MMU_PAGES 5 57#define KVM_MIN_FREE_MMU_PAGES 5
57#define KVM_REFILL_PAGES 25 58#define KVM_REFILL_PAGES 25
59#define KVM_MAX_CPUID_ENTRIES 40
58 60
59#define FX_IMAGE_SIZE 512 61#define FX_IMAGE_SIZE 512
60#define FX_IMAGE_ALIGN 16 62#define FX_IMAGE_ALIGN 16
61#define FX_BUF_SIZE (2 * FX_IMAGE_SIZE + FX_IMAGE_ALIGN) 63#define FX_BUF_SIZE (2 * FX_IMAGE_SIZE + FX_IMAGE_ALIGN)
62 64
63#define DE_VECTOR 0 65#define DE_VECTOR 0
66#define NM_VECTOR 7
64#define DF_VECTOR 8 67#define DF_VECTOR 8
65#define TS_VECTOR 10 68#define TS_VECTOR 10
66#define NP_VECTOR 11 69#define NP_VECTOR 11
@@ -73,6 +76,8 @@
73 76
74#define IOPL_SHIFT 12 77#define IOPL_SHIFT 12
75 78
79#define KVM_PIO_PAGE_OFFSET 1
80
76/* 81/*
77 * Address types: 82 * Address types:
78 * 83 *
@@ -106,6 +111,7 @@ struct kvm_pte_chain {
106 * bits 4:7 - page table level for this shadow (1-4) 111 * bits 4:7 - page table level for this shadow (1-4)
107 * bits 8:9 - page table quadrant for 2-level guests 112 * bits 8:9 - page table quadrant for 2-level guests
108 * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode) 113 * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode)
114 * bits 17:18 - "access" - the user and writable bits of a huge page pde
109 */ 115 */
110union kvm_mmu_page_role { 116union kvm_mmu_page_role {
111 unsigned word; 117 unsigned word;
@@ -115,6 +121,7 @@ union kvm_mmu_page_role {
115 unsigned quadrant : 2; 121 unsigned quadrant : 2;
116 unsigned pad_for_nice_hex_output : 6; 122 unsigned pad_for_nice_hex_output : 6;
117 unsigned metaphysical : 1; 123 unsigned metaphysical : 1;
124 unsigned hugepage_access : 2;
118 }; 125 };
119}; 126};
120 127
@@ -133,7 +140,6 @@ struct kvm_mmu_page {
133 unsigned long slot_bitmap; /* One bit set per slot which has memory 140 unsigned long slot_bitmap; /* One bit set per slot which has memory
134 * in this shadow page. 141 * in this shadow page.
135 */ 142 */
136 int global; /* Set if all ptes in this page are global */
137 int multimapped; /* More than one parent_pte? */ 143 int multimapped; /* More than one parent_pte? */
138 int root_count; /* Currently serving as active root */ 144 int root_count; /* Currently serving as active root */
139 union { 145 union {
@@ -219,6 +225,34 @@ enum {
219 VCPU_SREG_LDTR, 225 VCPU_SREG_LDTR,
220}; 226};
221 227
228struct kvm_pio_request {
229 unsigned long count;
230 int cur_count;
231 struct page *guest_pages[2];
232 unsigned guest_page_offset;
233 int in;
234 int size;
235 int string;
236 int down;
237 int rep;
238};
239
240struct kvm_stat {
241 u32 pf_fixed;
242 u32 pf_guest;
243 u32 tlb_flush;
244 u32 invlpg;
245
246 u32 exits;
247 u32 io_exits;
248 u32 mmio_exits;
249 u32 signal_exits;
250 u32 irq_window_exits;
251 u32 halt_exits;
252 u32 request_irq_exits;
253 u32 irq_exits;
254};
255
222struct kvm_vcpu { 256struct kvm_vcpu {
223 struct kvm *kvm; 257 struct kvm *kvm;
224 union { 258 union {
@@ -228,6 +262,8 @@ struct kvm_vcpu {
228 struct mutex mutex; 262 struct mutex mutex;
229 int cpu; 263 int cpu;
230 int launched; 264 int launched;
265 u64 host_tsc;
266 struct kvm_run *run;
231 int interrupt_window_open; 267 int interrupt_window_open;
232 unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ 268 unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */
233#define NR_IRQ_WORDS KVM_IRQ_BITMAP_SIZE(unsigned long) 269#define NR_IRQ_WORDS KVM_IRQ_BITMAP_SIZE(unsigned long)
@@ -266,6 +302,7 @@ struct kvm_vcpu {
266 char fx_buf[FX_BUF_SIZE]; 302 char fx_buf[FX_BUF_SIZE];
267 char *host_fx_image; 303 char *host_fx_image;
268 char *guest_fx_image; 304 char *guest_fx_image;
305 int fpu_active;
269 306
270 int mmio_needed; 307 int mmio_needed;
271 int mmio_read_completed; 308 int mmio_read_completed;
@@ -273,6 +310,14 @@ struct kvm_vcpu {
273 int mmio_size; 310 int mmio_size;
274 unsigned char mmio_data[8]; 311 unsigned char mmio_data[8];
275 gpa_t mmio_phys_addr; 312 gpa_t mmio_phys_addr;
313 gva_t mmio_fault_cr2;
314 struct kvm_pio_request pio;
315 void *pio_data;
316
317 int sigset_active;
318 sigset_t sigset;
319
320 struct kvm_stat stat;
276 321
277 struct { 322 struct {
278 int active; 323 int active;
@@ -284,6 +329,15 @@ struct kvm_vcpu {
284 u32 ar; 329 u32 ar;
285 } tr, es, ds, fs, gs; 330 } tr, es, ds, fs, gs;
286 } rmode; 331 } rmode;
332
333 int cpuid_nent;
334 struct kvm_cpuid_entry cpuid_entries[KVM_MAX_CPUID_ENTRIES];
335};
336
337struct kvm_mem_alias {
338 gfn_t base_gfn;
339 unsigned long npages;
340 gfn_t target_gfn;
287}; 341};
288 342
289struct kvm_memory_slot { 343struct kvm_memory_slot {
@@ -296,6 +350,8 @@ struct kvm_memory_slot {
296 350
297struct kvm { 351struct kvm {
298 spinlock_t lock; /* protects everything except vcpus */ 352 spinlock_t lock; /* protects everything except vcpus */
353 int naliases;
354 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
299 int nmemslots; 355 int nmemslots;
300 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS]; 356 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS];
301 /* 357 /*
@@ -312,22 +368,6 @@ struct kvm {
312 struct file *filp; 368 struct file *filp;
313}; 369};
314 370
315struct kvm_stat {
316 u32 pf_fixed;
317 u32 pf_guest;
318 u32 tlb_flush;
319 u32 invlpg;
320
321 u32 exits;
322 u32 io_exits;
323 u32 mmio_exits;
324 u32 signal_exits;
325 u32 irq_window_exits;
326 u32 halt_exits;
327 u32 request_irq_exits;
328 u32 irq_exits;
329};
330
331struct descriptor_table { 371struct descriptor_table {
332 u16 limit; 372 u16 limit;
333 unsigned long base; 373 unsigned long base;
@@ -358,10 +398,8 @@ struct kvm_arch_ops {
358 void (*set_segment)(struct kvm_vcpu *vcpu, 398 void (*set_segment)(struct kvm_vcpu *vcpu,
359 struct kvm_segment *var, int seg); 399 struct kvm_segment *var, int seg);
360 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l); 400 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
361 void (*decache_cr0_cr4_guest_bits)(struct kvm_vcpu *vcpu); 401 void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu);
362 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0); 402 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
363 void (*set_cr0_no_modeswitch)(struct kvm_vcpu *vcpu,
364 unsigned long cr0);
365 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); 403 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
366 void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4); 404 void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
367 void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer); 405 void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
@@ -391,7 +429,6 @@ struct kvm_arch_ops {
391 unsigned char *hypercall_addr); 429 unsigned char *hypercall_addr);
392}; 430};
393 431
394extern struct kvm_stat kvm_stat;
395extern struct kvm_arch_ops *kvm_arch_ops; 432extern struct kvm_arch_ops *kvm_arch_ops;
396 433
397#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) 434#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
@@ -400,28 +437,29 @@ extern struct kvm_arch_ops *kvm_arch_ops;
400int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module); 437int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module);
401void kvm_exit_arch(void); 438void kvm_exit_arch(void);
402 439
440int kvm_mmu_module_init(void);
441void kvm_mmu_module_exit(void);
442
403void kvm_mmu_destroy(struct kvm_vcpu *vcpu); 443void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
404int kvm_mmu_create(struct kvm_vcpu *vcpu); 444int kvm_mmu_create(struct kvm_vcpu *vcpu);
405int kvm_mmu_setup(struct kvm_vcpu *vcpu); 445int kvm_mmu_setup(struct kvm_vcpu *vcpu);
406 446
407int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); 447int kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
408void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot); 448void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot);
449void kvm_mmu_zap_all(struct kvm_vcpu *vcpu);
409 450
410hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa); 451hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa);
411#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 452#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
412#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 453#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
413static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 454static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
414hpa_t gva_to_hpa(struct kvm_vcpu *vcpu, gva_t gva); 455hpa_t gva_to_hpa(struct kvm_vcpu *vcpu, gva_t gva);
456struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
415 457
416void kvm_emulator_want_group7_invlpg(void); 458void kvm_emulator_want_group7_invlpg(void);
417 459
418extern hpa_t bad_page_address; 460extern hpa_t bad_page_address;
419 461
420static inline struct page *gfn_to_page(struct kvm_memory_slot *slot, gfn_t gfn) 462struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
421{
422 return slot->phys_mem[gfn - slot->base_gfn];
423}
424
425struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 463struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
426void mark_page_dirty(struct kvm *kvm, gfn_t gfn); 464void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
427 465
@@ -444,6 +482,10 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value,
444 482
445struct x86_emulate_ctxt; 483struct x86_emulate_ctxt;
446 484
485int kvm_setup_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
486 int size, unsigned long count, int string, int down,
487 gva_t address, int rep, unsigned port);
488void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
447int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); 489int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address);
448int emulate_clts(struct kvm_vcpu *vcpu); 490int emulate_clts(struct kvm_vcpu *vcpu);
449int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, 491int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr,
@@ -493,12 +535,6 @@ static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
493 return vcpu->mmu.page_fault(vcpu, gva, error_code); 535 return vcpu->mmu.page_fault(vcpu, gva, error_code);
494} 536}
495 537
496static inline struct page *_gfn_to_page(struct kvm *kvm, gfn_t gfn)
497{
498 struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn);
499 return (slot) ? slot->phys_mem[gfn - slot->base_gfn] : NULL;
500}
501
502static inline int is_long_mode(struct kvm_vcpu *vcpu) 538static inline int is_long_mode(struct kvm_vcpu *vcpu)
503{ 539{
504#ifdef CONFIG_X86_64 540#ifdef CONFIG_X86_64
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index dc7a8c78cbf9..c8b8cfa332bb 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -51,27 +51,27 @@ static DEFINE_SPINLOCK(kvm_lock);
51static LIST_HEAD(vm_list); 51static LIST_HEAD(vm_list);
52 52
53struct kvm_arch_ops *kvm_arch_ops; 53struct kvm_arch_ops *kvm_arch_ops;
54struct kvm_stat kvm_stat; 54
55EXPORT_SYMBOL_GPL(kvm_stat); 55#define STAT_OFFSET(x) offsetof(struct kvm_vcpu, stat.x)
56 56
57static struct kvm_stats_debugfs_item { 57static struct kvm_stats_debugfs_item {
58 const char *name; 58 const char *name;
59 u32 *data; 59 int offset;
60 struct dentry *dentry; 60 struct dentry *dentry;
61} debugfs_entries[] = { 61} debugfs_entries[] = {
62 { "pf_fixed", &kvm_stat.pf_fixed }, 62 { "pf_fixed", STAT_OFFSET(pf_fixed) },
63 { "pf_guest", &kvm_stat.pf_guest }, 63 { "pf_guest", STAT_OFFSET(pf_guest) },
64 { "tlb_flush", &kvm_stat.tlb_flush }, 64 { "tlb_flush", STAT_OFFSET(tlb_flush) },
65 { "invlpg", &kvm_stat.invlpg }, 65 { "invlpg", STAT_OFFSET(invlpg) },
66 { "exits", &kvm_stat.exits }, 66 { "exits", STAT_OFFSET(exits) },
67 { "io_exits", &kvm_stat.io_exits }, 67 { "io_exits", STAT_OFFSET(io_exits) },
68 { "mmio_exits", &kvm_stat.mmio_exits }, 68 { "mmio_exits", STAT_OFFSET(mmio_exits) },
69 { "signal_exits", &kvm_stat.signal_exits }, 69 { "signal_exits", STAT_OFFSET(signal_exits) },
70 { "irq_window", &kvm_stat.irq_window_exits }, 70 { "irq_window", STAT_OFFSET(irq_window_exits) },
71 { "halt_exits", &kvm_stat.halt_exits }, 71 { "halt_exits", STAT_OFFSET(halt_exits) },
72 { "request_irq", &kvm_stat.request_irq_exits }, 72 { "request_irq", STAT_OFFSET(request_irq_exits) },
73 { "irq_exits", &kvm_stat.irq_exits }, 73 { "irq_exits", STAT_OFFSET(irq_exits) },
74 { NULL, NULL } 74 { NULL }
75}; 75};
76 76
77static struct dentry *debugfs_dir; 77static struct dentry *debugfs_dir;
@@ -346,6 +346,17 @@ static void kvm_free_physmem(struct kvm *kvm)
346 kvm_free_physmem_slot(&kvm->memslots[i], NULL); 346 kvm_free_physmem_slot(&kvm->memslots[i], NULL);
347} 347}
348 348
349static void free_pio_guest_pages(struct kvm_vcpu *vcpu)
350{
351 int i;
352
353 for (i = 0; i < 2; ++i)
354 if (vcpu->pio.guest_pages[i]) {
355 __free_page(vcpu->pio.guest_pages[i]);
356 vcpu->pio.guest_pages[i] = NULL;
357 }
358}
359
349static void kvm_free_vcpu(struct kvm_vcpu *vcpu) 360static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
350{ 361{
351 if (!vcpu->vmcs) 362 if (!vcpu->vmcs)
@@ -355,6 +366,11 @@ static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
355 kvm_mmu_destroy(vcpu); 366 kvm_mmu_destroy(vcpu);
356 vcpu_put(vcpu); 367 vcpu_put(vcpu);
357 kvm_arch_ops->vcpu_free(vcpu); 368 kvm_arch_ops->vcpu_free(vcpu);
369 free_page((unsigned long)vcpu->run);
370 vcpu->run = NULL;
371 free_page((unsigned long)vcpu->pio_data);
372 vcpu->pio_data = NULL;
373 free_pio_guest_pages(vcpu);
358} 374}
359 375
360static void kvm_free_vcpus(struct kvm *kvm) 376static void kvm_free_vcpus(struct kvm *kvm)
@@ -404,12 +420,12 @@ static int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3)
404 u64 pdpte; 420 u64 pdpte;
405 u64 *pdpt; 421 u64 *pdpt;
406 int ret; 422 int ret;
407 struct kvm_memory_slot *memslot; 423 struct page *page;
408 424
409 spin_lock(&vcpu->kvm->lock); 425 spin_lock(&vcpu->kvm->lock);
410 memslot = gfn_to_memslot(vcpu->kvm, pdpt_gfn); 426 page = gfn_to_page(vcpu->kvm, pdpt_gfn);
411 /* FIXME: !memslot - emulate? 0xff? */ 427 /* FIXME: !page - emulate? 0xff? */
412 pdpt = kmap_atomic(gfn_to_page(memslot, pdpt_gfn), KM_USER0); 428 pdpt = kmap_atomic(page, KM_USER0);
413 429
414 ret = 1; 430 ret = 1;
415 for (i = 0; i < 4; ++i) { 431 for (i = 0; i < 4; ++i) {
@@ -494,7 +510,6 @@ EXPORT_SYMBOL_GPL(set_cr0);
494 510
495void lmsw(struct kvm_vcpu *vcpu, unsigned long msw) 511void lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
496{ 512{
497 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu);
498 set_cr0(vcpu, (vcpu->cr0 & ~0x0ful) | (msw & 0x0f)); 513 set_cr0(vcpu, (vcpu->cr0 & ~0x0ful) | (msw & 0x0f));
499} 514}
500EXPORT_SYMBOL_GPL(lmsw); 515EXPORT_SYMBOL_GPL(lmsw);
@@ -830,7 +845,73 @@ out:
830 return r; 845 return r;
831} 846}
832 847
833struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn) 848/*
849 * Set a new alias region. Aliases map a portion of physical memory into
850 * another portion. This is useful for memory windows, for example the PC
851 * VGA region.
852 */
853static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
854 struct kvm_memory_alias *alias)
855{
856 int r, n;
857 struct kvm_mem_alias *p;
858
859 r = -EINVAL;
860 /* General sanity checks */
861 if (alias->memory_size & (PAGE_SIZE - 1))
862 goto out;
863 if (alias->guest_phys_addr & (PAGE_SIZE - 1))
864 goto out;
865 if (alias->slot >= KVM_ALIAS_SLOTS)
866 goto out;
867 if (alias->guest_phys_addr + alias->memory_size
868 < alias->guest_phys_addr)
869 goto out;
870 if (alias->target_phys_addr + alias->memory_size
871 < alias->target_phys_addr)
872 goto out;
873
874 spin_lock(&kvm->lock);
875
876 p = &kvm->aliases[alias->slot];
877 p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT;
878 p->npages = alias->memory_size >> PAGE_SHIFT;
879 p->target_gfn = alias->target_phys_addr >> PAGE_SHIFT;
880
881 for (n = KVM_ALIAS_SLOTS; n > 0; --n)
882 if (kvm->aliases[n - 1].npages)
883 break;
884 kvm->naliases = n;
885
886 spin_unlock(&kvm->lock);
887
888 vcpu_load(&kvm->vcpus[0]);
889 spin_lock(&kvm->lock);
890 kvm_mmu_zap_all(&kvm->vcpus[0]);
891 spin_unlock(&kvm->lock);
892 vcpu_put(&kvm->vcpus[0]);
893
894 return 0;
895
896out:
897 return r;
898}
899
900static gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
901{
902 int i;
903 struct kvm_mem_alias *alias;
904
905 for (i = 0; i < kvm->naliases; ++i) {
906 alias = &kvm->aliases[i];
907 if (gfn >= alias->base_gfn
908 && gfn < alias->base_gfn + alias->npages)
909 return alias->target_gfn + gfn - alias->base_gfn;
910 }
911 return gfn;
912}
913
914static struct kvm_memory_slot *__gfn_to_memslot(struct kvm *kvm, gfn_t gfn)
834{ 915{
835 int i; 916 int i;
836 917
@@ -843,7 +924,24 @@ struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn)
843 } 924 }
844 return NULL; 925 return NULL;
845} 926}
846EXPORT_SYMBOL_GPL(gfn_to_memslot); 927
928struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn)
929{
930 gfn = unalias_gfn(kvm, gfn);
931 return __gfn_to_memslot(kvm, gfn);
932}
933
934struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
935{
936 struct kvm_memory_slot *slot;
937
938 gfn = unalias_gfn(kvm, gfn);
939 slot = __gfn_to_memslot(kvm, gfn);
940 if (!slot)
941 return NULL;
942 return slot->phys_mem[gfn - slot->base_gfn];
943}
944EXPORT_SYMBOL_GPL(gfn_to_page);
847 945
848void mark_page_dirty(struct kvm *kvm, gfn_t gfn) 946void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
849{ 947{
@@ -871,7 +969,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
871} 969}
872 970
873static int emulator_read_std(unsigned long addr, 971static int emulator_read_std(unsigned long addr,
874 unsigned long *val, 972 void *val,
875 unsigned int bytes, 973 unsigned int bytes,
876 struct x86_emulate_ctxt *ctxt) 974 struct x86_emulate_ctxt *ctxt)
877{ 975{
@@ -883,20 +981,20 @@ static int emulator_read_std(unsigned long addr,
883 unsigned offset = addr & (PAGE_SIZE-1); 981 unsigned offset = addr & (PAGE_SIZE-1);
884 unsigned tocopy = min(bytes, (unsigned)PAGE_SIZE - offset); 982 unsigned tocopy = min(bytes, (unsigned)PAGE_SIZE - offset);
885 unsigned long pfn; 983 unsigned long pfn;
886 struct kvm_memory_slot *memslot; 984 struct page *page;
887 void *page; 985 void *page_virt;
888 986
889 if (gpa == UNMAPPED_GVA) 987 if (gpa == UNMAPPED_GVA)
890 return X86EMUL_PROPAGATE_FAULT; 988 return X86EMUL_PROPAGATE_FAULT;
891 pfn = gpa >> PAGE_SHIFT; 989 pfn = gpa >> PAGE_SHIFT;
892 memslot = gfn_to_memslot(vcpu->kvm, pfn); 990 page = gfn_to_page(vcpu->kvm, pfn);
893 if (!memslot) 991 if (!page)
894 return X86EMUL_UNHANDLEABLE; 992 return X86EMUL_UNHANDLEABLE;
895 page = kmap_atomic(gfn_to_page(memslot, pfn), KM_USER0); 993 page_virt = kmap_atomic(page, KM_USER0);
896 994
897 memcpy(data, page + offset, tocopy); 995 memcpy(data, page_virt + offset, tocopy);
898 996
899 kunmap_atomic(page, KM_USER0); 997 kunmap_atomic(page_virt, KM_USER0);
900 998
901 bytes -= tocopy; 999 bytes -= tocopy;
902 data += tocopy; 1000 data += tocopy;
@@ -907,7 +1005,7 @@ static int emulator_read_std(unsigned long addr,
907} 1005}
908 1006
909static int emulator_write_std(unsigned long addr, 1007static int emulator_write_std(unsigned long addr,
910 unsigned long val, 1008 const void *val,
911 unsigned int bytes, 1009 unsigned int bytes,
912 struct x86_emulate_ctxt *ctxt) 1010 struct x86_emulate_ctxt *ctxt)
913{ 1011{
@@ -917,7 +1015,7 @@ static int emulator_write_std(unsigned long addr,
917} 1015}
918 1016
919static int emulator_read_emulated(unsigned long addr, 1017static int emulator_read_emulated(unsigned long addr,
920 unsigned long *val, 1018 void *val,
921 unsigned int bytes, 1019 unsigned int bytes,
922 struct x86_emulate_ctxt *ctxt) 1020 struct x86_emulate_ctxt *ctxt)
923{ 1021{
@@ -945,37 +1043,37 @@ static int emulator_read_emulated(unsigned long addr,
945} 1043}
946 1044
947static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, 1045static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
948 unsigned long val, int bytes) 1046 const void *val, int bytes)
949{ 1047{
950 struct kvm_memory_slot *m;
951 struct page *page; 1048 struct page *page;
952 void *virt; 1049 void *virt;
953 1050
954 if (((gpa + bytes - 1) >> PAGE_SHIFT) != (gpa >> PAGE_SHIFT)) 1051 if (((gpa + bytes - 1) >> PAGE_SHIFT) != (gpa >> PAGE_SHIFT))
955 return 0; 1052 return 0;
956 m = gfn_to_memslot(vcpu->kvm, gpa >> PAGE_SHIFT); 1053 page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT);
957 if (!m) 1054 if (!page)
958 return 0; 1055 return 0;
959 page = gfn_to_page(m, gpa >> PAGE_SHIFT);
960 kvm_mmu_pre_write(vcpu, gpa, bytes); 1056 kvm_mmu_pre_write(vcpu, gpa, bytes);
961 mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); 1057 mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT);
962 virt = kmap_atomic(page, KM_USER0); 1058 virt = kmap_atomic(page, KM_USER0);
963 memcpy(virt + offset_in_page(gpa), &val, bytes); 1059 memcpy(virt + offset_in_page(gpa), val, bytes);
964 kunmap_atomic(virt, KM_USER0); 1060 kunmap_atomic(virt, KM_USER0);
965 kvm_mmu_post_write(vcpu, gpa, bytes); 1061 kvm_mmu_post_write(vcpu, gpa, bytes);
966 return 1; 1062 return 1;
967} 1063}
968 1064
969static int emulator_write_emulated(unsigned long addr, 1065static int emulator_write_emulated(unsigned long addr,
970 unsigned long val, 1066 const void *val,
971 unsigned int bytes, 1067 unsigned int bytes,
972 struct x86_emulate_ctxt *ctxt) 1068 struct x86_emulate_ctxt *ctxt)
973{ 1069{
974 struct kvm_vcpu *vcpu = ctxt->vcpu; 1070 struct kvm_vcpu *vcpu = ctxt->vcpu;
975 gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); 1071 gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr);
976 1072
977 if (gpa == UNMAPPED_GVA) 1073 if (gpa == UNMAPPED_GVA) {
1074 kvm_arch_ops->inject_page_fault(vcpu, addr, 2);
978 return X86EMUL_PROPAGATE_FAULT; 1075 return X86EMUL_PROPAGATE_FAULT;
1076 }
979 1077
980 if (emulator_write_phys(vcpu, gpa, val, bytes)) 1078 if (emulator_write_phys(vcpu, gpa, val, bytes))
981 return X86EMUL_CONTINUE; 1079 return X86EMUL_CONTINUE;
@@ -984,14 +1082,14 @@ static int emulator_write_emulated(unsigned long addr,
984 vcpu->mmio_phys_addr = gpa; 1082 vcpu->mmio_phys_addr = gpa;
985 vcpu->mmio_size = bytes; 1083 vcpu->mmio_size = bytes;
986 vcpu->mmio_is_write = 1; 1084 vcpu->mmio_is_write = 1;
987 memcpy(vcpu->mmio_data, &val, bytes); 1085 memcpy(vcpu->mmio_data, val, bytes);
988 1086
989 return X86EMUL_CONTINUE; 1087 return X86EMUL_CONTINUE;
990} 1088}
991 1089
992static int emulator_cmpxchg_emulated(unsigned long addr, 1090static int emulator_cmpxchg_emulated(unsigned long addr,
993 unsigned long old, 1091 const void *old,
994 unsigned long new, 1092 const void *new,
995 unsigned int bytes, 1093 unsigned int bytes,
996 struct x86_emulate_ctxt *ctxt) 1094 struct x86_emulate_ctxt *ctxt)
997{ 1095{
@@ -1004,30 +1102,6 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
1004 return emulator_write_emulated(addr, new, bytes, ctxt); 1102 return emulator_write_emulated(addr, new, bytes, ctxt);
1005} 1103}
1006 1104
1007#ifdef CONFIG_X86_32
1008
1009static int emulator_cmpxchg8b_emulated(unsigned long addr,
1010 unsigned long old_lo,
1011 unsigned long old_hi,
1012 unsigned long new_lo,
1013 unsigned long new_hi,
1014 struct x86_emulate_ctxt *ctxt)
1015{
1016 static int reported;
1017 int r;
1018
1019 if (!reported) {
1020 reported = 1;
1021 printk(KERN_WARNING "kvm: emulating exchange8b as write\n");
1022 }
1023 r = emulator_write_emulated(addr, new_lo, 4, ctxt);
1024 if (r != X86EMUL_CONTINUE)
1025 return r;
1026 return emulator_write_emulated(addr+4, new_hi, 4, ctxt);
1027}
1028
1029#endif
1030
1031static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg) 1105static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg)
1032{ 1106{
1033 return kvm_arch_ops->get_segment_base(vcpu, seg); 1107 return kvm_arch_ops->get_segment_base(vcpu, seg);
@@ -1042,7 +1116,6 @@ int emulate_clts(struct kvm_vcpu *vcpu)
1042{ 1116{
1043 unsigned long cr0; 1117 unsigned long cr0;
1044 1118
1045 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu);
1046 cr0 = vcpu->cr0 & ~CR0_TS_MASK; 1119 cr0 = vcpu->cr0 & ~CR0_TS_MASK;
1047 kvm_arch_ops->set_cr0(vcpu, cr0); 1120 kvm_arch_ops->set_cr0(vcpu, cr0);
1048 return X86EMUL_CONTINUE; 1121 return X86EMUL_CONTINUE;
@@ -1102,9 +1175,6 @@ struct x86_emulate_ops emulate_ops = {
1102 .read_emulated = emulator_read_emulated, 1175 .read_emulated = emulator_read_emulated,
1103 .write_emulated = emulator_write_emulated, 1176 .write_emulated = emulator_write_emulated,
1104 .cmpxchg_emulated = emulator_cmpxchg_emulated, 1177 .cmpxchg_emulated = emulator_cmpxchg_emulated,
1105#ifdef CONFIG_X86_32
1106 .cmpxchg8b_emulated = emulator_cmpxchg8b_emulated,
1107#endif
1108}; 1178};
1109 1179
1110int emulate_instruction(struct kvm_vcpu *vcpu, 1180int emulate_instruction(struct kvm_vcpu *vcpu,
@@ -1116,6 +1186,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1116 int r; 1186 int r;
1117 int cs_db, cs_l; 1187 int cs_db, cs_l;
1118 1188
1189 vcpu->mmio_fault_cr2 = cr2;
1119 kvm_arch_ops->cache_regs(vcpu); 1190 kvm_arch_ops->cache_regs(vcpu);
1120 1191
1121 kvm_arch_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 1192 kvm_arch_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
@@ -1166,8 +1237,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1166 kvm_arch_ops->decache_regs(vcpu); 1237 kvm_arch_ops->decache_regs(vcpu);
1167 kvm_arch_ops->set_rflags(vcpu, emulate_ctxt.eflags); 1238 kvm_arch_ops->set_rflags(vcpu, emulate_ctxt.eflags);
1168 1239
1169 if (vcpu->mmio_is_write) 1240 if (vcpu->mmio_is_write) {
1241 vcpu->mmio_needed = 0;
1170 return EMULATE_DO_MMIO; 1242 return EMULATE_DO_MMIO;
1243 }
1171 1244
1172 return EMULATE_DONE; 1245 return EMULATE_DONE;
1173} 1246}
@@ -1177,7 +1250,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
1177{ 1250{
1178 unsigned long nr, a0, a1, a2, a3, a4, a5, ret; 1251 unsigned long nr, a0, a1, a2, a3, a4, a5, ret;
1179 1252
1180 kvm_arch_ops->decache_regs(vcpu); 1253 kvm_arch_ops->cache_regs(vcpu);
1181 ret = -KVM_EINVAL; 1254 ret = -KVM_EINVAL;
1182#ifdef CONFIG_X86_64 1255#ifdef CONFIG_X86_64
1183 if (is_long_mode(vcpu)) { 1256 if (is_long_mode(vcpu)) {
@@ -1201,10 +1274,19 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
1201 } 1274 }
1202 switch (nr) { 1275 switch (nr) {
1203 default: 1276 default:
1204 ; 1277 run->hypercall.args[0] = a0;
1278 run->hypercall.args[1] = a1;
1279 run->hypercall.args[2] = a2;
1280 run->hypercall.args[3] = a3;
1281 run->hypercall.args[4] = a4;
1282 run->hypercall.args[5] = a5;
1283 run->hypercall.ret = ret;
1284 run->hypercall.longmode = is_long_mode(vcpu);
1285 kvm_arch_ops->decache_regs(vcpu);
1286 return 0;
1205 } 1287 }
1206 vcpu->regs[VCPU_REGS_RAX] = ret; 1288 vcpu->regs[VCPU_REGS_RAX] = ret;
1207 kvm_arch_ops->cache_regs(vcpu); 1289 kvm_arch_ops->decache_regs(vcpu);
1208 return 1; 1290 return 1;
1209} 1291}
1210EXPORT_SYMBOL_GPL(kvm_hypercall); 1292EXPORT_SYMBOL_GPL(kvm_hypercall);
@@ -1237,7 +1319,7 @@ void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw,
1237 1319
1238unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr) 1320unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr)
1239{ 1321{
1240 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); 1322 kvm_arch_ops->decache_cr4_guest_bits(vcpu);
1241 switch (cr) { 1323 switch (cr) {
1242 case 0: 1324 case 0:
1243 return vcpu->cr0; 1325 return vcpu->cr0;
@@ -1442,6 +1524,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1442 printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n", 1524 printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n",
1443 __FUNCTION__, data); 1525 __FUNCTION__, data);
1444 break; 1526 break;
1527 case MSR_IA32_MCG_STATUS:
1528 printk(KERN_WARNING "%s: MSR_IA32_MCG_STATUS 0x%llx, nop\n",
1529 __FUNCTION__, data);
1530 break;
1445 case MSR_IA32_UCODE_REV: 1531 case MSR_IA32_UCODE_REV:
1446 case MSR_IA32_UCODE_WRITE: 1532 case MSR_IA32_UCODE_WRITE:
1447 case 0x200 ... 0x2ff: /* MTRRs */ 1533 case 0x200 ... 0x2ff: /* MTRRs */
@@ -1478,6 +1564,8 @@ static int set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
1478 1564
1479void kvm_resched(struct kvm_vcpu *vcpu) 1565void kvm_resched(struct kvm_vcpu *vcpu)
1480{ 1566{
1567 if (!need_resched())
1568 return;
1481 vcpu_put(vcpu); 1569 vcpu_put(vcpu);
1482 cond_resched(); 1570 cond_resched();
1483 vcpu_load(vcpu); 1571 vcpu_load(vcpu);
@@ -1502,29 +1590,250 @@ void save_msrs(struct vmx_msr_entry *e, int n)
1502} 1590}
1503EXPORT_SYMBOL_GPL(save_msrs); 1591EXPORT_SYMBOL_GPL(save_msrs);
1504 1592
1593void kvm_emulate_cpuid(struct kvm_vcpu *vcpu)
1594{
1595 int i;
1596 u32 function;
1597 struct kvm_cpuid_entry *e, *best;
1598
1599 kvm_arch_ops->cache_regs(vcpu);
1600 function = vcpu->regs[VCPU_REGS_RAX];
1601 vcpu->regs[VCPU_REGS_RAX] = 0;
1602 vcpu->regs[VCPU_REGS_RBX] = 0;
1603 vcpu->regs[VCPU_REGS_RCX] = 0;
1604 vcpu->regs[VCPU_REGS_RDX] = 0;
1605 best = NULL;
1606 for (i = 0; i < vcpu->cpuid_nent; ++i) {
1607 e = &vcpu->cpuid_entries[i];
1608 if (e->function == function) {
1609 best = e;
1610 break;
1611 }
1612 /*
1613 * Both basic or both extended?
1614 */
1615 if (((e->function ^ function) & 0x80000000) == 0)
1616 if (!best || e->function > best->function)
1617 best = e;
1618 }
1619 if (best) {
1620 vcpu->regs[VCPU_REGS_RAX] = best->eax;
1621 vcpu->regs[VCPU_REGS_RBX] = best->ebx;
1622 vcpu->regs[VCPU_REGS_RCX] = best->ecx;
1623 vcpu->regs[VCPU_REGS_RDX] = best->edx;
1624 }
1625 kvm_arch_ops->decache_regs(vcpu);
1626 kvm_arch_ops->skip_emulated_instruction(vcpu);
1627}
1628EXPORT_SYMBOL_GPL(kvm_emulate_cpuid);
1629
1630static int pio_copy_data(struct kvm_vcpu *vcpu)
1631{
1632 void *p = vcpu->pio_data;
1633 void *q;
1634 unsigned bytes;
1635 int nr_pages = vcpu->pio.guest_pages[1] ? 2 : 1;
1636
1637 kvm_arch_ops->vcpu_put(vcpu);
1638 q = vmap(vcpu->pio.guest_pages, nr_pages, VM_READ|VM_WRITE,
1639 PAGE_KERNEL);
1640 if (!q) {
1641 kvm_arch_ops->vcpu_load(vcpu);
1642 free_pio_guest_pages(vcpu);
1643 return -ENOMEM;
1644 }
1645 q += vcpu->pio.guest_page_offset;
1646 bytes = vcpu->pio.size * vcpu->pio.cur_count;
1647 if (vcpu->pio.in)
1648 memcpy(q, p, bytes);
1649 else
1650 memcpy(p, q, bytes);
1651 q -= vcpu->pio.guest_page_offset;
1652 vunmap(q);
1653 kvm_arch_ops->vcpu_load(vcpu);
1654 free_pio_guest_pages(vcpu);
1655 return 0;
1656}
1657
1658static int complete_pio(struct kvm_vcpu *vcpu)
1659{
1660 struct kvm_pio_request *io = &vcpu->pio;
1661 long delta;
1662 int r;
1663
1664 kvm_arch_ops->cache_regs(vcpu);
1665
1666 if (!io->string) {
1667 if (io->in)
1668 memcpy(&vcpu->regs[VCPU_REGS_RAX], vcpu->pio_data,
1669 io->size);
1670 } else {
1671 if (io->in) {
1672 r = pio_copy_data(vcpu);
1673 if (r) {
1674 kvm_arch_ops->cache_regs(vcpu);
1675 return r;
1676 }
1677 }
1678
1679 delta = 1;
1680 if (io->rep) {
1681 delta *= io->cur_count;
1682 /*
1683 * The size of the register should really depend on
1684 * current address size.
1685 */
1686 vcpu->regs[VCPU_REGS_RCX] -= delta;
1687 }
1688 if (io->down)
1689 delta = -delta;
1690 delta *= io->size;
1691 if (io->in)
1692 vcpu->regs[VCPU_REGS_RDI] += delta;
1693 else
1694 vcpu->regs[VCPU_REGS_RSI] += delta;
1695 }
1696
1697 kvm_arch_ops->decache_regs(vcpu);
1698
1699 io->count -= io->cur_count;
1700 io->cur_count = 0;
1701
1702 if (!io->count)
1703 kvm_arch_ops->skip_emulated_instruction(vcpu);
1704 return 0;
1705}
1706
1707int kvm_setup_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
1708 int size, unsigned long count, int string, int down,
1709 gva_t address, int rep, unsigned port)
1710{
1711 unsigned now, in_page;
1712 int i;
1713 int nr_pages = 1;
1714 struct page *page;
1715
1716 vcpu->run->exit_reason = KVM_EXIT_IO;
1717 vcpu->run->io.direction = in ? KVM_EXIT_IO_IN : KVM_EXIT_IO_OUT;
1718 vcpu->run->io.size = size;
1719 vcpu->run->io.data_offset = KVM_PIO_PAGE_OFFSET * PAGE_SIZE;
1720 vcpu->run->io.count = count;
1721 vcpu->run->io.port = port;
1722 vcpu->pio.count = count;
1723 vcpu->pio.cur_count = count;
1724 vcpu->pio.size = size;
1725 vcpu->pio.in = in;
1726 vcpu->pio.string = string;
1727 vcpu->pio.down = down;
1728 vcpu->pio.guest_page_offset = offset_in_page(address);
1729 vcpu->pio.rep = rep;
1730
1731 if (!string) {
1732 kvm_arch_ops->cache_regs(vcpu);
1733 memcpy(vcpu->pio_data, &vcpu->regs[VCPU_REGS_RAX], 4);
1734 kvm_arch_ops->decache_regs(vcpu);
1735 return 0;
1736 }
1737
1738 if (!count) {
1739 kvm_arch_ops->skip_emulated_instruction(vcpu);
1740 return 1;
1741 }
1742
1743 now = min(count, PAGE_SIZE / size);
1744
1745 if (!down)
1746 in_page = PAGE_SIZE - offset_in_page(address);
1747 else
1748 in_page = offset_in_page(address) + size;
1749 now = min(count, (unsigned long)in_page / size);
1750 if (!now) {
1751 /*
1752 * String I/O straddles page boundary. Pin two guest pages
1753 * so that we satisfy atomicity constraints. Do just one
1754 * transaction to avoid complexity.
1755 */
1756 nr_pages = 2;
1757 now = 1;
1758 }
1759 if (down) {
1760 /*
1761 * String I/O in reverse. Yuck. Kill the guest, fix later.
1762 */
1763 printk(KERN_ERR "kvm: guest string pio down\n");
1764 inject_gp(vcpu);
1765 return 1;
1766 }
1767 vcpu->run->io.count = now;
1768 vcpu->pio.cur_count = now;
1769
1770 for (i = 0; i < nr_pages; ++i) {
1771 spin_lock(&vcpu->kvm->lock);
1772 page = gva_to_page(vcpu, address + i * PAGE_SIZE);
1773 if (page)
1774 get_page(page);
1775 vcpu->pio.guest_pages[i] = page;
1776 spin_unlock(&vcpu->kvm->lock);
1777 if (!page) {
1778 inject_gp(vcpu);
1779 free_pio_guest_pages(vcpu);
1780 return 1;
1781 }
1782 }
1783
1784 if (!vcpu->pio.in)
1785 return pio_copy_data(vcpu);
1786 return 0;
1787}
1788EXPORT_SYMBOL_GPL(kvm_setup_pio);
1789
1505static int kvm_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1790static int kvm_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1506{ 1791{
1507 int r; 1792 int r;
1793 sigset_t sigsaved;
1508 1794
1509 vcpu_load(vcpu); 1795 vcpu_load(vcpu);
1510 1796
1797 if (vcpu->sigset_active)
1798 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
1799
1511 /* re-sync apic's tpr */ 1800 /* re-sync apic's tpr */
1512 vcpu->cr8 = kvm_run->cr8; 1801 vcpu->cr8 = kvm_run->cr8;
1513 1802
1514 if (kvm_run->emulated) { 1803 if (vcpu->pio.cur_count) {
1515 kvm_arch_ops->skip_emulated_instruction(vcpu); 1804 r = complete_pio(vcpu);
1516 kvm_run->emulated = 0; 1805 if (r)
1806 goto out;
1517 } 1807 }
1518 1808
1519 if (kvm_run->mmio_completed) { 1809 if (vcpu->mmio_needed) {
1520 memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); 1810 memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
1521 vcpu->mmio_read_completed = 1; 1811 vcpu->mmio_read_completed = 1;
1812 vcpu->mmio_needed = 0;
1813 r = emulate_instruction(vcpu, kvm_run,
1814 vcpu->mmio_fault_cr2, 0);
1815 if (r == EMULATE_DO_MMIO) {
1816 /*
1817 * Read-modify-write. Back to userspace.
1818 */
1819 kvm_run->exit_reason = KVM_EXIT_MMIO;
1820 r = 0;
1821 goto out;
1822 }
1522 } 1823 }
1523 1824
1524 vcpu->mmio_needed = 0; 1825 if (kvm_run->exit_reason == KVM_EXIT_HYPERCALL) {
1826 kvm_arch_ops->cache_regs(vcpu);
1827 vcpu->regs[VCPU_REGS_RAX] = kvm_run->hypercall.ret;
1828 kvm_arch_ops->decache_regs(vcpu);
1829 }
1525 1830
1526 r = kvm_arch_ops->run(vcpu, kvm_run); 1831 r = kvm_arch_ops->run(vcpu, kvm_run);
1527 1832
1833out:
1834 if (vcpu->sigset_active)
1835 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1836
1528 vcpu_put(vcpu); 1837 vcpu_put(vcpu);
1529 return r; 1838 return r;
1530} 1839}
@@ -1633,7 +1942,7 @@ static int kvm_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
1633 sregs->gdt.limit = dt.limit; 1942 sregs->gdt.limit = dt.limit;
1634 sregs->gdt.base = dt.base; 1943 sregs->gdt.base = dt.base;
1635 1944
1636 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); 1945 kvm_arch_ops->decache_cr4_guest_bits(vcpu);
1637 sregs->cr0 = vcpu->cr0; 1946 sregs->cr0 = vcpu->cr0;
1638 sregs->cr2 = vcpu->cr2; 1947 sregs->cr2 = vcpu->cr2;
1639 sregs->cr3 = vcpu->cr3; 1948 sregs->cr3 = vcpu->cr3;
@@ -1665,16 +1974,6 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1665 1974
1666 vcpu_load(vcpu); 1975 vcpu_load(vcpu);
1667 1976
1668 set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
1669 set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
1670 set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
1671 set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
1672 set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
1673 set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
1674
1675 set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
1676 set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
1677
1678 dt.limit = sregs->idt.limit; 1977 dt.limit = sregs->idt.limit;
1679 dt.base = sregs->idt.base; 1978 dt.base = sregs->idt.base;
1680 kvm_arch_ops->set_idt(vcpu, &dt); 1979 kvm_arch_ops->set_idt(vcpu, &dt);
@@ -1694,10 +1993,10 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1694#endif 1993#endif
1695 vcpu->apic_base = sregs->apic_base; 1994 vcpu->apic_base = sregs->apic_base;
1696 1995
1697 kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); 1996 kvm_arch_ops->decache_cr4_guest_bits(vcpu);
1698 1997
1699 mmu_reset_needed |= vcpu->cr0 != sregs->cr0; 1998 mmu_reset_needed |= vcpu->cr0 != sregs->cr0;
1700 kvm_arch_ops->set_cr0_no_modeswitch(vcpu, sregs->cr0); 1999 kvm_arch_ops->set_cr0(vcpu, sregs->cr0);
1701 2000
1702 mmu_reset_needed |= vcpu->cr4 != sregs->cr4; 2001 mmu_reset_needed |= vcpu->cr4 != sregs->cr4;
1703 kvm_arch_ops->set_cr4(vcpu, sregs->cr4); 2002 kvm_arch_ops->set_cr4(vcpu, sregs->cr4);
@@ -1714,6 +2013,16 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1714 if (vcpu->irq_pending[i]) 2013 if (vcpu->irq_pending[i])
1715 __set_bit(i, &vcpu->irq_summary); 2014 __set_bit(i, &vcpu->irq_summary);
1716 2015
2016 set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
2017 set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
2018 set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
2019 set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
2020 set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
2021 set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
2022
2023 set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
2024 set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
2025
1717 vcpu_put(vcpu); 2026 vcpu_put(vcpu);
1718 2027
1719 return 0; 2028 return 0;
@@ -1887,6 +2196,36 @@ static int kvm_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
1887 return r; 2196 return r;
1888} 2197}
1889 2198
2199static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
2200 unsigned long address,
2201 int *type)
2202{
2203 struct kvm_vcpu *vcpu = vma->vm_file->private_data;
2204 unsigned long pgoff;
2205 struct page *page;
2206
2207 *type = VM_FAULT_MINOR;
2208 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
2209 if (pgoff == 0)
2210 page = virt_to_page(vcpu->run);
2211 else if (pgoff == KVM_PIO_PAGE_OFFSET)
2212 page = virt_to_page(vcpu->pio_data);
2213 else
2214 return NOPAGE_SIGBUS;
2215 get_page(page);
2216 return page;
2217}
2218
2219static struct vm_operations_struct kvm_vcpu_vm_ops = {
2220 .nopage = kvm_vcpu_nopage,
2221};
2222
2223static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma)
2224{
2225 vma->vm_ops = &kvm_vcpu_vm_ops;
2226 return 0;
2227}
2228
1890static int kvm_vcpu_release(struct inode *inode, struct file *filp) 2229static int kvm_vcpu_release(struct inode *inode, struct file *filp)
1891{ 2230{
1892 struct kvm_vcpu *vcpu = filp->private_data; 2231 struct kvm_vcpu *vcpu = filp->private_data;
@@ -1899,6 +2238,7 @@ static struct file_operations kvm_vcpu_fops = {
1899 .release = kvm_vcpu_release, 2238 .release = kvm_vcpu_release,
1900 .unlocked_ioctl = kvm_vcpu_ioctl, 2239 .unlocked_ioctl = kvm_vcpu_ioctl,
1901 .compat_ioctl = kvm_vcpu_ioctl, 2240 .compat_ioctl = kvm_vcpu_ioctl,
2241 .mmap = kvm_vcpu_mmap,
1902}; 2242};
1903 2243
1904/* 2244/*
@@ -1947,6 +2287,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
1947{ 2287{
1948 int r; 2288 int r;
1949 struct kvm_vcpu *vcpu; 2289 struct kvm_vcpu *vcpu;
2290 struct page *page;
1950 2291
1951 r = -EINVAL; 2292 r = -EINVAL;
1952 if (!valid_vcpu(n)) 2293 if (!valid_vcpu(n))
@@ -1961,9 +2302,22 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
1961 return -EEXIST; 2302 return -EEXIST;
1962 } 2303 }
1963 2304
2305 page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2306 r = -ENOMEM;
2307 if (!page)
2308 goto out_unlock;
2309 vcpu->run = page_address(page);
2310
2311 page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2312 r = -ENOMEM;
2313 if (!page)
2314 goto out_free_run;
2315 vcpu->pio_data = page_address(page);
2316
1964 vcpu->host_fx_image = (char*)ALIGN((hva_t)vcpu->fx_buf, 2317 vcpu->host_fx_image = (char*)ALIGN((hva_t)vcpu->fx_buf,
1965 FX_IMAGE_ALIGN); 2318 FX_IMAGE_ALIGN);
1966 vcpu->guest_fx_image = vcpu->host_fx_image + FX_IMAGE_SIZE; 2319 vcpu->guest_fx_image = vcpu->host_fx_image + FX_IMAGE_SIZE;
2320 vcpu->cr0 = 0x10;
1967 2321
1968 r = kvm_arch_ops->vcpu_create(vcpu); 2322 r = kvm_arch_ops->vcpu_create(vcpu);
1969 if (r < 0) 2323 if (r < 0)
@@ -1990,11 +2344,107 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
1990 2344
1991out_free_vcpus: 2345out_free_vcpus:
1992 kvm_free_vcpu(vcpu); 2346 kvm_free_vcpu(vcpu);
2347out_free_run:
2348 free_page((unsigned long)vcpu->run);
2349 vcpu->run = NULL;
2350out_unlock:
1993 mutex_unlock(&vcpu->mutex); 2351 mutex_unlock(&vcpu->mutex);
1994out: 2352out:
1995 return r; 2353 return r;
1996} 2354}
1997 2355
2356static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
2357 struct kvm_cpuid *cpuid,
2358 struct kvm_cpuid_entry __user *entries)
2359{
2360 int r;
2361
2362 r = -E2BIG;
2363 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES)
2364 goto out;
2365 r = -EFAULT;
2366 if (copy_from_user(&vcpu->cpuid_entries, entries,
2367 cpuid->nent * sizeof(struct kvm_cpuid_entry)))
2368 goto out;
2369 vcpu->cpuid_nent = cpuid->nent;
2370 return 0;
2371
2372out:
2373 return r;
2374}
2375
2376static int kvm_vcpu_ioctl_set_sigmask(struct kvm_vcpu *vcpu, sigset_t *sigset)
2377{
2378 if (sigset) {
2379 sigdelsetmask(sigset, sigmask(SIGKILL)|sigmask(SIGSTOP));
2380 vcpu->sigset_active = 1;
2381 vcpu->sigset = *sigset;
2382 } else
2383 vcpu->sigset_active = 0;
2384 return 0;
2385}
2386
2387/*
2388 * fxsave fpu state. Taken from x86_64/processor.h. To be killed when
2389 * we have asm/x86/processor.h
2390 */
2391struct fxsave {
2392 u16 cwd;
2393 u16 swd;
2394 u16 twd;
2395 u16 fop;
2396 u64 rip;
2397 u64 rdp;
2398 u32 mxcsr;
2399 u32 mxcsr_mask;
2400 u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
2401#ifdef CONFIG_X86_64
2402 u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
2403#else
2404 u32 xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
2405#endif
2406};
2407
2408static int kvm_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
2409{
2410 struct fxsave *fxsave = (struct fxsave *)vcpu->guest_fx_image;
2411
2412 vcpu_load(vcpu);
2413
2414 memcpy(fpu->fpr, fxsave->st_space, 128);
2415 fpu->fcw = fxsave->cwd;
2416 fpu->fsw = fxsave->swd;
2417 fpu->ftwx = fxsave->twd;
2418 fpu->last_opcode = fxsave->fop;
2419 fpu->last_ip = fxsave->rip;
2420 fpu->last_dp = fxsave->rdp;
2421 memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space);
2422
2423 vcpu_put(vcpu);
2424
2425 return 0;
2426}
2427
2428static int kvm_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
2429{
2430 struct fxsave *fxsave = (struct fxsave *)vcpu->guest_fx_image;
2431
2432 vcpu_load(vcpu);
2433
2434 memcpy(fxsave->st_space, fpu->fpr, 128);
2435 fxsave->cwd = fpu->fcw;
2436 fxsave->swd = fpu->fsw;
2437 fxsave->twd = fpu->ftwx;
2438 fxsave->fop = fpu->last_opcode;
2439 fxsave->rip = fpu->last_ip;
2440 fxsave->rdp = fpu->last_dp;
2441 memcpy(fxsave->xmm_space, fpu->xmm, sizeof fxsave->xmm_space);
2442
2443 vcpu_put(vcpu);
2444
2445 return 0;
2446}
2447
1998static long kvm_vcpu_ioctl(struct file *filp, 2448static long kvm_vcpu_ioctl(struct file *filp,
1999 unsigned int ioctl, unsigned long arg) 2449 unsigned int ioctl, unsigned long arg)
2000{ 2450{
@@ -2003,21 +2453,12 @@ static long kvm_vcpu_ioctl(struct file *filp,
2003 int r = -EINVAL; 2453 int r = -EINVAL;
2004 2454
2005 switch (ioctl) { 2455 switch (ioctl) {
2006 case KVM_RUN: { 2456 case KVM_RUN:
2007 struct kvm_run kvm_run; 2457 r = -EINVAL;
2008 2458 if (arg)
2009 r = -EFAULT;
2010 if (copy_from_user(&kvm_run, argp, sizeof kvm_run))
2011 goto out; 2459 goto out;
2012 r = kvm_vcpu_ioctl_run(vcpu, &kvm_run); 2460 r = kvm_vcpu_ioctl_run(vcpu, vcpu->run);
2013 if (r < 0 && r != -EINTR)
2014 goto out;
2015 if (copy_to_user(argp, &kvm_run, sizeof kvm_run)) {
2016 r = -EFAULT;
2017 goto out;
2018 }
2019 break; 2461 break;
2020 }
2021 case KVM_GET_REGS: { 2462 case KVM_GET_REGS: {
2022 struct kvm_regs kvm_regs; 2463 struct kvm_regs kvm_regs;
2023 2464
@@ -2113,6 +2554,66 @@ static long kvm_vcpu_ioctl(struct file *filp,
2113 case KVM_SET_MSRS: 2554 case KVM_SET_MSRS:
2114 r = msr_io(vcpu, argp, do_set_msr, 0); 2555 r = msr_io(vcpu, argp, do_set_msr, 0);
2115 break; 2556 break;
2557 case KVM_SET_CPUID: {
2558 struct kvm_cpuid __user *cpuid_arg = argp;
2559 struct kvm_cpuid cpuid;
2560
2561 r = -EFAULT;
2562 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
2563 goto out;
2564 r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
2565 if (r)
2566 goto out;
2567 break;
2568 }
2569 case KVM_SET_SIGNAL_MASK: {
2570 struct kvm_signal_mask __user *sigmask_arg = argp;
2571 struct kvm_signal_mask kvm_sigmask;
2572 sigset_t sigset, *p;
2573
2574 p = NULL;
2575 if (argp) {
2576 r = -EFAULT;
2577 if (copy_from_user(&kvm_sigmask, argp,
2578 sizeof kvm_sigmask))
2579 goto out;
2580 r = -EINVAL;
2581 if (kvm_sigmask.len != sizeof sigset)
2582 goto out;
2583 r = -EFAULT;
2584 if (copy_from_user(&sigset, sigmask_arg->sigset,
2585 sizeof sigset))
2586 goto out;
2587 p = &sigset;
2588 }
2589 r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset);
2590 break;
2591 }
2592 case KVM_GET_FPU: {
2593 struct kvm_fpu fpu;
2594
2595 memset(&fpu, 0, sizeof fpu);
2596 r = kvm_vcpu_ioctl_get_fpu(vcpu, &fpu);
2597 if (r)
2598 goto out;
2599 r = -EFAULT;
2600 if (copy_to_user(argp, &fpu, sizeof fpu))
2601 goto out;
2602 r = 0;
2603 break;
2604 }
2605 case KVM_SET_FPU: {
2606 struct kvm_fpu fpu;
2607
2608 r = -EFAULT;
2609 if (copy_from_user(&fpu, argp, sizeof fpu))
2610 goto out;
2611 r = kvm_vcpu_ioctl_set_fpu(vcpu, &fpu);
2612 if (r)
2613 goto out;
2614 r = 0;
2615 break;
2616 }
2116 default: 2617 default:
2117 ; 2618 ;
2118 } 2619 }
@@ -2155,6 +2656,17 @@ static long kvm_vm_ioctl(struct file *filp,
2155 goto out; 2656 goto out;
2156 break; 2657 break;
2157 } 2658 }
2659 case KVM_SET_MEMORY_ALIAS: {
2660 struct kvm_memory_alias alias;
2661
2662 r = -EFAULT;
2663 if (copy_from_user(&alias, argp, sizeof alias))
2664 goto out;
2665 r = kvm_vm_ioctl_set_memory_alias(kvm, &alias);
2666 if (r)
2667 goto out;
2668 break;
2669 }
2158 default: 2670 default:
2159 ; 2671 ;
2160 } 2672 }
@@ -2168,15 +2680,11 @@ static struct page *kvm_vm_nopage(struct vm_area_struct *vma,
2168{ 2680{
2169 struct kvm *kvm = vma->vm_file->private_data; 2681 struct kvm *kvm = vma->vm_file->private_data;
2170 unsigned long pgoff; 2682 unsigned long pgoff;
2171 struct kvm_memory_slot *slot;
2172 struct page *page; 2683 struct page *page;
2173 2684
2174 *type = VM_FAULT_MINOR; 2685 *type = VM_FAULT_MINOR;
2175 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; 2686 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
2176 slot = gfn_to_memslot(kvm, pgoff); 2687 page = gfn_to_page(kvm, pgoff);
2177 if (!slot)
2178 return NOPAGE_SIGBUS;
2179 page = gfn_to_page(slot, pgoff);
2180 if (!page) 2688 if (!page)
2181 return NOPAGE_SIGBUS; 2689 return NOPAGE_SIGBUS;
2182 get_page(page); 2690 get_page(page);
@@ -2248,13 +2756,19 @@ static long kvm_dev_ioctl(struct file *filp,
2248 unsigned int ioctl, unsigned long arg) 2756 unsigned int ioctl, unsigned long arg)
2249{ 2757{
2250 void __user *argp = (void __user *)arg; 2758 void __user *argp = (void __user *)arg;
2251 int r = -EINVAL; 2759 long r = -EINVAL;
2252 2760
2253 switch (ioctl) { 2761 switch (ioctl) {
2254 case KVM_GET_API_VERSION: 2762 case KVM_GET_API_VERSION:
2763 r = -EINVAL;
2764 if (arg)
2765 goto out;
2255 r = KVM_API_VERSION; 2766 r = KVM_API_VERSION;
2256 break; 2767 break;
2257 case KVM_CREATE_VM: 2768 case KVM_CREATE_VM:
2769 r = -EINVAL;
2770 if (arg)
2771 goto out;
2258 r = kvm_dev_ioctl_create_vm(); 2772 r = kvm_dev_ioctl_create_vm();
2259 break; 2773 break;
2260 case KVM_GET_MSR_INDEX_LIST: { 2774 case KVM_GET_MSR_INDEX_LIST: {
@@ -2284,6 +2798,18 @@ static long kvm_dev_ioctl(struct file *filp,
2284 r = 0; 2798 r = 0;
2285 break; 2799 break;
2286 } 2800 }
2801 case KVM_CHECK_EXTENSION:
2802 /*
2803 * No extensions defined at present.
2804 */
2805 r = 0;
2806 break;
2807 case KVM_GET_VCPU_MMAP_SIZE:
2808 r = -EINVAL;
2809 if (arg)
2810 goto out;
2811 r = 2 * PAGE_SIZE;
2812 break;
2287 default: 2813 default:
2288 ; 2814 ;
2289 } 2815 }
@@ -2299,7 +2825,7 @@ static struct file_operations kvm_chardev_ops = {
2299}; 2825};
2300 2826
2301static struct miscdevice kvm_dev = { 2827static struct miscdevice kvm_dev = {
2302 MISC_DYNAMIC_MINOR, 2828 KVM_MINOR,
2303 "kvm", 2829 "kvm",
2304 &kvm_chardev_ops, 2830 &kvm_chardev_ops,
2305}; 2831};
@@ -2385,14 +2911,39 @@ static struct notifier_block kvm_cpu_notifier = {
2385 .priority = 20, /* must be > scheduler priority */ 2911 .priority = 20, /* must be > scheduler priority */
2386}; 2912};
2387 2913
2914static u64 stat_get(void *_offset)
2915{
2916 unsigned offset = (long)_offset;
2917 u64 total = 0;
2918 struct kvm *kvm;
2919 struct kvm_vcpu *vcpu;
2920 int i;
2921
2922 spin_lock(&kvm_lock);
2923 list_for_each_entry(kvm, &vm_list, vm_list)
2924 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
2925 vcpu = &kvm->vcpus[i];
2926 total += *(u32 *)((void *)vcpu + offset);
2927 }
2928 spin_unlock(&kvm_lock);
2929 return total;
2930}
2931
2932static void stat_set(void *offset, u64 val)
2933{
2934}
2935
2936DEFINE_SIMPLE_ATTRIBUTE(stat_fops, stat_get, stat_set, "%llu\n");
2937
2388static __init void kvm_init_debug(void) 2938static __init void kvm_init_debug(void)
2389{ 2939{
2390 struct kvm_stats_debugfs_item *p; 2940 struct kvm_stats_debugfs_item *p;
2391 2941
2392 debugfs_dir = debugfs_create_dir("kvm", NULL); 2942 debugfs_dir = debugfs_create_dir("kvm", NULL);
2393 for (p = debugfs_entries; p->name; ++p) 2943 for (p = debugfs_entries; p->name; ++p)
2394 p->dentry = debugfs_create_u32(p->name, 0444, debugfs_dir, 2944 p->dentry = debugfs_create_file(p->name, 0444, debugfs_dir,
2395 p->data); 2945 (void *)(long)p->offset,
2946 &stat_fops);
2396} 2947}
2397 2948
2398static void kvm_exit_debug(void) 2949static void kvm_exit_debug(void)
@@ -2522,6 +3073,10 @@ static __init int kvm_init(void)
2522 static struct page *bad_page; 3073 static struct page *bad_page;
2523 int r; 3074 int r;
2524 3075
3076 r = kvm_mmu_module_init();
3077 if (r)
3078 goto out4;
3079
2525 r = register_filesystem(&kvm_fs_type); 3080 r = register_filesystem(&kvm_fs_type);
2526 if (r) 3081 if (r)
2527 goto out3; 3082 goto out3;
@@ -2550,6 +3105,8 @@ out:
2550out2: 3105out2:
2551 unregister_filesystem(&kvm_fs_type); 3106 unregister_filesystem(&kvm_fs_type);
2552out3: 3107out3:
3108 kvm_mmu_module_exit();
3109out4:
2553 return r; 3110 return r;
2554} 3111}
2555 3112
@@ -2559,6 +3116,7 @@ static __exit void kvm_exit(void)
2559 __free_page(pfn_to_page(bad_page_address >> PAGE_SHIFT)); 3116 __free_page(pfn_to_page(bad_page_address >> PAGE_SHIFT));
2560 mntput(kvmfs_mnt); 3117 mntput(kvmfs_mnt);
2561 unregister_filesystem(&kvm_fs_type); 3118 unregister_filesystem(&kvm_fs_type);
3119 kvm_mmu_module_exit();
2562} 3120}
2563 3121
2564module_init(kvm_init) 3122module_init(kvm_init)
diff --git a/drivers/kvm/kvm_svm.h b/drivers/kvm/kvm_svm.h
index 624f1ca48657..a869983d683d 100644
--- a/drivers/kvm/kvm_svm.h
+++ b/drivers/kvm/kvm_svm.h
@@ -9,17 +9,15 @@
9#include "svm.h" 9#include "svm.h"
10#include "kvm.h" 10#include "kvm.h"
11 11
12static const u32 host_save_msrs[] = { 12static const u32 host_save_user_msrs[] = {
13#ifdef CONFIG_X86_64 13#ifdef CONFIG_X86_64
14 MSR_STAR, MSR_LSTAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_KERNEL_GS_BASE, 14 MSR_STAR, MSR_LSTAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_KERNEL_GS_BASE,
15 MSR_FS_BASE, MSR_GS_BASE, 15 MSR_FS_BASE,
16#endif 16#endif
17 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP, 17 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
18 MSR_IA32_DEBUGCTLMSR, /*MSR_IA32_LASTBRANCHFROMIP,
19 MSR_IA32_LASTBRANCHTOIP, MSR_IA32_LASTINTFROMIP,MSR_IA32_LASTINTTOIP,*/
20}; 18};
21 19
22#define NR_HOST_SAVE_MSRS ARRAY_SIZE(host_save_msrs) 20#define NR_HOST_SAVE_USER_MSRS ARRAY_SIZE(host_save_user_msrs)
23#define NUM_DB_REGS 4 21#define NUM_DB_REGS 4
24 22
25struct vcpu_svm { 23struct vcpu_svm {
@@ -28,13 +26,12 @@ struct vcpu_svm {
28 struct svm_cpu_data *svm_data; 26 struct svm_cpu_data *svm_data;
29 uint64_t asid_generation; 27 uint64_t asid_generation;
30 28
31 unsigned long cr0;
32 unsigned long cr4;
33 unsigned long db_regs[NUM_DB_REGS]; 29 unsigned long db_regs[NUM_DB_REGS];
34 30
35 u64 next_rip; 31 u64 next_rip;
36 32
37 u64 host_msrs[NR_HOST_SAVE_MSRS]; 33 u64 host_user_msrs[NR_HOST_SAVE_USER_MSRS];
34 u64 host_gs_base;
38 unsigned long host_cr2; 35 unsigned long host_cr2;
39 unsigned long host_db_regs[NUM_DB_REGS]; 36 unsigned long host_db_regs[NUM_DB_REGS];
40 unsigned long host_dr6; 37 unsigned long host_dr6;
diff --git a/drivers/kvm/kvm_vmx.h b/drivers/kvm/kvm_vmx.h
deleted file mode 100644
index d139f73fb6e1..000000000000
--- a/drivers/kvm/kvm_vmx.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __KVM_VMX_H
2#define __KVM_VMX_H
3
4#ifdef CONFIG_X86_64
5/*
6 * avoid save/load MSR_SYSCALL_MASK and MSR_LSTAR by std vt
7 * mechanism (cpu bug AA24)
8 */
9#define NR_BAD_MSRS 2
10#else
11#define NR_BAD_MSRS 0
12#endif
13
14#endif
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index cab26f301eab..e8e228118de9 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -52,11 +52,15 @@ static void kvm_mmu_audit(struct kvm_vcpu *vcpu, const char *msg) {}
52static int dbg = 1; 52static int dbg = 1;
53#endif 53#endif
54 54
55#ifndef MMU_DEBUG
56#define ASSERT(x) do { } while (0)
57#else
55#define ASSERT(x) \ 58#define ASSERT(x) \
56 if (!(x)) { \ 59 if (!(x)) { \
57 printk(KERN_WARNING "assertion failed %s:%d: %s\n", \ 60 printk(KERN_WARNING "assertion failed %s:%d: %s\n", \
58 __FILE__, __LINE__, #x); \ 61 __FILE__, __LINE__, #x); \
59 } 62 }
63#endif
60 64
61#define PT64_PT_BITS 9 65#define PT64_PT_BITS 9
62#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS) 66#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)
@@ -159,6 +163,9 @@ struct kvm_rmap_desc {
159 struct kvm_rmap_desc *more; 163 struct kvm_rmap_desc *more;
160}; 164};
161 165
166static struct kmem_cache *pte_chain_cache;
167static struct kmem_cache *rmap_desc_cache;
168
162static int is_write_protection(struct kvm_vcpu *vcpu) 169static int is_write_protection(struct kvm_vcpu *vcpu)
163{ 170{
164 return vcpu->cr0 & CR0_WP_MASK; 171 return vcpu->cr0 & CR0_WP_MASK;
@@ -196,14 +203,15 @@ static int is_rmap_pte(u64 pte)
196} 203}
197 204
198static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, 205static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
199 size_t objsize, int min) 206 struct kmem_cache *base_cache, int min,
207 gfp_t gfp_flags)
200{ 208{
201 void *obj; 209 void *obj;
202 210
203 if (cache->nobjs >= min) 211 if (cache->nobjs >= min)
204 return 0; 212 return 0;
205 while (cache->nobjs < ARRAY_SIZE(cache->objects)) { 213 while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
206 obj = kzalloc(objsize, GFP_NOWAIT); 214 obj = kmem_cache_zalloc(base_cache, gfp_flags);
207 if (!obj) 215 if (!obj)
208 return -ENOMEM; 216 return -ENOMEM;
209 cache->objects[cache->nobjs++] = obj; 217 cache->objects[cache->nobjs++] = obj;
@@ -217,20 +225,35 @@ static void mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc)
217 kfree(mc->objects[--mc->nobjs]); 225 kfree(mc->objects[--mc->nobjs]);
218} 226}
219 227
220static int mmu_topup_memory_caches(struct kvm_vcpu *vcpu) 228static int __mmu_topup_memory_caches(struct kvm_vcpu *vcpu, gfp_t gfp_flags)
221{ 229{
222 int r; 230 int r;
223 231
224 r = mmu_topup_memory_cache(&vcpu->mmu_pte_chain_cache, 232 r = mmu_topup_memory_cache(&vcpu->mmu_pte_chain_cache,
225 sizeof(struct kvm_pte_chain), 4); 233 pte_chain_cache, 4, gfp_flags);
226 if (r) 234 if (r)
227 goto out; 235 goto out;
228 r = mmu_topup_memory_cache(&vcpu->mmu_rmap_desc_cache, 236 r = mmu_topup_memory_cache(&vcpu->mmu_rmap_desc_cache,
229 sizeof(struct kvm_rmap_desc), 1); 237 rmap_desc_cache, 1, gfp_flags);
230out: 238out:
231 return r; 239 return r;
232} 240}
233 241
242static int mmu_topup_memory_caches(struct kvm_vcpu *vcpu)
243{
244 int r;
245
246 r = __mmu_topup_memory_caches(vcpu, GFP_NOWAIT);
247 if (r < 0) {
248 spin_unlock(&vcpu->kvm->lock);
249 kvm_arch_ops->vcpu_put(vcpu);
250 r = __mmu_topup_memory_caches(vcpu, GFP_KERNEL);
251 kvm_arch_ops->vcpu_load(vcpu);
252 spin_lock(&vcpu->kvm->lock);
253 }
254 return r;
255}
256
234static void mmu_free_memory_caches(struct kvm_vcpu *vcpu) 257static void mmu_free_memory_caches(struct kvm_vcpu *vcpu)
235{ 258{
236 mmu_free_memory_cache(&vcpu->mmu_pte_chain_cache); 259 mmu_free_memory_cache(&vcpu->mmu_pte_chain_cache);
@@ -390,13 +413,11 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn)
390{ 413{
391 struct kvm *kvm = vcpu->kvm; 414 struct kvm *kvm = vcpu->kvm;
392 struct page *page; 415 struct page *page;
393 struct kvm_memory_slot *slot;
394 struct kvm_rmap_desc *desc; 416 struct kvm_rmap_desc *desc;
395 u64 *spte; 417 u64 *spte;
396 418
397 slot = gfn_to_memslot(kvm, gfn); 419 page = gfn_to_page(kvm, gfn);
398 BUG_ON(!slot); 420 BUG_ON(!page);
399 page = gfn_to_page(slot, gfn);
400 421
401 while (page_private(page)) { 422 while (page_private(page)) {
402 if (!(page_private(page) & 1)) 423 if (!(page_private(page) & 1))
@@ -417,6 +438,7 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn)
417 } 438 }
418} 439}
419 440
441#ifdef MMU_DEBUG
420static int is_empty_shadow_page(hpa_t page_hpa) 442static int is_empty_shadow_page(hpa_t page_hpa)
421{ 443{
422 u64 *pos; 444 u64 *pos;
@@ -431,15 +453,15 @@ static int is_empty_shadow_page(hpa_t page_hpa)
431 } 453 }
432 return 1; 454 return 1;
433} 455}
456#endif
434 457
435static void kvm_mmu_free_page(struct kvm_vcpu *vcpu, hpa_t page_hpa) 458static void kvm_mmu_free_page(struct kvm_vcpu *vcpu, hpa_t page_hpa)
436{ 459{
437 struct kvm_mmu_page *page_head = page_header(page_hpa); 460 struct kvm_mmu_page *page_head = page_header(page_hpa);
438 461
439 ASSERT(is_empty_shadow_page(page_hpa)); 462 ASSERT(is_empty_shadow_page(page_hpa));
440 list_del(&page_head->link);
441 page_head->page_hpa = page_hpa; 463 page_head->page_hpa = page_hpa;
442 list_add(&page_head->link, &vcpu->free_pages); 464 list_move(&page_head->link, &vcpu->free_pages);
443 ++vcpu->kvm->n_free_mmu_pages; 465 ++vcpu->kvm->n_free_mmu_pages;
444} 466}
445 467
@@ -457,11 +479,9 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
457 return NULL; 479 return NULL;
458 480
459 page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link); 481 page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link);
460 list_del(&page->link); 482 list_move(&page->link, &vcpu->kvm->active_mmu_pages);
461 list_add(&page->link, &vcpu->kvm->active_mmu_pages);
462 ASSERT(is_empty_shadow_page(page->page_hpa)); 483 ASSERT(is_empty_shadow_page(page->page_hpa));
463 page->slot_bitmap = 0; 484 page->slot_bitmap = 0;
464 page->global = 1;
465 page->multimapped = 0; 485 page->multimapped = 0;
466 page->parent_pte = parent_pte; 486 page->parent_pte = parent_pte;
467 --vcpu->kvm->n_free_mmu_pages; 487 --vcpu->kvm->n_free_mmu_pages;
@@ -569,6 +589,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
569 gva_t gaddr, 589 gva_t gaddr,
570 unsigned level, 590 unsigned level,
571 int metaphysical, 591 int metaphysical,
592 unsigned hugepage_access,
572 u64 *parent_pte) 593 u64 *parent_pte)
573{ 594{
574 union kvm_mmu_page_role role; 595 union kvm_mmu_page_role role;
@@ -582,6 +603,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
582 role.glevels = vcpu->mmu.root_level; 603 role.glevels = vcpu->mmu.root_level;
583 role.level = level; 604 role.level = level;
584 role.metaphysical = metaphysical; 605 role.metaphysical = metaphysical;
606 role.hugepage_access = hugepage_access;
585 if (vcpu->mmu.root_level <= PT32_ROOT_LEVEL) { 607 if (vcpu->mmu.root_level <= PT32_ROOT_LEVEL) {
586 quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level)); 608 quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level));
587 quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1; 609 quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1;
@@ -669,10 +691,8 @@ static void kvm_mmu_zap_page(struct kvm_vcpu *vcpu,
669 if (!page->root_count) { 691 if (!page->root_count) {
670 hlist_del(&page->hash_link); 692 hlist_del(&page->hash_link);
671 kvm_mmu_free_page(vcpu, page->page_hpa); 693 kvm_mmu_free_page(vcpu, page->page_hpa);
672 } else { 694 } else
673 list_del(&page->link); 695 list_move(&page->link, &vcpu->kvm->active_mmu_pages);
674 list_add(&page->link, &vcpu->kvm->active_mmu_pages);
675 }
676} 696}
677 697
678static int kvm_mmu_unprotect_page(struct kvm_vcpu *vcpu, gfn_t gfn) 698static int kvm_mmu_unprotect_page(struct kvm_vcpu *vcpu, gfn_t gfn)
@@ -714,14 +734,12 @@ hpa_t safe_gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa)
714 734
715hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa) 735hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa)
716{ 736{
717 struct kvm_memory_slot *slot;
718 struct page *page; 737 struct page *page;
719 738
720 ASSERT((gpa & HPA_ERR_MASK) == 0); 739 ASSERT((gpa & HPA_ERR_MASK) == 0);
721 slot = gfn_to_memslot(vcpu->kvm, gpa >> PAGE_SHIFT); 740 page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT);
722 if (!slot) 741 if (!page)
723 return gpa | HPA_ERR_MASK; 742 return gpa | HPA_ERR_MASK;
724 page = gfn_to_page(slot, gpa >> PAGE_SHIFT);
725 return ((hpa_t)page_to_pfn(page) << PAGE_SHIFT) 743 return ((hpa_t)page_to_pfn(page) << PAGE_SHIFT)
726 | (gpa & (PAGE_SIZE-1)); 744 | (gpa & (PAGE_SIZE-1));
727} 745}
@@ -735,6 +753,15 @@ hpa_t gva_to_hpa(struct kvm_vcpu *vcpu, gva_t gva)
735 return gpa_to_hpa(vcpu, gpa); 753 return gpa_to_hpa(vcpu, gpa);
736} 754}
737 755
756struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva)
757{
758 gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, gva);
759
760 if (gpa == UNMAPPED_GVA)
761 return NULL;
762 return pfn_to_page(gpa_to_hpa(vcpu, gpa) >> PAGE_SHIFT);
763}
764
738static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) 765static void nonpaging_new_cr3(struct kvm_vcpu *vcpu)
739{ 766{
740} 767}
@@ -772,7 +799,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, hpa_t p)
772 >> PAGE_SHIFT; 799 >> PAGE_SHIFT;
773 new_table = kvm_mmu_get_page(vcpu, pseudo_gfn, 800 new_table = kvm_mmu_get_page(vcpu, pseudo_gfn,
774 v, level - 1, 801 v, level - 1,
775 1, &table[index]); 802 1, 0, &table[index]);
776 if (!new_table) { 803 if (!new_table) {
777 pgprintk("nonpaging_map: ENOMEM\n"); 804 pgprintk("nonpaging_map: ENOMEM\n");
778 return -ENOMEM; 805 return -ENOMEM;
@@ -804,10 +831,12 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
804 for (i = 0; i < 4; ++i) { 831 for (i = 0; i < 4; ++i) {
805 hpa_t root = vcpu->mmu.pae_root[i]; 832 hpa_t root = vcpu->mmu.pae_root[i];
806 833
807 ASSERT(VALID_PAGE(root)); 834 if (root) {
808 root &= PT64_BASE_ADDR_MASK; 835 ASSERT(VALID_PAGE(root));
809 page = page_header(root); 836 root &= PT64_BASE_ADDR_MASK;
810 --page->root_count; 837 page = page_header(root);
838 --page->root_count;
839 }
811 vcpu->mmu.pae_root[i] = INVALID_PAGE; 840 vcpu->mmu.pae_root[i] = INVALID_PAGE;
812 } 841 }
813 vcpu->mmu.root_hpa = INVALID_PAGE; 842 vcpu->mmu.root_hpa = INVALID_PAGE;
@@ -827,7 +856,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
827 856
828 ASSERT(!VALID_PAGE(root)); 857 ASSERT(!VALID_PAGE(root));
829 page = kvm_mmu_get_page(vcpu, root_gfn, 0, 858 page = kvm_mmu_get_page(vcpu, root_gfn, 0,
830 PT64_ROOT_LEVEL, 0, NULL); 859 PT64_ROOT_LEVEL, 0, 0, NULL);
831 root = page->page_hpa; 860 root = page->page_hpa;
832 ++page->root_count; 861 ++page->root_count;
833 vcpu->mmu.root_hpa = root; 862 vcpu->mmu.root_hpa = root;
@@ -838,13 +867,17 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
838 hpa_t root = vcpu->mmu.pae_root[i]; 867 hpa_t root = vcpu->mmu.pae_root[i];
839 868
840 ASSERT(!VALID_PAGE(root)); 869 ASSERT(!VALID_PAGE(root));
841 if (vcpu->mmu.root_level == PT32E_ROOT_LEVEL) 870 if (vcpu->mmu.root_level == PT32E_ROOT_LEVEL) {
871 if (!is_present_pte(vcpu->pdptrs[i])) {
872 vcpu->mmu.pae_root[i] = 0;
873 continue;
874 }
842 root_gfn = vcpu->pdptrs[i] >> PAGE_SHIFT; 875 root_gfn = vcpu->pdptrs[i] >> PAGE_SHIFT;
843 else if (vcpu->mmu.root_level == 0) 876 } else if (vcpu->mmu.root_level == 0)
844 root_gfn = 0; 877 root_gfn = 0;
845 page = kvm_mmu_get_page(vcpu, root_gfn, i << 30, 878 page = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
846 PT32_ROOT_LEVEL, !is_paging(vcpu), 879 PT32_ROOT_LEVEL, !is_paging(vcpu),
847 NULL); 880 0, NULL);
848 root = page->page_hpa; 881 root = page->page_hpa;
849 ++page->root_count; 882 ++page->root_count;
850 vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK; 883 vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK;
@@ -903,7 +936,7 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu)
903 936
904static void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu) 937static void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu)
905{ 938{
906 ++kvm_stat.tlb_flush; 939 ++vcpu->stat.tlb_flush;
907 kvm_arch_ops->tlb_flush(vcpu); 940 kvm_arch_ops->tlb_flush(vcpu);
908} 941}
909 942
@@ -918,11 +951,6 @@ static void paging_new_cr3(struct kvm_vcpu *vcpu)
918 kvm_arch_ops->set_cr3(vcpu, vcpu->mmu.root_hpa); 951 kvm_arch_ops->set_cr3(vcpu, vcpu->mmu.root_hpa);
919} 952}
920 953
921static void mark_pagetable_nonglobal(void *shadow_pte)
922{
923 page_header(__pa(shadow_pte))->global = 0;
924}
925
926static inline void set_pte_common(struct kvm_vcpu *vcpu, 954static inline void set_pte_common(struct kvm_vcpu *vcpu,
927 u64 *shadow_pte, 955 u64 *shadow_pte,
928 gpa_t gaddr, 956 gpa_t gaddr,
@@ -940,9 +968,6 @@ static inline void set_pte_common(struct kvm_vcpu *vcpu,
940 968
941 *shadow_pte |= access_bits; 969 *shadow_pte |= access_bits;
942 970
943 if (!(*shadow_pte & PT_GLOBAL_MASK))
944 mark_pagetable_nonglobal(shadow_pte);
945
946 if (is_error_hpa(paddr)) { 971 if (is_error_hpa(paddr)) {
947 *shadow_pte |= gaddr; 972 *shadow_pte |= gaddr;
948 *shadow_pte |= PT_SHADOW_IO_MARK; 973 *shadow_pte |= PT_SHADOW_IO_MARK;
@@ -1316,6 +1341,51 @@ void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot)
1316 } 1341 }
1317} 1342}
1318 1343
1344void kvm_mmu_zap_all(struct kvm_vcpu *vcpu)
1345{
1346 destroy_kvm_mmu(vcpu);
1347
1348 while (!list_empty(&vcpu->kvm->active_mmu_pages)) {
1349 struct kvm_mmu_page *page;
1350
1351 page = container_of(vcpu->kvm->active_mmu_pages.next,
1352 struct kvm_mmu_page, link);
1353 kvm_mmu_zap_page(vcpu, page);
1354 }
1355
1356 mmu_free_memory_caches(vcpu);
1357 kvm_arch_ops->tlb_flush(vcpu);
1358 init_kvm_mmu(vcpu);
1359}
1360
1361void kvm_mmu_module_exit(void)
1362{
1363 if (pte_chain_cache)
1364 kmem_cache_destroy(pte_chain_cache);
1365 if (rmap_desc_cache)
1366 kmem_cache_destroy(rmap_desc_cache);
1367}
1368
1369int kvm_mmu_module_init(void)
1370{
1371 pte_chain_cache = kmem_cache_create("kvm_pte_chain",
1372 sizeof(struct kvm_pte_chain),
1373 0, 0, NULL, NULL);
1374 if (!pte_chain_cache)
1375 goto nomem;
1376 rmap_desc_cache = kmem_cache_create("kvm_rmap_desc",
1377 sizeof(struct kvm_rmap_desc),
1378 0, 0, NULL, NULL);
1379 if (!rmap_desc_cache)
1380 goto nomem;
1381
1382 return 0;
1383
1384nomem:
1385 kvm_mmu_module_exit();
1386 return -ENOMEM;
1387}
1388
1319#ifdef AUDIT 1389#ifdef AUDIT
1320 1390
1321static const char *audit_msg; 1391static const char *audit_msg;
@@ -1338,7 +1408,7 @@ static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte,
1338 for (i = 0; i < PT64_ENT_PER_PAGE; ++i, va += va_delta) { 1408 for (i = 0; i < PT64_ENT_PER_PAGE; ++i, va += va_delta) {
1339 u64 ent = pt[i]; 1409 u64 ent = pt[i];
1340 1410
1341 if (!ent & PT_PRESENT_MASK) 1411 if (!(ent & PT_PRESENT_MASK))
1342 continue; 1412 continue;
1343 1413
1344 va = canonicalize(va); 1414 va = canonicalize(va);
@@ -1360,7 +1430,7 @@ static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte,
1360 1430
1361static void audit_mappings(struct kvm_vcpu *vcpu) 1431static void audit_mappings(struct kvm_vcpu *vcpu)
1362{ 1432{
1363 int i; 1433 unsigned i;
1364 1434
1365 if (vcpu->mmu.root_level == 4) 1435 if (vcpu->mmu.root_level == 4)
1366 audit_mappings_page(vcpu, vcpu->mmu.root_hpa, 0, 4); 1436 audit_mappings_page(vcpu, vcpu->mmu.root_hpa, 0, 4);
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index f3bcee904651..73ffbffb1097 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -148,8 +148,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
148 break; 148 break;
149 } 149 }
150 150
151 if (walker->level != 3 || is_long_mode(vcpu)) 151 walker->inherited_ar &= walker->table[index];
152 walker->inherited_ar &= walker->table[index];
153 table_gfn = (*ptep & PT_BASE_ADDR_MASK) >> PAGE_SHIFT; 152 table_gfn = (*ptep & PT_BASE_ADDR_MASK) >> PAGE_SHIFT;
154 paddr = safe_gpa_to_hpa(vcpu, *ptep & PT_BASE_ADDR_MASK); 153 paddr = safe_gpa_to_hpa(vcpu, *ptep & PT_BASE_ADDR_MASK);
155 kunmap_atomic(walker->table, KM_USER0); 154 kunmap_atomic(walker->table, KM_USER0);
@@ -248,6 +247,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
248 u64 shadow_pte; 247 u64 shadow_pte;
249 int metaphysical; 248 int metaphysical;
250 gfn_t table_gfn; 249 gfn_t table_gfn;
250 unsigned hugepage_access = 0;
251 251
252 if (is_present_pte(*shadow_ent) || is_io_pte(*shadow_ent)) { 252 if (is_present_pte(*shadow_ent) || is_io_pte(*shadow_ent)) {
253 if (level == PT_PAGE_TABLE_LEVEL) 253 if (level == PT_PAGE_TABLE_LEVEL)
@@ -277,6 +277,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
277 if (level - 1 == PT_PAGE_TABLE_LEVEL 277 if (level - 1 == PT_PAGE_TABLE_LEVEL
278 && walker->level == PT_DIRECTORY_LEVEL) { 278 && walker->level == PT_DIRECTORY_LEVEL) {
279 metaphysical = 1; 279 metaphysical = 1;
280 hugepage_access = *guest_ent;
281 hugepage_access &= PT_USER_MASK | PT_WRITABLE_MASK;
282 hugepage_access >>= PT_WRITABLE_SHIFT;
280 table_gfn = (*guest_ent & PT_BASE_ADDR_MASK) 283 table_gfn = (*guest_ent & PT_BASE_ADDR_MASK)
281 >> PAGE_SHIFT; 284 >> PAGE_SHIFT;
282 } else { 285 } else {
@@ -284,7 +287,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
284 table_gfn = walker->table_gfn[level - 2]; 287 table_gfn = walker->table_gfn[level - 2];
285 } 288 }
286 shadow_page = kvm_mmu_get_page(vcpu, table_gfn, addr, level-1, 289 shadow_page = kvm_mmu_get_page(vcpu, table_gfn, addr, level-1,
287 metaphysical, shadow_ent); 290 metaphysical, hugepage_access,
291 shadow_ent);
288 shadow_addr = shadow_page->page_hpa; 292 shadow_addr = shadow_page->page_hpa;
289 shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK 293 shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK
290 | PT_WRITABLE_MASK | PT_USER_MASK; 294 | PT_WRITABLE_MASK | PT_USER_MASK;
@@ -444,7 +448,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
444 if (is_io_pte(*shadow_pte)) 448 if (is_io_pte(*shadow_pte))
445 return 1; 449 return 1;
446 450
447 ++kvm_stat.pf_fixed; 451 ++vcpu->stat.pf_fixed;
448 kvm_mmu_audit(vcpu, "post page fault (fixed)"); 452 kvm_mmu_audit(vcpu, "post page fault (fixed)");
449 453
450 return write_pt; 454 return write_pt;
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 3d8ea7ac2ecc..9c15f32eea18 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -44,6 +44,10 @@ MODULE_LICENSE("GPL");
44#define KVM_EFER_LMA (1 << 10) 44#define KVM_EFER_LMA (1 << 10)
45#define KVM_EFER_LME (1 << 8) 45#define KVM_EFER_LME (1 << 8)
46 46
47#define SVM_FEATURE_NPT (1 << 0)
48#define SVM_FEATURE_LBRV (1 << 1)
49#define SVM_DEATURE_SVML (1 << 2)
50
47unsigned long iopm_base; 51unsigned long iopm_base;
48unsigned long msrpm_base; 52unsigned long msrpm_base;
49 53
@@ -59,15 +63,16 @@ struct kvm_ldttss_desc {
59struct svm_cpu_data { 63struct svm_cpu_data {
60 int cpu; 64 int cpu;
61 65
62 uint64_t asid_generation; 66 u64 asid_generation;
63 uint32_t max_asid; 67 u32 max_asid;
64 uint32_t next_asid; 68 u32 next_asid;
65 struct kvm_ldttss_desc *tss_desc; 69 struct kvm_ldttss_desc *tss_desc;
66 70
67 struct page *save_area; 71 struct page *save_area;
68}; 72};
69 73
70static DEFINE_PER_CPU(struct svm_cpu_data *, svm_data); 74static DEFINE_PER_CPU(struct svm_cpu_data *, svm_data);
75static uint32_t svm_features;
71 76
72struct svm_init_data { 77struct svm_init_data {
73 int cpu; 78 int cpu;
@@ -82,6 +87,11 @@ static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000};
82 87
83#define MAX_INST_SIZE 15 88#define MAX_INST_SIZE 15
84 89
90static inline u32 svm_has(u32 feat)
91{
92 return svm_features & feat;
93}
94
85static unsigned get_addr_size(struct kvm_vcpu *vcpu) 95static unsigned get_addr_size(struct kvm_vcpu *vcpu)
86{ 96{
87 struct vmcb_save_area *sa = &vcpu->svm->vmcb->save; 97 struct vmcb_save_area *sa = &vcpu->svm->vmcb->save;
@@ -203,13 +213,6 @@ static void inject_ud(struct kvm_vcpu *vcpu)
203 UD_VECTOR; 213 UD_VECTOR;
204} 214}
205 215
206static void inject_db(struct kvm_vcpu *vcpu)
207{
208 vcpu->svm->vmcb->control.event_inj = SVM_EVTINJ_VALID |
209 SVM_EVTINJ_TYPE_EXEPT |
210 DB_VECTOR;
211}
212
213static int is_page_fault(uint32_t info) 216static int is_page_fault(uint32_t info)
214{ 217{
215 info &= SVM_EVTINJ_VEC_MASK | SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID; 218 info &= SVM_EVTINJ_VEC_MASK | SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID;
@@ -309,6 +312,7 @@ static void svm_hardware_enable(void *garbage)
309 svm_data->asid_generation = 1; 312 svm_data->asid_generation = 1;
310 svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; 313 svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1;
311 svm_data->next_asid = svm_data->max_asid + 1; 314 svm_data->next_asid = svm_data->max_asid + 1;
315 svm_features = cpuid_edx(SVM_CPUID_FUNC);
312 316
313 asm volatile ( "sgdt %0" : "=m"(gdt_descr) ); 317 asm volatile ( "sgdt %0" : "=m"(gdt_descr) );
314 gdt = (struct desc_struct *)gdt_descr.address; 318 gdt = (struct desc_struct *)gdt_descr.address;
@@ -459,7 +463,6 @@ static void init_vmcb(struct vmcb *vmcb)
459{ 463{
460 struct vmcb_control_area *control = &vmcb->control; 464 struct vmcb_control_area *control = &vmcb->control;
461 struct vmcb_save_area *save = &vmcb->save; 465 struct vmcb_save_area *save = &vmcb->save;
462 u64 tsc;
463 466
464 control->intercept_cr_read = INTERCEPT_CR0_MASK | 467 control->intercept_cr_read = INTERCEPT_CR0_MASK |
465 INTERCEPT_CR3_MASK | 468 INTERCEPT_CR3_MASK |
@@ -511,12 +514,13 @@ static void init_vmcb(struct vmcb *vmcb)
511 (1ULL << INTERCEPT_VMSAVE) | 514 (1ULL << INTERCEPT_VMSAVE) |
512 (1ULL << INTERCEPT_STGI) | 515 (1ULL << INTERCEPT_STGI) |
513 (1ULL << INTERCEPT_CLGI) | 516 (1ULL << INTERCEPT_CLGI) |
514 (1ULL << INTERCEPT_SKINIT); 517 (1ULL << INTERCEPT_SKINIT) |
518 (1ULL << INTERCEPT_MONITOR) |
519 (1ULL << INTERCEPT_MWAIT);
515 520
516 control->iopm_base_pa = iopm_base; 521 control->iopm_base_pa = iopm_base;
517 control->msrpm_base_pa = msrpm_base; 522 control->msrpm_base_pa = msrpm_base;
518 rdtscll(tsc); 523 control->tsc_offset = 0;
519 control->tsc_offset = -tsc;
520 control->int_ctl = V_INTR_MASKING_MASK; 524 control->int_ctl = V_INTR_MASKING_MASK;
521 525
522 init_seg(&save->es); 526 init_seg(&save->es);
@@ -576,12 +580,15 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
576 vcpu->svm->vmcb = page_address(page); 580 vcpu->svm->vmcb = page_address(page);
577 memset(vcpu->svm->vmcb, 0, PAGE_SIZE); 581 memset(vcpu->svm->vmcb, 0, PAGE_SIZE);
578 vcpu->svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; 582 vcpu->svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT;
579 vcpu->svm->cr0 = 0x00000010;
580 vcpu->svm->asid_generation = 0; 583 vcpu->svm->asid_generation = 0;
581 memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs)); 584 memset(vcpu->svm->db_regs, 0, sizeof(vcpu->svm->db_regs));
582 init_vmcb(vcpu->svm->vmcb); 585 init_vmcb(vcpu->svm->vmcb);
583 586
584 fx_init(vcpu); 587 fx_init(vcpu);
588 vcpu->fpu_active = 1;
589 vcpu->apic_base = 0xfee00000 |
590 /*for vcpu 0*/ MSR_IA32_APICBASE_BSP |
591 MSR_IA32_APICBASE_ENABLE;
585 592
586 return 0; 593 return 0;
587 594
@@ -602,11 +609,34 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu)
602 609
603static void svm_vcpu_load(struct kvm_vcpu *vcpu) 610static void svm_vcpu_load(struct kvm_vcpu *vcpu)
604{ 611{
605 get_cpu(); 612 int cpu, i;
613
614 cpu = get_cpu();
615 if (unlikely(cpu != vcpu->cpu)) {
616 u64 tsc_this, delta;
617
618 /*
619 * Make sure that the guest sees a monotonically
620 * increasing TSC.
621 */
622 rdtscll(tsc_this);
623 delta = vcpu->host_tsc - tsc_this;
624 vcpu->svm->vmcb->control.tsc_offset += delta;
625 vcpu->cpu = cpu;
626 }
627
628 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
629 rdmsrl(host_save_user_msrs[i], vcpu->svm->host_user_msrs[i]);
606} 630}
607 631
608static void svm_vcpu_put(struct kvm_vcpu *vcpu) 632static void svm_vcpu_put(struct kvm_vcpu *vcpu)
609{ 633{
634 int i;
635
636 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
637 wrmsrl(host_save_user_msrs[i], vcpu->svm->host_user_msrs[i]);
638
639 rdtscll(vcpu->host_tsc);
610 put_cpu(); 640 put_cpu();
611} 641}
612 642
@@ -714,7 +744,7 @@ static void svm_set_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
714 vcpu->svm->vmcb->save.gdtr.base = dt->base ; 744 vcpu->svm->vmcb->save.gdtr.base = dt->base ;
715} 745}
716 746
717static void svm_decache_cr0_cr4_guest_bits(struct kvm_vcpu *vcpu) 747static void svm_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
718{ 748{
719} 749}
720 750
@@ -733,9 +763,15 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
733 } 763 }
734 } 764 }
735#endif 765#endif
736 vcpu->svm->cr0 = cr0; 766 if ((vcpu->cr0 & CR0_TS_MASK) && !(cr0 & CR0_TS_MASK)) {
737 vcpu->svm->vmcb->save.cr0 = cr0 | CR0_PG_MASK | CR0_WP_MASK; 767 vcpu->svm->vmcb->control.intercept_exceptions &= ~(1 << NM_VECTOR);
768 vcpu->fpu_active = 1;
769 }
770
738 vcpu->cr0 = cr0; 771 vcpu->cr0 = cr0;
772 cr0 |= CR0_PG_MASK | CR0_WP_MASK;
773 cr0 &= ~(CR0_CD_MASK | CR0_NW_MASK);
774 vcpu->svm->vmcb->save.cr0 = cr0;
739} 775}
740 776
741static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) 777static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
@@ -785,18 +821,16 @@ static int svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_debug_guest *dbg)
785 821
786static void load_host_msrs(struct kvm_vcpu *vcpu) 822static void load_host_msrs(struct kvm_vcpu *vcpu)
787{ 823{
788 int i; 824#ifdef CONFIG_X86_64
789 825 wrmsrl(MSR_GS_BASE, vcpu->svm->host_gs_base);
790 for ( i = 0; i < NR_HOST_SAVE_MSRS; i++) 826#endif
791 wrmsrl(host_save_msrs[i], vcpu->svm->host_msrs[i]);
792} 827}
793 828
794static void save_host_msrs(struct kvm_vcpu *vcpu) 829static void save_host_msrs(struct kvm_vcpu *vcpu)
795{ 830{
796 int i; 831#ifdef CONFIG_X86_64
797 832 rdmsrl(MSR_GS_BASE, vcpu->svm->host_gs_base);
798 for ( i = 0; i < NR_HOST_SAVE_MSRS; i++) 833#endif
799 rdmsrl(host_save_msrs[i], vcpu->svm->host_msrs[i]);
800} 834}
801 835
802static void new_asid(struct kvm_vcpu *vcpu, struct svm_cpu_data *svm_data) 836static void new_asid(struct kvm_vcpu *vcpu, struct svm_cpu_data *svm_data)
@@ -890,7 +924,7 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
890 case EMULATE_DONE: 924 case EMULATE_DONE:
891 return 1; 925 return 1;
892 case EMULATE_DO_MMIO: 926 case EMULATE_DO_MMIO:
893 ++kvm_stat.mmio_exits; 927 ++vcpu->stat.mmio_exits;
894 kvm_run->exit_reason = KVM_EXIT_MMIO; 928 kvm_run->exit_reason = KVM_EXIT_MMIO;
895 return 0; 929 return 0;
896 case EMULATE_FAIL: 930 case EMULATE_FAIL:
@@ -904,6 +938,16 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
904 return 0; 938 return 0;
905} 939}
906 940
941static int nm_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
942{
943 vcpu->svm->vmcb->control.intercept_exceptions &= ~(1 << NM_VECTOR);
944 if (!(vcpu->cr0 & CR0_TS_MASK))
945 vcpu->svm->vmcb->save.cr0 &= ~CR0_TS_MASK;
946 vcpu->fpu_active = 1;
947
948 return 1;
949}
950
907static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 951static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
908{ 952{
909 /* 953 /*
@@ -981,7 +1025,7 @@ static int io_get_override(struct kvm_vcpu *vcpu,
981 return 0; 1025 return 0;
982} 1026}
983 1027
984static unsigned long io_adress(struct kvm_vcpu *vcpu, int ins, u64 *address) 1028static unsigned long io_adress(struct kvm_vcpu *vcpu, int ins, gva_t *address)
985{ 1029{
986 unsigned long addr_mask; 1030 unsigned long addr_mask;
987 unsigned long *reg; 1031 unsigned long *reg;
@@ -1025,38 +1069,38 @@ static unsigned long io_adress(struct kvm_vcpu *vcpu, int ins, u64 *address)
1025static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1069static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1026{ 1070{
1027 u32 io_info = vcpu->svm->vmcb->control.exit_info_1; //address size bug? 1071 u32 io_info = vcpu->svm->vmcb->control.exit_info_1; //address size bug?
1028 int _in = io_info & SVM_IOIO_TYPE_MASK; 1072 int size, down, in, string, rep;
1073 unsigned port;
1074 unsigned long count;
1075 gva_t address = 0;
1029 1076
1030 ++kvm_stat.io_exits; 1077 ++vcpu->stat.io_exits;
1031 1078
1032 vcpu->svm->next_rip = vcpu->svm->vmcb->control.exit_info_2; 1079 vcpu->svm->next_rip = vcpu->svm->vmcb->control.exit_info_2;
1033 1080
1034 kvm_run->exit_reason = KVM_EXIT_IO; 1081 in = (io_info & SVM_IOIO_TYPE_MASK) != 0;
1035 kvm_run->io.port = io_info >> 16; 1082 port = io_info >> 16;
1036 kvm_run->io.direction = (_in) ? KVM_EXIT_IO_IN : KVM_EXIT_IO_OUT; 1083 size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT;
1037 kvm_run->io.size = ((io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT); 1084 string = (io_info & SVM_IOIO_STR_MASK) != 0;
1038 kvm_run->io.string = (io_info & SVM_IOIO_STR_MASK) != 0; 1085 rep = (io_info & SVM_IOIO_REP_MASK) != 0;
1039 kvm_run->io.rep = (io_info & SVM_IOIO_REP_MASK) != 0; 1086 count = 1;
1087 down = (vcpu->svm->vmcb->save.rflags & X86_EFLAGS_DF) != 0;
1040 1088
1041 if (kvm_run->io.string) { 1089 if (string) {
1042 unsigned addr_mask; 1090 unsigned addr_mask;
1043 1091
1044 addr_mask = io_adress(vcpu, _in, &kvm_run->io.address); 1092 addr_mask = io_adress(vcpu, in, &address);
1045 if (!addr_mask) { 1093 if (!addr_mask) {
1046 printk(KERN_DEBUG "%s: get io address failed\n", 1094 printk(KERN_DEBUG "%s: get io address failed\n",
1047 __FUNCTION__); 1095 __FUNCTION__);
1048 return 1; 1096 return 1;
1049 } 1097 }
1050 1098
1051 if (kvm_run->io.rep) { 1099 if (rep)
1052 kvm_run->io.count 1100 count = vcpu->regs[VCPU_REGS_RCX] & addr_mask;
1053 = vcpu->regs[VCPU_REGS_RCX] & addr_mask; 1101 }
1054 kvm_run->io.string_down = (vcpu->svm->vmcb->save.rflags 1102 return kvm_setup_pio(vcpu, kvm_run, in, size, count, string, down,
1055 & X86_EFLAGS_DF) != 0; 1103 address, rep, port);
1056 }
1057 } else
1058 kvm_run->io.value = vcpu->svm->vmcb->save.rax;
1059 return 0;
1060} 1104}
1061 1105
1062static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1106static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
@@ -1072,13 +1116,14 @@ static int halt_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1072 return 1; 1116 return 1;
1073 1117
1074 kvm_run->exit_reason = KVM_EXIT_HLT; 1118 kvm_run->exit_reason = KVM_EXIT_HLT;
1075 ++kvm_stat.halt_exits; 1119 ++vcpu->stat.halt_exits;
1076 return 0; 1120 return 0;
1077} 1121}
1078 1122
1079static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1123static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1080{ 1124{
1081 vcpu->svm->vmcb->save.rip += 3; 1125 vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 3;
1126 skip_emulated_instruction(vcpu);
1082 return kvm_hypercall(vcpu, kvm_run); 1127 return kvm_hypercall(vcpu, kvm_run);
1083} 1128}
1084 1129
@@ -1098,8 +1143,8 @@ static int task_switch_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_r
1098static int cpuid_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1143static int cpuid_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1099{ 1144{
1100 vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 2; 1145 vcpu->svm->next_rip = vcpu->svm->vmcb->save.rip + 2;
1101 kvm_run->exit_reason = KVM_EXIT_CPUID; 1146 kvm_emulate_cpuid(vcpu);
1102 return 0; 1147 return 1;
1103} 1148}
1104 1149
1105static int emulate_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1150static int emulate_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
@@ -1239,7 +1284,7 @@ static int interrupt_window_interception(struct kvm_vcpu *vcpu,
1239 */ 1284 */
1240 if (kvm_run->request_interrupt_window && 1285 if (kvm_run->request_interrupt_window &&
1241 !vcpu->irq_summary) { 1286 !vcpu->irq_summary) {
1242 ++kvm_stat.irq_window_exits; 1287 ++vcpu->stat.irq_window_exits;
1243 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN; 1288 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
1244 return 0; 1289 return 0;
1245 } 1290 }
@@ -1267,6 +1312,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu,
1267 [SVM_EXIT_WRITE_DR5] = emulate_on_interception, 1312 [SVM_EXIT_WRITE_DR5] = emulate_on_interception,
1268 [SVM_EXIT_WRITE_DR7] = emulate_on_interception, 1313 [SVM_EXIT_WRITE_DR7] = emulate_on_interception,
1269 [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, 1314 [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception,
1315 [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception,
1270 [SVM_EXIT_INTR] = nop_on_interception, 1316 [SVM_EXIT_INTR] = nop_on_interception,
1271 [SVM_EXIT_NMI] = nop_on_interception, 1317 [SVM_EXIT_NMI] = nop_on_interception,
1272 [SVM_EXIT_SMI] = nop_on_interception, 1318 [SVM_EXIT_SMI] = nop_on_interception,
@@ -1288,6 +1334,8 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu,
1288 [SVM_EXIT_STGI] = invalid_op_interception, 1334 [SVM_EXIT_STGI] = invalid_op_interception,
1289 [SVM_EXIT_CLGI] = invalid_op_interception, 1335 [SVM_EXIT_CLGI] = invalid_op_interception,
1290 [SVM_EXIT_SKINIT] = invalid_op_interception, 1336 [SVM_EXIT_SKINIT] = invalid_op_interception,
1337 [SVM_EXIT_MONITOR] = invalid_op_interception,
1338 [SVM_EXIT_MWAIT] = invalid_op_interception,
1291}; 1339};
1292 1340
1293 1341
@@ -1295,8 +1343,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1295{ 1343{
1296 u32 exit_code = vcpu->svm->vmcb->control.exit_code; 1344 u32 exit_code = vcpu->svm->vmcb->control.exit_code;
1297 1345
1298 kvm_run->exit_type = KVM_EXIT_TYPE_VM_EXIT;
1299
1300 if (is_external_interrupt(vcpu->svm->vmcb->control.exit_int_info) && 1346 if (is_external_interrupt(vcpu->svm->vmcb->control.exit_int_info) &&
1301 exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR) 1347 exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR)
1302 printk(KERN_ERR "%s: unexpected exit_ini_info 0x%x " 1348 printk(KERN_ERR "%s: unexpected exit_ini_info 0x%x "
@@ -1307,12 +1353,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1307 if (exit_code >= ARRAY_SIZE(svm_exit_handlers) 1353 if (exit_code >= ARRAY_SIZE(svm_exit_handlers)
1308 || svm_exit_handlers[exit_code] == 0) { 1354 || svm_exit_handlers[exit_code] == 0) {
1309 kvm_run->exit_reason = KVM_EXIT_UNKNOWN; 1355 kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
1310 printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", 1356 kvm_run->hw.hardware_exit_reason = exit_code;
1311 __FUNCTION__,
1312 exit_code,
1313 vcpu->svm->vmcb->save.rip,
1314 vcpu->cr0,
1315 vcpu->svm->vmcb->save.rflags);
1316 return 0; 1357 return 0;
1317 } 1358 }
1318 1359
@@ -1461,8 +1502,10 @@ again:
1461 load_db_regs(vcpu->svm->db_regs); 1502 load_db_regs(vcpu->svm->db_regs);
1462 } 1503 }
1463 1504
1464 fx_save(vcpu->host_fx_image); 1505 if (vcpu->fpu_active) {
1465 fx_restore(vcpu->guest_fx_image); 1506 fx_save(vcpu->host_fx_image);
1507 fx_restore(vcpu->guest_fx_image);
1508 }
1466 1509
1467 asm volatile ( 1510 asm volatile (
1468#ifdef CONFIG_X86_64 1511#ifdef CONFIG_X86_64
@@ -1573,8 +1616,10 @@ again:
1573#endif 1616#endif
1574 : "cc", "memory" ); 1617 : "cc", "memory" );
1575 1618
1576 fx_save(vcpu->guest_fx_image); 1619 if (vcpu->fpu_active) {
1577 fx_restore(vcpu->host_fx_image); 1620 fx_save(vcpu->guest_fx_image);
1621 fx_restore(vcpu->host_fx_image);
1622 }
1578 1623
1579 if ((vcpu->svm->vmcb->save.dr7 & 0xff)) 1624 if ((vcpu->svm->vmcb->save.dr7 & 0xff))
1580 load_db_regs(vcpu->svm->host_db_regs); 1625 load_db_regs(vcpu->svm->host_db_regs);
@@ -1606,8 +1651,9 @@ again:
1606 vcpu->svm->next_rip = 0; 1651 vcpu->svm->next_rip = 0;
1607 1652
1608 if (vcpu->svm->vmcb->control.exit_code == SVM_EXIT_ERR) { 1653 if (vcpu->svm->vmcb->control.exit_code == SVM_EXIT_ERR) {
1609 kvm_run->exit_type = KVM_EXIT_TYPE_FAIL_ENTRY; 1654 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
1610 kvm_run->exit_reason = vcpu->svm->vmcb->control.exit_code; 1655 kvm_run->fail_entry.hardware_entry_failure_reason
1656 = vcpu->svm->vmcb->control.exit_code;
1611 post_kvm_run_save(vcpu, kvm_run); 1657 post_kvm_run_save(vcpu, kvm_run);
1612 return 0; 1658 return 0;
1613 } 1659 }
@@ -1615,14 +1661,16 @@ again:
1615 r = handle_exit(vcpu, kvm_run); 1661 r = handle_exit(vcpu, kvm_run);
1616 if (r > 0) { 1662 if (r > 0) {
1617 if (signal_pending(current)) { 1663 if (signal_pending(current)) {
1618 ++kvm_stat.signal_exits; 1664 ++vcpu->stat.signal_exits;
1619 post_kvm_run_save(vcpu, kvm_run); 1665 post_kvm_run_save(vcpu, kvm_run);
1666 kvm_run->exit_reason = KVM_EXIT_INTR;
1620 return -EINTR; 1667 return -EINTR;
1621 } 1668 }
1622 1669
1623 if (dm_request_for_irq_injection(vcpu, kvm_run)) { 1670 if (dm_request_for_irq_injection(vcpu, kvm_run)) {
1624 ++kvm_stat.request_irq_exits; 1671 ++vcpu->stat.request_irq_exits;
1625 post_kvm_run_save(vcpu, kvm_run); 1672 post_kvm_run_save(vcpu, kvm_run);
1673 kvm_run->exit_reason = KVM_EXIT_INTR;
1626 return -EINTR; 1674 return -EINTR;
1627 } 1675 }
1628 kvm_resched(vcpu); 1676 kvm_resched(vcpu);
@@ -1641,6 +1689,12 @@ static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root)
1641{ 1689{
1642 vcpu->svm->vmcb->save.cr3 = root; 1690 vcpu->svm->vmcb->save.cr3 = root;
1643 force_new_asid(vcpu); 1691 force_new_asid(vcpu);
1692
1693 if (vcpu->fpu_active) {
1694 vcpu->svm->vmcb->control.intercept_exceptions |= (1 << NM_VECTOR);
1695 vcpu->svm->vmcb->save.cr0 |= CR0_TS_MASK;
1696 vcpu->fpu_active = 0;
1697 }
1644} 1698}
1645 1699
1646static void svm_inject_page_fault(struct kvm_vcpu *vcpu, 1700static void svm_inject_page_fault(struct kvm_vcpu *vcpu,
@@ -1649,7 +1703,7 @@ static void svm_inject_page_fault(struct kvm_vcpu *vcpu,
1649{ 1703{
1650 uint32_t exit_int_info = vcpu->svm->vmcb->control.exit_int_info; 1704 uint32_t exit_int_info = vcpu->svm->vmcb->control.exit_int_info;
1651 1705
1652 ++kvm_stat.pf_guest; 1706 ++vcpu->stat.pf_guest;
1653 1707
1654 if (is_page_fault(exit_int_info)) { 1708 if (is_page_fault(exit_int_info)) {
1655 1709
@@ -1709,9 +1763,8 @@ static struct kvm_arch_ops svm_arch_ops = {
1709 .get_segment = svm_get_segment, 1763 .get_segment = svm_get_segment,
1710 .set_segment = svm_set_segment, 1764 .set_segment = svm_set_segment,
1711 .get_cs_db_l_bits = svm_get_cs_db_l_bits, 1765 .get_cs_db_l_bits = svm_get_cs_db_l_bits,
1712 .decache_cr0_cr4_guest_bits = svm_decache_cr0_cr4_guest_bits, 1766 .decache_cr4_guest_bits = svm_decache_cr4_guest_bits,
1713 .set_cr0 = svm_set_cr0, 1767 .set_cr0 = svm_set_cr0,
1714 .set_cr0_no_modeswitch = svm_set_cr0,
1715 .set_cr3 = svm_set_cr3, 1768 .set_cr3 = svm_set_cr3,
1716 .set_cr4 = svm_set_cr4, 1769 .set_cr4 = svm_set_cr4,
1717 .set_efer = svm_set_efer, 1770 .set_efer = svm_set_efer,
diff --git a/drivers/kvm/svm.h b/drivers/kvm/svm.h
index df731c3fb588..5e93814400ce 100644
--- a/drivers/kvm/svm.h
+++ b/drivers/kvm/svm.h
@@ -44,6 +44,9 @@ enum {
44 INTERCEPT_RDTSCP, 44 INTERCEPT_RDTSCP,
45 INTERCEPT_ICEBP, 45 INTERCEPT_ICEBP,
46 INTERCEPT_WBINVD, 46 INTERCEPT_WBINVD,
47 INTERCEPT_MONITOR,
48 INTERCEPT_MWAIT,
49 INTERCEPT_MWAIT_COND,
47}; 50};
48 51
49 52
@@ -298,6 +301,9 @@ struct __attribute__ ((__packed__)) vmcb {
298#define SVM_EXIT_RDTSCP 0x087 301#define SVM_EXIT_RDTSCP 0x087
299#define SVM_EXIT_ICEBP 0x088 302#define SVM_EXIT_ICEBP 0x088
300#define SVM_EXIT_WBINVD 0x089 303#define SVM_EXIT_WBINVD 0x089
304#define SVM_EXIT_MONITOR 0x08a
305#define SVM_EXIT_MWAIT 0x08b
306#define SVM_EXIT_MWAIT_COND 0x08c
301#define SVM_EXIT_NPF 0x400 307#define SVM_EXIT_NPF 0x400
302 308
303#define SVM_EXIT_ERR -1 309#define SVM_EXIT_ERR -1
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index fbbf9d6b299f..724db0027f00 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -17,7 +17,6 @@
17 17
18#include "kvm.h" 18#include "kvm.h"
19#include "vmx.h" 19#include "vmx.h"
20#include "kvm_vmx.h"
21#include <linux/module.h> 20#include <linux/module.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
@@ -70,6 +69,10 @@ static struct kvm_vmx_segment_field {
70 VMX_SEGMENT_FIELD(LDTR), 69 VMX_SEGMENT_FIELD(LDTR),
71}; 70};
72 71
72/*
73 * Keep MSR_K6_STAR at the end, as setup_msrs() will try to optimize it
74 * away by decrementing the array size.
75 */
73static const u32 vmx_msr_index[] = { 76static const u32 vmx_msr_index[] = {
74#ifdef CONFIG_X86_64 77#ifdef CONFIG_X86_64
75 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR, MSR_KERNEL_GS_BASE, 78 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR, MSR_KERNEL_GS_BASE,
@@ -78,6 +81,19 @@ static const u32 vmx_msr_index[] = {
78}; 81};
79#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index) 82#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index)
80 83
84#ifdef CONFIG_X86_64
85static unsigned msr_offset_kernel_gs_base;
86#define NR_64BIT_MSRS 4
87/*
88 * avoid save/load MSR_SYSCALL_MASK and MSR_LSTAR by std vt
89 * mechanism (cpu bug AA24)
90 */
91#define NR_BAD_MSRS 2
92#else
93#define NR_64BIT_MSRS 0
94#define NR_BAD_MSRS 0
95#endif
96
81static inline int is_page_fault(u32 intr_info) 97static inline int is_page_fault(u32 intr_info)
82{ 98{
83 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK | 99 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
@@ -85,6 +101,13 @@ static inline int is_page_fault(u32 intr_info)
85 (INTR_TYPE_EXCEPTION | PF_VECTOR | INTR_INFO_VALID_MASK); 101 (INTR_TYPE_EXCEPTION | PF_VECTOR | INTR_INFO_VALID_MASK);
86} 102}
87 103
104static inline int is_no_device(u32 intr_info)
105{
106 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
107 INTR_INFO_VALID_MASK)) ==
108 (INTR_TYPE_EXCEPTION | NM_VECTOR | INTR_INFO_VALID_MASK);
109}
110
88static inline int is_external_interrupt(u32 intr_info) 111static inline int is_external_interrupt(u32 intr_info)
89{ 112{
90 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK)) 113 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
@@ -200,6 +223,16 @@ static void vmcs_write64(unsigned long field, u64 value)
200#endif 223#endif
201} 224}
202 225
226static void vmcs_clear_bits(unsigned long field, u32 mask)
227{
228 vmcs_writel(field, vmcs_readl(field) & ~mask);
229}
230
231static void vmcs_set_bits(unsigned long field, u32 mask)
232{
233 vmcs_writel(field, vmcs_readl(field) | mask);
234}
235
203/* 236/*
204 * Switches to specified vcpu, until a matching vcpu_put(), but assumes 237 * Switches to specified vcpu, until a matching vcpu_put(), but assumes
205 * vcpu mutex is already taken. 238 * vcpu mutex is already taken.
@@ -297,6 +330,44 @@ static void vmx_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code)
297} 330}
298 331
299/* 332/*
333 * Set up the vmcs to automatically save and restore system
334 * msrs. Don't touch the 64-bit msrs if the guest is in legacy
335 * mode, as fiddling with msrs is very expensive.
336 */
337static void setup_msrs(struct kvm_vcpu *vcpu)
338{
339 int nr_skip, nr_good_msrs;
340
341 if (is_long_mode(vcpu))
342 nr_skip = NR_BAD_MSRS;
343 else
344 nr_skip = NR_64BIT_MSRS;
345 nr_good_msrs = vcpu->nmsrs - nr_skip;
346
347 /*
348 * MSR_K6_STAR is only needed on long mode guests, and only
349 * if efer.sce is enabled.
350 */
351 if (find_msr_entry(vcpu, MSR_K6_STAR)) {
352 --nr_good_msrs;
353#ifdef CONFIG_X86_64
354 if (is_long_mode(vcpu) && (vcpu->shadow_efer & EFER_SCE))
355 ++nr_good_msrs;
356#endif
357 }
358
359 vmcs_writel(VM_ENTRY_MSR_LOAD_ADDR,
360 virt_to_phys(vcpu->guest_msrs + nr_skip));
361 vmcs_writel(VM_EXIT_MSR_STORE_ADDR,
362 virt_to_phys(vcpu->guest_msrs + nr_skip));
363 vmcs_writel(VM_EXIT_MSR_LOAD_ADDR,
364 virt_to_phys(vcpu->host_msrs + nr_skip));
365 vmcs_write32(VM_EXIT_MSR_STORE_COUNT, nr_good_msrs); /* 22.2.2 */
366 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */
367 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */
368}
369
370/*
300 * reads and returns guest's timestamp counter "register" 371 * reads and returns guest's timestamp counter "register"
301 * guest_tsc = host_tsc + tsc_offset -- 21.3 372 * guest_tsc = host_tsc + tsc_offset -- 21.3
302 */ 373 */
@@ -712,6 +783,8 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
712 783
713 vmcs_write32(GUEST_CS_AR_BYTES, 0xf3); 784 vmcs_write32(GUEST_CS_AR_BYTES, 0xf3);
714 vmcs_write32(GUEST_CS_LIMIT, 0xffff); 785 vmcs_write32(GUEST_CS_LIMIT, 0xffff);
786 if (vmcs_readl(GUEST_CS_BASE) == 0xffff0000)
787 vmcs_writel(GUEST_CS_BASE, 0xf0000);
715 vmcs_write16(GUEST_CS_SELECTOR, vmcs_readl(GUEST_CS_BASE) >> 4); 788 vmcs_write16(GUEST_CS_SELECTOR, vmcs_readl(GUEST_CS_BASE) >> 4);
716 789
717 fix_rmode_seg(VCPU_SREG_ES, &vcpu->rmode.es); 790 fix_rmode_seg(VCPU_SREG_ES, &vcpu->rmode.es);
@@ -754,11 +827,8 @@ static void exit_lmode(struct kvm_vcpu *vcpu)
754 827
755#endif 828#endif
756 829
757static void vmx_decache_cr0_cr4_guest_bits(struct kvm_vcpu *vcpu) 830static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
758{ 831{
759 vcpu->cr0 &= KVM_GUEST_CR0_MASK;
760 vcpu->cr0 |= vmcs_readl(GUEST_CR0) & ~KVM_GUEST_CR0_MASK;
761
762 vcpu->cr4 &= KVM_GUEST_CR4_MASK; 832 vcpu->cr4 &= KVM_GUEST_CR4_MASK;
763 vcpu->cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK; 833 vcpu->cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK;
764} 834}
@@ -780,22 +850,11 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
780 } 850 }
781#endif 851#endif
782 852
783 vmcs_writel(CR0_READ_SHADOW, cr0); 853 if (!(cr0 & CR0_TS_MASK)) {
784 vmcs_writel(GUEST_CR0, 854 vcpu->fpu_active = 1;
785 (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON); 855 vmcs_clear_bits(EXCEPTION_BITMAP, CR0_TS_MASK);
786 vcpu->cr0 = cr0; 856 }
787}
788
789/*
790 * Used when restoring the VM to avoid corrupting segment registers
791 */
792static void vmx_set_cr0_no_modeswitch(struct kvm_vcpu *vcpu, unsigned long cr0)
793{
794 if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK))
795 enter_rmode(vcpu);
796 857
797 vcpu->rmode.active = ((cr0 & CR0_PE_MASK) == 0);
798 update_exception_bitmap(vcpu);
799 vmcs_writel(CR0_READ_SHADOW, cr0); 858 vmcs_writel(CR0_READ_SHADOW, cr0);
800 vmcs_writel(GUEST_CR0, 859 vmcs_writel(GUEST_CR0,
801 (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON); 860 (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON);
@@ -805,6 +864,12 @@ static void vmx_set_cr0_no_modeswitch(struct kvm_vcpu *vcpu, unsigned long cr0)
805static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 864static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
806{ 865{
807 vmcs_writel(GUEST_CR3, cr3); 866 vmcs_writel(GUEST_CR3, cr3);
867
868 if (!(vcpu->cr0 & CR0_TS_MASK)) {
869 vcpu->fpu_active = 0;
870 vmcs_set_bits(GUEST_CR0, CR0_TS_MASK);
871 vmcs_set_bits(EXCEPTION_BITMAP, 1 << NM_VECTOR);
872 }
808} 873}
809 874
810static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) 875static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
@@ -835,6 +900,7 @@ static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer)
835 900
836 msr->data = efer & ~EFER_LME; 901 msr->data = efer & ~EFER_LME;
837 } 902 }
903 setup_msrs(vcpu);
838} 904}
839 905
840#endif 906#endif
@@ -878,7 +944,14 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
878 vmcs_writel(sf->base, var->base); 944 vmcs_writel(sf->base, var->base);
879 vmcs_write32(sf->limit, var->limit); 945 vmcs_write32(sf->limit, var->limit);
880 vmcs_write16(sf->selector, var->selector); 946 vmcs_write16(sf->selector, var->selector);
881 if (var->unusable) 947 if (vcpu->rmode.active && var->s) {
948 /*
949 * Hack real-mode segments into vm86 compatibility.
950 */
951 if (var->base == 0xffff0000 && var->selector == 0xf000)
952 vmcs_writel(sf->base, 0xf0000);
953 ar = 0xf3;
954 } else if (var->unusable)
882 ar = 1 << 16; 955 ar = 1 << 16;
883 else { 956 else {
884 ar = var->type & 15; 957 ar = var->type & 15;
@@ -933,9 +1006,9 @@ static int init_rmode_tss(struct kvm* kvm)
933 gfn_t fn = rmode_tss_base(kvm) >> PAGE_SHIFT; 1006 gfn_t fn = rmode_tss_base(kvm) >> PAGE_SHIFT;
934 char *page; 1007 char *page;
935 1008
936 p1 = _gfn_to_page(kvm, fn++); 1009 p1 = gfn_to_page(kvm, fn++);
937 p2 = _gfn_to_page(kvm, fn++); 1010 p2 = gfn_to_page(kvm, fn++);
938 p3 = _gfn_to_page(kvm, fn); 1011 p3 = gfn_to_page(kvm, fn);
939 1012
940 if (!p1 || !p2 || !p3) { 1013 if (!p1 || !p2 || !p3) {
941 kvm_printf(kvm,"%s: gfn_to_page failed\n", __FUNCTION__); 1014 kvm_printf(kvm,"%s: gfn_to_page failed\n", __FUNCTION__);
@@ -991,7 +1064,6 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
991 struct descriptor_table dt; 1064 struct descriptor_table dt;
992 int i; 1065 int i;
993 int ret = 0; 1066 int ret = 0;
994 int nr_good_msrs;
995 extern asmlinkage void kvm_vmx_return(void); 1067 extern asmlinkage void kvm_vmx_return(void);
996 1068
997 if (!init_rmode_tss(vcpu->kvm)) { 1069 if (!init_rmode_tss(vcpu->kvm)) {
@@ -1136,23 +1208,17 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1136 vcpu->host_msrs[j].reserved = 0; 1208 vcpu->host_msrs[j].reserved = 0;
1137 vcpu->host_msrs[j].data = data; 1209 vcpu->host_msrs[j].data = data;
1138 vcpu->guest_msrs[j] = vcpu->host_msrs[j]; 1210 vcpu->guest_msrs[j] = vcpu->host_msrs[j];
1211#ifdef CONFIG_X86_64
1212 if (index == MSR_KERNEL_GS_BASE)
1213 msr_offset_kernel_gs_base = j;
1214#endif
1139 ++vcpu->nmsrs; 1215 ++vcpu->nmsrs;
1140 } 1216 }
1141 printk(KERN_DEBUG "kvm: msrs: %d\n", vcpu->nmsrs);
1142 1217
1143 nr_good_msrs = vcpu->nmsrs - NR_BAD_MSRS; 1218 setup_msrs(vcpu);
1144 vmcs_writel(VM_ENTRY_MSR_LOAD_ADDR, 1219
1145 virt_to_phys(vcpu->guest_msrs + NR_BAD_MSRS));
1146 vmcs_writel(VM_EXIT_MSR_STORE_ADDR,
1147 virt_to_phys(vcpu->guest_msrs + NR_BAD_MSRS));
1148 vmcs_writel(VM_EXIT_MSR_LOAD_ADDR,
1149 virt_to_phys(vcpu->host_msrs + NR_BAD_MSRS));
1150 vmcs_write32_fixedbits(MSR_IA32_VMX_EXIT_CTLS, VM_EXIT_CONTROLS, 1220 vmcs_write32_fixedbits(MSR_IA32_VMX_EXIT_CTLS, VM_EXIT_CONTROLS,
1151 (HOST_IS_64 << 9)); /* 22.2,1, 20.7.1 */ 1221 (HOST_IS_64 << 9)); /* 22.2,1, 20.7.1 */
1152 vmcs_write32(VM_EXIT_MSR_STORE_COUNT, nr_good_msrs); /* 22.2.2 */
1153 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */
1154 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, nr_good_msrs); /* 22.2.2 */
1155
1156 1222
1157 /* 22.2.1, 20.8.1 */ 1223 /* 22.2.1, 20.8.1 */
1158 vmcs_write32_fixedbits(MSR_IA32_VMX_ENTRY_CTLS, 1224 vmcs_write32_fixedbits(MSR_IA32_VMX_ENTRY_CTLS,
@@ -1164,7 +1230,7 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1164 vmcs_writel(TPR_THRESHOLD, 0); 1230 vmcs_writel(TPR_THRESHOLD, 0);
1165#endif 1231#endif
1166 1232
1167 vmcs_writel(CR0_GUEST_HOST_MASK, KVM_GUEST_CR0_MASK); 1233 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL);
1168 vmcs_writel(CR4_GUEST_HOST_MASK, KVM_GUEST_CR4_MASK); 1234 vmcs_writel(CR4_GUEST_HOST_MASK, KVM_GUEST_CR4_MASK);
1169 1235
1170 vcpu->cr0 = 0x60000010; 1236 vcpu->cr0 = 0x60000010;
@@ -1190,7 +1256,7 @@ static void inject_rmode_irq(struct kvm_vcpu *vcpu, int irq)
1190 u16 sp = vmcs_readl(GUEST_RSP); 1256 u16 sp = vmcs_readl(GUEST_RSP);
1191 u32 ss_limit = vmcs_read32(GUEST_SS_LIMIT); 1257 u32 ss_limit = vmcs_read32(GUEST_SS_LIMIT);
1192 1258
1193 if (sp > ss_limit || sp - 6 > sp) { 1259 if (sp > ss_limit || sp < 6 ) {
1194 vcpu_printf(vcpu, "%s: #SS, rsp 0x%lx ss 0x%lx limit 0x%x\n", 1260 vcpu_printf(vcpu, "%s: #SS, rsp 0x%lx ss 0x%lx limit 0x%x\n",
1195 __FUNCTION__, 1261 __FUNCTION__,
1196 vmcs_readl(GUEST_RSP), 1262 vmcs_readl(GUEST_RSP),
@@ -1330,6 +1396,15 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1330 asm ("int $2"); 1396 asm ("int $2");
1331 return 1; 1397 return 1;
1332 } 1398 }
1399
1400 if (is_no_device(intr_info)) {
1401 vcpu->fpu_active = 1;
1402 vmcs_clear_bits(EXCEPTION_BITMAP, 1 << NM_VECTOR);
1403 if (!(vcpu->cr0 & CR0_TS_MASK))
1404 vmcs_clear_bits(GUEST_CR0, CR0_TS_MASK);
1405 return 1;
1406 }
1407
1333 error_code = 0; 1408 error_code = 0;
1334 rip = vmcs_readl(GUEST_RIP); 1409 rip = vmcs_readl(GUEST_RIP);
1335 if (intr_info & INTR_INFO_DELIEVER_CODE_MASK) 1410 if (intr_info & INTR_INFO_DELIEVER_CODE_MASK)
@@ -1355,7 +1430,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1355 case EMULATE_DONE: 1430 case EMULATE_DONE:
1356 return 1; 1431 return 1;
1357 case EMULATE_DO_MMIO: 1432 case EMULATE_DO_MMIO:
1358 ++kvm_stat.mmio_exits; 1433 ++vcpu->stat.mmio_exits;
1359 kvm_run->exit_reason = KVM_EXIT_MMIO; 1434 kvm_run->exit_reason = KVM_EXIT_MMIO;
1360 return 0; 1435 return 0;
1361 case EMULATE_FAIL: 1436 case EMULATE_FAIL:
@@ -1384,7 +1459,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1384static int handle_external_interrupt(struct kvm_vcpu *vcpu, 1459static int handle_external_interrupt(struct kvm_vcpu *vcpu,
1385 struct kvm_run *kvm_run) 1460 struct kvm_run *kvm_run)
1386{ 1461{
1387 ++kvm_stat.irq_exits; 1462 ++vcpu->stat.irq_exits;
1388 return 1; 1463 return 1;
1389} 1464}
1390 1465
@@ -1394,7 +1469,7 @@ static int handle_triple_fault(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1394 return 0; 1469 return 0;
1395} 1470}
1396 1471
1397static int get_io_count(struct kvm_vcpu *vcpu, u64 *count) 1472static int get_io_count(struct kvm_vcpu *vcpu, unsigned long *count)
1398{ 1473{
1399 u64 inst; 1474 u64 inst;
1400 gva_t rip; 1475 gva_t rip;
@@ -1439,33 +1514,35 @@ static int get_io_count(struct kvm_vcpu *vcpu, u64 *count)
1439done: 1514done:
1440 countr_size *= 8; 1515 countr_size *= 8;
1441 *count = vcpu->regs[VCPU_REGS_RCX] & (~0ULL >> (64 - countr_size)); 1516 *count = vcpu->regs[VCPU_REGS_RCX] & (~0ULL >> (64 - countr_size));
1517 //printk("cx: %lx\n", vcpu->regs[VCPU_REGS_RCX]);
1442 return 1; 1518 return 1;
1443} 1519}
1444 1520
1445static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1521static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1446{ 1522{
1447 u64 exit_qualification; 1523 u64 exit_qualification;
1524 int size, down, in, string, rep;
1525 unsigned port;
1526 unsigned long count;
1527 gva_t address;
1448 1528
1449 ++kvm_stat.io_exits; 1529 ++vcpu->stat.io_exits;
1450 exit_qualification = vmcs_read64(EXIT_QUALIFICATION); 1530 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
1451 kvm_run->exit_reason = KVM_EXIT_IO; 1531 in = (exit_qualification & 8) != 0;
1452 if (exit_qualification & 8) 1532 size = (exit_qualification & 7) + 1;
1453 kvm_run->io.direction = KVM_EXIT_IO_IN; 1533 string = (exit_qualification & 16) != 0;
1454 else 1534 down = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_DF) != 0;
1455 kvm_run->io.direction = KVM_EXIT_IO_OUT; 1535 count = 1;
1456 kvm_run->io.size = (exit_qualification & 7) + 1; 1536 rep = (exit_qualification & 32) != 0;
1457 kvm_run->io.string = (exit_qualification & 16) != 0; 1537 port = exit_qualification >> 16;
1458 kvm_run->io.string_down 1538 address = 0;
1459 = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_DF) != 0; 1539 if (string) {
1460 kvm_run->io.rep = (exit_qualification & 32) != 0; 1540 if (rep && !get_io_count(vcpu, &count))
1461 kvm_run->io.port = exit_qualification >> 16;
1462 if (kvm_run->io.string) {
1463 if (!get_io_count(vcpu, &kvm_run->io.count))
1464 return 1; 1541 return 1;
1465 kvm_run->io.address = vmcs_readl(GUEST_LINEAR_ADDRESS); 1542 address = vmcs_readl(GUEST_LINEAR_ADDRESS);
1466 } else 1543 }
1467 kvm_run->io.value = vcpu->regs[VCPU_REGS_RAX]; /* rax */ 1544 return kvm_setup_pio(vcpu, kvm_run, in, size, count, string, down,
1468 return 0; 1545 address, rep, port);
1469} 1546}
1470 1547
1471static void 1548static void
@@ -1514,6 +1591,15 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1514 return 1; 1591 return 1;
1515 }; 1592 };
1516 break; 1593 break;
1594 case 2: /* clts */
1595 vcpu_load_rsp_rip(vcpu);
1596 vcpu->fpu_active = 1;
1597 vmcs_clear_bits(EXCEPTION_BITMAP, 1 << NM_VECTOR);
1598 vmcs_clear_bits(GUEST_CR0, CR0_TS_MASK);
1599 vcpu->cr0 &= ~CR0_TS_MASK;
1600 vmcs_writel(CR0_READ_SHADOW, vcpu->cr0);
1601 skip_emulated_instruction(vcpu);
1602 return 1;
1517 case 1: /*mov from cr*/ 1603 case 1: /*mov from cr*/
1518 switch (cr) { 1604 switch (cr) {
1519 case 3: 1605 case 3:
@@ -1523,8 +1609,6 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1523 skip_emulated_instruction(vcpu); 1609 skip_emulated_instruction(vcpu);
1524 return 1; 1610 return 1;
1525 case 8: 1611 case 8:
1526 printk(KERN_DEBUG "handle_cr: read CR8 "
1527 "cpu erratum AA15\n");
1528 vcpu_load_rsp_rip(vcpu); 1612 vcpu_load_rsp_rip(vcpu);
1529 vcpu->regs[reg] = vcpu->cr8; 1613 vcpu->regs[reg] = vcpu->cr8;
1530 vcpu_put_rsp_rip(vcpu); 1614 vcpu_put_rsp_rip(vcpu);
@@ -1583,8 +1667,8 @@ static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1583 1667
1584static int handle_cpuid(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1668static int handle_cpuid(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1585{ 1669{
1586 kvm_run->exit_reason = KVM_EXIT_CPUID; 1670 kvm_emulate_cpuid(vcpu);
1587 return 0; 1671 return 1;
1588} 1672}
1589 1673
1590static int handle_rdmsr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1674static int handle_rdmsr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
@@ -1639,7 +1723,7 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu,
1639 if (kvm_run->request_interrupt_window && 1723 if (kvm_run->request_interrupt_window &&
1640 !vcpu->irq_summary) { 1724 !vcpu->irq_summary) {
1641 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN; 1725 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
1642 ++kvm_stat.irq_window_exits; 1726 ++vcpu->stat.irq_window_exits;
1643 return 0; 1727 return 0;
1644 } 1728 }
1645 return 1; 1729 return 1;
@@ -1652,13 +1736,13 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1652 return 1; 1736 return 1;
1653 1737
1654 kvm_run->exit_reason = KVM_EXIT_HLT; 1738 kvm_run->exit_reason = KVM_EXIT_HLT;
1655 ++kvm_stat.halt_exits; 1739 ++vcpu->stat.halt_exits;
1656 return 0; 1740 return 0;
1657} 1741}
1658 1742
1659static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1743static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1660{ 1744{
1661 vmcs_writel(GUEST_RIP, vmcs_readl(GUEST_RIP)+3); 1745 skip_emulated_instruction(vcpu);
1662 return kvm_hypercall(vcpu, kvm_run); 1746 return kvm_hypercall(vcpu, kvm_run);
1663} 1747}
1664 1748
@@ -1699,7 +1783,6 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1699 exit_reason != EXIT_REASON_EXCEPTION_NMI ) 1783 exit_reason != EXIT_REASON_EXCEPTION_NMI )
1700 printk(KERN_WARNING "%s: unexpected, valid vectoring info and " 1784 printk(KERN_WARNING "%s: unexpected, valid vectoring info and "
1701 "exit reason is 0x%x\n", __FUNCTION__, exit_reason); 1785 "exit reason is 0x%x\n", __FUNCTION__, exit_reason);
1702 kvm_run->instruction_length = vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
1703 if (exit_reason < kvm_vmx_max_exit_handlers 1786 if (exit_reason < kvm_vmx_max_exit_handlers
1704 && kvm_vmx_exit_handlers[exit_reason]) 1787 && kvm_vmx_exit_handlers[exit_reason])
1705 return kvm_vmx_exit_handlers[exit_reason](vcpu, kvm_run); 1788 return kvm_vmx_exit_handlers[exit_reason](vcpu, kvm_run);
@@ -1763,11 +1846,21 @@ again:
1763 if (vcpu->guest_debug.enabled) 1846 if (vcpu->guest_debug.enabled)
1764 kvm_guest_debug_pre(vcpu); 1847 kvm_guest_debug_pre(vcpu);
1765 1848
1766 fx_save(vcpu->host_fx_image); 1849 if (vcpu->fpu_active) {
1767 fx_restore(vcpu->guest_fx_image); 1850 fx_save(vcpu->host_fx_image);
1851 fx_restore(vcpu->guest_fx_image);
1852 }
1853 /*
1854 * Loading guest fpu may have cleared host cr0.ts
1855 */
1856 vmcs_writel(HOST_CR0, read_cr0());
1768 1857
1769 save_msrs(vcpu->host_msrs, vcpu->nmsrs); 1858#ifdef CONFIG_X86_64
1770 load_msrs(vcpu->guest_msrs, NR_BAD_MSRS); 1859 if (is_long_mode(vcpu)) {
1860 save_msrs(vcpu->host_msrs + msr_offset_kernel_gs_base, 1);
1861 load_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
1862 }
1863#endif
1771 1864
1772 asm ( 1865 asm (
1773 /* Store host registers */ 1866 /* Store host registers */
@@ -1909,21 +2002,28 @@ again:
1909 2002
1910 reload_tss(); 2003 reload_tss();
1911 } 2004 }
1912 ++kvm_stat.exits; 2005 ++vcpu->stat.exits;
1913 2006
1914 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS); 2007#ifdef CONFIG_X86_64
1915 load_msrs(vcpu->host_msrs, NR_BAD_MSRS); 2008 if (is_long_mode(vcpu)) {
2009 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
2010 load_msrs(vcpu->host_msrs, NR_BAD_MSRS);
2011 }
2012#endif
2013
2014 if (vcpu->fpu_active) {
2015 fx_save(vcpu->guest_fx_image);
2016 fx_restore(vcpu->host_fx_image);
2017 }
1916 2018
1917 fx_save(vcpu->guest_fx_image);
1918 fx_restore(vcpu->host_fx_image);
1919 vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0; 2019 vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0;
1920 2020
1921 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 2021 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
1922 2022
1923 kvm_run->exit_type = 0;
1924 if (fail) { 2023 if (fail) {
1925 kvm_run->exit_type = KVM_EXIT_TYPE_FAIL_ENTRY; 2024 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
1926 kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); 2025 kvm_run->fail_entry.hardware_entry_failure_reason
2026 = vmcs_read32(VM_INSTRUCTION_ERROR);
1927 r = 0; 2027 r = 0;
1928 } else { 2028 } else {
1929 /* 2029 /*
@@ -1933,19 +2033,20 @@ again:
1933 profile_hit(KVM_PROFILING, (void *)vmcs_readl(GUEST_RIP)); 2033 profile_hit(KVM_PROFILING, (void *)vmcs_readl(GUEST_RIP));
1934 2034
1935 vcpu->launched = 1; 2035 vcpu->launched = 1;
1936 kvm_run->exit_type = KVM_EXIT_TYPE_VM_EXIT;
1937 r = kvm_handle_exit(kvm_run, vcpu); 2036 r = kvm_handle_exit(kvm_run, vcpu);
1938 if (r > 0) { 2037 if (r > 0) {
1939 /* Give scheduler a change to reschedule. */ 2038 /* Give scheduler a change to reschedule. */
1940 if (signal_pending(current)) { 2039 if (signal_pending(current)) {
1941 ++kvm_stat.signal_exits; 2040 ++vcpu->stat.signal_exits;
1942 post_kvm_run_save(vcpu, kvm_run); 2041 post_kvm_run_save(vcpu, kvm_run);
2042 kvm_run->exit_reason = KVM_EXIT_INTR;
1943 return -EINTR; 2043 return -EINTR;
1944 } 2044 }
1945 2045
1946 if (dm_request_for_irq_injection(vcpu, kvm_run)) { 2046 if (dm_request_for_irq_injection(vcpu, kvm_run)) {
1947 ++kvm_stat.request_irq_exits; 2047 ++vcpu->stat.request_irq_exits;
1948 post_kvm_run_save(vcpu, kvm_run); 2048 post_kvm_run_save(vcpu, kvm_run);
2049 kvm_run->exit_reason = KVM_EXIT_INTR;
1949 return -EINTR; 2050 return -EINTR;
1950 } 2051 }
1951 2052
@@ -1969,7 +2070,7 @@ static void vmx_inject_page_fault(struct kvm_vcpu *vcpu,
1969{ 2070{
1970 u32 vect_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); 2071 u32 vect_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
1971 2072
1972 ++kvm_stat.pf_guest; 2073 ++vcpu->stat.pf_guest;
1973 2074
1974 if (is_page_fault(vect_info)) { 2075 if (is_page_fault(vect_info)) {
1975 printk(KERN_DEBUG "inject_page_fault: " 2076 printk(KERN_DEBUG "inject_page_fault: "
@@ -2026,6 +2127,7 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
2026 vmcs_clear(vmcs); 2127 vmcs_clear(vmcs);
2027 vcpu->vmcs = vmcs; 2128 vcpu->vmcs = vmcs;
2028 vcpu->launched = 0; 2129 vcpu->launched = 0;
2130 vcpu->fpu_active = 1;
2029 2131
2030 return 0; 2132 return 0;
2031 2133
@@ -2062,9 +2164,8 @@ static struct kvm_arch_ops vmx_arch_ops = {
2062 .get_segment = vmx_get_segment, 2164 .get_segment = vmx_get_segment,
2063 .set_segment = vmx_set_segment, 2165 .set_segment = vmx_set_segment,
2064 .get_cs_db_l_bits = vmx_get_cs_db_l_bits, 2166 .get_cs_db_l_bits = vmx_get_cs_db_l_bits,
2065 .decache_cr0_cr4_guest_bits = vmx_decache_cr0_cr4_guest_bits, 2167 .decache_cr4_guest_bits = vmx_decache_cr4_guest_bits,
2066 .set_cr0 = vmx_set_cr0, 2168 .set_cr0 = vmx_set_cr0,
2067 .set_cr0_no_modeswitch = vmx_set_cr0_no_modeswitch,
2068 .set_cr3 = vmx_set_cr3, 2169 .set_cr3 = vmx_set_cr3,
2069 .set_cr4 = vmx_set_cr4, 2170 .set_cr4 = vmx_set_cr4,
2070#ifdef CONFIG_X86_64 2171#ifdef CONFIG_X86_64
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 7513cddb929f..7ade09086aa5 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -833,8 +833,9 @@ done_prefixes:
833 dst.ptr = (unsigned long *)cr2; 833 dst.ptr = (unsigned long *)cr2;
834 dst.bytes = (d & ByteOp) ? 1 : op_bytes; 834 dst.bytes = (d & ByteOp) ? 1 : op_bytes;
835 if (d & BitOp) { 835 if (d & BitOp) {
836 dst.ptr += src.val / BITS_PER_LONG; 836 unsigned long mask = ~(dst.bytes * 8 - 1);
837 dst.bytes = sizeof(long); 837
838 dst.ptr = (void *)dst.ptr + (src.val & mask) / 8;
838 } 839 }
839 if (!(d & Mov) && /* optimisation - avoid slow emulated read */ 840 if (!(d & Mov) && /* optimisation - avoid slow emulated read */
840 ((rc = ops->read_emulated((unsigned long)dst.ptr, 841 ((rc = ops->read_emulated((unsigned long)dst.ptr,
@@ -1044,7 +1045,7 @@ done_prefixes:
1044 if ((rc = ops->write_std( 1045 if ((rc = ops->write_std(
1045 register_address(ctxt->ss_base, 1046 register_address(ctxt->ss_base,
1046 _regs[VCPU_REGS_RSP]), 1047 _regs[VCPU_REGS_RSP]),
1047 dst.val, dst.bytes, ctxt)) != 0) 1048 &dst.val, dst.bytes, ctxt)) != 0)
1048 goto done; 1049 goto done;
1049 dst.val = dst.orig_val; /* skanky: disable writeback */ 1050 dst.val = dst.orig_val; /* skanky: disable writeback */
1050 break; 1051 break;
@@ -1077,12 +1078,12 @@ writeback:
1077 case OP_MEM: 1078 case OP_MEM:
1078 if (lock_prefix) 1079 if (lock_prefix)
1079 rc = ops->cmpxchg_emulated((unsigned long)dst. 1080 rc = ops->cmpxchg_emulated((unsigned long)dst.
1080 ptr, dst.orig_val, 1081 ptr, &dst.orig_val,
1081 dst.val, dst.bytes, 1082 &dst.val, dst.bytes,
1082 ctxt); 1083 ctxt);
1083 else 1084 else
1084 rc = ops->write_emulated((unsigned long)dst.ptr, 1085 rc = ops->write_emulated((unsigned long)dst.ptr,
1085 dst.val, dst.bytes, 1086 &dst.val, dst.bytes,
1086 ctxt); 1087 ctxt);
1087 if (rc != 0) 1088 if (rc != 0)
1088 goto done; 1089 goto done;
@@ -1320,36 +1321,8 @@ twobyte_special_insn:
1320 realmode_set_cr(ctxt->vcpu, modrm_reg, modrm_val, &_eflags); 1321 realmode_set_cr(ctxt->vcpu, modrm_reg, modrm_val, &_eflags);
1321 break; 1322 break;
1322 case 0xc7: /* Grp9 (cmpxchg8b) */ 1323 case 0xc7: /* Grp9 (cmpxchg8b) */
1323#if defined(__i386__)
1324 {
1325 unsigned long old_lo, old_hi;
1326 if (((rc = ops->read_emulated(cr2 + 0, &old_lo, 4,
1327 ctxt)) != 0)
1328 || ((rc = ops->read_emulated(cr2 + 4, &old_hi, 4,
1329 ctxt)) != 0))
1330 goto done;
1331 if ((old_lo != _regs[VCPU_REGS_RAX])
1332 || (old_hi != _regs[VCPU_REGS_RDX])) {
1333 _regs[VCPU_REGS_RAX] = old_lo;
1334 _regs[VCPU_REGS_RDX] = old_hi;
1335 _eflags &= ~EFLG_ZF;
1336 } else if (ops->cmpxchg8b_emulated == NULL) {
1337 rc = X86EMUL_UNHANDLEABLE;
1338 goto done;
1339 } else {
1340 if ((rc = ops->cmpxchg8b_emulated(cr2, old_lo,
1341 old_hi,
1342 _regs[VCPU_REGS_RBX],
1343 _regs[VCPU_REGS_RCX],
1344 ctxt)) != 0)
1345 goto done;
1346 _eflags |= EFLG_ZF;
1347 }
1348 break;
1349 }
1350#elif defined(CONFIG_X86_64)
1351 { 1324 {
1352 unsigned long old, new; 1325 u64 old, new;
1353 if ((rc = ops->read_emulated(cr2, &old, 8, ctxt)) != 0) 1326 if ((rc = ops->read_emulated(cr2, &old, 8, ctxt)) != 0)
1354 goto done; 1327 goto done;
1355 if (((u32) (old >> 0) != (u32) _regs[VCPU_REGS_RAX]) || 1328 if (((u32) (old >> 0) != (u32) _regs[VCPU_REGS_RAX]) ||
@@ -1358,15 +1331,15 @@ twobyte_special_insn:
1358 _regs[VCPU_REGS_RDX] = (u32) (old >> 32); 1331 _regs[VCPU_REGS_RDX] = (u32) (old >> 32);
1359 _eflags &= ~EFLG_ZF; 1332 _eflags &= ~EFLG_ZF;
1360 } else { 1333 } else {
1361 new = (_regs[VCPU_REGS_RCX] << 32) | (u32) _regs[VCPU_REGS_RBX]; 1334 new = ((u64)_regs[VCPU_REGS_RCX] << 32)
1362 if ((rc = ops->cmpxchg_emulated(cr2, old, 1335 | (u32) _regs[VCPU_REGS_RBX];
1363 new, 8, ctxt)) != 0) 1336 if ((rc = ops->cmpxchg_emulated(cr2, &old,
1337 &new, 8, ctxt)) != 0)
1364 goto done; 1338 goto done;
1365 _eflags |= EFLG_ZF; 1339 _eflags |= EFLG_ZF;
1366 } 1340 }
1367 break; 1341 break;
1368 } 1342 }
1369#endif
1370 } 1343 }
1371 goto writeback; 1344 goto writeback;
1372 1345
diff --git a/drivers/kvm/x86_emulate.h b/drivers/kvm/x86_emulate.h
index 5d41bd55125e..ea3407d7feee 100644
--- a/drivers/kvm/x86_emulate.h
+++ b/drivers/kvm/x86_emulate.h
@@ -59,8 +59,7 @@ struct x86_emulate_ops {
59 * @val: [OUT] Value read from memory, zero-extended to 'u_long'. 59 * @val: [OUT] Value read from memory, zero-extended to 'u_long'.
60 * @bytes: [IN ] Number of bytes to read from memory. 60 * @bytes: [IN ] Number of bytes to read from memory.
61 */ 61 */
62 int (*read_std)(unsigned long addr, 62 int (*read_std)(unsigned long addr, void *val,
63 unsigned long *val,
64 unsigned int bytes, struct x86_emulate_ctxt * ctxt); 63 unsigned int bytes, struct x86_emulate_ctxt * ctxt);
65 64
66 /* 65 /*
@@ -71,8 +70,7 @@ struct x86_emulate_ops {
71 * required). 70 * required).
72 * @bytes: [IN ] Number of bytes to write to memory. 71 * @bytes: [IN ] Number of bytes to write to memory.
73 */ 72 */
74 int (*write_std)(unsigned long addr, 73 int (*write_std)(unsigned long addr, const void *val,
75 unsigned long val,
76 unsigned int bytes, struct x86_emulate_ctxt * ctxt); 74 unsigned int bytes, struct x86_emulate_ctxt * ctxt);
77 75
78 /* 76 /*
@@ -82,7 +80,7 @@ struct x86_emulate_ops {
82 * @bytes: [IN ] Number of bytes to read from memory. 80 * @bytes: [IN ] Number of bytes to read from memory.
83 */ 81 */
84 int (*read_emulated) (unsigned long addr, 82 int (*read_emulated) (unsigned long addr,
85 unsigned long *val, 83 void *val,
86 unsigned int bytes, 84 unsigned int bytes,
87 struct x86_emulate_ctxt * ctxt); 85 struct x86_emulate_ctxt * ctxt);
88 86
@@ -94,7 +92,7 @@ struct x86_emulate_ops {
94 * @bytes: [IN ] Number of bytes to write to memory. 92 * @bytes: [IN ] Number of bytes to write to memory.
95 */ 93 */
96 int (*write_emulated) (unsigned long addr, 94 int (*write_emulated) (unsigned long addr,
97 unsigned long val, 95 const void *val,
98 unsigned int bytes, 96 unsigned int bytes,
99 struct x86_emulate_ctxt * ctxt); 97 struct x86_emulate_ctxt * ctxt);
100 98
@@ -107,29 +105,11 @@ struct x86_emulate_ops {
107 * @bytes: [IN ] Number of bytes to access using CMPXCHG. 105 * @bytes: [IN ] Number of bytes to access using CMPXCHG.
108 */ 106 */
109 int (*cmpxchg_emulated) (unsigned long addr, 107 int (*cmpxchg_emulated) (unsigned long addr,
110 unsigned long old, 108 const void *old,
111 unsigned long new, 109 const void *new,
112 unsigned int bytes, 110 unsigned int bytes,
113 struct x86_emulate_ctxt * ctxt); 111 struct x86_emulate_ctxt * ctxt);
114 112
115 /*
116 * cmpxchg8b_emulated: Emulate an atomic (LOCKed) CMPXCHG8B operation on an
117 * emulated/special memory area.
118 * @addr: [IN ] Linear address to access.
119 * @old: [IN ] Value expected to be current at @addr.
120 * @new: [IN ] Value to write to @addr.
121 * NOTES:
122 * 1. This function is only ever called when emulating a real CMPXCHG8B.
123 * 2. This function is *never* called on x86/64 systems.
124 * 2. Not defining this function (i.e., specifying NULL) is equivalent
125 * to defining a function that always returns X86EMUL_UNHANDLEABLE.
126 */
127 int (*cmpxchg8b_emulated) (unsigned long addr,
128 unsigned long old_lo,
129 unsigned long old_hi,
130 unsigned long new_lo,
131 unsigned long new_hi,
132 struct x86_emulate_ctxt * ctxt);
133}; 113};
134 114
135struct cpu_user_regs; 115struct cpu_user_regs;
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 35233de460ad..3d0354e96a97 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -459,7 +459,8 @@ therm_of_probe( struct of_device *dev, const struct of_device_id *match )
459static int 459static int
460therm_of_remove( struct of_device *dev ) 460therm_of_remove( struct of_device *dev )
461{ 461{
462 return i2c_del_driver( &g4fan_driver ); 462 i2c_del_driver( &g4fan_driver );
463 return 0;
463} 464}
464 465
465static struct of_device_id therm_of_match[] = {{ 466static struct of_device_id therm_of_match[] = {{
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 76d21775fc35..741a93a3eb61 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -82,6 +82,7 @@ static unsigned char cuda_rbuf[16];
82static unsigned char *reply_ptr; 82static unsigned char *reply_ptr;
83static int reading_reply; 83static int reading_reply;
84static int data_index; 84static int data_index;
85static int cuda_irq;
85#ifdef CONFIG_PPC 86#ifdef CONFIG_PPC
86static struct device_node *vias; 87static struct device_node *vias;
87#endif 88#endif
@@ -160,10 +161,8 @@ int __init find_via_cuda(void)
160 /* Clear and enable interrupts, but only on PPC. On 68K it's done */ 161 /* Clear and enable interrupts, but only on PPC. On 68K it's done */
161 /* for us by the main VIA driver in arch/m68k/mac/via.c */ 162 /* for us by the main VIA driver in arch/m68k/mac/via.c */
162 163
163#ifndef CONFIG_MAC
164 out_8(&via[IFR], 0x7f); /* clear interrupts by writing 1s */ 164 out_8(&via[IFR], 0x7f); /* clear interrupts by writing 1s */
165 out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from SR */ 165 out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from SR */
166#endif
167 166
168 /* enable autopoll */ 167 /* enable autopoll */
169 cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1); 168 cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1);
@@ -181,24 +180,22 @@ int __init find_via_cuda(void)
181 180
182static int __init via_cuda_start(void) 181static int __init via_cuda_start(void)
183{ 182{
184 unsigned int irq;
185
186 if (via == NULL) 183 if (via == NULL)
187 return -ENODEV; 184 return -ENODEV;
188 185
189#ifdef CONFIG_MAC 186#ifdef CONFIG_MAC
190 irq = IRQ_MAC_ADB; 187 cuda_irq = IRQ_MAC_ADB;
191#else /* CONFIG_MAC */ 188#else /* CONFIG_MAC */
192 irq = irq_of_parse_and_map(vias, 0); 189 cuda_irq = irq_of_parse_and_map(vias, 0);
193 if (irq == NO_IRQ) { 190 if (cuda_irq == NO_IRQ) {
194 printk(KERN_ERR "via-cuda: can't map interrupts for %s\n", 191 printk(KERN_ERR "via-cuda: can't map interrupts for %s\n",
195 vias->full_name); 192 vias->full_name);
196 return -ENODEV; 193 return -ENODEV;
197 } 194 }
198#endif /* CONFIG_MAP */ 195#endif /* CONFIG_MAC */
199 196
200 if (request_irq(irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) { 197 if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
201 printk(KERN_ERR "via-cuda: can't request irq %d\n", irq); 198 printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq);
202 return -EAGAIN; 199 return -EAGAIN;
203 } 200 }
204 201
@@ -238,6 +235,7 @@ cuda_init(void)
238 printk(KERN_ERR "cuda_init_via() failed\n"); 235 printk(KERN_ERR "cuda_init_via() failed\n");
239 return -ENODEV; 236 return -ENODEV;
240 } 237 }
238 out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from SR */
241 239
242 return via_cuda_start(); 240 return via_cuda_start();
243#endif 241#endif
@@ -263,15 +261,17 @@ cuda_init_via(void)
263 out_8(&via[B], in_8(&via[B]) | TACK | TIP); /* negate them */ 261 out_8(&via[B], in_8(&via[B]) | TACK | TIP); /* negate them */
264 out_8(&via[ACR] ,(in_8(&via[ACR]) & ~SR_CTRL) | SR_EXT); /* SR data in */ 262 out_8(&via[ACR] ,(in_8(&via[ACR]) & ~SR_CTRL) | SR_EXT); /* SR data in */
265 (void)in_8(&via[SR]); /* clear any left-over data */ 263 (void)in_8(&via[SR]); /* clear any left-over data */
266#ifndef CONFIG_MAC 264#ifdef CONFIG_PPC
267 out_8(&via[IER], 0x7f); /* disable interrupts from VIA */ 265 out_8(&via[IER], 0x7f); /* disable interrupts from VIA */
268 (void)in_8(&via[IER]); 266 (void)in_8(&via[IER]);
267#else
268 out_8(&via[IER], SR_INT); /* disable SR interrupt from VIA */
269#endif 269#endif
270 270
271 /* delay 4ms and then clear any pending interrupt */ 271 /* delay 4ms and then clear any pending interrupt */
272 mdelay(4); 272 mdelay(4);
273 (void)in_8(&via[SR]); 273 (void)in_8(&via[SR]);
274 out_8(&via[IFR], in_8(&via[IFR]) & 0x7f); 274 out_8(&via[IFR], SR_INT);
275 275
276 /* sync with the CUDA - assert TACK without TIP */ 276 /* sync with the CUDA - assert TACK without TIP */
277 out_8(&via[B], in_8(&via[B]) & ~TACK); 277 out_8(&via[B], in_8(&via[B]) & ~TACK);
@@ -282,7 +282,7 @@ cuda_init_via(void)
282 /* wait for the interrupt and then clear it */ 282 /* wait for the interrupt and then clear it */
283 WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (2)"); 283 WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (2)");
284 (void)in_8(&via[SR]); 284 (void)in_8(&via[SR]);
285 out_8(&via[IFR], in_8(&via[IFR]) & 0x7f); 285 out_8(&via[IFR], SR_INT);
286 286
287 /* finish the sync by negating TACK */ 287 /* finish the sync by negating TACK */
288 out_8(&via[B], in_8(&via[B]) | TACK); 288 out_8(&via[B], in_8(&via[B]) | TACK);
@@ -291,7 +291,7 @@ cuda_init_via(void)
291 WAIT_FOR(in_8(&via[B]) & TREQ, "CUDA response to sync (3)"); 291 WAIT_FOR(in_8(&via[B]) & TREQ, "CUDA response to sync (3)");
292 WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (4)"); 292 WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (4)");
293 (void)in_8(&via[SR]); 293 (void)in_8(&via[SR]);
294 out_8(&via[IFR], in_8(&via[IFR]) & 0x7f); 294 out_8(&via[IFR], SR_INT);
295 out_8(&via[B], in_8(&via[B]) | TIP); /* should be unnecessary */ 295 out_8(&via[B], in_8(&via[B]) | TIP); /* should be unnecessary */
296 296
297 return 0; 297 return 0;
@@ -428,16 +428,12 @@ cuda_start(void)
428void 428void
429cuda_poll(void) 429cuda_poll(void)
430{ 430{
431 unsigned long flags;
432
433 /* cuda_interrupt only takes a normal lock, we disable 431 /* cuda_interrupt only takes a normal lock, we disable
434 * interrupts here to avoid re-entering and thus deadlocking. 432 * interrupts here to avoid re-entering and thus deadlocking.
435 * An option would be to disable only the IRQ source with
436 * disable_irq(), would that work on m68k ? --BenH
437 */ 433 */
438 local_irq_save(flags); 434 disable_irq(cuda_irq);
439 cuda_interrupt(0, NULL); 435 cuda_interrupt(0, NULL);
440 local_irq_restore(flags); 436 enable_irq(cuda_irq);
441} 437}
442 438
443static irqreturn_t 439static irqreturn_t
@@ -448,15 +444,25 @@ cuda_interrupt(int irq, void *arg)
448 unsigned char ibuf[16]; 444 unsigned char ibuf[16];
449 int ibuf_len = 0; 445 int ibuf_len = 0;
450 int complete = 0; 446 int complete = 0;
451 unsigned char virq;
452 447
453 spin_lock(&cuda_lock); 448 spin_lock(&cuda_lock);
454 449
455 virq = in_8(&via[IFR]) & 0x7f; 450 /* On powermacs, this handler is registered for the VIA IRQ. But it uses
456 out_8(&via[IFR], virq); 451 * just the shift register IRQ -- other VIA interrupt sources are disabled.
457 if ((virq & SR_INT) == 0) { 452 * On m68k macs, the VIA IRQ sources are dispatched individually. Unless
458 spin_unlock(&cuda_lock); 453 * we are polling, the shift register IRQ flag has already been cleared.
459 return IRQ_NONE; 454 */
455
456#ifdef CONFIG_MAC
457 if (!arg)
458#endif
459 {
460 if ((in_8(&via[IFR]) & SR_INT) == 0) {
461 spin_unlock(&cuda_lock);
462 return IRQ_NONE;
463 } else {
464 out_8(&via[IFR], SR_INT);
465 }
460 } 466 }
461 467
462 status = (~in_8(&via[B]) & (TIP|TREQ)) | (in_8(&via[ACR]) & SR_OUT); 468 status = (~in_8(&via[B]) & (TIP|TREQ)) | (in_8(&via[ACR]) & SR_OUT);
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c
index 1b3bad62a1be..01b8eca7ccd5 100644
--- a/drivers/macintosh/via-macii.c
+++ b/drivers/macintosh/via-macii.c
@@ -12,6 +12,15 @@
12 * 1999-08-02 (jmt) - Initial rewrite for Unified ADB. 12 * 1999-08-02 (jmt) - Initial rewrite for Unified ADB.
13 * 2000-03-29 Tony Mantler <tonym@mac.linux-m68k.org> 13 * 2000-03-29 Tony Mantler <tonym@mac.linux-m68k.org>
14 * - Big overhaul, should actually work now. 14 * - Big overhaul, should actually work now.
15 * 2006-12-31 Finn Thain <fthain@telegraphics.com.au> - Another overhaul.
16 *
17 * Suggested reading:
18 * Inside Macintosh, ch. 5 ADB Manager
19 * Guide to the Macinstosh Family Hardware, ch. 8 Apple Desktop Bus
20 * Rockwell R6522 VIA datasheet
21 *
22 * Apple's "ADB Analyzer" bus sniffer is invaluable:
23 * ftp://ftp.apple.com/developer/Tool_Chest/Devices_-_Hardware/Apple_Desktop_Bus/
15 */ 24 */
16 25
17#include <stdarg.h> 26#include <stdarg.h>
@@ -26,7 +35,6 @@
26#include <asm/macints.h> 35#include <asm/macints.h>
27#include <asm/machw.h> 36#include <asm/machw.h>
28#include <asm/mac_via.h> 37#include <asm/mac_via.h>
29#include <asm/io.h>
30#include <asm/system.h> 38#include <asm/system.h>
31 39
32static volatile unsigned char *via; 40static volatile unsigned char *via;
@@ -51,9 +59,7 @@ static volatile unsigned char *via;
51#define ANH (15*RS) /* A-side data, no handshake */ 59#define ANH (15*RS) /* A-side data, no handshake */
52 60
53/* Bits in B data register: all active low */ 61/* Bits in B data register: all active low */
54#define TREQ 0x08 /* Transfer request (input) */ 62#define CTLR_IRQ 0x08 /* Controller rcv status (input) */
55#define TACK 0x10 /* Transfer acknowledge (output) */
56#define TIP 0x20 /* Transfer in progress (output) */
57#define ST_MASK 0x30 /* mask for selecting ADB state bits */ 63#define ST_MASK 0x30 /* mask for selecting ADB state bits */
58 64
59/* Bits in ACR */ 65/* Bits in ACR */
@@ -65,8 +71,6 @@ static volatile unsigned char *via;
65#define IER_SET 0x80 /* set bits in IER */ 71#define IER_SET 0x80 /* set bits in IER */
66#define IER_CLR 0 /* clear bits in IER */ 72#define IER_CLR 0 /* clear bits in IER */
67#define SR_INT 0x04 /* Shift register full/empty */ 73#define SR_INT 0x04 /* Shift register full/empty */
68#define SR_DATA 0x08 /* Shift register data */
69#define SR_CLOCK 0x10 /* Shift register clock */
70 74
71/* ADB transaction states according to GMHW */ 75/* ADB transaction states according to GMHW */
72#define ST_CMD 0x00 /* ADB state: command byte */ 76#define ST_CMD 0x00 /* ADB state: command byte */
@@ -77,7 +81,6 @@ static volatile unsigned char *via;
77static int macii_init_via(void); 81static int macii_init_via(void);
78static void macii_start(void); 82static void macii_start(void);
79static irqreturn_t macii_interrupt(int irq, void *arg); 83static irqreturn_t macii_interrupt(int irq, void *arg);
80static void macii_retransmit(int);
81static void macii_queue_poll(void); 84static void macii_queue_poll(void);
82 85
83static int macii_probe(void); 86static int macii_probe(void);
@@ -103,29 +106,37 @@ static enum macii_state {
103 sending, 106 sending,
104 reading, 107 reading,
105 read_done, 108 read_done,
106 awaiting_reply
107} macii_state; 109} macii_state;
108 110
109static int need_poll; 111static struct adb_request *current_req; /* first request struct in the queue */
110static int command_byte; 112static struct adb_request *last_req; /* last request struct in the queue */
111static int last_reply; 113static unsigned char reply_buf[16]; /* storage for autopolled replies */
112static int last_active; 114static unsigned char *reply_ptr; /* next byte in req->data or reply_buf */
113 115static int reading_reply; /* store reply in reply_buf else req->reply */
114static struct adb_request *current_req; 116static int data_index; /* index of the next byte to send from req->data */
115static struct adb_request *last_req; 117static int reply_len; /* number of bytes received in reply_buf or req->reply */
116static struct adb_request *retry_req; 118static int status; /* VIA's ADB status bits captured upon interrupt */
117static unsigned char reply_buf[16]; 119static int last_status; /* status bits as at previous interrupt */
118static unsigned char *reply_ptr; 120static int srq_asserted; /* have to poll for the device that asserted it */
119static int reply_len; 121static int command_byte; /* the most recent command byte transmitted */
120static int reading_reply; 122static int autopoll_devs; /* bits set are device addresses to be polled */
121static int data_index; 123
122static int first_byte; 124/* Sanity check for request queue. Doesn't check for cycles. */
123static int prefix_len; 125static int request_is_queued(struct adb_request *req) {
124static int status = ST_IDLE|TREQ; 126 struct adb_request *cur;
125static int last_status; 127 unsigned long flags;
126static int driver_running; 128 local_irq_save(flags);
127 129 cur = current_req;
128/* debug level 10 required for ADB logging (should be && debug_adb, ideally) */ 130 while (cur) {
131 if (cur == req) {
132 local_irq_restore(flags);
133 return 1;
134 }
135 cur = cur->next;
136 }
137 local_irq_restore(flags);
138 return 0;
139}
129 140
130/* Check for MacII style ADB */ 141/* Check for MacII style ADB */
131static int macii_probe(void) 142static int macii_probe(void)
@@ -147,15 +158,16 @@ int macii_init(void)
147 local_irq_save(flags); 158 local_irq_save(flags);
148 159
149 err = macii_init_via(); 160 err = macii_init_via();
150 if (err) return err; 161 if (err) goto out;
151 162
152 err = request_irq(IRQ_MAC_ADB, macii_interrupt, IRQ_FLG_LOCK, "ADB", 163 err = request_irq(IRQ_MAC_ADB, macii_interrupt, IRQ_FLG_LOCK, "ADB",
153 macii_interrupt); 164 macii_interrupt);
154 if (err) return err; 165 if (err) goto out;
155 166
156 macii_state = idle; 167 macii_state = idle;
168out:
157 local_irq_restore(flags); 169 local_irq_restore(flags);
158 return 0; 170 return err;
159} 171}
160 172
161/* initialize the hardware */ 173/* initialize the hardware */
@@ -163,12 +175,12 @@ static int macii_init_via(void)
163{ 175{
164 unsigned char x; 176 unsigned char x;
165 177
166 /* Set the lines up. We want TREQ as input TACK|TIP as output */ 178 /* We want CTLR_IRQ as input and ST_EVEN | ST_ODD as output lines. */
167 via[DIRB] = (via[DIRB] | TACK | TIP) & ~TREQ; 179 via[DIRB] = (via[DIRB] | ST_EVEN | ST_ODD) & ~CTLR_IRQ;
168 180
169 /* Set up state: idle */ 181 /* Set up state: idle */
170 via[B] |= ST_IDLE; 182 via[B] |= ST_IDLE;
171 last_status = via[B] & (ST_MASK|TREQ); 183 last_status = via[B] & (ST_MASK|CTLR_IRQ);
172 184
173 /* Shift register on input */ 185 /* Shift register on input */
174 via[ACR] = (via[ACR] & ~SR_CTRL) | SR_EXT; 186 via[ACR] = (via[ACR] & ~SR_CTRL) | SR_EXT;
@@ -179,81 +191,72 @@ static int macii_init_via(void)
179 return 0; 191 return 0;
180} 192}
181 193
182/* Send an ADB poll (Talk Register 0 command, tagged on the front of the request queue) */ 194/* Send an ADB poll (Talk Register 0 command prepended to the request queue) */
183static void macii_queue_poll(void) 195static void macii_queue_poll(void)
184{ 196{
185 static int device = 0; 197 /* No point polling the active device as it will never assert SRQ, so
186 static int in_poll=0; 198 * poll the next device in the autopoll list. This could leave us
199 * stuck in a polling loop if an unprobed device is asserting SRQ.
200 * In theory, that could only happen if a device was plugged in after
201 * probing started. Unplugging it again will break the cycle.
202 * (Simply polling the next higher device often ends up polling almost
203 * every device (after wrapping around), which takes too long.)
204 */
205 int device_mask;
206 int next_device;
187 static struct adb_request req; 207 static struct adb_request req;
188 unsigned long flags;
189
190 if (in_poll) printk("macii_queue_poll: double poll!\n");
191
192 in_poll++;
193 if (++device > 15) device = 1;
194
195 adb_request(&req, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1,
196 ADB_READREG(device, 0));
197
198 local_irq_save(flags);
199
200 req.next = current_req;
201 current_req = &req;
202 208
203 local_irq_restore(flags); 209 if (!autopoll_devs) return;
204 macii_start();
205 in_poll--;
206}
207 210
208/* Send an ADB retransmit (Talk, appended to the request queue) */ 211 device_mask = (1 << (((command_byte & 0xF0) >> 4) + 1)) - 1;
209static void macii_retransmit(int device) 212 if (autopoll_devs & ~device_mask)
210{ 213 next_device = ffs(autopoll_devs & ~device_mask) - 1;
211 static int in_retransmit = 0; 214 else
212 static struct adb_request rt; 215 next_device = ffs(autopoll_devs) - 1;
213 unsigned long flags;
214
215 if (in_retransmit) printk("macii_retransmit: double retransmit!\n");
216 216
217 in_retransmit++; 217 BUG_ON(request_is_queued(&req));
218 218
219 adb_request(&rt, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1, 219 adb_request(&req, NULL, ADBREQ_NOSEND, 1,
220 ADB_READREG(device, 0)); 220 ADB_READREG(next_device, 0));
221 221
222 local_irq_save(flags); 222 req.sent = 0;
223 req.complete = 0;
224 req.reply_len = 0;
225 req.next = current_req;
223 226
224 if (current_req != NULL) { 227 if (current_req != NULL) {
225 last_req->next = &rt; 228 current_req = &req;
226 last_req = &rt;
227 } else { 229 } else {
228 current_req = &rt; 230 current_req = &req;
229 last_req = &rt; 231 last_req = &req;
230 } 232 }
231
232 if (macii_state == idle) macii_start();
233
234 local_irq_restore(flags);
235 in_retransmit--;
236} 233}
237 234
238/* Send an ADB request; if sync, poll out the reply 'till it's done */ 235/* Send an ADB request; if sync, poll out the reply 'till it's done */
239static int macii_send_request(struct adb_request *req, int sync) 236static int macii_send_request(struct adb_request *req, int sync)
240{ 237{
241 int i; 238 int err;
239 unsigned long flags;
242 240
243 i = macii_write(req); 241 BUG_ON(request_is_queued(req));
244 if (i) return i;
245 242
246 if (sync) { 243 local_irq_save(flags);
247 while (!req->complete) macii_poll(); 244 err = macii_write(req);
245 local_irq_restore(flags);
246
247 if (!err && sync) {
248 while (!req->complete) {
249 macii_poll();
250 }
251 BUG_ON(request_is_queued(req));
248 } 252 }
249 return 0; 253
254 return err;
250} 255}
251 256
252/* Send an ADB request */ 257/* Send an ADB request (append to request queue) */
253static int macii_write(struct adb_request *req) 258static int macii_write(struct adb_request *req)
254{ 259{
255 unsigned long flags;
256
257 if (req->nbytes < 2 || req->data[0] != ADB_PACKET || req->nbytes > 15) { 260 if (req->nbytes < 2 || req->data[0] != ADB_PACKET || req->nbytes > 15) {
258 req->complete = 1; 261 req->complete = 1;
259 return -EINVAL; 262 return -EINVAL;
@@ -264,8 +267,6 @@ static int macii_write(struct adb_request *req)
264 req->complete = 0; 267 req->complete = 0;
265 req->reply_len = 0; 268 req->reply_len = 0;
266 269
267 local_irq_save(flags);
268
269 if (current_req != NULL) { 270 if (current_req != NULL) {
270 last_req->next = req; 271 last_req->next = req;
271 last_req = req; 272 last_req = req;
@@ -274,28 +275,52 @@ static int macii_write(struct adb_request *req)
274 last_req = req; 275 last_req = req;
275 if (macii_state == idle) macii_start(); 276 if (macii_state == idle) macii_start();
276 } 277 }
277
278 local_irq_restore(flags);
279 return 0; 278 return 0;
280} 279}
281 280
282/* Start auto-polling */ 281/* Start auto-polling */
283static int macii_autopoll(int devs) 282static int macii_autopoll(int devs)
284{ 283{
285 /* Just ping a random default address */ 284 static struct adb_request req;
286 if (!(current_req || retry_req)) 285 unsigned long flags;
287 macii_retransmit( (last_active < 16 && last_active > 0) ? last_active : 3); 286 int err = 0;
288 return 0; 287
288 /* bit 1 == device 1, and so on. */
289 autopoll_devs = devs & 0xFFFE;
290
291 if (!autopoll_devs) return 0;
292
293 local_irq_save(flags);
294
295 if (current_req == NULL) {
296 /* Send a Talk Reg 0. The controller will repeatedly transmit
297 * this as long as it is idle.
298 */
299 adb_request(&req, NULL, ADBREQ_NOSEND, 1,
300 ADB_READREG(ffs(autopoll_devs) - 1, 0));
301 err = macii_write(&req);
302 }
303
304 local_irq_restore(flags);
305 return err;
306}
307
308static inline int need_autopoll(void) {
309 /* Was the last command Talk Reg 0
310 * and is the target on the autopoll list?
311 */
312 if ((command_byte & 0x0F) == 0x0C &&
313 ((1 << ((command_byte & 0xF0) >> 4)) & autopoll_devs))
314 return 0;
315 return 1;
289} 316}
290 317
291/* Prod the chip without interrupts */ 318/* Prod the chip without interrupts */
292static void macii_poll(void) 319static void macii_poll(void)
293{ 320{
294 unsigned long flags; 321 disable_irq(IRQ_MAC_ADB);
295 322 macii_interrupt(0, NULL);
296 local_irq_save(flags); 323 enable_irq(IRQ_MAC_ADB);
297 if (via[IFR] & SR_INT) macii_interrupt(0, NULL);
298 local_irq_restore(flags);
299} 324}
300 325
301/* Reset the bus */ 326/* Reset the bus */
@@ -303,73 +328,34 @@ static int macii_reset_bus(void)
303{ 328{
304 static struct adb_request req; 329 static struct adb_request req;
305 330
331 if (request_is_queued(&req))
332 return 0;
333
306 /* Command = 0, Address = ignored */ 334 /* Command = 0, Address = ignored */
307 adb_request(&req, NULL, 0, 1, ADB_BUSRESET); 335 adb_request(&req, NULL, 0, 1, ADB_BUSRESET);
308 336
337 /* Don't want any more requests during the Global Reset low time. */
338 udelay(3000);
339
309 return 0; 340 return 0;
310} 341}
311 342
312/* Start sending ADB packet */ 343/* Start sending ADB packet */
313static void macii_start(void) 344static void macii_start(void)
314{ 345{
315 unsigned long flags;
316 struct adb_request *req; 346 struct adb_request *req;
317 347
318 req = current_req; 348 req = current_req;
319 if (!req) return;
320
321 /* assert macii_state == idle */
322 if (macii_state != idle) {
323 printk("macii_start: called while driver busy (%p %x %x)!\n",
324 req, macii_state, (uint) via1[B] & (ST_MASK|TREQ));
325 return;
326 }
327 349
328 local_irq_save(flags); 350 BUG_ON(req == NULL);
329 351
330 /* 352 BUG_ON(macii_state != idle);
331 * IRQ signaled ?? (means ADB controller wants to send, or might 353
332 * be end of packet if we were reading) 354 /* Now send it. Be careful though, that first byte of the request
333 */ 355 * is actually ADB_PACKET; the real data begins at index 1!
334#if 0 /* FIXME: This is broke broke broke, for some reason */ 356 * And req->nbytes is the number of bytes of real data plus one.
335 if ((via[B] & TREQ) == 0) {
336 printk("macii_start: weird poll stuff. huh?\n");
337 /*
338 * FIXME - we need to restart this on a timer
339 * or a collision at boot hangs us.
340 * Never set macii_state to idle here, or macii_start
341 * won't be called again from send_request!
342 * (need to re-check other cases ...)
343 */
344 /*
345 * if the interrupt handler set the need_poll
346 * flag, it's hopefully a SRQ poll or re-Talk
347 * so we try to send here anyway
348 */
349 if (!need_poll) {
350 if (console_loglevel == 10)
351 printk("macii_start: device busy - retry %p state %d status %x!\n",
352 req, macii_state,
353 (uint) via[B] & (ST_MASK|TREQ));
354 retry_req = req;
355 /* set ADB status here ? */
356 local_irq_restore(flags);
357 return;
358 } else {
359 need_poll = 0;
360 }
361 }
362#endif
363 /*
364 * Another retry pending? (sanity check)
365 */ 357 */
366 if (retry_req) {
367 retry_req = NULL;
368 }
369 358
370 /* Now send it. Be careful though, that first byte of the request */
371 /* is actually ADB_PACKET; the real data begins at index 1! */
372
373 /* store command byte */ 359 /* store command byte */
374 command_byte = req->data[1]; 360 command_byte = req->data[1];
375 /* Output mode */ 361 /* Output mode */
@@ -381,115 +367,97 @@ static void macii_start(void)
381 367
382 macii_state = sending; 368 macii_state = sending;
383 data_index = 2; 369 data_index = 2;
384
385 local_irq_restore(flags);
386} 370}
387 371
388/* 372/*
389 * The notorious ADB interrupt handler - does all of the protocol handling, 373 * The notorious ADB interrupt handler - does all of the protocol handling.
390 * except for starting new send operations. Relies heavily on the ADB 374 * Relies on the ADB controller sending and receiving data, thereby
391 * controller sending and receiving data, thereby generating SR interrupts 375 * generating shift register interrupts (SR_INT) for us. This means there has
392 * for us. This means there has to be always activity on the ADB bus, otherwise 376 * to be activity on the ADB bus. The chip will poll to achieve this.
393 * the whole process dies and has to be re-kicked by sending TALK requests ...
394 * CUDA-based Macs seem to solve this with the autopoll option, for MacII-type
395 * ADB the problem isn't solved yet (retransmit of the latest active TALK seems
396 * a good choice; either on timeout or on a timer interrupt).
397 * 377 *
398 * The basic ADB state machine was left unchanged from the original MacII code 378 * The basic ADB state machine was left unchanged from the original MacII code
399 * by Alan Cox, which was based on the CUDA driver for PowerMac. 379 * by Alan Cox, which was based on the CUDA driver for PowerMac.
400 * The syntax of the ADB status lines seems to be totally different on MacII, 380 * The syntax of the ADB status lines is totally different on MacII,
401 * though. MacII uses the states Command -> Even -> Odd -> Even ->...-> Idle for 381 * though. MacII uses the states Command -> Even -> Odd -> Even ->...-> Idle
402 * sending, and Idle -> Even -> Odd -> Even ->...-> Idle for receiving. Start 382 * for sending and Idle -> Even -> Odd -> Even ->...-> Idle for receiving.
403 * and end of a receive packet are signaled by asserting /IRQ on the interrupt 383 * Start and end of a receive packet are signalled by asserting /IRQ on the
404 * line. Timeouts are signaled by a sequence of 4 0xFF, with /IRQ asserted on 384 * interrupt line (/IRQ means the CTLR_IRQ bit in port B; not to be confused
405 * every other byte. SRQ is probably signaled by 3 or more 0xFF tacked on the 385 * with the VIA shift register interrupt. /IRQ never actually interrupts the
406 * end of a packet. (Thanks to Guido Koerber for eavesdropping on the ADB 386 * processor, it's just an ordinary input.)
407 * protocol with a logic analyzer!!)
408 *
409 * Note: As of 21/10/97, the MacII ADB part works including timeout detection
410 * and retransmit (Talk to the last active device).
411 */ 387 */
412static irqreturn_t macii_interrupt(int irq, void *arg) 388static irqreturn_t macii_interrupt(int irq, void *arg)
413{ 389{
414 int x, adbdir; 390 int x;
415 unsigned long flags; 391 static int entered;
416 struct adb_request *req; 392 struct adb_request *req;
417 393
418 last_status = status; 394 if (!arg) {
419 395 /* Clear the SR IRQ flag when polling. */
420 /* prevent races due to SCSI enabling ints */ 396 if (via[IFR] & SR_INT)
421 local_irq_save(flags); 397 via[IFR] = SR_INT;
422 398 else
423 if (driver_running) { 399 return IRQ_NONE;
424 local_irq_restore(flags);
425 return IRQ_NONE;
426 } 400 }
427 401
428 driver_running = 1; 402 BUG_ON(entered++);
429 403
430 status = via[B] & (ST_MASK|TREQ); 404 last_status = status;
431 adbdir = via[ACR] & SR_OUT; 405 status = via[B] & (ST_MASK|CTLR_IRQ);
432 406
433 switch (macii_state) { 407 switch (macii_state) {
434 case idle: 408 case idle:
409 if (reading_reply) {
410 reply_ptr = current_req->reply;
411 } else {
412 BUG_ON(current_req != NULL);
413 reply_ptr = reply_buf;
414 }
415
435 x = via[SR]; 416 x = via[SR];
436 first_byte = x;
437 /* set ADB state = even for first data byte */
438 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
439 417
440 reply_buf[0] = first_byte; /* was command_byte?? */ 418 if ((status & CTLR_IRQ) && (x == 0xFF)) {
441 reply_ptr = reply_buf + 1; 419 /* Bus timeout without SRQ sequence:
442 reply_len = 1; 420 * data is "FF" while CTLR_IRQ is "H"
443 prefix_len = 1; 421 */
444 reading_reply = 0; 422 reply_len = 0;
445 423 srq_asserted = 0;
446 macii_state = reading; 424 macii_state = read_done;
447 break; 425 } else {
426 macii_state = reading;
427 *reply_ptr = x;
428 reply_len = 1;
429 }
448 430
449 case awaiting_reply:
450 /* handshake etc. for II ?? */
451 x = via[SR];
452 first_byte = x;
453 /* set ADB state = even for first data byte */ 431 /* set ADB state = even for first data byte */
454 via[B] = (via[B] & ~ST_MASK) | ST_EVEN; 432 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
455
456 current_req->reply[0] = first_byte;
457 reply_ptr = current_req->reply + 1;
458 reply_len = 1;
459 prefix_len = 1;
460 reading_reply = 1;
461
462 macii_state = reading;
463 break; 433 break;
464 434
465 case sending: 435 case sending:
466 req = current_req; 436 req = current_req;
467 if (data_index >= req->nbytes) { 437 if (data_index >= req->nbytes) {
468 /* print an error message if a listen command has no data */
469 if (((command_byte & 0x0C) == 0x08)
470 /* && (console_loglevel == 10) */
471 && (data_index == 2))
472 printk("MacII ADB: listen command with no data: %x!\n",
473 command_byte);
474 /* reset to shift in */
475 via[ACR] &= ~SR_OUT;
476 x = via[SR];
477 /* set ADB state idle - might get SRQ */
478 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
479
480 req->sent = 1; 438 req->sent = 1;
439 macii_state = idle;
481 440
482 if (req->reply_expected) { 441 if (req->reply_expected) {
483 macii_state = awaiting_reply; 442 reading_reply = 1;
484 } else { 443 } else {
485 req->complete = 1; 444 req->complete = 1;
486 current_req = req->next; 445 current_req = req->next;
487 if (req->done) (*req->done)(req); 446 if (req->done) (*req->done)(req);
488 macii_state = idle; 447
489 if (current_req || retry_req) 448 if (current_req)
490 macii_start(); 449 macii_start();
491 else 450 else
492 macii_retransmit((command_byte & 0xF0) >> 4); 451 if (need_autopoll())
452 macii_autopoll(autopoll_devs);
453 }
454
455 if (macii_state == idle) {
456 /* reset to shift in */
457 via[ACR] &= ~SR_OUT;
458 x = via[SR];
459 /* set ADB state idle - might get SRQ */
460 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
493 } 461 }
494 } else { 462 } else {
495 via[SR] = req->data[data_index++]; 463 via[SR] = req->data[data_index++];
@@ -505,147 +473,79 @@ static irqreturn_t macii_interrupt(int irq, void *arg)
505 break; 473 break;
506 474
507 case reading: 475 case reading:
476 x = via[SR];
477 BUG_ON((status & ST_MASK) == ST_CMD ||
478 (status & ST_MASK) == ST_IDLE);
479
480 /* Bus timeout with SRQ sequence:
481 * data is "XX FF" while CTLR_IRQ is "L L"
482 * End of packet without SRQ sequence:
483 * data is "XX...YY 00" while CTLR_IRQ is "L...H L"
484 * End of packet SRQ sequence:
485 * data is "XX...YY 00" while CTLR_IRQ is "L...L L"
486 * (where XX is the first response byte and
487 * YY is the last byte of valid response data.)
488 */
508 489
509 /* timeout / SRQ handling for II hw */ 490 srq_asserted = 0;
510 if( (first_byte == 0xFF && (reply_len-prefix_len)==2 491 if (!(status & CTLR_IRQ)) {
511 && memcmp(reply_ptr-2,"\xFF\xFF",2)==0) || 492 if (x == 0xFF) {
512 ((reply_len-prefix_len)==3 493 if (!(last_status & CTLR_IRQ)) {
513 && memcmp(reply_ptr-3,"\xFF\xFF\xFF",3)==0)) 494 macii_state = read_done;
514 { 495 reply_len = 0;
515 /* 496 srq_asserted = 1;
516 * possible timeout (in fact, most probably a 497 }
517 * timeout, since SRQ can't be signaled without 498 } else if (x == 0x00) {
518 * transfer on the bus). 499 macii_state = read_done;
519 * The last three bytes seen were FF, together 500 if (!(last_status & CTLR_IRQ))
520 * with the starting byte (in case we started 501 srq_asserted = 1;
521 * on 'idle' or 'awaiting_reply') this probably
522 * makes four. So this is mostl likely #5!
523 * The timeout signal is a pattern 1 0 1 0 0..
524 * on /INT, meaning we missed it :-(
525 */
526 x = via[SR];
527 if (x != 0xFF) printk("MacII ADB: mistaken timeout/SRQ!\n");
528
529 if ((status & TREQ) == (last_status & TREQ)) {
530 /* Not a timeout. Unsolicited SRQ? weird. */
531 /* Terminate the SRQ packet and poll */
532 need_poll = 1;
533 } 502 }
534 /* There's no packet to get, so reply is blank */ 503 }
535 via[B] ^= ST_MASK; 504
536 reply_ptr -= (reply_len-prefix_len); 505 if (macii_state == reading) {
537 reply_len = prefix_len; 506 BUG_ON(reply_len > 15);
538 macii_state = read_done;
539 break;
540 } /* end timeout / SRQ handling for II hw. */
541
542 if((reply_len-prefix_len)>3
543 && memcmp(reply_ptr-3,"\xFF\xFF\xFF",3)==0)
544 {
545 /* SRQ tacked on data packet */
546 /* Terminate the packet (SRQ never ends) */
547 x = via[SR];
548 macii_state = read_done;
549 reply_len -= 3;
550 reply_ptr -= 3;
551 need_poll = 1;
552 /* need to continue; next byte not seen else */
553 } else {
554 /* Sanity check */
555 if (reply_len > 15) reply_len = 0;
556 /* read byte */
557 x = via[SR];
558 *reply_ptr = x;
559 reply_ptr++; 507 reply_ptr++;
508 *reply_ptr = x;
560 reply_len++; 509 reply_len++;
561 } 510 }
562 /* The usual handshake ... */
563
564 /*
565 * NetBSD hints that the next to last byte
566 * is sent with IRQ !!
567 * Guido found out it's the last one (0x0),
568 * but IRQ should be asserted already.
569 * Problem with timeout detection: First
570 * transition to /IRQ might be second
571 * byte of timeout packet!
572 * Timeouts are signaled by 4x FF.
573 */
574 if (((status & TREQ) == 0) && (x == 0x00)) { /* != 0xFF */
575 /* invert state bits, toggle ODD/EVEN */
576 via[B] ^= ST_MASK;
577 511
578 /* adjust packet length */ 512 /* invert state bits, toggle ODD/EVEN */
579 reply_len--; 513 via[B] ^= ST_MASK;
580 reply_ptr--;
581 macii_state = read_done;
582 } else {
583 /* not caught: ST_CMD */
584 /* required for re-entry 'reading'! */
585 if ((status & ST_MASK) == ST_IDLE) {
586 /* (in)sanity check - set even */
587 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
588 } else {
589 /* invert state bits */
590 via[B] ^= ST_MASK;
591 }
592 }
593 break; 514 break;
594 515
595 case read_done: 516 case read_done:
596 x = via[SR]; 517 x = via[SR];
518
597 if (reading_reply) { 519 if (reading_reply) {
520 reading_reply = 0;
598 req = current_req; 521 req = current_req;
599 req->reply_len = reply_ptr - req->reply; 522 req->reply_len = reply_len;
600 req->complete = 1; 523 req->complete = 1;
601 current_req = req->next; 524 current_req = req->next;
602 if (req->done) (*req->done)(req); 525 if (req->done) (*req->done)(req);
603 } else { 526 } else if (reply_len && autopoll_devs)
604 adb_input(reply_buf, reply_ptr - reply_buf, 0); 527 adb_input(reply_buf, reply_len, 0);
605 }
606 528
607 /* 529 macii_state = idle;
608 * remember this device ID; it's the latest we got a
609 * reply from!
610 */
611 last_reply = command_byte;
612 last_active = (command_byte & 0xF0) >> 4;
613 530
614 /* SRQ seen before, initiate poll now */ 531 /* SRQ seen before, initiate poll now */
615 if (need_poll) { 532 if (srq_asserted)
616 macii_state = idle;
617 macii_queue_poll(); 533 macii_queue_poll();
618 need_poll = 0;
619 break;
620 }
621
622 /* set ADB state to idle */
623 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
624
625 /* /IRQ seen, so the ADB controller has data for us */
626 if ((via[B] & TREQ) != 0) {
627 macii_state = reading;
628 534
629 reply_buf[0] = command_byte; 535 if (current_req)
630 reply_ptr = reply_buf + 1; 536 macii_start();
631 reply_len = 1; 537 else
632 prefix_len = 1; 538 if (need_autopoll())
633 reading_reply = 0; 539 macii_autopoll(autopoll_devs);
634 } else { 540
635 /* no IRQ, send next packet or wait */ 541 if (macii_state == idle)
636 macii_state = idle; 542 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
637 if (current_req)
638 macii_start();
639 else
640 macii_retransmit(last_active);
641 }
642 break; 543 break;
643 544
644 default: 545 default:
645 break; 546 break;
646 } 547 }
647 /* reset mutex and interrupts */ 548
648 driver_running = 0; 549 entered--;
649 local_irq_restore(flags);
650 return IRQ_HANDLED; 550 return IRQ_HANDLED;
651} 551}
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index 356c7216a179..dfdf11c1eec4 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -111,7 +111,6 @@ static int pmu_send_request(struct adb_request *req, int sync);
111static int pmu_autopoll(int devs); 111static int pmu_autopoll(int devs);
112void pmu_poll(void); 112void pmu_poll(void);
113static int pmu_reset_bus(void); 113static int pmu_reset_bus(void);
114static int pmu_queue_request(struct adb_request *req);
115 114
116static void pmu_start(void); 115static void pmu_start(void);
117static void send_byte(int x); 116static void send_byte(int x);
@@ -475,7 +474,7 @@ pmu_request(struct adb_request *req, void (*done)(struct adb_request *),
475 return pmu_queue_request(req); 474 return pmu_queue_request(req);
476} 475}
477 476
478static int 477int
479pmu_queue_request(struct adb_request *req) 478pmu_queue_request(struct adb_request *req)
480{ 479{
481 unsigned long flags; 480 unsigned long flags;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 509171ca7fa8..2b4315d7e5d6 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3080,7 +3080,7 @@ static int do_md_run(mddev_t * mddev)
3080 if (test_bit(Faulty, &rdev->flags)) 3080 if (test_bit(Faulty, &rdev->flags))
3081 continue; 3081 continue;
3082 sync_blockdev(rdev->bdev); 3082 sync_blockdev(rdev->bdev);
3083 invalidate_bdev(rdev->bdev, 0); 3083 invalidate_bdev(rdev->bdev);
3084 } 3084 }
3085 3085
3086 md_probe(mddev->unit, NULL, NULL); 3086 md_probe(mddev->unit, NULL, NULL);
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c
index 5347a406fff7..02a0ea6e1c17 100644
--- a/drivers/media/dvb/b2c2/flexcop-i2c.c
+++ b/drivers/media/dvb/b2c2/flexcop-i2c.c
@@ -183,7 +183,8 @@ int flexcop_i2c_init(struct flexcop_device *fc)
183 mutex_init(&fc->i2c_mutex); 183 mutex_init(&fc->i2c_mutex);
184 184
185 memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter)); 185 memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter));
186 strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",I2C_NAME_SIZE); 186 strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",
187 sizeof(fc->i2c_adap.name));
187 188
188 i2c_set_adapdata(&fc->i2c_adap,fc); 189 i2c_set_adapdata(&fc->i2c_adap,fc);
189 190
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index a6cbbdd262d6..34d7abc900d7 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -26,11 +26,11 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/pci.h>
30#include <linux/input.h> 29#include <linux/input.h>
31#include <linux/dvb/frontend.h> 30#include <linux/dvb/frontend.h>
32#include <linux/mutex.h> 31#include <linux/mutex.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
33#include <asm/io.h>
34 34
35#include "dmxdev.h" 35#include "dmxdev.h"
36#include "dvb_demux.h" 36#include "dvb_demux.h"
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 70df31b0a8a9..088b6dee3a7f 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -19,7 +19,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
19 return -EINVAL; 19 return -EINVAL;
20 } 20 }
21 21
22 strncpy(d->i2c_adap.name,d->desc->name,I2C_NAME_SIZE); 22 strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
23#ifdef I2C_ADAP_CLASS_TV_DIGITAL 23#ifdef I2C_ADAP_CLASS_TV_DIGITAL
24 d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, 24 d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL,
25#else 25#else
diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c
index a18c8f45a2ee..315e09e95b0c 100644
--- a/drivers/media/dvb/frontends/dibx000_common.c
+++ b/drivers/media/dvb/frontends/dibx000_common.c
@@ -105,9 +105,9 @@ struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enu
105} 105}
106EXPORT_SYMBOL(dibx000_get_i2c_adapter); 106EXPORT_SYMBOL(dibx000_get_i2c_adapter);
107 107
108static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *algo, const char name[I2C_NAME_SIZE], struct dibx000_i2c_master *mst) 108static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *algo, const char *name, struct dibx000_i2c_master *mst)
109{ 109{
110 strncpy(i2c_adap->name, name, I2C_NAME_SIZE); 110 strncpy(i2c_adap->name, name, sizeof(i2c_adap->name));
111 i2c_adap->class = I2C_CLASS_TV_DIGITAL, 111 i2c_adap->class = I2C_CLASS_TV_DIGITAL,
112 i2c_adap->algo = algo; 112 i2c_adap->algo = algo;
113 i2c_adap->algo_data = NULL; 113 i2c_adap->algo_data = NULL;
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
index 2aa9ce920607..823cd6cc471e 100644
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -37,7 +37,6 @@
37#include <linux/major.h> 37#include <linux/major.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/pci.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
42#include <asm/io.h> 41#include <asm/io.h>
43#include <asm/pgtable.h> 42#include <asm/pgtable.h>
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index a3246a283aa4..05c7820fe53e 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -33,7 +33,6 @@
33#include <linux/major.h> 33#include <linux/major.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/pci.h>
37#include <linux/signal.h> 36#include <linux/signal.h>
38#include <asm/io.h> 37#include <asm/io.h>
39#include <asm/pgtable.h> 38#include <asm/pgtable.h>
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
index 68673863d5c9..59a43603b5cb 100644
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -37,7 +37,6 @@
37#include <linux/major.h> 37#include <linux/major.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/pci.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
42#include <asm/io.h> 41#include <asm/io.h>
43#include <asm/pgtable.h> 42#include <asm/pgtable.h>
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
index 42e2299dcb22..853b1a3d6a1d 100644
--- a/drivers/media/video/bt856.c
+++ b/drivers/media/video/bt856.c
@@ -37,7 +37,6 @@
37#include <linux/major.h> 37#include <linux/major.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/pci.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
42#include <asm/io.h> 41#include <asm/io.h>
43#include <asm/pgtable.h> 42#include <asm/pgtable.h>
diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c
index 772fd52d551a..2e4cf1efdd21 100644
--- a/drivers/media/video/bt866.c
+++ b/drivers/media/video/bt866.c
@@ -37,7 +37,6 @@
37#include <linux/major.h> 37#include <linux/major.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/pci.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
42#include <asm/io.h> 41#include <asm/io.h>
43#include <asm/pgtable.h> 42#include <asm/pgtable.h>
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index 88dbdddeec42..d73c86aeeaac 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -26,7 +26,6 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/videodev2.h> 28#include <linux/videodev2.h>
29#include <linux/i2c.h>
30 29
31#include <media/tuner.h> 30#include <media/tuner.h>
32#include <media/cx2341x.h> 31#include <media/cx2341x.h>
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 3956c257556c..2d666b56020c 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -27,6 +27,8 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/dma-mapping.h>
31
30#include <asm/delay.h> 32#include <asm/delay.h>
31#include <sound/driver.h> 33#include <sound/driver.h>
32#include <sound/core.h> 34#include <sound/core.h>
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index b2eb32e01aee..2ebde2fdbcbe 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -26,6 +26,7 @@
26#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/dma-mapping.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
30#include <asm/delay.h> 31#include <asm/delay.h>
31 32
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 97ef421dd093..e627062fde3a 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -43,7 +43,6 @@
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/mm.h> 44#include <linux/mm.h>
45#include <linux/poll.h> 45#include <linux/poll.h>
46#include <linux/pci.h>
47#include <linux/signal.h> 46#include <linux/signal.h>
48#include <linux/ioport.h> 47#include <linux/ioport.h>
49#include <linux/types.h> 48#include <linux/types.h>
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index fbce1d50578b..b94ef8ab28c1 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * 2 *
4 * device driver for Conexant 2388x based TV cards 3 * device driver for Conexant 2388x based TV cards
@@ -34,6 +33,7 @@
34#include <linux/kernel.h> 33#include <linux/kernel.h>
35#include <linux/slab.h> 34#include <linux/slab.h>
36#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/dma-mapping.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/kthread.h> 38#include <linux/kthread.h>
39#include <asm/div64.h> 39#include <asm/div64.h>
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index ed882ebc7b95..418ea8b7f85a 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/pci.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/i2c.h> 27#include <linux/i2c.h>
29#include <linux/usb.h> 28#include <linux/usb.h>
diff --git a/drivers/media/video/ovcamchip/ovcamchip_priv.h b/drivers/media/video/ovcamchip/ovcamchip_priv.h
index 1231335a9f4a..50c7763d44b3 100644
--- a/drivers/media/video/ovcamchip/ovcamchip_priv.h
+++ b/drivers/media/video/ovcamchip/ovcamchip_priv.h
@@ -15,6 +15,7 @@
15#ifndef __LINUX_OVCAMCHIP_PRIV_H 15#ifndef __LINUX_OVCAMCHIP_PRIV_H
16#define __LINUX_OVCAMCHIP_PRIV_H 16#define __LINUX_OVCAMCHIP_PRIV_H
17 17
18#include <linux/i2c.h>
18#include <media/ovcamchip.h> 19#include <media/ovcamchip.h>
19 20
20#ifdef DEBUG 21#ifdef DEBUG
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
index 44dc7479119c..74839f98b7c4 100644
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -36,7 +36,6 @@
36#include <linux/major.h> 36#include <linux/major.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/mm.h> 38#include <linux/mm.h>
39#include <linux/pci.h>
40#include <linux/signal.h> 39#include <linux/signal.h>
41#include <asm/io.h> 40#include <asm/io.h>
42#include <asm/pgtable.h> 41#include <asm/pgtable.h>
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
index 2ce3321ab995..87c3144ec7fc 100644
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -39,7 +39,6 @@
39#include <linux/slab.h> 39#include <linux/slab.h>
40 40
41#include <linux/mm.h> 41#include <linux/mm.h>
42#include <linux/pci.h>
43#include <linux/signal.h> 42#include <linux/signal.h>
44#include <asm/io.h> 43#include <asm/io.h>
45#include <asm/pgtable.h> 44#include <asm/pgtable.h>
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c
index 269d7114a93a..80bf91187856 100644
--- a/drivers/media/video/saa711x.c
+++ b/drivers/media/video/saa711x.c
@@ -30,7 +30,6 @@
30#include <linux/major.h> 30#include <linux/major.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/mm.h> 32#include <linux/mm.h>
33#include <linux/pci.h>
34#include <linux/signal.h> 33#include <linux/signal.h>
35#include <asm/io.h> 34#include <asm/io.h>
36#include <asm/pgtable.h> 35#include <asm/pgtable.h>
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
index e0fdb1ab7580..339592e7722d 100644
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -33,7 +33,6 @@
33#include <linux/major.h> 33#include <linux/major.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/pci.h>
37#include <linux/signal.h> 36#include <linux/signal.h>
38#include <asm/io.h> 37#include <asm/io.h>
39#include <asm/pgtable.h> 38#include <asm/pgtable.h>
diff --git a/drivers/media/video/usbvision/usbvision-cards.c b/drivers/media/video/usbvision/usbvision-cards.c
index 13f69fe6360d..51ab265d566a 100644
--- a/drivers/media/video/usbvision/usbvision-cards.c
+++ b/drivers/media/video/usbvision/usbvision-cards.c
@@ -24,7 +24,6 @@
24 24
25 25
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/i2c.h>
28#include <media/v4l2-dev.h> 27#include <media/v4l2-dev.h>
29#include <media/tuner.h> 28#include <media/tuner.h>
30#include "usbvision.h" 29#include "usbvision.h"
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 083acfd91d8b..97471af4309c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1531,6 +1531,7 @@ mpt_resume(struct pci_dev *pdev)
1531 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1531 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1532 u32 device_state = pdev->current_state; 1532 u32 device_state = pdev->current_state;
1533 int recovery_state; 1533 int recovery_state;
1534 int err;
1534 1535
1535 printk(MYIOC_s_INFO_FMT 1536 printk(MYIOC_s_INFO_FMT
1536 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", 1537 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n",
@@ -1538,7 +1539,9 @@ mpt_resume(struct pci_dev *pdev)
1538 1539
1539 pci_set_power_state(pdev, 0); 1540 pci_set_power_state(pdev, 0);
1540 pci_restore_state(pdev); 1541 pci_restore_state(pdev);
1541 pci_enable_device(pdev); 1542 err = pci_enable_device(pdev);
1543 if (err)
1544 return err;
1542 1545
1543 /* enable interrupts */ 1546 /* enable interrupts */
1544 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); 1547 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM);
@@ -4739,12 +4742,8 @@ mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum)
4739} 4742}
4740 4743
4741/** 4744/**
4742 * mpt_inactive_raid_list_free 4745 * mpt_inactive_raid_list_free - This clears this link list.
4743 * 4746 * @ioc : pointer to per adapter structure
4744 * This clears this link list.
4745 *
4746 * @ioc - pointer to per adapter structure
4747 *
4748 **/ 4747 **/
4749static void 4748static void
4750mpt_inactive_raid_list_free(MPT_ADAPTER *ioc) 4749mpt_inactive_raid_list_free(MPT_ADAPTER *ioc)
@@ -4764,15 +4763,11 @@ mpt_inactive_raid_list_free(MPT_ADAPTER *ioc)
4764} 4763}
4765 4764
4766/** 4765/**
4767 * mpt_inactive_raid_volumes 4766 * mpt_inactive_raid_volumes - sets up link list of phy_disk_nums for devices belonging in an inactive volume
4768 *
4769 * This sets up link list of phy_disk_nums for devices belonging in an inactive volume
4770 *
4771 * @ioc - pointer to per adapter structure
4772 * @channel - volume channel
4773 * @id - volume target id
4774 *
4775 * 4767 *
4768 * @ioc : pointer to per adapter structure
4769 * @channel : volume channel
4770 * @id : volume target id
4776 **/ 4771 **/
4777static void 4772static void
4778mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id) 4773mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id)
@@ -6663,7 +6658,7 @@ union loginfo_type {
6663/** 6658/**
6664 * mpt_iocstatus_info_config - IOCSTATUS information for config pages 6659 * mpt_iocstatus_info_config - IOCSTATUS information for config pages
6665 * @ioc: Pointer to MPT_ADAPTER structure 6660 * @ioc: Pointer to MPT_ADAPTER structure
6666 * ioc_status: U32 IOCStatus word from IOC 6661 * @ioc_status: U32 IOCStatus word from IOC
6667 * @mf: Pointer to MPT request frame 6662 * @mf: Pointer to MPT request frame
6668 * 6663 *
6669 * Refer to lsi/mpi.h. 6664 * Refer to lsi/mpi.h.
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index e3a39272aad6..d25d3be8fcd2 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -994,6 +994,7 @@ typedef struct _MPT_SCSI_HOST {
994 int scandv_wait_done; 994 int scandv_wait_done;
995 long last_queue_full; 995 long last_queue_full;
996 u16 tm_iocstatus; 996 u16 tm_iocstatus;
997 u16 spi_pending;
997 struct list_head target_reset_list; 998 struct list_head target_reset_list;
998} MPT_SCSI_HOST; 999} MPT_SCSI_HOST;
999 1000
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 2a3e9e66d4ef..fa0f7761652a 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -819,10 +819,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
819 sc->resid=0; 819 sc->resid=0;
820 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ 820 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
821 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ 821 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
822 if (scsi_status == MPI_SCSI_STATUS_BUSY) 822 sc->result = (DID_OK << 16) | scsi_status;
823 sc->result = (DID_BUS_BUSY << 16) | scsi_status;
824 else
825 sc->result = (DID_OK << 16) | scsi_status;
826 if (scsi_state == 0) { 823 if (scsi_state == 0) {
827 ; 824 ;
828 } else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) { 825 } else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) {
@@ -1188,20 +1185,7 @@ mptscsih_suspend(struct pci_dev *pdev, pm_message_t state)
1188int 1185int
1189mptscsih_resume(struct pci_dev *pdev) 1186mptscsih_resume(struct pci_dev *pdev)
1190{ 1187{
1191 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1188 return mpt_resume(pdev);
1192 struct Scsi_Host *host = ioc->sh;
1193 MPT_SCSI_HOST *hd;
1194
1195 mpt_resume(pdev);
1196
1197 if(!host)
1198 return 0;
1199
1200 hd = (MPT_SCSI_HOST *)host->hostdata;
1201 if(!hd)
1202 return 0;
1203
1204 return 0;
1205} 1189}
1206 1190
1207#endif 1191#endif
@@ -1537,21 +1521,23 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
1537/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1521/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1538/** 1522/**
1539 * mptscsih_TMHandler - Generic handler for SCSI Task Management. 1523 * mptscsih_TMHandler - Generic handler for SCSI Task Management.
1540 * Fall through to mpt_HardResetHandler if: not operational, too many 1524 * @hd: Pointer to MPT SCSI HOST structure
1541 * failed TM requests or handshake failure.
1542 *
1543 * @ioc: Pointer to MPT_ADAPTER structure
1544 * @type: Task Management type 1525 * @type: Task Management type
1526 * @channel: channel number for task management
1545 * @id: Logical Target ID for reset (if appropriate) 1527 * @id: Logical Target ID for reset (if appropriate)
1546 * @lun: Logical Unit for reset (if appropriate) 1528 * @lun: Logical Unit for reset (if appropriate)
1547 * @ctx2abort: Context for the task to be aborted (if appropriate) 1529 * @ctx2abort: Context for the task to be aborted (if appropriate)
1530 * @timeout: timeout for task management control
1531 *
1532 * Fall through to mpt_HardResetHandler if: not operational, too many
1533 * failed TM requests or handshake failure.
1548 * 1534 *
1549 * Remark: Currently invoked from a non-interrupt thread (_bh). 1535 * Remark: Currently invoked from a non-interrupt thread (_bh).
1550 * 1536 *
1551 * Remark: With old EH code, at most 1 SCSI TaskMgmt function per IOC 1537 * Remark: With old EH code, at most 1 SCSI TaskMgmt function per IOC
1552 * will be active. 1538 * will be active.
1553 * 1539 *
1554 * Returns 0 for SUCCESS, or FAILED. 1540 * Returns 0 for SUCCESS, or %FAILED.
1555 **/ 1541 **/
1556int 1542int
1557mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout) 1543mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout)
@@ -1650,9 +1636,11 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
1650 * mptscsih_IssueTaskMgmt - Generic send Task Management function. 1636 * mptscsih_IssueTaskMgmt - Generic send Task Management function.
1651 * @hd: Pointer to MPT_SCSI_HOST structure 1637 * @hd: Pointer to MPT_SCSI_HOST structure
1652 * @type: Task Management type 1638 * @type: Task Management type
1639 * @channel: channel number for task management
1653 * @id: Logical Target ID for reset (if appropriate) 1640 * @id: Logical Target ID for reset (if appropriate)
1654 * @lun: Logical Unit for reset (if appropriate) 1641 * @lun: Logical Unit for reset (if appropriate)
1655 * @ctx2abort: Context for the task to be aborted (if appropriate) 1642 * @ctx2abort: Context for the task to be aborted (if appropriate)
1643 * @timeout: timeout for task management control
1656 * 1644 *
1657 * Remark: _HardResetHandler can be invoked from an interrupt thread (timer) 1645 * Remark: _HardResetHandler can be invoked from an interrupt thread (timer)
1658 * or a non-interrupt thread. In the former, must not call schedule(). 1646 * or a non-interrupt thread. In the former, must not call schedule().
@@ -2022,6 +2010,7 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd)
2022/** 2010/**
2023 * mptscsih_tm_wait_for_completion - wait for completion of TM task 2011 * mptscsih_tm_wait_for_completion - wait for completion of TM task
2024 * @hd: Pointer to MPT host structure. 2012 * @hd: Pointer to MPT host structure.
2013 * @timeout: timeout value
2025 * 2014 *
2026 * Returns {SUCCESS,FAILED}. 2015 * Returns {SUCCESS,FAILED}.
2027 */ 2016 */
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 85f21b54cb7d..d75f7ffbb02e 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -96,14 +96,13 @@ static int mptspiTaskCtx = -1;
96static int mptspiInternalCtx = -1; /* Used only for internal commands */ 96static int mptspiInternalCtx = -1; /* Used only for internal commands */
97 97
98/** 98/**
99 * mptspi_setTargetNegoParms - Update the target negotiation 99 * mptspi_setTargetNegoParms - Update the target negotiation parameters
100 * parameters based on the the Inquiry data, adapter capabilities,
101 * and NVRAM settings
102 *
103 * @hd: Pointer to a SCSI Host Structure 100 * @hd: Pointer to a SCSI Host Structure
104 * @vtarget: per target private data 101 * @target: per target private data
105 * @sdev: SCSI device 102 * @sdev: SCSI device
106 * 103 *
104 * Update the target negotiation parameters based on the the Inquiry
105 * data, adapter capabilities, and NVRAM settings.
107 **/ 106 **/
108static void 107static void
109mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, 108mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
@@ -234,7 +233,7 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
234/** 233/**
235 * mptspi_writeIOCPage4 - write IOC Page 4 234 * mptspi_writeIOCPage4 - write IOC Page 4
236 * @hd: Pointer to a SCSI Host Structure 235 * @hd: Pointer to a SCSI Host Structure
237 * @channel: 236 * @channel: channel number
238 * @id: write IOC Page4 for this ID & Bus 237 * @id: write IOC Page4 for this ID & Bus
239 * 238 *
240 * Return: -EAGAIN if unable to obtain a Message Frame 239 * Return: -EAGAIN if unable to obtain a Message Frame
@@ -446,7 +445,7 @@ static int mptspi_target_alloc(struct scsi_target *starget)
446 return 0; 445 return 0;
447} 446}
448 447
449void 448static void
450mptspi_target_destroy(struct scsi_target *starget) 449mptspi_target_destroy(struct scsi_target *starget)
451{ 450{
452 if (starget->hostdata) 451 if (starget->hostdata)
@@ -677,7 +676,9 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
677 return; 676 return;
678 } 677 }
679 678
679 hd->spi_pending |= (1 << sdev->id);
680 spi_dv_device(sdev); 680 spi_dv_device(sdev);
681 hd->spi_pending &= ~(1 << sdev->id);
681 682
682 if (sdev->channel == 1 && 683 if (sdev->channel == 1 &&
683 mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0) 684 mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0)
@@ -1203,11 +1204,27 @@ mptspi_dv_renegotiate_work(struct work_struct *work)
1203 container_of(work, struct work_queue_wrapper, work); 1204 container_of(work, struct work_queue_wrapper, work);
1204 struct _MPT_SCSI_HOST *hd = wqw->hd; 1205 struct _MPT_SCSI_HOST *hd = wqw->hd;
1205 struct scsi_device *sdev; 1206 struct scsi_device *sdev;
1207 struct scsi_target *starget;
1208 struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1;
1209 u32 nego;
1206 1210
1207 kfree(wqw); 1211 kfree(wqw);
1208 1212
1209 shost_for_each_device(sdev, hd->ioc->sh) 1213 if (hd->spi_pending) {
1210 mptspi_dv_device(hd, sdev); 1214 shost_for_each_device(sdev, hd->ioc->sh) {
1215 if (hd->spi_pending & (1 << sdev->id))
1216 continue;
1217 starget = scsi_target(sdev);
1218 nego = mptspi_getRP(starget);
1219 pg1.RequestedParameters = cpu_to_le32(nego);
1220 pg1.Reserved = 0;
1221 pg1.Configuration = 0;
1222 mptspi_write_spi_device_pg1(starget, &pg1);
1223 }
1224 } else {
1225 shost_for_each_device(sdev, hd->ioc->sh)
1226 mptspi_dv_device(hd, sdev);
1227 }
1211} 1228}
1212 1229
1213static void 1230static void
@@ -1453,6 +1470,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1453 init_waitqueue_head(&hd->scandv_waitq); 1470 init_waitqueue_head(&hd->scandv_waitq);
1454 hd->scandv_wait_done = 0; 1471 hd->scandv_wait_done = 0;
1455 hd->last_queue_full = 0; 1472 hd->last_queue_full = 0;
1473 hd->spi_pending = 0;
1456 1474
1457 /* Some versions of the firmware don't support page 0; without 1475 /* Some versions of the firmware don't support page 0; without
1458 * that we can't get the parameters */ 1476 * that we can't get the parameters */
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index ca86f113f36a..276ba3c5143f 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -18,7 +18,6 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/miscdevice.h> 20#include <linux/miscdevice.h>
21#include <linux/pci.h>
22#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
23#include <linux/platform_device.h> 22#include <linux/platform_device.h>
24#include <asm/uaccess.h> 23#include <asm/uaccess.h>
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 6a51e99a8079..60c8b26f0678 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -18,7 +18,6 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/hdpu_features.h> 20#include <linux/hdpu_features.h>
21#include <linux/pci.h>
22 21
23#include <linux/platform_device.h> 22#include <linux/platform_device.h>
24 23
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index bc60e2fc3c2c..1ba6c085419a 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -11,10 +11,20 @@
11 11
12#include <linux/tifm.h> 12#include <linux/tifm.h>
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/freezer.h>
15 14
16#define DRIVER_NAME "tifm_7xx1" 15#define DRIVER_NAME "tifm_7xx1"
17#define DRIVER_VERSION "0.7" 16#define DRIVER_VERSION "0.8"
17
18#define TIFM_IRQ_ENABLE 0x80000000
19#define TIFM_IRQ_SOCKMASK(x) (x)
20#define TIFM_IRQ_CARDMASK(x) ((x) << 8)
21#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
22#define TIFM_IRQ_SETALL 0xffffffff
23
24static void tifm_7xx1_dummy_eject(struct tifm_adapter *fm,
25 struct tifm_dev *sock)
26{
27}
18 28
19static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock) 29static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock)
20{ 30{
@@ -22,7 +32,7 @@ static void tifm_7xx1_eject(struct tifm_adapter *fm, struct tifm_dev *sock)
22 32
23 spin_lock_irqsave(&fm->lock, flags); 33 spin_lock_irqsave(&fm->lock, flags);
24 fm->socket_change_set |= 1 << sock->socket_id; 34 fm->socket_change_set |= 1 << sock->socket_id;
25 wake_up_all(&fm->change_set_notify); 35 tifm_queue_work(&fm->media_switcher);
26 spin_unlock_irqrestore(&fm->lock, flags); 36 spin_unlock_irqrestore(&fm->lock, flags);
27} 37}
28 38
@@ -30,8 +40,7 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
30{ 40{
31 struct tifm_adapter *fm = dev_id; 41 struct tifm_adapter *fm = dev_id;
32 struct tifm_dev *sock; 42 struct tifm_dev *sock;
33 unsigned int irq_status; 43 unsigned int irq_status, cnt;
34 unsigned int sock_irq_status, cnt;
35 44
36 spin_lock(&fm->lock); 45 spin_lock(&fm->lock);
37 irq_status = readl(fm->addr + FM_INTERRUPT_STATUS); 46 irq_status = readl(fm->addr + FM_INTERRUPT_STATUS);
@@ -45,12 +54,12 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
45 54
46 for (cnt = 0; cnt < fm->num_sockets; cnt++) { 55 for (cnt = 0; cnt < fm->num_sockets; cnt++) {
47 sock = fm->sockets[cnt]; 56 sock = fm->sockets[cnt];
48 sock_irq_status = (irq_status >> cnt) 57 if (sock) {
49 & (TIFM_IRQ_FIFOMASK(1) 58 if ((irq_status >> cnt) & TIFM_IRQ_FIFOMASK(1))
50 | TIFM_IRQ_CARDMASK(1)); 59 sock->data_event(sock);
51 60 if ((irq_status >> cnt) & TIFM_IRQ_CARDMASK(1))
52 if (sock && sock_irq_status) 61 sock->card_event(sock);
53 sock->signal_irq(sock, sock_irq_status); 62 }
54 } 63 }
55 64
56 fm->socket_change_set |= irq_status 65 fm->socket_change_set |= irq_status
@@ -58,57 +67,57 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
58 } 67 }
59 writel(irq_status, fm->addr + FM_INTERRUPT_STATUS); 68 writel(irq_status, fm->addr + FM_INTERRUPT_STATUS);
60 69
61 if (!fm->socket_change_set) 70 if (fm->finish_me)
71 complete_all(fm->finish_me);
72 else if (!fm->socket_change_set)
62 writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE); 73 writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE);
63 else 74 else
64 wake_up_all(&fm->change_set_notify); 75 tifm_queue_work(&fm->media_switcher);
65 76
66 spin_unlock(&fm->lock); 77 spin_unlock(&fm->lock);
67 return IRQ_HANDLED; 78 return IRQ_HANDLED;
68} 79}
69 80
70static tifm_media_id tifm_7xx1_toggle_sock_power(char __iomem *sock_addr, 81static unsigned char tifm_7xx1_toggle_sock_power(char __iomem *sock_addr)
71 int is_x2)
72{ 82{
73 unsigned int s_state; 83 unsigned int s_state;
74 int cnt; 84 int cnt;
75 85
76 writel(0x0e00, sock_addr + SOCK_CONTROL); 86 writel(0x0e00, sock_addr + SOCK_CONTROL);
77 87
78 for (cnt = 0; cnt < 100; cnt++) { 88 for (cnt = 16; cnt <= 256; cnt <<= 1) {
79 if (!(TIFM_SOCK_STATE_POWERED 89 if (!(TIFM_SOCK_STATE_POWERED
80 & readl(sock_addr + SOCK_PRESENT_STATE))) 90 & readl(sock_addr + SOCK_PRESENT_STATE)))
81 break; 91 break;
82 msleep(10); 92
93 msleep(cnt);
83 } 94 }
84 95
85 s_state = readl(sock_addr + SOCK_PRESENT_STATE); 96 s_state = readl(sock_addr + SOCK_PRESENT_STATE);
86 if (!(TIFM_SOCK_STATE_OCCUPIED & s_state)) 97 if (!(TIFM_SOCK_STATE_OCCUPIED & s_state))
87 return FM_NULL; 98 return 0;
88
89 if (is_x2) {
90 writel((s_state & 7) | 0x0c00, sock_addr + SOCK_CONTROL);
91 } else {
92 // SmartMedia cards need extra 40 msec
93 if (((readl(sock_addr + SOCK_PRESENT_STATE) >> 4) & 7) == 1)
94 msleep(40);
95 writel(readl(sock_addr + SOCK_CONTROL) | TIFM_CTRL_LED,
96 sock_addr + SOCK_CONTROL);
97 msleep(10);
98 writel((s_state & 0x7) | 0x0c00 | TIFM_CTRL_LED,
99 sock_addr + SOCK_CONTROL);
100 }
101 99
102 for (cnt = 0; cnt < 100; cnt++) { 100 writel(readl(sock_addr + SOCK_CONTROL) | TIFM_CTRL_LED,
101 sock_addr + SOCK_CONTROL);
102
103 /* xd needs some extra time before power on */
104 if (((readl(sock_addr + SOCK_PRESENT_STATE) >> 4) & 7)
105 == TIFM_TYPE_XD)
106 msleep(40);
107
108 writel((s_state & 7) | 0x0c00, sock_addr + SOCK_CONTROL);
109 /* wait for power to stabilize */
110 msleep(20);
111 for (cnt = 16; cnt <= 256; cnt <<= 1) {
103 if ((TIFM_SOCK_STATE_POWERED 112 if ((TIFM_SOCK_STATE_POWERED
104 & readl(sock_addr + SOCK_PRESENT_STATE))) 113 & readl(sock_addr + SOCK_PRESENT_STATE)))
105 break; 114 break;
106 msleep(10); 115
116 msleep(cnt);
107 } 117 }
108 118
109 if (!is_x2) 119 writel(readl(sock_addr + SOCK_CONTROL) & (~TIFM_CTRL_LED),
110 writel(readl(sock_addr + SOCK_CONTROL) & (~TIFM_CTRL_LED), 120 sock_addr + SOCK_CONTROL);
111 sock_addr + SOCK_CONTROL);
112 121
113 return (readl(sock_addr + SOCK_PRESENT_STATE) >> 4) & 7; 122 return (readl(sock_addr + SOCK_PRESENT_STATE) >> 4) & 7;
114} 123}
@@ -119,127 +128,77 @@ tifm_7xx1_sock_addr(char __iomem *base_addr, unsigned int sock_num)
119 return base_addr + ((sock_num + 1) << 10); 128 return base_addr + ((sock_num + 1) << 10);
120} 129}
121 130
122static int tifm_7xx1_switch_media(void *data) 131static void tifm_7xx1_switch_media(struct work_struct *work)
123{ 132{
124 struct tifm_adapter *fm = data; 133 struct tifm_adapter *fm = container_of(work, struct tifm_adapter,
125 unsigned long flags; 134 media_switcher);
126 tifm_media_id media_id;
127 char *card_name = "xx";
128 int cnt, rc;
129 struct tifm_dev *sock; 135 struct tifm_dev *sock;
130 unsigned int socket_change_set; 136 unsigned long flags;
131 137 unsigned char media_id;
132 while (1) { 138 unsigned int socket_change_set, cnt;
133 rc = wait_event_interruptible(fm->change_set_notify,
134 fm->socket_change_set);
135 if (rc == -ERESTARTSYS)
136 try_to_freeze();
137 139
138 spin_lock_irqsave(&fm->lock, flags); 140 spin_lock_irqsave(&fm->lock, flags);
139 socket_change_set = fm->socket_change_set; 141 socket_change_set = fm->socket_change_set;
140 fm->socket_change_set = 0; 142 fm->socket_change_set = 0;
141 143
142 dev_dbg(fm->dev, "checking media set %x\n", 144 dev_dbg(fm->cdev.dev, "checking media set %x\n",
143 socket_change_set); 145 socket_change_set);
144 146
145 if (kthread_should_stop()) 147 if (!socket_change_set) {
146 socket_change_set = (1 << fm->num_sockets) - 1;
147 spin_unlock_irqrestore(&fm->lock, flags); 148 spin_unlock_irqrestore(&fm->lock, flags);
149 return;
150 }
148 151
149 if (!socket_change_set) 152 for (cnt = 0; cnt < fm->num_sockets; cnt++) {
153 if (!(socket_change_set & (1 << cnt)))
150 continue; 154 continue;
151 155 sock = fm->sockets[cnt];
152 spin_lock_irqsave(&fm->lock, flags); 156 if (sock) {
153 for (cnt = 0; cnt < fm->num_sockets; cnt++) { 157 printk(KERN_INFO
154 if (!(socket_change_set & (1 << cnt))) 158 "%s : demand removing card from socket %u:%u\n",
155 continue; 159 fm->cdev.class_id, fm->id, cnt);
156 sock = fm->sockets[cnt]; 160 fm->sockets[cnt] = NULL;
157 if (sock) {
158 printk(KERN_INFO DRIVER_NAME
159 ": demand removing card from socket %d\n",
160 cnt);
161 fm->sockets[cnt] = NULL;
162 spin_unlock_irqrestore(&fm->lock, flags);
163 device_unregister(&sock->dev);
164 spin_lock_irqsave(&fm->lock, flags);
165 writel(0x0e00,
166 tifm_7xx1_sock_addr(fm->addr, cnt)
167 + SOCK_CONTROL);
168 }
169 if (kthread_should_stop())
170 continue;
171
172 spin_unlock_irqrestore(&fm->lock, flags); 161 spin_unlock_irqrestore(&fm->lock, flags);
173 media_id = tifm_7xx1_toggle_sock_power( 162 device_unregister(&sock->dev);
174 tifm_7xx1_sock_addr(fm->addr, cnt), 163 spin_lock_irqsave(&fm->lock, flags);
175 fm->num_sockets == 2); 164 writel(0x0e00, tifm_7xx1_sock_addr(fm->addr, cnt)
176 if (media_id) { 165 + SOCK_CONTROL);
177 sock = tifm_alloc_device(fm);
178 if (sock) {
179 sock->addr = tifm_7xx1_sock_addr(fm->addr,
180 cnt);
181 sock->media_id = media_id;
182 sock->socket_id = cnt;
183 switch (media_id) {
184 case 1:
185 card_name = "xd";
186 break;
187 case 2:
188 card_name = "ms";
189 break;
190 case 3:
191 card_name = "sd";
192 break;
193 default:
194 tifm_free_device(&sock->dev);
195 spin_lock_irqsave(&fm->lock, flags);
196 continue;
197 }
198 snprintf(sock->dev.bus_id, BUS_ID_SIZE,
199 "tifm_%s%u:%u", card_name,
200 fm->id, cnt);
201 printk(KERN_INFO DRIVER_NAME
202 ": %s card detected in socket %d\n",
203 card_name, cnt);
204 if (!device_register(&sock->dev)) {
205 spin_lock_irqsave(&fm->lock, flags);
206 if (!fm->sockets[cnt]) {
207 fm->sockets[cnt] = sock;
208 sock = NULL;
209 }
210 spin_unlock_irqrestore(&fm->lock, flags);
211 }
212 if (sock)
213 tifm_free_device(&sock->dev);
214 }
215 spin_lock_irqsave(&fm->lock, flags);
216 }
217 } 166 }
218 167
219 if (!kthread_should_stop()) { 168 spin_unlock_irqrestore(&fm->lock, flags);
220 writel(TIFM_IRQ_FIFOMASK(socket_change_set) 169
221 | TIFM_IRQ_CARDMASK(socket_change_set), 170 media_id = tifm_7xx1_toggle_sock_power(
222 fm->addr + FM_CLEAR_INTERRUPT_ENABLE); 171 tifm_7xx1_sock_addr(fm->addr, cnt));
223 writel(TIFM_IRQ_FIFOMASK(socket_change_set) 172
224 | TIFM_IRQ_CARDMASK(socket_change_set), 173 // tifm_alloc_device will check if media_id is valid
225 fm->addr + FM_SET_INTERRUPT_ENABLE); 174 sock = tifm_alloc_device(fm, cnt, media_id);
226 writel(TIFM_IRQ_ENABLE, 175 if (sock) {
227 fm->addr + FM_SET_INTERRUPT_ENABLE); 176 sock->addr = tifm_7xx1_sock_addr(fm->addr, cnt);
228 spin_unlock_irqrestore(&fm->lock, flags); 177
229 } else { 178 if (!device_register(&sock->dev)) {
230 for (cnt = 0; cnt < fm->num_sockets; cnt++) { 179 spin_lock_irqsave(&fm->lock, flags);
231 if (fm->sockets[cnt]) 180 if (!fm->sockets[cnt]) {
232 fm->socket_change_set |= 1 << cnt; 181 fm->sockets[cnt] = sock;
233 } 182 sock = NULL;
234 if (!fm->socket_change_set) { 183 }
235 spin_unlock_irqrestore(&fm->lock, flags);
236 return 0;
237 } else {
238 spin_unlock_irqrestore(&fm->lock, flags); 184 spin_unlock_irqrestore(&fm->lock, flags);
239 } 185 }
186 if (sock)
187 tifm_free_device(&sock->dev);
240 } 188 }
189 spin_lock_irqsave(&fm->lock, flags);
241 } 190 }
242 return 0; 191
192 writel(TIFM_IRQ_FIFOMASK(socket_change_set)
193 | TIFM_IRQ_CARDMASK(socket_change_set),
194 fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
195
196 writel(TIFM_IRQ_FIFOMASK(socket_change_set)
197 | TIFM_IRQ_CARDMASK(socket_change_set),
198 fm->addr + FM_SET_INTERRUPT_ENABLE);
199
200 writel(TIFM_IRQ_ENABLE, fm->addr + FM_SET_INTERRUPT_ENABLE);
201 spin_unlock_irqrestore(&fm->lock, flags);
243} 202}
244 203
245#ifdef CONFIG_PM 204#ifdef CONFIG_PM
@@ -258,9 +217,11 @@ static int tifm_7xx1_suspend(struct pci_dev *dev, pm_message_t state)
258static int tifm_7xx1_resume(struct pci_dev *dev) 217static int tifm_7xx1_resume(struct pci_dev *dev)
259{ 218{
260 struct tifm_adapter *fm = pci_get_drvdata(dev); 219 struct tifm_adapter *fm = pci_get_drvdata(dev);
261 int cnt, rc; 220 int rc;
221 unsigned int good_sockets = 0, bad_sockets = 0;
262 unsigned long flags; 222 unsigned long flags;
263 tifm_media_id new_ids[fm->num_sockets]; 223 unsigned char new_ids[fm->num_sockets];
224 DECLARE_COMPLETION_ONSTACK(finish_resume);
264 225
265 pci_set_power_state(dev, PCI_D0); 226 pci_set_power_state(dev, PCI_D0);
266 pci_restore_state(dev); 227 pci_restore_state(dev);
@@ -271,45 +232,49 @@ static int tifm_7xx1_resume(struct pci_dev *dev)
271 232
272 dev_dbg(&dev->dev, "resuming host\n"); 233 dev_dbg(&dev->dev, "resuming host\n");
273 234
274 for (cnt = 0; cnt < fm->num_sockets; cnt++) 235 for (rc = 0; rc < fm->num_sockets; rc++)
275 new_ids[cnt] = tifm_7xx1_toggle_sock_power( 236 new_ids[rc] = tifm_7xx1_toggle_sock_power(
276 tifm_7xx1_sock_addr(fm->addr, cnt), 237 tifm_7xx1_sock_addr(fm->addr, rc));
277 fm->num_sockets == 2);
278 spin_lock_irqsave(&fm->lock, flags); 238 spin_lock_irqsave(&fm->lock, flags);
279 fm->socket_change_set = 0; 239 for (rc = 0; rc < fm->num_sockets; rc++) {
280 for (cnt = 0; cnt < fm->num_sockets; cnt++) { 240 if (fm->sockets[rc]) {
281 if (fm->sockets[cnt]) { 241 if (fm->sockets[rc]->type == new_ids[rc])
282 if (fm->sockets[cnt]->media_id == new_ids[cnt]) 242 good_sockets |= 1 << rc;
283 fm->socket_change_set |= 1 << cnt; 243 else
284 244 bad_sockets |= 1 << rc;
285 fm->sockets[cnt]->media_id = new_ids[cnt];
286 } 245 }
287 } 246 }
288 247
289 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), 248 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1),
290 fm->addr + FM_SET_INTERRUPT_ENABLE); 249 fm->addr + FM_SET_INTERRUPT_ENABLE);
291 if (!fm->socket_change_set) { 250 dev_dbg(&dev->dev, "change sets on resume: good %x, bad %x\n",
292 spin_unlock_irqrestore(&fm->lock, flags); 251 good_sockets, bad_sockets);
293 return 0; 252
294 } else { 253 fm->socket_change_set = 0;
295 fm->socket_change_set = 0; 254 if (good_sockets) {
255 fm->finish_me = &finish_resume;
296 spin_unlock_irqrestore(&fm->lock, flags); 256 spin_unlock_irqrestore(&fm->lock, flags);
257 rc = wait_for_completion_timeout(&finish_resume, HZ);
258 dev_dbg(&dev->dev, "wait returned %d\n", rc);
259 writel(TIFM_IRQ_FIFOMASK(good_sockets)
260 | TIFM_IRQ_CARDMASK(good_sockets),
261 fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
262 writel(TIFM_IRQ_FIFOMASK(good_sockets)
263 | TIFM_IRQ_CARDMASK(good_sockets),
264 fm->addr + FM_SET_INTERRUPT_ENABLE);
265 spin_lock_irqsave(&fm->lock, flags);
266 fm->finish_me = NULL;
267 fm->socket_change_set ^= good_sockets & fm->socket_change_set;
297 } 268 }
298 269
299 wait_event_timeout(fm->change_set_notify, fm->socket_change_set, HZ); 270 fm->socket_change_set |= bad_sockets;
271 if (fm->socket_change_set)
272 tifm_queue_work(&fm->media_switcher);
300 273
301 spin_lock_irqsave(&fm->lock, flags); 274 spin_unlock_irqrestore(&fm->lock, flags);
302 writel(TIFM_IRQ_FIFOMASK(fm->socket_change_set)
303 | TIFM_IRQ_CARDMASK(fm->socket_change_set),
304 fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
305 writel(TIFM_IRQ_FIFOMASK(fm->socket_change_set)
306 | TIFM_IRQ_CARDMASK(fm->socket_change_set),
307 fm->addr + FM_SET_INTERRUPT_ENABLE);
308 writel(TIFM_IRQ_ENABLE, 275 writel(TIFM_IRQ_ENABLE,
309 fm->addr + FM_SET_INTERRUPT_ENABLE); 276 fm->addr + FM_SET_INTERRUPT_ENABLE);
310 fm->socket_change_set = 0;
311 277
312 spin_unlock_irqrestore(&fm->lock, flags);
313 return 0; 278 return 0;
314} 279}
315 280
@@ -345,20 +310,14 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
345 310
346 pci_intx(dev, 1); 311 pci_intx(dev, 1);
347 312
348 fm = tifm_alloc_adapter(); 313 fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
314 ? 4 : 2, &dev->dev);
349 if (!fm) { 315 if (!fm) {
350 rc = -ENOMEM; 316 rc = -ENOMEM;
351 goto err_out_int; 317 goto err_out_int;
352 } 318 }
353 319
354 fm->dev = &dev->dev; 320 INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media);
355 fm->num_sockets = (dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM)
356 ? 4 : 2;
357 fm->sockets = kzalloc(sizeof(struct tifm_dev*) * fm->num_sockets,
358 GFP_KERNEL);
359 if (!fm->sockets)
360 goto err_out_free;
361
362 fm->eject = tifm_7xx1_eject; 321 fm->eject = tifm_7xx1_eject;
363 pci_set_drvdata(dev, fm); 322 pci_set_drvdata(dev, fm);
364 323
@@ -367,19 +326,16 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
367 if (!fm->addr) 326 if (!fm->addr)
368 goto err_out_free; 327 goto err_out_free;
369 328
370 rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm); 329 rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm);
371 if (rc) 330 if (rc)
372 goto err_out_unmap; 331 goto err_out_unmap;
373 332
374 init_waitqueue_head(&fm->change_set_notify); 333 rc = tifm_add_adapter(fm);
375 rc = tifm_add_adapter(fm, tifm_7xx1_switch_media);
376 if (rc) 334 if (rc)
377 goto err_out_irq; 335 goto err_out_irq;
378 336
379 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
380 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), 337 writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1),
381 fm->addr + FM_SET_INTERRUPT_ENABLE); 338 fm->addr + FM_SET_INTERRUPT_ENABLE);
382 wake_up_process(fm->media_switcher);
383 return 0; 339 return 0;
384 340
385err_out_irq: 341err_out_irq:
@@ -401,18 +357,12 @@ err_out:
401static void tifm_7xx1_remove(struct pci_dev *dev) 357static void tifm_7xx1_remove(struct pci_dev *dev)
402{ 358{
403 struct tifm_adapter *fm = pci_get_drvdata(dev); 359 struct tifm_adapter *fm = pci_get_drvdata(dev);
404 unsigned long flags;
405 360
361 fm->eject = tifm_7xx1_dummy_eject;
406 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); 362 writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE);
407 mmiowb(); 363 mmiowb();
408 free_irq(dev->irq, fm); 364 free_irq(dev->irq, fm);
409 365
410 spin_lock_irqsave(&fm->lock, flags);
411 fm->socket_change_set = (1 << fm->num_sockets) - 1;
412 spin_unlock_irqrestore(&fm->lock, flags);
413
414 kthread_stop(fm->media_switcher);
415
416 tifm_remove_adapter(fm); 366 tifm_remove_adapter(fm);
417 367
418 pci_set_drvdata(dev, NULL); 368 pci_set_drvdata(dev, NULL);
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 6b10ebe9d936..d195fb088f4a 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -14,71 +14,124 @@
14#include <linux/idr.h> 14#include <linux/idr.h>
15 15
16#define DRIVER_NAME "tifm_core" 16#define DRIVER_NAME "tifm_core"
17#define DRIVER_VERSION "0.7" 17#define DRIVER_VERSION "0.8"
18 18
19static struct workqueue_struct *workqueue;
19static DEFINE_IDR(tifm_adapter_idr); 20static DEFINE_IDR(tifm_adapter_idr);
20static DEFINE_SPINLOCK(tifm_adapter_lock); 21static DEFINE_SPINLOCK(tifm_adapter_lock);
21 22
22static tifm_media_id *tifm_device_match(tifm_media_id *ids, 23static const char *tifm_media_type_name(unsigned char type, unsigned char nt)
23 struct tifm_dev *dev)
24{ 24{
25 while (*ids) { 25 const char *card_type_name[3][3] = {
26 if (dev->media_id == *ids) 26 { "SmartMedia/xD", "MemoryStick", "MMC/SD" },
27 return ids; 27 { "XD", "MS", "SD"},
28 ids++; 28 { "xd", "ms", "sd"}
29 } 29 };
30 return NULL; 30
31 if (nt > 2 || type < 1 || type > 3)
32 return NULL;
33 return card_type_name[nt][type - 1];
31} 34}
32 35
33static int tifm_match(struct device *dev, struct device_driver *drv) 36static int tifm_dev_match(struct tifm_dev *sock, struct tifm_device_id *id)
34{ 37{
35 struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); 38 if (sock->type == id->type)
36 struct tifm_driver *fm_drv;
37
38 fm_drv = container_of(drv, struct tifm_driver, driver);
39 if (!fm_drv->id_table)
40 return -EINVAL;
41 if (tifm_device_match(fm_drv->id_table, fm_dev))
42 return 1; 39 return 1;
43 return -ENODEV; 40 return 0;
41}
42
43static int tifm_bus_match(struct device *dev, struct device_driver *drv)
44{
45 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
46 struct tifm_driver *fm_drv = container_of(drv, struct tifm_driver,
47 driver);
48 struct tifm_device_id *ids = fm_drv->id_table;
49
50 if (ids) {
51 while (ids->type) {
52 if (tifm_dev_match(sock, ids))
53 return 1;
54 ++ids;
55 }
56 }
57 return 0;
44} 58}
45 59
46static int tifm_uevent(struct device *dev, char **envp, int num_envp, 60static int tifm_uevent(struct device *dev, char **envp, int num_envp,
47 char *buffer, int buffer_size) 61 char *buffer, int buffer_size)
48{ 62{
49 struct tifm_dev *fm_dev; 63 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
50 int i = 0; 64 int i = 0;
51 int length = 0; 65 int length = 0;
52 const char *card_type_name[] = {"INV", "SM", "MS", "SD"};
53 66
54 if (!dev || !(fm_dev = container_of(dev, struct tifm_dev, dev)))
55 return -ENODEV;
56 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, 67 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
57 "TIFM_CARD_TYPE=%s", card_type_name[fm_dev->media_id])) 68 "TIFM_CARD_TYPE=%s",
69 tifm_media_type_name(sock->type, 1)))
58 return -ENOMEM; 70 return -ENOMEM;
59 71
60 return 0; 72 return 0;
61} 73}
62 74
75static int tifm_device_probe(struct device *dev)
76{
77 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
78 struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
79 driver);
80 int rc = -ENODEV;
81
82 get_device(dev);
83 if (dev->driver && drv->probe) {
84 rc = drv->probe(sock);
85 if (!rc)
86 return 0;
87 }
88 put_device(dev);
89 return rc;
90}
91
92static void tifm_dummy_event(struct tifm_dev *sock)
93{
94 return;
95}
96
97static int tifm_device_remove(struct device *dev)
98{
99 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
100 struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
101 driver);
102
103 if (dev->driver && drv->remove) {
104 sock->card_event = tifm_dummy_event;
105 sock->data_event = tifm_dummy_event;
106 drv->remove(sock);
107 sock->dev.driver = NULL;
108 }
109
110 put_device(dev);
111 return 0;
112}
113
63#ifdef CONFIG_PM 114#ifdef CONFIG_PM
64 115
65static int tifm_device_suspend(struct device *dev, pm_message_t state) 116static int tifm_device_suspend(struct device *dev, pm_message_t state)
66{ 117{
67 struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); 118 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
68 struct tifm_driver *drv = fm_dev->drv; 119 struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
120 driver);
69 121
70 if (drv && drv->suspend) 122 if (dev->driver && drv->suspend)
71 return drv->suspend(fm_dev, state); 123 return drv->suspend(sock, state);
72 return 0; 124 return 0;
73} 125}
74 126
75static int tifm_device_resume(struct device *dev) 127static int tifm_device_resume(struct device *dev)
76{ 128{
77 struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); 129 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
78 struct tifm_driver *drv = fm_dev->drv; 130 struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
131 driver);
79 132
80 if (drv && drv->resume) 133 if (dev->driver && drv->resume)
81 return drv->resume(fm_dev); 134 return drv->resume(sock);
82 return 0; 135 return 0;
83} 136}
84 137
@@ -89,19 +142,33 @@ static int tifm_device_resume(struct device *dev)
89 142
90#endif /* CONFIG_PM */ 143#endif /* CONFIG_PM */
91 144
145static ssize_t type_show(struct device *dev, struct device_attribute *attr,
146 char *buf)
147{
148 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
149 return sprintf(buf, "%x", sock->type);
150}
151
152static struct device_attribute tifm_dev_attrs[] = {
153 __ATTR(type, S_IRUGO, type_show, NULL),
154 __ATTR_NULL
155};
156
92static struct bus_type tifm_bus_type = { 157static struct bus_type tifm_bus_type = {
93 .name = "tifm", 158 .name = "tifm",
94 .match = tifm_match, 159 .dev_attrs = tifm_dev_attrs,
95 .uevent = tifm_uevent, 160 .match = tifm_bus_match,
96 .suspend = tifm_device_suspend, 161 .uevent = tifm_uevent,
97 .resume = tifm_device_resume 162 .probe = tifm_device_probe,
163 .remove = tifm_device_remove,
164 .suspend = tifm_device_suspend,
165 .resume = tifm_device_resume
98}; 166};
99 167
100static void tifm_free(struct class_device *cdev) 168static void tifm_free(struct class_device *cdev)
101{ 169{
102 struct tifm_adapter *fm = container_of(cdev, struct tifm_adapter, cdev); 170 struct tifm_adapter *fm = container_of(cdev, struct tifm_adapter, cdev);
103 171
104 kfree(fm->sockets);
105 kfree(fm); 172 kfree(fm);
106} 173}
107 174
@@ -110,28 +177,25 @@ static struct class tifm_adapter_class = {
110 .release = tifm_free 177 .release = tifm_free
111}; 178};
112 179
113struct tifm_adapter *tifm_alloc_adapter(void) 180struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
181 struct device *dev)
114{ 182{
115 struct tifm_adapter *fm; 183 struct tifm_adapter *fm;
116 184
117 fm = kzalloc(sizeof(struct tifm_adapter), GFP_KERNEL); 185 fm = kzalloc(sizeof(struct tifm_adapter)
186 + sizeof(struct tifm_dev*) * num_sockets, GFP_KERNEL);
118 if (fm) { 187 if (fm) {
119 fm->cdev.class = &tifm_adapter_class; 188 fm->cdev.class = &tifm_adapter_class;
120 spin_lock_init(&fm->lock); 189 fm->cdev.dev = dev;
121 class_device_initialize(&fm->cdev); 190 class_device_initialize(&fm->cdev);
191 spin_lock_init(&fm->lock);
192 fm->num_sockets = num_sockets;
122 } 193 }
123 return fm; 194 return fm;
124} 195}
125EXPORT_SYMBOL(tifm_alloc_adapter); 196EXPORT_SYMBOL(tifm_alloc_adapter);
126 197
127void tifm_free_adapter(struct tifm_adapter *fm) 198int tifm_add_adapter(struct tifm_adapter *fm)
128{
129 class_device_put(&fm->cdev);
130}
131EXPORT_SYMBOL(tifm_free_adapter);
132
133int tifm_add_adapter(struct tifm_adapter *fm,
134 int (*mediathreadfn)(void *data))
135{ 199{
136 int rc; 200 int rc;
137 201
@@ -141,59 +205,80 @@ int tifm_add_adapter(struct tifm_adapter *fm,
141 spin_lock(&tifm_adapter_lock); 205 spin_lock(&tifm_adapter_lock);
142 rc = idr_get_new(&tifm_adapter_idr, fm, &fm->id); 206 rc = idr_get_new(&tifm_adapter_idr, fm, &fm->id);
143 spin_unlock(&tifm_adapter_lock); 207 spin_unlock(&tifm_adapter_lock);
144 if (!rc) { 208 if (rc)
145 snprintf(fm->cdev.class_id, BUS_ID_SIZE, "tifm%u", fm->id); 209 return rc;
146 fm->media_switcher = kthread_create(mediathreadfn,
147 fm, "tifm/%u", fm->id);
148
149 if (!IS_ERR(fm->media_switcher))
150 return class_device_add(&fm->cdev);
151 210
211 snprintf(fm->cdev.class_id, BUS_ID_SIZE, "tifm%u", fm->id);
212 rc = class_device_add(&fm->cdev);
213 if (rc) {
152 spin_lock(&tifm_adapter_lock); 214 spin_lock(&tifm_adapter_lock);
153 idr_remove(&tifm_adapter_idr, fm->id); 215 idr_remove(&tifm_adapter_idr, fm->id);
154 spin_unlock(&tifm_adapter_lock); 216 spin_unlock(&tifm_adapter_lock);
155 rc = -ENOMEM;
156 } 217 }
218
157 return rc; 219 return rc;
158} 220}
159EXPORT_SYMBOL(tifm_add_adapter); 221EXPORT_SYMBOL(tifm_add_adapter);
160 222
161void tifm_remove_adapter(struct tifm_adapter *fm) 223void tifm_remove_adapter(struct tifm_adapter *fm)
162{ 224{
163 class_device_del(&fm->cdev); 225 unsigned int cnt;
226
227 flush_workqueue(workqueue);
228 for (cnt = 0; cnt < fm->num_sockets; ++cnt) {
229 if (fm->sockets[cnt])
230 device_unregister(&fm->sockets[cnt]->dev);
231 }
164 232
165 spin_lock(&tifm_adapter_lock); 233 spin_lock(&tifm_adapter_lock);
166 idr_remove(&tifm_adapter_idr, fm->id); 234 idr_remove(&tifm_adapter_idr, fm->id);
167 spin_unlock(&tifm_adapter_lock); 235 spin_unlock(&tifm_adapter_lock);
236 class_device_del(&fm->cdev);
168} 237}
169EXPORT_SYMBOL(tifm_remove_adapter); 238EXPORT_SYMBOL(tifm_remove_adapter);
170 239
171void tifm_free_device(struct device *dev) 240void tifm_free_adapter(struct tifm_adapter *fm)
172{ 241{
173 struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); 242 class_device_put(&fm->cdev);
174 kfree(fm_dev);
175} 243}
176EXPORT_SYMBOL(tifm_free_device); 244EXPORT_SYMBOL(tifm_free_adapter);
177 245
178static void tifm_dummy_signal_irq(struct tifm_dev *sock, 246void tifm_free_device(struct device *dev)
179 unsigned int sock_irq_status)
180{ 247{
181 return; 248 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
249 kfree(sock);
182} 250}
251EXPORT_SYMBOL(tifm_free_device);
183 252
184struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm) 253struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
254 unsigned char type)
185{ 255{
186 struct tifm_dev *dev = kzalloc(sizeof(struct tifm_dev), GFP_KERNEL); 256 struct tifm_dev *sock = NULL;
187 257
188 if (dev) { 258 if (!tifm_media_type_name(type, 0))
189 spin_lock_init(&dev->lock); 259 return sock;
190 260
191 dev->dev.parent = fm->dev; 261 sock = kzalloc(sizeof(struct tifm_dev), GFP_KERNEL);
192 dev->dev.bus = &tifm_bus_type; 262 if (sock) {
193 dev->dev.release = tifm_free_device; 263 spin_lock_init(&sock->lock);
194 dev->signal_irq = tifm_dummy_signal_irq; 264 sock->type = type;
265 sock->socket_id = id;
266 sock->card_event = tifm_dummy_event;
267 sock->data_event = tifm_dummy_event;
268
269 sock->dev.parent = fm->cdev.dev;
270 sock->dev.bus = &tifm_bus_type;
271 sock->dev.dma_mask = fm->cdev.dev->dma_mask;
272 sock->dev.release = tifm_free_device;
273
274 snprintf(sock->dev.bus_id, BUS_ID_SIZE,
275 "tifm_%s%u:%u", tifm_media_type_name(type, 2),
276 fm->id, id);
277 printk(KERN_INFO DRIVER_NAME
278 ": %s card detected in socket %u:%u\n",
279 tifm_media_type_name(type, 0), fm->id, id);
195 } 280 }
196 return dev; 281 return sock;
197} 282}
198EXPORT_SYMBOL(tifm_alloc_device); 283EXPORT_SYMBOL(tifm_alloc_device);
199 284
@@ -218,54 +303,15 @@ void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
218} 303}
219EXPORT_SYMBOL(tifm_unmap_sg); 304EXPORT_SYMBOL(tifm_unmap_sg);
220 305
221static int tifm_device_probe(struct device *dev) 306void tifm_queue_work(struct work_struct *work)
222{
223 struct tifm_driver *drv;
224 struct tifm_dev *fm_dev;
225 int rc = 0;
226 const tifm_media_id *id;
227
228 drv = container_of(dev->driver, struct tifm_driver, driver);
229 fm_dev = container_of(dev, struct tifm_dev, dev);
230 get_device(dev);
231 if (!fm_dev->drv && drv->probe && drv->id_table) {
232 rc = -ENODEV;
233 id = tifm_device_match(drv->id_table, fm_dev);
234 if (id)
235 rc = drv->probe(fm_dev);
236 if (rc >= 0) {
237 rc = 0;
238 fm_dev->drv = drv;
239 }
240 }
241 if (rc)
242 put_device(dev);
243 return rc;
244}
245
246static int tifm_device_remove(struct device *dev)
247{ 307{
248 struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); 308 queue_work(workqueue, work);
249 struct tifm_driver *drv = fm_dev->drv;
250
251 if (drv) {
252 fm_dev->signal_irq = tifm_dummy_signal_irq;
253 if (drv->remove)
254 drv->remove(fm_dev);
255 fm_dev->drv = NULL;
256 }
257
258 put_device(dev);
259 return 0;
260} 309}
310EXPORT_SYMBOL(tifm_queue_work);
261 311
262int tifm_register_driver(struct tifm_driver *drv) 312int tifm_register_driver(struct tifm_driver *drv)
263{ 313{
264 drv->driver.bus = &tifm_bus_type; 314 drv->driver.bus = &tifm_bus_type;
265 drv->driver.probe = tifm_device_probe;
266 drv->driver.remove = tifm_device_remove;
267 drv->driver.suspend = tifm_device_suspend;
268 drv->driver.resume = tifm_device_resume;
269 315
270 return driver_register(&drv->driver); 316 return driver_register(&drv->driver);
271} 317}
@@ -279,13 +325,25 @@ EXPORT_SYMBOL(tifm_unregister_driver);
279 325
280static int __init tifm_init(void) 326static int __init tifm_init(void)
281{ 327{
282 int rc = bus_register(&tifm_bus_type); 328 int rc;
283 329
284 if (!rc) { 330 workqueue = create_freezeable_workqueue("tifm");
285 rc = class_register(&tifm_adapter_class); 331 if (!workqueue)
286 if (rc) 332 return -ENOMEM;
287 bus_unregister(&tifm_bus_type); 333
288 } 334 rc = bus_register(&tifm_bus_type);
335
336 if (rc)
337 goto err_out_wq;
338
339 rc = class_register(&tifm_adapter_class);
340 if (!rc)
341 return 0;
342
343 bus_unregister(&tifm_bus_type);
344
345err_out_wq:
346 destroy_workqueue(workqueue);
289 347
290 return rc; 348 return rc;
291} 349}
@@ -294,6 +352,7 @@ static void __exit tifm_exit(void)
294{ 352{
295 class_unregister(&tifm_adapter_class); 353 class_unregister(&tifm_adapter_class);
296 bus_unregister(&tifm_bus_type); 354 bus_unregister(&tifm_bus_type);
355 destroy_workqueue(workqueue);
297} 356}
298 357
299subsys_initcall(tifm_init); 358subsys_initcall(tifm_init);
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 12af9c718764..6c97491543db 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -19,110 +19,10 @@ config MMC_DEBUG
19 This is an option for use by developers; most people should 19 This is an option for use by developers; most people should
20 say N here. This enables MMC core and driver debugging. 20 say N here. This enables MMC core and driver debugging.
21 21
22config MMC_BLOCK 22source "drivers/mmc/core/Kconfig"
23 tristate "MMC block device driver"
24 depends on MMC && BLOCK
25 default y
26 help
27 Say Y here to enable the MMC block device driver support.
28 This provides a block device driver, which you can use to
29 mount the filesystem. Almost everyone wishing MMC support
30 should say Y or M here.
31
32config MMC_ARMMMCI
33 tristate "ARM AMBA Multimedia Card Interface support"
34 depends on ARM_AMBA && MMC
35 help
36 This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
37 Interface (PL180 and PL181) support. If you have an ARM(R)
38 platform with a Multimedia Card slot, say Y or M here.
39
40 If unsure, say N.
41
42config MMC_PXA
43 tristate "Intel PXA25x/26x/27x Multimedia Card Interface support"
44 depends on ARCH_PXA && MMC
45 help
46 This selects the Intel(R) PXA(R) Multimedia card Interface.
47 If you have a PXA(R) platform with a Multimedia Card slot,
48 say Y or M here.
49
50 If unsure, say N.
51
52config MMC_SDHCI
53 tristate "Secure Digital Host Controller Interface support (EXPERIMENTAL)"
54 depends on PCI && MMC && EXPERIMENTAL
55 help
56 This select the generic Secure Digital Host Controller Interface.
57 It is used by manufacturers such as Texas Instruments(R), Ricoh(R)
58 and Toshiba(R). Most controllers found in laptops are of this type.
59 If you have a controller with this interface, say Y or M here.
60
61 If unsure, say N.
62
63config MMC_OMAP
64 tristate "TI OMAP Multimedia Card Interface support"
65 depends on ARCH_OMAP && MMC
66 select TPS65010 if MACH_OMAP_H2
67 help
68 This selects the TI OMAP Multimedia card Interface.
69 If you have an OMAP board with a Multimedia Card slot,
70 say Y or M here.
71
72 If unsure, say N.
73 23
74config MMC_WBSD 24source "drivers/mmc/card/Kconfig"
75 tristate "Winbond W83L51xD SD/MMC Card Interface support"
76 depends on MMC && ISA_DMA_API
77 help
78 This selects the Winbond(R) W83L51xD Secure digital and
79 Multimedia card Interface.
80 If you have a machine with a integrated W83L518D or W83L519D
81 SD/MMC card reader, say Y or M here.
82
83 If unsure, say N.
84
85config MMC_AU1X
86 tristate "Alchemy AU1XX0 MMC Card Interface support"
87 depends on MMC && SOC_AU1200
88 help
89 This selects the AMD Alchemy(R) Multimedia card interface.
90 If you have a Alchemy platform with a MMC slot, say Y or M here.
91
92 If unsure, say N.
93
94config MMC_AT91
95 tristate "AT91 SD/MMC Card Interface support"
96 depends on ARCH_AT91 && MMC
97 help
98 This selects the AT91 MCI controller.
99
100 If unsure, say N.
101
102config MMC_IMX
103 tristate "Motorola i.MX Multimedia Card Interface support"
104 depends on ARCH_IMX && MMC
105 help
106 This selects the Motorola i.MX Multimedia card Interface.
107 If you have a i.MX platform with a Multimedia Card slot,
108 say Y or M here.
109
110 If unsure, say N.
111
112config MMC_TIFM_SD
113 tristate "TI Flash Media MMC/SD Interface support (EXPERIMENTAL)"
114 depends on MMC && EXPERIMENTAL && PCI
115 select TIFM_CORE
116 help
117 Say Y here if you want to be able to access MMC/SD cards with
118 the Texas Instruments(R) Flash Media card reader, found in many
119 laptops.
120 This option 'selects' (turns on, enables) 'TIFM_CORE', but you
121 probably also need appropriate card reader host adapter, such as
122 'Misc devices: TI Flash Media PCI74xx/PCI76xx host adapter support
123 (TIFM_7XX1)'.
124 25
125 To compile this driver as a module, choose M here: the 26source "drivers/mmc/host/Kconfig"
126 module will be called tifm_sd.
127 27
128endmenu 28endmenu
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 83ffb9326a54..9979f5e9765b 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -2,32 +2,11 @@
2# Makefile for the kernel mmc device drivers. 2# Makefile for the kernel mmc device drivers.
3# 3#
4 4
5#
6# Core
7#
8obj-$(CONFIG_MMC) += mmc_core.o
9
10#
11# Media drivers
12#
13obj-$(CONFIG_MMC_BLOCK) += mmc_block.o
14
15#
16# Host drivers
17#
18obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
19obj-$(CONFIG_MMC_PXA) += pxamci.o
20obj-$(CONFIG_MMC_IMX) += imxmmc.o
21obj-$(CONFIG_MMC_SDHCI) += sdhci.o
22obj-$(CONFIG_MMC_WBSD) += wbsd.o
23obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
24obj-$(CONFIG_MMC_OMAP) += omap.o
25obj-$(CONFIG_MMC_AT91) += at91_mci.o
26obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
27
28mmc_core-y := mmc.o mmc_sysfs.o
29mmc_core-$(CONFIG_BLOCK) += mmc_queue.o
30
31ifeq ($(CONFIG_MMC_DEBUG),y) 5ifeq ($(CONFIG_MMC_DEBUG),y)
32EXTRA_CFLAGS += -DDEBUG 6 EXTRA_CFLAGS += -DDEBUG
33endif 7endif
8
9obj-$(CONFIG_MMC) += core/
10obj-$(CONFIG_MMC) += card/
11obj-$(CONFIG_MMC) += host/
12
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
new file mode 100644
index 000000000000..01a9fd376a1f
--- /dev/null
+++ b/drivers/mmc/card/Kconfig
@@ -0,0 +1,17 @@
1#
2# MMC/SD card drivers
3#
4
5comment "MMC/SD Card Drivers"
6 depends MMC
7
8config MMC_BLOCK
9 tristate "MMC block device driver"
10 depends on MMC && BLOCK
11 default y
12 help
13 Say Y here to enable the MMC block device driver support.
14 This provides a block device driver, which you can use to
15 mount the filesystem. Almost everyone wishing MMC support
16 should say Y or M here.
17
diff --git a/drivers/mmc/card/Makefile b/drivers/mmc/card/Makefile
new file mode 100644
index 000000000000..cf8c939867f5
--- /dev/null
+++ b/drivers/mmc/card/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for MMC/SD card drivers
3#
4
5ifeq ($(CONFIG_MMC_DEBUG),y)
6 EXTRA_CFLAGS += -DDEBUG
7endif
8
9obj-$(CONFIG_MMC_BLOCK) += mmc_block.o
10mmc_block-objs := block.o queue.o
11
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/card/block.c
index 86439a0bb271..d24ab234394c 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/card/block.c
@@ -2,6 +2,7 @@
2 * Block driver for media (i.e., flash cards) 2 * Block driver for media (i.e., flash cards)
3 * 3 *
4 * Copyright 2002 Hewlett-Packard Company 4 * Copyright 2002 Hewlett-Packard Company
5 * Copyright 2005-2007 Pierre Ossman
5 * 6 *
6 * Use consistent with the GNU GPL is permitted, 7 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is 8 * provided that this copyright notice is
@@ -31,13 +32,13 @@
31 32
32#include <linux/mmc/card.h> 33#include <linux/mmc/card.h>
33#include <linux/mmc/host.h> 34#include <linux/mmc/host.h>
34#include <linux/mmc/protocol.h> 35#include <linux/mmc/mmc.h>
35#include <linux/mmc/host.h> 36#include <linux/mmc/sd.h>
36 37
37#include <asm/system.h> 38#include <asm/system.h>
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39 40
40#include "mmc_queue.h" 41#include "queue.h"
41 42
42/* 43/*
43 * max 8 partitions per card 44 * max 8 partitions per card
@@ -223,10 +224,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
223 struct mmc_blk_data *md = mq->data; 224 struct mmc_blk_data *md = mq->data;
224 struct mmc_card *card = md->queue.card; 225 struct mmc_card *card = md->queue.card;
225 struct mmc_blk_request brq; 226 struct mmc_blk_request brq;
226 int ret = 1; 227 int ret = 1, sg_pos, data_size;
227 228
228 if (mmc_card_claim_host(card)) 229 mmc_claim_host(card->host);
229 goto flush_queue;
230 230
231 do { 231 do {
232 struct mmc_command cmd; 232 struct mmc_command cmd;
@@ -283,6 +283,20 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
283 brq.data.sg = mq->sg; 283 brq.data.sg = mq->sg;
284 brq.data.sg_len = blk_rq_map_sg(req->q, req, brq.data.sg); 284 brq.data.sg_len = blk_rq_map_sg(req->q, req, brq.data.sg);
285 285
286 if (brq.data.blocks !=
287 (req->nr_sectors >> (md->block_bits - 9))) {
288 data_size = brq.data.blocks * brq.data.blksz;
289 for (sg_pos = 0; sg_pos < brq.data.sg_len; sg_pos++) {
290 data_size -= mq->sg[sg_pos].length;
291 if (data_size <= 0) {
292 mq->sg[sg_pos].length += data_size;
293 sg_pos++;
294 break;
295 }
296 }
297 brq.data.sg_len = sg_pos;
298 }
299
286 mmc_wait_for_req(card->host, &brq.mrq); 300 mmc_wait_for_req(card->host, &brq.mrq);
287 if (brq.cmd.error) { 301 if (brq.cmd.error) {
288 printk(KERN_ERR "%s: error %d sending read/write command\n", 302 printk(KERN_ERR "%s: error %d sending read/write command\n",
@@ -342,7 +356,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
342 spin_unlock_irq(&md->lock); 356 spin_unlock_irq(&md->lock);
343 } while (ret); 357 } while (ret);
344 358
345 mmc_card_release_host(card); 359 mmc_release_host(card->host);
346 360
347 return 1; 361 return 1;
348 362
@@ -378,9 +392,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
378 spin_unlock_irq(&md->lock); 392 spin_unlock_irq(&md->lock);
379 } 393 }
380 394
381flush_queue: 395 mmc_release_host(card->host);
382
383 mmc_card_release_host(card);
384 396
385 spin_lock_irq(&md->lock); 397 spin_lock_irq(&md->lock);
386 while (ret) { 398 while (ret) {
@@ -477,11 +489,20 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
477 489
478 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); 490 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
479 491
480 /* 492 if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
481 * The CSD capacity field is in units of read_blkbits. 493 /*
482 * set_capacity takes units of 512 bytes. 494 * The EXT_CSD sector count is in number or 512 byte
483 */ 495 * sectors.
484 set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9)); 496 */
497 set_capacity(md->disk, card->ext_csd.sectors);
498 } else {
499 /*
500 * The CSD capacity field is in units of read_blkbits.
501 * set_capacity takes units of 512 bytes.
502 */
503 set_capacity(md->disk,
504 card->csd.capacity << (card->csd.read_blkbits - 9));
505 }
485 return md; 506 return md;
486 507
487 err_putdisk: 508 err_putdisk:
@@ -502,12 +523,12 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
502 if (mmc_card_blockaddr(card)) 523 if (mmc_card_blockaddr(card))
503 return 0; 524 return 0;
504 525
505 mmc_card_claim_host(card); 526 mmc_claim_host(card->host);
506 cmd.opcode = MMC_SET_BLOCKLEN; 527 cmd.opcode = MMC_SET_BLOCKLEN;
507 cmd.arg = 1 << md->block_bits; 528 cmd.arg = 1 << md->block_bits;
508 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; 529 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
509 err = mmc_wait_for_cmd(card->host, &cmd, 5); 530 err = mmc_wait_for_cmd(card->host, &cmd, 5);
510 mmc_card_release_host(card); 531 mmc_release_host(card->host);
511 532
512 if (err) { 533 if (err) {
513 printk(KERN_ERR "%s: unable to set block size to %d: %d\n", 534 printk(KERN_ERR "%s: unable to set block size to %d: %d\n",
diff --git a/drivers/mmc/mmc_queue.c b/drivers/mmc/card/queue.c
index c27e42645cdb..2e77963db334 100644
--- a/drivers/mmc/mmc_queue.c
+++ b/drivers/mmc/card/queue.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/mmc/mmc_queue.c 2 * linux/drivers/mmc/queue.c
3 * 3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved. 4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright 2006-2007 Pierre Ossman
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -14,7 +15,7 @@
14 15
15#include <linux/mmc/card.h> 16#include <linux/mmc/card.h>
16#include <linux/mmc/host.h> 17#include <linux/mmc/host.h>
17#include "mmc_queue.h" 18#include "queue.h"
18 19
19#define MMC_QUEUE_SUSPENDED (1 << 0) 20#define MMC_QUEUE_SUSPENDED (1 << 0)
20 21
@@ -179,7 +180,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
179 blk_cleanup_queue(mq->queue); 180 blk_cleanup_queue(mq->queue);
180 return ret; 181 return ret;
181} 182}
182EXPORT_SYMBOL(mmc_init_queue);
183 183
184void mmc_cleanup_queue(struct mmc_queue *mq) 184void mmc_cleanup_queue(struct mmc_queue *mq)
185{ 185{
@@ -191,6 +191,9 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
191 q->queuedata = NULL; 191 q->queuedata = NULL;
192 spin_unlock_irqrestore(q->queue_lock, flags); 192 spin_unlock_irqrestore(q->queue_lock, flags);
193 193
194 /* Make sure the queue isn't suspended, as that will deadlock */
195 mmc_queue_resume(mq);
196
194 /* Then terminate our worker thread */ 197 /* Then terminate our worker thread */
195 kthread_stop(mq->thread); 198 kthread_stop(mq->thread);
196 199
@@ -226,7 +229,6 @@ void mmc_queue_suspend(struct mmc_queue *mq)
226 down(&mq->thread_sem); 229 down(&mq->thread_sem);
227 } 230 }
228} 231}
229EXPORT_SYMBOL(mmc_queue_suspend);
230 232
231/** 233/**
232 * mmc_queue_resume - resume a previously suspended MMC request queue 234 * mmc_queue_resume - resume a previously suspended MMC request queue
@@ -247,4 +249,4 @@ void mmc_queue_resume(struct mmc_queue *mq)
247 spin_unlock_irqrestore(q->queue_lock, flags); 249 spin_unlock_irqrestore(q->queue_lock, flags);
248 } 250 }
249} 251}
250EXPORT_SYMBOL(mmc_queue_resume); 252
diff --git a/drivers/mmc/mmc_queue.h b/drivers/mmc/card/queue.h
index c9f139e764f6..c9f139e764f6 100644
--- a/drivers/mmc/mmc_queue.h
+++ b/drivers/mmc/card/queue.h
diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig
new file mode 100644
index 000000000000..94222b9a15ea
--- /dev/null
+++ b/drivers/mmc/core/Kconfig
@@ -0,0 +1,17 @@
1#
2# MMC core configuration
3#
4
5config MMC_UNSAFE_RESUME
6 bool "Allow unsafe resume (DANGEROUS)"
7 depends on MMC != n
8 help
9 If you say Y here, the MMC layer will assume that all cards
10 stayed in their respective slots during the suspend. The
11 normal behaviour is to remove them at suspend and
12 redetecting them at resume. Breaking this assumption will
13 in most cases result in data corruption.
14
15 This option is usually just for embedded systems which use
16 a MMC/SD card for rootfs. Most people should say N here.
17
diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
new file mode 100644
index 000000000000..1075b02ae754
--- /dev/null
+++ b/drivers/mmc/core/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the kernel mmc core.
3#
4
5ifeq ($(CONFIG_MMC_DEBUG),y)
6 EXTRA_CFLAGS += -DDEBUG
7endif
8
9obj-$(CONFIG_MMC) += mmc_core.o
10mmc_core-y := core.o sysfs.o mmc.o mmc_ops.o sd.o sd_ops.o
11
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
new file mode 100644
index 000000000000..72c7cf4a9f9d
--- /dev/null
+++ b/drivers/mmc/core/core.c
@@ -0,0 +1,727 @@
1/*
2 * linux/drivers/mmc/core/core.c
3 *
4 * Copyright (C) 2003-2004 Russell King, All Rights Reserved.
5 * SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
6 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
7 * MMCv4 support Copyright (C) 2006 Philip Langdale, All Rights Reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/completion.h>
17#include <linux/device.h>
18#include <linux/delay.h>
19#include <linux/pagemap.h>
20#include <linux/err.h>
21#include <asm/scatterlist.h>
22#include <linux/scatterlist.h>
23
24#include <linux/mmc/card.h>
25#include <linux/mmc/host.h>
26#include <linux/mmc/mmc.h>
27#include <linux/mmc/sd.h>
28
29#include "core.h"
30#include "sysfs.h"
31
32#include "mmc_ops.h"
33#include "sd_ops.h"
34
35extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
36extern int mmc_attach_sd(struct mmc_host *host, u32 ocr);
37
38/**
39 * mmc_request_done - finish processing an MMC request
40 * @host: MMC host which completed request
41 * @mrq: MMC request which request
42 *
43 * MMC drivers should call this function when they have completed
44 * their processing of a request.
45 */
46void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
47{
48 struct mmc_command *cmd = mrq->cmd;
49 int err = cmd->error;
50
51 pr_debug("%s: req done (CMD%u): %d/%d/%d: %08x %08x %08x %08x\n",
52 mmc_hostname(host), cmd->opcode, err,
53 mrq->data ? mrq->data->error : 0,
54 mrq->stop ? mrq->stop->error : 0,
55 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
56
57 if (err && cmd->retries) {
58 cmd->retries--;
59 cmd->error = 0;
60 host->ops->request(host, mrq);
61 } else if (mrq->done) {
62 mrq->done(mrq);
63 }
64}
65
66EXPORT_SYMBOL(mmc_request_done);
67
68/**
69 * mmc_start_request - start a command on a host
70 * @host: MMC host to start command on
71 * @mrq: MMC request to start
72 *
73 * Queue a command on the specified host. We expect the
74 * caller to be holding the host lock with interrupts disabled.
75 */
76void
77mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
78{
79#ifdef CONFIG_MMC_DEBUG
80 unsigned int i, sz;
81#endif
82
83 pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
84 mmc_hostname(host), mrq->cmd->opcode,
85 mrq->cmd->arg, mrq->cmd->flags);
86
87 WARN_ON(!host->claimed);
88
89 mrq->cmd->error = 0;
90 mrq->cmd->mrq = mrq;
91 if (mrq->data) {
92 BUG_ON(mrq->data->blksz > host->max_blk_size);
93 BUG_ON(mrq->data->blocks > host->max_blk_count);
94 BUG_ON(mrq->data->blocks * mrq->data->blksz >
95 host->max_req_size);
96
97#ifdef CONFIG_MMC_DEBUG
98 sz = 0;
99 for (i = 0;i < mrq->data->sg_len;i++)
100 sz += mrq->data->sg[i].length;
101 BUG_ON(sz != mrq->data->blocks * mrq->data->blksz);
102#endif
103
104 mrq->cmd->data = mrq->data;
105 mrq->data->error = 0;
106 mrq->data->mrq = mrq;
107 if (mrq->stop) {
108 mrq->data->stop = mrq->stop;
109 mrq->stop->error = 0;
110 mrq->stop->mrq = mrq;
111 }
112 }
113 host->ops->request(host, mrq);
114}
115
116EXPORT_SYMBOL(mmc_start_request);
117
118static void mmc_wait_done(struct mmc_request *mrq)
119{
120 complete(mrq->done_data);
121}
122
123int mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
124{
125 DECLARE_COMPLETION_ONSTACK(complete);
126
127 mrq->done_data = &complete;
128 mrq->done = mmc_wait_done;
129
130 mmc_start_request(host, mrq);
131
132 wait_for_completion(&complete);
133
134 return 0;
135}
136
137EXPORT_SYMBOL(mmc_wait_for_req);
138
139/**
140 * mmc_wait_for_cmd - start a command and wait for completion
141 * @host: MMC host to start command
142 * @cmd: MMC command to start
143 * @retries: maximum number of retries
144 *
145 * Start a new MMC command for a host, and wait for the command
146 * to complete. Return any error that occurred while the command
147 * was executing. Do not attempt to parse the response.
148 */
149int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries)
150{
151 struct mmc_request mrq;
152
153 BUG_ON(!host->claimed);
154
155 memset(&mrq, 0, sizeof(struct mmc_request));
156
157 memset(cmd->resp, 0, sizeof(cmd->resp));
158 cmd->retries = retries;
159
160 mrq.cmd = cmd;
161 cmd->data = NULL;
162
163 mmc_wait_for_req(host, &mrq);
164
165 return cmd->error;
166}
167
168EXPORT_SYMBOL(mmc_wait_for_cmd);
169
170/**
171 * mmc_set_data_timeout - set the timeout for a data command
172 * @data: data phase for command
173 * @card: the MMC card associated with the data transfer
174 * @write: flag to differentiate reads from writes
175 */
176void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
177 int write)
178{
179 unsigned int mult;
180
181 /*
182 * SD cards use a 100 multiplier rather than 10
183 */
184 mult = mmc_card_sd(card) ? 100 : 10;
185
186 /*
187 * Scale up the multiplier (and therefore the timeout) by
188 * the r2w factor for writes.
189 */
190 if (write)
191 mult <<= card->csd.r2w_factor;
192
193 data->timeout_ns = card->csd.tacc_ns * mult;
194 data->timeout_clks = card->csd.tacc_clks * mult;
195
196 /*
197 * SD cards also have an upper limit on the timeout.
198 */
199 if (mmc_card_sd(card)) {
200 unsigned int timeout_us, limit_us;
201
202 timeout_us = data->timeout_ns / 1000;
203 timeout_us += data->timeout_clks * 1000 /
204 (card->host->ios.clock / 1000);
205
206 if (write)
207 limit_us = 250000;
208 else
209 limit_us = 100000;
210
211 /*
212 * SDHC cards always use these fixed values.
213 */
214 if (timeout_us > limit_us || mmc_card_blockaddr(card)) {
215 data->timeout_ns = limit_us * 1000;
216 data->timeout_clks = 0;
217 }
218 }
219}
220EXPORT_SYMBOL(mmc_set_data_timeout);
221
222/**
223 * __mmc_claim_host - exclusively claim a host
224 * @host: mmc host to claim
225 * @card: mmc card to claim host for
226 *
227 * Claim a host for a set of operations. If a valid card
228 * is passed and this wasn't the last card selected, select
229 * the card before returning.
230 *
231 * Note: you should use mmc_card_claim_host or mmc_claim_host.
232 */
233void mmc_claim_host(struct mmc_host *host)
234{
235 DECLARE_WAITQUEUE(wait, current);
236 unsigned long flags;
237
238 add_wait_queue(&host->wq, &wait);
239 spin_lock_irqsave(&host->lock, flags);
240 while (1) {
241 set_current_state(TASK_UNINTERRUPTIBLE);
242 if (!host->claimed)
243 break;
244 spin_unlock_irqrestore(&host->lock, flags);
245 schedule();
246 spin_lock_irqsave(&host->lock, flags);
247 }
248 set_current_state(TASK_RUNNING);
249 host->claimed = 1;
250 spin_unlock_irqrestore(&host->lock, flags);
251 remove_wait_queue(&host->wq, &wait);
252}
253
254EXPORT_SYMBOL(mmc_claim_host);
255
256/**
257 * mmc_release_host - release a host
258 * @host: mmc host to release
259 *
260 * Release a MMC host, allowing others to claim the host
261 * for their operations.
262 */
263void mmc_release_host(struct mmc_host *host)
264{
265 unsigned long flags;
266
267 BUG_ON(!host->claimed);
268
269 spin_lock_irqsave(&host->lock, flags);
270 host->claimed = 0;
271 spin_unlock_irqrestore(&host->lock, flags);
272
273 wake_up(&host->wq);
274}
275
276EXPORT_SYMBOL(mmc_release_host);
277
278/*
279 * Internal function that does the actual ios call to the host driver,
280 * optionally printing some debug output.
281 */
282static inline void mmc_set_ios(struct mmc_host *host)
283{
284 struct mmc_ios *ios = &host->ios;
285
286 pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u "
287 "width %u timing %u\n",
288 mmc_hostname(host), ios->clock, ios->bus_mode,
289 ios->power_mode, ios->chip_select, ios->vdd,
290 ios->bus_width, ios->timing);
291
292 host->ops->set_ios(host, ios);
293}
294
295/*
296 * Control chip select pin on a host.
297 */
298void mmc_set_chip_select(struct mmc_host *host, int mode)
299{
300 host->ios.chip_select = mode;
301 mmc_set_ios(host);
302}
303
304/*
305 * Sets the host clock to the highest possible frequency that
306 * is below "hz".
307 */
308void mmc_set_clock(struct mmc_host *host, unsigned int hz)
309{
310 WARN_ON(hz < host->f_min);
311
312 if (hz > host->f_max)
313 hz = host->f_max;
314
315 host->ios.clock = hz;
316 mmc_set_ios(host);
317}
318
319/*
320 * Change the bus mode (open drain/push-pull) of a host.
321 */
322void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
323{
324 host->ios.bus_mode = mode;
325 mmc_set_ios(host);
326}
327
328/*
329 * Change data bus width of a host.
330 */
331void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
332{
333 host->ios.bus_width = width;
334 mmc_set_ios(host);
335}
336
337/*
338 * Mask off any voltages we don't support and select
339 * the lowest voltage
340 */
341u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
342{
343 int bit;
344
345 ocr &= host->ocr_avail;
346
347 bit = ffs(ocr);
348 if (bit) {
349 bit -= 1;
350
351 ocr &= 3 << bit;
352
353 host->ios.vdd = bit;
354 mmc_set_ios(host);
355 } else {
356 ocr = 0;
357 }
358
359 return ocr;
360}
361
362/*
363 * Select timing parameters for host.
364 */
365void mmc_set_timing(struct mmc_host *host, unsigned int timing)
366{
367 host->ios.timing = timing;
368 mmc_set_ios(host);
369}
370
371/*
372 * Allocate a new MMC card
373 */
374struct mmc_card *mmc_alloc_card(struct mmc_host *host)
375{
376 struct mmc_card *card;
377
378 card = kmalloc(sizeof(struct mmc_card), GFP_KERNEL);
379 if (!card)
380 return ERR_PTR(-ENOMEM);
381
382 mmc_init_card(card, host);
383
384 return card;
385}
386
387/*
388 * Apply power to the MMC stack. This is a two-stage process.
389 * First, we enable power to the card without the clock running.
390 * We then wait a bit for the power to stabilise. Finally,
391 * enable the bus drivers and clock to the card.
392 *
393 * We must _NOT_ enable the clock prior to power stablising.
394 *
395 * If a host does all the power sequencing itself, ignore the
396 * initial MMC_POWER_UP stage.
397 */
398static void mmc_power_up(struct mmc_host *host)
399{
400 int bit = fls(host->ocr_avail) - 1;
401
402 host->ios.vdd = bit;
403 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
404 host->ios.chip_select = MMC_CS_DONTCARE;
405 host->ios.power_mode = MMC_POWER_UP;
406 host->ios.bus_width = MMC_BUS_WIDTH_1;
407 host->ios.timing = MMC_TIMING_LEGACY;
408 mmc_set_ios(host);
409
410 mmc_delay(1);
411
412 host->ios.clock = host->f_min;
413 host->ios.power_mode = MMC_POWER_ON;
414 mmc_set_ios(host);
415
416 mmc_delay(2);
417}
418
419static void mmc_power_off(struct mmc_host *host)
420{
421 host->ios.clock = 0;
422 host->ios.vdd = 0;
423 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
424 host->ios.chip_select = MMC_CS_DONTCARE;
425 host->ios.power_mode = MMC_POWER_OFF;
426 host->ios.bus_width = MMC_BUS_WIDTH_1;
427 host->ios.timing = MMC_TIMING_LEGACY;
428 mmc_set_ios(host);
429}
430
431/*
432 * Assign a mmc bus handler to a host. Only one bus handler may control a
433 * host at any given time.
434 */
435void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops)
436{
437 unsigned long flags;
438
439 BUG_ON(!host);
440 BUG_ON(!ops);
441
442 BUG_ON(!host->claimed);
443
444 spin_lock_irqsave(&host->lock, flags);
445
446 BUG_ON(host->bus_ops);
447 BUG_ON(host->bus_refs);
448
449 host->bus_ops = ops;
450 host->bus_refs = 1;
451 host->bus_dead = 0;
452
453 spin_unlock_irqrestore(&host->lock, flags);
454}
455
456/*
457 * Remove the current bus handler from a host. Assumes that there are
458 * no interesting cards left, so the bus is powered down.
459 */
460void mmc_detach_bus(struct mmc_host *host)
461{
462 unsigned long flags;
463
464 BUG_ON(!host);
465
466 BUG_ON(!host->claimed);
467 BUG_ON(!host->bus_ops);
468
469 spin_lock_irqsave(&host->lock, flags);
470
471 host->bus_dead = 1;
472
473 spin_unlock_irqrestore(&host->lock, flags);
474
475 mmc_power_off(host);
476
477 mmc_bus_put(host);
478}
479
480/*
481 * Cleanup when the last reference to the bus operator is dropped.
482 */
483void __mmc_release_bus(struct mmc_host *host)
484{
485 BUG_ON(!host);
486 BUG_ON(host->bus_refs);
487 BUG_ON(!host->bus_dead);
488
489 host->bus_ops = NULL;
490}
491
492/**
493 * mmc_detect_change - process change of state on a MMC socket
494 * @host: host which changed state.
495 * @delay: optional delay to wait before detection (jiffies)
496 *
497 * All we know is that card(s) have been inserted or removed
498 * from the socket(s). We don't know which socket or cards.
499 */
500void mmc_detect_change(struct mmc_host *host, unsigned long delay)
501{
502#ifdef CONFIG_MMC_DEBUG
503 mmc_claim_host(host);
504 BUG_ON(host->removed);
505 mmc_release_host(host);
506#endif
507
508 mmc_schedule_delayed_work(&host->detect, delay);
509}
510
511EXPORT_SYMBOL(mmc_detect_change);
512
513
514static void mmc_rescan(struct work_struct *work)
515{
516 struct mmc_host *host =
517 container_of(work, struct mmc_host, detect.work);
518 u32 ocr;
519 int err;
520
521 mmc_bus_get(host);
522
523 if (host->bus_ops == NULL) {
524 /*
525 * Only we can add a new handler, so it's safe to
526 * release the lock here.
527 */
528 mmc_bus_put(host);
529
530 mmc_claim_host(host);
531
532 mmc_power_up(host);
533 mmc_go_idle(host);
534
535 mmc_send_if_cond(host, host->ocr_avail);
536
537 err = mmc_send_app_op_cond(host, 0, &ocr);
538 if (err == MMC_ERR_NONE) {
539 if (mmc_attach_sd(host, ocr))
540 mmc_power_off(host);
541 } else {
542 /*
543 * If we fail to detect any SD cards then try
544 * searching for MMC cards.
545 */
546 err = mmc_send_op_cond(host, 0, &ocr);
547 if (err == MMC_ERR_NONE) {
548 if (mmc_attach_mmc(host, ocr))
549 mmc_power_off(host);
550 } else {
551 mmc_power_off(host);
552 mmc_release_host(host);
553 }
554 }
555 } else {
556 if (host->bus_ops->detect && !host->bus_dead)
557 host->bus_ops->detect(host);
558
559 mmc_bus_put(host);
560 }
561}
562
563
564/**
565 * mmc_alloc_host - initialise the per-host structure.
566 * @extra: sizeof private data structure
567 * @dev: pointer to host device model structure
568 *
569 * Initialise the per-host structure.
570 */
571struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
572{
573 struct mmc_host *host;
574
575 host = mmc_alloc_host_sysfs(extra, dev);
576 if (host) {
577 spin_lock_init(&host->lock);
578 init_waitqueue_head(&host->wq);
579 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
580
581 /*
582 * By default, hosts do not support SGIO or large requests.
583 * They have to set these according to their abilities.
584 */
585 host->max_hw_segs = 1;
586 host->max_phys_segs = 1;
587 host->max_seg_size = PAGE_CACHE_SIZE;
588
589 host->max_req_size = PAGE_CACHE_SIZE;
590 host->max_blk_size = 512;
591 host->max_blk_count = PAGE_CACHE_SIZE / 512;
592 }
593
594 return host;
595}
596
597EXPORT_SYMBOL(mmc_alloc_host);
598
599/**
600 * mmc_add_host - initialise host hardware
601 * @host: mmc host
602 */
603int mmc_add_host(struct mmc_host *host)
604{
605 int ret;
606
607 ret = mmc_add_host_sysfs(host);
608 if (ret == 0) {
609 mmc_power_off(host);
610 mmc_detect_change(host, 0);
611 }
612
613 return ret;
614}
615
616EXPORT_SYMBOL(mmc_add_host);
617
618/**
619 * mmc_remove_host - remove host hardware
620 * @host: mmc host
621 *
622 * Unregister and remove all cards associated with this host,
623 * and power down the MMC bus.
624 */
625void mmc_remove_host(struct mmc_host *host)
626{
627#ifdef CONFIG_MMC_DEBUG
628 mmc_claim_host(host);
629 host->removed = 1;
630 mmc_release_host(host);
631#endif
632
633 mmc_flush_scheduled_work();
634
635 mmc_bus_get(host);
636 if (host->bus_ops && !host->bus_dead) {
637 if (host->bus_ops->remove)
638 host->bus_ops->remove(host);
639
640 mmc_claim_host(host);
641 mmc_detach_bus(host);
642 mmc_release_host(host);
643 }
644 mmc_bus_put(host);
645
646 BUG_ON(host->card);
647
648 mmc_power_off(host);
649 mmc_remove_host_sysfs(host);
650}
651
652EXPORT_SYMBOL(mmc_remove_host);
653
654/**
655 * mmc_free_host - free the host structure
656 * @host: mmc host
657 *
658 * Free the host once all references to it have been dropped.
659 */
660void mmc_free_host(struct mmc_host *host)
661{
662 mmc_free_host_sysfs(host);
663}
664
665EXPORT_SYMBOL(mmc_free_host);
666
667#ifdef CONFIG_PM
668
669/**
670 * mmc_suspend_host - suspend a host
671 * @host: mmc host
672 * @state: suspend mode (PM_SUSPEND_xxx)
673 */
674int mmc_suspend_host(struct mmc_host *host, pm_message_t state)
675{
676 mmc_flush_scheduled_work();
677
678 mmc_bus_get(host);
679 if (host->bus_ops && !host->bus_dead) {
680 if (host->bus_ops->suspend)
681 host->bus_ops->suspend(host);
682 if (!host->bus_ops->resume) {
683 if (host->bus_ops->remove)
684 host->bus_ops->remove(host);
685
686 mmc_claim_host(host);
687 mmc_detach_bus(host);
688 mmc_release_host(host);
689 }
690 }
691 mmc_bus_put(host);
692
693 mmc_power_off(host);
694
695 return 0;
696}
697
698EXPORT_SYMBOL(mmc_suspend_host);
699
700/**
701 * mmc_resume_host - resume a previously suspended host
702 * @host: mmc host
703 */
704int mmc_resume_host(struct mmc_host *host)
705{
706 mmc_bus_get(host);
707 if (host->bus_ops && !host->bus_dead) {
708 mmc_power_up(host);
709 BUG_ON(!host->bus_ops->resume);
710 host->bus_ops->resume(host);
711 }
712 mmc_bus_put(host);
713
714 /*
715 * We add a slight delay here so that resume can progress
716 * in parallel.
717 */
718 mmc_detect_change(host, 1);
719
720 return 0;
721}
722
723EXPORT_SYMBOL(mmc_resume_host);
724
725#endif
726
727MODULE_LICENSE("GPL");
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
new file mode 100644
index 000000000000..177264d090ac
--- /dev/null
+++ b/drivers/mmc/core/core.h
@@ -0,0 +1,70 @@
1/*
2 * linux/drivers/mmc/core/core.h
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright 2007 Pierre Ossman
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _MMC_CORE_CORE_H
12#define _MMC_CORE_CORE_H
13
14#include <linux/delay.h>
15
16#define MMC_CMD_RETRIES 3
17
18struct mmc_bus_ops {
19 void (*remove)(struct mmc_host *);
20 void (*detect)(struct mmc_host *);
21 void (*suspend)(struct mmc_host *);
22 void (*resume)(struct mmc_host *);
23};
24
25void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
26void mmc_detach_bus(struct mmc_host *host);
27
28void __mmc_release_bus(struct mmc_host *host);
29
30static inline void mmc_bus_get(struct mmc_host *host)
31{
32 unsigned long flags;
33
34 spin_lock_irqsave(&host->lock, flags);
35 host->bus_refs++;
36 spin_unlock_irqrestore(&host->lock, flags);
37}
38
39static inline void mmc_bus_put(struct mmc_host *host)
40{
41 unsigned long flags;
42
43 spin_lock_irqsave(&host->lock, flags);
44 host->bus_refs--;
45 if ((host->bus_refs == 0) && host->bus_ops)
46 __mmc_release_bus(host);
47 spin_unlock_irqrestore(&host->lock, flags);
48}
49
50void mmc_set_chip_select(struct mmc_host *host, int mode);
51void mmc_set_clock(struct mmc_host *host, unsigned int hz);
52void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
53void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
54u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
55void mmc_set_timing(struct mmc_host *host, unsigned int timing);
56
57struct mmc_card *mmc_alloc_card(struct mmc_host *host);
58
59static inline void mmc_delay(unsigned int ms)
60{
61 if (ms < 1000 / HZ) {
62 cond_resched();
63 mdelay(ms);
64 } else {
65 msleep(ms);
66 }
67}
68
69#endif
70
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
new file mode 100644
index 000000000000..42cc2867ed7d
--- /dev/null
+++ b/drivers/mmc/core/mmc.c
@@ -0,0 +1,537 @@
1/*
2 * linux/drivers/mmc/mmc.c
3 *
4 * Copyright (C) 2003-2004 Russell King, All Rights Reserved.
5 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
6 * MMCv4 support Copyright (C) 2006 Philip Langdale, All Rights Reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/err.h>
14
15#include <linux/mmc/host.h>
16#include <linux/mmc/card.h>
17#include <linux/mmc/mmc.h>
18
19#include "core.h"
20#include "sysfs.h"
21#include "mmc_ops.h"
22
23static const unsigned int tran_exp[] = {
24 10000, 100000, 1000000, 10000000,
25 0, 0, 0, 0
26};
27
28static const unsigned char tran_mant[] = {
29 0, 10, 12, 13, 15, 20, 25, 30,
30 35, 40, 45, 50, 55, 60, 70, 80,
31};
32
33static const unsigned int tacc_exp[] = {
34 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
35};
36
37static const unsigned int tacc_mant[] = {
38 0, 10, 12, 13, 15, 20, 25, 30,
39 35, 40, 45, 50, 55, 60, 70, 80,
40};
41
42#define UNSTUFF_BITS(resp,start,size) \
43 ({ \
44 const int __size = size; \
45 const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
46 const int __off = 3 - ((start) / 32); \
47 const int __shft = (start) & 31; \
48 u32 __res; \
49 \
50 __res = resp[__off] >> __shft; \
51 if (__size + __shft > 32) \
52 __res |= resp[__off-1] << ((32 - __shft) % 32); \
53 __res & __mask; \
54 })
55
56/*
57 * Given the decoded CSD structure, decode the raw CID to our CID structure.
58 */
59static int mmc_decode_cid(struct mmc_card *card)
60{
61 u32 *resp = card->raw_cid;
62
63 /*
64 * The selection of the format here is based upon published
65 * specs from sandisk and from what people have reported.
66 */
67 switch (card->csd.mmca_vsn) {
68 case 0: /* MMC v1.0 - v1.2 */
69 case 1: /* MMC v1.4 */
70 card->cid.manfid = UNSTUFF_BITS(resp, 104, 24);
71 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
72 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
73 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
74 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
75 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
76 card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
77 card->cid.prod_name[6] = UNSTUFF_BITS(resp, 48, 8);
78 card->cid.hwrev = UNSTUFF_BITS(resp, 44, 4);
79 card->cid.fwrev = UNSTUFF_BITS(resp, 40, 4);
80 card->cid.serial = UNSTUFF_BITS(resp, 16, 24);
81 card->cid.month = UNSTUFF_BITS(resp, 12, 4);
82 card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
83 break;
84
85 case 2: /* MMC v2.0 - v2.2 */
86 case 3: /* MMC v3.1 - v3.3 */
87 case 4: /* MMC v4 */
88 card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
89 card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
90 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
91 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
92 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
93 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
94 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
95 card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
96 card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
97 card->cid.month = UNSTUFF_BITS(resp, 12, 4);
98 card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
99 break;
100
101 default:
102 printk("%s: card has unknown MMCA version %d\n",
103 mmc_hostname(card->host), card->csd.mmca_vsn);
104 return -EINVAL;
105 }
106
107 return 0;
108}
109
110/*
111 * Given a 128-bit response, decode to our card CSD structure.
112 */
113static int mmc_decode_csd(struct mmc_card *card)
114{
115 struct mmc_csd *csd = &card->csd;
116 unsigned int e, m, csd_struct;
117 u32 *resp = card->raw_csd;
118
119 /*
120 * We only understand CSD structure v1.1 and v1.2.
121 * v1.2 has extra information in bits 15, 11 and 10.
122 */
123 csd_struct = UNSTUFF_BITS(resp, 126, 2);
124 if (csd_struct != 1 && csd_struct != 2) {
125 printk("%s: unrecognised CSD structure version %d\n",
126 mmc_hostname(card->host), csd_struct);
127 return -EINVAL;
128 }
129
130 csd->mmca_vsn = UNSTUFF_BITS(resp, 122, 4);
131 m = UNSTUFF_BITS(resp, 115, 4);
132 e = UNSTUFF_BITS(resp, 112, 3);
133 csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10;
134 csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100;
135
136 m = UNSTUFF_BITS(resp, 99, 4);
137 e = UNSTUFF_BITS(resp, 96, 3);
138 csd->max_dtr = tran_exp[e] * tran_mant[m];
139 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
140
141 e = UNSTUFF_BITS(resp, 47, 3);
142 m = UNSTUFF_BITS(resp, 62, 12);
143 csd->capacity = (1 + m) << (e + 2);
144
145 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
146 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
147 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
148 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
149 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
150 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
151 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
152
153 return 0;
154}
155
156/*
157 * Read and decode extended CSD.
158 */
159static int mmc_read_ext_csd(struct mmc_card *card)
160{
161 int err;
162 u8 *ext_csd;
163
164 BUG_ON(!card);
165
166 err = MMC_ERR_FAILED;
167
168 if (card->csd.mmca_vsn < CSD_SPEC_VER_4)
169 return MMC_ERR_NONE;
170
171 /*
172 * As the ext_csd is so large and mostly unused, we don't store the
173 * raw block in mmc_card.
174 */
175 ext_csd = kmalloc(512, GFP_KERNEL);
176 if (!ext_csd) {
177 printk(KERN_ERR "%s: could not allocate a buffer to "
178 "receive the ext_csd. mmc v4 cards will be "
179 "treated as v3.\n", mmc_hostname(card->host));
180 return MMC_ERR_FAILED;
181 }
182
183 err = mmc_send_ext_csd(card, ext_csd);
184 if (err != MMC_ERR_NONE) {
185 /*
186 * High capacity cards should have this "magic" size
187 * stored in their CSD.
188 */
189 if (card->csd.capacity == (4096 * 512)) {
190 printk(KERN_ERR "%s: unable to read EXT_CSD "
191 "on a possible high capacity card. "
192 "Card will be ignored.\n",
193 mmc_hostname(card->host));
194 } else {
195 printk(KERN_WARNING "%s: unable to read "
196 "EXT_CSD, performance might "
197 "suffer.\n",
198 mmc_hostname(card->host));
199 err = MMC_ERR_NONE;
200 }
201 goto out;
202 }
203
204 card->ext_csd.sectors =
205 ext_csd[EXT_CSD_SEC_CNT + 0] << 0 |
206 ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
207 ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
208 ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
209 if (card->ext_csd.sectors)
210 mmc_card_set_blockaddr(card);
211
212 switch (ext_csd[EXT_CSD_CARD_TYPE]) {
213 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26:
214 card->ext_csd.hs_max_dtr = 52000000;
215 break;
216 case EXT_CSD_CARD_TYPE_26:
217 card->ext_csd.hs_max_dtr = 26000000;
218 break;
219 default:
220 /* MMC v4 spec says this cannot happen */
221 printk(KERN_WARNING "%s: card is mmc v4 but doesn't "
222 "support any high-speed modes.\n",
223 mmc_hostname(card->host));
224 goto out;
225 }
226
227out:
228 kfree(ext_csd);
229
230 return err;
231}
232
233/*
234 * Handle the detection and initialisation of a card.
235 *
236 * In the case of a resume, "curcard" will contain the card
237 * we're trying to reinitialise.
238 */
239static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
240 struct mmc_card *oldcard)
241{
242 struct mmc_card *card;
243 int err;
244 u32 cid[4];
245 unsigned int max_dtr;
246
247 BUG_ON(!host);
248 BUG_ON(!host->claimed);
249
250 /*
251 * Since we're changing the OCR value, we seem to
252 * need to tell some cards to go back to the idle
253 * state. We wait 1ms to give cards time to
254 * respond.
255 */
256 mmc_go_idle(host);
257
258 /* The extra bit indicates that we support high capacity */
259 err = mmc_send_op_cond(host, ocr | (1 << 30), NULL);
260 if (err != MMC_ERR_NONE)
261 goto err;
262
263 /*
264 * Fetch CID from card.
265 */
266 err = mmc_all_send_cid(host, cid);
267 if (err != MMC_ERR_NONE)
268 goto err;
269
270 if (oldcard) {
271 if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0)
272 goto err;
273
274 card = oldcard;
275 } else {
276 /*
277 * Allocate card structure.
278 */
279 card = mmc_alloc_card(host);
280 if (IS_ERR(card))
281 goto err;
282
283 card->type = MMC_TYPE_MMC;
284 card->rca = 1;
285 memcpy(card->raw_cid, cid, sizeof(card->raw_cid));
286 }
287
288 /*
289 * Set card RCA.
290 */
291 err = mmc_set_relative_addr(card);
292 if (err != MMC_ERR_NONE)
293 goto free_card;
294
295 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
296
297 if (!oldcard) {
298 /*
299 * Fetch CSD from card.
300 */
301 err = mmc_send_csd(card, card->raw_csd);
302 if (err != MMC_ERR_NONE)
303 goto free_card;
304
305 err = mmc_decode_csd(card);
306 if (err < 0)
307 goto free_card;
308 err = mmc_decode_cid(card);
309 if (err < 0)
310 goto free_card;
311 }
312
313 /*
314 * Select card, as all following commands rely on that.
315 */
316 err = mmc_select_card(card);
317 if (err != MMC_ERR_NONE)
318 goto free_card;
319
320 if (!oldcard) {
321 /*
322 * Fetch and process extened CSD.
323 */
324 err = mmc_read_ext_csd(card);
325 if (err != MMC_ERR_NONE)
326 goto free_card;
327 }
328
329 /*
330 * Activate high speed (if supported)
331 */
332 if ((card->ext_csd.hs_max_dtr != 0) &&
333 (host->caps & MMC_CAP_MMC_HIGHSPEED)) {
334 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
335 EXT_CSD_HS_TIMING, 1);
336 if (err != MMC_ERR_NONE)
337 goto free_card;
338
339 mmc_card_set_highspeed(card);
340
341 mmc_set_timing(card->host, MMC_TIMING_MMC_HS);
342 }
343
344 /*
345 * Compute bus speed.
346 */
347 max_dtr = (unsigned int)-1;
348
349 if (mmc_card_highspeed(card)) {
350 if (max_dtr > card->ext_csd.hs_max_dtr)
351 max_dtr = card->ext_csd.hs_max_dtr;
352 } else if (max_dtr > card->csd.max_dtr) {
353 max_dtr = card->csd.max_dtr;
354 }
355
356 mmc_set_clock(host, max_dtr);
357
358 /*
359 * Activate wide bus (if supported).
360 */
361 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
362 (host->caps & MMC_CAP_4_BIT_DATA)) {
363 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
364 EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4);
365 if (err != MMC_ERR_NONE)
366 goto free_card;
367
368 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
369 }
370
371 if (!oldcard)
372 host->card = card;
373
374 return MMC_ERR_NONE;
375
376free_card:
377 if (!oldcard)
378 mmc_remove_card(card);
379err:
380
381 return MMC_ERR_FAILED;
382}
383
384/*
385 * Host is being removed. Free up the current card.
386 */
387static void mmc_remove(struct mmc_host *host)
388{
389 BUG_ON(!host);
390 BUG_ON(!host->card);
391
392 mmc_remove_card(host->card);
393 host->card = NULL;
394}
395
396/*
397 * Card detection callback from host.
398 */
399static void mmc_detect(struct mmc_host *host)
400{
401 int err;
402
403 BUG_ON(!host);
404 BUG_ON(!host->card);
405
406 mmc_claim_host(host);
407
408 /*
409 * Just check if our card has been removed.
410 */
411 err = mmc_send_status(host->card, NULL);
412
413 mmc_release_host(host);
414
415 if (err != MMC_ERR_NONE) {
416 mmc_remove_card(host->card);
417 host->card = NULL;
418
419 mmc_claim_host(host);
420 mmc_detach_bus(host);
421 mmc_release_host(host);
422 }
423}
424
425#ifdef CONFIG_MMC_UNSAFE_RESUME
426
427/*
428 * Suspend callback from host.
429 */
430static void mmc_suspend(struct mmc_host *host)
431{
432 BUG_ON(!host);
433 BUG_ON(!host->card);
434
435 mmc_claim_host(host);
436 mmc_deselect_cards(host);
437 host->card->state &= ~MMC_STATE_HIGHSPEED;
438 mmc_release_host(host);
439}
440
441/*
442 * Resume callback from host.
443 *
444 * This function tries to determine if the same card is still present
445 * and, if so, restore all state to it.
446 */
447static void mmc_resume(struct mmc_host *host)
448{
449 int err;
450
451 BUG_ON(!host);
452 BUG_ON(!host->card);
453
454 mmc_claim_host(host);
455
456 err = mmc_sd_init_card(host, host->ocr, host->card);
457 if (err != MMC_ERR_NONE) {
458 mmc_remove_card(host->card);
459 host->card = NULL;
460
461 mmc_detach_bus(host);
462 }
463
464 mmc_release_host(host);
465}
466
467#else
468
469#define mmc_suspend NULL
470#define mmc_resume NULL
471
472#endif
473
474static const struct mmc_bus_ops mmc_ops = {
475 .remove = mmc_remove,
476 .detect = mmc_detect,
477 .suspend = mmc_suspend,
478 .resume = mmc_resume,
479};
480
481/*
482 * Starting point for MMC card init.
483 */
484int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
485{
486 int err;
487
488 BUG_ON(!host);
489 BUG_ON(!host->claimed);
490
491 mmc_attach_bus(host, &mmc_ops);
492
493 /*
494 * Sanity check the voltages that the card claims to
495 * support.
496 */
497 if (ocr & 0x7F) {
498 printk(KERN_WARNING "%s: card claims to support voltages "
499 "below the defined range. These will be ignored.\n",
500 mmc_hostname(host));
501 ocr &= ~0x7F;
502 }
503
504 host->ocr = mmc_select_voltage(host, ocr);
505
506 /*
507 * Can we support the voltage of the card?
508 */
509 if (!host->ocr)
510 goto err;
511
512 /*
513 * Detect and init the card.
514 */
515 err = mmc_sd_init_card(host, host->ocr, NULL);
516 if (err != MMC_ERR_NONE)
517 goto err;
518
519 mmc_release_host(host);
520
521 err = mmc_register_card(host->card);
522 if (err)
523 goto reclaim_host;
524
525 return 0;
526
527reclaim_host:
528 mmc_claim_host(host);
529 mmc_remove_card(host->card);
530 host->card = NULL;
531err:
532 mmc_detach_bus(host);
533 mmc_release_host(host);
534
535 return 0;
536}
537
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
new file mode 100644
index 000000000000..7dd720fa5895
--- /dev/null
+++ b/drivers/mmc/core/mmc_ops.c
@@ -0,0 +1,276 @@
1/*
2 * linux/drivers/mmc/mmc_ops.h
3 *
4 * Copyright 2006-2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h>
15
16#include <linux/mmc/host.h>
17#include <linux/mmc/card.h>
18#include <linux/mmc/mmc.h>
19
20#include "core.h"
21#include "mmc_ops.h"
22
23static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card)
24{
25 int err;
26 struct mmc_command cmd;
27
28 BUG_ON(!host);
29
30 memset(&cmd, 0, sizeof(struct mmc_command));
31
32 cmd.opcode = MMC_SELECT_CARD;
33
34 if (card) {
35 cmd.arg = card->rca << 16;
36 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
37 } else {
38 cmd.arg = 0;
39 cmd.flags = MMC_RSP_NONE | MMC_CMD_AC;
40 }
41
42 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
43 if (err != MMC_ERR_NONE)
44 return err;
45
46 return MMC_ERR_NONE;
47}
48
49int mmc_select_card(struct mmc_card *card)
50{
51 BUG_ON(!card);
52
53 return _mmc_select_card(card->host, card);
54}
55
56int mmc_deselect_cards(struct mmc_host *host)
57{
58 return _mmc_select_card(host, NULL);
59}
60
61int mmc_go_idle(struct mmc_host *host)
62{
63 int err;
64 struct mmc_command cmd;
65
66 mmc_set_chip_select(host, MMC_CS_HIGH);
67
68 mmc_delay(1);
69
70 memset(&cmd, 0, sizeof(struct mmc_command));
71
72 cmd.opcode = MMC_GO_IDLE_STATE;
73 cmd.arg = 0;
74 cmd.flags = MMC_RSP_NONE | MMC_CMD_BC;
75
76 err = mmc_wait_for_cmd(host, &cmd, 0);
77
78 mmc_delay(1);
79
80 mmc_set_chip_select(host, MMC_CS_DONTCARE);
81
82 mmc_delay(1);
83
84 return err;
85}
86
87int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
88{
89 struct mmc_command cmd;
90 int i, err = 0;
91
92 BUG_ON(!host);
93
94 memset(&cmd, 0, sizeof(struct mmc_command));
95
96 cmd.opcode = MMC_SEND_OP_COND;
97 cmd.arg = ocr;
98 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
99
100 for (i = 100; i; i--) {
101 err = mmc_wait_for_cmd(host, &cmd, 0);
102 if (err != MMC_ERR_NONE)
103 break;
104
105 if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
106 break;
107
108 err = MMC_ERR_TIMEOUT;
109
110 mmc_delay(10);
111 }
112
113 if (rocr)
114 *rocr = cmd.resp[0];
115
116 return err;
117}
118
119int mmc_all_send_cid(struct mmc_host *host, u32 *cid)
120{
121 int err;
122 struct mmc_command cmd;
123
124 BUG_ON(!host);
125 BUG_ON(!cid);
126
127 memset(&cmd, 0, sizeof(struct mmc_command));
128
129 cmd.opcode = MMC_ALL_SEND_CID;
130 cmd.arg = 0;
131 cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
132
133 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
134 if (err != MMC_ERR_NONE)
135 return err;
136
137 memcpy(cid, cmd.resp, sizeof(u32) * 4);
138
139 return MMC_ERR_NONE;
140}
141
142int mmc_set_relative_addr(struct mmc_card *card)
143{
144 int err;
145 struct mmc_command cmd;
146
147 BUG_ON(!card);
148 BUG_ON(!card->host);
149
150 memset(&cmd, 0, sizeof(struct mmc_command));
151
152 cmd.opcode = MMC_SET_RELATIVE_ADDR;
153 cmd.arg = card->rca << 16;
154 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
155
156 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES);
157 if (err != MMC_ERR_NONE)
158 return err;
159
160 return MMC_ERR_NONE;
161}
162
163int mmc_send_csd(struct mmc_card *card, u32 *csd)
164{
165 int err;
166 struct mmc_command cmd;
167
168 BUG_ON(!card);
169 BUG_ON(!card->host);
170 BUG_ON(!csd);
171
172 memset(&cmd, 0, sizeof(struct mmc_command));
173
174 cmd.opcode = MMC_SEND_CSD;
175 cmd.arg = card->rca << 16;
176 cmd.flags = MMC_RSP_R2 | MMC_CMD_AC;
177
178 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES);
179 if (err != MMC_ERR_NONE)
180 return err;
181
182 memcpy(csd, cmd.resp, sizeof(u32) * 4);
183
184 return MMC_ERR_NONE;
185}
186
187int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd)
188{
189 struct mmc_request mrq;
190 struct mmc_command cmd;
191 struct mmc_data data;
192 struct scatterlist sg;
193
194 BUG_ON(!card);
195 BUG_ON(!card->host);
196 BUG_ON(!ext_csd);
197
198 memset(&mrq, 0, sizeof(struct mmc_request));
199 memset(&cmd, 0, sizeof(struct mmc_command));
200 memset(&data, 0, sizeof(struct mmc_data));
201
202 mrq.cmd = &cmd;
203 mrq.data = &data;
204
205 cmd.opcode = MMC_SEND_EXT_CSD;
206 cmd.arg = 0;
207 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
208
209 data.blksz = 512;
210 data.blocks = 1;
211 data.flags = MMC_DATA_READ;
212 data.sg = &sg;
213 data.sg_len = 1;
214
215 sg_init_one(&sg, ext_csd, 512);
216
217 mmc_set_data_timeout(&data, card, 0);
218
219 mmc_wait_for_req(card->host, &mrq);
220
221 if (cmd.error != MMC_ERR_NONE)
222 return cmd.error;
223 if (data.error != MMC_ERR_NONE)
224 return data.error;
225
226 return MMC_ERR_NONE;
227}
228
229int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value)
230{
231 int err;
232 struct mmc_command cmd;
233
234 BUG_ON(!card);
235 BUG_ON(!card->host);
236
237 memset(&cmd, 0, sizeof(struct mmc_command));
238
239 cmd.opcode = MMC_SWITCH;
240 cmd.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
241 (index << 16) |
242 (value << 8) |
243 set;
244 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
245
246 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES);
247 if (err != MMC_ERR_NONE)
248 return err;
249
250 return MMC_ERR_NONE;
251}
252
253int mmc_send_status(struct mmc_card *card, u32 *status)
254{
255 int err;
256 struct mmc_command cmd;
257
258 BUG_ON(!card);
259 BUG_ON(!card->host);
260
261 memset(&cmd, 0, sizeof(struct mmc_command));
262
263 cmd.opcode = MMC_SEND_STATUS;
264 cmd.arg = card->rca << 16;
265 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
266
267 err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES);
268 if (err != MMC_ERR_NONE)
269 return err;
270
271 if (status)
272 *status = cmd.resp[0];
273
274 return MMC_ERR_NONE;
275}
276
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
new file mode 100644
index 000000000000..7a481e8ca5ea
--- /dev/null
+++ b/drivers/mmc/core/mmc_ops.h
@@ -0,0 +1,27 @@
1/*
2 * linux/drivers/mmc/mmc_ops.h
3 *
4 * Copyright 2006-2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef _MMC_MMC_OPS_H
13#define _MMC_MMC_OPS_H
14
15int mmc_select_card(struct mmc_card *card);
16int mmc_deselect_cards(struct mmc_host *host);
17int mmc_go_idle(struct mmc_host *host);
18int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
19int mmc_all_send_cid(struct mmc_host *host, u32 *cid);
20int mmc_set_relative_addr(struct mmc_card *card);
21int mmc_send_csd(struct mmc_card *card, u32 *csd);
22int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
23int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value);
24int mmc_send_status(struct mmc_card *card, u32 *status);
25
26#endif
27
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
new file mode 100644
index 000000000000..c1dfd03d559a
--- /dev/null
+++ b/drivers/mmc/core/sd.c
@@ -0,0 +1,587 @@
1/*
2 * linux/drivers/mmc/sd.c
3 *
4 * Copyright (C) 2003-2004 Russell King, All Rights Reserved.
5 * SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
6 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/err.h>
14
15#include <linux/mmc/host.h>
16#include <linux/mmc/card.h>
17#include <linux/mmc/mmc.h>
18
19#include "core.h"
20#include "sysfs.h"
21#include "mmc_ops.h"
22#include "sd_ops.h"
23
24#include "core.h"
25
26static const unsigned int tran_exp[] = {
27 10000, 100000, 1000000, 10000000,
28 0, 0, 0, 0
29};
30
31static const unsigned char tran_mant[] = {
32 0, 10, 12, 13, 15, 20, 25, 30,
33 35, 40, 45, 50, 55, 60, 70, 80,
34};
35
36static const unsigned int tacc_exp[] = {
37 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
38};
39
40static const unsigned int tacc_mant[] = {
41 0, 10, 12, 13, 15, 20, 25, 30,
42 35, 40, 45, 50, 55, 60, 70, 80,
43};
44
45#define UNSTUFF_BITS(resp,start,size) \
46 ({ \
47 const int __size = size; \
48 const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
49 const int __off = 3 - ((start) / 32); \
50 const int __shft = (start) & 31; \
51 u32 __res; \
52 \
53 __res = resp[__off] >> __shft; \
54 if (__size + __shft > 32) \
55 __res |= resp[__off-1] << ((32 - __shft) % 32); \
56 __res & __mask; \
57 })
58
59/*
60 * Given the decoded CSD structure, decode the raw CID to our CID structure.
61 */
62static void mmc_decode_cid(struct mmc_card *card)
63{
64 u32 *resp = card->raw_cid;
65
66 memset(&card->cid, 0, sizeof(struct mmc_cid));
67
68 /*
69 * SD doesn't currently have a version field so we will
70 * have to assume we can parse this.
71 */
72 card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
73 card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
74 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
75 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
76 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
77 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
78 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
79 card->cid.hwrev = UNSTUFF_BITS(resp, 60, 4);
80 card->cid.fwrev = UNSTUFF_BITS(resp, 56, 4);
81 card->cid.serial = UNSTUFF_BITS(resp, 24, 32);
82 card->cid.year = UNSTUFF_BITS(resp, 12, 8);
83 card->cid.month = UNSTUFF_BITS(resp, 8, 4);
84
85 card->cid.year += 2000; /* SD cards year offset */
86}
87
88/*
89 * Given a 128-bit response, decode to our card CSD structure.
90 */
91static int mmc_decode_csd(struct mmc_card *card)
92{
93 struct mmc_csd *csd = &card->csd;
94 unsigned int e, m, csd_struct;
95 u32 *resp = card->raw_csd;
96
97 csd_struct = UNSTUFF_BITS(resp, 126, 2);
98
99 switch (csd_struct) {
100 case 0:
101 m = UNSTUFF_BITS(resp, 115, 4);
102 e = UNSTUFF_BITS(resp, 112, 3);
103 csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10;
104 csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100;
105
106 m = UNSTUFF_BITS(resp, 99, 4);
107 e = UNSTUFF_BITS(resp, 96, 3);
108 csd->max_dtr = tran_exp[e] * tran_mant[m];
109 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
110
111 e = UNSTUFF_BITS(resp, 47, 3);
112 m = UNSTUFF_BITS(resp, 62, 12);
113 csd->capacity = (1 + m) << (e + 2);
114
115 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
116 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
117 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
118 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
119 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
120 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
121 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
122 break;
123 case 1:
124 /*
125 * This is a block-addressed SDHC card. Most
126 * interesting fields are unused and have fixed
127 * values. To avoid getting tripped by buggy cards,
128 * we assume those fixed values ourselves.
129 */
130 mmc_card_set_blockaddr(card);
131
132 csd->tacc_ns = 0; /* Unused */
133 csd->tacc_clks = 0; /* Unused */
134
135 m = UNSTUFF_BITS(resp, 99, 4);
136 e = UNSTUFF_BITS(resp, 96, 3);
137 csd->max_dtr = tran_exp[e] * tran_mant[m];
138 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
139
140 m = UNSTUFF_BITS(resp, 48, 22);
141 csd->capacity = (1 + m) << 10;
142
143 csd->read_blkbits = 9;
144 csd->read_partial = 0;
145 csd->write_misalign = 0;
146 csd->read_misalign = 0;
147 csd->r2w_factor = 4; /* Unused */
148 csd->write_blkbits = 9;
149 csd->write_partial = 0;
150 break;
151 default:
152 printk("%s: unrecognised CSD structure version %d\n",
153 mmc_hostname(card->host), csd_struct);
154 return -EINVAL;
155 }
156
157 return 0;
158}
159
160/*
161 * Given a 64-bit response, decode to our card SCR structure.
162 */
163static int mmc_decode_scr(struct mmc_card *card)
164{
165 struct sd_scr *scr = &card->scr;
166 unsigned int scr_struct;
167 u32 resp[4];
168
169 BUG_ON(!mmc_card_sd(card));
170
171 resp[3] = card->raw_scr[1];
172 resp[2] = card->raw_scr[0];
173
174 scr_struct = UNSTUFF_BITS(resp, 60, 4);
175 if (scr_struct != 0) {
176 printk("%s: unrecognised SCR structure version %d\n",
177 mmc_hostname(card->host), scr_struct);
178 return -EINVAL;
179 }
180
181 scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4);
182 scr->bus_widths = UNSTUFF_BITS(resp, 48, 4);
183
184 return 0;
185}
186
187/*
188 * Fetches and decodes switch information
189 */
190static int mmc_read_switch(struct mmc_card *card)
191{
192 int err;
193 u8 *status;
194
195 err = MMC_ERR_FAILED;
196
197 status = kmalloc(64, GFP_KERNEL);
198 if (!status) {
199 printk("%s: could not allocate a buffer for switch "
200 "capabilities.\n",
201 mmc_hostname(card->host));
202 return err;
203 }
204
205 err = mmc_sd_switch(card, 0, 0, 1, status);
206 if (err != MMC_ERR_NONE) {
207 /*
208 * Card not supporting high-speed will ignore the
209 * command.
210 */
211 err = MMC_ERR_NONE;
212 goto out;
213 }
214
215 if (status[13] & 0x02)
216 card->sw_caps.hs_max_dtr = 50000000;
217
218out:
219 kfree(status);
220
221 return err;
222}
223
224/*
225 * Test if the card supports high-speed mode and, if so, switch to it.
226 */
227static int mmc_switch_hs(struct mmc_card *card)
228{
229 int err;
230 u8 *status;
231
232 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
233 return MMC_ERR_NONE;
234
235 if (card->sw_caps.hs_max_dtr == 0)
236 return MMC_ERR_NONE;
237
238 err = MMC_ERR_FAILED;
239
240 status = kmalloc(64, GFP_KERNEL);
241 if (!status) {
242 printk("%s: could not allocate a buffer for switch "
243 "capabilities.\n",
244 mmc_hostname(card->host));
245 return err;
246 }
247
248 err = mmc_sd_switch(card, 1, 0, 1, status);
249 if (err != MMC_ERR_NONE)
250 goto out;
251
252 if ((status[16] & 0xF) != 1) {
253 printk(KERN_WARNING "%s: Problem switching card "
254 "into high-speed mode!\n",
255 mmc_hostname(card->host));
256 } else {
257 mmc_card_set_highspeed(card);
258 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
259 }
260
261out:
262 kfree(status);
263
264 return err;
265}
266
267/*
268 * Handle the detection and initialisation of a card.
269 *
270 * In the case of a resume, "curcard" will contain the card
271 * we're trying to reinitialise.
272 */
273static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
274 struct mmc_card *oldcard)
275{
276 struct mmc_card *card;
277 int err;
278 u32 cid[4];
279 unsigned int max_dtr;
280
281 BUG_ON(!host);
282 BUG_ON(!host->claimed);
283
284 /*
285 * Since we're changing the OCR value, we seem to
286 * need to tell some cards to go back to the idle
287 * state. We wait 1ms to give cards time to
288 * respond.
289 */
290 mmc_go_idle(host);
291
292 /*
293 * If SD_SEND_IF_COND indicates an SD 2.0
294 * compliant card and we should set bit 30
295 * of the ocr to indicate that we can handle
296 * block-addressed SDHC cards.
297 */
298 err = mmc_send_if_cond(host, ocr);
299 if (err == MMC_ERR_NONE)
300 ocr |= 1 << 30;
301
302 err = mmc_send_app_op_cond(host, ocr, NULL);
303 if (err != MMC_ERR_NONE)
304 goto err;
305
306 /*
307 * Fetch CID from card.
308 */
309 err = mmc_all_send_cid(host, cid);
310 if (err != MMC_ERR_NONE)
311 goto err;
312
313 if (oldcard) {
314 if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0)
315 goto err;
316
317 card = oldcard;
318 } else {
319 /*
320 * Allocate card structure.
321 */
322 card = mmc_alloc_card(host);
323 if (IS_ERR(card))
324 goto err;
325
326 card->type = MMC_TYPE_SD;
327 memcpy(card->raw_cid, cid, sizeof(card->raw_cid));
328 }
329
330 /*
331 * Set card RCA.
332 */
333 err = mmc_send_relative_addr(host, &card->rca);
334 if (err != MMC_ERR_NONE)
335 goto free_card;
336
337 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
338
339 if (!oldcard) {
340 /*
341 * Fetch CSD from card.
342 */
343 err = mmc_send_csd(card, card->raw_csd);
344 if (err != MMC_ERR_NONE)
345 goto free_card;
346
347 err = mmc_decode_csd(card);
348 if (err < 0)
349 goto free_card;
350
351 mmc_decode_cid(card);
352 }
353
354 /*
355 * Select card, as all following commands rely on that.
356 */
357 err = mmc_select_card(card);
358 if (err != MMC_ERR_NONE)
359 goto free_card;
360
361 if (!oldcard) {
362 /*
363 * Fetch SCR from card.
364 */
365 err = mmc_app_send_scr(card, card->raw_scr);
366 if (err != MMC_ERR_NONE)
367 goto free_card;
368
369 err = mmc_decode_scr(card);
370 if (err < 0)
371 goto free_card;
372
373 /*
374 * Fetch switch information from card.
375 */
376 err = mmc_read_switch(card);
377 if (err != MMC_ERR_NONE)
378 goto free_card;
379 }
380
381 /*
382 * Attempt to change to high-speed (if supported)
383 */
384 err = mmc_switch_hs(card);
385 if (err != MMC_ERR_NONE)
386 goto free_card;
387
388 /*
389 * Compute bus speed.
390 */
391 max_dtr = (unsigned int)-1;
392
393 if (mmc_card_highspeed(card)) {
394 if (max_dtr > card->sw_caps.hs_max_dtr)
395 max_dtr = card->sw_caps.hs_max_dtr;
396 } else if (max_dtr > card->csd.max_dtr) {
397 max_dtr = card->csd.max_dtr;
398 }
399
400 mmc_set_clock(host, max_dtr);
401
402 /*
403 * Switch to wider bus (if supported).
404 */
405 if ((host->caps && MMC_CAP_4_BIT_DATA) &&
406 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
407 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
408 if (err != MMC_ERR_NONE)
409 goto free_card;
410
411 mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
412 }
413
414 if (!oldcard)
415 host->card = card;
416
417 return MMC_ERR_NONE;
418
419free_card:
420 if (!oldcard)
421 mmc_remove_card(card);
422err:
423
424 return MMC_ERR_FAILED;
425}
426
427/*
428 * Host is being removed. Free up the current card.
429 */
430static void mmc_sd_remove(struct mmc_host *host)
431{
432 BUG_ON(!host);
433 BUG_ON(!host->card);
434
435 mmc_remove_card(host->card);
436 host->card = NULL;
437}
438
439/*
440 * Card detection callback from host.
441 */
442static void mmc_sd_detect(struct mmc_host *host)
443{
444 int err;
445
446 BUG_ON(!host);
447 BUG_ON(!host->card);
448
449 mmc_claim_host(host);
450
451 /*
452 * Just check if our card has been removed.
453 */
454 err = mmc_send_status(host->card, NULL);
455
456 mmc_release_host(host);
457
458 if (err != MMC_ERR_NONE) {
459 mmc_remove_card(host->card);
460 host->card = NULL;
461
462 mmc_claim_host(host);
463 mmc_detach_bus(host);
464 mmc_release_host(host);
465 }
466}
467
468#ifdef CONFIG_MMC_UNSAFE_RESUME
469
470/*
471 * Suspend callback from host.
472 */
473static void mmc_sd_suspend(struct mmc_host *host)
474{
475 BUG_ON(!host);
476 BUG_ON(!host->card);
477
478 mmc_claim_host(host);
479 mmc_deselect_cards(host);
480 host->card->state &= ~MMC_STATE_HIGHSPEED;
481 mmc_release_host(host);
482}
483
484/*
485 * Resume callback from host.
486 *
487 * This function tries to determine if the same card is still present
488 * and, if so, restore all state to it.
489 */
490static void mmc_sd_resume(struct mmc_host *host)
491{
492 int err;
493
494 BUG_ON(!host);
495 BUG_ON(!host->card);
496
497 mmc_claim_host(host);
498
499 err = mmc_sd_init_card(host, host->ocr, host->card);
500 if (err != MMC_ERR_NONE) {
501 mmc_remove_card(host->card);
502 host->card = NULL;
503
504 mmc_detach_bus(host);
505 }
506
507 mmc_release_host(host);
508}
509
510#else
511
512#define mmc_sd_suspend NULL
513#define mmc_sd_resume NULL
514
515#endif
516
517static const struct mmc_bus_ops mmc_sd_ops = {
518 .remove = mmc_sd_remove,
519 .detect = mmc_sd_detect,
520 .suspend = mmc_sd_suspend,
521 .resume = mmc_sd_resume,
522};
523
524/*
525 * Starting point for SD card init.
526 */
527int mmc_attach_sd(struct mmc_host *host, u32 ocr)
528{
529 int err;
530
531 BUG_ON(!host);
532 BUG_ON(!host->claimed);
533
534 mmc_attach_bus(host, &mmc_sd_ops);
535
536 /*
537 * Sanity check the voltages that the card claims to
538 * support.
539 */
540 if (ocr & 0x7F) {
541 printk(KERN_WARNING "%s: card claims to support voltages "
542 "below the defined range. These will be ignored.\n",
543 mmc_hostname(host));
544 ocr &= ~0x7F;
545 }
546
547 if (ocr & MMC_VDD_165_195) {
548 printk(KERN_WARNING "%s: SD card claims to support the "
549 "incompletely defined 'low voltage range'. This "
550 "will be ignored.\n", mmc_hostname(host));
551 ocr &= ~MMC_VDD_165_195;
552 }
553
554 host->ocr = mmc_select_voltage(host, ocr);
555
556 /*
557 * Can we support the voltage(s) of the card(s)?
558 */
559 if (!host->ocr)
560 goto err;
561
562 /*
563 * Detect and init the card.
564 */
565 err = mmc_sd_init_card(host, host->ocr, NULL);
566 if (err != MMC_ERR_NONE)
567 goto err;
568
569 mmc_release_host(host);
570
571 err = mmc_register_card(host->card);
572 if (err)
573 goto reclaim_host;
574
575 return 0;
576
577reclaim_host:
578 mmc_claim_host(host);
579 mmc_remove_card(host->card);
580 host->card = NULL;
581err:
582 mmc_detach_bus(host);
583 mmc_release_host(host);
584
585 return 0;
586}
587
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
new file mode 100644
index 000000000000..9697ce581101
--- /dev/null
+++ b/drivers/mmc/core/sd_ops.c
@@ -0,0 +1,316 @@
1/*
2 * linux/drivers/mmc/sd_ops.h
3 *
4 * Copyright 2006-2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h>
15
16#include <linux/mmc/host.h>
17#include <linux/mmc/card.h>
18#include <linux/mmc/mmc.h>
19#include <linux/mmc/sd.h>
20
21#include "core.h"
22#include "sd_ops.h"
23
24/**
25 * mmc_wait_for_app_cmd - start an application command and wait for
26 completion
27 * @host: MMC host to start command
28 * @rca: RCA to send MMC_APP_CMD to
29 * @cmd: MMC command to start
30 * @retries: maximum number of retries
31 *
32 * Sends a MMC_APP_CMD, checks the card response, sends the command
33 * in the parameter and waits for it to complete. Return any error
34 * that occurred while the command was executing. Do not attempt to
35 * parse the response.
36 */
37int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
38 struct mmc_command *cmd, int retries)
39{
40 struct mmc_request mrq;
41
42 int i, err;
43
44 BUG_ON(!cmd);
45 BUG_ON(retries < 0);
46
47 err = MMC_ERR_INVALID;
48
49 /*
50 * We have to resend MMC_APP_CMD for each attempt so
51 * we cannot use the retries field in mmc_command.
52 */
53 for (i = 0;i <= retries;i++) {
54 memset(&mrq, 0, sizeof(struct mmc_request));
55
56 err = mmc_app_cmd(host, card);
57 if (err != MMC_ERR_NONE)
58 continue;
59
60 memset(&mrq, 0, sizeof(struct mmc_request));
61
62 memset(cmd->resp, 0, sizeof(cmd->resp));
63 cmd->retries = 0;
64
65 mrq.cmd = cmd;
66 cmd->data = NULL;
67
68 mmc_wait_for_req(host, &mrq);
69
70 err = cmd->error;
71 if (cmd->error == MMC_ERR_NONE)
72 break;
73 }
74
75 return err;
76}
77
78EXPORT_SYMBOL(mmc_wait_for_app_cmd);
79
80int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
81{
82 int err;
83 struct mmc_command cmd;
84
85 BUG_ON(!host);
86 BUG_ON(card && (card->host != host));
87
88 cmd.opcode = MMC_APP_CMD;
89
90 if (card) {
91 cmd.arg = card->rca << 16;
92 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
93 } else {
94 cmd.arg = 0;
95 cmd.flags = MMC_RSP_R1 | MMC_CMD_BCR;
96 }
97
98 err = mmc_wait_for_cmd(host, &cmd, 0);
99 if (err != MMC_ERR_NONE)
100 return err;
101
102 /* Check that card supported application commands */
103 if (!(cmd.resp[0] & R1_APP_CMD))
104 return MMC_ERR_FAILED;
105
106 return MMC_ERR_NONE;
107}
108
109int mmc_app_set_bus_width(struct mmc_card *card, int width)
110{
111 int err;
112 struct mmc_command cmd;
113
114 BUG_ON(!card);
115 BUG_ON(!card->host);
116
117 memset(&cmd, 0, sizeof(struct mmc_command));
118
119 cmd.opcode = SD_APP_SET_BUS_WIDTH;
120 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
121
122 switch (width) {
123 case MMC_BUS_WIDTH_1:
124 cmd.arg = SD_BUS_WIDTH_1;
125 break;
126 case MMC_BUS_WIDTH_4:
127 cmd.arg = SD_BUS_WIDTH_4;
128 break;
129 default:
130 return MMC_ERR_INVALID;
131 }
132
133 err = mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES);
134 if (err != MMC_ERR_NONE)
135 return err;
136
137 return MMC_ERR_NONE;
138}
139
140int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
141{
142 struct mmc_command cmd;
143 int i, err = 0;
144
145 BUG_ON(!host);
146
147 memset(&cmd, 0, sizeof(struct mmc_command));
148
149 cmd.opcode = SD_APP_OP_COND;
150 cmd.arg = ocr;
151 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
152
153 for (i = 100; i; i--) {
154 err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES);
155 if (err != MMC_ERR_NONE)
156 break;
157
158 if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
159 break;
160
161 err = MMC_ERR_TIMEOUT;
162
163 mmc_delay(10);
164 }
165
166 if (rocr)
167 *rocr = cmd.resp[0];
168
169 return err;
170}
171
172int mmc_send_if_cond(struct mmc_host *host, u32 ocr)
173{
174 struct mmc_command cmd;
175 int err;
176 static const u8 test_pattern = 0xAA;
177
178 /*
179 * To support SD 2.0 cards, we must always invoke SD_SEND_IF_COND
180 * before SD_APP_OP_COND. This command will harmlessly fail for
181 * SD 1.0 cards.
182 */
183 cmd.opcode = SD_SEND_IF_COND;
184 cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | test_pattern;
185 cmd.flags = MMC_RSP_R7 | MMC_CMD_BCR;
186
187 err = mmc_wait_for_cmd(host, &cmd, 0);
188 if (err != MMC_ERR_NONE)
189 return err;
190
191 if ((cmd.resp[0] & 0xFF) != test_pattern)
192 return MMC_ERR_FAILED;
193
194 return MMC_ERR_NONE;
195}
196
197int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
198{
199 int err;
200 struct mmc_command cmd;
201
202 BUG_ON(!host);
203 BUG_ON(!rca);
204
205 memset(&cmd, 0, sizeof(struct mmc_command));
206
207 cmd.opcode = SD_SEND_RELATIVE_ADDR;
208 cmd.arg = 0;
209 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
210
211 err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
212 if (err != MMC_ERR_NONE)
213 return err;
214
215 *rca = cmd.resp[0] >> 16;
216
217 return MMC_ERR_NONE;
218}
219
220int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
221{
222 int err;
223 struct mmc_request mrq;
224 struct mmc_command cmd;
225 struct mmc_data data;
226 struct scatterlist sg;
227
228 BUG_ON(!card);
229 BUG_ON(!card->host);
230 BUG_ON(!scr);
231
232 err = mmc_app_cmd(card->host, card);
233 if (err != MMC_ERR_NONE)
234 return err;
235
236 memset(&mrq, 0, sizeof(struct mmc_request));
237 memset(&cmd, 0, sizeof(struct mmc_command));
238 memset(&data, 0, sizeof(struct mmc_data));
239
240 mrq.cmd = &cmd;
241 mrq.data = &data;
242
243 cmd.opcode = SD_APP_SEND_SCR;
244 cmd.arg = 0;
245 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
246
247 data.blksz = 8;
248 data.blocks = 1;
249 data.flags = MMC_DATA_READ;
250 data.sg = &sg;
251 data.sg_len = 1;
252
253 sg_init_one(&sg, scr, 8);
254
255 mmc_set_data_timeout(&data, card, 0);
256
257 mmc_wait_for_req(card->host, &mrq);
258
259 if (cmd.error != MMC_ERR_NONE)
260 return cmd.error;
261 if (data.error != MMC_ERR_NONE)
262 return data.error;
263
264 scr[0] = ntohl(scr[0]);
265 scr[1] = ntohl(scr[1]);
266
267 return MMC_ERR_NONE;
268}
269
270int mmc_sd_switch(struct mmc_card *card, int mode, int group,
271 u8 value, u8 *resp)
272{
273 struct mmc_request mrq;
274 struct mmc_command cmd;
275 struct mmc_data data;
276 struct scatterlist sg;
277
278 BUG_ON(!card);
279 BUG_ON(!card->host);
280
281 mode = !!mode;
282 value &= 0xF;
283
284 memset(&mrq, 0, sizeof(struct mmc_request));
285 memset(&cmd, 0, sizeof(struct mmc_command));
286 memset(&data, 0, sizeof(struct mmc_data));
287
288 mrq.cmd = &cmd;
289 mrq.data = &data;
290
291 cmd.opcode = SD_SWITCH;
292 cmd.arg = mode << 31 | 0x00FFFFFF;
293 cmd.arg &= ~(0xF << (group * 4));
294 cmd.arg |= value << (group * 4);
295 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
296
297 data.blksz = 64;
298 data.blocks = 1;
299 data.flags = MMC_DATA_READ;
300 data.sg = &sg;
301 data.sg_len = 1;
302
303 sg_init_one(&sg, resp, 64);
304
305 mmc_set_data_timeout(&data, card, 0);
306
307 mmc_wait_for_req(card->host, &mrq);
308
309 if (cmd.error != MMC_ERR_NONE)
310 return cmd.error;
311 if (data.error != MMC_ERR_NONE)
312 return data.error;
313
314 return MMC_ERR_NONE;
315}
316
diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h
new file mode 100644
index 000000000000..1240fddba5e3
--- /dev/null
+++ b/drivers/mmc/core/sd_ops.h
@@ -0,0 +1,25 @@
1/*
2 * linux/drivers/mmc/sd_ops.h
3 *
4 * Copyright 2006-2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef _MMC_SD_OPS_H
13#define _MMC_SD_OPS_H
14
15int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
16int mmc_app_set_bus_width(struct mmc_card *card, int width);
17int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
18int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
19int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
20int mmc_app_send_scr(struct mmc_card *card, u32 *scr);
21int mmc_sd_switch(struct mmc_card *card, int mode, int group,
22 u8 value, u8 *resp);
23
24#endif
25
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/core/sysfs.c
index e0e82d849d5f..843b1fbba557 100644
--- a/drivers/mmc/mmc_sysfs.c
+++ b/drivers/mmc/core/sysfs.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/mmc/mmc_sysfs.c 2 * linux/drivers/mmc/core/sysfs.c
3 * 3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved. 4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * 5 *
@@ -18,7 +18,7 @@
18#include <linux/mmc/card.h> 18#include <linux/mmc/card.h>
19#include <linux/mmc/host.h> 19#include <linux/mmc/host.h>
20 20
21#include "mmc.h" 21#include "sysfs.h"
22 22
23#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev) 23#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev)
24#define to_mmc_driver(d) container_of(d, struct mmc_driver, drv) 24#define to_mmc_driver(d) container_of(d, struct mmc_driver, drv)
@@ -72,12 +72,11 @@ static void mmc_release_card(struct device *dev)
72/* 72/*
73 * This currently matches any MMC driver to any MMC card - drivers 73 * This currently matches any MMC driver to any MMC card - drivers
74 * themselves make the decision whether to drive this card in their 74 * themselves make the decision whether to drive this card in their
75 * probe method. However, we force "bad" cards to fail. 75 * probe method.
76 */ 76 */
77static int mmc_bus_match(struct device *dev, struct device_driver *drv) 77static int mmc_bus_match(struct device *dev, struct device_driver *drv)
78{ 78{
79 struct mmc_card *card = dev_to_mmc_card(dev); 79 return 1;
80 return !mmc_card_bad(card);
81} 80}
82 81
83static int 82static int
@@ -217,6 +216,8 @@ int mmc_register_card(struct mmc_card *card)
217 device_del(&card->dev); 216 device_del(&card->dev);
218 } 217 }
219 } 218 }
219 if (ret == 0)
220 mmc_card_set_present(card);
220 return ret; 221 return ret;
221} 222}
222 223
diff --git a/drivers/mmc/mmc.h b/drivers/mmc/core/sysfs.h
index 149affe0b686..80e29b358282 100644
--- a/drivers/mmc/mmc.h
+++ b/drivers/mmc/core/sysfs.h
@@ -1,15 +1,16 @@
1/* 1/*
2 * linux/drivers/mmc/mmc.h 2 * linux/drivers/mmc/core/sysfs.h
3 * 3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved. 4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright 2007 Pierre Ossman
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
9 */ 10 */
10#ifndef _MMC_H 11#ifndef _MMC_CORE_SYSFS_H
11#define _MMC_H 12#define _MMC_CORE_SYSFS_H
12/* core-internal functions */ 13
13void mmc_init_card(struct mmc_card *card, struct mmc_host *host); 14void mmc_init_card(struct mmc_card *card, struct mmc_host *host);
14int mmc_register_card(struct mmc_card *card); 15int mmc_register_card(struct mmc_card *card);
15void mmc_remove_card(struct mmc_card *card); 16void mmc_remove_card(struct mmc_card *card);
@@ -22,4 +23,5 @@ void mmc_free_host_sysfs(struct mmc_host *host);
22int mmc_schedule_work(struct work_struct *work); 23int mmc_schedule_work(struct work_struct *work);
23int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay); 24int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay);
24void mmc_flush_scheduled_work(void); 25void mmc_flush_scheduled_work(void);
26
25#endif 27#endif
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
new file mode 100644
index 000000000000..ed4deab2203d
--- /dev/null
+++ b/drivers/mmc/host/Kconfig
@@ -0,0 +1,103 @@
1#
2# MMC/SD host controller drivers
3#
4
5comment "MMC/SD Host Controller Drivers"
6 depends on MMC
7
8config MMC_ARMMMCI
9 tristate "ARM AMBA Multimedia Card Interface support"
10 depends on ARM_AMBA && MMC
11 help
12 This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
13 Interface (PL180 and PL181) support. If you have an ARM(R)
14 platform with a Multimedia Card slot, say Y or M here.
15
16 If unsure, say N.
17
18config MMC_PXA
19 tristate "Intel PXA25x/26x/27x Multimedia Card Interface support"
20 depends on ARCH_PXA && MMC
21 help
22 This selects the Intel(R) PXA(R) Multimedia card Interface.
23 If you have a PXA(R) platform with a Multimedia Card slot,
24 say Y or M here.
25
26 If unsure, say N.
27
28config MMC_SDHCI
29 tristate "Secure Digital Host Controller Interface support (EXPERIMENTAL)"
30 depends on PCI && MMC && EXPERIMENTAL
31 help
32 This select the generic Secure Digital Host Controller Interface.
33 It is used by manufacturers such as Texas Instruments(R), Ricoh(R)
34 and Toshiba(R). Most controllers found in laptops are of this type.
35 If you have a controller with this interface, say Y or M here.
36
37 If unsure, say N.
38
39config MMC_OMAP
40 tristate "TI OMAP Multimedia Card Interface support"
41 depends on ARCH_OMAP && MMC
42 select TPS65010 if MACH_OMAP_H2
43 help
44 This selects the TI OMAP Multimedia card Interface.
45 If you have an OMAP board with a Multimedia Card slot,
46 say Y or M here.
47
48 If unsure, say N.
49
50config MMC_WBSD
51 tristate "Winbond W83L51xD SD/MMC Card Interface support"
52 depends on MMC && ISA_DMA_API
53 help
54 This selects the Winbond(R) W83L51xD Secure digital and
55 Multimedia card Interface.
56 If you have a machine with a integrated W83L518D or W83L519D
57 SD/MMC card reader, say Y or M here.
58
59 If unsure, say N.
60
61config MMC_AU1X
62 tristate "Alchemy AU1XX0 MMC Card Interface support"
63 depends on MMC && SOC_AU1200
64 help
65 This selects the AMD Alchemy(R) Multimedia card interface.
66 If you have a Alchemy platform with a MMC slot, say Y or M here.
67
68 If unsure, say N.
69
70config MMC_AT91
71 tristate "AT91 SD/MMC Card Interface support"
72 depends on ARCH_AT91 && MMC
73 help
74 This selects the AT91 MCI controller.
75
76 If unsure, say N.
77
78config MMC_IMX
79 tristate "Motorola i.MX Multimedia Card Interface support"
80 depends on ARCH_IMX && MMC
81 help
82 This selects the Motorola i.MX Multimedia card Interface.
83 If you have a i.MX platform with a Multimedia Card slot,
84 say Y or M here.
85
86 If unsure, say N.
87
88config MMC_TIFM_SD
89 tristate "TI Flash Media MMC/SD Interface support (EXPERIMENTAL)"
90 depends on MMC && EXPERIMENTAL && PCI
91 select TIFM_CORE
92 help
93 Say Y here if you want to be able to access MMC/SD cards with
94 the Texas Instruments(R) Flash Media card reader, found in many
95 laptops.
96 This option 'selects' (turns on, enables) 'TIFM_CORE', but you
97 probably also need appropriate card reader host adapter, such as
98 'Misc devices: TI Flash Media PCI74xx/PCI76xx host adapter support
99 (TIFM_7XX1)'.
100
101 To compile this driver as a module, choose M here: the
102 module will be called tifm_sd.
103
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
new file mode 100644
index 000000000000..6685f64345b4
--- /dev/null
+++ b/drivers/mmc/host/Makefile
@@ -0,0 +1,18 @@
1#
2# Makefile for MMC/SD host controller drivers
3#
4
5ifeq ($(CONFIG_MMC_DEBUG),y)
6 EXTRA_CFLAGS += -DDEBUG
7endif
8
9obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
10obj-$(CONFIG_MMC_PXA) += pxamci.o
11obj-$(CONFIG_MMC_IMX) += imxmmc.o
12obj-$(CONFIG_MMC_SDHCI) += sdhci.o
13obj-$(CONFIG_MMC_WBSD) += wbsd.o
14obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
15obj-$(CONFIG_MMC_OMAP) += omap.o
16obj-$(CONFIG_MMC_AT91) += at91_mci.o
17obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
18
diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 459f4b4feded..e37943c314cb 100644
--- a/drivers/mmc/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -67,7 +67,6 @@
67#include <linux/atmel_pdc.h> 67#include <linux/atmel_pdc.h>
68 68
69#include <linux/mmc/host.h> 69#include <linux/mmc/host.h>
70#include <linux/mmc/protocol.h>
71 70
72#include <asm/io.h> 71#include <asm/io.h>
73#include <asm/irq.h> 72#include <asm/irq.h>
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index b834be261ab7..b7156a4555b5 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -42,7 +42,6 @@
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43 43
44#include <linux/mmc/host.h> 44#include <linux/mmc/host.h>
45#include <linux/mmc/protocol.h>
46#include <asm/io.h> 45#include <asm/io.h>
47#include <asm/mach-au1x00/au1000.h> 46#include <asm/mach-au1x00/au1000.h>
48#include <asm/mach-au1x00/au1xxx_dbdma.h> 47#include <asm/mach-au1x00/au1xxx_dbdma.h>
diff --git a/drivers/mmc/au1xmmc.h b/drivers/mmc/host/au1xmmc.h
index 341cbdf0baca..341cbdf0baca 100644
--- a/drivers/mmc/au1xmmc.h
+++ b/drivers/mmc/host/au1xmmc.h
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/host/imxmmc.c
index 0de5c9e94e74..7ee2045acbef 100644
--- a/drivers/mmc/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -41,7 +41,6 @@
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/mmc/host.h> 42#include <linux/mmc/host.h>
43#include <linux/mmc/card.h> 43#include <linux/mmc/card.h>
44#include <linux/mmc/protocol.h>
45#include <linux/delay.h> 44#include <linux/delay.h>
46 45
47#include <asm/dma.h> 46#include <asm/dma.h>
diff --git a/drivers/mmc/imxmmc.h b/drivers/mmc/host/imxmmc.h
index e5339e334dbb..e5339e334dbb 100644
--- a/drivers/mmc/imxmmc.h
+++ b/drivers/mmc/host/imxmmc.h
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/host/mmci.c
index 5941dd951e82..d11c2d23ceea 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -17,7 +17,6 @@
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/mmc/host.h> 19#include <linux/mmc/host.h>
20#include <linux/mmc/protocol.h>
21#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
22#include <linux/clk.h> 21#include <linux/clk.h>
23 22
diff --git a/drivers/mmc/mmci.h b/drivers/mmc/host/mmci.h
index 6d7eadc9a678..6d7eadc9a678 100644
--- a/drivers/mmc/mmci.h
+++ b/drivers/mmc/host/mmci.h
diff --git a/drivers/mmc/omap.c b/drivers/mmc/host/omap.c
index 1e96a2f65022..1914e65d4db1 100644
--- a/drivers/mmc/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -22,7 +22,6 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/timer.h> 23#include <linux/timer.h>
24#include <linux/mmc/host.h> 24#include <linux/mmc/host.h>
25#include <linux/mmc/protocol.h>
26#include <linux/mmc/card.h> 25#include <linux/mmc/card.h>
27#include <linux/clk.h> 26#include <linux/clk.h>
28 27
@@ -605,7 +604,7 @@ static void mmc_omap_switch_handler(struct work_struct *work)
605 } 604 }
606 if (mmc_omap_cover_is_open(host)) { 605 if (mmc_omap_cover_is_open(host)) {
607 if (!complained) { 606 if (!complained) {
608 dev_info(mmc_dev(host->mmc), "cover is open"); 607 dev_info(mmc_dev(host->mmc), "cover is open\n");
609 complained = 1; 608 complained = 1;
610 } 609 }
611 if (mmc_omap_enable_poll) 610 if (mmc_omap_enable_poll)
@@ -937,48 +936,55 @@ static void mmc_omap_power(struct mmc_omap_host *host, int on)
937 } 936 }
938} 937}
939 938
940static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 939static int mmc_omap_calc_divisor(struct mmc_host *mmc, struct mmc_ios *ios)
941{ 940{
942 struct mmc_omap_host *host = mmc_priv(mmc); 941 struct mmc_omap_host *host = mmc_priv(mmc);
942 int func_clk_rate = clk_get_rate(host->fclk);
943 int dsor; 943 int dsor;
944 int realclock, i;
945
946 realclock = ios->clock;
947 944
948 if (ios->clock == 0) 945 if (ios->clock == 0)
949 dsor = 0; 946 return 0;
950 else {
951 int func_clk_rate = clk_get_rate(host->fclk);
952
953 dsor = func_clk_rate / realclock;
954 if (dsor < 1)
955 dsor = 1;
956 947
957 if (func_clk_rate / dsor > realclock) 948 dsor = func_clk_rate / ios->clock;
958 dsor++; 949 if (dsor < 1)
950 dsor = 1;
959 951
960 if (dsor > 250) 952 if (func_clk_rate / dsor > ios->clock)
961 dsor = 250;
962 dsor++; 953 dsor++;
963 954
964 if (ios->bus_width == MMC_BUS_WIDTH_4) 955 if (dsor > 250)
965 dsor |= 1 << 15; 956 dsor = 250;
966 } 957 dsor++;
958
959 if (ios->bus_width == MMC_BUS_WIDTH_4)
960 dsor |= 1 << 15;
961
962 return dsor;
963}
964
965static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
966{
967 struct mmc_omap_host *host = mmc_priv(mmc);
968 int dsor;
969 int i;
970
971 dsor = mmc_omap_calc_divisor(mmc, ios);
972 host->bus_mode = ios->bus_mode;
973 host->hw_bus_mode = host->bus_mode;
967 974
968 switch (ios->power_mode) { 975 switch (ios->power_mode) {
969 case MMC_POWER_OFF: 976 case MMC_POWER_OFF:
970 mmc_omap_power(host, 0); 977 mmc_omap_power(host, 0);
971 break; 978 break;
972 case MMC_POWER_UP: 979 case MMC_POWER_UP:
973 case MMC_POWER_ON: 980 /* Cannot touch dsor yet, just power up MMC */
974 mmc_omap_power(host, 1); 981 mmc_omap_power(host, 1);
982 return;
983 case MMC_POWER_ON:
975 dsor |= 1 << 11; 984 dsor |= 1 << 11;
976 break; 985 break;
977 } 986 }
978 987
979 host->bus_mode = ios->bus_mode;
980 host->hw_bus_mode = host->bus_mode;
981
982 clk_enable(host->fclk); 988 clk_enable(host->fclk);
983 989
984 /* On insanely high arm_per frequencies something sometimes 990 /* On insanely high arm_per frequencies something sometimes
@@ -987,7 +993,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
987 * Writing to the CON register twice seems to do the trick. */ 993 * Writing to the CON register twice seems to do the trick. */
988 for (i = 0; i < 2; i++) 994 for (i = 0; i < 2; i++)
989 OMAP_MMC_WRITE(host, CON, dsor); 995 OMAP_MMC_WRITE(host, CON, dsor);
990 if (ios->power_mode == MMC_POWER_UP) { 996 if (ios->power_mode == MMC_POWER_ON) {
991 /* Send clock cycles, poll completion */ 997 /* Send clock cycles, poll completion */
992 OMAP_MMC_WRITE(host, IE, 0); 998 OMAP_MMC_WRITE(host, IE, 0);
993 OMAP_MMC_WRITE(host, STAT, 0xffff); 999 OMAP_MMC_WRITE(host, STAT, 0xffff);
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/host/pxamci.c
index 9774fc68b61a..d97d3864b57f 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -24,7 +24,6 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/mmc/host.h> 26#include <linux/mmc/host.h>
27#include <linux/mmc/protocol.h>
28 27
29#include <asm/dma.h> 28#include <asm/dma.h>
30#include <asm/io.h> 29#include <asm/io.h>
@@ -369,14 +368,14 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
369 if (CLOCKRATE / clk > ios->clock) 368 if (CLOCKRATE / clk > ios->clock)
370 clk <<= 1; 369 clk <<= 1;
371 host->clkrt = fls(clk) - 1; 370 host->clkrt = fls(clk) - 1;
372 pxa_set_cken(CKEN12_MMC, 1); 371 pxa_set_cken(CKEN_MMC, 1);
373 372
374 /* 373 /*
375 * we write clkrt on the next command 374 * we write clkrt on the next command
376 */ 375 */
377 } else { 376 } else {
378 pxamci_stop_clock(host); 377 pxamci_stop_clock(host);
379 pxa_set_cken(CKEN12_MMC, 0); 378 pxa_set_cken(CKEN_MMC, 0);
380 } 379 }
381 380
382 if (host->power_mode != ios->power_mode) { 381 if (host->power_mode != ios->power_mode) {
diff --git a/drivers/mmc/pxamci.h b/drivers/mmc/host/pxamci.h
index 1b163220df2b..1b163220df2b 100644
--- a/drivers/mmc/pxamci.h
+++ b/drivers/mmc/host/pxamci.h
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/host/sdhci.c
index d749f08601b8..ff5bf73cdd25 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/mmc/sdhci.c - Secure Digital Host Controller Interface driver 2 * linux/drivers/mmc/sdhci.c - Secure Digital Host Controller Interface driver
3 * 3 *
4 * Copyright (C) 2005-2006 Pierre Ossman, All Rights Reserved. 4 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -15,7 +15,6 @@
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16 16
17#include <linux/mmc/host.h> 17#include <linux/mmc/host.h>
18#include <linux/mmc/protocol.h>
19 18
20#include <asm/scatterlist.h> 19#include <asm/scatterlist.h>
21 20
@@ -247,14 +246,13 @@ static void sdhci_read_block_pio(struct sdhci_host *host)
247 chunk_remain = min(blksize, 4); 246 chunk_remain = min(blksize, 4);
248 } 247 }
249 248
250 size = min(host->size, host->remain); 249 size = min(host->remain, chunk_remain);
251 size = min(size, chunk_remain);
252 250
253 chunk_remain -= size; 251 chunk_remain -= size;
254 blksize -= size; 252 blksize -= size;
255 host->offset += size; 253 host->offset += size;
256 host->remain -= size; 254 host->remain -= size;
257 host->size -= size; 255
258 while (size) { 256 while (size) {
259 *buffer = data & 0xFF; 257 *buffer = data & 0xFF;
260 buffer++; 258 buffer++;
@@ -289,14 +287,13 @@ static void sdhci_write_block_pio(struct sdhci_host *host)
289 buffer = sdhci_sg_to_buffer(host) + host->offset; 287 buffer = sdhci_sg_to_buffer(host) + host->offset;
290 288
291 while (blksize) { 289 while (blksize) {
292 size = min(host->size, host->remain); 290 size = min(host->remain, chunk_remain);
293 size = min(size, chunk_remain);
294 291
295 chunk_remain -= size; 292 chunk_remain -= size;
296 blksize -= size; 293 blksize -= size;
297 host->offset += size; 294 host->offset += size;
298 host->remain -= size; 295 host->remain -= size;
299 host->size -= size; 296
300 while (size) { 297 while (size) {
301 data >>= 8; 298 data >>= 8;
302 data |= (u32)*buffer << 24; 299 data |= (u32)*buffer << 24;
@@ -325,7 +322,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
325 322
326 BUG_ON(!host->data); 323 BUG_ON(!host->data);
327 324
328 if (host->size == 0) 325 if (host->num_sg == 0)
329 return; 326 return;
330 327
331 if (host->data->flags & MMC_DATA_READ) 328 if (host->data->flags & MMC_DATA_READ)
@@ -339,10 +336,8 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
339 else 336 else
340 sdhci_write_block_pio(host); 337 sdhci_write_block_pio(host);
341 338
342 if (host->size == 0) 339 if (host->num_sg == 0)
343 break; 340 break;
344
345 BUG_ON(host->num_sg == 0);
346 } 341 }
347 342
348 DBG("PIO transfer complete.\n"); 343 DBG("PIO transfer complete.\n");
@@ -408,8 +403,6 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
408 403
409 writel(sg_dma_address(data->sg), host->ioaddr + SDHCI_DMA_ADDRESS); 404 writel(sg_dma_address(data->sg), host->ioaddr + SDHCI_DMA_ADDRESS);
410 } else { 405 } else {
411 host->size = data->blksz * data->blocks;
412
413 host->cur_sg = data->sg; 406 host->cur_sg = data->sg;
414 host->num_sg = data->sg_len; 407 host->num_sg = data->sg_len;
415 408
@@ -473,10 +466,6 @@ static void sdhci_finish_data(struct sdhci_host *host)
473 "though there were blocks left.\n", 466 "though there were blocks left.\n",
474 mmc_hostname(host->mmc)); 467 mmc_hostname(host->mmc));
475 data->error = MMC_ERR_FAILED; 468 data->error = MMC_ERR_FAILED;
476 } else if (host->size != 0) {
477 printk(KERN_ERR "%s: %d bytes were left untransferred.\n",
478 mmc_hostname(host->mmc), host->size);
479 data->error = MMC_ERR_FAILED;
480 } 469 }
481 470
482 DBG("Ending data transfer (%d bytes)\n", data->bytes_xfered); 471 DBG("Ending data transfer (%d bytes)\n", data->bytes_xfered);
@@ -669,20 +658,16 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
669 658
670 pwr = SDHCI_POWER_ON; 659 pwr = SDHCI_POWER_ON;
671 660
672 switch (power) { 661 switch (1 << power) {
673 case MMC_VDD_170: 662 case MMC_VDD_165_195:
674 case MMC_VDD_180:
675 case MMC_VDD_190:
676 pwr |= SDHCI_POWER_180; 663 pwr |= SDHCI_POWER_180;
677 break; 664 break;
678 case MMC_VDD_290: 665 case MMC_VDD_29_30:
679 case MMC_VDD_300: 666 case MMC_VDD_30_31:
680 case MMC_VDD_310:
681 pwr |= SDHCI_POWER_300; 667 pwr |= SDHCI_POWER_300;
682 break; 668 break;
683 case MMC_VDD_320: 669 case MMC_VDD_32_33:
684 case MMC_VDD_330: 670 case MMC_VDD_33_34:
685 case MMC_VDD_340:
686 pwr |= SDHCI_POWER_330; 671 pwr |= SDHCI_POWER_330;
687 break; 672 break;
688 default: 673 default:
@@ -1294,7 +1279,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1294 if (caps & SDHCI_CAN_VDD_300) 1279 if (caps & SDHCI_CAN_VDD_300)
1295 mmc->ocr_avail |= MMC_VDD_29_30|MMC_VDD_30_31; 1280 mmc->ocr_avail |= MMC_VDD_29_30|MMC_VDD_30_31;
1296 if (caps & SDHCI_CAN_VDD_180) 1281 if (caps & SDHCI_CAN_VDD_180)
1297 mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19; 1282 mmc->ocr_avail |= MMC_VDD_165_195;
1298 1283
1299 if (mmc->ocr_avail == 0) { 1284 if (mmc->ocr_avail == 0) {
1300 printk(KERN_ERR "%s: Hardware doesn't report any " 1285 printk(KERN_ERR "%s: Hardware doesn't report any "
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/host/sdhci.h
index e324f0a623dc..7400f4bc114f 100644
--- a/drivers/mmc/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/mmc/sdhci.h - Secure Digital Host Controller Interface driver 2 * linux/drivers/mmc/sdhci.h - Secure Digital Host Controller Interface driver
3 * 3 *
4 * Copyright (C) 2005 Pierre Ossman, All Rights Reserved. 4 * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -187,8 +187,6 @@ struct sdhci_host {
187 int offset; /* Offset into current sg */ 187 int offset; /* Offset into current sg */
188 int remain; /* Bytes left in current */ 188 int remain; /* Bytes left in current */
189 189
190 int size; /* Remaining bytes in transfer */
191
192 char slot_descr[20]; /* Name for reservations */ 190 char slot_descr[20]; /* Name for reservations */
193 191
194 int irq; /* Device IRQ */ 192 int irq; /* Device IRQ */
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
new file mode 100644
index 000000000000..7511f961c67b
--- /dev/null
+++ b/drivers/mmc/host/tifm_sd.c
@@ -0,0 +1,1102 @@
1/*
2 * tifm_sd.c - TI FlashMedia driver
3 *
4 * Copyright (C) 2006 Alex Dubov <oakad@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Special thanks to Brad Campbell for extensive testing of this driver.
11 *
12 */
13
14
15#include <linux/tifm.h>
16#include <linux/mmc/host.h>
17#include <linux/highmem.h>
18#include <linux/scatterlist.h>
19#include <asm/io.h>
20
21#define DRIVER_NAME "tifm_sd"
22#define DRIVER_VERSION "0.8"
23
24static int no_dma = 0;
25static int fixed_timeout = 0;
26module_param(no_dma, bool, 0644);
27module_param(fixed_timeout, bool, 0644);
28
29/* Constants here are mostly from OMAP5912 datasheet */
30#define TIFM_MMCSD_RESET 0x0002
31#define TIFM_MMCSD_CLKMASK 0x03ff
32#define TIFM_MMCSD_POWER 0x0800
33#define TIFM_MMCSD_4BBUS 0x8000
34#define TIFM_MMCSD_RXDE 0x8000 /* rx dma enable */
35#define TIFM_MMCSD_TXDE 0x0080 /* tx dma enable */
36#define TIFM_MMCSD_BUFINT 0x0c00 /* set bits: AE, AF */
37#define TIFM_MMCSD_DPE 0x0020 /* data timeout counted in kilocycles */
38#define TIFM_MMCSD_INAB 0x0080 /* abort / initialize command */
39#define TIFM_MMCSD_READ 0x8000
40
41#define TIFM_MMCSD_ERRMASK 0x01e0 /* set bits: CCRC, CTO, DCRC, DTO */
42#define TIFM_MMCSD_EOC 0x0001 /* end of command phase */
43#define TIFM_MMCSD_CD 0x0002 /* card detect */
44#define TIFM_MMCSD_CB 0x0004 /* card enter busy state */
45#define TIFM_MMCSD_BRS 0x0008 /* block received/sent */
46#define TIFM_MMCSD_EOFB 0x0010 /* card exit busy state */
47#define TIFM_MMCSD_DTO 0x0020 /* data time-out */
48#define TIFM_MMCSD_DCRC 0x0040 /* data crc error */
49#define TIFM_MMCSD_CTO 0x0080 /* command time-out */
50#define TIFM_MMCSD_CCRC 0x0100 /* command crc error */
51#define TIFM_MMCSD_AF 0x0400 /* fifo almost full */
52#define TIFM_MMCSD_AE 0x0800 /* fifo almost empty */
53#define TIFM_MMCSD_OCRB 0x1000 /* OCR busy */
54#define TIFM_MMCSD_CIRQ 0x2000 /* card irq (cmd40/sdio) */
55#define TIFM_MMCSD_CERR 0x4000 /* card status error */
56
57#define TIFM_MMCSD_ODTO 0x0040 /* open drain / extended timeout */
58#define TIFM_MMCSD_CARD_RO 0x0200 /* card is read-only */
59
60#define TIFM_MMCSD_FIFO_SIZE 0x0020
61
62#define TIFM_MMCSD_RSP_R0 0x0000
63#define TIFM_MMCSD_RSP_R1 0x0100
64#define TIFM_MMCSD_RSP_R2 0x0200
65#define TIFM_MMCSD_RSP_R3 0x0300
66#define TIFM_MMCSD_RSP_R4 0x0400
67#define TIFM_MMCSD_RSP_R5 0x0500
68#define TIFM_MMCSD_RSP_R6 0x0600
69
70#define TIFM_MMCSD_RSP_BUSY 0x0800
71
72#define TIFM_MMCSD_CMD_BC 0x0000
73#define TIFM_MMCSD_CMD_BCR 0x1000
74#define TIFM_MMCSD_CMD_AC 0x2000
75#define TIFM_MMCSD_CMD_ADTC 0x3000
76
77#define TIFM_MMCSD_MAX_BLOCK_SIZE 0x0800UL
78
79enum {
80 CMD_READY = 0x0001,
81 FIFO_READY = 0x0002,
82 BRS_READY = 0x0004,
83 SCMD_ACTIVE = 0x0008,
84 SCMD_READY = 0x0010,
85 CARD_BUSY = 0x0020,
86 DATA_CARRY = 0x0040
87};
88
89struct tifm_sd {
90 struct tifm_dev *dev;
91
92 unsigned short eject:1,
93 open_drain:1,
94 no_dma:1;
95 unsigned short cmd_flags;
96
97 unsigned int clk_freq;
98 unsigned int clk_div;
99 unsigned long timeout_jiffies;
100
101 struct tasklet_struct finish_tasklet;
102 struct timer_list timer;
103 struct mmc_request *req;
104
105 int sg_len;
106 int sg_pos;
107 unsigned int block_pos;
108 struct scatterlist bounce_buf;
109 unsigned char bounce_buf_data[TIFM_MMCSD_MAX_BLOCK_SIZE];
110};
111
112/* for some reason, host won't respond correctly to readw/writew */
113static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
114 unsigned int off, unsigned int cnt)
115{
116 struct tifm_dev *sock = host->dev;
117 unsigned char *buf;
118 unsigned int pos = 0, val;
119
120 buf = kmap_atomic(pg, KM_BIO_DST_IRQ) + off;
121 if (host->cmd_flags & DATA_CARRY) {
122 buf[pos++] = host->bounce_buf_data[0];
123 host->cmd_flags &= ~DATA_CARRY;
124 }
125
126 while (pos < cnt) {
127 val = readl(sock->addr + SOCK_MMCSD_DATA);
128 buf[pos++] = val & 0xff;
129 if (pos == cnt) {
130 host->bounce_buf_data[0] = (val >> 8) & 0xff;
131 host->cmd_flags |= DATA_CARRY;
132 break;
133 }
134 buf[pos++] = (val >> 8) & 0xff;
135 }
136 kunmap_atomic(buf - off, KM_BIO_DST_IRQ);
137}
138
139static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
140 unsigned int off, unsigned int cnt)
141{
142 struct tifm_dev *sock = host->dev;
143 unsigned char *buf;
144 unsigned int pos = 0, val;
145
146 buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + off;
147 if (host->cmd_flags & DATA_CARRY) {
148 val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00);
149 writel(val, sock->addr + SOCK_MMCSD_DATA);
150 host->cmd_flags &= ~DATA_CARRY;
151 }
152
153 while (pos < cnt) {
154 val = buf[pos++];
155 if (pos == cnt) {
156 host->bounce_buf_data[0] = val & 0xff;
157 host->cmd_flags |= DATA_CARRY;
158 break;
159 }
160 val |= (buf[pos++] << 8) & 0xff00;
161 writel(val, sock->addr + SOCK_MMCSD_DATA);
162 }
163 kunmap_atomic(buf - off, KM_BIO_SRC_IRQ);
164}
165
166static void tifm_sd_transfer_data(struct tifm_sd *host)
167{
168 struct mmc_data *r_data = host->req->cmd->data;
169 struct scatterlist *sg = r_data->sg;
170 unsigned int off, cnt, t_size = TIFM_MMCSD_FIFO_SIZE * 2;
171 unsigned int p_off, p_cnt;
172 struct page *pg;
173
174 if (host->sg_pos == host->sg_len)
175 return;
176 while (t_size) {
177 cnt = sg[host->sg_pos].length - host->block_pos;
178 if (!cnt) {
179 host->block_pos = 0;
180 host->sg_pos++;
181 if (host->sg_pos == host->sg_len) {
182 if ((r_data->flags & MMC_DATA_WRITE)
183 && DATA_CARRY)
184 writel(host->bounce_buf_data[0],
185 host->dev->addr
186 + SOCK_MMCSD_DATA);
187
188 return;
189 }
190 cnt = sg[host->sg_pos].length;
191 }
192 off = sg[host->sg_pos].offset + host->block_pos;
193
194 pg = nth_page(sg[host->sg_pos].page, off >> PAGE_SHIFT);
195 p_off = offset_in_page(off);
196 p_cnt = PAGE_SIZE - p_off;
197 p_cnt = min(p_cnt, cnt);
198 p_cnt = min(p_cnt, t_size);
199
200 if (r_data->flags & MMC_DATA_READ)
201 tifm_sd_read_fifo(host, pg, p_off, p_cnt);
202 else if (r_data->flags & MMC_DATA_WRITE)
203 tifm_sd_write_fifo(host, pg, p_off, p_cnt);
204
205 t_size -= p_cnt;
206 host->block_pos += p_cnt;
207 }
208}
209
210static void tifm_sd_copy_page(struct page *dst, unsigned int dst_off,
211 struct page *src, unsigned int src_off,
212 unsigned int count)
213{
214 unsigned char *src_buf = kmap_atomic(src, KM_BIO_SRC_IRQ) + src_off;
215 unsigned char *dst_buf = kmap_atomic(dst, KM_BIO_DST_IRQ) + dst_off;
216
217 memcpy(dst_buf, src_buf, count);
218
219 kunmap_atomic(dst_buf - dst_off, KM_BIO_DST_IRQ);
220 kunmap_atomic(src_buf - src_off, KM_BIO_SRC_IRQ);
221}
222
223static void tifm_sd_bounce_block(struct tifm_sd *host, struct mmc_data *r_data)
224{
225 struct scatterlist *sg = r_data->sg;
226 unsigned int t_size = r_data->blksz;
227 unsigned int off, cnt;
228 unsigned int p_off, p_cnt;
229 struct page *pg;
230
231 dev_dbg(&host->dev->dev, "bouncing block\n");
232 while (t_size) {
233 cnt = sg[host->sg_pos].length - host->block_pos;
234 if (!cnt) {
235 host->block_pos = 0;
236 host->sg_pos++;
237 if (host->sg_pos == host->sg_len)
238 return;
239 cnt = sg[host->sg_pos].length;
240 }
241 off = sg[host->sg_pos].offset + host->block_pos;
242
243 pg = nth_page(sg[host->sg_pos].page, off >> PAGE_SHIFT);
244 p_off = offset_in_page(off);
245 p_cnt = PAGE_SIZE - p_off;
246 p_cnt = min(p_cnt, cnt);
247 p_cnt = min(p_cnt, t_size);
248
249 if (r_data->flags & MMC_DATA_WRITE)
250 tifm_sd_copy_page(host->bounce_buf.page,
251 r_data->blksz - t_size,
252 pg, p_off, p_cnt);
253 else if (r_data->flags & MMC_DATA_READ)
254 tifm_sd_copy_page(pg, p_off, host->bounce_buf.page,
255 r_data->blksz - t_size, p_cnt);
256
257 t_size -= p_cnt;
258 host->block_pos += p_cnt;
259 }
260}
261
262static int tifm_sd_set_dma_data(struct tifm_sd *host, struct mmc_data *r_data)
263{
264 struct tifm_dev *sock = host->dev;
265 unsigned int t_size = TIFM_DMA_TSIZE * r_data->blksz;
266 unsigned int dma_len, dma_blk_cnt, dma_off;
267 struct scatterlist *sg = NULL;
268 unsigned long flags;
269
270 if (host->sg_pos == host->sg_len)
271 return 1;
272
273 if (host->cmd_flags & DATA_CARRY) {
274 host->cmd_flags &= ~DATA_CARRY;
275 local_irq_save(flags);
276 tifm_sd_bounce_block(host, r_data);
277 local_irq_restore(flags);
278 if (host->sg_pos == host->sg_len)
279 return 1;
280 }
281
282 dma_len = sg_dma_len(&r_data->sg[host->sg_pos]) - host->block_pos;
283 if (!dma_len) {
284 host->block_pos = 0;
285 host->sg_pos++;
286 if (host->sg_pos == host->sg_len)
287 return 1;
288 dma_len = sg_dma_len(&r_data->sg[host->sg_pos]);
289 }
290
291 if (dma_len < t_size) {
292 dma_blk_cnt = dma_len / r_data->blksz;
293 dma_off = host->block_pos;
294 host->block_pos += dma_blk_cnt * r_data->blksz;
295 } else {
296 dma_blk_cnt = TIFM_DMA_TSIZE;
297 dma_off = host->block_pos;
298 host->block_pos += t_size;
299 }
300
301 if (dma_blk_cnt)
302 sg = &r_data->sg[host->sg_pos];
303 else if (dma_len) {
304 if (r_data->flags & MMC_DATA_WRITE) {
305 local_irq_save(flags);
306 tifm_sd_bounce_block(host, r_data);
307 local_irq_restore(flags);
308 } else
309 host->cmd_flags |= DATA_CARRY;
310
311 sg = &host->bounce_buf;
312 dma_off = 0;
313 dma_blk_cnt = 1;
314 } else
315 return 1;
316
317 dev_dbg(&sock->dev, "setting dma for %d blocks\n", dma_blk_cnt);
318 writel(sg_dma_address(sg) + dma_off, sock->addr + SOCK_DMA_ADDRESS);
319 if (r_data->flags & MMC_DATA_WRITE)
320 writel((dma_blk_cnt << 8) | TIFM_DMA_TX | TIFM_DMA_EN,
321 sock->addr + SOCK_DMA_CONTROL);
322 else
323 writel((dma_blk_cnt << 8) | TIFM_DMA_EN,
324 sock->addr + SOCK_DMA_CONTROL);
325
326 return 0;
327}
328
329static unsigned int tifm_sd_op_flags(struct mmc_command *cmd)
330{
331 unsigned int rc = 0;
332
333 switch (mmc_resp_type(cmd)) {
334 case MMC_RSP_NONE:
335 rc |= TIFM_MMCSD_RSP_R0;
336 break;
337 case MMC_RSP_R1B:
338 rc |= TIFM_MMCSD_RSP_BUSY; // deliberate fall-through
339 case MMC_RSP_R1:
340 rc |= TIFM_MMCSD_RSP_R1;
341 break;
342 case MMC_RSP_R2:
343 rc |= TIFM_MMCSD_RSP_R2;
344 break;
345 case MMC_RSP_R3:
346 rc |= TIFM_MMCSD_RSP_R3;
347 break;
348 default:
349 BUG();
350 }
351
352 switch (mmc_cmd_type(cmd)) {
353 case MMC_CMD_BC:
354 rc |= TIFM_MMCSD_CMD_BC;
355 break;
356 case MMC_CMD_BCR:
357 rc |= TIFM_MMCSD_CMD_BCR;
358 break;
359 case MMC_CMD_AC:
360 rc |= TIFM_MMCSD_CMD_AC;
361 break;
362 case MMC_CMD_ADTC:
363 rc |= TIFM_MMCSD_CMD_ADTC;
364 break;
365 default:
366 BUG();
367 }
368 return rc;
369}
370
371static void tifm_sd_exec(struct tifm_sd *host, struct mmc_command *cmd)
372{
373 struct tifm_dev *sock = host->dev;
374 unsigned int cmd_mask = tifm_sd_op_flags(cmd);
375
376 if (host->open_drain)
377 cmd_mask |= TIFM_MMCSD_ODTO;
378
379 if (cmd->data && (cmd->data->flags & MMC_DATA_READ))
380 cmd_mask |= TIFM_MMCSD_READ;
381
382 dev_dbg(&sock->dev, "executing opcode 0x%x, arg: 0x%x, mask: 0x%x\n",
383 cmd->opcode, cmd->arg, cmd_mask);
384
385 writel((cmd->arg >> 16) & 0xffff, sock->addr + SOCK_MMCSD_ARG_HIGH);
386 writel(cmd->arg & 0xffff, sock->addr + SOCK_MMCSD_ARG_LOW);
387 writel(cmd->opcode | cmd_mask, sock->addr + SOCK_MMCSD_COMMAND);
388}
389
390static void tifm_sd_fetch_resp(struct mmc_command *cmd, struct tifm_dev *sock)
391{
392 cmd->resp[0] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x1c) << 16)
393 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x18);
394 cmd->resp[1] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x14) << 16)
395 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x10);
396 cmd->resp[2] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x0c) << 16)
397 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x08);
398 cmd->resp[3] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x04) << 16)
399 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x00);
400}
401
402static void tifm_sd_check_status(struct tifm_sd *host)
403{
404 struct tifm_dev *sock = host->dev;
405 struct mmc_command *cmd = host->req->cmd;
406
407 if (cmd->error != MMC_ERR_NONE)
408 goto finish_request;
409
410 if (!(host->cmd_flags & CMD_READY))
411 return;
412
413 if (cmd->data) {
414 if (cmd->data->error != MMC_ERR_NONE) {
415 if ((host->cmd_flags & SCMD_ACTIVE)
416 && !(host->cmd_flags & SCMD_READY))
417 return;
418
419 goto finish_request;
420 }
421
422 if (!(host->cmd_flags & BRS_READY))
423 return;
424
425 if (!(host->no_dma || (host->cmd_flags & FIFO_READY)))
426 return;
427
428 if (cmd->data->flags & MMC_DATA_WRITE) {
429 if (host->req->stop) {
430 if (!(host->cmd_flags & SCMD_ACTIVE)) {
431 host->cmd_flags |= SCMD_ACTIVE;
432 writel(TIFM_MMCSD_EOFB
433 | readl(sock->addr
434 + SOCK_MMCSD_INT_ENABLE),
435 sock->addr
436 + SOCK_MMCSD_INT_ENABLE);
437 tifm_sd_exec(host, host->req->stop);
438 return;
439 } else {
440 if (!(host->cmd_flags & SCMD_READY)
441 || (host->cmd_flags & CARD_BUSY))
442 return;
443 writel((~TIFM_MMCSD_EOFB)
444 & readl(sock->addr
445 + SOCK_MMCSD_INT_ENABLE),
446 sock->addr
447 + SOCK_MMCSD_INT_ENABLE);
448 }
449 } else {
450 if (host->cmd_flags & CARD_BUSY)
451 return;
452 writel((~TIFM_MMCSD_EOFB)
453 & readl(sock->addr
454 + SOCK_MMCSD_INT_ENABLE),
455 sock->addr + SOCK_MMCSD_INT_ENABLE);
456 }
457 } else {
458 if (host->req->stop) {
459 if (!(host->cmd_flags & SCMD_ACTIVE)) {
460 host->cmd_flags |= SCMD_ACTIVE;
461 tifm_sd_exec(host, host->req->stop);
462 return;
463 } else {
464 if (!(host->cmd_flags & SCMD_READY))
465 return;
466 }
467 }
468 }
469 }
470finish_request:
471 tasklet_schedule(&host->finish_tasklet);
472}
473
474/* Called from interrupt handler */
475static void tifm_sd_data_event(struct tifm_dev *sock)
476{
477 struct tifm_sd *host;
478 unsigned int fifo_status = 0;
479 struct mmc_data *r_data = NULL;
480
481 spin_lock(&sock->lock);
482 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock));
483 fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS);
484 dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n",
485 fifo_status, host->cmd_flags);
486
487 if (host->req) {
488 r_data = host->req->cmd->data;
489
490 if (r_data && (fifo_status & TIFM_FIFO_READY)) {
491 if (tifm_sd_set_dma_data(host, r_data)) {
492 host->cmd_flags |= FIFO_READY;
493 tifm_sd_check_status(host);
494 }
495 }
496 }
497
498 writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS);
499 spin_unlock(&sock->lock);
500}
501
502/* Called from interrupt handler */
503static void tifm_sd_card_event(struct tifm_dev *sock)
504{
505 struct tifm_sd *host;
506 unsigned int host_status = 0;
507 int cmd_error = MMC_ERR_NONE;
508 struct mmc_command *cmd = NULL;
509 unsigned long flags;
510
511 spin_lock(&sock->lock);
512 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock));
513 host_status = readl(sock->addr + SOCK_MMCSD_STATUS);
514 dev_dbg(&sock->dev, "host event: host_status %x, flags %x\n",
515 host_status, host->cmd_flags);
516
517 if (host->req) {
518 cmd = host->req->cmd;
519
520 if (host_status & TIFM_MMCSD_ERRMASK) {
521 writel(host_status & TIFM_MMCSD_ERRMASK,
522 sock->addr + SOCK_MMCSD_STATUS);
523 if (host_status & TIFM_MMCSD_CTO)
524 cmd_error = MMC_ERR_TIMEOUT;
525 else if (host_status & TIFM_MMCSD_CCRC)
526 cmd_error = MMC_ERR_BADCRC;
527
528 if (cmd->data) {
529 if (host_status & TIFM_MMCSD_DTO)
530 cmd->data->error = MMC_ERR_TIMEOUT;
531 else if (host_status & TIFM_MMCSD_DCRC)
532 cmd->data->error = MMC_ERR_BADCRC;
533 }
534
535 writel(TIFM_FIFO_INT_SETALL,
536 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
537 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
538
539 if (host->req->stop) {
540 if (host->cmd_flags & SCMD_ACTIVE) {
541 host->req->stop->error = cmd_error;
542 host->cmd_flags |= SCMD_READY;
543 } else {
544 cmd->error = cmd_error;
545 host->cmd_flags |= SCMD_ACTIVE;
546 tifm_sd_exec(host, host->req->stop);
547 goto done;
548 }
549 } else
550 cmd->error = cmd_error;
551 } else {
552 if (host_status & (TIFM_MMCSD_EOC | TIFM_MMCSD_CERR)) {
553 if (!(host->cmd_flags & CMD_READY)) {
554 host->cmd_flags |= CMD_READY;
555 tifm_sd_fetch_resp(cmd, sock);
556 } else if (host->cmd_flags & SCMD_ACTIVE) {
557 host->cmd_flags |= SCMD_READY;
558 tifm_sd_fetch_resp(host->req->stop,
559 sock);
560 }
561 }
562 if (host_status & TIFM_MMCSD_BRS)
563 host->cmd_flags |= BRS_READY;
564 }
565
566 if (host->no_dma && cmd->data) {
567 if (host_status & TIFM_MMCSD_AE)
568 writel(host_status & TIFM_MMCSD_AE,
569 sock->addr + SOCK_MMCSD_STATUS);
570
571 if (host_status & (TIFM_MMCSD_AE | TIFM_MMCSD_AF
572 | TIFM_MMCSD_BRS)) {
573 local_irq_save(flags);
574 tifm_sd_transfer_data(host);
575 local_irq_restore(flags);
576 host_status &= ~TIFM_MMCSD_AE;
577 }
578 }
579
580 if (host_status & TIFM_MMCSD_EOFB)
581 host->cmd_flags &= ~CARD_BUSY;
582 else if (host_status & TIFM_MMCSD_CB)
583 host->cmd_flags |= CARD_BUSY;
584
585 tifm_sd_check_status(host);
586 }
587done:
588 writel(host_status, sock->addr + SOCK_MMCSD_STATUS);
589 spin_unlock(&sock->lock);
590}
591
592static void tifm_sd_set_data_timeout(struct tifm_sd *host,
593 struct mmc_data *data)
594{
595 struct tifm_dev *sock = host->dev;
596 unsigned int data_timeout = data->timeout_clks;
597
598 if (fixed_timeout)
599 return;
600
601 data_timeout += data->timeout_ns /
602 ((1000000000UL / host->clk_freq) * host->clk_div);
603
604 if (data_timeout < 0xffff) {
605 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
606 writel((~TIFM_MMCSD_DPE)
607 & readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
608 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
609 } else {
610 data_timeout = (data_timeout >> 10) + 1;
611 if (data_timeout > 0xffff)
612 data_timeout = 0; /* set to unlimited */
613 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
614 writel(TIFM_MMCSD_DPE
615 | readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
616 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
617 }
618}
619
620static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
621{
622 struct tifm_sd *host = mmc_priv(mmc);
623 struct tifm_dev *sock = host->dev;
624 unsigned long flags;
625 struct mmc_data *r_data = mrq->cmd->data;
626
627 spin_lock_irqsave(&sock->lock, flags);
628 if (host->eject) {
629 spin_unlock_irqrestore(&sock->lock, flags);
630 goto err_out;
631 }
632
633 if (host->req) {
634 printk(KERN_ERR "%s : unfinished request detected\n",
635 sock->dev.bus_id);
636 spin_unlock_irqrestore(&sock->lock, flags);
637 goto err_out;
638 }
639
640 host->cmd_flags = 0;
641 host->block_pos = 0;
642 host->sg_pos = 0;
643
644 if (r_data) {
645 tifm_sd_set_data_timeout(host, r_data);
646
647 if ((r_data->flags & MMC_DATA_WRITE) && !mrq->stop)
648 writel(TIFM_MMCSD_EOFB
649 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
650 sock->addr + SOCK_MMCSD_INT_ENABLE);
651
652 if (host->no_dma) {
653 writel(TIFM_MMCSD_BUFINT
654 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
655 sock->addr + SOCK_MMCSD_INT_ENABLE);
656 writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8)
657 | (TIFM_MMCSD_FIFO_SIZE - 1),
658 sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
659
660 host->sg_len = r_data->sg_len;
661 } else {
662 sg_init_one(&host->bounce_buf, host->bounce_buf_data,
663 r_data->blksz);
664
665 if(1 != tifm_map_sg(sock, &host->bounce_buf, 1,
666 r_data->flags & MMC_DATA_WRITE
667 ? PCI_DMA_TODEVICE
668 : PCI_DMA_FROMDEVICE)) {
669 printk(KERN_ERR "%s : scatterlist map failed\n",
670 sock->dev.bus_id);
671 spin_unlock_irqrestore(&sock->lock, flags);
672 goto err_out;
673 }
674 host->sg_len = tifm_map_sg(sock, r_data->sg,
675 r_data->sg_len,
676 r_data->flags
677 & MMC_DATA_WRITE
678 ? PCI_DMA_TODEVICE
679 : PCI_DMA_FROMDEVICE);
680 if (host->sg_len < 1) {
681 printk(KERN_ERR "%s : scatterlist map failed\n",
682 sock->dev.bus_id);
683 tifm_unmap_sg(sock, &host->bounce_buf, 1,
684 r_data->flags & MMC_DATA_WRITE
685 ? PCI_DMA_TODEVICE
686 : PCI_DMA_FROMDEVICE);
687 spin_unlock_irqrestore(&sock->lock, flags);
688 goto err_out;
689 }
690
691 writel(TIFM_FIFO_INT_SETALL,
692 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
693 writel(ilog2(r_data->blksz) - 2,
694 sock->addr + SOCK_FIFO_PAGE_SIZE);
695 writel(TIFM_FIFO_ENABLE,
696 sock->addr + SOCK_FIFO_CONTROL);
697 writel(TIFM_FIFO_INTMASK,
698 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
699
700 if (r_data->flags & MMC_DATA_WRITE)
701 writel(TIFM_MMCSD_TXDE,
702 sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
703 else
704 writel(TIFM_MMCSD_RXDE,
705 sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
706
707 tifm_sd_set_dma_data(host, r_data);
708 }
709
710 writel(r_data->blocks - 1,
711 sock->addr + SOCK_MMCSD_NUM_BLOCKS);
712 writel(r_data->blksz - 1,
713 sock->addr + SOCK_MMCSD_BLOCK_LEN);
714 }
715
716 host->req = mrq;
717 mod_timer(&host->timer, jiffies + host->timeout_jiffies);
718 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL),
719 sock->addr + SOCK_CONTROL);
720 tifm_sd_exec(host, mrq->cmd);
721 spin_unlock_irqrestore(&sock->lock, flags);
722 return;
723
724err_out:
725 mrq->cmd->error = MMC_ERR_TIMEOUT;
726 mmc_request_done(mmc, mrq);
727}
728
729static void tifm_sd_end_cmd(unsigned long data)
730{
731 struct tifm_sd *host = (struct tifm_sd*)data;
732 struct tifm_dev *sock = host->dev;
733 struct mmc_host *mmc = tifm_get_drvdata(sock);
734 struct mmc_request *mrq;
735 struct mmc_data *r_data = NULL;
736 unsigned long flags;
737
738 spin_lock_irqsave(&sock->lock, flags);
739
740 del_timer(&host->timer);
741 mrq = host->req;
742 host->req = NULL;
743
744 if (!mrq) {
745 printk(KERN_ERR " %s : no request to complete?\n",
746 sock->dev.bus_id);
747 spin_unlock_irqrestore(&sock->lock, flags);
748 return;
749 }
750
751 r_data = mrq->cmd->data;
752 if (r_data) {
753 if (host->no_dma) {
754 writel((~TIFM_MMCSD_BUFINT)
755 & readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
756 sock->addr + SOCK_MMCSD_INT_ENABLE);
757 } else {
758 tifm_unmap_sg(sock, &host->bounce_buf, 1,
759 (r_data->flags & MMC_DATA_WRITE)
760 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
761 tifm_unmap_sg(sock, r_data->sg, r_data->sg_len,
762 (r_data->flags & MMC_DATA_WRITE)
763 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
764 }
765
766 r_data->bytes_xfered = r_data->blocks
767 - readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1;
768 r_data->bytes_xfered *= r_data->blksz;
769 r_data->bytes_xfered += r_data->blksz
770 - readl(sock->addr + SOCK_MMCSD_BLOCK_LEN) + 1;
771 }
772
773 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
774 sock->addr + SOCK_CONTROL);
775
776 spin_unlock_irqrestore(&sock->lock, flags);
777 mmc_request_done(mmc, mrq);
778}
779
780static void tifm_sd_abort(unsigned long data)
781{
782 struct tifm_sd *host = (struct tifm_sd*)data;
783
784 printk(KERN_ERR
785 "%s : card failed to respond for a long period of time "
786 "(%x, %x)\n",
787 host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags);
788
789 tifm_eject(host->dev);
790}
791
792static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
793{
794 struct tifm_sd *host = mmc_priv(mmc);
795 struct tifm_dev *sock = host->dev;
796 unsigned int clk_div1, clk_div2;
797 unsigned long flags;
798
799 spin_lock_irqsave(&sock->lock, flags);
800
801 dev_dbg(&sock->dev, "ios: clock = %u, vdd = %x, bus_mode = %x, "
802 "chip_select = %x, power_mode = %x, bus_width = %x\n",
803 ios->clock, ios->vdd, ios->bus_mode, ios->chip_select,
804 ios->power_mode, ios->bus_width);
805
806 if (ios->bus_width == MMC_BUS_WIDTH_4) {
807 writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
808 sock->addr + SOCK_MMCSD_CONFIG);
809 } else {
810 writel((~TIFM_MMCSD_4BBUS)
811 & readl(sock->addr + SOCK_MMCSD_CONFIG),
812 sock->addr + SOCK_MMCSD_CONFIG);
813 }
814
815 if (ios->clock) {
816 clk_div1 = 20000000 / ios->clock;
817 if (!clk_div1)
818 clk_div1 = 1;
819
820 clk_div2 = 24000000 / ios->clock;
821 if (!clk_div2)
822 clk_div2 = 1;
823
824 if ((20000000 / clk_div1) > ios->clock)
825 clk_div1++;
826 if ((24000000 / clk_div2) > ios->clock)
827 clk_div2++;
828 if ((20000000 / clk_div1) > (24000000 / clk_div2)) {
829 host->clk_freq = 20000000;
830 host->clk_div = clk_div1;
831 writel((~TIFM_CTRL_FAST_CLK)
832 & readl(sock->addr + SOCK_CONTROL),
833 sock->addr + SOCK_CONTROL);
834 } else {
835 host->clk_freq = 24000000;
836 host->clk_div = clk_div2;
837 writel(TIFM_CTRL_FAST_CLK
838 | readl(sock->addr + SOCK_CONTROL),
839 sock->addr + SOCK_CONTROL);
840 }
841 } else {
842 host->clk_div = 0;
843 }
844 host->clk_div &= TIFM_MMCSD_CLKMASK;
845 writel(host->clk_div
846 | ((~TIFM_MMCSD_CLKMASK)
847 & readl(sock->addr + SOCK_MMCSD_CONFIG)),
848 sock->addr + SOCK_MMCSD_CONFIG);
849
850 host->open_drain = (ios->bus_mode == MMC_BUSMODE_OPENDRAIN);
851
852 /* chip_select : maybe later */
853 //vdd
854 //power is set before probe / after remove
855
856 spin_unlock_irqrestore(&sock->lock, flags);
857}
858
859static int tifm_sd_ro(struct mmc_host *mmc)
860{
861 int rc = 0;
862 struct tifm_sd *host = mmc_priv(mmc);
863 struct tifm_dev *sock = host->dev;
864 unsigned long flags;
865
866 spin_lock_irqsave(&sock->lock, flags);
867 if (TIFM_MMCSD_CARD_RO & readl(sock->addr + SOCK_PRESENT_STATE))
868 rc = 1;
869 spin_unlock_irqrestore(&sock->lock, flags);
870 return rc;
871}
872
873static const struct mmc_host_ops tifm_sd_ops = {
874 .request = tifm_sd_request,
875 .set_ios = tifm_sd_ios,
876 .get_ro = tifm_sd_ro
877};
878
879static int tifm_sd_initialize_host(struct tifm_sd *host)
880{
881 int rc;
882 unsigned int host_status = 0;
883 struct tifm_dev *sock = host->dev;
884
885 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
886 mmiowb();
887 host->clk_div = 61;
888 host->clk_freq = 20000000;
889 writel(TIFM_MMCSD_RESET, sock->addr + SOCK_MMCSD_SYSTEM_CONTROL);
890 writel(host->clk_div | TIFM_MMCSD_POWER,
891 sock->addr + SOCK_MMCSD_CONFIG);
892
893 /* wait up to 0.51 sec for reset */
894 for (rc = 32; rc <= 256; rc <<= 1) {
895 if (1 & readl(sock->addr + SOCK_MMCSD_SYSTEM_STATUS)) {
896 rc = 0;
897 break;
898 }
899 msleep(rc);
900 }
901
902 if (rc) {
903 printk(KERN_ERR "%s : controller failed to reset\n",
904 sock->dev.bus_id);
905 return -ENODEV;
906 }
907
908 writel(0, sock->addr + SOCK_MMCSD_NUM_BLOCKS);
909 writel(host->clk_div | TIFM_MMCSD_POWER,
910 sock->addr + SOCK_MMCSD_CONFIG);
911 writel(TIFM_MMCSD_RXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
912
913 // command timeout fixed to 64 clocks for now
914 writel(64, sock->addr + SOCK_MMCSD_COMMAND_TO);
915 writel(TIFM_MMCSD_INAB, sock->addr + SOCK_MMCSD_COMMAND);
916
917 for (rc = 16; rc <= 64; rc <<= 1) {
918 host_status = readl(sock->addr + SOCK_MMCSD_STATUS);
919 writel(host_status, sock->addr + SOCK_MMCSD_STATUS);
920 if (!(host_status & TIFM_MMCSD_ERRMASK)
921 && (host_status & TIFM_MMCSD_EOC)) {
922 rc = 0;
923 break;
924 }
925 msleep(rc);
926 }
927
928 if (rc) {
929 printk(KERN_ERR
930 "%s : card not ready - probe failed on initialization\n",
931 sock->dev.bus_id);
932 return -ENODEV;
933 }
934
935 writel(TIFM_MMCSD_CERR | TIFM_MMCSD_BRS | TIFM_MMCSD_EOC
936 | TIFM_MMCSD_ERRMASK,
937 sock->addr + SOCK_MMCSD_INT_ENABLE);
938 mmiowb();
939
940 return 0;
941}
942
943static int tifm_sd_probe(struct tifm_dev *sock)
944{
945 struct mmc_host *mmc;
946 struct tifm_sd *host;
947 int rc = -EIO;
948
949 if (!(TIFM_SOCK_STATE_OCCUPIED
950 & readl(sock->addr + SOCK_PRESENT_STATE))) {
951 printk(KERN_WARNING "%s : card gone, unexpectedly\n",
952 sock->dev.bus_id);
953 return rc;
954 }
955
956 mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev);
957 if (!mmc)
958 return -ENOMEM;
959
960 host = mmc_priv(mmc);
961 host->no_dma = no_dma;
962 tifm_set_drvdata(sock, mmc);
963 host->dev = sock;
964 host->timeout_jiffies = msecs_to_jiffies(1000);
965
966 tasklet_init(&host->finish_tasklet, tifm_sd_end_cmd,
967 (unsigned long)host);
968 setup_timer(&host->timer, tifm_sd_abort, (unsigned long)host);
969
970 mmc->ops = &tifm_sd_ops;
971 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
972 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
973 mmc->f_min = 20000000 / 60;
974 mmc->f_max = 24000000;
975
976 mmc->max_blk_count = 2048;
977 mmc->max_hw_segs = mmc->max_blk_count;
978 mmc->max_blk_size = min(TIFM_MMCSD_MAX_BLOCK_SIZE, PAGE_SIZE);
979 mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
980 mmc->max_req_size = mmc->max_seg_size;
981 mmc->max_phys_segs = mmc->max_hw_segs;
982
983 sock->card_event = tifm_sd_card_event;
984 sock->data_event = tifm_sd_data_event;
985 rc = tifm_sd_initialize_host(host);
986
987 if (!rc)
988 rc = mmc_add_host(mmc);
989 if (!rc)
990 return 0;
991
992 mmc_free_host(mmc);
993 return rc;
994}
995
996static void tifm_sd_remove(struct tifm_dev *sock)
997{
998 struct mmc_host *mmc = tifm_get_drvdata(sock);
999 struct tifm_sd *host = mmc_priv(mmc);
1000 unsigned long flags;
1001
1002 spin_lock_irqsave(&sock->lock, flags);
1003 host->eject = 1;
1004 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
1005 mmiowb();
1006 spin_unlock_irqrestore(&sock->lock, flags);
1007
1008 tasklet_kill(&host->finish_tasklet);
1009
1010 spin_lock_irqsave(&sock->lock, flags);
1011 if (host->req) {
1012 writel(TIFM_FIFO_INT_SETALL,
1013 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
1014 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
1015 host->req->cmd->error = MMC_ERR_TIMEOUT;
1016 if (host->req->stop)
1017 host->req->stop->error = MMC_ERR_TIMEOUT;
1018 tasklet_schedule(&host->finish_tasklet);
1019 }
1020 spin_unlock_irqrestore(&sock->lock, flags);
1021 mmc_remove_host(mmc);
1022 dev_dbg(&sock->dev, "after remove\n");
1023
1024 /* The meaning of the bit majority in this constant is unknown. */
1025 writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
1026 sock->addr + SOCK_CONTROL);
1027
1028 mmc_free_host(mmc);
1029}
1030
1031#ifdef CONFIG_PM
1032
1033static int tifm_sd_suspend(struct tifm_dev *sock, pm_message_t state)
1034{
1035 struct mmc_host *mmc = tifm_get_drvdata(sock);
1036 int rc;
1037
1038 rc = mmc_suspend_host(mmc, state);
1039 /* The meaning of the bit majority in this constant is unknown. */
1040 writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
1041 sock->addr + SOCK_CONTROL);
1042 return rc;
1043}
1044
1045static int tifm_sd_resume(struct tifm_dev *sock)
1046{
1047 struct mmc_host *mmc = tifm_get_drvdata(sock);
1048 struct tifm_sd *host = mmc_priv(mmc);
1049 int rc;
1050
1051 rc = tifm_sd_initialize_host(host);
1052 dev_dbg(&sock->dev, "resume initialize %d\n", rc);
1053
1054 if (rc)
1055 host->eject = 1;
1056 else
1057 rc = mmc_resume_host(mmc);
1058
1059 return rc;
1060}
1061
1062#else
1063
1064#define tifm_sd_suspend NULL
1065#define tifm_sd_resume NULL
1066
1067#endif /* CONFIG_PM */
1068
1069static struct tifm_device_id tifm_sd_id_tbl[] = {
1070 { TIFM_TYPE_SD }, { }
1071};
1072
1073static struct tifm_driver tifm_sd_driver = {
1074 .driver = {
1075 .name = DRIVER_NAME,
1076 .owner = THIS_MODULE
1077 },
1078 .id_table = tifm_sd_id_tbl,
1079 .probe = tifm_sd_probe,
1080 .remove = tifm_sd_remove,
1081 .suspend = tifm_sd_suspend,
1082 .resume = tifm_sd_resume
1083};
1084
1085static int __init tifm_sd_init(void)
1086{
1087 return tifm_register_driver(&tifm_sd_driver);
1088}
1089
1090static void __exit tifm_sd_exit(void)
1091{
1092 tifm_unregister_driver(&tifm_sd_driver);
1093}
1094
1095MODULE_AUTHOR("Alex Dubov");
1096MODULE_DESCRIPTION("TI FlashMedia SD driver");
1097MODULE_LICENSE("GPL");
1098MODULE_DEVICE_TABLE(tifm, tifm_sd_id_tbl);
1099MODULE_VERSION(DRIVER_VERSION);
1100
1101module_init(tifm_sd_init);
1102module_exit(tifm_sd_exit);
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/host/wbsd.c
index 05ccfc43168f..867ca6a69298 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/mmc/wbsd.c - Winbond W83L51xD SD/MMC driver 2 * linux/drivers/mmc/wbsd.c - Winbond W83L51xD SD/MMC driver
3 * 3 *
4 * Copyright (C) 2004-2006 Pierre Ossman, All Rights Reserved. 4 * Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -33,7 +33,6 @@
33#include <linux/pnp.h> 33#include <linux/pnp.h>
34#include <linux/highmem.h> 34#include <linux/highmem.h>
35#include <linux/mmc/host.h> 35#include <linux/mmc/host.h>
36#include <linux/mmc/protocol.h>
37 36
38#include <asm/io.h> 37#include <asm/io.h>
39#include <asm/dma.h> 38#include <asm/dma.h>
@@ -178,9 +177,8 @@ static void wbsd_init_device(struct wbsd_host *host)
178 ier = 0; 177 ier = 0;
179 ier |= WBSD_EINT_CARD; 178 ier |= WBSD_EINT_CARD;
180 ier |= WBSD_EINT_FIFO_THRE; 179 ier |= WBSD_EINT_FIFO_THRE;
181 ier |= WBSD_EINT_CCRC;
182 ier |= WBSD_EINT_TIMEOUT;
183 ier |= WBSD_EINT_CRC; 180 ier |= WBSD_EINT_CRC;
181 ier |= WBSD_EINT_TIMEOUT;
184 ier |= WBSD_EINT_TC; 182 ier |= WBSD_EINT_TC;
185 183
186 outb(ier, host->base + WBSD_EIR); 184 outb(ier, host->base + WBSD_EIR);
@@ -278,90 +276,36 @@ static inline char *wbsd_sg_to_buffer(struct wbsd_host *host)
278 276
279static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) 277static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data)
280{ 278{
281 unsigned int len, i, size; 279 unsigned int len, i;
282 struct scatterlist *sg; 280 struct scatterlist *sg;
283 char *dmabuf = host->dma_buffer; 281 char *dmabuf = host->dma_buffer;
284 char *sgbuf; 282 char *sgbuf;
285 283
286 size = host->size;
287
288 sg = data->sg; 284 sg = data->sg;
289 len = data->sg_len; 285 len = data->sg_len;
290 286
291 /*
292 * Just loop through all entries. Size might not
293 * be the entire list though so make sure that
294 * we do not transfer too much.
295 */
296 for (i = 0; i < len; i++) { 287 for (i = 0; i < len; i++) {
297 sgbuf = page_address(sg[i].page) + sg[i].offset; 288 sgbuf = page_address(sg[i].page) + sg[i].offset;
298 if (size < sg[i].length) 289 memcpy(dmabuf, sgbuf, sg[i].length);
299 memcpy(dmabuf, sgbuf, size);
300 else
301 memcpy(dmabuf, sgbuf, sg[i].length);
302 dmabuf += sg[i].length; 290 dmabuf += sg[i].length;
303
304 if (size < sg[i].length)
305 size = 0;
306 else
307 size -= sg[i].length;
308
309 if (size == 0)
310 break;
311 } 291 }
312
313 /*
314 * Check that we didn't get a request to transfer
315 * more data than can fit into the SG list.
316 */
317
318 BUG_ON(size != 0);
319
320 host->size -= size;
321} 292}
322 293
323static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data) 294static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data)
324{ 295{
325 unsigned int len, i, size; 296 unsigned int len, i;
326 struct scatterlist *sg; 297 struct scatterlist *sg;
327 char *dmabuf = host->dma_buffer; 298 char *dmabuf = host->dma_buffer;
328 char *sgbuf; 299 char *sgbuf;
329 300
330 size = host->size;
331
332 sg = data->sg; 301 sg = data->sg;
333 len = data->sg_len; 302 len = data->sg_len;
334 303
335 /*
336 * Just loop through all entries. Size might not
337 * be the entire list though so make sure that
338 * we do not transfer too much.
339 */
340 for (i = 0; i < len; i++) { 304 for (i = 0; i < len; i++) {
341 sgbuf = page_address(sg[i].page) + sg[i].offset; 305 sgbuf = page_address(sg[i].page) + sg[i].offset;
342 if (size < sg[i].length) 306 memcpy(sgbuf, dmabuf, sg[i].length);
343 memcpy(sgbuf, dmabuf, size);
344 else
345 memcpy(sgbuf, dmabuf, sg[i].length);
346 dmabuf += sg[i].length; 307 dmabuf += sg[i].length;
347
348 if (size < sg[i].length)
349 size = 0;
350 else
351 size -= sg[i].length;
352
353 if (size == 0)
354 break;
355 } 308 }
356
357 /*
358 * Check that we didn't get a request to transfer
359 * more data than can fit into the SG list.
360 */
361
362 BUG_ON(size != 0);
363
364 host->size -= size;
365} 309}
366 310
367/* 311/*
@@ -484,7 +428,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host)
484 /* 428 /*
485 * Handle excessive data. 429 * Handle excessive data.
486 */ 430 */
487 if (data->bytes_xfered == host->size) 431 if (host->num_sg == 0)
488 return; 432 return;
489 433
490 buffer = wbsd_sg_to_buffer(host) + host->offset; 434 buffer = wbsd_sg_to_buffer(host) + host->offset;
@@ -514,31 +458,14 @@ static void wbsd_empty_fifo(struct wbsd_host *host)
514 data->bytes_xfered++; 458 data->bytes_xfered++;
515 459
516 /* 460 /*
517 * Transfer done?
518 */
519 if (data->bytes_xfered == host->size)
520 return;
521
522 /*
523 * End of scatter list entry? 461 * End of scatter list entry?
524 */ 462 */
525 if (host->remain == 0) { 463 if (host->remain == 0) {
526 /* 464 /*
527 * Get next entry. Check if last. 465 * Get next entry. Check if last.
528 */ 466 */
529 if (!wbsd_next_sg(host)) { 467 if (!wbsd_next_sg(host))
530 /*
531 * We should never reach this point.
532 * It means that we're trying to
533 * transfer more blocks than can fit
534 * into the scatter list.
535 */
536 BUG_ON(1);
537
538 host->size = data->bytes_xfered;
539
540 return; 468 return;
541 }
542 469
543 buffer = wbsd_sg_to_buffer(host); 470 buffer = wbsd_sg_to_buffer(host);
544 } 471 }
@@ -550,7 +477,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host)
550 * hardware problem. The chip doesn't trigger 477 * hardware problem. The chip doesn't trigger
551 * FIFO threshold interrupts properly. 478 * FIFO threshold interrupts properly.
552 */ 479 */
553 if ((host->size - data->bytes_xfered) < 16) 480 if ((data->blocks * data->blksz - data->bytes_xfered) < 16)
554 tasklet_schedule(&host->fifo_tasklet); 481 tasklet_schedule(&host->fifo_tasklet);
555} 482}
556 483
@@ -564,7 +491,7 @@ static void wbsd_fill_fifo(struct wbsd_host *host)
564 * Check that we aren't being called after the 491 * Check that we aren't being called after the
565 * entire buffer has been transfered. 492 * entire buffer has been transfered.
566 */ 493 */
567 if (data->bytes_xfered == host->size) 494 if (host->num_sg == 0)
568 return; 495 return;
569 496
570 buffer = wbsd_sg_to_buffer(host) + host->offset; 497 buffer = wbsd_sg_to_buffer(host) + host->offset;
@@ -594,31 +521,14 @@ static void wbsd_fill_fifo(struct wbsd_host *host)
594 data->bytes_xfered++; 521 data->bytes_xfered++;
595 522
596 /* 523 /*
597 * Transfer done?
598 */
599 if (data->bytes_xfered == host->size)
600 return;
601
602 /*
603 * End of scatter list entry? 524 * End of scatter list entry?
604 */ 525 */
605 if (host->remain == 0) { 526 if (host->remain == 0) {
606 /* 527 /*
607 * Get next entry. Check if last. 528 * Get next entry. Check if last.
608 */ 529 */
609 if (!wbsd_next_sg(host)) { 530 if (!wbsd_next_sg(host))
610 /*
611 * We should never reach this point.
612 * It means that we're trying to
613 * transfer more blocks than can fit
614 * into the scatter list.
615 */
616 BUG_ON(1);
617
618 host->size = data->bytes_xfered;
619
620 return; 531 return;
621 }
622 532
623 buffer = wbsd_sg_to_buffer(host); 533 buffer = wbsd_sg_to_buffer(host);
624 } 534 }
@@ -638,6 +548,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
638 u16 blksize; 548 u16 blksize;
639 u8 setup; 549 u8 setup;
640 unsigned long dmaflags; 550 unsigned long dmaflags;
551 unsigned int size;
641 552
642 DBGF("blksz %04x blks %04x flags %08x\n", 553 DBGF("blksz %04x blks %04x flags %08x\n",
643 data->blksz, data->blocks, data->flags); 554 data->blksz, data->blocks, data->flags);
@@ -647,7 +558,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
647 /* 558 /*
648 * Calculate size. 559 * Calculate size.
649 */ 560 */
650 host->size = data->blocks * data->blksz; 561 size = data->blocks * data->blksz;
651 562
652 /* 563 /*
653 * Check timeout values for overflow. 564 * Check timeout values for overflow.
@@ -705,8 +616,8 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
705 /* 616 /*
706 * The buffer for DMA is only 64 kB. 617 * The buffer for DMA is only 64 kB.
707 */ 618 */
708 BUG_ON(host->size > 0x10000); 619 BUG_ON(size > 0x10000);
709 if (host->size > 0x10000) { 620 if (size > 0x10000) {
710 data->error = MMC_ERR_INVALID; 621 data->error = MMC_ERR_INVALID;
711 return; 622 return;
712 } 623 }
@@ -729,7 +640,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
729 else 640 else
730 set_dma_mode(host->dma, DMA_MODE_WRITE & ~0x40); 641 set_dma_mode(host->dma, DMA_MODE_WRITE & ~0x40);
731 set_dma_addr(host->dma, host->dma_addr); 642 set_dma_addr(host->dma, host->dma_addr);
732 set_dma_count(host->dma, host->size); 643 set_dma_count(host->dma, size);
733 644
734 enable_dma(host->dma); 645 enable_dma(host->dma);
735 release_dma_lock(dmaflags); 646 release_dma_lock(dmaflags);
@@ -812,6 +723,10 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
812 count = get_dma_residue(host->dma); 723 count = get_dma_residue(host->dma);
813 release_dma_lock(dmaflags); 724 release_dma_lock(dmaflags);
814 725
726 data->bytes_xfered = host->mrq->data->blocks *
727 host->mrq->data->blksz - count;
728 data->bytes_xfered -= data->bytes_xfered % data->blksz;
729
815 /* 730 /*
816 * Any leftover data? 731 * Any leftover data?
817 */ 732 */
@@ -820,7 +735,8 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
820 "%d bytes left.\n", 735 "%d bytes left.\n",
821 mmc_hostname(host->mmc), count); 736 mmc_hostname(host->mmc), count);
822 737
823 data->error = MMC_ERR_FAILED; 738 if (data->error == MMC_ERR_NONE)
739 data->error = MMC_ERR_FAILED;
824 } else { 740 } else {
825 /* 741 /*
826 * Transfer data from DMA buffer to 742 * Transfer data from DMA buffer to
@@ -828,8 +744,11 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
828 */ 744 */
829 if (data->flags & MMC_DATA_READ) 745 if (data->flags & MMC_DATA_READ)
830 wbsd_dma_to_sg(host, data); 746 wbsd_dma_to_sg(host, data);
747 }
831 748
832 data->bytes_xfered = host->size; 749 if (data->error != MMC_ERR_NONE) {
750 if (data->bytes_xfered)
751 data->bytes_xfered -= data->blksz;
833 } 752 }
834 } 753 }
835 754
@@ -869,24 +788,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
869 goto done; 788 goto done;
870 } 789 }
871 790
872 /*
873 * Does the request include data?
874 */
875 if (cmd->data) { 791 if (cmd->data) {
876 wbsd_prepare_data(host, cmd->data);
877
878 if (cmd->data->error != MMC_ERR_NONE)
879 goto done;
880 }
881
882 wbsd_send_command(host, cmd);
883
884 /*
885 * If this is a data transfer the request
886 * will be finished after the data has
887 * transfered.
888 */
889 if (cmd->data && (cmd->error == MMC_ERR_NONE)) {
890 /* 792 /*
891 * The hardware is so delightfully stupid that it has a list 793 * The hardware is so delightfully stupid that it has a list
892 * of "data" commands. If a command isn't on this list, it'll 794 * of "data" commands. If a command isn't on this list, it'll
@@ -918,14 +820,30 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
918 "supported by this controller.\n", 820 "supported by this controller.\n",
919 mmc_hostname(host->mmc), cmd->opcode); 821 mmc_hostname(host->mmc), cmd->opcode);
920#endif 822#endif
921 cmd->data->error = MMC_ERR_INVALID; 823 cmd->error = MMC_ERR_INVALID;
922
923 if (cmd->data->stop)
924 wbsd_send_command(host, cmd->data->stop);
925 824
926 goto done; 825 goto done;
927 }; 826 };
827 }
828
829 /*
830 * Does the request include data?
831 */
832 if (cmd->data) {
833 wbsd_prepare_data(host, cmd->data);
834
835 if (cmd->data->error != MMC_ERR_NONE)
836 goto done;
837 }
838
839 wbsd_send_command(host, cmd);
928 840
841 /*
842 * If this is a data transfer the request
843 * will be finished after the data has
844 * transfered.
845 */
846 if (cmd->data && (cmd->error == MMC_ERR_NONE)) {
929 /* 847 /*
930 * Dirty fix for hardware bug. 848 * Dirty fix for hardware bug.
931 */ 849 */
@@ -1167,7 +1085,7 @@ static void wbsd_tasklet_fifo(unsigned long param)
1167 /* 1085 /*
1168 * Done? 1086 * Done?
1169 */ 1087 */
1170 if (host->size == data->bytes_xfered) { 1088 if (host->num_sg == 0) {
1171 wbsd_write_index(host, WBSD_IDX_FIFOEN, 0); 1089 wbsd_write_index(host, WBSD_IDX_FIFOEN, 0);
1172 tasklet_schedule(&host->finish_tasklet); 1090 tasklet_schedule(&host->finish_tasklet);
1173 } 1091 }
@@ -1245,30 +1163,6 @@ end:
1245 spin_unlock(&host->lock); 1163 spin_unlock(&host->lock);
1246} 1164}
1247 1165
1248static void wbsd_tasklet_block(unsigned long param)
1249{
1250 struct wbsd_host *host = (struct wbsd_host *)param;
1251 struct mmc_data *data;
1252
1253 spin_lock(&host->lock);
1254
1255 if ((wbsd_read_index(host, WBSD_IDX_CRCSTATUS) & WBSD_CRC_MASK) !=
1256 WBSD_CRC_OK) {
1257 data = wbsd_get_data(host);
1258 if (!data)
1259 goto end;
1260
1261 DBGF("CRC error\n");
1262
1263 data->error = MMC_ERR_BADCRC;
1264
1265 tasklet_schedule(&host->finish_tasklet);
1266 }
1267
1268end:
1269 spin_unlock(&host->lock);
1270}
1271
1272/* 1166/*
1273 * Interrupt handling 1167 * Interrupt handling
1274 */ 1168 */
@@ -1299,8 +1193,6 @@ static irqreturn_t wbsd_irq(int irq, void *dev_id)
1299 tasklet_hi_schedule(&host->crc_tasklet); 1193 tasklet_hi_schedule(&host->crc_tasklet);
1300 if (isr & WBSD_INT_TIMEOUT) 1194 if (isr & WBSD_INT_TIMEOUT)
1301 tasklet_hi_schedule(&host->timeout_tasklet); 1195 tasklet_hi_schedule(&host->timeout_tasklet);
1302 if (isr & WBSD_INT_BUSYEND)
1303 tasklet_hi_schedule(&host->block_tasklet);
1304 if (isr & WBSD_INT_TC) 1196 if (isr & WBSD_INT_TC)
1305 tasklet_schedule(&host->finish_tasklet); 1197 tasklet_schedule(&host->finish_tasklet);
1306 1198
@@ -1601,8 +1493,6 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1601 (unsigned long)host); 1493 (unsigned long)host);
1602 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, 1494 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish,
1603 (unsigned long)host); 1495 (unsigned long)host);
1604 tasklet_init(&host->block_tasklet, wbsd_tasklet_block,
1605 (unsigned long)host);
1606 1496
1607 return 0; 1497 return 0;
1608} 1498}
@@ -1621,7 +1511,6 @@ static void __devexit wbsd_release_irq(struct wbsd_host *host)
1621 tasklet_kill(&host->crc_tasklet); 1511 tasklet_kill(&host->crc_tasklet);
1622 tasklet_kill(&host->timeout_tasklet); 1512 tasklet_kill(&host->timeout_tasklet);
1623 tasklet_kill(&host->finish_tasklet); 1513 tasklet_kill(&host->finish_tasklet);
1624 tasklet_kill(&host->block_tasklet);
1625} 1514}
1626 1515
1627/* 1516/*
diff --git a/drivers/mmc/wbsd.h b/drivers/mmc/host/wbsd.h
index d06718b0e2ab..873bda1e59b4 100644
--- a/drivers/mmc/wbsd.h
+++ b/drivers/mmc/host/wbsd.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/mmc/wbsd.h - Winbond W83L51xD SD/MMC driver 2 * linux/drivers/mmc/wbsd.h - Winbond W83L51xD SD/MMC driver
3 * 3 *
4 * Copyright (C) 2004-2005 Pierre Ossman, All Rights Reserved. 4 * Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@
46 46
47#define WBSD_EINT_CARD 0x40 47#define WBSD_EINT_CARD 0x40
48#define WBSD_EINT_FIFO_THRE 0x20 48#define WBSD_EINT_FIFO_THRE 0x20
49#define WBSD_EINT_CCRC 0x10 49#define WBSD_EINT_CRC 0x10
50#define WBSD_EINT_TIMEOUT 0x08 50#define WBSD_EINT_TIMEOUT 0x08
51#define WBSD_EINT_PROGEND 0x04 51#define WBSD_EINT_PROGEND 0x04
52#define WBSD_EINT_CRC 0x02 52#define WBSD_EINT_BUSYEND 0x02
53#define WBSD_EINT_TC 0x01 53#define WBSD_EINT_TC 0x01
54 54
55#define WBSD_INT_PENDING 0x80 55#define WBSD_INT_PENDING 0x80
@@ -158,8 +158,6 @@ struct wbsd_host
158 unsigned int offset; /* Offset into current entry */ 158 unsigned int offset; /* Offset into current entry */
159 unsigned int remain; /* Data left in curren entry */ 159 unsigned int remain; /* Data left in curren entry */
160 160
161 int size; /* Total size of transfer */
162
163 char* dma_buffer; /* ISA DMA buffer */ 161 char* dma_buffer; /* ISA DMA buffer */
164 dma_addr_t dma_addr; /* Physical address for same */ 162 dma_addr_t dma_addr; /* Physical address for same */
165 163
@@ -182,7 +180,6 @@ struct wbsd_host
182 struct tasklet_struct crc_tasklet; 180 struct tasklet_struct crc_tasklet;
183 struct tasklet_struct timeout_tasklet; 181 struct tasklet_struct timeout_tasklet;
184 struct tasklet_struct finish_tasklet; 182 struct tasklet_struct finish_tasklet;
185 struct tasklet_struct block_tasklet;
186 183
187 struct timer_list ignore_timer; /* Ignore detection timer */ 184 struct timer_list ignore_timer; /* Ignore detection timer */
188}; 185};
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
deleted file mode 100644
index 4a73e8b2428d..000000000000
--- a/drivers/mmc/mmc.c
+++ /dev/null
@@ -1,1724 +0,0 @@
1/*
2 * linux/drivers/mmc/mmc.c
3 *
4 * Copyright (C) 2003-2004 Russell King, All Rights Reserved.
5 * SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
6 * SD support Copyright (C) 2005 Pierre Ossman, All Rights Reserved.
7 * MMCv4 support Copyright (C) 2006 Philip Langdale, All Rights Reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/completion.h>
17#include <linux/device.h>
18#include <linux/delay.h>
19#include <linux/pagemap.h>
20#include <linux/err.h>
21#include <asm/scatterlist.h>
22#include <linux/scatterlist.h>
23
24#include <linux/mmc/card.h>
25#include <linux/mmc/host.h>
26#include <linux/mmc/protocol.h>
27
28#include "mmc.h"
29
30#define CMD_RETRIES 3
31
32/*
33 * OCR Bit positions to 10s of Vdd mV.
34 */
35static const unsigned short mmc_ocr_bit_to_vdd[] = {
36 150, 155, 160, 165, 170, 180, 190, 200,
37 210, 220, 230, 240, 250, 260, 270, 280,
38 290, 300, 310, 320, 330, 340, 350, 360
39};
40
41static const unsigned int tran_exp[] = {
42 10000, 100000, 1000000, 10000000,
43 0, 0, 0, 0
44};
45
46static const unsigned char tran_mant[] = {
47 0, 10, 12, 13, 15, 20, 25, 30,
48 35, 40, 45, 50, 55, 60, 70, 80,
49};
50
51static const unsigned int tacc_exp[] = {
52 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
53};
54
55static const unsigned int tacc_mant[] = {
56 0, 10, 12, 13, 15, 20, 25, 30,
57 35, 40, 45, 50, 55, 60, 70, 80,
58};
59
60
61/**
62 * mmc_request_done - finish processing an MMC request
63 * @host: MMC host which completed request
64 * @mrq: MMC request which request
65 *
66 * MMC drivers should call this function when they have completed
67 * their processing of a request.
68 */
69void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
70{
71 struct mmc_command *cmd = mrq->cmd;
72 int err = cmd->error;
73
74 pr_debug("%s: req done (CMD%u): %d/%d/%d: %08x %08x %08x %08x\n",
75 mmc_hostname(host), cmd->opcode, err,
76 mrq->data ? mrq->data->error : 0,
77 mrq->stop ? mrq->stop->error : 0,
78 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
79
80 if (err && cmd->retries) {
81 cmd->retries--;
82 cmd->error = 0;
83 host->ops->request(host, mrq);
84 } else if (mrq->done) {
85 mrq->done(mrq);
86 }
87}
88
89EXPORT_SYMBOL(mmc_request_done);
90
91/**
92 * mmc_start_request - start a command on a host
93 * @host: MMC host to start command on
94 * @mrq: MMC request to start
95 *
96 * Queue a command on the specified host. We expect the
97 * caller to be holding the host lock with interrupts disabled.
98 */
99void
100mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
101{
102 pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
103 mmc_hostname(host), mrq->cmd->opcode,
104 mrq->cmd->arg, mrq->cmd->flags);
105
106 WARN_ON(!host->claimed);
107
108 mrq->cmd->error = 0;
109 mrq->cmd->mrq = mrq;
110 if (mrq->data) {
111 BUG_ON(mrq->data->blksz > host->max_blk_size);
112 BUG_ON(mrq->data->blocks > host->max_blk_count);
113 BUG_ON(mrq->data->blocks * mrq->data->blksz >
114 host->max_req_size);
115
116 mrq->cmd->data = mrq->data;
117 mrq->data->error = 0;
118 mrq->data->mrq = mrq;
119 if (mrq->stop) {
120 mrq->data->stop = mrq->stop;
121 mrq->stop->error = 0;
122 mrq->stop->mrq = mrq;
123 }
124 }
125 host->ops->request(host, mrq);
126}
127
128EXPORT_SYMBOL(mmc_start_request);
129
130static void mmc_wait_done(struct mmc_request *mrq)
131{
132 complete(mrq->done_data);
133}
134
135int mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
136{
137 DECLARE_COMPLETION_ONSTACK(complete);
138
139 mrq->done_data = &complete;
140 mrq->done = mmc_wait_done;
141
142 mmc_start_request(host, mrq);
143
144 wait_for_completion(&complete);
145
146 return 0;
147}
148
149EXPORT_SYMBOL(mmc_wait_for_req);
150
151/**
152 * mmc_wait_for_cmd - start a command and wait for completion
153 * @host: MMC host to start command
154 * @cmd: MMC command to start
155 * @retries: maximum number of retries
156 *
157 * Start a new MMC command for a host, and wait for the command
158 * to complete. Return any error that occurred while the command
159 * was executing. Do not attempt to parse the response.
160 */
161int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries)
162{
163 struct mmc_request mrq;
164
165 BUG_ON(!host->claimed);
166
167 memset(&mrq, 0, sizeof(struct mmc_request));
168
169 memset(cmd->resp, 0, sizeof(cmd->resp));
170 cmd->retries = retries;
171
172 mrq.cmd = cmd;
173 cmd->data = NULL;
174
175 mmc_wait_for_req(host, &mrq);
176
177 return cmd->error;
178}
179
180EXPORT_SYMBOL(mmc_wait_for_cmd);
181
182/**
183 * mmc_wait_for_app_cmd - start an application command and wait for
184 completion
185 * @host: MMC host to start command
186 * @rca: RCA to send MMC_APP_CMD to
187 * @cmd: MMC command to start
188 * @retries: maximum number of retries
189 *
190 * Sends a MMC_APP_CMD, checks the card response, sends the command
191 * in the parameter and waits for it to complete. Return any error
192 * that occurred while the command was executing. Do not attempt to
193 * parse the response.
194 */
195int mmc_wait_for_app_cmd(struct mmc_host *host, unsigned int rca,
196 struct mmc_command *cmd, int retries)
197{
198 struct mmc_request mrq;
199 struct mmc_command appcmd;
200
201 int i, err;
202
203 BUG_ON(!host->claimed);
204 BUG_ON(retries < 0);
205
206 err = MMC_ERR_INVALID;
207
208 /*
209 * We have to resend MMC_APP_CMD for each attempt so
210 * we cannot use the retries field in mmc_command.
211 */
212 for (i = 0;i <= retries;i++) {
213 memset(&mrq, 0, sizeof(struct mmc_request));
214
215 appcmd.opcode = MMC_APP_CMD;
216 appcmd.arg = rca << 16;
217 appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
218 appcmd.retries = 0;
219 memset(appcmd.resp, 0, sizeof(appcmd.resp));
220 appcmd.data = NULL;
221
222 mrq.cmd = &appcmd;
223 appcmd.data = NULL;
224
225 mmc_wait_for_req(host, &mrq);
226
227 if (appcmd.error) {
228 err = appcmd.error;
229 continue;
230 }
231
232 /* Check that card supported application commands */
233 if (!(appcmd.resp[0] & R1_APP_CMD))
234 return MMC_ERR_FAILED;
235
236 memset(&mrq, 0, sizeof(struct mmc_request));
237
238 memset(cmd->resp, 0, sizeof(cmd->resp));
239 cmd->retries = 0;
240
241 mrq.cmd = cmd;
242 cmd->data = NULL;
243
244 mmc_wait_for_req(host, &mrq);
245
246 err = cmd->error;
247 if (cmd->error == MMC_ERR_NONE)
248 break;
249 }
250
251 return err;
252}
253
254EXPORT_SYMBOL(mmc_wait_for_app_cmd);
255
256/**
257 * mmc_set_data_timeout - set the timeout for a data command
258 * @data: data phase for command
259 * @card: the MMC card associated with the data transfer
260 * @write: flag to differentiate reads from writes
261 */
262void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
263 int write)
264{
265 unsigned int mult;
266
267 /*
268 * SD cards use a 100 multiplier rather than 10
269 */
270 mult = mmc_card_sd(card) ? 100 : 10;
271
272 /*
273 * Scale up the multiplier (and therefore the timeout) by
274 * the r2w factor for writes.
275 */
276 if (write)
277 mult <<= card->csd.r2w_factor;
278
279 data->timeout_ns = card->csd.tacc_ns * mult;
280 data->timeout_clks = card->csd.tacc_clks * mult;
281
282 /*
283 * SD cards also have an upper limit on the timeout.
284 */
285 if (mmc_card_sd(card)) {
286 unsigned int timeout_us, limit_us;
287
288 timeout_us = data->timeout_ns / 1000;
289 timeout_us += data->timeout_clks * 1000 /
290 (card->host->ios.clock / 1000);
291
292 if (write)
293 limit_us = 250000;
294 else
295 limit_us = 100000;
296
297 /*
298 * SDHC cards always use these fixed values.
299 */
300 if (timeout_us > limit_us || mmc_card_blockaddr(card)) {
301 data->timeout_ns = limit_us * 1000;
302 data->timeout_clks = 0;
303 }
304 }
305}
306EXPORT_SYMBOL(mmc_set_data_timeout);
307
308static int mmc_select_card(struct mmc_host *host, struct mmc_card *card);
309
310/**
311 * __mmc_claim_host - exclusively claim a host
312 * @host: mmc host to claim
313 * @card: mmc card to claim host for
314 *
315 * Claim a host for a set of operations. If a valid card
316 * is passed and this wasn't the last card selected, select
317 * the card before returning.
318 *
319 * Note: you should use mmc_card_claim_host or mmc_claim_host.
320 */
321int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card)
322{
323 DECLARE_WAITQUEUE(wait, current);
324 unsigned long flags;
325 int err = 0;
326
327 add_wait_queue(&host->wq, &wait);
328 spin_lock_irqsave(&host->lock, flags);
329 while (1) {
330 set_current_state(TASK_UNINTERRUPTIBLE);
331 if (!host->claimed)
332 break;
333 spin_unlock_irqrestore(&host->lock, flags);
334 schedule();
335 spin_lock_irqsave(&host->lock, flags);
336 }
337 set_current_state(TASK_RUNNING);
338 host->claimed = 1;
339 spin_unlock_irqrestore(&host->lock, flags);
340 remove_wait_queue(&host->wq, &wait);
341
342 if (card != (void *)-1) {
343 err = mmc_select_card(host, card);
344 if (err != MMC_ERR_NONE)
345 return err;
346 }
347
348 return err;
349}
350
351EXPORT_SYMBOL(__mmc_claim_host);
352
353/**
354 * mmc_release_host - release a host
355 * @host: mmc host to release
356 *
357 * Release a MMC host, allowing others to claim the host
358 * for their operations.
359 */
360void mmc_release_host(struct mmc_host *host)
361{
362 unsigned long flags;
363
364 BUG_ON(!host->claimed);
365
366 spin_lock_irqsave(&host->lock, flags);
367 host->claimed = 0;
368 spin_unlock_irqrestore(&host->lock, flags);
369
370 wake_up(&host->wq);
371}
372
373EXPORT_SYMBOL(mmc_release_host);
374
375static inline void mmc_set_ios(struct mmc_host *host)
376{
377 struct mmc_ios *ios = &host->ios;
378
379 pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u "
380 "width %u timing %u\n",
381 mmc_hostname(host), ios->clock, ios->bus_mode,
382 ios->power_mode, ios->chip_select, ios->vdd,
383 ios->bus_width, ios->timing);
384
385 host->ops->set_ios(host, ios);
386}
387
388static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
389{
390 int err;
391 struct mmc_command cmd;
392
393 BUG_ON(!host->claimed);
394
395 if (host->card_selected == card)
396 return MMC_ERR_NONE;
397
398 host->card_selected = card;
399
400 cmd.opcode = MMC_SELECT_CARD;
401 cmd.arg = card->rca << 16;
402 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
403
404 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
405 if (err != MMC_ERR_NONE)
406 return err;
407
408 /*
409 * We can only change the bus width of SD cards when
410 * they are selected so we have to put the handling
411 * here.
412 *
413 * The card is in 1 bit mode by default so
414 * we only need to change if it supports the
415 * wider version.
416 */
417 if (mmc_card_sd(card) &&
418 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
419
420 /*
421 * Default bus width is 1 bit.
422 */
423 host->ios.bus_width = MMC_BUS_WIDTH_1;
424
425 if (host->caps & MMC_CAP_4_BIT_DATA) {
426 struct mmc_command cmd;
427 cmd.opcode = SD_APP_SET_BUS_WIDTH;
428 cmd.arg = SD_BUS_WIDTH_4;
429 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
430
431 err = mmc_wait_for_app_cmd(host, card->rca, &cmd,
432 CMD_RETRIES);
433 if (err != MMC_ERR_NONE)
434 return err;
435
436 host->ios.bus_width = MMC_BUS_WIDTH_4;
437 }
438 }
439
440 mmc_set_ios(host);
441
442 return MMC_ERR_NONE;
443}
444
445/*
446 * Ensure that no card is selected.
447 */
448static void mmc_deselect_cards(struct mmc_host *host)
449{
450 struct mmc_command cmd;
451
452 if (host->card_selected) {
453 host->card_selected = NULL;
454
455 cmd.opcode = MMC_SELECT_CARD;
456 cmd.arg = 0;
457 cmd.flags = MMC_RSP_NONE | MMC_CMD_AC;
458
459 mmc_wait_for_cmd(host, &cmd, 0);
460 }
461}
462
463
464static inline void mmc_delay(unsigned int ms)
465{
466 if (ms < 1000 / HZ) {
467 cond_resched();
468 mdelay(ms);
469 } else {
470 msleep(ms);
471 }
472}
473
474/*
475 * Mask off any voltages we don't support and select
476 * the lowest voltage
477 */
478static u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
479{
480 int bit;
481
482 ocr &= host->ocr_avail;
483
484 bit = ffs(ocr);
485 if (bit) {
486 bit -= 1;
487
488 ocr &= 3 << bit;
489
490 host->ios.vdd = bit;
491 mmc_set_ios(host);
492 } else {
493 ocr = 0;
494 }
495
496 return ocr;
497}
498
499#define UNSTUFF_BITS(resp,start,size) \
500 ({ \
501 const int __size = size; \
502 const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
503 const int __off = 3 - ((start) / 32); \
504 const int __shft = (start) & 31; \
505 u32 __res; \
506 \
507 __res = resp[__off] >> __shft; \
508 if (__size + __shft > 32) \
509 __res |= resp[__off-1] << ((32 - __shft) % 32); \
510 __res & __mask; \
511 })
512
513/*
514 * Given the decoded CSD structure, decode the raw CID to our CID structure.
515 */
516static void mmc_decode_cid(struct mmc_card *card)
517{
518 u32 *resp = card->raw_cid;
519
520 memset(&card->cid, 0, sizeof(struct mmc_cid));
521
522 if (mmc_card_sd(card)) {
523 /*
524 * SD doesn't currently have a version field so we will
525 * have to assume we can parse this.
526 */
527 card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
528 card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
529 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
530 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
531 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
532 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
533 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
534 card->cid.hwrev = UNSTUFF_BITS(resp, 60, 4);
535 card->cid.fwrev = UNSTUFF_BITS(resp, 56, 4);
536 card->cid.serial = UNSTUFF_BITS(resp, 24, 32);
537 card->cid.year = UNSTUFF_BITS(resp, 12, 8);
538 card->cid.month = UNSTUFF_BITS(resp, 8, 4);
539
540 card->cid.year += 2000; /* SD cards year offset */
541 } else {
542 /*
543 * The selection of the format here is based upon published
544 * specs from sandisk and from what people have reported.
545 */
546 switch (card->csd.mmca_vsn) {
547 case 0: /* MMC v1.0 - v1.2 */
548 case 1: /* MMC v1.4 */
549 card->cid.manfid = UNSTUFF_BITS(resp, 104, 24);
550 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
551 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
552 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
553 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
554 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
555 card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
556 card->cid.prod_name[6] = UNSTUFF_BITS(resp, 48, 8);
557 card->cid.hwrev = UNSTUFF_BITS(resp, 44, 4);
558 card->cid.fwrev = UNSTUFF_BITS(resp, 40, 4);
559 card->cid.serial = UNSTUFF_BITS(resp, 16, 24);
560 card->cid.month = UNSTUFF_BITS(resp, 12, 4);
561 card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
562 break;
563
564 case 2: /* MMC v2.0 - v2.2 */
565 case 3: /* MMC v3.1 - v3.3 */
566 case 4: /* MMC v4 */
567 card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
568 card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
569 card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
570 card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
571 card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
572 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
573 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
574 card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
575 card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
576 card->cid.month = UNSTUFF_BITS(resp, 12, 4);
577 card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
578 break;
579
580 default:
581 printk("%s: card has unknown MMCA version %d\n",
582 mmc_hostname(card->host), card->csd.mmca_vsn);
583 mmc_card_set_bad(card);
584 break;
585 }
586 }
587}
588
589/*
590 * Given a 128-bit response, decode to our card CSD structure.
591 */
592static void mmc_decode_csd(struct mmc_card *card)
593{
594 struct mmc_csd *csd = &card->csd;
595 unsigned int e, m, csd_struct;
596 u32 *resp = card->raw_csd;
597
598 if (mmc_card_sd(card)) {
599 csd_struct = UNSTUFF_BITS(resp, 126, 2);
600
601 switch (csd_struct) {
602 case 0:
603 m = UNSTUFF_BITS(resp, 115, 4);
604 e = UNSTUFF_BITS(resp, 112, 3);
605 csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10;
606 csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100;
607
608 m = UNSTUFF_BITS(resp, 99, 4);
609 e = UNSTUFF_BITS(resp, 96, 3);
610 csd->max_dtr = tran_exp[e] * tran_mant[m];
611 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
612
613 e = UNSTUFF_BITS(resp, 47, 3);
614 m = UNSTUFF_BITS(resp, 62, 12);
615 csd->capacity = (1 + m) << (e + 2);
616
617 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
618 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
619 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
620 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
621 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
622 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
623 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
624 break;
625 case 1:
626 /*
627 * This is a block-addressed SDHC card. Most
628 * interesting fields are unused and have fixed
629 * values. To avoid getting tripped by buggy cards,
630 * we assume those fixed values ourselves.
631 */
632 mmc_card_set_blockaddr(card);
633
634 csd->tacc_ns = 0; /* Unused */
635 csd->tacc_clks = 0; /* Unused */
636
637 m = UNSTUFF_BITS(resp, 99, 4);
638 e = UNSTUFF_BITS(resp, 96, 3);
639 csd->max_dtr = tran_exp[e] * tran_mant[m];
640 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
641
642 m = UNSTUFF_BITS(resp, 48, 22);
643 csd->capacity = (1 + m) << 10;
644
645 csd->read_blkbits = 9;
646 csd->read_partial = 0;
647 csd->write_misalign = 0;
648 csd->read_misalign = 0;
649 csd->r2w_factor = 4; /* Unused */
650 csd->write_blkbits = 9;
651 csd->write_partial = 0;
652 break;
653 default:
654 printk("%s: unrecognised CSD structure version %d\n",
655 mmc_hostname(card->host), csd_struct);
656 mmc_card_set_bad(card);
657 return;
658 }
659 } else {
660 /*
661 * We only understand CSD structure v1.1 and v1.2.
662 * v1.2 has extra information in bits 15, 11 and 10.
663 */
664 csd_struct = UNSTUFF_BITS(resp, 126, 2);
665 if (csd_struct != 1 && csd_struct != 2) {
666 printk("%s: unrecognised CSD structure version %d\n",
667 mmc_hostname(card->host), csd_struct);
668 mmc_card_set_bad(card);
669 return;
670 }
671
672 csd->mmca_vsn = UNSTUFF_BITS(resp, 122, 4);
673 m = UNSTUFF_BITS(resp, 115, 4);
674 e = UNSTUFF_BITS(resp, 112, 3);
675 csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10;
676 csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100;
677
678 m = UNSTUFF_BITS(resp, 99, 4);
679 e = UNSTUFF_BITS(resp, 96, 3);
680 csd->max_dtr = tran_exp[e] * tran_mant[m];
681 csd->cmdclass = UNSTUFF_BITS(resp, 84, 12);
682
683 e = UNSTUFF_BITS(resp, 47, 3);
684 m = UNSTUFF_BITS(resp, 62, 12);
685 csd->capacity = (1 + m) << (e + 2);
686
687 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
688 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
689 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
690 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
691 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
692 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
693 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
694 }
695}
696
697/*
698 * Given a 64-bit response, decode to our card SCR structure.
699 */
700static void mmc_decode_scr(struct mmc_card *card)
701{
702 struct sd_scr *scr = &card->scr;
703 unsigned int scr_struct;
704 u32 resp[4];
705
706 BUG_ON(!mmc_card_sd(card));
707
708 resp[3] = card->raw_scr[1];
709 resp[2] = card->raw_scr[0];
710
711 scr_struct = UNSTUFF_BITS(resp, 60, 4);
712 if (scr_struct != 0) {
713 printk("%s: unrecognised SCR structure version %d\n",
714 mmc_hostname(card->host), scr_struct);
715 mmc_card_set_bad(card);
716 return;
717 }
718
719 scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4);
720 scr->bus_widths = UNSTUFF_BITS(resp, 48, 4);
721}
722
723/*
724 * Locate a MMC card on this MMC host given a raw CID.
725 */
726static struct mmc_card *mmc_find_card(struct mmc_host *host, u32 *raw_cid)
727{
728 struct mmc_card *card;
729
730 list_for_each_entry(card, &host->cards, node) {
731 if (memcmp(card->raw_cid, raw_cid, sizeof(card->raw_cid)) == 0)
732 return card;
733 }
734 return NULL;
735}
736
737/*
738 * Allocate a new MMC card, and assign a unique RCA.
739 */
740static struct mmc_card *
741mmc_alloc_card(struct mmc_host *host, u32 *raw_cid, unsigned int *frca)
742{
743 struct mmc_card *card, *c;
744 unsigned int rca = *frca;
745
746 card = kmalloc(sizeof(struct mmc_card), GFP_KERNEL);
747 if (!card)
748 return ERR_PTR(-ENOMEM);
749
750 mmc_init_card(card, host);
751 memcpy(card->raw_cid, raw_cid, sizeof(card->raw_cid));
752
753 again:
754 list_for_each_entry(c, &host->cards, node)
755 if (c->rca == rca) {
756 rca++;
757 goto again;
758 }
759
760 card->rca = rca;
761
762 *frca = rca;
763
764 return card;
765}
766
767/*
768 * Tell attached cards to go to IDLE state
769 */
770static void mmc_idle_cards(struct mmc_host *host)
771{
772 struct mmc_command cmd;
773
774 host->ios.chip_select = MMC_CS_HIGH;
775 mmc_set_ios(host);
776
777 mmc_delay(1);
778
779 cmd.opcode = MMC_GO_IDLE_STATE;
780 cmd.arg = 0;
781 cmd.flags = MMC_RSP_NONE | MMC_CMD_BC;
782
783 mmc_wait_for_cmd(host, &cmd, 0);
784
785 mmc_delay(1);
786
787 host->ios.chip_select = MMC_CS_DONTCARE;
788 mmc_set_ios(host);
789
790 mmc_delay(1);
791}
792
793/*
794 * Apply power to the MMC stack. This is a two-stage process.
795 * First, we enable power to the card without the clock running.
796 * We then wait a bit for the power to stabilise. Finally,
797 * enable the bus drivers and clock to the card.
798 *
799 * We must _NOT_ enable the clock prior to power stablising.
800 *
801 * If a host does all the power sequencing itself, ignore the
802 * initial MMC_POWER_UP stage.
803 */
804static void mmc_power_up(struct mmc_host *host)
805{
806 int bit = fls(host->ocr_avail) - 1;
807
808 host->ios.vdd = bit;
809 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
810 host->ios.chip_select = MMC_CS_DONTCARE;
811 host->ios.power_mode = MMC_POWER_UP;
812 host->ios.bus_width = MMC_BUS_WIDTH_1;
813 host->ios.timing = MMC_TIMING_LEGACY;
814 mmc_set_ios(host);
815
816 mmc_delay(1);
817
818 host->ios.clock = host->f_min;
819 host->ios.power_mode = MMC_POWER_ON;
820 mmc_set_ios(host);
821
822 mmc_delay(2);
823}
824
825static void mmc_power_off(struct mmc_host *host)
826{
827 host->ios.clock = 0;
828 host->ios.vdd = 0;
829 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
830 host->ios.chip_select = MMC_CS_DONTCARE;
831 host->ios.power_mode = MMC_POWER_OFF;
832 host->ios.bus_width = MMC_BUS_WIDTH_1;
833 host->ios.timing = MMC_TIMING_LEGACY;
834 mmc_set_ios(host);
835}
836
837static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
838{
839 struct mmc_command cmd;
840 int i, err = 0;
841
842 cmd.opcode = MMC_SEND_OP_COND;
843 cmd.arg = ocr;
844 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
845
846 for (i = 100; i; i--) {
847 err = mmc_wait_for_cmd(host, &cmd, 0);
848 if (err != MMC_ERR_NONE)
849 break;
850
851 if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
852 break;
853
854 err = MMC_ERR_TIMEOUT;
855
856 mmc_delay(10);
857 }
858
859 if (rocr)
860 *rocr = cmd.resp[0];
861
862 return err;
863}
864
865static int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
866{
867 struct mmc_command cmd;
868 int i, err = 0;
869
870 cmd.opcode = SD_APP_OP_COND;
871 cmd.arg = ocr;
872 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
873
874 for (i = 100; i; i--) {
875 err = mmc_wait_for_app_cmd(host, 0, &cmd, CMD_RETRIES);
876 if (err != MMC_ERR_NONE)
877 break;
878
879 if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
880 break;
881
882 err = MMC_ERR_TIMEOUT;
883
884 mmc_delay(10);
885 }
886
887 if (rocr)
888 *rocr = cmd.resp[0];
889
890 return err;
891}
892
893static int mmc_send_if_cond(struct mmc_host *host, u32 ocr, int *rsd2)
894{
895 struct mmc_command cmd;
896 int err, sd2;
897 static const u8 test_pattern = 0xAA;
898
899 /*
900 * To support SD 2.0 cards, we must always invoke SD_SEND_IF_COND
901 * before SD_APP_OP_COND. This command will harmlessly fail for
902 * SD 1.0 cards.
903 */
904 cmd.opcode = SD_SEND_IF_COND;
905 cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | test_pattern;
906 cmd.flags = MMC_RSP_R7 | MMC_CMD_BCR;
907
908 err = mmc_wait_for_cmd(host, &cmd, 0);
909 if (err == MMC_ERR_NONE) {
910 if ((cmd.resp[0] & 0xFF) == test_pattern) {
911 sd2 = 1;
912 } else {
913 sd2 = 0;
914 err = MMC_ERR_FAILED;
915 }
916 } else {
917 /*
918 * Treat errors as SD 1.0 card.
919 */
920 sd2 = 0;
921 err = MMC_ERR_NONE;
922 }
923 if (rsd2)
924 *rsd2 = sd2;
925 return err;
926}
927
928/*
929 * Discover cards by requesting their CID. If this command
930 * times out, it is not an error; there are no further cards
931 * to be discovered. Add new cards to the list.
932 *
933 * Create a mmc_card entry for each discovered card, assigning
934 * it an RCA, and save the raw CID for decoding later.
935 */
936static void mmc_discover_cards(struct mmc_host *host)
937{
938 struct mmc_card *card;
939 unsigned int first_rca = 1, err;
940
941 while (1) {
942 struct mmc_command cmd;
943
944 cmd.opcode = MMC_ALL_SEND_CID;
945 cmd.arg = 0;
946 cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
947
948 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
949 if (err == MMC_ERR_TIMEOUT) {
950 err = MMC_ERR_NONE;
951 break;
952 }
953 if (err != MMC_ERR_NONE) {
954 printk(KERN_ERR "%s: error requesting CID: %d\n",
955 mmc_hostname(host), err);
956 break;
957 }
958
959 card = mmc_find_card(host, cmd.resp);
960 if (!card) {
961 card = mmc_alloc_card(host, cmd.resp, &first_rca);
962 if (IS_ERR(card)) {
963 err = PTR_ERR(card);
964 break;
965 }
966 list_add(&card->node, &host->cards);
967 }
968
969 card->state &= ~MMC_STATE_DEAD;
970
971 if (host->mode == MMC_MODE_SD) {
972 mmc_card_set_sd(card);
973
974 cmd.opcode = SD_SEND_RELATIVE_ADDR;
975 cmd.arg = 0;
976 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
977
978 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
979 if (err != MMC_ERR_NONE)
980 mmc_card_set_dead(card);
981 else {
982 card->rca = cmd.resp[0] >> 16;
983
984 if (!host->ops->get_ro) {
985 printk(KERN_WARNING "%s: host does not "
986 "support reading read-only "
987 "switch. assuming write-enable.\n",
988 mmc_hostname(host));
989 } else {
990 if (host->ops->get_ro(host))
991 mmc_card_set_readonly(card);
992 }
993 }
994 } else {
995 cmd.opcode = MMC_SET_RELATIVE_ADDR;
996 cmd.arg = card->rca << 16;
997 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
998
999 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1000 if (err != MMC_ERR_NONE)
1001 mmc_card_set_dead(card);
1002 }
1003 }
1004}
1005
1006static void mmc_read_csds(struct mmc_host *host)
1007{
1008 struct mmc_card *card;
1009
1010 list_for_each_entry(card, &host->cards, node) {
1011 struct mmc_command cmd;
1012 int err;
1013
1014 if (card->state & (MMC_STATE_DEAD|MMC_STATE_PRESENT))
1015 continue;
1016
1017 cmd.opcode = MMC_SEND_CSD;
1018 cmd.arg = card->rca << 16;
1019 cmd.flags = MMC_RSP_R2 | MMC_CMD_AC;
1020
1021 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1022 if (err != MMC_ERR_NONE) {
1023 mmc_card_set_dead(card);
1024 continue;
1025 }
1026
1027 memcpy(card->raw_csd, cmd.resp, sizeof(card->raw_csd));
1028
1029 mmc_decode_csd(card);
1030 mmc_decode_cid(card);
1031 }
1032}
1033
1034static void mmc_process_ext_csds(struct mmc_host *host)
1035{
1036 int err;
1037 struct mmc_card *card;
1038
1039 struct mmc_request mrq;
1040 struct mmc_command cmd;
1041 struct mmc_data data;
1042
1043 struct scatterlist sg;
1044
1045 /*
1046 * As the ext_csd is so large and mostly unused, we don't store the
1047 * raw block in mmc_card.
1048 */
1049 u8 *ext_csd;
1050 ext_csd = kmalloc(512, GFP_KERNEL);
1051 if (!ext_csd) {
1052 printk("%s: could not allocate a buffer to receive the ext_csd."
1053 "mmc v4 cards will be treated as v3.\n",
1054 mmc_hostname(host));
1055 return;
1056 }
1057
1058 list_for_each_entry(card, &host->cards, node) {
1059 if (card->state & (MMC_STATE_DEAD|MMC_STATE_PRESENT))
1060 continue;
1061 if (mmc_card_sd(card))
1062 continue;
1063 if (card->csd.mmca_vsn < CSD_SPEC_VER_4)
1064 continue;
1065
1066 err = mmc_select_card(host, card);
1067 if (err != MMC_ERR_NONE) {
1068 mmc_card_set_dead(card);
1069 continue;
1070 }
1071
1072 memset(&cmd, 0, sizeof(struct mmc_command));
1073
1074 cmd.opcode = MMC_SEND_EXT_CSD;
1075 cmd.arg = 0;
1076 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
1077
1078 memset(&data, 0, sizeof(struct mmc_data));
1079
1080 mmc_set_data_timeout(&data, card, 0);
1081
1082 data.blksz = 512;
1083 data.blocks = 1;
1084 data.flags = MMC_DATA_READ;
1085 data.sg = &sg;
1086 data.sg_len = 1;
1087
1088 memset(&mrq, 0, sizeof(struct mmc_request));
1089
1090 mrq.cmd = &cmd;
1091 mrq.data = &data;
1092
1093 sg_init_one(&sg, ext_csd, 512);
1094
1095 mmc_wait_for_req(host, &mrq);
1096
1097 if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) {
1098 printk("%s: unable to read EXT_CSD, performance "
1099 "might suffer.\n", mmc_hostname(card->host));
1100 continue;
1101 }
1102
1103 switch (ext_csd[EXT_CSD_CARD_TYPE]) {
1104 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26:
1105 card->ext_csd.hs_max_dtr = 52000000;
1106 break;
1107 case EXT_CSD_CARD_TYPE_26:
1108 card->ext_csd.hs_max_dtr = 26000000;
1109 break;
1110 default:
1111 /* MMC v4 spec says this cannot happen */
1112 printk("%s: card is mmc v4 but doesn't support "
1113 "any high-speed modes.\n",
1114 mmc_hostname(card->host));
1115 continue;
1116 }
1117
1118 if (host->caps & MMC_CAP_MMC_HIGHSPEED) {
1119 /* Activate highspeed support. */
1120 cmd.opcode = MMC_SWITCH;
1121 cmd.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
1122 (EXT_CSD_HS_TIMING << 16) |
1123 (1 << 8) |
1124 EXT_CSD_CMD_SET_NORMAL;
1125 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
1126
1127 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1128 if (err != MMC_ERR_NONE) {
1129 printk("%s: failed to switch card to mmc v4 "
1130 "high-speed mode.\n",
1131 mmc_hostname(card->host));
1132 continue;
1133 }
1134
1135 mmc_card_set_highspeed(card);
1136
1137 host->ios.timing = MMC_TIMING_SD_HS;
1138 mmc_set_ios(host);
1139 }
1140
1141 /* Check for host support for wide-bus modes. */
1142 if (host->caps & MMC_CAP_4_BIT_DATA) {
1143 /* Activate 4-bit support. */
1144 cmd.opcode = MMC_SWITCH;
1145 cmd.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
1146 (EXT_CSD_BUS_WIDTH << 16) |
1147 (EXT_CSD_BUS_WIDTH_4 << 8) |
1148 EXT_CSD_CMD_SET_NORMAL;
1149 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
1150
1151 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1152 if (err != MMC_ERR_NONE) {
1153 printk("%s: failed to switch card to "
1154 "mmc v4 4-bit bus mode.\n",
1155 mmc_hostname(card->host));
1156 continue;
1157 }
1158
1159 host->ios.bus_width = MMC_BUS_WIDTH_4;
1160 mmc_set_ios(host);
1161 }
1162 }
1163
1164 kfree(ext_csd);
1165
1166 mmc_deselect_cards(host);
1167}
1168
1169static void mmc_read_scrs(struct mmc_host *host)
1170{
1171 int err;
1172 struct mmc_card *card;
1173 struct mmc_request mrq;
1174 struct mmc_command cmd;
1175 struct mmc_data data;
1176 struct scatterlist sg;
1177
1178 list_for_each_entry(card, &host->cards, node) {
1179 if (card->state & (MMC_STATE_DEAD|MMC_STATE_PRESENT))
1180 continue;
1181 if (!mmc_card_sd(card))
1182 continue;
1183
1184 err = mmc_select_card(host, card);
1185 if (err != MMC_ERR_NONE) {
1186 mmc_card_set_dead(card);
1187 continue;
1188 }
1189
1190 memset(&cmd, 0, sizeof(struct mmc_command));
1191
1192 cmd.opcode = MMC_APP_CMD;
1193 cmd.arg = card->rca << 16;
1194 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
1195
1196 err = mmc_wait_for_cmd(host, &cmd, 0);
1197 if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) {
1198 mmc_card_set_dead(card);
1199 continue;
1200 }
1201
1202 memset(&cmd, 0, sizeof(struct mmc_command));
1203
1204 cmd.opcode = SD_APP_SEND_SCR;
1205 cmd.arg = 0;
1206 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
1207
1208 memset(&data, 0, sizeof(struct mmc_data));
1209
1210 mmc_set_data_timeout(&data, card, 0);
1211
1212 data.blksz = 1 << 3;
1213 data.blocks = 1;
1214 data.flags = MMC_DATA_READ;
1215 data.sg = &sg;
1216 data.sg_len = 1;
1217
1218 memset(&mrq, 0, sizeof(struct mmc_request));
1219
1220 mrq.cmd = &cmd;
1221 mrq.data = &data;
1222
1223 sg_init_one(&sg, (u8*)card->raw_scr, 8);
1224
1225 mmc_wait_for_req(host, &mrq);
1226
1227 if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) {
1228 mmc_card_set_dead(card);
1229 continue;
1230 }
1231
1232 card->raw_scr[0] = ntohl(card->raw_scr[0]);
1233 card->raw_scr[1] = ntohl(card->raw_scr[1]);
1234
1235 mmc_decode_scr(card);
1236 }
1237
1238 mmc_deselect_cards(host);
1239}
1240
1241static void mmc_read_switch_caps(struct mmc_host *host)
1242{
1243 int err;
1244 struct mmc_card *card;
1245 struct mmc_request mrq;
1246 struct mmc_command cmd;
1247 struct mmc_data data;
1248 unsigned char *status;
1249 struct scatterlist sg;
1250
1251 if (!(host->caps & MMC_CAP_SD_HIGHSPEED))
1252 return;
1253
1254 status = kmalloc(64, GFP_KERNEL);
1255 if (!status) {
1256 printk(KERN_WARNING "%s: Unable to allocate buffer for "
1257 "reading switch capabilities.\n",
1258 mmc_hostname(host));
1259 return;
1260 }
1261
1262 list_for_each_entry(card, &host->cards, node) {
1263 if (card->state & (MMC_STATE_DEAD|MMC_STATE_PRESENT))
1264 continue;
1265 if (!mmc_card_sd(card))
1266 continue;
1267 if (card->scr.sda_vsn < SCR_SPEC_VER_1)
1268 continue;
1269
1270 err = mmc_select_card(host, card);
1271 if (err != MMC_ERR_NONE) {
1272 mmc_card_set_dead(card);
1273 continue;
1274 }
1275
1276 memset(&cmd, 0, sizeof(struct mmc_command));
1277
1278 cmd.opcode = SD_SWITCH;
1279 cmd.arg = 0x00FFFFF1;
1280 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
1281
1282 memset(&data, 0, sizeof(struct mmc_data));
1283
1284 mmc_set_data_timeout(&data, card, 0);
1285
1286 data.blksz = 64;
1287 data.blocks = 1;
1288 data.flags = MMC_DATA_READ;
1289 data.sg = &sg;
1290 data.sg_len = 1;
1291
1292 memset(&mrq, 0, sizeof(struct mmc_request));
1293
1294 mrq.cmd = &cmd;
1295 mrq.data = &data;
1296
1297 sg_init_one(&sg, status, 64);
1298
1299 mmc_wait_for_req(host, &mrq);
1300
1301 if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) {
1302 printk("%s: unable to read switch capabilities, "
1303 "performance might suffer.\n",
1304 mmc_hostname(card->host));
1305 continue;
1306 }
1307
1308 if (status[13] & 0x02)
1309 card->sw_caps.hs_max_dtr = 50000000;
1310
1311 memset(&cmd, 0, sizeof(struct mmc_command));
1312
1313 cmd.opcode = SD_SWITCH;
1314 cmd.arg = 0x80FFFFF1;
1315 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
1316
1317 memset(&data, 0, sizeof(struct mmc_data));
1318
1319 mmc_set_data_timeout(&data, card, 0);
1320
1321 data.blksz = 64;
1322 data.blocks = 1;
1323 data.flags = MMC_DATA_READ;
1324 data.sg = &sg;
1325 data.sg_len = 1;
1326
1327 memset(&mrq, 0, sizeof(struct mmc_request));
1328
1329 mrq.cmd = &cmd;
1330 mrq.data = &data;
1331
1332 sg_init_one(&sg, status, 64);
1333
1334 mmc_wait_for_req(host, &mrq);
1335
1336 if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE ||
1337 (status[16] & 0xF) != 1) {
1338 printk(KERN_WARNING "%s: Problem switching card "
1339 "into high-speed mode!\n",
1340 mmc_hostname(host));
1341 continue;
1342 }
1343
1344 mmc_card_set_highspeed(card);
1345
1346 host->ios.timing = MMC_TIMING_SD_HS;
1347 mmc_set_ios(host);
1348 }
1349
1350 kfree(status);
1351
1352 mmc_deselect_cards(host);
1353}
1354
1355static unsigned int mmc_calculate_clock(struct mmc_host *host)
1356{
1357 struct mmc_card *card;
1358 unsigned int max_dtr = host->f_max;
1359
1360 list_for_each_entry(card, &host->cards, node)
1361 if (!mmc_card_dead(card)) {
1362 if (mmc_card_highspeed(card) && mmc_card_sd(card)) {
1363 if (max_dtr > card->sw_caps.hs_max_dtr)
1364 max_dtr = card->sw_caps.hs_max_dtr;
1365 } else if (mmc_card_highspeed(card) && !mmc_card_sd(card)) {
1366 if (max_dtr > card->ext_csd.hs_max_dtr)
1367 max_dtr = card->ext_csd.hs_max_dtr;
1368 } else if (max_dtr > card->csd.max_dtr) {
1369 max_dtr = card->csd.max_dtr;
1370 }
1371 }
1372
1373 pr_debug("%s: selected %d.%03dMHz transfer rate\n",
1374 mmc_hostname(host),
1375 max_dtr / 1000000, (max_dtr / 1000) % 1000);
1376
1377 return max_dtr;
1378}
1379
1380/*
1381 * Check whether cards we already know about are still present.
1382 * We do this by requesting status, and checking whether a card
1383 * responds.
1384 *
1385 * A request for status does not cause a state change in data
1386 * transfer mode.
1387 */
1388static void mmc_check_cards(struct mmc_host *host)
1389{
1390 struct list_head *l, *n;
1391
1392 mmc_deselect_cards(host);
1393
1394 list_for_each_safe(l, n, &host->cards) {
1395 struct mmc_card *card = mmc_list_to_card(l);
1396 struct mmc_command cmd;
1397 int err;
1398
1399 cmd.opcode = MMC_SEND_STATUS;
1400 cmd.arg = card->rca << 16;
1401 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
1402
1403 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1404 if (err == MMC_ERR_NONE)
1405 continue;
1406
1407 mmc_card_set_dead(card);
1408 }
1409}
1410
1411static void mmc_setup(struct mmc_host *host)
1412{
1413 if (host->ios.power_mode != MMC_POWER_ON) {
1414 int err;
1415 u32 ocr;
1416
1417 host->mode = MMC_MODE_SD;
1418
1419 mmc_power_up(host);
1420 mmc_idle_cards(host);
1421
1422 err = mmc_send_if_cond(host, host->ocr_avail, NULL);
1423 if (err != MMC_ERR_NONE) {
1424 return;
1425 }
1426 err = mmc_send_app_op_cond(host, 0, &ocr);
1427
1428 /*
1429 * If we fail to detect any SD cards then try
1430 * searching for MMC cards.
1431 */
1432 if (err != MMC_ERR_NONE) {
1433 host->mode = MMC_MODE_MMC;
1434
1435 err = mmc_send_op_cond(host, 0, &ocr);
1436 if (err != MMC_ERR_NONE)
1437 return;
1438 }
1439
1440 host->ocr = mmc_select_voltage(host, ocr);
1441
1442 /*
1443 * Since we're changing the OCR value, we seem to
1444 * need to tell some cards to go back to the idle
1445 * state. We wait 1ms to give cards time to
1446 * respond.
1447 */
1448 if (host->ocr)
1449 mmc_idle_cards(host);
1450 } else {
1451 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
1452 host->ios.clock = host->f_min;
1453 mmc_set_ios(host);
1454
1455 /*
1456 * We should remember the OCR mask from the existing
1457 * cards, and detect the new cards OCR mask, combine
1458 * the two and re-select the VDD. However, if we do
1459 * change VDD, we should do an idle, and then do a
1460 * full re-initialisation. We would need to notify
1461 * drivers so that they can re-setup the cards as
1462 * well, while keeping their queues at bay.
1463 *
1464 * For the moment, we take the easy way out - if the
1465 * new cards don't like our currently selected VDD,
1466 * they drop off the bus.
1467 */
1468 }
1469
1470 if (host->ocr == 0)
1471 return;
1472
1473 /*
1474 * Send the selected OCR multiple times... until the cards
1475 * all get the idea that they should be ready for CMD2.
1476 * (My SanDisk card seems to need this.)
1477 */
1478 if (host->mode == MMC_MODE_SD) {
1479 int err, sd2;
1480 err = mmc_send_if_cond(host, host->ocr, &sd2);
1481 if (err == MMC_ERR_NONE) {
1482 /*
1483 * If SD_SEND_IF_COND indicates an SD 2.0
1484 * compliant card and we should set bit 30
1485 * of the ocr to indicate that we can handle
1486 * block-addressed SDHC cards.
1487 */
1488 mmc_send_app_op_cond(host, host->ocr | (sd2 << 30), NULL);
1489 }
1490 } else {
1491 mmc_send_op_cond(host, host->ocr, NULL);
1492 }
1493
1494 mmc_discover_cards(host);
1495
1496 /*
1497 * Ok, now switch to push-pull mode.
1498 */
1499 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
1500 mmc_set_ios(host);
1501
1502 mmc_read_csds(host);
1503
1504 if (host->mode == MMC_MODE_SD) {
1505 mmc_read_scrs(host);
1506 mmc_read_switch_caps(host);
1507 } else
1508 mmc_process_ext_csds(host);
1509}
1510
1511
1512/**
1513 * mmc_detect_change - process change of state on a MMC socket
1514 * @host: host which changed state.
1515 * @delay: optional delay to wait before detection (jiffies)
1516 *
1517 * All we know is that card(s) have been inserted or removed
1518 * from the socket(s). We don't know which socket or cards.
1519 */
1520void mmc_detect_change(struct mmc_host *host, unsigned long delay)
1521{
1522 mmc_schedule_delayed_work(&host->detect, delay);
1523}
1524
1525EXPORT_SYMBOL(mmc_detect_change);
1526
1527
1528static void mmc_rescan(struct work_struct *work)
1529{
1530 struct mmc_host *host =
1531 container_of(work, struct mmc_host, detect.work);
1532 struct list_head *l, *n;
1533 unsigned char power_mode;
1534
1535 mmc_claim_host(host);
1536
1537 /*
1538 * Check for removed cards and newly inserted ones. We check for
1539 * removed cards first so we can intelligently re-select the VDD.
1540 */
1541 power_mode = host->ios.power_mode;
1542 if (power_mode == MMC_POWER_ON)
1543 mmc_check_cards(host);
1544
1545 mmc_setup(host);
1546
1547 /*
1548 * Some broken cards process CMD1 even in stand-by state. There is
1549 * no reply, but an ILLEGAL_COMMAND error is cached and returned
1550 * after next command. We poll for card status here to clear any
1551 * possibly pending error.
1552 */
1553 if (power_mode == MMC_POWER_ON)
1554 mmc_check_cards(host);
1555
1556 if (!list_empty(&host->cards)) {
1557 /*
1558 * (Re-)calculate the fastest clock rate which the
1559 * attached cards and the host support.
1560 */
1561 host->ios.clock = mmc_calculate_clock(host);
1562 mmc_set_ios(host);
1563 }
1564
1565 mmc_release_host(host);
1566
1567 list_for_each_safe(l, n, &host->cards) {
1568 struct mmc_card *card = mmc_list_to_card(l);
1569
1570 /*
1571 * If this is a new and good card, register it.
1572 */
1573 if (!mmc_card_present(card) && !mmc_card_dead(card)) {
1574 if (mmc_register_card(card))
1575 mmc_card_set_dead(card);
1576 else
1577 mmc_card_set_present(card);
1578 }
1579
1580 /*
1581 * If this card is dead, destroy it.
1582 */
1583 if (mmc_card_dead(card)) {
1584 list_del(&card->node);
1585 mmc_remove_card(card);
1586 }
1587 }
1588
1589 /*
1590 * If we discover that there are no cards on the
1591 * bus, turn off the clock and power down.
1592 */
1593 if (list_empty(&host->cards))
1594 mmc_power_off(host);
1595}
1596
1597
1598/**
1599 * mmc_alloc_host - initialise the per-host structure.
1600 * @extra: sizeof private data structure
1601 * @dev: pointer to host device model structure
1602 *
1603 * Initialise the per-host structure.
1604 */
1605struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
1606{
1607 struct mmc_host *host;
1608
1609 host = mmc_alloc_host_sysfs(extra, dev);
1610 if (host) {
1611 spin_lock_init(&host->lock);
1612 init_waitqueue_head(&host->wq);
1613 INIT_LIST_HEAD(&host->cards);
1614 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
1615
1616 /*
1617 * By default, hosts do not support SGIO or large requests.
1618 * They have to set these according to their abilities.
1619 */
1620 host->max_hw_segs = 1;
1621 host->max_phys_segs = 1;
1622 host->max_seg_size = PAGE_CACHE_SIZE;
1623
1624 host->max_req_size = PAGE_CACHE_SIZE;
1625 host->max_blk_size = 512;
1626 host->max_blk_count = PAGE_CACHE_SIZE / 512;
1627 }
1628
1629 return host;
1630}
1631
1632EXPORT_SYMBOL(mmc_alloc_host);
1633
1634/**
1635 * mmc_add_host - initialise host hardware
1636 * @host: mmc host
1637 */
1638int mmc_add_host(struct mmc_host *host)
1639{
1640 int ret;
1641
1642 ret = mmc_add_host_sysfs(host);
1643 if (ret == 0) {
1644 mmc_power_off(host);
1645 mmc_detect_change(host, 0);
1646 }
1647
1648 return ret;
1649}
1650
1651EXPORT_SYMBOL(mmc_add_host);
1652
1653/**
1654 * mmc_remove_host - remove host hardware
1655 * @host: mmc host
1656 *
1657 * Unregister and remove all cards associated with this host,
1658 * and power down the MMC bus.
1659 */
1660void mmc_remove_host(struct mmc_host *host)
1661{
1662 struct list_head *l, *n;
1663
1664 list_for_each_safe(l, n, &host->cards) {
1665 struct mmc_card *card = mmc_list_to_card(l);
1666
1667 mmc_remove_card(card);
1668 }
1669
1670 mmc_power_off(host);
1671 mmc_remove_host_sysfs(host);
1672}
1673
1674EXPORT_SYMBOL(mmc_remove_host);
1675
1676/**
1677 * mmc_free_host - free the host structure
1678 * @host: mmc host
1679 *
1680 * Free the host once all references to it have been dropped.
1681 */
1682void mmc_free_host(struct mmc_host *host)
1683{
1684 mmc_flush_scheduled_work();
1685 mmc_free_host_sysfs(host);
1686}
1687
1688EXPORT_SYMBOL(mmc_free_host);
1689
1690#ifdef CONFIG_PM
1691
1692/**
1693 * mmc_suspend_host - suspend a host
1694 * @host: mmc host
1695 * @state: suspend mode (PM_SUSPEND_xxx)
1696 */
1697int mmc_suspend_host(struct mmc_host *host, pm_message_t state)
1698{
1699 mmc_claim_host(host);
1700 mmc_deselect_cards(host);
1701 mmc_power_off(host);
1702 mmc_release_host(host);
1703
1704 return 0;
1705}
1706
1707EXPORT_SYMBOL(mmc_suspend_host);
1708
1709/**
1710 * mmc_resume_host - resume a previously suspended host
1711 * @host: mmc host
1712 */
1713int mmc_resume_host(struct mmc_host *host)
1714{
1715 mmc_rescan(&host->detect.work);
1716
1717 return 0;
1718}
1719
1720EXPORT_SYMBOL(mmc_resume_host);
1721
1722#endif
1723
1724MODULE_LICENSE("GPL");
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
deleted file mode 100644
index 0581d09c58fc..000000000000
--- a/drivers/mmc/tifm_sd.c
+++ /dev/null
@@ -1,987 +0,0 @@
1/*
2 * tifm_sd.c - TI FlashMedia driver
3 *
4 * Copyright (C) 2006 Alex Dubov <oakad@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12
13#include <linux/tifm.h>
14#include <linux/mmc/protocol.h>
15#include <linux/mmc/host.h>
16#include <linux/highmem.h>
17#include <asm/io.h>
18
19#define DRIVER_NAME "tifm_sd"
20#define DRIVER_VERSION "0.7"
21
22static int no_dma = 0;
23static int fixed_timeout = 0;
24module_param(no_dma, bool, 0644);
25module_param(fixed_timeout, bool, 0644);
26
27/* Constants here are mostly from OMAP5912 datasheet */
28#define TIFM_MMCSD_RESET 0x0002
29#define TIFM_MMCSD_CLKMASK 0x03ff
30#define TIFM_MMCSD_POWER 0x0800
31#define TIFM_MMCSD_4BBUS 0x8000
32#define TIFM_MMCSD_RXDE 0x8000 /* rx dma enable */
33#define TIFM_MMCSD_TXDE 0x0080 /* tx dma enable */
34#define TIFM_MMCSD_BUFINT 0x0c00 /* set bits: AE, AF */
35#define TIFM_MMCSD_DPE 0x0020 /* data timeout counted in kilocycles */
36#define TIFM_MMCSD_INAB 0x0080 /* abort / initialize command */
37#define TIFM_MMCSD_READ 0x8000
38
39#define TIFM_MMCSD_DATAMASK 0x401d /* set bits: CERR, EOFB, BRS, CB, EOC */
40#define TIFM_MMCSD_ERRMASK 0x01e0 /* set bits: CCRC, CTO, DCRC, DTO */
41#define TIFM_MMCSD_EOC 0x0001 /* end of command phase */
42#define TIFM_MMCSD_CB 0x0004 /* card enter busy state */
43#define TIFM_MMCSD_BRS 0x0008 /* block received/sent */
44#define TIFM_MMCSD_EOFB 0x0010 /* card exit busy state */
45#define TIFM_MMCSD_DTO 0x0020 /* data time-out */
46#define TIFM_MMCSD_DCRC 0x0040 /* data crc error */
47#define TIFM_MMCSD_CTO 0x0080 /* command time-out */
48#define TIFM_MMCSD_CCRC 0x0100 /* command crc error */
49#define TIFM_MMCSD_AF 0x0400 /* fifo almost full */
50#define TIFM_MMCSD_AE 0x0800 /* fifo almost empty */
51#define TIFM_MMCSD_CERR 0x4000 /* card status error */
52
53#define TIFM_MMCSD_FIFO_SIZE 0x0020
54
55#define TIFM_MMCSD_RSP_R0 0x0000
56#define TIFM_MMCSD_RSP_R1 0x0100
57#define TIFM_MMCSD_RSP_R2 0x0200
58#define TIFM_MMCSD_RSP_R3 0x0300
59#define TIFM_MMCSD_RSP_R4 0x0400
60#define TIFM_MMCSD_RSP_R5 0x0500
61#define TIFM_MMCSD_RSP_R6 0x0600
62
63#define TIFM_MMCSD_RSP_BUSY 0x0800
64
65#define TIFM_MMCSD_CMD_BC 0x0000
66#define TIFM_MMCSD_CMD_BCR 0x1000
67#define TIFM_MMCSD_CMD_AC 0x2000
68#define TIFM_MMCSD_CMD_ADTC 0x3000
69
70typedef enum {
71 IDLE = 0,
72 CMD, /* main command ended */
73 BRS, /* block transfer finished */
74 SCMD, /* stop command ended */
75 CARD, /* card left busy state */
76 FIFO, /* FIFO operation completed (uncertain) */
77 READY
78} card_state_t;
79
80enum {
81 FIFO_RDY = 0x0001, /* hardware dependent value */
82 EJECT = 0x0004,
83 EJECT_DONE = 0x0008,
84 CARD_BUSY = 0x0010,
85 OPENDRAIN = 0x0040, /* hardware dependent value */
86 CARD_EVENT = 0x0100, /* hardware dependent value */
87 CARD_RO = 0x0200, /* hardware dependent value */
88 FIFO_EVENT = 0x10000 }; /* hardware dependent value */
89
90struct tifm_sd {
91 struct tifm_dev *dev;
92
93 unsigned int flags;
94 card_state_t state;
95 unsigned int clk_freq;
96 unsigned int clk_div;
97 unsigned long timeout_jiffies;
98
99 struct tasklet_struct finish_tasklet;
100 struct timer_list timer;
101 struct mmc_request *req;
102 wait_queue_head_t notify;
103
104 size_t written_blocks;
105 size_t buffer_size;
106 size_t buffer_pos;
107
108};
109
110static char* tifm_sd_data_buffer(struct mmc_data *data)
111{
112 return page_address(data->sg->page) + data->sg->offset;
113}
114
115static int tifm_sd_transfer_data(struct tifm_dev *sock, struct tifm_sd *host,
116 unsigned int host_status)
117{
118 struct mmc_command *cmd = host->req->cmd;
119 unsigned int t_val = 0, cnt = 0;
120 char *buffer;
121
122 if (host_status & TIFM_MMCSD_BRS) {
123 /* in non-dma rx mode BRS fires when fifo is still not empty */
124 if (no_dma && (cmd->data->flags & MMC_DATA_READ)) {
125 buffer = tifm_sd_data_buffer(host->req->data);
126 while (host->buffer_size > host->buffer_pos) {
127 t_val = readl(sock->addr + SOCK_MMCSD_DATA);
128 buffer[host->buffer_pos++] = t_val & 0xff;
129 buffer[host->buffer_pos++] =
130 (t_val >> 8) & 0xff;
131 }
132 }
133 return 1;
134 } else if (no_dma) {
135 buffer = tifm_sd_data_buffer(host->req->data);
136 if ((cmd->data->flags & MMC_DATA_READ) &&
137 (host_status & TIFM_MMCSD_AF)) {
138 for (cnt = 0; cnt < TIFM_MMCSD_FIFO_SIZE; cnt++) {
139 t_val = readl(sock->addr + SOCK_MMCSD_DATA);
140 if (host->buffer_size > host->buffer_pos) {
141 buffer[host->buffer_pos++] =
142 t_val & 0xff;
143 buffer[host->buffer_pos++] =
144 (t_val >> 8) & 0xff;
145 }
146 }
147 } else if ((cmd->data->flags & MMC_DATA_WRITE)
148 && (host_status & TIFM_MMCSD_AE)) {
149 for (cnt = 0; cnt < TIFM_MMCSD_FIFO_SIZE; cnt++) {
150 if (host->buffer_size > host->buffer_pos) {
151 t_val = buffer[host->buffer_pos++]
152 & 0x00ff;
153 t_val |= ((buffer[host->buffer_pos++])
154 << 8) & 0xff00;
155 writel(t_val,
156 sock->addr + SOCK_MMCSD_DATA);
157 }
158 }
159 }
160 }
161 return 0;
162}
163
164static unsigned int tifm_sd_op_flags(struct mmc_command *cmd)
165{
166 unsigned int rc = 0;
167
168 switch (mmc_resp_type(cmd)) {
169 case MMC_RSP_NONE:
170 rc |= TIFM_MMCSD_RSP_R0;
171 break;
172 case MMC_RSP_R1B:
173 rc |= TIFM_MMCSD_RSP_BUSY; // deliberate fall-through
174 case MMC_RSP_R1:
175 rc |= TIFM_MMCSD_RSP_R1;
176 break;
177 case MMC_RSP_R2:
178 rc |= TIFM_MMCSD_RSP_R2;
179 break;
180 case MMC_RSP_R3:
181 rc |= TIFM_MMCSD_RSP_R3;
182 break;
183 default:
184 BUG();
185 }
186
187 switch (mmc_cmd_type(cmd)) {
188 case MMC_CMD_BC:
189 rc |= TIFM_MMCSD_CMD_BC;
190 break;
191 case MMC_CMD_BCR:
192 rc |= TIFM_MMCSD_CMD_BCR;
193 break;
194 case MMC_CMD_AC:
195 rc |= TIFM_MMCSD_CMD_AC;
196 break;
197 case MMC_CMD_ADTC:
198 rc |= TIFM_MMCSD_CMD_ADTC;
199 break;
200 default:
201 BUG();
202 }
203 return rc;
204}
205
206static void tifm_sd_exec(struct tifm_sd *host, struct mmc_command *cmd)
207{
208 struct tifm_dev *sock = host->dev;
209 unsigned int cmd_mask = tifm_sd_op_flags(cmd) |
210 (host->flags & OPENDRAIN);
211
212 if (cmd->data && (cmd->data->flags & MMC_DATA_READ))
213 cmd_mask |= TIFM_MMCSD_READ;
214
215 dev_dbg(&sock->dev, "executing opcode 0x%x, arg: 0x%x, mask: 0x%x\n",
216 cmd->opcode, cmd->arg, cmd_mask);
217
218 writel((cmd->arg >> 16) & 0xffff, sock->addr + SOCK_MMCSD_ARG_HIGH);
219 writel(cmd->arg & 0xffff, sock->addr + SOCK_MMCSD_ARG_LOW);
220 writel(cmd->opcode | cmd_mask, sock->addr + SOCK_MMCSD_COMMAND);
221}
222
223static void tifm_sd_fetch_resp(struct mmc_command *cmd, struct tifm_dev *sock)
224{
225 cmd->resp[0] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x1c) << 16)
226 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x18);
227 cmd->resp[1] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x14) << 16)
228 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x10);
229 cmd->resp[2] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x0c) << 16)
230 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x08);
231 cmd->resp[3] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x04) << 16)
232 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x00);
233}
234
235static void tifm_sd_process_cmd(struct tifm_dev *sock, struct tifm_sd *host,
236 unsigned int host_status)
237{
238 struct mmc_command *cmd = host->req->cmd;
239
240change_state:
241 switch (host->state) {
242 case IDLE:
243 return;
244 case CMD:
245 if (host_status & (TIFM_MMCSD_EOC | TIFM_MMCSD_CERR)) {
246 tifm_sd_fetch_resp(cmd, sock);
247 if (cmd->data) {
248 host->state = BRS;
249 } else {
250 host->state = READY;
251 }
252 goto change_state;
253 }
254 break;
255 case BRS:
256 if (tifm_sd_transfer_data(sock, host, host_status)) {
257 if (cmd->data->flags & MMC_DATA_WRITE) {
258 host->state = CARD;
259 } else {
260 if (no_dma) {
261 if (host->req->stop) {
262 tifm_sd_exec(host, host->req->stop);
263 host->state = SCMD;
264 } else {
265 host->state = READY;
266 }
267 } else {
268 host->state = FIFO;
269 }
270 }
271 goto change_state;
272 }
273 break;
274 case SCMD:
275 if (host_status & TIFM_MMCSD_EOC) {
276 tifm_sd_fetch_resp(host->req->stop, sock);
277 host->state = READY;
278 goto change_state;
279 }
280 break;
281 case CARD:
282 dev_dbg(&sock->dev, "waiting for CARD, have %zd blocks\n",
283 host->written_blocks);
284 if (!(host->flags & CARD_BUSY)
285 && (host->written_blocks == cmd->data->blocks)) {
286 if (no_dma) {
287 if (host->req->stop) {
288 tifm_sd_exec(host, host->req->stop);
289 host->state = SCMD;
290 } else {
291 host->state = READY;
292 }
293 } else {
294 host->state = FIFO;
295 }
296 goto change_state;
297 }
298 break;
299 case FIFO:
300 if (host->flags & FIFO_RDY) {
301 host->flags &= ~FIFO_RDY;
302 if (host->req->stop) {
303 tifm_sd_exec(host, host->req->stop);
304 host->state = SCMD;
305 } else {
306 host->state = READY;
307 }
308 goto change_state;
309 }
310 break;
311 case READY:
312 tasklet_schedule(&host->finish_tasklet);
313 return;
314 }
315
316}
317
318/* Called from interrupt handler */
319static void tifm_sd_signal_irq(struct tifm_dev *sock,
320 unsigned int sock_irq_status)
321{
322 struct tifm_sd *host;
323 unsigned int host_status = 0, fifo_status = 0;
324 int error_code = 0;
325
326 spin_lock(&sock->lock);
327 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock));
328
329 if (sock_irq_status & FIFO_EVENT) {
330 fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS);
331 writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS);
332
333 host->flags |= fifo_status & FIFO_RDY;
334 }
335
336 if (sock_irq_status & CARD_EVENT) {
337 host_status = readl(sock->addr + SOCK_MMCSD_STATUS);
338 writel(host_status, sock->addr + SOCK_MMCSD_STATUS);
339
340 if (!host->req)
341 goto done;
342
343 if (host_status & TIFM_MMCSD_ERRMASK) {
344 if (host_status & (TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
345 error_code = MMC_ERR_TIMEOUT;
346 else if (host_status
347 & (TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC))
348 error_code = MMC_ERR_BADCRC;
349
350 writel(TIFM_FIFO_INT_SETALL,
351 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
352 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
353
354 if (host->req->stop) {
355 if (host->state == SCMD) {
356 host->req->stop->error = error_code;
357 } else if (host->state == BRS
358 || host->state == CARD
359 || host->state == FIFO) {
360 host->req->cmd->error = error_code;
361 tifm_sd_exec(host, host->req->stop);
362 host->state = SCMD;
363 goto done;
364 } else {
365 host->req->cmd->error = error_code;
366 }
367 } else {
368 host->req->cmd->error = error_code;
369 }
370 host->state = READY;
371 }
372
373 if (host_status & TIFM_MMCSD_CB)
374 host->flags |= CARD_BUSY;
375 if ((host_status & TIFM_MMCSD_EOFB)
376 && (host->flags & CARD_BUSY)) {
377 host->written_blocks++;
378 host->flags &= ~CARD_BUSY;
379 }
380 }
381
382 if (host->req)
383 tifm_sd_process_cmd(sock, host, host_status);
384done:
385 dev_dbg(&sock->dev, "host_status %x, fifo_status %x\n",
386 host_status, fifo_status);
387 spin_unlock(&sock->lock);
388}
389
390static void tifm_sd_prepare_data(struct tifm_sd *host, struct mmc_command *cmd)
391{
392 struct tifm_dev *sock = host->dev;
393 unsigned int dest_cnt;
394
395 /* DMA style IO */
396 dev_dbg(&sock->dev, "setting dma for %d blocks\n",
397 cmd->data->blocks);
398 writel(TIFM_FIFO_INT_SETALL,
399 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
400 writel(ilog2(cmd->data->blksz) - 2,
401 sock->addr + SOCK_FIFO_PAGE_SIZE);
402 writel(TIFM_FIFO_ENABLE, sock->addr + SOCK_FIFO_CONTROL);
403 writel(TIFM_FIFO_INTMASK, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
404
405 dest_cnt = (cmd->data->blocks) << 8;
406
407 writel(sg_dma_address(cmd->data->sg), sock->addr + SOCK_DMA_ADDRESS);
408
409 writel(cmd->data->blocks - 1, sock->addr + SOCK_MMCSD_NUM_BLOCKS);
410 writel(cmd->data->blksz - 1, sock->addr + SOCK_MMCSD_BLOCK_LEN);
411
412 if (cmd->data->flags & MMC_DATA_WRITE) {
413 writel(TIFM_MMCSD_TXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
414 writel(dest_cnt | TIFM_DMA_TX | TIFM_DMA_EN,
415 sock->addr + SOCK_DMA_CONTROL);
416 } else {
417 writel(TIFM_MMCSD_RXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
418 writel(dest_cnt | TIFM_DMA_EN, sock->addr + SOCK_DMA_CONTROL);
419 }
420}
421
422static void tifm_sd_set_data_timeout(struct tifm_sd *host,
423 struct mmc_data *data)
424{
425 struct tifm_dev *sock = host->dev;
426 unsigned int data_timeout = data->timeout_clks;
427
428 if (fixed_timeout)
429 return;
430
431 data_timeout += data->timeout_ns /
432 ((1000000000UL / host->clk_freq) * host->clk_div);
433
434 if (data_timeout < 0xffff) {
435 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
436 writel((~TIFM_MMCSD_DPE)
437 & readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
438 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
439 } else {
440 data_timeout = (data_timeout >> 10) + 1;
441 if (data_timeout > 0xffff)
442 data_timeout = 0; /* set to unlimited */
443 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
444 writel(TIFM_MMCSD_DPE
445 | readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG),
446 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
447 }
448}
449
450static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
451{
452 struct tifm_sd *host = mmc_priv(mmc);
453 struct tifm_dev *sock = host->dev;
454 unsigned long flags;
455 int sg_count = 0;
456 struct mmc_data *r_data = mrq->cmd->data;
457
458 spin_lock_irqsave(&sock->lock, flags);
459 if (host->flags & EJECT) {
460 spin_unlock_irqrestore(&sock->lock, flags);
461 goto err_out;
462 }
463
464 if (host->req) {
465 printk(KERN_ERR DRIVER_NAME ": unfinished request detected\n");
466 spin_unlock_irqrestore(&sock->lock, flags);
467 goto err_out;
468 }
469
470 if (r_data) {
471 tifm_sd_set_data_timeout(host, r_data);
472
473 sg_count = tifm_map_sg(sock, r_data->sg, r_data->sg_len,
474 mrq->cmd->flags & MMC_DATA_WRITE
475 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
476 if (sg_count != 1) {
477 printk(KERN_ERR DRIVER_NAME
478 ": scatterlist map failed\n");
479 spin_unlock_irqrestore(&sock->lock, flags);
480 goto err_out;
481 }
482
483 host->written_blocks = 0;
484 host->flags &= ~CARD_BUSY;
485 tifm_sd_prepare_data(host, mrq->cmd);
486 }
487
488 host->req = mrq;
489 mod_timer(&host->timer, jiffies + host->timeout_jiffies);
490 host->state = CMD;
491 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL),
492 sock->addr + SOCK_CONTROL);
493 tifm_sd_exec(host, mrq->cmd);
494 spin_unlock_irqrestore(&sock->lock, flags);
495 return;
496
497err_out:
498 if (sg_count > 0)
499 tifm_unmap_sg(sock, r_data->sg, r_data->sg_len,
500 (r_data->flags & MMC_DATA_WRITE)
501 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
502
503 mrq->cmd->error = MMC_ERR_TIMEOUT;
504 mmc_request_done(mmc, mrq);
505}
506
507static void tifm_sd_end_cmd(unsigned long data)
508{
509 struct tifm_sd *host = (struct tifm_sd*)data;
510 struct tifm_dev *sock = host->dev;
511 struct mmc_host *mmc = tifm_get_drvdata(sock);
512 struct mmc_request *mrq;
513 struct mmc_data *r_data = NULL;
514 unsigned long flags;
515
516 spin_lock_irqsave(&sock->lock, flags);
517
518 del_timer(&host->timer);
519 mrq = host->req;
520 host->req = NULL;
521 host->state = IDLE;
522
523 if (!mrq) {
524 printk(KERN_ERR DRIVER_NAME ": no request to complete?\n");
525 spin_unlock_irqrestore(&sock->lock, flags);
526 return;
527 }
528
529 r_data = mrq->cmd->data;
530 if (r_data) {
531 if (r_data->flags & MMC_DATA_WRITE) {
532 r_data->bytes_xfered = host->written_blocks
533 * r_data->blksz;
534 } else {
535 r_data->bytes_xfered = r_data->blocks -
536 readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1;
537 r_data->bytes_xfered *= r_data->blksz;
538 r_data->bytes_xfered += r_data->blksz -
539 readl(sock->addr + SOCK_MMCSD_BLOCK_LEN) + 1;
540 }
541 tifm_unmap_sg(sock, r_data->sg, r_data->sg_len,
542 (r_data->flags & MMC_DATA_WRITE)
543 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
544 }
545
546 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
547 sock->addr + SOCK_CONTROL);
548
549 spin_unlock_irqrestore(&sock->lock, flags);
550 mmc_request_done(mmc, mrq);
551}
552
553static void tifm_sd_request_nodma(struct mmc_host *mmc, struct mmc_request *mrq)
554{
555 struct tifm_sd *host = mmc_priv(mmc);
556 struct tifm_dev *sock = host->dev;
557 unsigned long flags;
558 struct mmc_data *r_data = mrq->cmd->data;
559
560 spin_lock_irqsave(&sock->lock, flags);
561 if (host->flags & EJECT) {
562 spin_unlock_irqrestore(&sock->lock, flags);
563 goto err_out;
564 }
565
566 if (host->req) {
567 printk(KERN_ERR DRIVER_NAME ": unfinished request detected\n");
568 spin_unlock_irqrestore(&sock->lock, flags);
569 goto err_out;
570 }
571
572 if (r_data) {
573 tifm_sd_set_data_timeout(host, r_data);
574
575 host->buffer_size = mrq->cmd->data->blocks
576 * mrq->cmd->data->blksz;
577
578 writel(TIFM_MMCSD_BUFINT
579 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
580 sock->addr + SOCK_MMCSD_INT_ENABLE);
581 writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8)
582 | (TIFM_MMCSD_FIFO_SIZE - 1),
583 sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
584
585 host->written_blocks = 0;
586 host->flags &= ~CARD_BUSY;
587 host->buffer_pos = 0;
588 writel(r_data->blocks - 1, sock->addr + SOCK_MMCSD_NUM_BLOCKS);
589 writel(r_data->blksz - 1, sock->addr + SOCK_MMCSD_BLOCK_LEN);
590 }
591
592 host->req = mrq;
593 mod_timer(&host->timer, jiffies + host->timeout_jiffies);
594 host->state = CMD;
595 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL),
596 sock->addr + SOCK_CONTROL);
597 tifm_sd_exec(host, mrq->cmd);
598 spin_unlock_irqrestore(&sock->lock, flags);
599 return;
600
601err_out:
602 mrq->cmd->error = MMC_ERR_TIMEOUT;
603 mmc_request_done(mmc, mrq);
604}
605
606static void tifm_sd_end_cmd_nodma(unsigned long data)
607{
608 struct tifm_sd *host = (struct tifm_sd*)data;
609 struct tifm_dev *sock = host->dev;
610 struct mmc_host *mmc = tifm_get_drvdata(sock);
611 struct mmc_request *mrq;
612 struct mmc_data *r_data = NULL;
613 unsigned long flags;
614
615 spin_lock_irqsave(&sock->lock, flags);
616
617 del_timer(&host->timer);
618 mrq = host->req;
619 host->req = NULL;
620 host->state = IDLE;
621
622 if (!mrq) {
623 printk(KERN_ERR DRIVER_NAME ": no request to complete?\n");
624 spin_unlock_irqrestore(&sock->lock, flags);
625 return;
626 }
627
628 r_data = mrq->cmd->data;
629 if (r_data) {
630 writel((~TIFM_MMCSD_BUFINT) &
631 readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
632 sock->addr + SOCK_MMCSD_INT_ENABLE);
633
634 if (r_data->flags & MMC_DATA_WRITE) {
635 r_data->bytes_xfered = host->written_blocks
636 * r_data->blksz;
637 } else {
638 r_data->bytes_xfered = r_data->blocks -
639 readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1;
640 r_data->bytes_xfered *= r_data->blksz;
641 r_data->bytes_xfered += r_data->blksz -
642 readl(sock->addr + SOCK_MMCSD_BLOCK_LEN) + 1;
643 }
644 host->buffer_pos = 0;
645 host->buffer_size = 0;
646 }
647
648 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
649 sock->addr + SOCK_CONTROL);
650
651 spin_unlock_irqrestore(&sock->lock, flags);
652
653 mmc_request_done(mmc, mrq);
654}
655
656static void tifm_sd_terminate(struct tifm_sd *host)
657{
658 struct tifm_dev *sock = host->dev;
659 unsigned long flags;
660
661 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
662 mmiowb();
663 spin_lock_irqsave(&sock->lock, flags);
664 host->flags |= EJECT;
665 if (host->req) {
666 writel(TIFM_FIFO_INT_SETALL,
667 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
668 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
669 tasklet_schedule(&host->finish_tasklet);
670 }
671 spin_unlock_irqrestore(&sock->lock, flags);
672}
673
674static void tifm_sd_abort(unsigned long data)
675{
676 struct tifm_sd *host = (struct tifm_sd*)data;
677
678 printk(KERN_ERR DRIVER_NAME
679 ": card failed to respond for a long period of time");
680
681 tifm_sd_terminate(host);
682 tifm_eject(host->dev);
683}
684
685static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
686{
687 struct tifm_sd *host = mmc_priv(mmc);
688 struct tifm_dev *sock = host->dev;
689 unsigned int clk_div1, clk_div2;
690 unsigned long flags;
691
692 spin_lock_irqsave(&sock->lock, flags);
693
694 dev_dbg(&sock->dev, "Setting bus width %d, power %d\n", ios->bus_width,
695 ios->power_mode);
696 if (ios->bus_width == MMC_BUS_WIDTH_4) {
697 writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
698 sock->addr + SOCK_MMCSD_CONFIG);
699 } else {
700 writel((~TIFM_MMCSD_4BBUS)
701 & readl(sock->addr + SOCK_MMCSD_CONFIG),
702 sock->addr + SOCK_MMCSD_CONFIG);
703 }
704
705 if (ios->clock) {
706 clk_div1 = 20000000 / ios->clock;
707 if (!clk_div1)
708 clk_div1 = 1;
709
710 clk_div2 = 24000000 / ios->clock;
711 if (!clk_div2)
712 clk_div2 = 1;
713
714 if ((20000000 / clk_div1) > ios->clock)
715 clk_div1++;
716 if ((24000000 / clk_div2) > ios->clock)
717 clk_div2++;
718 if ((20000000 / clk_div1) > (24000000 / clk_div2)) {
719 host->clk_freq = 20000000;
720 host->clk_div = clk_div1;
721 writel((~TIFM_CTRL_FAST_CLK)
722 & readl(sock->addr + SOCK_CONTROL),
723 sock->addr + SOCK_CONTROL);
724 } else {
725 host->clk_freq = 24000000;
726 host->clk_div = clk_div2;
727 writel(TIFM_CTRL_FAST_CLK
728 | readl(sock->addr + SOCK_CONTROL),
729 sock->addr + SOCK_CONTROL);
730 }
731 } else {
732 host->clk_div = 0;
733 }
734 host->clk_div &= TIFM_MMCSD_CLKMASK;
735 writel(host->clk_div
736 | ((~TIFM_MMCSD_CLKMASK)
737 & readl(sock->addr + SOCK_MMCSD_CONFIG)),
738 sock->addr + SOCK_MMCSD_CONFIG);
739
740 if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
741 host->flags |= OPENDRAIN;
742 else
743 host->flags &= ~OPENDRAIN;
744
745 /* chip_select : maybe later */
746 //vdd
747 //power is set before probe / after remove
748 //I believe, power_off when already marked for eject is sufficient to
749 // allow removal.
750 if ((host->flags & EJECT) && ios->power_mode == MMC_POWER_OFF) {
751 host->flags |= EJECT_DONE;
752 wake_up_all(&host->notify);
753 }
754
755 spin_unlock_irqrestore(&sock->lock, flags);
756}
757
758static int tifm_sd_ro(struct mmc_host *mmc)
759{
760 int rc;
761 struct tifm_sd *host = mmc_priv(mmc);
762 struct tifm_dev *sock = host->dev;
763 unsigned long flags;
764
765 spin_lock_irqsave(&sock->lock, flags);
766
767 host->flags |= (CARD_RO & readl(sock->addr + SOCK_PRESENT_STATE));
768 rc = (host->flags & CARD_RO) ? 1 : 0;
769
770 spin_unlock_irqrestore(&sock->lock, flags);
771 return rc;
772}
773
774static struct mmc_host_ops tifm_sd_ops = {
775 .request = tifm_sd_request,
776 .set_ios = tifm_sd_ios,
777 .get_ro = tifm_sd_ro
778};
779
780static int tifm_sd_initialize_host(struct tifm_sd *host)
781{
782 int rc;
783 unsigned int host_status = 0;
784 struct tifm_dev *sock = host->dev;
785
786 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
787 mmiowb();
788 host->clk_div = 61;
789 host->clk_freq = 20000000;
790 writel(TIFM_MMCSD_RESET, sock->addr + SOCK_MMCSD_SYSTEM_CONTROL);
791 writel(host->clk_div | TIFM_MMCSD_POWER,
792 sock->addr + SOCK_MMCSD_CONFIG);
793
794 /* wait up to 0.51 sec for reset */
795 for (rc = 2; rc <= 256; rc <<= 1) {
796 if (1 & readl(sock->addr + SOCK_MMCSD_SYSTEM_STATUS)) {
797 rc = 0;
798 break;
799 }
800 msleep(rc);
801 }
802
803 if (rc) {
804 printk(KERN_ERR DRIVER_NAME
805 ": controller failed to reset\n");
806 return -ENODEV;
807 }
808
809 writel(0, sock->addr + SOCK_MMCSD_NUM_BLOCKS);
810 writel(host->clk_div | TIFM_MMCSD_POWER,
811 sock->addr + SOCK_MMCSD_CONFIG);
812 writel(TIFM_MMCSD_RXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
813
814 // command timeout fixed to 64 clocks for now
815 writel(64, sock->addr + SOCK_MMCSD_COMMAND_TO);
816 writel(TIFM_MMCSD_INAB, sock->addr + SOCK_MMCSD_COMMAND);
817
818 /* INAB should take much less than reset */
819 for (rc = 1; rc <= 16; rc <<= 1) {
820 host_status = readl(sock->addr + SOCK_MMCSD_STATUS);
821 writel(host_status, sock->addr + SOCK_MMCSD_STATUS);
822 if (!(host_status & TIFM_MMCSD_ERRMASK)
823 && (host_status & TIFM_MMCSD_EOC)) {
824 rc = 0;
825 break;
826 }
827 msleep(rc);
828 }
829
830 if (rc) {
831 printk(KERN_ERR DRIVER_NAME
832 ": card not ready - probe failed on initialization\n");
833 return -ENODEV;
834 }
835
836 writel(TIFM_MMCSD_DATAMASK | TIFM_MMCSD_ERRMASK,
837 sock->addr + SOCK_MMCSD_INT_ENABLE);
838 mmiowb();
839
840 return 0;
841}
842
843static int tifm_sd_probe(struct tifm_dev *sock)
844{
845 struct mmc_host *mmc;
846 struct tifm_sd *host;
847 int rc = -EIO;
848
849 if (!(TIFM_SOCK_STATE_OCCUPIED
850 & readl(sock->addr + SOCK_PRESENT_STATE))) {
851 printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n");
852 return rc;
853 }
854
855 mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev);
856 if (!mmc)
857 return -ENOMEM;
858
859 host = mmc_priv(mmc);
860 tifm_set_drvdata(sock, mmc);
861 host->dev = sock;
862 host->timeout_jiffies = msecs_to_jiffies(1000);
863
864 init_waitqueue_head(&host->notify);
865 tasklet_init(&host->finish_tasklet,
866 no_dma ? tifm_sd_end_cmd_nodma : tifm_sd_end_cmd,
867 (unsigned long)host);
868 setup_timer(&host->timer, tifm_sd_abort, (unsigned long)host);
869
870 tifm_sd_ops.request = no_dma ? tifm_sd_request_nodma : tifm_sd_request;
871 mmc->ops = &tifm_sd_ops;
872 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
873 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
874 mmc->f_min = 20000000 / 60;
875 mmc->f_max = 24000000;
876 mmc->max_hw_segs = 1;
877 mmc->max_phys_segs = 1;
878 // limited by DMA counter - it's safer to stick with
879 // block counter has 11 bits though
880 mmc->max_blk_count = 256;
881 // 2k maximum hw block length
882 mmc->max_blk_size = 2048;
883 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
884 mmc->max_seg_size = mmc->max_req_size;
885 sock->signal_irq = tifm_sd_signal_irq;
886 rc = tifm_sd_initialize_host(host);
887
888 if (!rc)
889 rc = mmc_add_host(mmc);
890 if (rc)
891 goto out_free_mmc;
892
893 return 0;
894out_free_mmc:
895 mmc_free_host(mmc);
896 return rc;
897}
898
899static void tifm_sd_remove(struct tifm_dev *sock)
900{
901 struct mmc_host *mmc = tifm_get_drvdata(sock);
902 struct tifm_sd *host = mmc_priv(mmc);
903
904 del_timer_sync(&host->timer);
905 tifm_sd_terminate(host);
906 wait_event_timeout(host->notify, host->flags & EJECT_DONE,
907 host->timeout_jiffies);
908 tasklet_kill(&host->finish_tasklet);
909 mmc_remove_host(mmc);
910
911 /* The meaning of the bit majority in this constant is unknown. */
912 writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
913 sock->addr + SOCK_CONTROL);
914
915 tifm_set_drvdata(sock, NULL);
916 mmc_free_host(mmc);
917}
918
919#ifdef CONFIG_PM
920
921static int tifm_sd_suspend(struct tifm_dev *sock, pm_message_t state)
922{
923 struct mmc_host *mmc = tifm_get_drvdata(sock);
924 int rc;
925
926 rc = mmc_suspend_host(mmc, state);
927 /* The meaning of the bit majority in this constant is unknown. */
928 writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
929 sock->addr + SOCK_CONTROL);
930 return rc;
931}
932
933static int tifm_sd_resume(struct tifm_dev *sock)
934{
935 struct mmc_host *mmc = tifm_get_drvdata(sock);
936 struct tifm_sd *host = mmc_priv(mmc);
937
938 if (sock->media_id != FM_SD
939 || tifm_sd_initialize_host(host)) {
940 tifm_eject(sock);
941 return 0;
942 } else {
943 return mmc_resume_host(mmc);
944 }
945}
946
947#else
948
949#define tifm_sd_suspend NULL
950#define tifm_sd_resume NULL
951
952#endif /* CONFIG_PM */
953
954static tifm_media_id tifm_sd_id_tbl[] = {
955 FM_SD, 0
956};
957
958static struct tifm_driver tifm_sd_driver = {
959 .driver = {
960 .name = DRIVER_NAME,
961 .owner = THIS_MODULE
962 },
963 .id_table = tifm_sd_id_tbl,
964 .probe = tifm_sd_probe,
965 .remove = tifm_sd_remove,
966 .suspend = tifm_sd_suspend,
967 .resume = tifm_sd_resume
968};
969
970static int __init tifm_sd_init(void)
971{
972 return tifm_register_driver(&tifm_sd_driver);
973}
974
975static void __exit tifm_sd_exit(void)
976{
977 tifm_unregister_driver(&tifm_sd_driver);
978}
979
980MODULE_AUTHOR("Alex Dubov");
981MODULE_DESCRIPTION("TI FlashMedia SD driver");
982MODULE_LICENSE("GPL");
983MODULE_DEVICE_TABLE(tifm, tifm_sd_id_tbl);
984MODULE_VERSION(DRIVER_VERSION);
985
986module_init(tifm_sd_init);
987module_exit(tifm_sd_exit);
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 690c94236d7f..ff642f8fbee7 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -49,8 +49,8 @@ config MTD_MS02NV
49 49
50 If you want to compile this driver as a module ( = code which can be 50 If you want to compile this driver as a module ( = code which can be
51 inserted in and removed from the running kernel whenever you want), 51 inserted in and removed from the running kernel whenever you want),
52 say M here and read <file:Documentation/modules.txt>. The module will 52 say M here and read <file:Documentation/kbuild/modules.txt>.
53 be called ms02-nv.o. 53 The module will be called ms02-nv.ko.
54 54
55config MTD_DATAFLASH 55config MTD_DATAFLASH
56 tristate "Support for AT45xxx DataFlash" 56 tristate "Support for AT45xxx DataFlash"
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index ce47544dc120..fc4cc8ba9e29 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -40,13 +40,11 @@ struct block2mtd_dev {
40static LIST_HEAD(blkmtd_device_list); 40static LIST_HEAD(blkmtd_device_list);
41 41
42 42
43static struct page* page_read(struct address_space *mapping, int index) 43static struct page *page_read(struct address_space *mapping, int index)
44{ 44{
45 filler_t *filler = (filler_t*)mapping->a_ops->readpage; 45 return read_mapping_page(mapping, index, NULL);
46 return read_cache_page(mapping, index, filler, NULL);
47} 46}
48 47
49
50/* erase a specified part of the device */ 48/* erase a specified part of the device */
51static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len) 49static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
52{ 50{
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
index 8a0c4dec6351..c73e96bfafc6 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
@@ -13,7 +13,6 @@
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <linux/miscdevice.h> 15#include <linux/miscdevice.h>
16#include <linux/pci.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c
index 6f368aec5d5d..6413efc045e0 100644
--- a/drivers/mtd/devices/doc2001.c
+++ b/drivers/mtd/devices/doc2001.c
@@ -13,7 +13,6 @@
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <linux/miscdevice.h> 15#include <linux/miscdevice.h>
16#include <linux/pci.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/init.h> 18#include <linux/init.h>
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c
index 88ba82df0fbb..2b30b587c6e8 100644
--- a/drivers/mtd/devices/doc2001plus.c
+++ b/drivers/mtd/devices/doc2001plus.c
@@ -17,7 +17,6 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
20#include <linux/pci.h>
21#include <linux/delay.h> 20#include <linux/delay.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <linux/init.h> 22#include <linux/init.h>
diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c
index 52b5d638077f..fd8a8daba3a8 100644
--- a/drivers/mtd/devices/docecc.c
+++ b/drivers/mtd/devices/docecc.c
@@ -29,7 +29,6 @@
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <linux/miscdevice.h> 31#include <linux/miscdevice.h>
32#include <linux/pci.h>
33#include <linux/delay.h> 32#include <linux/delay.h>
34#include <linux/slab.h> 33#include <linux/slab.h>
35#include <linux/init.h> 34#include <linux/init.h>
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index acf3ba223298..ecac0e438f49 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -31,7 +31,6 @@
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
34#include <linux/pci.h>
35#include <linux/delay.h> 34#include <linux/delay.h>
36#include <linux/slab.h> 35#include <linux/slab.h>
37#include <linux/init.h> 36#include <linux/init.h>
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index 8296305c8297..89deff007116 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -20,7 +20,6 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/pci.h>
24#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
25#include <linux/mtd/nand.h> 24#include <linux/mtd/nand.h>
26#include <linux/mtd/nand_ecc.h> 25#include <linux/mtd/nand_ecc.h>
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index e6ef7d7f9f14..0c9ce19ea27a 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -17,7 +17,6 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
20#include <linux/pci.h>
21#include <linux/delay.h> 20#include <linux/delay.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <linux/init.h> 22#include <linux/init.h>
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index d847ee1da3d9..3dba5733ed1f 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -940,8 +940,7 @@ static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
940{ 940{
941 struct ltree_entry *le = obj; 941 struct ltree_entry *le = obj;
942 942
943 if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) != 943 if (flags & SLAB_CTOR_CONSTRUCTOR)
944 SLAB_CTOR_CONSTRUCTOR)
945 return; 944 return;
946 945
947 le->users = 0; 946 le->users = 0;
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index d396f996af57..0877fc372f4b 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -565,9 +565,9 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
565 ib->btx_ring [entry].length = (-len) | 0xf000; 565 ib->btx_ring [entry].length = (-len) | 0xf000;
566 ib->btx_ring [entry].misc = 0; 566 ib->btx_ring [entry].misc = 0;
567 567
568 if (skb->len < ETH_ZLEN) 568 if (skb->len < ETH_ZLEN)
569 memset((char *)&ib->tx_buf[entry][0], 0, ETH_ZLEN); 569 memset((void *)&ib->tx_buf[entry][0], 0, ETH_ZLEN);
570 skb_copy_from_linear_data(skb, &ib->tx_buf[entry][0], skblen); 570 skb_copy_from_linear_data(skb, (void *)&ib->tx_buf[entry][0], skblen);
571 571
572 /* Now, give the packet to the lance */ 572 /* Now, give the packet to the lance */
573 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 573 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dcdad217df51..279ec625cec4 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -311,7 +311,7 @@ config MAC8390
311 311
312config MAC89x0 312config MAC89x0
313 tristate "Macintosh CS89x0 based ethernet cards" 313 tristate "Macintosh CS89x0 based ethernet cards"
314 depends on NET_ETHERNET && MAC && BROKEN 314 depends on NET_ETHERNET && MAC
315 ---help--- 315 ---help---
316 Support for CS89x0 chipset based Ethernet cards. If you have a 316 Support for CS89x0 chipset based Ethernet cards. If you have a
317 Nubus or LC-PDS network (Ethernet) card of this type, say Y and 317 Nubus or LC-PDS network (Ethernet) card of this type, say Y and
@@ -337,8 +337,8 @@ config MACSONIC
337 be called macsonic. 337 be called macsonic.
338 338
339config MACMACE 339config MACMACE
340 bool "Macintosh (AV) onboard MACE ethernet (EXPERIMENTAL)" 340 bool "Macintosh (AV) onboard MACE ethernet"
341 depends on NET_ETHERNET && MAC && EXPERIMENTAL 341 depends on NET_ETHERNET && MAC
342 select CRC32 342 select CRC32
343 help 343 help
344 Support for the onboard AMD 79C940 MACE Ethernet controller used in 344 Support for the onboard AMD 79C940 MACE Ethernet controller used in
@@ -822,7 +822,7 @@ config SMC91X
822 tristate "SMC 91C9x/91C1xxx support" 822 tristate "SMC 91C9x/91C1xxx support"
823 select CRC32 823 select CRC32
824 select MII 824 select MII
825 depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00) 825 depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BFIN)
826 help 826 help
827 This is a driver for SMC's 91x series of Ethernet chipsets, 827 This is a driver for SMC's 91x series of Ethernet chipsets,
828 including the SMC91C94 and the SMC91C111. Say Y if you want it 828 including the SMC91C94 and the SMC91C111. Say Y if you want it
@@ -833,8 +833,8 @@ config SMC91X
833 This driver is also available as a module ( = code which can be 833 This driver is also available as a module ( = code which can be
834 inserted in and removed from the running kernel whenever you want). 834 inserted in and removed from the running kernel whenever you want).
835 The module will be called smc91x. If you want to compile it as a 835 The module will be called smc91x. If you want to compile it as a
836 module, say M here and read <file:Documentation/modules.txt> as well 836 module, say M here and read <file:Documentation/kbuild/modules.txt>
837 as <file:Documentation/networking/net-modules.txt>. 837 as well as <file:Documentation/networking/net-modules.txt>.
838 838
839config SMC9194 839config SMC9194
840 tristate "SMC 9194 support" 840 tristate "SMC 9194 support"
@@ -889,7 +889,7 @@ config SMC911X
889 889
890 This driver is also available as a module. The module will be 890 This driver is also available as a module. The module will be
891 called smc911x. If you want to compile it as a module, say M 891 called smc911x. If you want to compile it as a module, say M
892 here and read <file:Documentation/modules.txt> 892 here and read <file:Documentation/kbuild/modules.txt>
893 893
894config NET_VENDOR_RACAL 894config NET_VENDOR_RACAL
895 bool "Racal-Interlan (Micom) NI cards" 895 bool "Racal-Interlan (Micom) NI cards"
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index dd8ed456c8b2..1c3e293fbaf7 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -83,7 +83,6 @@ extern struct net_device *bagetlance_probe(int unit);
83extern struct net_device *mvme147lance_probe(int unit); 83extern struct net_device *mvme147lance_probe(int unit);
84extern struct net_device *tc515_probe(int unit); 84extern struct net_device *tc515_probe(int unit);
85extern struct net_device *lance_probe(int unit); 85extern struct net_device *lance_probe(int unit);
86extern struct net_device *mace_probe(int unit);
87extern struct net_device *mac8390_probe(int unit); 86extern struct net_device *mac8390_probe(int unit);
88extern struct net_device *mac89x0_probe(int unit); 87extern struct net_device *mac89x0_probe(int unit);
89extern struct net_device *mc32_probe(int unit); 88extern struct net_device *mc32_probe(int unit);
@@ -274,9 +273,6 @@ static struct devprobe2 m68k_probes[] __initdata = {
274#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ 273#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
275 {mvme147lance_probe, 0}, 274 {mvme147lance_probe, 0},
276#endif 275#endif
277#ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */
278 {mace_probe, 0},
279#endif
280#ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ 276#ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */
281 {mac8390_probe, 0}, 277 {mac8390_probe, 0},
282#endif 278#endif
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 1226cbba0450..81d5a374042a 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -562,7 +562,6 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
562 volatile struct lance_init_block *ib = lp->init_block; 562 volatile struct lance_init_block *ib = lp->init_block;
563 int entry, skblen, len; 563 int entry, skblen, len;
564 int status = 0; 564 int status = 0;
565 static int outs;
566 unsigned long flags; 565 unsigned long flags;
567 566
568 skblen = skb->len; 567 skblen = skb->len;
@@ -598,17 +597,16 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
598 ib->btx_ring [entry].length = (-len) | 0xf000; 597 ib->btx_ring [entry].length = (-len) | 0xf000;
599 ib->btx_ring [entry].misc = 0; 598 ib->btx_ring [entry].misc = 0;
600 599
601 skb_copy_from_linear_data(skb, &ib->tx_buf [entry][0], skblen); 600 skb_copy_from_linear_data(skb, (void *)&ib->tx_buf [entry][0], skblen);
602 601
603 /* Clear the slack of the packet, do I need this? */ 602 /* Clear the slack of the packet, do I need this? */
604 if (len != skblen) 603 if (len != skblen)
605 memset ((char *) &ib->tx_buf [entry][skblen], 0, len - skblen); 604 memset ((void *) &ib->tx_buf [entry][skblen], 0, len - skblen);
606 605
607 /* Now, give the packet to the lance */ 606 /* Now, give the packet to the lance */
608 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 607 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
609 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask; 608 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask;
610 609 lp->stats.tx_bytes += skblen;
611 outs++;
612 610
613 if (TX_BUFFS_AVAIL <= 0) 611 if (TX_BUFFS_AVAIL <= 0)
614 netif_stop_queue(dev); 612 netif_stop_queue(dev);
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index a0e68e718531..a241ae7855a3 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -677,6 +677,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)
677 priv->cur_tx -= TX_RING_SIZE; 677 priv->cur_tx -= TX_RING_SIZE;
678 priv->dirty_tx -= TX_RING_SIZE; 678 priv->dirty_tx -= TX_RING_SIZE;
679 } 679 }
680 priv->stats.tx_bytes += len;
680 681
681 /* Trigger an immediate send poll. */ 682 /* Trigger an immediate send poll. */
682 lance->RAP = CSR0; /* PCnet-ISA Controller Status */ 683 lance->RAP = CSR0; /* PCnet-ISA Controller Status */
diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atl1/atl1_param.c
index c407214339f6..bcd0bd891722 100644
--- a/drivers/net/atl1/atl1_param.c
+++ b/drivers/net/atl1/atl1_param.c
@@ -22,7 +22,6 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/pci.h>
26#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
27#include "atl1.h" 26#include "atl1.h"
28 27
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index d10fb80e9a63..c39ab803c5d8 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -45,7 +45,6 @@
45#include <linux/bitops.h> 45#include <linux/bitops.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/interrupt.h> 47#include <linux/interrupt.h>
48#include <linux/pci.h>
49#include <linux/init.h> 48#include <linux/init.h>
50#include <linux/netdevice.h> 49#include <linux/netdevice.h>
51#include <linux/etherdevice.h> 50#include <linux/etherdevice.h>
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f98a2205a090..88b33c6ddda8 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1,6 +1,6 @@
1/* bnx2.c: Broadcom NX2 network driver. 1/* bnx2.c: Broadcom NX2 network driver.
2 * 2 *
3 * Copyright (c) 2004, 2005, 2006 Broadcom Corporation 3 * Copyright (c) 2004-2007 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.5.8" 57#define DRV_MODULE_VERSION "1.5.10"
58#define DRV_MODULE_RELDATE "April 24, 2007" 58#define DRV_MODULE_RELDATE "May 1, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -84,6 +84,7 @@ typedef enum {
84 BCM5708, 84 BCM5708,
85 BCM5708S, 85 BCM5708S,
86 BCM5709, 86 BCM5709,
87 BCM5709S,
87} board_t; 88} board_t;
88 89
89/* indexed by board_t, above */ 90/* indexed by board_t, above */
@@ -98,6 +99,7 @@ static const struct {
98 { "Broadcom NetXtreme II BCM5708 1000Base-T" }, 99 { "Broadcom NetXtreme II BCM5708 1000Base-T" },
99 { "Broadcom NetXtreme II BCM5708 1000Base-SX" }, 100 { "Broadcom NetXtreme II BCM5708 1000Base-SX" },
100 { "Broadcom NetXtreme II BCM5709 1000Base-T" }, 101 { "Broadcom NetXtreme II BCM5709 1000Base-T" },
102 { "Broadcom NetXtreme II BCM5709 1000Base-SX" },
101 }; 103 };
102 104
103static struct pci_device_id bnx2_pci_tbl[] = { 105static struct pci_device_id bnx2_pci_tbl[] = {
@@ -117,6 +119,8 @@ static struct pci_device_id bnx2_pci_tbl[] = {
117 PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5708S }, 119 PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5708S },
118 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5709, 120 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5709,
119 PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709 }, 121 PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709 },
122 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5709S,
123 PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709S },
120 { 0, } 124 { 0, }
121}; 125};
122 126
@@ -230,21 +234,29 @@ static inline u32 bnx2_tx_avail(struct bnx2 *bp)
230static u32 234static u32
231bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset) 235bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset)
232{ 236{
237 u32 val;
238
239 spin_lock_bh(&bp->indirect_lock);
233 REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); 240 REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
234 return (REG_RD(bp, BNX2_PCICFG_REG_WINDOW)); 241 val = REG_RD(bp, BNX2_PCICFG_REG_WINDOW);
242 spin_unlock_bh(&bp->indirect_lock);
243 return val;
235} 244}
236 245
237static void 246static void
238bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val) 247bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
239{ 248{
249 spin_lock_bh(&bp->indirect_lock);
240 REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); 250 REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
241 REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val); 251 REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val);
252 spin_unlock_bh(&bp->indirect_lock);
242} 253}
243 254
244static void 255static void
245bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val) 256bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
246{ 257{
247 offset += cid_addr; 258 offset += cid_addr;
259 spin_lock_bh(&bp->indirect_lock);
248 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 260 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
249 int i; 261 int i;
250 262
@@ -262,6 +274,7 @@ bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
262 REG_WR(bp, BNX2_CTX_DATA_ADR, offset); 274 REG_WR(bp, BNX2_CTX_DATA_ADR, offset);
263 REG_WR(bp, BNX2_CTX_DATA, val); 275 REG_WR(bp, BNX2_CTX_DATA, val);
264 } 276 }
277 spin_unlock_bh(&bp->indirect_lock);
265} 278}
266 279
267static int 280static int
@@ -572,8 +585,8 @@ bnx2_report_fw_link(struct bnx2 *bp)
572 if (bp->autoneg) { 585 if (bp->autoneg) {
573 fw_link_status |= BNX2_LINK_STATUS_AN_ENABLED; 586 fw_link_status |= BNX2_LINK_STATUS_AN_ENABLED;
574 587
575 bnx2_read_phy(bp, MII_BMSR, &bmsr); 588 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
576 bnx2_read_phy(bp, MII_BMSR, &bmsr); 589 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
577 590
578 if (!(bmsr & BMSR_ANEGCOMPLETE) || 591 if (!(bmsr & BMSR_ANEGCOMPLETE) ||
579 bp->phy_flags & PHY_PARALLEL_DETECT_FLAG) 592 bp->phy_flags & PHY_PARALLEL_DETECT_FLAG)
@@ -654,8 +667,8 @@ bnx2_resolve_flow_ctrl(struct bnx2 *bp)
654 return; 667 return;
655 } 668 }
656 669
657 bnx2_read_phy(bp, MII_ADVERTISE, &local_adv); 670 bnx2_read_phy(bp, bp->mii_adv, &local_adv);
658 bnx2_read_phy(bp, MII_LPA, &remote_adv); 671 bnx2_read_phy(bp, bp->mii_lpa, &remote_adv);
659 672
660 if (bp->phy_flags & PHY_SERDES_FLAG) { 673 if (bp->phy_flags & PHY_SERDES_FLAG) {
661 u32 new_local_adv = 0; 674 u32 new_local_adv = 0;
@@ -700,6 +713,45 @@ bnx2_resolve_flow_ctrl(struct bnx2 *bp)
700} 713}
701 714
702static int 715static int
716bnx2_5709s_linkup(struct bnx2 *bp)
717{
718 u32 val, speed;
719
720 bp->link_up = 1;
721
722 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_GP_STATUS);
723 bnx2_read_phy(bp, MII_BNX2_GP_TOP_AN_STATUS1, &val);
724 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
725
726 if ((bp->autoneg & AUTONEG_SPEED) == 0) {
727 bp->line_speed = bp->req_line_speed;
728 bp->duplex = bp->req_duplex;
729 return 0;
730 }
731 speed = val & MII_BNX2_GP_TOP_AN_SPEED_MSK;
732 switch (speed) {
733 case MII_BNX2_GP_TOP_AN_SPEED_10:
734 bp->line_speed = SPEED_10;
735 break;
736 case MII_BNX2_GP_TOP_AN_SPEED_100:
737 bp->line_speed = SPEED_100;
738 break;
739 case MII_BNX2_GP_TOP_AN_SPEED_1G:
740 case MII_BNX2_GP_TOP_AN_SPEED_1GKV:
741 bp->line_speed = SPEED_1000;
742 break;
743 case MII_BNX2_GP_TOP_AN_SPEED_2_5G:
744 bp->line_speed = SPEED_2500;
745 break;
746 }
747 if (val & MII_BNX2_GP_TOP_AN_FD)
748 bp->duplex = DUPLEX_FULL;
749 else
750 bp->duplex = DUPLEX_HALF;
751 return 0;
752}
753
754static int
703bnx2_5708s_linkup(struct bnx2 *bp) 755bnx2_5708s_linkup(struct bnx2 *bp)
704{ 756{
705 u32 val; 757 u32 val;
@@ -736,7 +788,7 @@ bnx2_5706s_linkup(struct bnx2 *bp)
736 bp->link_up = 1; 788 bp->link_up = 1;
737 bp->line_speed = SPEED_1000; 789 bp->line_speed = SPEED_1000;
738 790
739 bnx2_read_phy(bp, MII_BMCR, &bmcr); 791 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
740 if (bmcr & BMCR_FULLDPLX) { 792 if (bmcr & BMCR_FULLDPLX) {
741 bp->duplex = DUPLEX_FULL; 793 bp->duplex = DUPLEX_FULL;
742 } 794 }
@@ -748,8 +800,8 @@ bnx2_5706s_linkup(struct bnx2 *bp)
748 return 0; 800 return 0;
749 } 801 }
750 802
751 bnx2_read_phy(bp, MII_ADVERTISE, &local_adv); 803 bnx2_read_phy(bp, bp->mii_adv, &local_adv);
752 bnx2_read_phy(bp, MII_LPA, &remote_adv); 804 bnx2_read_phy(bp, bp->mii_lpa, &remote_adv);
753 805
754 common = local_adv & remote_adv; 806 common = local_adv & remote_adv;
755 if (common & (ADVERTISE_1000XHALF | ADVERTISE_1000XFULL)) { 807 if (common & (ADVERTISE_1000XHALF | ADVERTISE_1000XFULL)) {
@@ -770,7 +822,7 @@ bnx2_copper_linkup(struct bnx2 *bp)
770{ 822{
771 u32 bmcr; 823 u32 bmcr;
772 824
773 bnx2_read_phy(bp, MII_BMCR, &bmcr); 825 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
774 if (bmcr & BMCR_ANENABLE) { 826 if (bmcr & BMCR_ANENABLE) {
775 u32 local_adv, remote_adv, common; 827 u32 local_adv, remote_adv, common;
776 828
@@ -787,8 +839,8 @@ bnx2_copper_linkup(struct bnx2 *bp)
787 bp->duplex = DUPLEX_HALF; 839 bp->duplex = DUPLEX_HALF;
788 } 840 }
789 else { 841 else {
790 bnx2_read_phy(bp, MII_ADVERTISE, &local_adv); 842 bnx2_read_phy(bp, bp->mii_adv, &local_adv);
791 bnx2_read_phy(bp, MII_LPA, &remote_adv); 843 bnx2_read_phy(bp, bp->mii_lpa, &remote_adv);
792 844
793 common = local_adv & remote_adv; 845 common = local_adv & remote_adv;
794 if (common & ADVERTISE_100FULL) { 846 if (common & ADVERTISE_100FULL) {
@@ -898,6 +950,145 @@ bnx2_set_mac_link(struct bnx2 *bp)
898 return 0; 950 return 0;
899} 951}
900 952
953static void
954bnx2_enable_bmsr1(struct bnx2 *bp)
955{
956 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
957 (CHIP_NUM(bp) == CHIP_NUM_5709))
958 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
959 MII_BNX2_BLK_ADDR_GP_STATUS);
960}
961
962static void
963bnx2_disable_bmsr1(struct bnx2 *bp)
964{
965 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
966 (CHIP_NUM(bp) == CHIP_NUM_5709))
967 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
968 MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
969}
970
971static int
972bnx2_test_and_enable_2g5(struct bnx2 *bp)
973{
974 u32 up1;
975 int ret = 1;
976
977 if (!(bp->phy_flags & PHY_2_5G_CAPABLE_FLAG))
978 return 0;
979
980 if (bp->autoneg & AUTONEG_SPEED)
981 bp->advertising |= ADVERTISED_2500baseX_Full;
982
983 if (CHIP_NUM(bp) == CHIP_NUM_5709)
984 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G);
985
986 bnx2_read_phy(bp, bp->mii_up1, &up1);
987 if (!(up1 & BCM5708S_UP1_2G5)) {
988 up1 |= BCM5708S_UP1_2G5;
989 bnx2_write_phy(bp, bp->mii_up1, up1);
990 ret = 0;
991 }
992
993 if (CHIP_NUM(bp) == CHIP_NUM_5709)
994 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
995 MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
996
997 return ret;
998}
999
1000static int
1001bnx2_test_and_disable_2g5(struct bnx2 *bp)
1002{
1003 u32 up1;
1004 int ret = 0;
1005
1006 if (!(bp->phy_flags & PHY_2_5G_CAPABLE_FLAG))
1007 return 0;
1008
1009 if (CHIP_NUM(bp) == CHIP_NUM_5709)
1010 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G);
1011
1012 bnx2_read_phy(bp, bp->mii_up1, &up1);
1013 if (up1 & BCM5708S_UP1_2G5) {
1014 up1 &= ~BCM5708S_UP1_2G5;
1015 bnx2_write_phy(bp, bp->mii_up1, up1);
1016 ret = 1;
1017 }
1018
1019 if (CHIP_NUM(bp) == CHIP_NUM_5709)
1020 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
1021 MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
1022
1023 return ret;
1024}
1025
1026static void
1027bnx2_enable_forced_2g5(struct bnx2 *bp)
1028{
1029 u32 bmcr;
1030
1031 if (!(bp->phy_flags & PHY_2_5G_CAPABLE_FLAG))
1032 return;
1033
1034 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
1035 u32 val;
1036
1037 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
1038 MII_BNX2_BLK_ADDR_SERDES_DIG);
1039 bnx2_read_phy(bp, MII_BNX2_SERDES_DIG_MISC1, &val);
1040 val &= ~MII_BNX2_SD_MISC1_FORCE_MSK;
1041 val |= MII_BNX2_SD_MISC1_FORCE | MII_BNX2_SD_MISC1_FORCE_2_5G;
1042 bnx2_write_phy(bp, MII_BNX2_SERDES_DIG_MISC1, val);
1043
1044 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
1045 MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
1046 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1047
1048 } else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
1049 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1050 bmcr |= BCM5708S_BMCR_FORCE_2500;
1051 }
1052
1053 if (bp->autoneg & AUTONEG_SPEED) {
1054 bmcr &= ~BMCR_ANENABLE;
1055 if (bp->req_duplex == DUPLEX_FULL)
1056 bmcr |= BMCR_FULLDPLX;
1057 }
1058 bnx2_write_phy(bp, bp->mii_bmcr, bmcr);
1059}
1060
1061static void
1062bnx2_disable_forced_2g5(struct bnx2 *bp)
1063{
1064 u32 bmcr;
1065
1066 if (!(bp->phy_flags & PHY_2_5G_CAPABLE_FLAG))
1067 return;
1068
1069 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
1070 u32 val;
1071
1072 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
1073 MII_BNX2_BLK_ADDR_SERDES_DIG);
1074 bnx2_read_phy(bp, MII_BNX2_SERDES_DIG_MISC1, &val);
1075 val &= ~MII_BNX2_SD_MISC1_FORCE;
1076 bnx2_write_phy(bp, MII_BNX2_SERDES_DIG_MISC1, val);
1077
1078 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
1079 MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
1080 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1081
1082 } else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
1083 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1084 bmcr &= ~BCM5708S_BMCR_FORCE_2500;
1085 }
1086
1087 if (bp->autoneg & AUTONEG_SPEED)
1088 bmcr |= BMCR_SPEED1000 | BMCR_ANENABLE | BMCR_ANRESTART;
1089 bnx2_write_phy(bp, bp->mii_bmcr, bmcr);
1090}
1091
901static int 1092static int
902bnx2_set_link(struct bnx2 *bp) 1093bnx2_set_link(struct bnx2 *bp)
903{ 1094{
@@ -911,8 +1102,10 @@ bnx2_set_link(struct bnx2 *bp)
911 1102
912 link_up = bp->link_up; 1103 link_up = bp->link_up;
913 1104
914 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1105 bnx2_enable_bmsr1(bp);
915 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1106 bnx2_read_phy(bp, bp->mii_bmsr1, &bmsr);
1107 bnx2_read_phy(bp, bp->mii_bmsr1, &bmsr);
1108 bnx2_disable_bmsr1(bp);
916 1109
917 if ((bp->phy_flags & PHY_SERDES_FLAG) && 1110 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
918 (CHIP_NUM(bp) == CHIP_NUM_5706)) { 1111 (CHIP_NUM(bp) == CHIP_NUM_5706)) {
@@ -933,6 +1126,8 @@ bnx2_set_link(struct bnx2 *bp)
933 bnx2_5706s_linkup(bp); 1126 bnx2_5706s_linkup(bp);
934 else if (CHIP_NUM(bp) == CHIP_NUM_5708) 1127 else if (CHIP_NUM(bp) == CHIP_NUM_5708)
935 bnx2_5708s_linkup(bp); 1128 bnx2_5708s_linkup(bp);
1129 else if (CHIP_NUM(bp) == CHIP_NUM_5709)
1130 bnx2_5709s_linkup(bp);
936 } 1131 }
937 else { 1132 else {
938 bnx2_copper_linkup(bp); 1133 bnx2_copper_linkup(bp);
@@ -941,17 +1136,9 @@ bnx2_set_link(struct bnx2 *bp)
941 } 1136 }
942 else { 1137 else {
943 if ((bp->phy_flags & PHY_SERDES_FLAG) && 1138 if ((bp->phy_flags & PHY_SERDES_FLAG) &&
944 (bp->autoneg & AUTONEG_SPEED)) { 1139 (bp->autoneg & AUTONEG_SPEED))
1140 bnx2_disable_forced_2g5(bp);
945 1141
946 u32 bmcr;
947
948 bnx2_read_phy(bp, MII_BMCR, &bmcr);
949 bmcr &= ~BCM5708S_BMCR_FORCE_2500;
950 if (!(bmcr & BMCR_ANENABLE)) {
951 bnx2_write_phy(bp, MII_BMCR, bmcr |
952 BMCR_ANENABLE);
953 }
954 }
955 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG; 1142 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG;
956 bp->link_up = 0; 1143 bp->link_up = 0;
957 } 1144 }
@@ -971,13 +1158,13 @@ bnx2_reset_phy(struct bnx2 *bp)
971 int i; 1158 int i;
972 u32 reg; 1159 u32 reg;
973 1160
974 bnx2_write_phy(bp, MII_BMCR, BMCR_RESET); 1161 bnx2_write_phy(bp, bp->mii_bmcr, BMCR_RESET);
975 1162
976#define PHY_RESET_MAX_WAIT 100 1163#define PHY_RESET_MAX_WAIT 100
977 for (i = 0; i < PHY_RESET_MAX_WAIT; i++) { 1164 for (i = 0; i < PHY_RESET_MAX_WAIT; i++) {
978 udelay(10); 1165 udelay(10);
979 1166
980 bnx2_read_phy(bp, MII_BMCR, &reg); 1167 bnx2_read_phy(bp, bp->mii_bmcr, &reg);
981 if (!(reg & BMCR_RESET)) { 1168 if (!(reg & BMCR_RESET)) {
982 udelay(20); 1169 udelay(20);
983 break; 1170 break;
@@ -1026,34 +1213,40 @@ bnx2_phy_get_pause_adv(struct bnx2 *bp)
1026static int 1213static int
1027bnx2_setup_serdes_phy(struct bnx2 *bp) 1214bnx2_setup_serdes_phy(struct bnx2 *bp)
1028{ 1215{
1029 u32 adv, bmcr, up1; 1216 u32 adv, bmcr;
1030 u32 new_adv = 0; 1217 u32 new_adv = 0;
1031 1218
1032 if (!(bp->autoneg & AUTONEG_SPEED)) { 1219 if (!(bp->autoneg & AUTONEG_SPEED)) {
1033 u32 new_bmcr; 1220 u32 new_bmcr;
1034 int force_link_down = 0; 1221 int force_link_down = 0;
1035 1222
1036 bnx2_read_phy(bp, MII_ADVERTISE, &adv); 1223 if (bp->req_line_speed == SPEED_2500) {
1224 if (!bnx2_test_and_enable_2g5(bp))
1225 force_link_down = 1;
1226 } else if (bp->req_line_speed == SPEED_1000) {
1227 if (bnx2_test_and_disable_2g5(bp))
1228 force_link_down = 1;
1229 }
1230 bnx2_read_phy(bp, bp->mii_adv, &adv);
1037 adv &= ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF); 1231 adv &= ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF);
1038 1232
1039 bnx2_read_phy(bp, MII_BMCR, &bmcr); 1233 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1040 new_bmcr = bmcr & ~(BMCR_ANENABLE | BCM5708S_BMCR_FORCE_2500); 1234 new_bmcr = bmcr & ~BMCR_ANENABLE;
1041 new_bmcr |= BMCR_SPEED1000; 1235 new_bmcr |= BMCR_SPEED1000;
1042 if (bp->req_line_speed == SPEED_2500) { 1236
1043 new_bmcr |= BCM5708S_BMCR_FORCE_2500; 1237 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
1044 bnx2_read_phy(bp, BCM5708S_UP1, &up1); 1238 if (bp->req_line_speed == SPEED_2500)
1045 if (!(up1 & BCM5708S_UP1_2G5)) { 1239 bnx2_enable_forced_2g5(bp);
1046 up1 |= BCM5708S_UP1_2G5; 1240 else if (bp->req_line_speed == SPEED_1000) {
1047 bnx2_write_phy(bp, BCM5708S_UP1, up1); 1241 bnx2_disable_forced_2g5(bp);
1048 force_link_down = 1; 1242 new_bmcr &= ~0x2000;
1049 } 1243 }
1244
1050 } else if (CHIP_NUM(bp) == CHIP_NUM_5708) { 1245 } else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
1051 bnx2_read_phy(bp, BCM5708S_UP1, &up1); 1246 if (bp->req_line_speed == SPEED_2500)
1052 if (up1 & BCM5708S_UP1_2G5) { 1247 new_bmcr |= BCM5708S_BMCR_FORCE_2500;
1053 up1 &= ~BCM5708S_UP1_2G5; 1248 else
1054 bnx2_write_phy(bp, BCM5708S_UP1, up1); 1249 new_bmcr = bmcr & ~BCM5708S_BMCR_FORCE_2500;
1055 force_link_down = 1;
1056 }
1057 } 1250 }
1058 1251
1059 if (bp->req_duplex == DUPLEX_FULL) { 1252 if (bp->req_duplex == DUPLEX_FULL) {
@@ -1067,49 +1260,48 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
1067 if ((new_bmcr != bmcr) || (force_link_down)) { 1260 if ((new_bmcr != bmcr) || (force_link_down)) {
1068 /* Force a link down visible on the other side */ 1261 /* Force a link down visible on the other side */
1069 if (bp->link_up) { 1262 if (bp->link_up) {
1070 bnx2_write_phy(bp, MII_ADVERTISE, adv & 1263 bnx2_write_phy(bp, bp->mii_adv, adv &
1071 ~(ADVERTISE_1000XFULL | 1264 ~(ADVERTISE_1000XFULL |
1072 ADVERTISE_1000XHALF)); 1265 ADVERTISE_1000XHALF));
1073 bnx2_write_phy(bp, MII_BMCR, bmcr | 1266 bnx2_write_phy(bp, bp->mii_bmcr, bmcr |
1074 BMCR_ANRESTART | BMCR_ANENABLE); 1267 BMCR_ANRESTART | BMCR_ANENABLE);
1075 1268
1076 bp->link_up = 0; 1269 bp->link_up = 0;
1077 netif_carrier_off(bp->dev); 1270 netif_carrier_off(bp->dev);
1078 bnx2_write_phy(bp, MII_BMCR, new_bmcr); 1271 bnx2_write_phy(bp, bp->mii_bmcr, new_bmcr);
1079 bnx2_report_link(bp); 1272 bnx2_report_link(bp);
1080 } 1273 }
1081 bnx2_write_phy(bp, MII_ADVERTISE, adv); 1274 bnx2_write_phy(bp, bp->mii_adv, adv);
1082 bnx2_write_phy(bp, MII_BMCR, new_bmcr); 1275 bnx2_write_phy(bp, bp->mii_bmcr, new_bmcr);
1276 } else {
1277 bnx2_resolve_flow_ctrl(bp);
1278 bnx2_set_mac_link(bp);
1083 } 1279 }
1084 return 0; 1280 return 0;
1085 } 1281 }
1086 1282
1087 if (bp->phy_flags & PHY_2_5G_CAPABLE_FLAG) { 1283 bnx2_test_and_enable_2g5(bp);
1088 bnx2_read_phy(bp, BCM5708S_UP1, &up1);
1089 up1 |= BCM5708S_UP1_2G5;
1090 bnx2_write_phy(bp, BCM5708S_UP1, up1);
1091 }
1092 1284
1093 if (bp->advertising & ADVERTISED_1000baseT_Full) 1285 if (bp->advertising & ADVERTISED_1000baseT_Full)
1094 new_adv |= ADVERTISE_1000XFULL; 1286 new_adv |= ADVERTISE_1000XFULL;
1095 1287
1096 new_adv |= bnx2_phy_get_pause_adv(bp); 1288 new_adv |= bnx2_phy_get_pause_adv(bp);
1097 1289
1098 bnx2_read_phy(bp, MII_ADVERTISE, &adv); 1290 bnx2_read_phy(bp, bp->mii_adv, &adv);
1099 bnx2_read_phy(bp, MII_BMCR, &bmcr); 1291 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1100 1292
1101 bp->serdes_an_pending = 0; 1293 bp->serdes_an_pending = 0;
1102 if ((adv != new_adv) || ((bmcr & BMCR_ANENABLE) == 0)) { 1294 if ((adv != new_adv) || ((bmcr & BMCR_ANENABLE) == 0)) {
1103 /* Force a link down visible on the other side */ 1295 /* Force a link down visible on the other side */
1104 if (bp->link_up) { 1296 if (bp->link_up) {
1105 bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); 1297 bnx2_write_phy(bp, bp->mii_bmcr, BMCR_LOOPBACK);
1106 spin_unlock_bh(&bp->phy_lock); 1298 spin_unlock_bh(&bp->phy_lock);
1107 msleep(20); 1299 msleep(20);
1108 spin_lock_bh(&bp->phy_lock); 1300 spin_lock_bh(&bp->phy_lock);
1109 } 1301 }
1110 1302
1111 bnx2_write_phy(bp, MII_ADVERTISE, new_adv); 1303 bnx2_write_phy(bp, bp->mii_adv, new_adv);
1112 bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | 1304 bnx2_write_phy(bp, bp->mii_bmcr, bmcr | BMCR_ANRESTART |
1113 BMCR_ANENABLE); 1305 BMCR_ANENABLE);
1114 /* Speed up link-up time when the link partner 1306 /* Speed up link-up time when the link partner
1115 * does not autonegotiate which is very common 1307 * does not autonegotiate which is very common
@@ -1122,6 +1314,9 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
1122 bp->current_interval = SERDES_AN_TIMEOUT; 1314 bp->current_interval = SERDES_AN_TIMEOUT;
1123 bp->serdes_an_pending = 1; 1315 bp->serdes_an_pending = 1;
1124 mod_timer(&bp->timer, jiffies + bp->current_interval); 1316 mod_timer(&bp->timer, jiffies + bp->current_interval);
1317 } else {
1318 bnx2_resolve_flow_ctrl(bp);
1319 bnx2_set_mac_link(bp);
1125 } 1320 }
1126 1321
1127 return 0; 1322 return 0;
@@ -1146,14 +1341,14 @@ bnx2_setup_copper_phy(struct bnx2 *bp)
1146 u32 bmcr; 1341 u32 bmcr;
1147 u32 new_bmcr; 1342 u32 new_bmcr;
1148 1343
1149 bnx2_read_phy(bp, MII_BMCR, &bmcr); 1344 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
1150 1345
1151 if (bp->autoneg & AUTONEG_SPEED) { 1346 if (bp->autoneg & AUTONEG_SPEED) {
1152 u32 adv_reg, adv1000_reg; 1347 u32 adv_reg, adv1000_reg;
1153 u32 new_adv_reg = 0; 1348 u32 new_adv_reg = 0;
1154 u32 new_adv1000_reg = 0; 1349 u32 new_adv1000_reg = 0;
1155 1350
1156 bnx2_read_phy(bp, MII_ADVERTISE, &adv_reg); 1351 bnx2_read_phy(bp, bp->mii_adv, &adv_reg);
1157 adv_reg &= (PHY_ALL_10_100_SPEED | ADVERTISE_PAUSE_CAP | 1352 adv_reg &= (PHY_ALL_10_100_SPEED | ADVERTISE_PAUSE_CAP |
1158 ADVERTISE_PAUSE_ASYM); 1353 ADVERTISE_PAUSE_ASYM);
1159 1354
@@ -1179,9 +1374,9 @@ bnx2_setup_copper_phy(struct bnx2 *bp)
1179 (adv_reg != new_adv_reg) || 1374 (adv_reg != new_adv_reg) ||
1180 ((bmcr & BMCR_ANENABLE) == 0)) { 1375 ((bmcr & BMCR_ANENABLE) == 0)) {
1181 1376
1182 bnx2_write_phy(bp, MII_ADVERTISE, new_adv_reg); 1377 bnx2_write_phy(bp, bp->mii_adv, new_adv_reg);
1183 bnx2_write_phy(bp, MII_CTRL1000, new_adv1000_reg); 1378 bnx2_write_phy(bp, MII_CTRL1000, new_adv1000_reg);
1184 bnx2_write_phy(bp, MII_BMCR, BMCR_ANRESTART | 1379 bnx2_write_phy(bp, bp->mii_bmcr, BMCR_ANRESTART |
1185 BMCR_ANENABLE); 1380 BMCR_ANENABLE);
1186 } 1381 }
1187 else if (bp->link_up) { 1382 else if (bp->link_up) {
@@ -1204,21 +1399,21 @@ bnx2_setup_copper_phy(struct bnx2 *bp)
1204 if (new_bmcr != bmcr) { 1399 if (new_bmcr != bmcr) {
1205 u32 bmsr; 1400 u32 bmsr;
1206 1401
1207 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1402 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
1208 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1403 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
1209 1404
1210 if (bmsr & BMSR_LSTATUS) { 1405 if (bmsr & BMSR_LSTATUS) {
1211 /* Force link down */ 1406 /* Force link down */
1212 bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); 1407 bnx2_write_phy(bp, bp->mii_bmcr, BMCR_LOOPBACK);
1213 spin_unlock_bh(&bp->phy_lock); 1408 spin_unlock_bh(&bp->phy_lock);
1214 msleep(50); 1409 msleep(50);
1215 spin_lock_bh(&bp->phy_lock); 1410 spin_lock_bh(&bp->phy_lock);
1216 1411
1217 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1412 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
1218 bnx2_read_phy(bp, MII_BMSR, &bmsr); 1413 bnx2_read_phy(bp, bp->mii_bmsr, &bmsr);
1219 } 1414 }
1220 1415
1221 bnx2_write_phy(bp, MII_BMCR, new_bmcr); 1416 bnx2_write_phy(bp, bp->mii_bmcr, new_bmcr);
1222 1417
1223 /* Normally, the new speed is setup after the link has 1418 /* Normally, the new speed is setup after the link has
1224 * gone down and up again. In some cases, link will not go 1419 * gone down and up again. In some cases, link will not go
@@ -1230,6 +1425,9 @@ bnx2_setup_copper_phy(struct bnx2 *bp)
1230 bnx2_resolve_flow_ctrl(bp); 1425 bnx2_resolve_flow_ctrl(bp);
1231 bnx2_set_mac_link(bp); 1426 bnx2_set_mac_link(bp);
1232 } 1427 }
1428 } else {
1429 bnx2_resolve_flow_ctrl(bp);
1430 bnx2_set_mac_link(bp);
1233 } 1431 }
1234 return 0; 1432 return 0;
1235} 1433}
@@ -1249,10 +1447,63 @@ bnx2_setup_phy(struct bnx2 *bp)
1249} 1447}
1250 1448
1251static int 1449static int
1450bnx2_init_5709s_phy(struct bnx2 *bp)
1451{
1452 u32 val;
1453
1454 bp->mii_bmcr = MII_BMCR + 0x10;
1455 bp->mii_bmsr = MII_BMSR + 0x10;
1456 bp->mii_bmsr1 = MII_BNX2_GP_TOP_AN_STATUS1;
1457 bp->mii_adv = MII_ADVERTISE + 0x10;
1458 bp->mii_lpa = MII_LPA + 0x10;
1459 bp->mii_up1 = MII_BNX2_OVER1G_UP1;
1460
1461 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_AER);
1462 bnx2_write_phy(bp, MII_BNX2_AER_AER, MII_BNX2_AER_AER_AN_MMD);
1463
1464 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
1465 bnx2_reset_phy(bp);
1466
1467 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_SERDES_DIG);
1468
1469 bnx2_read_phy(bp, MII_BNX2_SERDES_DIG_1000XCTL1, &val);
1470 val &= ~MII_BNX2_SD_1000XCTL1_AUTODET;
1471 val |= MII_BNX2_SD_1000XCTL1_FIBER;
1472 bnx2_write_phy(bp, MII_BNX2_SERDES_DIG_1000XCTL1, val);
1473
1474 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G);
1475 bnx2_read_phy(bp, MII_BNX2_OVER1G_UP1, &val);
1476 if (bp->phy_flags & PHY_2_5G_CAPABLE_FLAG)
1477 val |= BCM5708S_UP1_2G5;
1478 else
1479 val &= ~BCM5708S_UP1_2G5;
1480 bnx2_write_phy(bp, MII_BNX2_OVER1G_UP1, val);
1481
1482 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_BAM_NXTPG);
1483 bnx2_read_phy(bp, MII_BNX2_BAM_NXTPG_CTL, &val);
1484 val |= MII_BNX2_NXTPG_CTL_T2 | MII_BNX2_NXTPG_CTL_BAM;
1485 bnx2_write_phy(bp, MII_BNX2_BAM_NXTPG_CTL, val);
1486
1487 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_CL73_USERB0);
1488
1489 val = MII_BNX2_CL73_BAM_EN | MII_BNX2_CL73_BAM_STA_MGR_EN |
1490 MII_BNX2_CL73_BAM_NP_AFT_BP_EN;
1491 bnx2_write_phy(bp, MII_BNX2_CL73_BAM_CTL1, val);
1492
1493 bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
1494
1495 return 0;
1496}
1497
1498static int
1252bnx2_init_5708s_phy(struct bnx2 *bp) 1499bnx2_init_5708s_phy(struct bnx2 *bp)
1253{ 1500{
1254 u32 val; 1501 u32 val;
1255 1502
1503 bnx2_reset_phy(bp);
1504
1505 bp->mii_up1 = BCM5708S_UP1;
1506
1256 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG3); 1507 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG3);
1257 bnx2_write_phy(bp, BCM5708S_DIG_3_0, BCM5708S_DIG_3_0_USE_IEEE); 1508 bnx2_write_phy(bp, BCM5708S_DIG_3_0, BCM5708S_DIG_3_0_USE_IEEE);
1258 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG); 1509 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG);
@@ -1305,6 +1556,8 @@ bnx2_init_5708s_phy(struct bnx2 *bp)
1305static int 1556static int
1306bnx2_init_5706s_phy(struct bnx2 *bp) 1557bnx2_init_5706s_phy(struct bnx2 *bp)
1307{ 1558{
1559 bnx2_reset_phy(bp);
1560
1308 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG; 1561 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG;
1309 1562
1310 if (CHIP_NUM(bp) == CHIP_NUM_5706) 1563 if (CHIP_NUM(bp) == CHIP_NUM_5706)
@@ -1342,6 +1595,8 @@ bnx2_init_copper_phy(struct bnx2 *bp)
1342{ 1595{
1343 u32 val; 1596 u32 val;
1344 1597
1598 bnx2_reset_phy(bp);
1599
1345 if (bp->phy_flags & PHY_CRC_FIX_FLAG) { 1600 if (bp->phy_flags & PHY_CRC_FIX_FLAG) {
1346 bnx2_write_phy(bp, 0x18, 0x0c00); 1601 bnx2_write_phy(bp, 0x18, 0x0c00);
1347 bnx2_write_phy(bp, 0x17, 0x000a); 1602 bnx2_write_phy(bp, 0x17, 0x000a);
@@ -1396,9 +1651,13 @@ bnx2_init_phy(struct bnx2 *bp)
1396 bp->phy_flags &= ~PHY_INT_MODE_MASK_FLAG; 1651 bp->phy_flags &= ~PHY_INT_MODE_MASK_FLAG;
1397 bp->phy_flags |= PHY_INT_MODE_LINK_READY_FLAG; 1652 bp->phy_flags |= PHY_INT_MODE_LINK_READY_FLAG;
1398 1653
1399 REG_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK); 1654 bp->mii_bmcr = MII_BMCR;
1655 bp->mii_bmsr = MII_BMSR;
1656 bp->mii_bmsr1 = MII_BMSR;
1657 bp->mii_adv = MII_ADVERTISE;
1658 bp->mii_lpa = MII_LPA;
1400 1659
1401 bnx2_reset_phy(bp); 1660 REG_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK);
1402 1661
1403 bnx2_read_phy(bp, MII_PHYSID1, &val); 1662 bnx2_read_phy(bp, MII_PHYSID1, &val);
1404 bp->phy_id = val << 16; 1663 bp->phy_id = val << 16;
@@ -1410,6 +1669,8 @@ bnx2_init_phy(struct bnx2 *bp)
1410 rc = bnx2_init_5706s_phy(bp); 1669 rc = bnx2_init_5706s_phy(bp);
1411 else if (CHIP_NUM(bp) == CHIP_NUM_5708) 1670 else if (CHIP_NUM(bp) == CHIP_NUM_5708)
1412 rc = bnx2_init_5708s_phy(bp); 1671 rc = bnx2_init_5708s_phy(bp);
1672 else if (CHIP_NUM(bp) == CHIP_NUM_5709)
1673 rc = bnx2_init_5709s_phy(bp);
1413 } 1674 }
1414 else { 1675 else {
1415 rc = bnx2_init_copper_phy(bp); 1676 rc = bnx2_init_copper_phy(bp);
@@ -1442,7 +1703,7 @@ bnx2_set_phy_loopback(struct bnx2 *bp)
1442 int rc, i; 1703 int rc, i;
1443 1704
1444 spin_lock_bh(&bp->phy_lock); 1705 spin_lock_bh(&bp->phy_lock);
1445 rc = bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | 1706 rc = bnx2_write_phy(bp, bp->mii_bmcr, BMCR_LOOPBACK | BMCR_FULLDPLX |
1446 BMCR_SPEED1000); 1707 BMCR_SPEED1000);
1447 spin_unlock_bh(&bp->phy_lock); 1708 spin_unlock_bh(&bp->phy_lock);
1448 if (rc) 1709 if (rc)
@@ -1681,25 +1942,33 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
1681 return 0; 1942 return 0;
1682} 1943}
1683 1944
1684static void 1945static int
1685bnx2_phy_int(struct bnx2 *bp) 1946bnx2_phy_event_is_set(struct bnx2 *bp, u32 event)
1686{ 1947{
1948 struct status_block *sblk = bp->status_blk;
1687 u32 new_link_state, old_link_state; 1949 u32 new_link_state, old_link_state;
1950 int is_set = 1;
1688 1951
1689 new_link_state = bp->status_blk->status_attn_bits & 1952 new_link_state = sblk->status_attn_bits & event;
1690 STATUS_ATTN_BITS_LINK_STATE; 1953 old_link_state = sblk->status_attn_bits_ack & event;
1691 old_link_state = bp->status_blk->status_attn_bits_ack &
1692 STATUS_ATTN_BITS_LINK_STATE;
1693 if (new_link_state != old_link_state) { 1954 if (new_link_state != old_link_state) {
1694 if (new_link_state) { 1955 if (new_link_state)
1695 REG_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD, 1956 REG_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD, event);
1696 STATUS_ATTN_BITS_LINK_STATE); 1957 else
1697 } 1958 REG_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD, event);
1698 else { 1959 } else
1699 REG_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD, 1960 is_set = 0;
1700 STATUS_ATTN_BITS_LINK_STATE); 1961
1701 } 1962 return is_set;
1963}
1964
1965static void
1966bnx2_phy_int(struct bnx2 *bp)
1967{
1968 if (bnx2_phy_event_is_set(bp, STATUS_ATTN_BITS_LINK_STATE)) {
1969 spin_lock(&bp->phy_lock);
1702 bnx2_set_link(bp); 1970 bnx2_set_link(bp);
1971 spin_unlock(&bp->phy_lock);
1703 } 1972 }
1704} 1973}
1705 1974
@@ -1993,6 +2262,23 @@ bnx2_msi(int irq, void *dev_instance)
1993} 2262}
1994 2263
1995static irqreturn_t 2264static irqreturn_t
2265bnx2_msi_1shot(int irq, void *dev_instance)
2266{
2267 struct net_device *dev = dev_instance;
2268 struct bnx2 *bp = netdev_priv(dev);
2269
2270 prefetch(bp->status_blk);
2271
2272 /* Return here if interrupt is disabled. */
2273 if (unlikely(atomic_read(&bp->intr_sem) != 0))
2274 return IRQ_HANDLED;
2275
2276 netif_rx_schedule(dev);
2277
2278 return IRQ_HANDLED;
2279}
2280
2281static irqreturn_t
1996bnx2_interrupt(int irq, void *dev_instance) 2282bnx2_interrupt(int irq, void *dev_instance)
1997{ 2283{
1998 struct net_device *dev = dev_instance; 2284 struct net_device *dev = dev_instance;
@@ -2022,6 +2308,8 @@ bnx2_interrupt(int irq, void *dev_instance)
2022 return IRQ_HANDLED; 2308 return IRQ_HANDLED;
2023} 2309}
2024 2310
2311#define STATUS_ATTN_EVENTS STATUS_ATTN_BITS_LINK_STATE
2312
2025static inline int 2313static inline int
2026bnx2_has_work(struct bnx2 *bp) 2314bnx2_has_work(struct bnx2 *bp)
2027{ 2315{
@@ -2031,8 +2319,8 @@ bnx2_has_work(struct bnx2 *bp)
2031 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) 2319 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
2032 return 1; 2320 return 1;
2033 2321
2034 if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 2322 if ((sblk->status_attn_bits & STATUS_ATTN_EVENTS) !=
2035 (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) 2323 (sblk->status_attn_bits_ack & STATUS_ATTN_EVENTS))
2036 return 1; 2324 return 1;
2037 2325
2038 return 0; 2326 return 0;
@@ -2042,15 +2330,14 @@ static int
2042bnx2_poll(struct net_device *dev, int *budget) 2330bnx2_poll(struct net_device *dev, int *budget)
2043{ 2331{
2044 struct bnx2 *bp = netdev_priv(dev); 2332 struct bnx2 *bp = netdev_priv(dev);
2333 struct status_block *sblk = bp->status_blk;
2334 u32 status_attn_bits = sblk->status_attn_bits;
2335 u32 status_attn_bits_ack = sblk->status_attn_bits_ack;
2045 2336
2046 if ((bp->status_blk->status_attn_bits & 2337 if ((status_attn_bits & STATUS_ATTN_EVENTS) !=
2047 STATUS_ATTN_BITS_LINK_STATE) != 2338 (status_attn_bits_ack & STATUS_ATTN_EVENTS)) {
2048 (bp->status_blk->status_attn_bits_ack &
2049 STATUS_ATTN_BITS_LINK_STATE)) {
2050 2339
2051 spin_lock(&bp->phy_lock);
2052 bnx2_phy_int(bp); 2340 bnx2_phy_int(bp);
2053 spin_unlock(&bp->phy_lock);
2054 2341
2055 /* This is needed to take care of transient status 2342 /* This is needed to take care of transient status
2056 * during link changes. 2343 * during link changes.
@@ -3489,17 +3776,21 @@ bnx2_init_chip(struct bnx2 *bp)
3489 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ 3776 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */
3490 3777
3491 if (CHIP_ID(bp) == CHIP_ID_5706_A1) 3778 if (CHIP_ID(bp) == CHIP_ID_5706_A1)
3492 REG_WR(bp, BNX2_HC_CONFIG, BNX2_HC_CONFIG_COLLECT_STATS); 3779 val = BNX2_HC_CONFIG_COLLECT_STATS;
3493 else { 3780 else {
3494 REG_WR(bp, BNX2_HC_CONFIG, BNX2_HC_CONFIG_RX_TMR_MODE | 3781 val = BNX2_HC_CONFIG_RX_TMR_MODE | BNX2_HC_CONFIG_TX_TMR_MODE |
3495 BNX2_HC_CONFIG_TX_TMR_MODE | 3782 BNX2_HC_CONFIG_COLLECT_STATS;
3496 BNX2_HC_CONFIG_COLLECT_STATS);
3497 } 3783 }
3498 3784
3785 if (bp->flags & ONE_SHOT_MSI_FLAG)
3786 val |= BNX2_HC_CONFIG_ONE_SHOT;
3787
3788 REG_WR(bp, BNX2_HC_CONFIG, val);
3789
3499 /* Clear internal stats counters. */ 3790 /* Clear internal stats counters. */
3500 REG_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW); 3791 REG_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW);
3501 3792
3502 REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE); 3793 REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS);
3503 3794
3504 if (REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE) & 3795 if (REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE) &
3505 BNX2_PORT_FEATURE_ASF_ENABLED) 3796 BNX2_PORT_FEATURE_ASF_ENABLED)
@@ -3763,10 +4054,11 @@ static int
3763bnx2_test_registers(struct bnx2 *bp) 4054bnx2_test_registers(struct bnx2 *bp)
3764{ 4055{
3765 int ret; 4056 int ret;
3766 int i; 4057 int i, is_5709;
3767 static const struct { 4058 static const struct {
3768 u16 offset; 4059 u16 offset;
3769 u16 flags; 4060 u16 flags;
4061#define BNX2_FL_NOT_5709 1
3770 u32 rw_mask; 4062 u32 rw_mask;
3771 u32 ro_mask; 4063 u32 ro_mask;
3772 } reg_tbl[] = { 4064 } reg_tbl[] = {
@@ -3774,26 +4066,26 @@ bnx2_test_registers(struct bnx2 *bp)
3774 { 0x0090, 0, 0xffffffff, 0x00000000 }, 4066 { 0x0090, 0, 0xffffffff, 0x00000000 },
3775 { 0x0094, 0, 0x00000000, 0x00000000 }, 4067 { 0x0094, 0, 0x00000000, 0x00000000 },
3776 4068
3777 { 0x0404, 0, 0x00003f00, 0x00000000 }, 4069 { 0x0404, BNX2_FL_NOT_5709, 0x00003f00, 0x00000000 },
3778 { 0x0418, 0, 0x00000000, 0xffffffff }, 4070 { 0x0418, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3779 { 0x041c, 0, 0x00000000, 0xffffffff }, 4071 { 0x041c, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3780 { 0x0420, 0, 0x00000000, 0x80ffffff }, 4072 { 0x0420, BNX2_FL_NOT_5709, 0x00000000, 0x80ffffff },
3781 { 0x0424, 0, 0x00000000, 0x00000000 }, 4073 { 0x0424, BNX2_FL_NOT_5709, 0x00000000, 0x00000000 },
3782 { 0x0428, 0, 0x00000000, 0x00000001 }, 4074 { 0x0428, BNX2_FL_NOT_5709, 0x00000000, 0x00000001 },
3783 { 0x0450, 0, 0x00000000, 0x0000ffff }, 4075 { 0x0450, BNX2_FL_NOT_5709, 0x00000000, 0x0000ffff },
3784 { 0x0454, 0, 0x00000000, 0xffffffff }, 4076 { 0x0454, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3785 { 0x0458, 0, 0x00000000, 0xffffffff }, 4077 { 0x0458, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3786 4078
3787 { 0x0808, 0, 0x00000000, 0xffffffff }, 4079 { 0x0808, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3788 { 0x0854, 0, 0x00000000, 0xffffffff }, 4080 { 0x0854, BNX2_FL_NOT_5709, 0x00000000, 0xffffffff },
3789 { 0x0868, 0, 0x00000000, 0x77777777 }, 4081 { 0x0868, BNX2_FL_NOT_5709, 0x00000000, 0x77777777 },
3790 { 0x086c, 0, 0x00000000, 0x77777777 }, 4082 { 0x086c, BNX2_FL_NOT_5709, 0x00000000, 0x77777777 },
3791 { 0x0870, 0, 0x00000000, 0x77777777 }, 4083 { 0x0870, BNX2_FL_NOT_5709, 0x00000000, 0x77777777 },
3792 { 0x0874, 0, 0x00000000, 0x77777777 }, 4084 { 0x0874, BNX2_FL_NOT_5709, 0x00000000, 0x77777777 },
3793 4085
3794 { 0x0c00, 0, 0x00000000, 0x00000001 }, 4086 { 0x0c00, BNX2_FL_NOT_5709, 0x00000000, 0x00000001 },
3795 { 0x0c04, 0, 0x00000000, 0x03ff0001 }, 4087 { 0x0c04, BNX2_FL_NOT_5709, 0x00000000, 0x03ff0001 },
3796 { 0x0c08, 0, 0x0f0ff073, 0x00000000 }, 4088 { 0x0c08, BNX2_FL_NOT_5709, 0x0f0ff073, 0x00000000 },
3797 4089
3798 { 0x1000, 0, 0x00000000, 0x00000001 }, 4090 { 0x1000, 0, 0x00000000, 0x00000001 },
3799 { 0x1004, 0, 0x00000000, 0x000f0001 }, 4091 { 0x1004, 0, 0x00000000, 0x000f0001 },
@@ -3840,7 +4132,6 @@ bnx2_test_registers(struct bnx2 *bp)
3840 4132
3841 { 0x5004, 0, 0x00000000, 0x0000007f }, 4133 { 0x5004, 0, 0x00000000, 0x0000007f },
3842 { 0x5008, 0, 0x0f0007ff, 0x00000000 }, 4134 { 0x5008, 0, 0x0f0007ff, 0x00000000 },
3843 { 0x500c, 0, 0xf800f800, 0x07ff07ff },
3844 4135
3845 { 0x5c00, 0, 0x00000000, 0x00000001 }, 4136 { 0x5c00, 0, 0x00000000, 0x00000001 },
3846 { 0x5c04, 0, 0x00000000, 0x0003000f }, 4137 { 0x5c04, 0, 0x00000000, 0x0003000f },
@@ -3880,8 +4171,16 @@ bnx2_test_registers(struct bnx2 *bp)
3880 }; 4171 };
3881 4172
3882 ret = 0; 4173 ret = 0;
4174 is_5709 = 0;
4175 if (CHIP_NUM(bp) == CHIP_NUM_5709)
4176 is_5709 = 1;
4177
3883 for (i = 0; reg_tbl[i].offset != 0xffff; i++) { 4178 for (i = 0; reg_tbl[i].offset != 0xffff; i++) {
3884 u32 offset, rw_mask, ro_mask, save_val, val; 4179 u32 offset, rw_mask, ro_mask, save_val, val;
4180 u16 flags = reg_tbl[i].flags;
4181
4182 if (is_5709 && (flags & BNX2_FL_NOT_5709))
4183 continue;
3885 4184
3886 offset = (u32) reg_tbl[i].offset; 4185 offset = (u32) reg_tbl[i].offset;
3887 rw_mask = reg_tbl[i].rw_mask; 4186 rw_mask = reg_tbl[i].rw_mask;
@@ -3950,10 +4249,10 @@ bnx2_test_memory(struct bnx2 *bp)
3950{ 4249{
3951 int ret = 0; 4250 int ret = 0;
3952 int i; 4251 int i;
3953 static const struct { 4252 static struct mem_entry {
3954 u32 offset; 4253 u32 offset;
3955 u32 len; 4254 u32 len;
3956 } mem_tbl[] = { 4255 } mem_tbl_5706[] = {
3957 { 0x60000, 0x4000 }, 4256 { 0x60000, 0x4000 },
3958 { 0xa0000, 0x3000 }, 4257 { 0xa0000, 0x3000 },
3959 { 0xe0000, 0x4000 }, 4258 { 0xe0000, 0x4000 },
@@ -3961,7 +4260,21 @@ bnx2_test_memory(struct bnx2 *bp)
3961 { 0x1a0000, 0x4000 }, 4260 { 0x1a0000, 0x4000 },
3962 { 0x160000, 0x4000 }, 4261 { 0x160000, 0x4000 },
3963 { 0xffffffff, 0 }, 4262 { 0xffffffff, 0 },
4263 },
4264 mem_tbl_5709[] = {
4265 { 0x60000, 0x4000 },
4266 { 0xa0000, 0x3000 },
4267 { 0xe0000, 0x4000 },
4268 { 0x120000, 0x4000 },
4269 { 0x1a0000, 0x4000 },
4270 { 0xffffffff, 0 },
3964 }; 4271 };
4272 struct mem_entry *mem_tbl;
4273
4274 if (CHIP_NUM(bp) == CHIP_NUM_5709)
4275 mem_tbl = mem_tbl_5709;
4276 else
4277 mem_tbl = mem_tbl_5706;
3965 4278
3966 for (i = 0; mem_tbl[i].offset != 0xffffffff; i++) { 4279 for (i = 0; mem_tbl[i].offset != 0xffffffff; i++) {
3967 if ((ret = bnx2_do_mem_test(bp, mem_tbl[i].offset, 4280 if ((ret = bnx2_do_mem_test(bp, mem_tbl[i].offset,
@@ -4163,8 +4476,10 @@ bnx2_test_link(struct bnx2 *bp)
4163 u32 bmsr; 4476 u32 bmsr;
4164 4477
4165 spin_lock_bh(&bp->phy_lock); 4478 spin_lock_bh(&bp->phy_lock);
4166 bnx2_read_phy(bp, MII_BMSR, &bmsr); 4479 bnx2_enable_bmsr1(bp);
4167 bnx2_read_phy(bp, MII_BMSR, &bmsr); 4480 bnx2_read_phy(bp, bp->mii_bmsr1, &bmsr);
4481 bnx2_read_phy(bp, bp->mii_bmsr1, &bmsr);
4482 bnx2_disable_bmsr1(bp);
4168 spin_unlock_bh(&bp->phy_lock); 4483 spin_unlock_bh(&bp->phy_lock);
4169 4484
4170 if (bmsr & BMSR_LSTATUS) { 4485 if (bmsr & BMSR_LSTATUS) {
@@ -4214,7 +4529,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
4214 4529
4215 bp->current_interval = bp->timer_interval; 4530 bp->current_interval = bp->timer_interval;
4216 4531
4217 bnx2_read_phy(bp, MII_BMCR, &bmcr); 4532 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
4218 4533
4219 if (bmcr & BMCR_ANENABLE) { 4534 if (bmcr & BMCR_ANENABLE) {
4220 u32 phy1, phy2; 4535 u32 phy1, phy2;
@@ -4232,7 +4547,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
4232 4547
4233 bmcr &= ~BMCR_ANENABLE; 4548 bmcr &= ~BMCR_ANENABLE;
4234 bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX; 4549 bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX;
4235 bnx2_write_phy(bp, MII_BMCR, bmcr); 4550 bnx2_write_phy(bp, bp->mii_bmcr, bmcr);
4236 bp->phy_flags |= PHY_PARALLEL_DETECT_FLAG; 4551 bp->phy_flags |= PHY_PARALLEL_DETECT_FLAG;
4237 } 4552 }
4238 } 4553 }
@@ -4246,9 +4561,9 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
4246 if (phy2 & 0x20) { 4561 if (phy2 & 0x20) {
4247 u32 bmcr; 4562 u32 bmcr;
4248 4563
4249 bnx2_read_phy(bp, MII_BMCR, &bmcr); 4564 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
4250 bmcr |= BMCR_ANENABLE; 4565 bmcr |= BMCR_ANENABLE;
4251 bnx2_write_phy(bp, MII_BMCR, bmcr); 4566 bnx2_write_phy(bp, bp->mii_bmcr, bmcr);
4252 4567
4253 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG; 4568 bp->phy_flags &= ~PHY_PARALLEL_DETECT_FLAG;
4254 } 4569 }
@@ -4272,17 +4587,12 @@ bnx2_5708_serdes_timer(struct bnx2 *bp)
4272 else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) { 4587 else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) {
4273 u32 bmcr; 4588 u32 bmcr;
4274 4589
4275 bnx2_read_phy(bp, MII_BMCR, &bmcr); 4590 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
4276
4277 if (bmcr & BMCR_ANENABLE) { 4591 if (bmcr & BMCR_ANENABLE) {
4278 bmcr &= ~BMCR_ANENABLE; 4592 bnx2_enable_forced_2g5(bp);
4279 bmcr |= BMCR_FULLDPLX | BCM5708S_BMCR_FORCE_2500;
4280 bnx2_write_phy(bp, MII_BMCR, bmcr);
4281 bp->current_interval = SERDES_FORCED_TIMEOUT; 4593 bp->current_interval = SERDES_FORCED_TIMEOUT;
4282 } else { 4594 } else {
4283 bmcr &= ~(BMCR_FULLDPLX | BCM5708S_BMCR_FORCE_2500); 4595 bnx2_disable_forced_2g5(bp);
4284 bmcr |= BMCR_ANENABLE;
4285 bnx2_write_phy(bp, MII_BMCR, bmcr);
4286 bp->serdes_an_pending = 2; 4596 bp->serdes_an_pending = 2;
4287 bp->current_interval = bp->timer_interval; 4597 bp->current_interval = bp->timer_interval;
4288 } 4598 }
@@ -4313,7 +4623,7 @@ bnx2_timer(unsigned long data)
4313 if (bp->phy_flags & PHY_SERDES_FLAG) { 4623 if (bp->phy_flags & PHY_SERDES_FLAG) {
4314 if (CHIP_NUM(bp) == CHIP_NUM_5706) 4624 if (CHIP_NUM(bp) == CHIP_NUM_5706)
4315 bnx2_5706_serdes_timer(bp); 4625 bnx2_5706_serdes_timer(bp);
4316 else if (CHIP_NUM(bp) == CHIP_NUM_5708) 4626 else
4317 bnx2_5708_serdes_timer(bp); 4627 bnx2_5708_serdes_timer(bp);
4318 } 4628 }
4319 4629
@@ -4321,6 +4631,38 @@ bnx2_restart_timer:
4321 mod_timer(&bp->timer, jiffies + bp->current_interval); 4631 mod_timer(&bp->timer, jiffies + bp->current_interval);
4322} 4632}
4323 4633
4634static int
4635bnx2_request_irq(struct bnx2 *bp)
4636{
4637 struct net_device *dev = bp->dev;
4638 int rc = 0;
4639
4640 if (bp->flags & USING_MSI_FLAG) {
4641 irq_handler_t fn = bnx2_msi;
4642
4643 if (bp->flags & ONE_SHOT_MSI_FLAG)
4644 fn = bnx2_msi_1shot;
4645
4646 rc = request_irq(bp->pdev->irq, fn, 0, dev->name, dev);
4647 } else
4648 rc = request_irq(bp->pdev->irq, bnx2_interrupt,
4649 IRQF_SHARED, dev->name, dev);
4650 return rc;
4651}
4652
4653static void
4654bnx2_free_irq(struct bnx2 *bp)
4655{
4656 struct net_device *dev = bp->dev;
4657
4658 if (bp->flags & USING_MSI_FLAG) {
4659 free_irq(bp->pdev->irq, dev);
4660 pci_disable_msi(bp->pdev);
4661 bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
4662 } else
4663 free_irq(bp->pdev->irq, dev);
4664}
4665
4324/* Called with rtnl_lock */ 4666/* Called with rtnl_lock */
4325static int 4667static int
4326bnx2_open(struct net_device *dev) 4668bnx2_open(struct net_device *dev)
@@ -4328,6 +4670,8 @@ bnx2_open(struct net_device *dev)
4328 struct bnx2 *bp = netdev_priv(dev); 4670 struct bnx2 *bp = netdev_priv(dev);
4329 int rc; 4671 int rc;
4330 4672
4673 netif_carrier_off(dev);
4674
4331 bnx2_set_power_state(bp, PCI_D0); 4675 bnx2_set_power_state(bp, PCI_D0);
4332 bnx2_disable_int(bp); 4676 bnx2_disable_int(bp);
4333 4677
@@ -4335,24 +4679,15 @@ bnx2_open(struct net_device *dev)
4335 if (rc) 4679 if (rc)
4336 return rc; 4680 return rc;
4337 4681
4338 if ((CHIP_ID(bp) != CHIP_ID_5706_A0) && 4682 if ((bp->flags & MSI_CAP_FLAG) && !disable_msi) {
4339 (CHIP_ID(bp) != CHIP_ID_5706_A1) &&
4340 !disable_msi) {
4341
4342 if (pci_enable_msi(bp->pdev) == 0) { 4683 if (pci_enable_msi(bp->pdev) == 0) {
4343 bp->flags |= USING_MSI_FLAG; 4684 bp->flags |= USING_MSI_FLAG;
4344 rc = request_irq(bp->pdev->irq, bnx2_msi, 0, dev->name, 4685 if (CHIP_NUM(bp) == CHIP_NUM_5709)
4345 dev); 4686 bp->flags |= ONE_SHOT_MSI_FLAG;
4346 }
4347 else {
4348 rc = request_irq(bp->pdev->irq, bnx2_interrupt,
4349 IRQF_SHARED, dev->name, dev);
4350 } 4687 }
4351 } 4688 }
4352 else { 4689 rc = bnx2_request_irq(bp);
4353 rc = request_irq(bp->pdev->irq, bnx2_interrupt, IRQF_SHARED, 4690
4354 dev->name, dev);
4355 }
4356 if (rc) { 4691 if (rc) {
4357 bnx2_free_mem(bp); 4692 bnx2_free_mem(bp);
4358 return rc; 4693 return rc;
@@ -4361,11 +4696,7 @@ bnx2_open(struct net_device *dev)
4361 rc = bnx2_init_nic(bp); 4696 rc = bnx2_init_nic(bp);
4362 4697
4363 if (rc) { 4698 if (rc) {
4364 free_irq(bp->pdev->irq, dev); 4699 bnx2_free_irq(bp);
4365 if (bp->flags & USING_MSI_FLAG) {
4366 pci_disable_msi(bp->pdev);
4367 bp->flags &= ~USING_MSI_FLAG;
4368 }
4369 bnx2_free_skbs(bp); 4700 bnx2_free_skbs(bp);
4370 bnx2_free_mem(bp); 4701 bnx2_free_mem(bp);
4371 return rc; 4702 return rc;
@@ -4389,16 +4720,13 @@ bnx2_open(struct net_device *dev)
4389 bp->dev->name); 4720 bp->dev->name);
4390 4721
4391 bnx2_disable_int(bp); 4722 bnx2_disable_int(bp);
4392 free_irq(bp->pdev->irq, dev); 4723 bnx2_free_irq(bp);
4393 pci_disable_msi(bp->pdev);
4394 bp->flags &= ~USING_MSI_FLAG;
4395 4724
4396 rc = bnx2_init_nic(bp); 4725 rc = bnx2_init_nic(bp);
4397 4726
4398 if (!rc) { 4727 if (!rc)
4399 rc = request_irq(bp->pdev->irq, bnx2_interrupt, 4728 rc = bnx2_request_irq(bp);
4400 IRQF_SHARED, dev->name, dev); 4729
4401 }
4402 if (rc) { 4730 if (rc) {
4403 bnx2_free_skbs(bp); 4731 bnx2_free_skbs(bp);
4404 bnx2_free_mem(bp); 4732 bnx2_free_mem(bp);
@@ -4508,40 +4836,53 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
4508 vlan_tag_flags |= 4836 vlan_tag_flags |=
4509 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); 4837 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
4510 } 4838 }
4511 if ((mss = skb_shinfo(skb)->gso_size) && 4839 if ((mss = skb_shinfo(skb)->gso_size)) {
4512 (skb->len > (bp->dev->mtu + ETH_HLEN))) {
4513 u32 tcp_opt_len, ip_tcp_len; 4840 u32 tcp_opt_len, ip_tcp_len;
4514 struct iphdr *iph; 4841 struct iphdr *iph;
4515 4842
4516 if (skb_header_cloned(skb) &&
4517 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
4518 dev_kfree_skb(skb);
4519 return NETDEV_TX_OK;
4520 }
4521
4522 vlan_tag_flags |= TX_BD_FLAGS_SW_LSO; 4843 vlan_tag_flags |= TX_BD_FLAGS_SW_LSO;
4523 4844
4524 tcp_opt_len = 0; 4845 tcp_opt_len = tcp_optlen(skb);
4525 if (tcp_hdr(skb)->doff > 5) 4846
4526 tcp_opt_len = tcp_optlen(skb); 4847 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) {
4848 u32 tcp_off = skb_transport_offset(skb) -
4849 sizeof(struct ipv6hdr) - ETH_HLEN;
4527 4850
4528 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); 4851 vlan_tag_flags |= ((tcp_opt_len >> 2) << 8) |
4852 TX_BD_FLAGS_SW_FLAGS;
4853 if (likely(tcp_off == 0))
4854 vlan_tag_flags &= ~TX_BD_FLAGS_TCP6_OFF0_MSK;
4855 else {
4856 tcp_off >>= 3;
4857 vlan_tag_flags |= ((tcp_off & 0x3) <<
4858 TX_BD_FLAGS_TCP6_OFF0_SHL) |
4859 ((tcp_off & 0x10) <<
4860 TX_BD_FLAGS_TCP6_OFF4_SHL);
4861 mss |= (tcp_off & 0xc) << TX_BD_TCP6_OFF2_SHL;
4862 }
4863 } else {
4864 if (skb_header_cloned(skb) &&
4865 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
4866 dev_kfree_skb(skb);
4867 return NETDEV_TX_OK;
4868 }
4529 4869
4530 iph = ip_hdr(skb); 4870 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
4531 iph->check = 0; 4871
4532 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); 4872 iph = ip_hdr(skb);
4533 tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, 4873 iph->check = 0;
4534 iph->daddr, 0, 4874 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
4535 IPPROTO_TCP, 0); 4875 tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
4536 if (tcp_opt_len || (iph->ihl > 5)) { 4876 iph->daddr, 0,
4537 vlan_tag_flags |= ((iph->ihl - 5) + 4877 IPPROTO_TCP,
4538 (tcp_opt_len >> 2)) << 8; 4878 0);
4879 if (tcp_opt_len || (iph->ihl > 5)) {
4880 vlan_tag_flags |= ((iph->ihl - 5) +
4881 (tcp_opt_len >> 2)) << 8;
4882 }
4539 } 4883 }
4540 } 4884 } else
4541 else
4542 {
4543 mss = 0; 4885 mss = 0;
4544 }
4545 4886
4546 mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); 4887 mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
4547 4888
@@ -4622,11 +4963,7 @@ bnx2_close(struct net_device *dev)
4622 else 4963 else
4623 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; 4964 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
4624 bnx2_reset_chip(bp, reset_code); 4965 bnx2_reset_chip(bp, reset_code);
4625 free_irq(bp->pdev->irq, dev); 4966 bnx2_free_irq(bp);
4626 if (bp->flags & USING_MSI_FLAG) {
4627 pci_disable_msi(bp->pdev);
4628 bp->flags &= ~USING_MSI_FLAG;
4629 }
4630 bnx2_free_skbs(bp); 4967 bnx2_free_skbs(bp);
4631 bnx2_free_mem(bp); 4968 bnx2_free_mem(bp);
4632 bp->link_up = 0; 4969 bp->link_up = 0;
@@ -4735,6 +5072,8 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4735 if (bp->phy_flags & PHY_SERDES_FLAG) { 5072 if (bp->phy_flags & PHY_SERDES_FLAG) {
4736 cmd->supported |= SUPPORTED_1000baseT_Full | 5073 cmd->supported |= SUPPORTED_1000baseT_Full |
4737 SUPPORTED_FIBRE; 5074 SUPPORTED_FIBRE;
5075 if (bp->phy_flags & PHY_2_5G_CAPABLE_FLAG)
5076 cmd->supported |= SUPPORTED_2500baseX_Full;
4738 5077
4739 cmd->port = PORT_FIBRE; 5078 cmd->port = PORT_FIBRE;
4740 } 5079 }
@@ -4798,8 +5137,10 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
4798 5137
4799 advertising = cmd->advertising; 5138 advertising = cmd->advertising;
4800 5139
4801 } 5140 } else if (cmd->advertising == ADVERTISED_2500baseX_Full) {
4802 else if (cmd->advertising == ADVERTISED_1000baseT_Full) { 5141 if (!(bp->phy_flags & PHY_2_5G_CAPABLE_FLAG))
5142 return -EINVAL;
5143 } else if (cmd->advertising == ADVERTISED_1000baseT_Full) {
4803 advertising = cmd->advertising; 5144 advertising = cmd->advertising;
4804 } 5145 }
4805 else if (cmd->advertising == ADVERTISED_1000baseT_Half) { 5146 else if (cmd->advertising == ADVERTISED_1000baseT_Half) {
@@ -4975,7 +5316,7 @@ bnx2_nway_reset(struct net_device *dev)
4975 5316
4976 /* Force a link down visible on the other side */ 5317 /* Force a link down visible on the other side */
4977 if (bp->phy_flags & PHY_SERDES_FLAG) { 5318 if (bp->phy_flags & PHY_SERDES_FLAG) {
4978 bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK); 5319 bnx2_write_phy(bp, bp->mii_bmcr, BMCR_LOOPBACK);
4979 spin_unlock_bh(&bp->phy_lock); 5320 spin_unlock_bh(&bp->phy_lock);
4980 5321
4981 msleep(20); 5322 msleep(20);
@@ -4987,9 +5328,9 @@ bnx2_nway_reset(struct net_device *dev)
4987 mod_timer(&bp->timer, jiffies + bp->current_interval); 5328 mod_timer(&bp->timer, jiffies + bp->current_interval);
4988 } 5329 }
4989 5330
4990 bnx2_read_phy(bp, MII_BMCR, &bmcr); 5331 bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
4991 bmcr &= ~BMCR_LOOPBACK; 5332 bmcr &= ~BMCR_LOOPBACK;
4992 bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART | BMCR_ANENABLE); 5333 bnx2_write_phy(bp, bp->mii_bmcr, bmcr | BMCR_ANRESTART | BMCR_ANENABLE);
4993 5334
4994 spin_unlock_bh(&bp->phy_lock); 5335 spin_unlock_bh(&bp->phy_lock);
4995 5336
@@ -5209,10 +5550,15 @@ bnx2_set_rx_csum(struct net_device *dev, u32 data)
5209static int 5550static int
5210bnx2_set_tso(struct net_device *dev, u32 data) 5551bnx2_set_tso(struct net_device *dev, u32 data)
5211{ 5552{
5212 if (data) 5553 struct bnx2 *bp = netdev_priv(dev);
5554
5555 if (data) {
5213 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN; 5556 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
5214 else 5557 if (CHIP_NUM(bp) == CHIP_NUM_5709)
5215 dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO_ECN); 5558 dev->features |= NETIF_F_TSO6;
5559 } else
5560 dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6 |
5561 NETIF_F_TSO_ECN);
5216 return 0; 5562 return 0;
5217} 5563}
5218 5564
@@ -5510,6 +5856,17 @@ bnx2_phys_id(struct net_device *dev, u32 data)
5510 return 0; 5856 return 0;
5511} 5857}
5512 5858
5859static int
5860bnx2_set_tx_csum(struct net_device *dev, u32 data)
5861{
5862 struct bnx2 *bp = netdev_priv(dev);
5863
5864 if (CHIP_NUM(bp) == CHIP_NUM_5709)
5865 return (ethtool_op_set_tx_hw_csum(dev, data));
5866 else
5867 return (ethtool_op_set_tx_csum(dev, data));
5868}
5869
5513static const struct ethtool_ops bnx2_ethtool_ops = { 5870static const struct ethtool_ops bnx2_ethtool_ops = {
5514 .get_settings = bnx2_get_settings, 5871 .get_settings = bnx2_get_settings,
5515 .set_settings = bnx2_set_settings, 5872 .set_settings = bnx2_set_settings,
@@ -5532,7 +5889,7 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
5532 .get_rx_csum = bnx2_get_rx_csum, 5889 .get_rx_csum = bnx2_get_rx_csum,
5533 .set_rx_csum = bnx2_set_rx_csum, 5890 .set_rx_csum = bnx2_set_rx_csum,
5534 .get_tx_csum = ethtool_op_get_tx_csum, 5891 .get_tx_csum = ethtool_op_get_tx_csum,
5535 .set_tx_csum = ethtool_op_set_tx_csum, 5892 .set_tx_csum = bnx2_set_tx_csum,
5536 .get_sg = ethtool_op_get_sg, 5893 .get_sg = ethtool_op_get_sg,
5537 .set_sg = ethtool_op_set_sg, 5894 .set_sg = ethtool_op_set_sg,
5538 .get_tso = ethtool_op_get_tso, 5895 .get_tso = ethtool_op_get_tso,
@@ -5562,6 +5919,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5562 case SIOCGMIIREG: { 5919 case SIOCGMIIREG: {
5563 u32 mii_regval; 5920 u32 mii_regval;
5564 5921
5922 if (!netif_running(dev))
5923 return -EAGAIN;
5924
5565 spin_lock_bh(&bp->phy_lock); 5925 spin_lock_bh(&bp->phy_lock);
5566 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); 5926 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval);
5567 spin_unlock_bh(&bp->phy_lock); 5927 spin_unlock_bh(&bp->phy_lock);
@@ -5575,6 +5935,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5575 if (!capable(CAP_NET_ADMIN)) 5935 if (!capable(CAP_NET_ADMIN))
5576 return -EPERM; 5936 return -EPERM;
5577 5937
5938 if (!netif_running(dev))
5939 return -EAGAIN;
5940
5578 spin_lock_bh(&bp->phy_lock); 5941 spin_lock_bh(&bp->phy_lock);
5579 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); 5942 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in);
5580 spin_unlock_bh(&bp->phy_lock); 5943 spin_unlock_bh(&bp->phy_lock);
@@ -5676,6 +6039,58 @@ bnx2_get_5709_media(struct bnx2 *bp)
5676 } 6039 }
5677} 6040}
5678 6041
6042static void __devinit
6043bnx2_get_pci_speed(struct bnx2 *bp)
6044{
6045 u32 reg;
6046
6047 reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS);
6048 if (reg & BNX2_PCICFG_MISC_STATUS_PCIX_DET) {
6049 u32 clkreg;
6050
6051 bp->flags |= PCIX_FLAG;
6052
6053 clkreg = REG_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS);
6054
6055 clkreg &= BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET;
6056 switch (clkreg) {
6057 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_133MHZ:
6058 bp->bus_speed_mhz = 133;
6059 break;
6060
6061 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_95MHZ:
6062 bp->bus_speed_mhz = 100;
6063 break;
6064
6065 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_66MHZ:
6066 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_80MHZ:
6067 bp->bus_speed_mhz = 66;
6068 break;
6069
6070 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_48MHZ:
6071 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_55MHZ:
6072 bp->bus_speed_mhz = 50;
6073 break;
6074
6075 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_LOW:
6076 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_32MHZ:
6077 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_38MHZ:
6078 bp->bus_speed_mhz = 33;
6079 break;
6080 }
6081 }
6082 else {
6083 if (reg & BNX2_PCICFG_MISC_STATUS_M66EN)
6084 bp->bus_speed_mhz = 66;
6085 else
6086 bp->bus_speed_mhz = 33;
6087 }
6088
6089 if (reg & BNX2_PCICFG_MISC_STATUS_32BIT_DET)
6090 bp->flags |= PCI_32BIT_FLAG;
6091
6092}
6093
5679static int __devinit 6094static int __devinit
5680bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) 6095bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5681{ 6096{
@@ -5683,6 +6098,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5683 unsigned long mem_len; 6098 unsigned long mem_len;
5684 int rc; 6099 int rc;
5685 u32 reg; 6100 u32 reg;
6101 u64 dma_mask, persist_dma_mask;
5686 6102
5687 SET_MODULE_OWNER(dev); 6103 SET_MODULE_OWNER(dev);
5688 SET_NETDEV_DEV(dev, &pdev->dev); 6104 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -5721,25 +6137,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5721 goto err_out_release; 6137 goto err_out_release;
5722 } 6138 }
5723 6139
5724 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
5725 bp->flags |= USING_DAC_FLAG;
5726 if (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) != 0) {
5727 dev_err(&pdev->dev,
5728 "pci_set_consistent_dma_mask failed, aborting.\n");
5729 rc = -EIO;
5730 goto err_out_release;
5731 }
5732 }
5733 else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) {
5734 dev_err(&pdev->dev, "System does not support DMA, aborting.\n");
5735 rc = -EIO;
5736 goto err_out_release;
5737 }
5738
5739 bp->dev = dev; 6140 bp->dev = dev;
5740 bp->pdev = pdev; 6141 bp->pdev = pdev;
5741 6142
5742 spin_lock_init(&bp->phy_lock); 6143 spin_lock_init(&bp->phy_lock);
6144 spin_lock_init(&bp->indirect_lock);
5743 INIT_WORK(&bp->reset_task, bnx2_reset_task); 6145 INIT_WORK(&bp->reset_task, bnx2_reset_task);
5744 6146
5745 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); 6147 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
@@ -5767,7 +6169,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5767 6169
5768 bp->chip_id = REG_RD(bp, BNX2_MISC_ID); 6170 bp->chip_id = REG_RD(bp, BNX2_MISC_ID);
5769 6171
5770 if (CHIP_NUM(bp) != CHIP_NUM_5709) { 6172 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
6173 if (pci_find_capability(pdev, PCI_CAP_ID_EXP) == 0) {
6174 dev_err(&pdev->dev,
6175 "Cannot find PCIE capability, aborting.\n");
6176 rc = -EIO;
6177 goto err_out_unmap;
6178 }
6179 bp->flags |= PCIE_FLAG;
6180 } else {
5771 bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); 6181 bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
5772 if (bp->pcix_cap == 0) { 6182 if (bp->pcix_cap == 0) {
5773 dev_err(&pdev->dev, 6183 dev_err(&pdev->dev,
@@ -5777,51 +6187,33 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5777 } 6187 }
5778 } 6188 }
5779 6189
5780 /* Get bus information. */ 6190 if (CHIP_ID(bp) != CHIP_ID_5706_A0 && CHIP_ID(bp) != CHIP_ID_5706_A1) {
5781 reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS); 6191 if (pci_find_capability(pdev, PCI_CAP_ID_MSI))
5782 if (reg & BNX2_PCICFG_MISC_STATUS_PCIX_DET) { 6192 bp->flags |= MSI_CAP_FLAG;
5783 u32 clkreg; 6193 }
5784
5785 bp->flags |= PCIX_FLAG;
5786
5787 clkreg = REG_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS);
5788
5789 clkreg &= BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET;
5790 switch (clkreg) {
5791 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_133MHZ:
5792 bp->bus_speed_mhz = 133;
5793 break;
5794
5795 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_95MHZ:
5796 bp->bus_speed_mhz = 100;
5797 break;
5798
5799 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_66MHZ:
5800 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_80MHZ:
5801 bp->bus_speed_mhz = 66;
5802 break;
5803 6194
5804 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_48MHZ: 6195 /* 5708 cannot support DMA addresses > 40-bit. */
5805 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_55MHZ: 6196 if (CHIP_NUM(bp) == CHIP_NUM_5708)
5806 bp->bus_speed_mhz = 50; 6197 persist_dma_mask = dma_mask = DMA_40BIT_MASK;
5807 break; 6198 else
6199 persist_dma_mask = dma_mask = DMA_64BIT_MASK;
5808 6200
5809 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_LOW: 6201 /* Configure DMA attributes. */
5810 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_32MHZ: 6202 if (pci_set_dma_mask(pdev, dma_mask) == 0) {
5811 case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_38MHZ: 6203 dev->features |= NETIF_F_HIGHDMA;
5812 bp->bus_speed_mhz = 33; 6204 rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask);
5813 break; 6205 if (rc) {
6206 dev_err(&pdev->dev,
6207 "pci_set_consistent_dma_mask failed, aborting.\n");
6208 goto err_out_unmap;
5814 } 6209 }
5815 } 6210 } else if ((rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0) {
5816 else { 6211 dev_err(&pdev->dev, "System does not support DMA, aborting.\n");
5817 if (reg & BNX2_PCICFG_MISC_STATUS_M66EN) 6212 goto err_out_unmap;
5818 bp->bus_speed_mhz = 66;
5819 else
5820 bp->bus_speed_mhz = 33;
5821 } 6213 }
5822 6214
5823 if (reg & BNX2_PCICFG_MISC_STATUS_32BIT_DET) 6215 if (!(bp->flags & PCIE_FLAG))
5824 bp->flags |= PCI_32BIT_FLAG; 6216 bnx2_get_pci_speed(bp);
5825 6217
5826 /* 5706A0 may falsely detect SERR and PERR. */ 6218 /* 5706A0 may falsely detect SERR and PERR. */
5827 if (CHIP_ID(bp) == CHIP_ID_5706_A0) { 6219 if (CHIP_ID(bp) == CHIP_ID_5706_A0) {
@@ -6005,6 +6397,26 @@ err_out:
6005 return rc; 6397 return rc;
6006} 6398}
6007 6399
6400static char * __devinit
6401bnx2_bus_string(struct bnx2 *bp, char *str)
6402{
6403 char *s = str;
6404
6405 if (bp->flags & PCIE_FLAG) {
6406 s += sprintf(s, "PCI Express");
6407 } else {
6408 s += sprintf(s, "PCI");
6409 if (bp->flags & PCIX_FLAG)
6410 s += sprintf(s, "-X");
6411 if (bp->flags & PCI_32BIT_FLAG)
6412 s += sprintf(s, " 32-bit");
6413 else
6414 s += sprintf(s, " 64-bit");
6415 s += sprintf(s, " %dMHz", bp->bus_speed_mhz);
6416 }
6417 return str;
6418}
6419
6008static int __devinit 6420static int __devinit
6009bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 6421bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6010{ 6422{
@@ -6012,6 +6424,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6012 struct net_device *dev = NULL; 6424 struct net_device *dev = NULL;
6013 struct bnx2 *bp; 6425 struct bnx2 *bp;
6014 int rc, i; 6426 int rc, i;
6427 char str[40];
6015 6428
6016 if (version_printed++ == 0) 6429 if (version_printed++ == 0)
6017 printk(KERN_INFO "%s", version); 6430 printk(KERN_INFO "%s", version);
@@ -6052,6 +6465,23 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6052 dev->poll_controller = poll_bnx2; 6465 dev->poll_controller = poll_bnx2;
6053#endif 6466#endif
6054 6467
6468 pci_set_drvdata(pdev, dev);
6469
6470 memcpy(dev->dev_addr, bp->mac_addr, 6);
6471 memcpy(dev->perm_addr, bp->mac_addr, 6);
6472 bp->name = board_info[ent->driver_data].name;
6473
6474 if (CHIP_NUM(bp) == CHIP_NUM_5709)
6475 dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
6476 else
6477 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
6478#ifdef BCM_VLAN
6479 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
6480#endif
6481 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
6482 if (CHIP_NUM(bp) == CHIP_NUM_5709)
6483 dev->features |= NETIF_F_TSO6;
6484
6055 if ((rc = register_netdev(dev))) { 6485 if ((rc = register_netdev(dev))) {
6056 dev_err(&pdev->dev, "Cannot register net device\n"); 6486 dev_err(&pdev->dev, "Cannot register net device\n");
6057 if (bp->regview) 6487 if (bp->regview)
@@ -6063,20 +6493,13 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6063 return rc; 6493 return rc;
6064 } 6494 }
6065 6495
6066 pci_set_drvdata(pdev, dev); 6496 printk(KERN_INFO "%s: %s (%c%d) %s found at mem %lx, "
6067
6068 memcpy(dev->dev_addr, bp->mac_addr, 6);
6069 memcpy(dev->perm_addr, bp->mac_addr, 6);
6070 bp->name = board_info[ent->driver_data].name,
6071 printk(KERN_INFO "%s: %s (%c%d) PCI%s %s %dMHz found at mem %lx, "
6072 "IRQ %d, ", 6497 "IRQ %d, ",
6073 dev->name, 6498 dev->name,
6074 bp->name, 6499 bp->name,
6075 ((CHIP_ID(bp) & 0xf000) >> 12) + 'A', 6500 ((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
6076 ((CHIP_ID(bp) & 0x0ff0) >> 4), 6501 ((CHIP_ID(bp) & 0x0ff0) >> 4),
6077 ((bp->flags & PCIX_FLAG) ? "-X" : ""), 6502 bnx2_bus_string(bp, str),
6078 ((bp->flags & PCI_32BIT_FLAG) ? "32-bit" : "64-bit"),
6079 bp->bus_speed_mhz,
6080 dev->base_addr, 6503 dev->base_addr,
6081 bp->pdev->irq); 6504 bp->pdev->irq);
6082 6505
@@ -6085,17 +6508,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6085 printk("%2.2x", dev->dev_addr[i]); 6508 printk("%2.2x", dev->dev_addr[i]);
6086 printk("\n"); 6509 printk("\n");
6087 6510
6088 dev->features |= NETIF_F_SG;
6089 if (bp->flags & USING_DAC_FLAG)
6090 dev->features |= NETIF_F_HIGHDMA;
6091 dev->features |= NETIF_F_IP_CSUM;
6092#ifdef BCM_VLAN
6093 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
6094#endif
6095 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
6096
6097 netif_carrier_off(bp->dev);
6098
6099 return 0; 6511 return 0;
6100} 6512}
6101 6513
@@ -6140,6 +6552,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
6140 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; 6552 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
6141 bnx2_reset_chip(bp, reset_code); 6553 bnx2_reset_chip(bp, reset_code);
6142 bnx2_free_skbs(bp); 6554 bnx2_free_skbs(bp);
6555 pci_save_state(pdev);
6143 bnx2_set_power_state(bp, pci_choose_state(pdev, state)); 6556 bnx2_set_power_state(bp, pci_choose_state(pdev, state));
6144 return 0; 6557 return 0;
6145} 6558}
@@ -6153,6 +6566,7 @@ bnx2_resume(struct pci_dev *pdev)
6153 if (!netif_running(dev)) 6566 if (!netif_running(dev))
6154 return 0; 6567 return 0;
6155 6568
6569 pci_restore_state(pdev);
6156 bnx2_set_power_state(bp, PCI_D0); 6570 bnx2_set_power_state(bp, PCI_D0);
6157 netif_device_attach(dev); 6571 netif_device_attach(dev);
6158 bnx2_init_nic(bp); 6572 bnx2_init_nic(bp);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 878eee58f12a..bd6288d6350f 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -1,6 +1,6 @@
1/* bnx2.h: Broadcom NX2 network driver. 1/* bnx2.h: Broadcom NX2 network driver.
2 * 2 *
3 * Copyright (c) 2004, 2005, 2006 Broadcom Corporation 3 * Copyright (c) 2004-2007 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -24,8 +24,11 @@ struct tx_bd {
24 u32 tx_bd_haddr_hi; 24 u32 tx_bd_haddr_hi;
25 u32 tx_bd_haddr_lo; 25 u32 tx_bd_haddr_lo;
26 u32 tx_bd_mss_nbytes; 26 u32 tx_bd_mss_nbytes;
27 #define TX_BD_TCP6_OFF2_SHL (14)
27 u32 tx_bd_vlan_tag_flags; 28 u32 tx_bd_vlan_tag_flags;
28 #define TX_BD_FLAGS_CONN_FAULT (1<<0) 29 #define TX_BD_FLAGS_CONN_FAULT (1<<0)
30 #define TX_BD_FLAGS_TCP6_OFF0_MSK (3<<1)
31 #define TX_BD_FLAGS_TCP6_OFF0_SHL (1)
29 #define TX_BD_FLAGS_TCP_UDP_CKSUM (1<<1) 32 #define TX_BD_FLAGS_TCP_UDP_CKSUM (1<<1)
30 #define TX_BD_FLAGS_IP_CKSUM (1<<2) 33 #define TX_BD_FLAGS_IP_CKSUM (1<<2)
31 #define TX_BD_FLAGS_VLAN_TAG (1<<3) 34 #define TX_BD_FLAGS_VLAN_TAG (1<<3)
@@ -34,6 +37,7 @@ struct tx_bd {
34 #define TX_BD_FLAGS_END (1<<6) 37 #define TX_BD_FLAGS_END (1<<6)
35 #define TX_BD_FLAGS_START (1<<7) 38 #define TX_BD_FLAGS_START (1<<7)
36 #define TX_BD_FLAGS_SW_OPTION_WORD (0x1f<<8) 39 #define TX_BD_FLAGS_SW_OPTION_WORD (0x1f<<8)
40 #define TX_BD_FLAGS_TCP6_OFF4_SHL (12)
37 #define TX_BD_FLAGS_SW_FLAGS (1<<13) 41 #define TX_BD_FLAGS_SW_FLAGS (1<<13)
38 #define TX_BD_FLAGS_SW_SNAP (1<<14) 42 #define TX_BD_FLAGS_SW_SNAP (1<<14)
39 #define TX_BD_FLAGS_SW_LSO (1<<15) 43 #define TX_BD_FLAGS_SW_LSO (1<<15)
@@ -6292,6 +6296,41 @@ struct l2_fhdr {
6292#define MII_BNX2_DSP_ADDRESS 0x17 6296#define MII_BNX2_DSP_ADDRESS 0x17
6293#define MII_BNX2_DSP_EXPAND_REG 0x0f00 6297#define MII_BNX2_DSP_EXPAND_REG 0x0f00
6294 6298
6299#define MII_BNX2_BLK_ADDR 0x1f
6300#define MII_BNX2_BLK_ADDR_IEEE0 0x0000
6301#define MII_BNX2_BLK_ADDR_GP_STATUS 0x8120
6302#define MII_BNX2_GP_TOP_AN_STATUS1 0x1b
6303#define MII_BNX2_GP_TOP_AN_SPEED_MSK 0x3f00
6304#define MII_BNX2_GP_TOP_AN_SPEED_10 0x0000
6305#define MII_BNX2_GP_TOP_AN_SPEED_100 0x0100
6306#define MII_BNX2_GP_TOP_AN_SPEED_1G 0x0200
6307#define MII_BNX2_GP_TOP_AN_SPEED_2_5G 0x0300
6308#define MII_BNX2_GP_TOP_AN_SPEED_1GKV 0x0d00
6309#define MII_BNX2_GP_TOP_AN_FD 0x8
6310#define MII_BNX2_BLK_ADDR_SERDES_DIG 0x8300
6311#define MII_BNX2_SERDES_DIG_1000XCTL1 0x10
6312#define MII_BNX2_SD_1000XCTL1_FIBER 0x01
6313#define MII_BNX2_SD_1000XCTL1_AUTODET 0x10
6314#define MII_BNX2_SERDES_DIG_MISC1 0x18
6315#define MII_BNX2_SD_MISC1_FORCE_MSK 0xf
6316#define MII_BNX2_SD_MISC1_FORCE_2_5G 0x0
6317#define MII_BNX2_SD_MISC1_FORCE 0x10
6318#define MII_BNX2_BLK_ADDR_OVER1G 0x8320
6319#define MII_BNX2_OVER1G_UP1 0x19
6320#define MII_BNX2_BLK_ADDR_BAM_NXTPG 0x8350
6321#define MII_BNX2_BAM_NXTPG_CTL 0x10
6322#define MII_BNX2_NXTPG_CTL_BAM 0x1
6323#define MII_BNX2_NXTPG_CTL_T2 0x2
6324#define MII_BNX2_BLK_ADDR_CL73_USERB0 0x8370
6325#define MII_BNX2_CL73_BAM_CTL1 0x12
6326#define MII_BNX2_CL73_BAM_EN 0x8000
6327#define MII_BNX2_CL73_BAM_STA_MGR_EN 0x4000
6328#define MII_BNX2_CL73_BAM_NP_AFT_BP_EN 0x2000
6329#define MII_BNX2_BLK_ADDR_AER 0xffd0
6330#define MII_BNX2_AER_AER 0x1e
6331#define MII_BNX2_AER_AER_AN_MMD 0x3800
6332#define MII_BNX2_BLK_ADDR_COMBO_IEEEB0 0xffe0
6333
6295#define MIN_ETHERNET_PACKET_SIZE 60 6334#define MIN_ETHERNET_PACKET_SIZE 60
6296#define MAX_ETHERNET_PACKET_SIZE 1514 6335#define MAX_ETHERNET_PACKET_SIZE 1514
6297#define MAX_ETHERNET_JUMBO_PACKET_SIZE 9014 6336#define MAX_ETHERNET_JUMBO_PACKET_SIZE 9014
@@ -6429,13 +6468,15 @@ struct bnx2 {
6429 u32 last_status_idx; 6468 u32 last_status_idx;
6430 6469
6431 u32 flags; 6470 u32 flags;
6432#define PCIX_FLAG 1 6471#define PCIX_FLAG 0x00000001
6433#define PCI_32BIT_FLAG 2 6472#define PCI_32BIT_FLAG 0x00000002
6434#define ONE_TDMA_FLAG 4 /* no longer used */ 6473#define ONE_TDMA_FLAG 0x00000004 /* no longer used */
6435#define NO_WOL_FLAG 8 6474#define NO_WOL_FLAG 0x00000008
6436#define USING_DAC_FLAG 0x10 6475#define USING_MSI_FLAG 0x00000020
6437#define USING_MSI_FLAG 0x20 6476#define ASF_ENABLE_FLAG 0x00000040
6438#define ASF_ENABLE_FLAG 0x40 6477#define MSI_CAP_FLAG 0x00000080
6478#define ONE_SHOT_MSI_FLAG 0x00000100
6479#define PCIE_FLAG 0x00000200
6439 6480
6440 /* Put tx producer and consumer fields in separate cache lines. */ 6481 /* Put tx producer and consumer fields in separate cache lines. */
6441 6482
@@ -6484,6 +6525,7 @@ struct bnx2 {
6484 6525
6485 /* Used to synchronize phy accesses. */ 6526 /* Used to synchronize phy accesses. */
6486 spinlock_t phy_lock; 6527 spinlock_t phy_lock;
6528 spinlock_t indirect_lock;
6487 6529
6488 u32 phy_flags; 6530 u32 phy_flags;
6489#define PHY_SERDES_FLAG 1 6531#define PHY_SERDES_FLAG 1
@@ -6495,6 +6537,13 @@ struct bnx2 {
6495#define PHY_INT_MODE_LINK_READY_FLAG 0x200 6537#define PHY_INT_MODE_LINK_READY_FLAG 0x200
6496#define PHY_DIS_EARLY_DAC_FLAG 0x400 6538#define PHY_DIS_EARLY_DAC_FLAG 0x400
6497 6539
6540 u32 mii_bmcr;
6541 u32 mii_bmsr;
6542 u32 mii_bmsr1;
6543 u32 mii_adv;
6544 u32 mii_lpa;
6545 u32 mii_up1;
6546
6498 u32 chip_id; 6547 u32 chip_id;
6499 /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ 6548 /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */
6500#define CHIP_NUM(bp) (((bp)->chip_id) & 0xffff0000) 6549#define CHIP_NUM(bp) (((bp)->chip_id) & 0xffff0000)
diff --git a/drivers/net/bnx2_fw.h b/drivers/net/bnx2_fw.h
index 21d368ff424d..b49f439e0f67 100644
--- a/drivers/net/bnx2_fw.h
+++ b/drivers/net/bnx2_fw.h
@@ -15,680 +15,1071 @@
15 */ 15 */
16 16
17static u8 bnx2_COM_b06FwText[] = { 17static u8 bnx2_COM_b06FwText[] = {
18 0x1f, 0x8b, 0x08, 0x08, 0x09, 0x83, 0x41, 0x44, 0x00, 0x03, 0x74, 0x65, 18 0x1f, 0x8b, 0x08, 0x00, 0x45, 0x30, 0xe7, 0x45, 0x00, 0x03, 0xdc, 0x5a,
19 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xec, 0x5b, 0x7d, 0x6c, 19 0x6b, 0x6c, 0x1c, 0xd7, 0x75, 0x3e, 0x33, 0x3b, 0x4b, 0xae, 0xc8, 0x15,
20 0x5b, 0xd7, 0x75, 0x3f, 0xef, 0xf1, 0x51, 0x7a, 0x96, 0x68, 0xf9, 0x99, 20 0x35, 0xa2, 0xc6, 0xf4, 0x5a, 0xa2, 0xed, 0x5d,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, 0x48, 0xe8, 0x08, 124 0xdb, 0x01, 0x76, 0x84, 0xb1, 0x9d, 0x7b, 0x4d, 0x4a, 0xc4, 0xa5, 0xce,
125 0x1d, 0x17, 0x36, 0xef, 0xf4, 0x04, 0x25, 0x0e, 0x9e, 0x18, 0xa0, 0x34, 125 0x45, 0x41, 0x6b, 0x1a, 0xb6, 0x58, 0xaf, 0x69, 0xb8, 0x5d, 0xd3, 0x00,
126 0x6c, 0xc0, 0xdc, 0xc4, 0xb5, 0x32, 0xf8, 0x78, 0x47, 0x13, 0x59, 0xb0, 126 0x5a, 0x31, 0x6e, 0x54, 0xd9, 0x98, 0x12, 0x5f, 0x4d, 0x9b, 0xfc, 0x0e,
127 0x75, 0xf0, 0x93, 0xfd, 0x7e, 0xf2, 0xc5, 0xe3, 0x90, 0xb7, 0x98, 0xf0, 127 0xee, 0xd7, 0xab, 0xe7, 0xbe, 0x2d, 0x06, 0x57, 0x31, 0x76, 0x77, 0x52,
128 0x5d, 0xd5, 0x9f, 0xa6, 0xed, 0xaa, 0x69, 0x37, 0xc1, 0x3f, 0x62, 0xde, 128 0xe6, 0x13, 0x90, 0x79, 0x5c, 0xe6, 0xa7, 0xc9, 0xb3, 0x54, 0xe2, 0x71,
129 0xfe, 0x98, 0x90, 0x4d, 0xef, 0x2f, 0x09, 0x1b, 0x94, 0x8c, 0x7d, 0x08, 129 0x41, 0xbb, 0x94, 0x90, 0xb3, 0x93, 0x92, 0x3d, 0x7c, 0xaa, 0x57, 0xfa,
130 0xf9, 0x75, 0x69, 0xe4, 0xea, 0x1f, 0xdb, 0xfa, 0x2b, 0x1e, 0x1f, 0xb2, 130 0x60, 0x9f, 0x73, 0x93, 0x57, 0x2a, 0xe0, 0xdb, 0xbd, 0x75, 0xe2, 0x02,
131 0x05, 0x76, 0xdf, 0x84, 0x3c, 0xb9, 0x76, 0x9f, 0xed, 0x71, 0x88, 0x6d, 131 0x83, 0xe1, 0xef, 0x7b, 0xa2, 0x12, 0xc9, 0x64, 0xa0, 0x0b, 0x69, 0xe5,
132 0x26, 0xf4, 0x8d, 0x6d, 0x70, 0x80, 0xd4, 0x19, 0x4d, 0xda, 0x69, 0x5d, 132 0x83, 0x97, 0xfe, 0x2c, 0xeb, 0xfe, 0x65, 0xed, 0x3a, 0xf8, 0x79, 0xcc,
133 0xda, 0xe9, 0x00, 0x6c, 0x34, 0xb7, 0x0d, 0xd9, 0x36, 0x45, 0x1b, 0xf6, 133 0xdb, 0x93, 0x56, 0x7a, 0x13, 0xfe, 0xcb, 0x01, 0x57, 0x72, 0xe9, 0x8f,
134 0x1a, 0xf6, 0x70, 0x77, 0x3a, 0x35, 0xc1, 0xfe, 0x10, 0xbe, 0x7b, 0x86, 134 0xa1, 0x5b, 0x01, 0x4d, 0x81, 0x6d, 0xd0, 0x07, 0x7d, 0x10, 0xf2, 0x6d,
135 0x75, 0xf8, 0xdb, 0x43, 0x23, 0xd3, 0xc2, 0x07, 0xb0, 0xff, 0x80, 0x65, 135 0xad, 0xc0, 0x17, 0x07, 0xf2, 0x0b, 0xfc, 0x11, 0xfd, 0x44, 0x82, 0x58,
136 0x66, 0x1b, 0xce, 0xb6, 0x1c, 0xfb, 0x2e, 0x62, 0xdd, 0x8a, 0xad, 0x64, 136 0x0e, 0x5b, 0xa0, 0x6f, 0x88, 0x8b, 0x39, 0x63, 0x69, 0xff, 0x11, 0xd3,
137 0x39, 0xf1, 0xe2, 0xc5, 0x38, 0xad, 0x21, 0xf5, 0xa4, 0x43, 0x6b, 0x35, 137 0xfe, 0x23, 0x0e, 0xdf, 0xc1, 0xb6, 0xad, 0xdb, 0x8e, 0x6e, 0x27, 0xd0,
138 0xfe, 0xa8, 0x46, 0x2d, 0x4c, 0x63, 0xc6, 0x7f, 0x2b, 0x70, 0xe6, 0x7d, 138 0x46, 0xec, 0x31, 0x43, 0xbb, 0x7a, 0xeb, 0xf8, 0xc8, 0xb4, 0xf2, 0x49,
139 0xfd, 0x4f, 0xe0, 0xcc, 0xeb, 0xd6, 0xe3, 0x4d, 0x7a, 0x6b, 0xfc, 0xac, 139 0xf4, 0x67, 0xf0, 0x14, 0xf4, 0x29, 0xf4, 0x2d, 0xd8, 0x6f, 0x09, 0xeb,
140 0xfe, 0xf0, 0x33, 0xa4, 0x37, 0xc7, 0xcf, 0xd2, 0xbf, 0x58, 0x74, 0x9f, 140 0x55, 0x31, 0x9c, 0xf2, 0x08, 0xd3, 0x43, 0x5a, 0xd6, 0x89, 0x09, 0x3f,
141 0x0e, 0x3f, 0xdb, 0xad, 0xc0, 0xcf, 0x16, 0xa1, 0xef, 0x53, 0x3a, 0x1d, 141 0x9b, 0x75, 0x48, 0xef, 0x77, 0x20, 0x0f, 0x62, 0x25, 0xe9, 0xbe, 0x15,
142 0x3c, 0x15, 0xc9, 0xfc, 0x2b, 0x45, 0x61, 0x3f, 0x76, 0xd0, 0xc8, 0x94, 142 0xb4, 0x72, 0x3f, 0xff, 0x97, 0xb4, 0x72, 0xbd, 0x5a, 0x7a, 0x3f, 0x2d,
143 0x42, 0x7a, 0x17, 0xb5, 0xc3, 0x7f, 0xf4, 0x37, 0x61, 0xfe, 0x5d, 0x44, 143 0x66, 0x2b, 0xec, 0xc0, 0x9e, 0x33, 0xc0, 0x66, 0x31, 0xf6, 0x77, 0x0e,
144 0x9b, 0x1d, 0xbf, 0xd9, 0x15, 0x1e, 0x05, 0xff, 0xd3, 0x2f, 0x7e, 0x05, 144 0x62, 0xcf, 0x03, 0xc0, 0xee, 0x7e, 0x60, 0xf7, 0x1e, 0x60, 0x77, 0x1f,
145 0xdf, 0x3c, 0x4d, 0x07, 0xa7, 0x0e, 0x2b, 0x39, 0xfb, 0x08, 0xe0, 0x97, 145 0xb0, 0x3b, 0x0b, 0xec, 0xee, 0x05, 0x6e, 0xf7, 0x00, 0xb7, 0xd3, 0xe0,
146 0x83, 0xd5, 0x01, 0x9b, 0x07, 0xec, 0x97, 0x31, 0xef, 0xd3, 0xa4, 0xdf, 146 0x8d, 0x23, 0xb3, 0xc0, 0xf1, 0x59, 0xe8, 0xcb, 0x2c, 0xe6, 0x28, 0xcc,
147 0x1e, 0x19, 0x48, 0x28, 0xc0, 0xe3, 0x45, 0x01, 0x2f, 0x7d, 0x71, 0x97, 147 0x88, 0xf1, 0x35, 0xec, 0xe1, 0xe8, 0x54, 0x6a, 0x16, 0xfa, 0x9d, 0x18,
148 0xb1, 0x53, 0xf0, 0x3f, 0x40, 0xef, 0x15, 0x2f, 0x80, 0xbe, 0xbd, 0xf0, 148 0x32, 0xa1, 0x07, 0xe9, 0xbb, 0x61, 0x6f, 0x88, 0x9b, 0xca, 0x83, 0x32,
149 0x39, 0x91, 0x67, 0x61, 0x93, 0xe1, 0x8f, 0x22, 0x57, 0x31, 0x2d, 0x7c, 149 0x0c, 0xbf, 0xdf, 0xb6, 0xb5, 0x1d, 0xfa, 0x84, 0x68, 0x24, 0x11, 0xe8,
150 0x11, 0x29, 0x0f, 0x76, 0xa7, 0x41, 0xef, 0x38, 0xfc, 0xd3, 0x00, 0xfc, 150 0x68, 0xbf, 0x14, 0xbc, 0x76, 0xbb, 0xcd, 0xec, 0x42, 0x5f, 0x2a, 0x89,
151 0x53, 0x0c, 0xbe, 0xa9, 0x07, 0x7e, 0xc9, 0x82, 0x5f, 0x0a, 0x83, 0x1f, 151 0x18, 0xd5, 0x38, 0x74, 0x3a, 0x65, 0x8c, 0x9c, 0x26, 0x0f, 0x26, 0x81,
152 0x06, 0xcd, 0xc2, 0x47, 0xcd, 0x42, 0xfe, 0xe7, 0x66, 0x48, 0x19, 0x04, 152 0x83, 0x15, 0x19, 0x4f, 0x53, 0x4f, 0x2b, 0xf2, 0x5c, 0x3a, 0xd5, 0x5b,
153 0xad, 0xcf, 0xc1, 0x3f, 0x26, 0x63, 0x77, 0x42, 0xcf, 0x22, 0x17, 0x66, 153 0x94, 0x46, 0x39, 0xe9, 0x4c, 0x2a, 0xdf, 0x6f, 0x65, 0x4e, 0x29, 0x1f,
154 0xd5, 0x41, 0xca, 0xc1, 0x9f, 0x77, 0x6e, 0x8b, 0x62, 0xbd, 0x26, 0x4a, 154 0x3a, 0xec, 0xe2, 0x5a, 0x6a, 0x33, 0x0a, 0xa7, 0xb9, 0xd7, 0x76, 0xfc,
155 0x84, 0x5c, 0x1d, 0xe5, 0xdf, 0x7e, 0x85, 0xac, 0x7f, 0x06, 0xef, 0x22, 155 0xa2, 0x58, 0xf7, 0x57, 0x90, 0x91, 0x25, 0x7d, 0x3d, 0x62, 0x1c, 0xee,
156 0x61, 0xa2, 0x3d, 0x94, 0xb5, 0xa3, 0x46, 0xa7, 0xda, 0x03, 0x18, 0x6e, 156 0x2c, 0x02, 0x39, 0x53, 0xf6, 0x22, 0x56, 0xcb, 0x4f, 0xb6, 0x27, 0xda,
157 0x87, 0x95, 0x03, 0x53, 0x11, 0x05, 0xfb, 0x03, 0xcd, 0x27, 0x60, 0xeb, 157 0x4d, 0x4b, 0x86, 0x2c, 0x43, 0x46, 0x61, 0x5f, 0x7d, 0xe9, 0xff, 0xa9,
158 0xcb, 0x34, 0x1e, 0x63, 0x3d, 0x29, 0xd3, 0xf3, 0xb1, 0xc8, 0x40, 0x9e, 158 0x9c, 0x74, 0xf8, 0xbc, 0x5e, 0xfe, 0x5c, 0x61, 0x31, 0xd6, 0x9e, 0x9f,
159 0x5a, 0xe9, 0x98, 0x39, 0x21, 0x7c, 0xbc, 0x16, 0x3f, 0x21, 0x74, 0x2c, 159 0xc6, 0xba, 0x51, 0xf0, 0x9b, 0xeb, 0x72, 0x1e, 0xb4, 0x81, 0x8b, 0x96,
160 0x67, 0xe1, 0x59, 0xec, 0x54, 0xb2, 0x53, 0xbc, 0x7e, 0x14, 0x5a, 0xee, 160 0x9b, 0x9a, 0x2d, 0xca, 0x2e, 0xd8, 0xe9, 0x06, 0xc9, 0x6d, 0xaf, 0x93,
161 0xc7, 0x93, 0xe7, 0x07, 0xdd, 0xfa, 0x49, 0x39, 0xd8, 0x9d, 0x87, 0x77, 161 0xec, 0x40, 0x52, 0x0a, 0x53, 0xbb, 0x80, 0x8d, 0x31, 0x65, 0xab, 0x85,
162 0x88, 0x18, 0x8b, 0x58, 0x39, 0x35, 0x11, 0x0d, 0x45, 0x55, 0x8d, 0x86, 162 0xc1, 0xa4, 0x3c, 0x36, 0xc5, 0xbe, 0x2c, 0xf6, 0x9a, 0x3a, 0x95, 0x15,
163 0x35, 0x85, 0x46, 0x61, 0x6f, 0xd2, 0xb1, 0xff, 0x2c, 0x1f, 0x33, 0x79, 163 0xee, 0xd5, 0x90, 0xec, 0xc1, 0xac, 0x3c, 0xe6, 0x65, 0x65, 0x04, 0xf2,
164 0xbc, 0x99, 0xbe, 0x2a, 0xfc, 0x0d, 0xd6, 0x2e, 0x4c, 0x63, 0x5d, 0x3f, 164 0x3a, 0x0b, 0x5e, 0x1e, 0xf2, 0x5c, 0x79, 0x0e, 0xbe, 0x26, 0x7f, 0x1a,
165 0xf8, 0xcb, 0xeb, 0xf2, 0x3c, 0x68, 0xc3, 0xf6, 0x6b, 0x56, 0xe4, 0xd9, 165 0x58, 0xeb, 0xae, 0x07, 0x2e, 0xa6, 0xce, 0x31, 0xc6, 0x37, 0x19, 0x87,
166 0x3c, 0xed, 0x00, 0x6d, 0xd9, 0x66, 0xc1, 0x3e, 0x0c, 0x60, 0xed, 0x5e, 166 0x82, 0x97, 0x7f, 0x34, 0x45, 0x5e, 0x9a, 0x32, 0x7d, 0xaf, 0x01, 0x3c,
167 0xd8, 0x4f, 0x3c, 0x93, 0xbd, 0x1c, 0x07, 0x05, 0x68, 0xd8, 0x64, 0x79, 167 0x48, 0x82, 0x77, 0xae, 0xfc, 0xb1, 0x97, 0x3a, 0x9f, 0x35, 0x81, 0xc5,
168 0xd4, 0xe5, 0x98, 0xe9, 0x19, 0xf3, 0xcb, 0xb1, 0x20, 0xfe, 0xe0, 0x7f, 168 0xe9, 0xde, 0x88, 0x34, 0x24, 0x30, 0xce, 0x1f, 0x93, 0x4f, 0x47, 0x20,
169 0x4d, 0x96, 0x19, 0x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xa4, 0x8b,
184 0x1f, 0xab, 0xe8, 0xa8, 0x13, 0xff, 0xa9, 0x88, 0x11, 0x0b, 0x88, 0x11, 184 0xe3, 0xcf, 0x81, 0x4e, 0xf2, 0x4e, 0x86, 0x18, 0x57, 0x21, 0x16, 0x7e,
185 0x53, 0x42, 0x47, 0x8d, 0x04, 0x72, 0x04, 0xd0, 0xdc, 0xd1, 0xcf, 0x42, 185 0x84, 0x32, 0x1e, 0xed, 0x7e, 0x88, 0x7c, 0x2b, 0x82, 0xe8, 0x53, 0x3e,
186 0x91, 0x71, 0xc9, 0xb1, 0x5c, 0x0e, 0x00, 0x99, 0x13, 0x8e, 0x7d, 0xa4, 186 0x8e, 0x49, 0x91, 0x71, 0xe8, 0x62, 0xe4, 0x09, 0x19, 0x9a, 0xa7, 0x2f,
187 0x3c, 0xc7, 0x91, 0xa3, 0xea, 0x53, 0x34, 0x5c, 0x60, 0x3f, 0x8e, 0x3f, 187 0xc4, 0xcf, 0x23, 0x26, 0x02, 0xc7, 0x94, 0xcf, 0x6a, 0x87, 0x3e, 0x14,
188 0x9b, 0x6d, 0x2d, 0xec, 0xa3, 0xf0, 0xc5, 0x51, 0xf0, 0x39, 0x0f, 0x1a, 188 0xc1, 0xef, 0x8d, 0x3a, 0x0e, 0x3b, 0x08, 0xf9, 0xf6, 0x43, 0xfe, 0x19,
189 0xac, 0x97, 0x74, 0xdd, 0x4f, 0x07, 0xec, 0x3d, 0xa0, 0x79, 0x9c, 0x46, 189 0x19, 0x39, 0x33, 0x42, 0xdd, 0xee, 0x9a, 0x97, 0x54, 0xd7, 0x49, 0xd9,
190 0x4e, 0x8d, 0xb0, 0xcc, 0xf6, 0x14, 0x28, 0xd2, 0x73, 0x8c, 0xb6, 0x1b, 190 0x66, 0xcf, 0xc1, 0x06, 0xb3, 0x83, 0x95, 0x5d, 0x66, 0x86, 0xef, 0x9c,
191 0x73, 0x2c, 0xdf, 0x83, 0xe5, 0x1d, 0xe0, 0x85, 0xd0, 0x51,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x03, 0x0e, 0x81, 0xb1, 0xbe, 0x2c, 0x5d, 0x25, 0xdb, 0x45, 0x33,
214 0x4a, 0x4d, 0x74, 0x54, 0xe3, 0xf1, 0x48, 0x38, 0xaf, 0x1e, 0x42, 0xdc, 214 0xaa, 0xf1, 0x8f, 0xed, 0x94, 0xfd, 0xb0, 0xc0, 0x58, 0x1a, 0xf6, 0x80,
215 0xf3, 0xb8, 0xea, 0xb7, 0x7e, 0xe6, 0x67, 0xbf, 0xe3, 0xb7, 0xae, 0x29, 215 0xcf, 0x7b, 0x64, 0xb8, 0x9c, 0x91, 0xc2, 0x99, 0x6d, 0xf6, 0x28, 0x72,
216 0xd5, 0xb9, 0x10, 0x87, 0x8a, 0xdc, 0x60, 0x41, 0x19, 0x2c, 0x5d, 0x52, 216 0xf5, 0x25, 0xda, 0x89, 0x75, 0x45, 0x60, 0x1d, 0xfc, 0xb7, 0x27, 0xc5,
217 0x92, 0x85, 0x6b, 0x4a, 0xaa, 0xc4, 0x30, 0x8e, 0xce, 0x67, 0xcf, 0x74, 217 0xba, 0x0c, 0x31, 0xaf, 0x03, 0xfa, 0x84, 0xbe, 0xd2, 0x92, 0x4e, 0xde,
218 0x82, 0x4e, 0x1f, 0x89, 0xef, 0xe6, 0x7a, 0x8f, 0x50, 0xea, 0xd4, 0xad, 218 0xbf, 0x62, 0x3f, 0xf4, 0xdb, 0xcb, 0xf7, 0x34, 0x2f, 0xd7, 0xde, 0xd3,
219 0x94, 0x9e, 0xe6, 0xbc, 0x34, 0x02, 0x7c, 0x3f, 0x2a, 0xe7, 0x62, 0x41, 219 0xee, 0xea, 0x9e, 0x88, 0x31, 0xf0, 0x03, 0x1e, 0xfc, 0x00, 0x74, 0xfa,
220 0xca, 0x9d, 0xe1, 0x31, 0xb6, 0x5f, 0xd6, 0xd5, 0x45, 0x1f, 0xef, 0x9f, 220 0x75, 0x0f, 0x7e, 0xc0, 0x83, 0x1f, 0x80, 0x3d, 0xbe, 0x02, 0x7d, 0x7c,
221 0xf9, 0x6f, 0x52, 0xc1, 0x7e, 0x53, 0xd2, 0x8f, 0xdf, 0x7d, 0x9c, 0x93, 221 0xd9, 0x83, 0x2f, 0xf0, 0xe0, 0x0b, 0x3c, 0xf8, 0x02, 0x2f, 0x07, 0xd9,
222 0xe1, 0xf7, 0x6f, 0x86, 0xd3, 0xb7, 0x95, 0x16, 0x36, 0xdc, 0xc8, 0x3e, 222 0x11, 0xef, 0xe9, 0x4b, 0x0e, 0x54, 0xfd, 0xa7, 0x1f, 0x83, 0xdd, 0xa2,
223 0x57, 0xb3, 0xc7, 0x47, 0x7d, 0x7e, 0x6b, 0x7b, 0x13, 0xb5, 0x84, 0x80, 223 0xe3, 0x1a, 0xd8, 0xae, 0xbd, 0x59, 0x46, 0xbb, 0x98, 0x13, 0x35, 0xe0,
224 0xc3, 0x4a, 0x7b, 0x64, 0x98, 0x5f, 0x87, 0x1c, 0xb0, 0x4d, 0xd9, 0x0d, 224 0xda, 0x88, 0x2b, 0x62, 0x98, 0xae, 0x2f, 0x69, 0xdb, 0x79, 0x1c, 0x74,
225 0x7e, 0x5a, 0x6c, 0xc3, 0x60, 0x93, 0x76, 0x53, 0xae, 0xc4, 0xb2, 0x1d, 225 0x01, 0x17, 0xba, 0xbe, 0x08, 0xdd, 0x44, 0x1c, 0xe1, 0xfe, 0x86, 0x8e,
226 0x35, 0x32, 0x90, 0xb1, 0x34, 0x75, 0xb1, 0x1e, 0xb9, 0xba, 0x07, 0xdb, 226 0x7f, 0x7e, 0x64, 0xf9, 0xba, 0xd9, 0x88, 0xbe, 0xfb, 0xd0, 0xd7, 0x88,
227 0x9d, 0x87, 0xed, 0x46, 0x3c, 0x64, 0x53, 0xbe, 0x29, 0xce, 0x36, 0xbc, 227 0x31, 0x47, 0x31, 0x86, 0xf1, 0x53, 0x93, 0xee, 0x0b, 0x8f, 0x63, 0x1c,
228 0x0b, 0xb2, 0x85, 0xbe, 0x62, 0x55, 0x17, 0x77, 0x2d, 0xc1, 0x5d,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x87, 0x1f, 0xe2, 0x18, 0x91, 0x73, 265 0x76, 0x82, 0x26, 0xc6, 0x7d, 0xaa, 0x4e, 0xd5, 0xec, 0xd7, 0xc6, 0x48,
266 0xd9, 0x18, 0xe5, 0x62, 0x45, 0xc4, 0x6a, 0x91, 0xd9, 0xd9, 0x4a, 0x8e, 266 0x43, 0xe0, 0x27, 0x95, 0x3f, 0x9e, 0x80, 0xeb, 0xc3, 0xde, 0x10, 0x48,
267 0xf5, 0x35, 0x69, 0xbb, 0x6b, 0xe2, 0x22, 0x7a, 0xbc, 0x78, 0x09, 0xf8, 267 0x02, 0xdb, 0x73, 0x93, 0x3b, 0xb5, 0xdf, 0x65, 0x0e, 0xc1, 0xf8, 0xdd,
268 0x73, 0xbc, 0xa5, 0x49, 0x1b, 0xc1, 0xfd, 0xe3, 0x12, 0x47, 0x7e, 0xe7, 268 0xd7, 0xd3, 0x5c, 0x7a, 0x34, 0x98, 0xa7, 0x05, 0x9e, 0x32, 0x54, 0x43,
269 0x3a, 0x1e, 0x7c, 0x69, 0xf1, 0x47, 0xe0, 0x15, 0xc7, 0x7d, 0x51, 0x27, 269 0xe3, 0x5a, 0x8c, 0x7b, 0x82, 0x18, 0x68, 0x8f, 0x8e, 0x81, 0xfa, 0xe5,
270 0xde, 0xab, 0x89, 0xa9, 0xd7, 0xf8, 0xc9, 0xe2, 0x78, 0x89, 0x61, 0x74, 270 0x88, 0xe7, 0xe7, 0x0c, 0x03, 0xa5, 0x01, 0xf4, 0x29, 0xda, 0x13, 0x8c,
271 0x19, 0x2f, 0x05, 0x64, 0x5e, 0x63, 0xc8, 0x3c, 0x87, 0x63, 0x6d, 0xae, 271 0x35, 0x4d, 0x93, 0xb1, 0x66, 0x0a, 0xc9, 0x87, 0xbf, 0x97, 0xb6, 0xad,
272 0xb1, 0xd6, 0xc7, 0x50, 0x0b, 0x43, 0xc1, 0x6d, 0xcc, 0x13, 0x8e, 0xa1, 272 0xac, 0x65, 0x06, 0x7b, 0x69, 0xbc, 0xb0, 0x7c, 0x2f, 0xbb, 0x94, 0xde,
273 0xda, 0x28, 0x39, 0xe3, 0xc4, 0x50, 0x4e, 0x9d, 0xcd, 0xcd, 0x71, 0x5c, 273 0x9b, 0xe0, 0x9d, 0x8f, 0x4d, 0x9c, 0xf3, 0x7c, 0x94, 0xb8, 0x35, 0x50,
274 0x5c, 0xd9, 0x0f, 0xef, 0xc0, 0x3e, 0x45, 0x9e, 0x14, 0x74, 0xea, 0x7f, 274 0x1a, 0x54, 0xf3, 0x8e, 0xaf, 0x98, 0x57, 0xb0, 0xc7, 0x03, 0x6b, 0x3c,
275 0x1a, 0xec, 0xf6, 0x51, 0xf4, 0x8f, 0xba, 0xfd, 0x9e, 0x5c, 0xc3, 0xc5, 275 0xe3, 0xfe, 0x19, 0x5b, 0xd8, 0x7a, 0xff, 0x81, 0x0c, 0x2f, 0x63, 0xce,
276 0x85, 0x7d, 0xbd, 0x1b, 0xd3, 0xed, 0x96, 0x31, 0x1d, 0x62, 0x18, 0xdb, 276 0x2e, 0xa3, 0xa0, 0xe2, 0xb6, 0x83, 0x4a, 0x1e, 0x85, 0xd2, 0x10, 0xae,
277 0xc9, 0xbb, 0xf6, 0x16, 0x33, 0xe8, 0xe3, 0x75, 0x11, 0x1b, 0x12, 0xc7, 277 0xb4, 0x17, 0x35, 0x8f, 0xb2, 0x99, 0x51, 0x25, 0x83, 0x11, 0xb5, 0xc7,
278 0x49, 0x90, 0xaf, 0xfd, 0x91, 0x50, 0x58, 0xad, 0xc7, 0xab, 0x75, 0xa1, 278 0xb9, 0xd2, 0x23, 0x88, 0xd7, 0xbe, 0x0e, 0x3f, 0x18, 0xae, 0x2b, 0x3a,
279 0x16, 0xaf, 0x41, 0xf1, 0xdd, 0xf8, 0x92, 0xef, 0x48, 0xc4, 0x92, 0xe3, 279 0x18, 0x43, 0x5e, 0x15, 0x43, 0x78, 0x4a, 0x9a, 0x59, 0x33, 0xbc, 0x82,
280 0xf6, 0x10, 0xe8, 0xc5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 0xaf,
295 0x3b, 0x36, 0x73, 0x25, 0xbf, 0xee, 0xc2, 0xed, 0x41, 0x9c, 0xad, 0x50, 295 0xac, 0x7a, 0x37, 0xc0, 0x8b, 0xb8, 0x6c, 0x9c, 0xd9, 0xac, 0x30, 0xc3,
296 0x93, 0x55, 0xc0, 0xfe, 0xde, 0xf0, 0x37, 0x5b, 0xae, 0x2e, 0x06, 0x68, 296 0x9e, 0x5a, 0xc2, 0x8c, 0x51, 0xcf, 0xd7, 0x5f, 0xf0, 0xca, 0xd9, 0x28,
297 0xfd, 0xcc, 0x2d, 0x42, 0x1f, 0x8d, 0xc9, 0xaa, 0x3e, 0x8e, 0x82, 0x37, 297 0xd7, 0x9b, 0x77, 0x2f, 0xe5, 0x10, 0x43, 0xd5, 0x1c, 0xe2, 0x96, 0x1a,
298 0x19, 0xa7, 0x06, 0x60, 0xae, 0xa7, 0xeb, 0xd7, 0x0b, 0xc6, 0xed, 0x37, 298 0x3e, 0xae, 0x86, 0x99, 0xe7, 0x54, 0xbe, 0xfc, 0x6a, 0x39, 0xf5, 0x82,
299 0xfd, 0xaa, 0xe5, 0xca, 0xc0, 0xf5, 0xf2, 0x91, 0x4f, 0xd5, 0xd1, 0xba, 299 0x48, 0x1f, 0xf2, 0xe4, 0xd4, 0x79, 0x91, 0x2c, 0x72, 0x65, 0xe6, 0x73,
300 0x51, 0x4d, 0xf8, 0x2c, 0xe8, 0x1a, 0x47, 0xde, 0x1d, 0x79, 0x81, 0x10, 300 0x7b, 0x90, 0x3b, 0xa7, 0x7e, 0x21, 0xd2, 0x8b, 0x9c, 0x99, 0xf9, 0x70,
301 0x3b, 0x39, 0x79, 0x78, 0x1a, 0xb9, 0x77, 0xe4, 0x02, 0xe7, 0xe3, 0x6e, 301 0x3f, 0xf8, 0xda, 0x03, 0x4c, 0x4d, 0x03, 0x63, 0xb7, 0x83, 0xbf, 0x5d,
302 0x7e, 0xfe, 0x6a, 0x29, 0x72, 0x36, 0x8f, 0x9c, 0x79,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xfa, 0xdb, 0xc2, 0x64, 0x0c, 0x51,
310 0x6c, 0xef, 0x43, 0x32, 0x97, 0x5c, 0x78, 0x28, 0x69, 0xe5, 0x43, 0x3e, 310 0x29, 0xff, 0x9a, 0x65, 0xae, 0xf7, 0xf6, 0x7a, 0x69, 0xd8, 0xf6, 0x02,
311 0xf7, 0x7c, 0x62, 0x42, 0x47, 0x84, 0xc8, 0xbf, 0x20, 0xcd, 0x0d, 0x20, 311 0x8b, 0x63, 0xc4, 0x99, 0x39, 0x27, 0xae, 0xea, 0xdd, 0x37, 0xb9, 0xec,
312 0x71, 0x6e, 0xd9, 0xfe, 0x02, 0x1f, 0x10, 0xb1, 0x6d, 0x9c, 0x33, 0x03, 312 0xb7, 0x21, 0xd3, 0xdf, 0x92, 0x39, 0xc4, 0x13, 0xf3, 0xbd, 0xa0, 0x71,
313 0xa2, 0xd6, 0xb6, 0xd1, 0xe2, 0x7e, 0x03, 0xfc, 0xbe, 0x8f, 0xe6, 0x90, 313 0x7b, 0x0b, 0xc6, 0xd3, 0xee, 0xc8, 0xf3, 0xdf, 0x96, 0xa1, 0x41, 0xf2,
314 0x43, 0x14, 0x44, 0x1e, 0xde, 0x0e, 0x78, 0x37, 0x0f, 0xbf, 0x1f, 0xb9, 314 0xd4, 0xc1, 0xf8, 0xfb, 0x31, 0xa6, 0x19, 0xd7, 0x07, 0x23, 0x73, 0x76,
315 0x01, 0xd3, 0xd8, 0x04, 0xfc, 0x6f, 0x03, 0xc6, 0x6b, 0x43, 0x9f, 0x6b, 315 0xcc, 0x6f, 0x0f, 0x70, 0x0e, 0xfa, 0x52, 0xce, 0xc3, 0xb5, 0x5a, 0x94,
316 0x22, 0xf1, 0x3d, 0x8f, 0xb7, 0x13, 0xd7, 0x65, 0xab, 0xf3, 0xf2, 0x9c, 316 0xcd, 0x2f, 0xcd, 0xcf, 0xb9, 0xf9, 0xec, 0xe3, 0xca, 0xbe, 0xee, 0xee,
317 0x3c, 0xf6, 0x61, 0xf9, 0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xe1, 0x0a, 0xbf, 0x04,
332 0xe1, 0xa9, 0xe0, 0xc9, 0xf5, 0x0c, 0x1d, 0x4f, 0xe8, 0x18, 0xec, 0x53, 332 0xac, 0xc9, 0x77, 0xbf, 0x0d, 0x1d, 0x82, 0x6c, 0xca, 0xb6, 0x71, 0xbf,
333 0xb4, 0xef, 0x92, 0x93, 0x3f, 0x41, 0x37, 0xde, 0x9e, 0x74, 0xea, 0x51, 333 0xe7, 0xd7, 0x87, 0x16, 0xdd, 0xd5, 0xeb, 0x43, 0x8b, 0xa2, 0xea, 0x43,
334 0x8b, 0xd6, 0x72, 0xf5, 0xa8, 0x3f, 0x67, 0x9e, 0x9c, 0x70, 0xeb, 0x51, 334 0x13, 0xd7, 0xa8, 0x0f, 0x65, 0xaf, 0xbf, 0x3e, 0x74, 0xa2, 0x9e, 0x18,
335 0x8b, 0x24, 0xea, 0x51, 0x27, 0x56, 0xa8, 0x47, 0x25, 0x56, 0x5f, 0x8f, 335 0xbc, 0xb7, 0x47, 0x8c, 0xdf, 0xd5, 0xf5, 0xa1, 0xf7, 0xc5, 0xaf, 0x0f,
336 0xe2, 0xf9, 0x35, 0xda, 0xd7, 0x4f, 0xca, 0x17, 0x64, 0x3d, 0xea, 0x3d, 336 0x5d, 0x94, 0xd5, 0xeb, 0x43, 0x13, 0x35, 0xf5, 0xa1, 0x8d, 0xaa, 0x3e,
337 0x72, 0xea, 0x51, 0x17, 0xa9, 0x71, 0x3d, 0xea, 0x78, 0x5d, 0x3d, 0x2a, 337 0xc4, 0x79, 0xfc, 0xfa, 0x10, 0xdb, 0x6d, 0xdd, 0xbd, 0xa1, 0x3a, 0x08,
338 0x28, 0xea, 0x51, 0x3c, 0x8f, 0x53, 0x8f, 0x12, 0xed, 0xbe, 0x88, 0xa7, 338 0xf0, 0x54, 0xe5, 0x84, 0xb6, 0x31, 0xe8, 0x05, 0x18, 0x45, 0x2c, 0xbf,
339 0xee, 0x42, 0xf4, 0xee, 0x64, 0x07, 0x68, 0x66, 0xd0, 0xf7, 0x1a, 0xda, 339 0xb9, 0xea, 0x8f, 0x96, 0xf0, 0xca, 0x50, 0xba, 0x75, 0x2d, 0xbc, 0x1a,
340 0x34, 0x45, 0xc8, 0xdb, 0x4a, 0x35, 0xd0, 0x07, 0x6e, 0xb8, 0xbe, 0xa2, 340 0xf4, 0x63, 0x90, 0x65, 0x58, 0x35, 0x5e, 0x8d, 0x53, 0x5e, 0xab, 0x67,
341 0xd0, 0x06, 0xcc, 0x9b, 0xec, 0x7b, 0xd8, 0x53, 0x63, 0x61, 0x9a, 0xff, 341 0xde, 0x3c, 0x56, 0x5a, 0x9a, 0x77, 0x0c, 0xb2, 0x1d, 0xaa, 0xd6, 0x50,
342 0x62, 0xea, 0x2c, 0x07, 0x45, 0x9d, 0xe5, 0x87, 0x6b, 0xbc, 0x75, 0x96, 342 0xd6, 0x8a, 0x85, 0x1c, 0x39, 0xb6, 0xea, 0x37, 0xb8, 0x44, 0x76, 0xe5,
343 0x45, 0xba, 0x7e, 0x9d, 0xe5, 0x60, 0x83, 0x3a, 0xcb, 0x5b, 0x54, 0xad, 343 0x37, 0x38, 0x43, 0x1c, 0xd0, 0xd9, 0xd6, 0x5d, 0x50, 0x79, 0xd5, 0x9c,
344 0xb3, 0xbc, 0x45, 0xd5, 0x3a, 0xcb, 0xc1, 0x12, 0xe7, 0xe2, 0x3e, 0x89, 344 0xf7, 0x55, 0xb9, 0xf0, 0xb0, 0x0d, 0x3c, 0x09, 0x6a, 0x26, 0x94, 0xe5,
345 0x5f, 0x06, 0xed, 0x41, 0xf1, 0xc7, 0xb5, 0x97, 0xc5, 0xca, 0x1e, 0x7e, 345 0x92, 0x8f, 0x28, 0x98, 0x9f, 0x5f, 0xdd, 0xe4, 0xb0, 0xaa, 0x9b, 0xfc,
346 0xd9, 0x6a, 0x2f, 0x6c, 0x03, 0x22, 0x17, 0x2e, 0xd7, 0xd4, 0x5e, 0xb8, 346 0xbc, 0x3e, 0x5c, 0x37, 0x59, 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7c, 361 0x23, 0x31, 0xe2, 0x63, 0x8b, 0xcb, 0x3d, 0xf4, 0x6b, 0x5c, 0x63, 0xdb,
362 0x7d, 0x17, 0x36, 0x9c, 0xcf, 0xaa, 0xbf, 0x23, 0x6a, 0x04, 0x73, 0x36, 362 0xcf, 0xf5, 0x58, 0x8f, 0x6e, 0x71, 0x9f, 0x80, 0x5c, 0x59, 0xab, 0x09,
363 0xdb, 0x6b, 0x8e, 0x41, 0x7f, 0x0b, 0xb2, 0xc4, 0xef, 0x51, 0x71, 0x2e, 363 0xe4, 0xf7, 0x0d, 0xbd, 0xef, 0x5e, 0x29, 0xb6, 0x48, 0x6c, 0x23, 0xe8,
364 0x21, 0x6a, 0xf8, 0x83, 0xdc, 0x76, 0xed, 0x4a, 0x94, 0xed, 0x30, 0xf6, 364 0x69, 0x9b, 0x62, 0x8c, 0x7d, 0x8f, 0xca, 0x37, 0x1c, 0x77, 0x6d, 0xbb,
365 0x5c, 0xa5, 0x31, 0xe2, 0x23, 0xc8, 0x0c, 0xc7, 0xb1, 0x0c, 0xe7, 0xc6, 365 0xdd, 0x7f, 0x03, 0x76, 0x3b, 0x70, 0x55, 0xbb, 0x3d, 0x1b, 0x0b, 0xdb,
366 0x9e, 0x9a, 0xa7, 0x66, 0xab, 0xcb, 0xb8, 0x88, 0x75, 0x39, 0x00, 0x9a, 366 0xed, 0xfe, 0x1b, 0xb0, 0xdb, 0x23, 0x37, 0x64, 0xb7, 0xdc, 0x1b, 0x31,
367 0xed, 0x10, 0x31, 0xea, 0xb8, 0x5d, 0xa6, 0xea, 0x19, 0x3f, 0xd3, 0xdc, 367 0x29, 0xa8, 0x8b, 0xad, 0x8c, 0x9b, 0x82, 0x75, 0x47, 0xb1, 0x66, 0x76,
368 0x39, 0xe7, 0x3f, 0x66, 0x2f, 0x47, 0xfb, 0xcd, 0x37, 0x48, 0x7b, 0x47, 368 0x8d, 0x35, 0x87, 0xd6, 0xac, 0xbb, 0xd6, 0xc6, 0x4c, 0xd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95, 0x9f, 0xf0, 0x7d, 0xa5, 0x93, 0xc8, 0x29, 0xac,
384 0x56, 0x7c, 0x46, 0xcb, 0xf9, 0x61, 0x5e, 0xc9, 0xd8, 0xe3, 0x7c, 0x1f, 384 0x50, 0x9d, 0x3d, 0xa6, 0x73, 0x31, 0xda, 0x58, 0x5c, 0xe5, 0x89, 0x7e,
385 0x41, 0x4d, 0xc6, 0x36, 0xca, 0x78, 0xf0, 0x38, 0xdf, 0x77, 0x28, 0xab, 385 0xee, 0xc1, 0x5c, 0x75, 0xf9, 0x99, 0x8d, 0xd5, 0x75, 0x60, 0xf3, 0x27,
386 0x71, 0xae, 0x45, 0x91, 0xaa, 0xc6, 0x6f, 0x87, 0x8f, 0xda, 0x0e, 0xbc, 386 0xd0, 0x81, 0x5a, 0xf9, 0xc5, 0x60, 0xfb, 0x81, 0xfc, 0x82, 0x98, 0x65,
387 0x9a, 0x79, 0xdc, 0xa7, 0xc6, 0x5b, 0x99, 0x76, 0x8a, 0x1a, 0x5f, 0x2b, 387 0x56, 0xef, 0xbb, 0xdd, 0x97, 0xe1, 0xff, 0x8b, 0x7d, 0x1a, 0xa1, 0x7d,
388 0xcf, 0x0d, 0x7a, 0x03, 0x0e, 0xfe, 0xdd, 0xdc, 0xd6, 0xd4, 0xf8, 0xdd, 388 0x06, 0x78, 0x74, 0x58, 0xef, 0x73, 0x47, 0x0d, 0x1e, 0x0d, 0xd4, 0xd8,
389 0xec, 0xd3, 0xc2, 0xa4, 0xba, 0xfd, 0xb7, 0x07, 0x98, 0xae, 0xa4, 0xde, 389 0xec, 0xe7, 0x89, 0x47, 0x97, 0xd7, 0x7d, 0xfe, 0x78, 0xc4, 0x7d, 0x6d,
390 0x16, 0xe0, 0xb8, 0x76, 0xde, 0xf6, 0x8b, 0x3b, 0x05, 0xc9, 0x18, 0xd7, 390 0x59, 0x15, 0x87, 0xfc, 0x7d, 0x3c, 0x2d, 0x66, 0xe6, 0xb3, 0xcc, 0xdf,
391 0xcc, 0x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 0x46, 398 0xc8, 0xf6, 0x35, 0xc4, 0x4b, 0xaf, 0x7a, 0xc8, 0x59, 0x3d, 0xe4, 0xaa,
399 0x9d, 0xb3, 0x7a, 0xbb, 0xde, 0xff, 0x8d, 0x8a, 0x73, 0x65, 0xc7, 0x06, 399 0x1e, 0x72, 0x55, 0x0f, 0xb9, 0xaa, 0xd7, 0xa5, 0x73, 0xde, 0x01, 0x5d,
400 0xb9, 0xe7, 0xc3, 0xab, 0x3b, 0xff, 0xbe, 0xbe, 0x3e, 0xb5, 0xd4, 0xd7, 400 0xd7, 0xe7, 0xf7, 0x70, 0xd6, 0x0b, 0x8a, 0xf0, 0x25, 0xe3, 0x3c, 0x63,
401 0x0d, 0x24, 0x0d, 0x98, 0x36, 0x8d, 0xcf, 0xee, 0xe7, 0x4b, 0x7c, 0xaf, 401 0x61, 0xe6, 0xd2, 0xeb, 0x82, 0x73, 0x48, 0xba, 0xe6, 0xdd, 0xaa, 0x6b,
402 0x25, 0x12, 0xe3, 0xdc, 0x6d, 0x44, 0xdc, 0xf9, 0x50, 0x21, 0x85, 0x3a, 402 0x30, 0x75, 0x37, 0x29, 0xdf, 0x6c, 0xbe, 0xd1, 0xe0, 0x7f, 0x33, 0xe7,
403 0x8d, 0x19, 0x9c, 0xf3, 0x85, 0x86, 0x7d, 0x71, 0xca, 0x64, 0x27, 0x48, 403 0xf9, 0x8f, 0x3f, 0x44, 0x5c, 0xc2, 0x1a, 0xd8, 0x04, 0x6d, 0xb4, 0x62,
404 0x43, 0xac, 0x98, 0xa9, 0xd6, 0x03, 0x1f, 0x5c, 0x43, 0x96, 0x2b, 0x97, 404 0x66, 0x58, 0x63, 0x11, 0xd3, 0xcc, 0x7c, 0x01, 0xef, 0x6c, 0xc3, 0x1e,
405 0x51, 0xce, 0x1f, 0x6a, 0xce, 0xed, 0x16, 0xe9, 0xb0, 0x72, 0xa0, 0x74, 405 0xea, 0x69, 0xdb, 0x11, 0x33, 0xd3, 0x48, 0x9e, 0x1a,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16,
428 0x84, 0x63, 0x57, 0x58, 0xbf, 0x79, 0x7e, 0x69, 0x5f, 0x4a, 0x2c, 0x87, 428 0x8c, 0x6f, 0xa8, 0x19, 0x8f, 0xbe, 0x33, 0x75, 0xfa, 0xbb, 0x17, 0x31,
429 0xce, 0x3a, 0xe9, 0x25, 0x32, 0x1b, 0x5e, 0x52, 0x77, 0xf1, 0xd5, 0xd9, 429 0xf6, 0x88, 0xce, 0xbb, 0x71, 0x2d, 0xd5, 0x7e, 0x4b, 0xa1, 0xde, 0xb5,
430 0x77, 0x12, 0xf6, 0x3d, 0xd7, 0xe2, 0xb7, 0x36, 0xac, 0xbd, 0x9e, 0x7d, 430 0x42, 0x06, 0xc1, 0x39, 0x3b, 0xda, 0x6b, 0x16, 0xf6, 0xba, 0x14, 0xcb,
431 0xcf, 0x78, 0xec, 0x7b, 0x38, 0x58, 0xf5, 0xf9, 0x8f, 0x09, 0x9f, 0xdf, 431 0xf8, 0xfa, 0x18, 0xd6, 0x45, 0xe2, 0x43, 0x51, 0x22, 0x2e, 0x74, 0x67,
432 0xd1, 0xc0, 0x66, 0xac, 0xde, 0xe7, 0xef, 0xfd, 0xd8, 0x3e, 0x7f, 0xb9, 432 0x1e, 0x3a, 0x34, 0x1f, 0xf8, 0x24, 0x9e, 0x99, 0x4a, 0x75, 0xf9, 0x7a,
433 0x75, 0x57, 0xe3, 0xf3, 0x1f, 0x69, 0xf9, 0x78, 0x3e, 0x9f, 0xd7, 0xac, 433 0x6a, 0x48, 0xd4, 0x5d, 0xd0, 0x39, 0xd8, 0x4e, 0xd2, 0x0e, 0xbc, 0x0c,
434 0xaf, 0x65, 0x7a, 0xcf, 0x59, 0x8e, 0xca, 0x18, 0x7b, 0xb7, 0x27, 0xc6, 434 0x30, 0x53, 0x4e, 0xf9, 0x76, 0x43, 0xfd, 0xe5, 0xfc, 0xda, 0x7e, 0xa8,
435 0x66, 0xfc, 0xbe, 0x27, 0xef, 0x02, 0x9e, 0x5e, 0xeb, 0xc8, 0xdb, 0x51, 435 0xab, 0x7a, 0x9d, 0xbe, 0x15, 0xb8, 0x96, 0x5c, 0x51, 0xab, 0x8a, 0x5c,
436 0x19, 0xa7, 0x73, 0xec, 0x8d, 0xf7, 0xc2, 0x23, 0x90, 0xd1, 0x7c, 0x8f, 436 0x07, 0xae, 0x0d, 0x54, 0x71, 0xed, 0x41, 0x99, 0xad, 0xe6, 0xdb, 0xfd,
437 0x8f, 0x54, 0x9a, 0x35, 0x9d, 0xb3, 0xed, 0x9f, 0x6f, 0xae, 0x17, 0xa1, 437 0x72, 0xd4, 0xdb, 0xcb, 0xf3, 0x38, 0xa7, 0xb2, 0xf2, 0xd9, 0xe4, 0xdb,
438 0xcb, 0xc2, 0x9f, 0x24, 0x3e, 0x81, 0x5a, 0xea, 0x49, 0xc8, 0x8f, 0xbb, 438 0x7b, 0xab, 0x7e, 0x32, 0x35, 0x91, 0x95, 0x0b, 0xc7, 0x99, 0x43, 0x05,
439 0xaf, 0x95, 0x6a, 0xa9, 0xf5, 0xe7, 0x1f, 0x7c, 0xee, 0x41, 0xca, 0x03, 439 0xb5, 0xd6, 0x71, 0xef, 0x5b, 0x94, 0x0b, 0x6c, 0xe3, 0x46, 0xf3, 0x6d,
440 0x95, 0x73, 0x10, 0xaf, 0x4e, 0xe9, 0x94, 0x9d, 0x21, 0xdd, 0x8c, 0x93, 440 0xce, 0xe7, 0xc8, 0x51, 0xff, 0x2c, 0x44, 0x75, 0xde, 0x62, 0x75, 0xde,
441 0xb2, 0x8f, 0x71, 0x8e, 0xfd, 0xb0, 0x52, 0x6f, 0x3f, 0x24, 0x6b, 0x30, 441 0x84, 0xb6, 0x37, 0xfa, 0xe0, 0x25, 0x7f, 0x99, 0x87, 0xbf, 0x1c, 0x42,
442 0xea, 0xb2, 0x77, 0x82, 0x7e, 0x02, 0x7c, 0x58, 0xaf, 0x9c, 0x1a, 0x8c, 442 0xce, 0xbd, 0xe0, 0xad, 0x56, 0xef, 0xbc, 0x51, 0x7f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, 0x22, 0x0a, 0xbf, 0xac, 0xd7, 0x4e, 0xe3, 0xa4, 0x61, 487 0x15, 0xf1, 0xd7, 0x8d, 0xf1, 0x3d, 0x88, 0x85, 0xdf, 0xc4, 0xfe, 0xda,
488 0x93, 0x3a, 0xad, 0x69, 0xd2, 0x60, 0xc7, 0x4b, 0x12, 0x29, 0xa5, 0xa4, 488 0xa0, 0x1f, 0x8f, 0x4b, 0xfe, 0xcc, 0x1d, 0xd2, 0x37, 0x9d, 0x02, 0x3d,
489 0x52, 0x55, 0x45, 0x60, 0xa9, 0x21, 0x4e, 0xda, 0x0a, 0x71, 0x70, 0x0b, 489 0xbf, 0xae, 0x0c, 0xa7, 0x11, 0x37, 0x3f, 0xcf, 0x33, 0x60, 0xc0, 0x4b,
490 0x48, 0x51, 0xc5, 0x21, 0x4d, 0xd3, 0x7b, 0x85, 0x84, 0x54, 0xa1, 0x8a, 490 0xf0, 0xed, 0x95, 0x15, 0xdf, 0xa0, 0xc3, 0xe7, 0xc6, 0xba, 0xaa, 0xe7,
491 0x46, 0x4e, 0x02, 0x15, 0x4a, 0xe5, 0x0a, 0x96, 0x72, 0x41, 0xa2, 0xd8, 491 0x80, 0x5e, 0x2a, 0x4b, 0xac, 0x99, 0x34, 0x4f, 0x2d, 0x9d, 0x09, 0x5f,
492 0x8e, 0x02, 0x52, 0x2a, 0xf7, 0xca, 0x85, 0xba, 0xbf, 0x08, 0x89, 0x03, 492 0x28, 0xef, 0x56, 0x7e, 0xec, 0xc5, 0xf2, 0xff, 0x52, 0x77, 0x6d, 0xb1,
493 0x70, 0x06, 0x29, 0x2a, 0x3f, 0xe2, 0xc0, 0x8d, 0x1b, 0x54, 0x5d, 0xde, 493 0x6d, 0x9d, 0xf7, 0xfd, 0xcf, 0x43, 0xea, 0x12, 0xdd, 0x7c, 0x24, 0xd3,
494 0x37, 0xb3, 0x63, 0xaf, 0x77, 0xd7, 0x8e, 0x03, 0x11, 0x07, 0x27, 0xbb, 494 0x32, 0x2d, 0xd1, 0xf2, 0x39, 0xd2, 0xb1, 0xc5, 0xd8, 0x5a, 0xc7, 0x6a,
495 0xf6, 0xcc, 0xce, 0xec, 0xcc, 0x37, 0x6f, 0xbe, 0xf7, 0x37, 0xfd, 0xbe, 495 0xca, 0x26, 0xac, 0x5a, 0xc2, 0x52, 0xf4, 0x65, 0x59, 0x36, 0xd0, 0x97,
496 0x78, 0x8d, 0x5a, 0xdb, 0x5b, 0xf3, 0x55, 0xec, 0xe7, 0xaf, 0x37, 0x18, 496 0x76, 0x1e, 0x16, 0xa0, 0x0e, 0x65, 0x3b, 0x1d, 0xd0, 0x07, 0xb7, 0xd9,
497 0x57, 0xed, 0xba, 0xe4, 0xa9, 0xf5, 0xe3, 0x9a, 0x72, 0xd9, 0x1b, 0xf0, 497 0x80, 0xa4, 0x03, 0x6c, 0x96, 0xb2, 0x1c, 0xaf, 0x53, 0x4d, 0x36, 0x66,
498 0xfe, 0xc7, 0x68, 0x51, 0xd8, 0x86, 0x94, 0xad, 0xee, 0xc5, 0x40, 0x9b, 498 0xd5, 0xac, 0x1b, 0x50, 0x4e, 0x92, 0x9d, 0xb4, 0x50, 0xc0, 0x64, 0xbd,
499 0xd9, 0xff, 0x33, 0x16, 0x03, 0x3e, 0x9b, 0x68, 0xad, 0x6d, 0x8a, 0xed, 499 0x60, 0xd8, 0x43, 0xad, 0xc9, 0xf6, 0xf6, 0xb2, 0x87, 0x6c, 0xd8, 0x83,
500 0x71, 0xd9, 0x16, 0xde, 0xda, 0xc2, 0xb6, 0x10, 0x3c, 0x16, 0xfd, 0x9e, 500 0x81, 0x0d, 0x98, 0x63, 0x05, 0x68, 0x96, 0x02, 0x49, 0x87, 0x15, 0x43,
501 0xb1, 0xa8, 0xc9, 0xea, 0xa1, 0x16, 0xed, 0x74, 0x88, 0x21, 0xbf, 0x9d, 501 0x1e, 0x36, 0x70, 0xff, 0xdf, 0x77, 0x21, 0x0f, 0x0f, 0x0f, 0x75, 0x89,
502 0x67, 0x6c, 0x05, 0xca, 0xce, 0x4f, 0x5d, 0x36, 0x3c, 0xe0, 0x73, 0xdc, 502 0x9d, 0x01, 0x33, 0x60, 0x88, 0xe7, 0x9c, 0xef, 0x9c, 0xf3, 0x7d, 0xff,
503 0x59, 0xeb, 0xc0, 0x27, 0xb5, 0x9d, 0x1a, 0x51, 0xed, 0x01, 0x8f, 0xc9, 503 0xef, 0x7f, 0xbf, 0x9d, 0x3a, 0x3f, 0x8f, 0xd8, 0xc3, 0xdc, 0xca, 0x5b,
504 0xc5, 0x45, 0x82, 0xbe, 0x86, 0x36, 0xe3, 0x82, 0xe3, 0xfa, 0x39, 0x14, 504 0x0c, 0x8b, 0xbb, 0x42, 0x96, 0xcd, 0xe5, 0x69, 0x28, 0x48, 0xd8, 0x0f,
505 0x8f, 0xf1, 0xfa, 0x1b, 0x88, 0xe5, 0x70, 0xda, 0x3f, 0xd9, 0x76, 0xae, 505 0x0a, 0x30, 0x0c, 0x44, 0x6e, 0x86, 0x8c, 0xcd, 0x47, 0xc5, 0xbe, 0x4a,
506 0x9c, 0xe5, 0xbd, 0x42, 0xd4, 0x63, 0xbd, 0xef, 0x52, 0xdb, 0x82, 0xa8, 506 0x5e, 0x71, 0xcc, 0x95, 0x5b, 0x51, 0xdb, 0x5b, 0x99, 0x73, 0x21, 0xf7,
507 0x27, 0xe3, 0x20, 0x1c, 0x1d, 0xd0, 0xe1, 0xe2, 0x8d, 0x74, 0x3f, 0xff, 507 0x42, 0xe6, 0x85, 0x00, 0x9e, 0xab, 0x17, 0x8f, 0x3b, 0x32, 0x2f, 0x64,
508 0x9e, 0x13, 0xcc, 0xdd, 0x7f, 0xdd, 0x1d, 0x36, 0x3f, 0x34, 0x64, 0xae, 508 0x64, 0x01, 0xe7, 0xfa, 0x3d, 0x72, 0xae, 0x9d, 0x71, 0x00, 0x39, 0x44,
509 0xde, 0x56, 0xdc, 0x5d, 0xd9, 0x89, 0x06, 0x85, 0xaf, 0xc1, 0xad, 0x7b, 509 0xc8, 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7a, 0x7e, 0x90, 0x0d, 0x3d, 0x68, 0x0e, 0x87, 0x7c, 0x73, 539 0x45, 0xcc, 0xa7, 0x0e, 0xca, 0x2d, 0x4b, 0x70, 0x9f, 0x17, 0x16, 0x35,
540 0x28, 0xf1, 0x06, 0x6e, 0x8f, 0x58, 0xbc, 0x83, 0x9e, 0x38, 0xc5, 0x9d, 540 0x39, 0x32, 0xa7, 0xe4, 0xc8, 0xa2, 0x8b, 0x8f, 0x37, 0xea, 0xed, 0x7d,
541 0x18, 0x93, 0xee, 0x80, 0x78, 0x41, 0xc4, 0xfa, 0xf9, 0xfa, 0xcb, 0xef, 541 0x3e, 0x7a, 0xbb, 0xbb, 0xb6, 0x43, 0xd4, 0xb8, 0x35, 0xa9, 0xed, 0xf0,
542 0x7c, 0x51, 0xf3, 0xaf, 0xad, 0x49, 0x6d, 0xba, 0x3c, 0xad, 0x4d, 0x15, 542 0xab, 0x99, 0xc2, 0xd8, 0x17, 0x59, 0x5f, 0xf9, 0x14, 0xf4, 0x15, 0x13,
543 0x51, 0xee, 0xa2, 0x56, 0xdb, 0x97, 0x36, 0x5d, 0x1c, 0x11, 0x7c, 0x30, 543 0x35, 0x4b, 0x52, 0x67, 0xc1, 0x75, 0x96, 0x49, 0xaf, 0x45, 0x18, 0xa7,
544 0x79, 0xad, 0x42, 0x78, 0x4f, 0xdb, 0xbe, 0x25, 0xb8, 0xed, 0x80, 0x0f, 544 0x8e, 0xd1, 0x79, 0xd6, 0xc9, 0x6f, 0xd2, 0xe3, 0xca, 0x66, 0x4b, 0xb8,
545 0xab, 0x8a, 0x73, 0x18, 0x2d, 0xbc, 0x97, 0xb4, 0xbd, 0xb8, 0xb9, 0x8e, 545 0xf2, 0x4c, 0x91, 0xdf, 0x1f, 0xa0, 0xec, 0xb3, 0x76, 0x2c, 0x41, 0xc7,
546 0x5b, 0xbe, 0x3f, 0x1d, 0x20, 0xdf, 0x9b, 0xd9, 0x0a, 0x91, 0xbf, 0x29, 546 0xe8, 0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a, 0x73, 0x54, 0x2c, 0x51, 0xd6, 0x0a,
591 0x07, 0xe2, 0x55, 0x7d, 0x60, 0x45, 0xe8, 0x09, 0xbb, 0x1c, 0x1d, 0x34, 591 0x9d, 0x15, 0x75, 0x8f, 0xfb, 0x23, 0xeb, 0x94, 0x66, 0xb9, 0x97, 0xa5,
592 0xd8, 0x16, 0x97, 0xcb, 0xe3, 0xcc, 0x1b, 0xd8, 0xf8, 0xa4, 0x1d, 0x7d, 592 0x73, 0x2c, 0x63, 0xcf, 0x2d, 0xd5, 0x74, 0xfc, 0xc6, 0xda, 0xc7, 0x7a,
593 0xda, 0xaa, 0x9e, 0x99, 0xc3, 0xba, 0x65, 0x8d, 0x4b, 0xfb, 0xe5, 0x09, 593 0x1c, 0x5f, 0x17, 0x38, 0x1e, 0xdd, 0x10, 0xc7, 0x8f, 0x56, 0x71, 0x7c,
594 0xce, 0xac, 0xa8, 0xcc, 0x3e, 0x30, 0xa3, 0xa4, 0xa5, 0x93, 0xf1, 0xa9, 594 0xae, 0x4f, 0xe2, 0xf3, 0x45, 0x7e, 0x56, 0x0f, 0x1d, 0x16, 0xcf, 0xcd,
595 0x50, 0x84, 0x16, 0xac, 0x28, 0x15, 0xac, 0x14, 0x73, 0x70, 0xf0, 0xe3, 595 0xf2, 0xef, 0x4e, 0x3a, 0x2c, 0xfb, 0x62, 0xf0, 0xbb, 0x99, 0xc7, 0xe7,
596 0xd0, 0x80, 0x46, 0x11, 0x96, 0x35, 0x11, 0x2a, 0x95, 0x94, 0x4e, 0x76, 596 0xb3, 0x74, 0xfe, 0x7a, 0x36, 0x90, 0x12, 0x35, 0x0a, 0xee, 0xbe, 0x1e,
597 0x86, 0xc8, 0x2c, 0xc6, 0xa4, 0x0d, 0x9b, 0x71, 0x9a, 0x1f, 0x33, 0xe6, 597 0xfa, 0x7e, 0x8c, 0x6b, 0x86, 0xff, 0x9a, 0x2f, 0xc9, 0x9a, 0xab, 0x92,
598 0x49, 0x43, 0xcc, 0x8b,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a, 0x7a, 0x64, 0x82, 0x17, 0xdf, 0xd0, 0x2f, 0x05, 0xfb, 0x4b, 0x86,
606 0x39, 0x4e, 0xef, 0x57, 0xed, 0x07, 0x12, 0x43, 0x39, 0x91, 0x43, 0x84, 606 0xd4, 0x83, 0x27, 0x59, 0xbf, 0xdd, 0x6e, 0x0c, 0xe9, 0x61, 0x75, 0x44,
607 0x33, 0x17, 0x2a, 0xb3, 0xbf, 0x9b, 0x5e, 0x7f, 0x3f, 0xeb, 0x5b, 0x1f, 607 0x6f, 0x4f, 0x0e, 0xef, 0x6f, 0xec, 0x83, 0xb4, 0x39, 0x32, 0xaf, 0x3d,
608 0xc5, 0x28, 0x72, 0x15, 0x71, 0xdd, 0x36, 0x5d, 0x1b, 0x4f, 0x5e, 0xd9, 608 0x25, 0x78, 0xc1, 0xe5, 0xb1, 0x0a, 0x4d, 0xc7, 0xbb, 0x29, 0x33, 0xc6,
609 0x14, 0x79, 0x68, 0x09, 0x5a, 0x33, 0xa5, 0x3c, 0xcd, 0x71, 0xf9, 0x15, 609 0xef, 0x9e, 0x44, 0x4f, 0xac, 0x20, 0x65, 0x99, 0x7e, 0x33, 0x63, 0x8f,
610 0x94, 0x5b, 0x4b, 0xd0, 0x3d, 0x91, 0x8f, 0xd6, 0x4e, 0x77, 0xf4, 0x18, 610 0x29, 0x7d, 0x51, 0xfb, 0xdd, 0xdb, 0x54, 0xee, 0xc3, 0x45, 0x11, 0xab,
611 0x85, 0x6e, 0x9a, 0xc6, 0xbc, 0xf0, 0x0b, 0x57, 0x66, 0x87, 0x86, 0x0d, 611 0x94, 0xfd, 0x84, 0xf8, 0xf7, 0x92, 0x7e, 0xf6, 0x45, 0x11, 0x33, 0xcd,
612 0xd2, 0xae, 0xa2, 0x1e, 0xff, 0xbf, 0x89, 0xfb, 0x28, 0x61, 0x7e, 0x66, 612 0x5c, 0x6f, 0x55, 0xe3, 0x3a, 0x5d, 0xe3, 0x30, 0xa6, 0x53, 0x8d, 0xc5,
613 0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, 0x84, 0x9c, 620 0x37, 0x72, 0xbd, 0x21, 0xc8, 0xa2, 0x32, 0x62, 0xa9, 0x88, 0x6b, 0x34,
621 0xa3, 0x36, 0xca, 0x64, 0xbb, 0x69, 0xb3, 0x14, 0x66, 0x71, 0x05, 0xec, 621 0xd3, 0x9d, 0xf7, 0x20, 0x5f, 0x7f, 0x1b, 0x3a, 0xe8, 0x56, 0xe8, 0xcf,
622 0x44, 0xb9, 0x4c, 0x81, 0xa6, 0xd6, 0x5f, 0xeb, 0x83, 0x1f, 0x66, 0x52, 622 0xf2, 0xa1, 0x3f, 0xf7, 0xfb, 0x51, 0xeb, 0x86, 0x9a, 0xb7, 0x6c, 0xcc,
623 0xab, 0x61, 0xe9, 0x51, 0x00, 0x96, 0x7e, 0xa9, 0xc3, 0xd2, 0xd1, 0xbe, 623 0xa0, 0x0a, 0xdb, 0x0a, 0x06, 0x95, 0xcc, 0x00, 0x9d, 0x77, 0xec, 0xf8,
624 0xe6, 0x58, 0xea, 0x77, 0x62, 0xd6, 0xa3, 0x14, 0x71, 0x70, 0xf4, 0x39, 624 0x12, 0xc9, 0x9a, 0xc9, 0xe9, 0x79, 0x3b, 0xb6, 0x4a, 0x87, 0xcc, 0x73,
625 0xe3, 0xe8, 0x3d, 0xc6, 0xd1, 0xf1, 0x06, 0x38, 0xd2, 0x3c, 0x38, 0x3a, 625 0x24, 0x7b, 0x25, 0x94, 0x58, 0x06, 0x9f, 0xa1, 0x18, 0xdb, 0x47, 0x6c,
626 0x51, 0x87, 0xa3, 0x6c, 0x5f, 0x33, 0x1c, 0x1d, 0x0f, 0xa1, 0xff, 0xcd, 626 0x7f, 0x9e, 0x42, 0x5c, 0x46, 0xef, 0x0b, 0x6a, 0xe3, 0xf1, 0x37, 0xc6,
627 0xd6, 0x32, 0xfa, 0xb0, 0x9f, 0x39, 0xbd, 0x49, 0xa5, 0xd5, 0xe4, 0xf8, 627 0x70, 0xba, 0xb9, 0x93, 0x3a, 0x12, 0xfc, 0xc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0xb3, 0xe4, 0xb7, 0xad, 0xed, 0x32, 0xf8, 635 0xe1, 0xfd, 0x7e, 0xba, 0x97, 0x77, 0x6d, 0xee, 0x7a, 0xd5, 0xef, 0xd0,
636 0x5d, 0x0d, 0xc6, 0x56, 0x58, 0xc4, 0x91, 0x24, 0x47, 0x67, 0x42, 0x90, 636 0xb4, 0xac, 0x35, 0x56, 0xb8, 0x70, 0xbd, 0x89, 0x7f, 0xf3, 0x49, 0x21,
637 0x59, 0xb7, 0x18, 0x53, 0x3c, 0x17, 0x3c, 0x7e, 0xda, 0xf5, 0x41, 0x96, 637 0x2f, 0xcf, 0xca, 0x38, 0xc3, 0x80, 0xec, 0x6d, 0x16, 0xa2, 0xe5, 0x6a,
638 0x39, 0x4f, 0x09, 0x1b, 0xf4, 0x94, 0xa9, 0xc7, 0x33, 0x64, 0x5f, 0xd6, 638 0xed, 0x67, 0x50, 0xd5, 0x7f, 0x30, 0x53, 0x7c, 0xa4, 0x75, 0x9f, 0x3a,
639 0xcc, 0x31, 0x91, 0xeb, 0xb6, 0x54, 0xf6, 0x9e, 0x31, 0x91, 0xe1, 0xb1, 639 0x57, 0x15, 0x71, 0xa7, 0xb4, 0x2b, 0x8f, 0x22, 0xa4, 0xf2, 0x24, 0x70,
640 0x57, 0x78, 0xf4, 0xca, 0xa1, 0x76, 0xaa, 0x38, 0x31, 0x4c, 0x85, 0x55, 640 0xdf, 0x48, 0x18, 0x75, 0x5b, 0xb2, 0xd6, 0x12, 0x63, 0x50, 0xe7, 0x08,
641 0xdb, 0x7e, 0xc8, 0xfc, 0x7f, 0xcd, 0x84, 0xcc, 0xfe, 0xdb, 0xae, 0xc4, 641 0x1b, 0x12, 0x75, 0xae, 0xf0, 0xfb, 0x35, 0xab, 0x05, 0xc5, 0x78, 0xf8,
642 0x74, 0x5a, 0x36, 0x55, 0xdf, 0xee, 0x08, 0x7c, 0x31, 0x47, 0xa4, 0x77, 642 0x9f, 0xb4, 0x5d, 0x78, 0x5a, 0xd0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x05, 0x91, 0x47, 0xb9, 0x58, 0xb8, 0x24, 0xff,
679 0x96, 0x5e, 0x52, 0xef, 0xe0, 0xf7, 0x95, 0xff, 0x86, 0x12, 0x7d, 0x96,
680 0xcb, 0x36, 0x73, 0xff, 0xf3, 0xd7, 0x3f, 0x8e, 0x6f, 0x4b, 0xff, 0xc8,
681 0xa6, 0x6b, 0xfa, 0x87, 0xfb, 0xd9, 0x5a, 0x17, 0x39, 0xd6, 0x2f, 0xfb,
682 0x37, 0x00, 0x06, 0x9d, 0xd0, 0xad, 0xd2, 0x80, 0xa5, 0x31, 0x65, 0x47,
683 0x92, 0xc1, 0x49, 0x9a, 0x2d, 0x47, 0x8d, 0x4c, 0x01, 0x3a, 0x30, 0xff,
684 0x2d, 0x5d, 0xd9, 0x2d, 0x7d, 0x2e, 0xfa, 0x1e, 0xf0, 0xf5, 0x9d, 0x3c,
685 0xfe, 0x3f, 0xfa, 0x65, 0xee, 0xb5, 0xfb, 0x7c, 0x0f, 0x9f, 0x7f, 0x2e,
686 0x52, 0x7f, 0xfe, 0x31, 0x3e, 0xdf, 0xc7, 0xe7, 0xe1, 0x87, 0x84, 0x9f,
687 0x31, 0x46, 0x39, 0xde, 0x9f, 0xd9, 0x32, 0xf3, 0xa9, 0x57, 0x58, 0x5e,
688 0x2c, 0xe9, 0x71, 0xbb, 0x50, 0x97, 0x23, 0xf6, 0xc4, 0xe0, 0x31, 0x97,
689 0xf3, 0x63, 0x3c, 0x6e, 0x90, 0x82, 0xaf, 0x58, 0x34, 0xbb, 0xa4, 0x71,
690 0x52, 0xe7, 0xd4, 0xbf, 0xc3, 0xf0, 0x45, 0xde, 0xce, 0x47, 0xbb, 0x25,
691 0xfc, 0x62, 0xc2, 0x87, 0x89, 0x3c, 0x8e, 0x2b, 0x02, 0xf7, 0xec, 0x49,
692 0xab, 0xfa, 0x7e, 0xe0, 0x96, 0x88, 0x73, 0xf0, 0x1a, 0x58, 0x2e, 0x4d,
693 0x39, 0x66, 0xae, 0x9a, 0x8f, 0xf6, 0xe7, 0x03, 0xf2, 0xfe, 0xff, 0xda,
694 0x25, 0xfb, 0xa3, 0xbe, 0x3f, 0xa0, 0xfb, 0x24, 0x4a, 0x9d, 0x00, 0x39,
695 0xca, 0x01, 0x01, 0x9b, 0xe0, 0x02, 0xe4, 0x95, 0xc1, 0xbf, 0x79, 0x3d,
696 0x69, 0xcc, 0xb1, 0xad, 0x5f, 0xf7, 0x7c, 0x91, 0xeb, 0x3a, 0xc6, 0xf3,
697 0x4d, 0xf1, 0xba, 0xf4, 0xf9, 0x04, 0x1f, 0xfb, 0xed, 0x2f, 0x9e, 0xd5,
698 0x91, 0x46, 0x5d, 0x70, 0xe6, 0x54, 0x47, 0x3a, 0x13, 0x93, 0xfb, 0x5c,
699 0xf3, 0xd1, 0x46, 0xaa, 0x3e, 0xda, 0xb9, 0xfc, 0x78, 0x3f, 0xfc, 0x15,
700 0xc6, 0x35, 0xde, 0xef, 0xf0, 0x15, 0x1e, 0x8b, 0x7a, 0x84, 0x1c, 0xff,
701 0xed, 0x52, 0xf9, 0x3c, 0x8d, 0xb8, 0x22, 0xf3, 0x23, 0xb4, 0x5e, 0x81,
702 0x7b, 0x9f, 0xe0, 0x67, 0x48, 0xdd, 0xa2, 0xf9, 0x7b, 0xa8, 0x21, 0xff,
703 0xa5, 0x11, 0xc7, 0x36, 0xf2, 0xab, 0x8a, 0x38, 0xa2, 0x0f, 0x9e, 0x6d,
704 0xd4, 0x83, 0xe0, 0x9e, 0xf0, 0x8b, 0x4d, 0x37, 0xd0, 0x2b, 0xe8, 0x38,
705 0x44, 0x2f, 0xcc, 0x67, 0xe9, 0x31, 0xde, 0xab, 0x3f, 0x30, 0x3e, 0x83,
706 0x38, 0x3b, 0xc9, 0x5c, 0x27, 0x86, 0x71, 0xde, 0x89, 0x9d, 0x33, 0x52,
707 0xe0, 0x8b, 0x95, 0x90, 0xd3, 0x45, 0xad, 0x4c, 0xab, 0xbf, 0x49, 0x23,
708 0x6c, 0xcf, 0x81, 0x66, 0x9d, 0x48, 0x8a, 0x40, 0x6f, 0xb6, 0x79, 0x84,
709 0x71, 0x62, 0xba, 0x0c, 0x7c, 0x36, 0xe8, 0x8b, 0x45, 0xa2, 0xe7, 0x8b,
710 0x23, 0xe6, 0xf7, 0xc8, 0xb1, 0x6a, 0xd7, 0x6d, 0x33, 0xc9, 0xf3, 0x48,
711 0x95, 0x5f, 0xa2, 0xf7, 0x44, 0xdf, 0x12, 0xc0, 0x51, 0xef, 0xfb, 0x1f,
712 0xd1, 0x99, 0x34, 0xe6, 0xbd, 0x75, 0xfa, 0x3c, 0xb9, 0x2d, 0xfa, 0xec,
713 0xf0, 0xa1, 0xcf, 0x7f, 0x54, 0x78, 0x53, 0x61, 0x1c, 0xed, 0xa0, 0x99,
714 0x02, 0x72, 0xbf, 0x3e, 0x8b, 0xfe, 0x52, 0x85, 0x0c, 0xf3, 0xa5, 0x4c,
715 0x8d, 0x2f, 0x5d, 0x4d, 0x06, 0x13, 0xa0, 0x71, 0xf4, 0x65, 0x53, 0xf9,
716 0x3e, 0x58, 0xc7, 0x00, 0x8d, 0x2c, 0x74, 0x22, 0xf6, 0xb5, 0x9a, 0x9c,
717 0x48, 0xa8, 0xfa, 0x7c, 0xdb, 0x9a, 0x66, 0xfe, 0x38, 0xc7, 0xb4, 0x9c,
718 0x2b, 0x1c, 0xa4, 0xc5, 0x70, 0x94, 0x86, 0x17, 0x74, 0xbf, 0x12, 0x11,
719 0x37, 0x89, 0x4a, 0x9e, 0xa4, 0xd7, 0xfd, 0x84, 0xf0, 0x45, 0x58, 0x37,
720 0x3f, 0xa9, 0x75, 0x77, 0x6e, 0xc2, 0x97, 0xde, 0x57, 0x34, 0x5b, 0xb9,
721 0x95, 0x8c, 0x53, 0x36, 0x39, 0xf1, 0xef, 0x02, 0xff, 0x87, 0x6f, 0xc2,
722 0xaf, 0x06, 0x1e, 0x6d, 0x51, 0x3a, 0xef, 0x85, 0x45, 0x94, 0xd7, 0x8d,
723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0xc9, 0xce, 0x5a, 0x06, 0xf4, 0x11, 0xf8,
753 0x54, 0x64, 0xee, 0xd5, 0x49, 0xa7, 0xf7, 0xed, 0x5d, 0x53, 0xa3, 0x94,
754 0xe8, 0x07, 0xde, 0x4b, 0x9a, 0x55, 0x3d, 0x04, 0x04, 0xbf, 0x37, 0x0f,
755 0xe8, 0x9a, 0x48, 0x7d, 0xac, 0x65, 0x85, 0x3e, 0xee, 0xf2, 0x5c, 0x37,
756 0x3d, 0xd7, 0xab, 0x79, 0x72, 0x2c, 0xf3, 0x58, 0xce, 0x93, 0xec, 0x39,
757 0x84, 0xbe, 0x71, 0xc0, 0x3f, 0xf3, 0xc0, 0x7e, 0xf3, 0x73, 0xca, 0x06,
758 0xca, 0xac, 0x8c, 0x44, 0x7a, 0x8d, 0x98, 0x91, 0x19, 0xfb, 0x97, 0x4a,
759 0x22, 0x0d, 0xbd, 0xe8, 0xc6, 0x6e, 0xc9, 0xe3, 0x30, 0xaf, 0x6c, 0x1c,
760 0xaa, 0xdb, 0xa9, 0x95, 0x2e, 0x5a, 0x15, 0x7d, 0xb5, 0xa0, 0x63, 0xe0,
761 0x7e, 0x3c, 0x27, 0x6b, 0xb6, 0xb0, 0x7d, 0x77, 0xc3, 0x01, 0x8d, 0x1f,
762 0x8a, 0xdc, 0xe4, 0xfd, 0x4c, 0xad, 0x7c, 0x54, 0x39, 0x23, 0xfa, 0xd2,
763 0x60, 0x6c, 0x0f, 0xcd, 0x08, 0x9b, 0x8b, 0xf5, 0x97, 0x3a, 0xbb, 0x76,
764 0x12, 0xf3, 0xcc, 0x22, 0x56, 0x62, 0x38, 0xdf, 0x0e, 0x64, 0x4a, 0x32,
765 0xf6, 0x9d, 0xf2, 0xc4, 0xbe, 0x4f, 0x89, 0xd8, 0x37, 0xe2, 0xde, 0x80,
766 0x2b, 0x60, 0xe9, 0x97, 0xcb, 0x82, 0x7d, 0x8c, 0xf3, 0x3e, 0x5a, 0x34,
767 0x77, 0x5d, 0xf0, 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 0x58, 0x99, 0x09, 0xf7, 0x3a, 0xc4, 0x7c, 0xd7, 0xa7, 0xc5, 0xb8, 0xa0,
783 0x67, 0x5c, 0x82, 0x32, 0x13, 0x98, 0xbf, 0x18, 0xf3, 0x3f, 0xc9, 0xb8,
784 0x5e, 0x8f, 0xfb, 0x7e, 0x8b, 0x72, 0x42, 0xdf, 0xe7, 0xbf, 0x4b, 0x3d,
785 0x81, 0xf5, 0x02, 0xfc, 0x26, 0x06, 0xe3, 0x3f, 0xe6, 0x66, 0x51, 0x76,
786 0x89, 0xd7, 0x75, 0xbd, 0x2b, 0xf0, 0xa0, 0xf0, 0x93, 0x4a, 0xa6, 0x2e,
787 0xb7, 0xa5, 0xde, 0xbf, 0x2e, 0x6d, 0xae, 0x28, 0x39, 0xd7, 0x20, 0x4b,
788 0x21, 0x47, 0xb3, 0x95, 0xa0, 0x03, 0xbd, 0x0f, 0xb6, 0xd0, 0x25, 0xe6,
789 0x63, 0x32, 0x3f, 0x89, 0x79, 0x2a, 0xf3, 0x32, 0x49, 0x47, 0xa9, 0xba,
790 0xcf, 0x32, 0x48, 0x5c, 0x1e, 0xae, 0xe5, 0x45, 0xba, 0xe2, 0xe6, 0x21,
791 0x57, 0xdc, 0xdc, 0x74, 0xe5, 0x45, 0x86, 0x85, 0x9e, 0x56, 0xd3, 0xad,
792 0xc2, 0x4a, 0xb7, 0x8a, 0x8a, 0x9e, 0xf4, 0xe0, 0x71, 0x8b, 0x55, 0x1e,
793 0xb7, 0x73, 0x13, 0x1e, 0xe7, 0x67, 0x9b, 0xae, 0x2a, 0x7e, 0x62, 0xc7,
794 0x21, 0x6b, 0x6e, 0x31, 0xdf, 0xf8, 0x71, 0x79, 0x82, 0xf9, 0x49, 0x9c,
795 0xf9, 0xc9, 0x18, 0xf3, 0x93, 0x18, 0xf3, 0x13, 0x87, 0x61, 0x60, 0xf1,
796 0xda, 0xef, 0x05, 0x6e, 0xcf, 0x43, 0x8e, 0x4c, 0xd2, 0x95, 0x32,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xf3,
841 0x4c, 0xb3, 0x90, 0x7b, 0xd7, 0x02, 0x77, 0x0a, 0x06, 0xeb, 0x62, 0x21,
842 0x33, 0x43, 0xe0, 0x9f, 0x42, 0x3f, 0xe3, 0x7d, 0x5f, 0x65, 0x7e, 0x0f,
843 0xdf, 0x29, 0x7a, 0x77, 0x95, 0x20, 0x3b, 0x22, 0xb7, 0x99, 0x7f, 0x5e,
844 0x28, 0x5e, 0x63, 0x3a, 0xef, 0xa3, 0x2f, 0x17, 0x21, 0x9f, 0x01, 0x23,
845 0x3e, 0x2e, 0x91, 0xf0, 0x7d, 0x19, 0x53, 0x58, 0xfb, 0xfe, 0xac, 0x21,
846 0xf0, 0xe4, 0xaf, 0x01, 0x07, 0x86, 0xfd, 0xdd, 0x3d, 0xe8, 0x69, 0x9f,
847 0x30, 0x5a, 0x95, 0x8f, 0x17, 0xbf, 0x31, 0x1e, 0x63, 0x01, 0x37, 0x1c,
848 0x37, 0x8b, 0x2f, 0xe2, 0x1b, 0x11, 0x71, 0x86, 0x87, 0x97, 0x5f, 0x5d,
849 0xe5, 0xfb, 0x05, 0xbc, 0x26, 0x93, 0x41, 0xd4, 0x87, 0xd3, 0xd7, 0x82,
850 0x53, 0x93, 0xf4, 0x72, 0x19, 0xf3, 0xbe, 0x42, 0xb3, 0x61, 0xf0, 0x1f,
851 0x3b, 0x7e, 0x9f, 0x24, 0xec, 0xda, 0x59, 0xdf, 0xfc, 0xa2, 0x3f, 0x4f,
852 0xb3, 0x92, 0x42, 0x3f, 0x6e, 0x63, 0x7b, 0x07, 0xb0, 0x79, 0x83, 0x71,
853 0x2d, 0x0e, 0x1f, 0x80, 0xe2, 0x67, 0xdf, 0x67, 0x9e, 0x83, 0x3d, 0xc3,
854 0x71, 0x3d, 0x0f, 0x5b, 0x53, 0x3c, 0xcc, 0x71, 0xf1, 0xb0, 0x5c, 0x95,
855 0x87, 0x31, 0x2e, 0x08, 0xde, 0x05, 0xde, 0x74, 0x82, 0xf5, 0x45, 0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 0x6a, 0x9f, 0x99, 0x10, 0x63,
871 0xcd, 0x19, 0xe8, 0x44, 0xa6, 0x9e, 0x8b, 0xb6, 0x0d, 0xdd, 0x73, 0xb1,
872 0x63, 0xf7, 0xe9, 0x8f, 0x49, 0xea, 0x1d, 0x43, 0xac, 0x77, 0xe0, 0x3c,
873 0xcd, 0x82, 0xcf, 0xe6, 0xc2, 0xe8, 0x11, 0x3b, 0xc8, 0x30, 0x62, 0x3b,
874 0x6a, 0x82, 0xff, 0x0a, 0xbf, 0x18, 0x9e, 0xa3, 0xef, 0xff, 0x43, 0x5a,
875 0x9f, 0x07, 0x2f, 0x86, 0xfe, 0x29, 0xfb, 0xc8, 0xae, 0xaf, 0x48, 0xff,
876 0x6b, 0xca, 0xd7, 0xff, 0x0a, 0xdf, 0xeb, 0x04, 0xf4, 0x73, 0x13, 0x7e,
877 0xda, 0x69, 0xf5, 0xed, 0x8f, 0x5c, 0x19, 0xcf, 0xf2, 0xe3, 0x2b, 0x93,
878 0xae, 0x1c, 0x35, 0xe4, 0x8c, 0x64, 0x99, 0x4f, 0x38, 0x66, 0x8b, 0x21,
879 0x6b, 0x64, 0x6e, 0x95, 0xb5, 0xae, 0x73, 0x8c, 0xf7, 0xc4, 0x89, 0x1b,
880 0x46, 0x4a, 0xf8, 0x08, 0xda, 0x9d, 0x2e, 0x6a, 0x63, 0x39, 0x78, 0x8e,
881 0xd0, 0xe7, 0xcc, 0xb6, 0x10, 0x3b, 0xb9, 0xca, 0x38, 0x36, 0x1b, 0xb7,
882 0x23, 0xcf, 0x0b, 0x7b, 0x12, 0xf2, 0x01, 0xdf, 0x4e, 0x01, 0xac, 0x30,
883 0x07, 0xfe, 0xbd, 0x8c, 0x9e, 0x95, 0x71, 0x5e, 0x3f, 0x7c, 0xbd, 0x23,
884 0xd6, 0x5d, 0x96, 0x2b, 0x57, 0x85, 0x3f, 0xe5, 0x12, 0xeb, 0x92, 0xb6,
885 0x79, 0x54, 0xd0, 0x99, 0x31, 0xc4, 0x54, 0xc1, 0x74, 0x82, 0x1c, 0x81,
886 0xfd, 0xa2, 0xa7, 0x8e, 0xb4, 0x51, 0x78, 0x95, 0x2b, 0xaa, 0x57, 0x41,
887 0x1a, 0xb4, 0xbf, 0x75, 0x5f, 0x42, 0xfa, 0xa1, 0x7d, 0x28, 0x6e, 0x1d,
888 0xca, 0xeb, 0xa7, 0x86, 0x3d, 0x66, 0x89, 0xde, 0x8c, 0x80, 0x9d, 0xf0,
889 0x03, 0x1a, 0x63, 0x0c, 0x37, 0xfd, 0x9d, 0x1a, 0xb7, 0xbd, 0x7f, 0x5e,
890 0xd4, 0xdc, 0xbf, 0x59, 0x96, 0x32, 0x34, 0xc7, 0xb6, 0xf8, 0xec, 0xb8,
891 0x5b, 0xa7, 0xb0, 0x0b, 0xd3, 0xc2, 0x07, 0x33, 0x40, 0xc9, 0x85, 0x31,
892 0xfa, 0x7c, 0x1e, 0x3c, 0x88, 0xee, 0x27, 0x1d, 0xf1, 0xcd, 0x25, 0x9e,
893 0xd3, 0x18, 0xa5, 0xca, 0x80, 0x51, 0x80, 0x66, 0x99, 0xcb, 0xe7, 0x0a,
894 0x88, 0xbd, 0xf3, 0xef, 0x12, 0xbe, 0xa9, 0xf2, 0x3b, 0xca, 0xb7, 0x1d,
895 0xa5, 0xe9, 0x05, 0xca, 0x66, 0xe2, 0x4f, 0x8b, 0x3e, 0xd3, 0x99, 0xf8,
896 0xa8, 0xf2, 0xc9, 0x44, 0xf8, 0x3c, 0xfc, 0x5c, 0x16, 0x7d, 0x2e, 0x6f,
897 0x67, 0x33, 0x24, 0x7d, 0x0d, 0xc4, 0x73, 0x30, 0x58, 0x76, 0xee, 0x64,
898 0x9e, 0x70, 0x52, 0xf8, 0x1b, 0x58, 0xd3, 0x98, 0xc7, 0x78, 0xf8, 0x0a,
899 0xfa, 0x08, 0xf6, 0x55, 0xa6, 0xf0, 0x92, 0x1a, 0x5b, 0x21, 0x93, 0x71,
900 0xc1, 0xfc, 0x55, 0x27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, 0x7e, 0x79, 0xed, 0x98, 0x36,
945 0x4a, 0x17, 0x00, 0x57, 0xe4, 0x32, 0x5a, 0xbc, 0x37, 0x02, 0x4e, 0x59,
946 0xd3, 0x07, 0x06, 0xc7, 0x15, 0x0c, 0xbe, 0x22, 0xd6, 0x88, 0x5c, 0x40,
947 0xf8, 0x1c, 0x9b, 0xc3, 0x21, 0x97, 0x1f, 0xe1, 0xe7, 0x30, 0xee, 0x8f,
948 0x47, 0x98, 0x07, 0x6d, 0x1d, 0x0e, 0xb5, 0xb5, 0x37, 0xe3, 0x35, 0x5b,
949 0xad, 0x87, 0xb9, 0xef, 0x92, 0x1d, 0x11, 0x25, 0x37, 0xa4, 0x9e, 0xfb,
950 0x98, 0x63, 0xa7, 0xb3, 0x3c, 0xb7, 0xbf, 0x8f, 0xb7, 0xef, 0xa5, 0x8e,
951 0x0a, 0x1d, 0x8b, 0x03, 0x9f, 0x7b, 0xd8, 0x6e, 0xe4, 0x39, 0xec, 0xaf,
952 0xd0, 0xd5, 0xf8, 0x01, 0xb6, 0x4d, 0xf0, 0x2d, 0xa6, 0x11, 0xfe, 0xef,
953 0x24, 0x82, 0x01, 0xcc, 0xab, 0x8b, 0xef, 0x0d, 0x93, 0xd1, 0x9b, 0xe8,
954 0x6d, 0x57, 0xba, 0x29, 0xfc, 0x6e, 0xac, 0x9b, 0x1a, 0x33, 0xf1, 0x1d,
955 0xaa, 0xa6, 0x0c, 0xbe, 0x6a, 0xc4, 0xb1, 0x7e, 0x56, 0x91, 0xbd, 0x00,
956 0xa2, 0xea, 0xf8, 0xa7, 0x95, 0x44, 0x14, 0xc7, 0x26, 0xdd, 0x60, 0x7b,
957 0x39, 0x11, 0x18, 0xd9, 0x2b, 0x74, 0xf6, 0x80, 0x7d, 0x4c, 0xe6, 0x30,
958 0xd8, 0xa6, 0x15, 0xf0, 0xc3, 0x77, 0xa9, 0xeb, 0xd4, 0xf2, 0x4c, 0x81,
959 0xff, 0x15, 0xfa, 0x4f, 0xa6, 0x55, 0x93, 0x10, 0xb3, 0x98, 0x14, 0xb5,
960 0xce, 0xc8, 0x33, 0x3e, 0x3b, 0x0f, 0x9a, 0x85, 0xdf, 0xd0, 0x51, 0x7b,
961 0xfc, 0x29, 0xe4, 0x89, 0x15, 0x16, 0x69, 0x63, 0x59, 0x01, 0xbf, 0xd8,
962 0xc8, 0xc2, 0x5a, 0x6f, 0x58, 0xd4, 0x5e, 0xc3, 0xcf, 0xa9, 0xf3, 0x89,
963 0xf7, 0xf3, 0xf3, 0x43, 0xe2, 0xdb, 0x72, 0xd3, 0xd7, 0x30, 0xae, 0x95,
964 0x86, 0x17, 0x2a, 0x4f, 0xf1, 0x75, 0x11, 0x2f, 0xcc, 0x50, 0xbb, 0x8a,
965 0x05, 0x74, 0xa9, 0xf8, 0x51, 0x84, 0x69, 0xa8, 0x56, 0x53, 0x3c, 0x5c,
966 0xf5, 0x9d, 0x01, 0xb7, 0xbd, 0xbe, 0xb3, 0xaf, 0x6d, 0x22, 0x67, 0x36,
967 0xc3, 0x67, 0xe4, 0x82, 0xb6, 0x91, 0xf2, 0x09, 0x5a, 0xb3, 0xb4, 0xd5,
968 0xda, 0xb9, 0x6d, 0xdf, 0xd3, 0xde, 0x3a, 0xb5, 0x7a, 0xf1, 0xae, 0xd3,
969 0xa1, 0xf0, 0xa8, 0x95, 0xce, 0x16, 0x3b, 0x58, 0x56, 0xa3, 0xce, 0x09,
970 0xf0, 0x0a, 0x46, 0x51, 0x27, 0xf2, 0x5c, 0xa8, 0x95, 0x96, 0x97, 0x91,
971 0xd3, 0xf0, 0x67, 0x7b, 0x65, 0x7e, 0x6e, 0x9a, 0xe1, 0x72, 0x88, 0xe5,
972 0x9a, 0xa1, 0x62, 0x35, 0x38, 0x07, 0x9e, 0x20, 0x7a, 0x78, 0x86, 0x9e,
973 0x1e, 0xed, 0x60, 0x7d, 0x5e, 0xfa, 0xfa, 0x0f, 0xf3, 0xb3, 0xbf, 0x57,
974 0x4c, 0xc3, 0x4f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ac, 0x13,
989 0xac, 0x5e, 0x1c, 0x3d, 0x80, 0xe3, 0x44, 0x6f, 0x90, 0x61, 0x24, 0x71,
990 0xa8, 0xe1, 0x9b, 0x75, 0xa1, 0xc3, 0xa3, 0xe4, 0xfa, 0x6e, 0x1d, 0x7a,
991 0x26, 0x75, 0x50, 0x8a, 0xdf, 0x31, 0x5d, 0x94, 0xeb, 0x9e, 0x2b, 0x07,
992 0x49, 0xfa, 0x87, 0x52, 0x43, 0xfa, 0xfb, 0x84, 0xd4, 0x8f, 0x67, 0x6b,
993 0x5a, 0xc1, 0xef, 0x1e, 0x7a, 0x50, 0xec, 0xa2, 0x75, 0x15, 0x43, 0x7a,
994 0x20, 0xec, 0x29, 0xe6, 0xc5, 0xe9, 0x1e, 0xba, 0xbf, 0xdc, 0x42, 0xd4,
995 0xd7, 0x21, 0x62, 0xbc, 0x0f, 0x8a, 0x8b, 0x94, 0x7c, 0xed, 0xc9, 0x21,
996 0xe9, 0x4f, 0xa9, 0xe1, 0xc8, 0x03, 0x1f, 0x1c, 0x79, 0x57, 0xe0, 0xc8,
997 0xf0, 0xd0, 0xc6, 0x38, 0xb2, 0x47, 0xe7, 0x22, 0x52, 0xab, 0xc2, 0x8f,
998 0xd7, 0x19, 0x3f, 0x5e, 0x66, 0xfc, 0x38, 0xd2, 0x04, 0x3f, 0x0c, 0x0f,
999 0x7e, 0x1c, 0x15, 0xf8, 0xf1, 0xeb, 0x43, 0x1b, 0xe1, 0xc7, 0x91, 0xe0,
1000 0x46, 0x3e, 0x1e, 0x8d, 0x9b, 0x03, 0xb4, 0x54, 0x74, 0x68, 0x79, 0xde,
1001 0x8e, 0x27, 0x68, 0x35, 0x22, 0x63, 0x83, 0x53, 0xa2, 0x4e, 0x65, 0x51,
1002 0xe0, 0x55, 0x5a, 0xf8, 0x2f, 0xfd, 0xbf, 0x1b, 0x68, 0x29, 0xf8, 0xcb,
1003 0x3d, 0x99, 0xce, 0xaf, 0x5e, 0xfc, 0x3b, 0xde, 0xc7, 0xdb, 0x2b, 0xa1,
1004 0x10, 0xae, 0x05, 0xa7, 0xc2, 0xb4, 0xb6, 0x82, 0xef, 0x12, 0x46, 0xe8,
1005 0x4e, 0x31, 0x4a, 0xb7, 0x8b, 0x03, 0xb4, 0x56, 0x1c, 0xa2, 0xbb, 0x45,
1006 0xbc, 0x03, 0x30, 0xe7, 0x63, 0x01, 0x73, 0x83, 0x0e, 0x87, 0x79, 0xcc,
1007 0xf2, 0x00, 0xad, 0x2e, 0x6b, 0x7c, 0x05, 0xae, 0x62, 0xff, 0xe1, 0x27,
1008 0xf0, 0xc7, 0x81, 0xe9, 0x3a, 0x1c, 0x90, 0xf7, 0x60, 0xef, 0x67, 0x1b,
1009 0x6b, 0x64, 0x45, 0x9e, 0xa5, 0xc9, 0x38, 0xd2, 0x32, 0x65, 0x0b, 0x5f,
1010 0xea, 0xe1, 0x20, 0x74, 0xd9, 0xc4, 0x3e, 0xea, 0xe1, 0x3d, 0x70, 0x90,
1011 0x27, 0x34, 0xc4, 0x7a, 0xe9, 0x0e, 0xa1, 0x87, 0x26, 0x9d, 0x50, 0x64,
1012 0x9a, 0x2a, 0x97, 0x0c, 0x07, 0x3d, 0x0f, 0xd3, 0xfc, 0x3c, 0x43, 0xf9,
1013 0x71, 0xba, 0x5d, 0xf8, 0xe4, 0xd5, 0x39, 0x11, 0x8b, 0x7d, 0x96, 0xe7,
1014 0x0c, 0xf9, 0x58, 0x8b, 0x73, 0x50, 0x35, 0xce, 0xd1, 0xce, 0xeb, 0x96,
1015 0xb4, 0x34, 0xe3, 0xf0, 0xb8, 0x32, 0x8f, 0x2b, 0x23, 0x76, 0xc6, 0xe7,
1016 0x97, 0x11, 0xb7, 0x8d, 0xd2, 0xda, 0x3c, 0x68, 0x0e, 0x7e, 0x89, 0x5a,
1017 0xac, 0x74, 0x6d, 0x05, 0xe7, 0xe1, 0x9b, 0xa8, 0xc5, 0x4a, 0xd7, 0x54,
1018 0xac, 0x74, 0x6d, 0x65, 0x4a, 0xf0, 0xe1, 0xd9, 0xff, 0xdd, 0x14, 0x60,
1019 0x19, 0x30, 0x85, 0x19, 0xba, 0x4e, 0x53, 0x0d, 0x7a, 0xbf, 0x4e, 0x0c,
1020 0x78, 0x6c, 0x58, 0x50, 0x05, 0x7f, 0x18, 0xba, 0x62, 0x84, 0xa1, 0x0d,
1021 0xb8, 0xfd, 0xe3, 0x02, 0x34, 0xd3, 0x79, 0x4a, 0x0c, 0x30, 0x3c, 0x23,
1022 0x80, 0x79, 0x49, 0x18, 0x9a, 0x97, 0x60, 0x73, 0xaf, 0xfc, 0x0c, 0x90,
1023 0xbb, 0x7a, 0x6c, 0xc0, 0x6d, 0x7c, 0x48, 0xf9, 0x23, 0x83, 0x56, 0xfe,
1024 0x30, 0xb0, 0x38, 0xa9, 0x43, 0xf4, 0x37, 0xad, 0x7f, 0x2c, 0x07, 0x1b,
1025 0x5f, 0x6b, 0x02, 0x9a, 0xdb, 0x3c, 0x85, 0x94, 0xb9, 0x5b, 0x60, 0xbd,
1026 0x89, 0x75, 0x5d, 0x26, 0xb1, 0x76, 0xc3, 0xd2, 0x42, 0x0c, 0x19, 0xe9,
1027 0x09, 0x62, 0x06, 0x22, 0x3d, 0xd9, 0x00, 0xcb, 0x4e, 0x16, 0x60, 0x5e,
1028 0x11, 0x02, 0xd6, 0x0f, 0x0c, 0xd0, 0x3a, 0xe6, 0x00, 0x78, 0x2c, 0xa1,
1029 0x89, 0x01, 0x74, 0x07, 0x27, 0xd0, 0xfe, 0x7e, 0x65, 0xf0, 0xba, 0xe3,
1030 0x06, 0x09, 0x88, 0xa1, 0x8b, 0x7a, 0x14, 0xe5, 0x41, 0x79, 0xd4, 0x49,
1031 0x85, 0x81, 0xc4, 0xfc, 0x04, 0xf2, 0x1f, 0xd0, 0x1f, 0x20, 0x3f, 0x02,
1032 0xf3, 0x93, 0x33, 0x50, 0x0e, 0xb4, 0x36, 0xaa, 0x79, 0x0d, 0x48, 0x1f,
1033 0x28, 0x0c, 0x41, 0x65, 0x2a, 0x68, 0x8c, 0x03, 0xc8, 0x5e, 0x22, 0x04,
1034 0x0d, 0x3b, 0x20, 0x0d, 0x64, 0x37, 0x4f, 0x11, 0x01, 0xf3, 0x93, 0x02,
1035 0x84, 0x18, 0x1a, 0xe0, 0xf9, 0x89, 0x1d, 0xe8, 0x52, 0x98, 0x9b, 0xfe,
1036 0xff, 0x3f, 0xa6, 0xc2, 0x02, 0x4c, 0x7b, 0xa0, 0xb5, 0xb5, 0xbf, 0xff,
1037 0x1f, 0x10, 0x61, 0x61, 0x68, 0x81, 0xaf, 0xd1, 0x0b, 0x94, 0x07, 0x95,
1038 0x73, 0x0b, 0x80, 0xac, 0x36, 0x78, 0xbd, 0x0d, 0x92, 0x07, 0x89, 0xfd,
1039 0x02, 0x96, 0x2b, 0xff, 0xff, 0x2f, 0x85, 0xab, 0x05, 0x01, 0x00, 0xb3,
1040 0x28, 0x79, 0xae, 0x58, 0x7d, 0x00, 0x00, 0x00 };
652 1041
653static u32 bnx2_COM_b06FwData[(0x0/4) + 1] = { 0x0 }; 1042static const u32 bnx2_COM_b06FwData[(0x0/4) + 1] = { 0x0 };
654static u32 bnx2_COM_b06FwRodata[(0x58/4) + 1] = { 1043static const u32 bnx2_COM_b06FwRodata[(0x88/4) + 1] = {
655 0x08002428, 0x0800245c, 0x0800245c, 0x0800245c, 0x0800245c, 0x0800245c, 1044 0x08001c1c, 0x08001c4c, 0x08001c4c, 0x08001c4c, 0x08001c4c, 0x08001c4c,
656 0x08002380, 0x0800245c, 0x080023e4, 0x0800245c, 0x0800231c, 0x0800245c, 1045 0x08001b74, 0x08001c4c, 0x08001bdc, 0x08001c4c, 0x08001b08, 0x08001c4c,
657 0x0800245c, 0x0800245c, 0x08002328, 0x00000000, 0x08003240, 0x08003270, 1046 0x08001c4c, 0x08001c4c, 0x08001b14, 0x00000000, 0x08002b58, 0x08002ba8,
658 0x080032a0, 0x080032d0, 0x08003300, 0x00000000, 0x00000000 }; 1047 0x08002bd8, 0x08002c08, 0x08002c38, 0x00000000, 0x080060cc, 0x080060cc,
659static u32 bnx2_COM_b06FwBss[(0x88/4) + 1] = { 0x0 }; 1048 0x080060cc, 0x080060cc, 0x080060cc, 0x08006100, 0x08006100, 0x08006140,
660static u32 bnx2_COM_b06FwSbss[(0x1c/4) + 1] = { 0x0 }; 1049 0x0800614c, 0x0800614c, 0x080060cc, 0x00000000, 0x00000000 };
1050static const u32 bnx2_COM_b06FwBss[(0x88/4) + 1] = { 0x0 };
1051static const u32 bnx2_COM_b06FwSbss[(0x60/4) + 1] = { 0x0 };
661 1052
662static struct fw_info bnx2_com_fw_06 = { 1053static struct fw_info bnx2_com_fw_06 = {
663 .ver_major = 0x1, 1054 .ver_major = 0x3,
664 .ver_minor = 0x0, 1055 .ver_minor = 0x4,
665 .ver_fix = 0x0, 1056 .ver_fix = 0x3,
666 1057
667 .start_addr = 0x080008b4, 1058 .start_addr = 0x080000b4,
668 1059
669 .text_addr = 0x08000000, 1060 .text_addr = 0x08000000,
670 .text_len = 0x57bc, 1061 .text_len = 0x7d54,
671 .text_index = 0x0, 1062 .text_index = 0x0,
672 .gz_text = bnx2_COM_b06FwText, 1063 .gz_text = bnx2_COM_b06FwText,
673 .gz_text_len = sizeof(bnx2_COM_b06FwText), 1064 .gz_text_len = sizeof(bnx2_COM_b06FwText),
674 1065
675 .data_addr = 0x08005840, 1066 .data_addr = 0x08007e00,
676 .data_len = 0x0, 1067 .data_len = 0x0,
677 .data_index = 0x0, 1068 .data_index = 0x0,
678 .data = bnx2_COM_b06FwData, 1069 .data = bnx2_COM_b06FwData,
679 1070
680 .sbss_addr = 0x08005840, 1071 .sbss_addr = 0x08007e00,
681 .sbss_len = 0x1c, 1072 .sbss_len = 0x60,
682 .sbss_index = 0x0, 1073 .sbss_index = 0x0,
683 .sbss = bnx2_COM_b06FwSbss, 1074 .sbss = bnx2_COM_b06FwSbss,
684 1075
685 .bss_addr = 0x08005860, 1076 .bss_addr = 0x08007e60,
686 .bss_len = 0x88, 1077 .bss_len = 0x88,
687 .bss_index = 0x0, 1078 .bss_index = 0x0,
688 .bss = bnx2_COM_b06FwBss, 1079 .bss = bnx2_COM_b06FwBss,
689 1080
690 .rodata_addr = 0x080057c0, 1081 .rodata_addr = 0x08007d58,
691 .rodata_len = 0x58, 1082 .rodata_len = 0x88,
692 .rodata_index = 0x0, 1083 .rodata_index = 0x0,
693 .rodata = bnx2_COM_b06FwRodata, 1084 .rodata = bnx2_COM_b06FwRodata,
694}; 1085};
diff --git a/drivers/net/bnx2_fw2.h b/drivers/net/bnx2_fw2.h
index 680c769a3fc0..2c067531f031 100644
--- a/drivers/net/bnx2_fw2.h
+++ b/drivers/net/bnx2_fw2.h
@@ -1,13 +1,13 @@
1/* bnx2_fw2.h: Broadcom NX2 network driver. 1/* bnx2_fw2.h: Broadcom NX2 network driver.
2 * 2 *
3 * Copyright (c) 2006 Broadcom Corporation 3 * Copyright (c) 2004, 2005, 2006, 2007 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, except as noted below. 7 * the Free Software Foundation, except as noted below.
8 * 8 *
9 * This file contains firmware data derived from proprietary unpublished 9 * This file contains firmware data derived from proprietary unpublished
10 * source code, Copyright (c) 2006 Broadcom Corporation. 10 * source code, Copyright (c) 2004, 2005, 2006, 2007 Broadcom Corporation.
11 * 11 *
12 * Permission is hereby granted for the distribution of this firmware data 12 * Permission is hereby granted for the distribution of this firmware data
13 * in hexadecimal or equivalent format, provided this copyright notice is 13 * in hexadecimal or equivalent format, provided this copyright notice is
@@ -15,3289 +15,3260 @@
15 */ 15 */
16 16
17static u8 bnx2_COM_b09FwText[] = { 17static u8 bnx2_COM_b09FwText[] = {
18 0x1f, 0x8b, 0x08, 0x08, 0xac, 0xfb, 0x2f, 0x45, 0x00, 0x03, 0x74, 0x65, 18 0x1f,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 0xbf, 0x6d, 0x85, 0x98,
100 0x63, 0x06, 0xb5, 0xbb, 0x2b, 0x94, 0x37, 0xee, 0xcb, 0xa4, 0x75, 0x03, 100 0xfd, 0xb8, 0xff, 0x3b, 0x78, 0x67, 0x9d, 0xc8, 0x51, 0xfd, 0x1e, 0xd4,
101 0xc6, 0x9a, 0xb8, 0x66, 0x3c, 0x9a, 0x83, 0x74, 0x72, 0x2e, 0xd2, 0xc9, 101 0x57, 0xfc, 0xb8, 0xe4, 0x93, 0x95, 0x94, 0x2d, 0x5b, 0x54, 0xb0, 0xee,
102 0xeb, 0xde, 0x00, 0x9d, 0xfb, 0x6a, 0xf7, 0xb3, 0x81, 0xfb, 0x62, 0xe5, 102 0x78, 0xd8, 0x06, 0x7e, 0x2c, 0x01, 0x27, 0x33, 0x5a, 0x5f, 0x4a, 0xd3,
103 0xd7, 0x5b, 0x5c, 0xfa, 0xc8, 0xd7, 0x41, 0x99, 0x98, 0x7e, 0xc8, 0x5b, 103 0xeb, 0xdf, 0xce, 0xeb, 0x6a, 0xf4, 0x77, 0x06, 0xe5, 0xac, 0xe6, 0x67,
104 0x0b, 0xf7, 0x65, 0xae, 0xb1, 0x00, 0x3e, 0xa9, 0x91, 0x57, 0x58, 0xab, 104 0x7a, 0xcc, 0xca, 0x25, 0x65, 0x6b, 0x8d, 0xe5, 0x21, 0xeb, 0x4e, 0x9f,
105 0x18, 0x58, 0xeb, 0x70, 0x60, 0xad, 0xc3, 0x81, 0xb5, 0x8a, 0xe0, 0xad, 105 0xf2, 0x8c, 0x77, 0x9f, 0x74, 0x5e, 0x89, 0x7e, 0x36, 0x9e, 0x79, 0x43,
106 0xac, 0xd3, 0x81, 0x33, 0x79, 0xc2, 0xbc, 0x1c, 0xc5, 0x9c, 0x6f, 0x88, 106 0x6f, 0x94, 0x46, 0xce, 0x43, 0x1a, 0xf9, 0xfc, 0x66, 0x84, 0xc6, 0x27,
107 0x91, 0xa6, 0x2d, 0xf8, 0x36, 0xf9, 0x07, 0x18, 0x9f, 0x96, 0x73, 0x0e, 107 0x1b, 0xef, 0x47, 0x23, 0xef, 0x15, 0xff, 0x8f, 0x5a, 0x03, 0xda, 0x86,
108 0x78, 0x73, 0x3c, 0x24, 0x77, 0xa9, 0x71, 0xff, 0xb1, 0xc6, 0xa5, 0x31, 108 0xe4, 0x8d, 0x99, 0xaf, 0x98, 0x75, 0xf0, 0x7e, 0x8a, 0xf3, 0x7f, 0xab,
109 0xf8, 0x2c, 0x2c, 0xbb, 0xa2, 0xbc, 0xf7, 0x9f, 0x99, 0xe0, 0x37, 0xdb, 109 0x1e, 0xc8, 0x4b, 0xe5, 0x22, 0xeb, 0x2c, 0x44, 0xd6, 0xf9, 0x6e, 0x64,
110 0x93, 0x37, 0xb8, 0x6d, 0xde, 0x9f, 0xf5, 0xf6, 0xd2, 0xee, 0xbe, 0x57, 110 0x9d, 0xef, 0x46, 0xd6, 0xa9, 0x80, 0xa7, 0xb2, 0x51, 0x41, 0x86, 0x4b,
111 0x79, 0x53, 0x61, 0xc6, 0x62, 0x85, 0xb6, 0x2d, 0x29, 0xc3, 0x96, 0xfd, 111 0x34, 0x63, 0x72, 0x08, 0x73, 0xbe, 0x2e, 0xb1, 0x1c, 0xf5, 0x3c, 0xc4,
112 0x43, 0xa9, 0x4e, 0x99, 0xb4, 0xb4, 0xd4, 0x44, 0xb2, 0x99, 0xfc, 0xcf, 112 0x9b, 0x73, 0xe8, 0x9f, 0x93, 0xb3, 0x33, 0x15, 0x29, 0x1d, 0x89, 0xcb,
113 0xe8, 0x76, 0x2b, 0xec, 0x47, 0xe2, 0x3a, 0x71, 0x51, 0xed, 0xeb, 0x5b, 113 0x1d, 0xba, 0xdf, 0x26, 0x43, 0x5f, 0xb4, 0x2d, 0x21, 0x7b, 0x92, 0x7c,
114 0x1e, 0xfd, 0x16, 0xdb, 0x23, 0xba, 0xdd, 0xd1, 0xd0, 0x4f, 0xfd, 0xff, 114 0x0f, 0xdb, 0x6c, 0xf0, 0x99, 0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 0xa7, 0x1b, 0xf1, 0x83, 0xef, 0x11, 0x3f, 0x5c, 0xec, 122 0xf8, 0xe4, 0x52, 0xee, 0xe2, 0xa0, 0x35, 0x0b, 0x9d, 0x5b, 0x67, 0x68,
123 0x98, 0x98, 0x25, 0x8e, 0xd4, 0x71, 0xe3, 0xc8, 0xb4, 0x8f, 0x25, 0x9c, 123 0xb8, 0xc2, 0xd0, 0x00, 0x5a, 0xfb, 0x20, 0x59, 0x5a, 0x97, 0xb4, 0x68,
124 0x9b, 0x18, 0xe2, 0xe3, 0x07, 0xdf, 0x23, 0x7e, 0x18, 0x90, 0x15, 0xe7, 124 0x35, 0x95, 0xc9, 0xfb, 0xf0, 0x7d, 0x83, 0x6e, 0x0f, 0x74, 0x2e, 0x7c,
125 0xf4, 0xd7, 0x9f, 0x6a, 0x98, 0x7b, 0x4a, 0x61, 0x93, 0x8b, 0xcb, 0x6f, 125 0x86, 0xf8, 0xfe, 0x66, 0xc4, 0x5e, 0xf4, 0x40, 0x67, 0x93, 0xe0, 0x55,
126 0x06, 0x70, 0xbe, 0x0b, 0x18, 0x1d, 0x85, 0xfc, 0x7c, 0x8c, 0x26, 0x76, 126 0x88, 0xf5, 0xc4, 0xe0, 0x14, 0xec, 0x03, 0x64, 0x55, 0x63, 0x7b, 0x3b,
127 0xc6, 0x80, 0xeb, 0xe0, 0x91, 0xc2, 0xe4, 0x08, 0x70, 0xcc, 0xf4, 0x30, 127 0xf0, 0xd0, 0x36, 0xd8, 0x9c, 0x30, 0xd8, 0xdc, 0x0e, 0x5c, 0x66, 0xd9,
128 0x35, 0xec, 0x61, 0x6a, 0x04, 0x78, 0xca, 0xb6, 0xe5, 0xb5, 0xa3, 0x5e, 128 0x31, 0xe5, 0xa4, 0x29, 0xa7, 0x50, 0x86, 0x1d, 0x9f, 0x25, 0x2e, 0x5f,
129 0x3b, 0x86, 0x36, 0xfc, 0xef, 0x1c, 0x6d, 0xec, 0xb5, 0x43, 0xe3, 0xb3, 129 0x77, 0x70, 0xef, 0x51, 0x8d, 0xf7, 0xb4, 0x15, 0x40, 0x61, 0xe2, 0x35,
130 0x0a, 0xa7, 0x89, 0xf1, 0xc0, 0x0a, 0xe2, 0x2c, 0xf1, 0xb6, 0x4b, 0x16, 130 0x71, 0xbb, 0x47, 0xe6, 0x6b, 0x58, 0xaf, 0x81, 0x8d, 0xdc, 0x7b, 0x94,
131 0xca, 0x58, 0xaf, 0x86, 0x69, 0x94, 0x47, 0x90, 0x1e, 0xd2, 0xb2, 0x46, 131 0x1e, 0xd2, 0xb2, 0x5e, 0x14, 0x6c, 0x57, 0x3e, 0x49, 0x7a, 0x1f, 0xc4,
132 0xf4, 0xc7, 0xdc, 0xfd, 0xe8, 0xe9, 0xcf, 0xeb, 0xd2, 0xc2, 0x7d, 0x90, 132 0xde, 0x89, 0x3f, 0xa4, 0xfb, 0x2a, 0xd0, 0xca, 0x7d, 0xfc, 0x3c, 0x69,
133 0xee, 0x1b, 0x41, 0x2b, 0xf7, 0xf6, 0xa3, 0xa4, 0x95, 0xeb, 0x35, 0xd2, 133 0xe5, 0x7a, 0xcd, 0xf4, 0x7e, 0x58, 0x1c, 0x24, 0xed, 0x27, 0xb1, 0xe7,
134 0x7b, 0x1a, 0xf4, 0x66, 0x80, 0xb7, 0xa2, 0x8d, 0xf6, 0x8e, 0x82, 0xde, 134 0x3c, 0x30, 0x4f, 0xac, 0xd1, 0xbe, 0x51, 0xec, 0x79, 0x04, 0x78, 0x78,
135 0x11, 0x60, 0xf1, 0x30, 0xb0, 0x78, 0x27, 0xb0, 0x78, 0x08, 0x58, 0x9c, 135 0x3b, 0xf0, 0x70, 0x37, 0xf0, 0x70, 0x18, 0x78, 0x98, 0x03, 0x16, 0x0e,
136 0x06, 0x0e, 0x0f, 0x02, 0x87, 0x07, 0x80, 0xc3, 0x29, 0xec, 0x2b, 0x2a, 136 0x01, 0x0b, 0x07, 0x81, 0x85, 0x59, 0xf0, 0x26, 0x29, 0x73, 0xc0, 0xc6,
137 0xf3, 0xc0, 0xe5, 0x79, 0xe0, 0xf3, 0x3c, 0xe4, 0x35, 0x31, 0x27, 0xda, 137 0x39, 0x60, 0xe4, 0x1c, 0xe6, 0x18, 0x9f, 0x15, 0xeb, 0x4b, 0xd8, 0xc3,
138 0x17, 0xb0, 0xfe, 0x63, 0x33, 0x89, 0xd3, 0xd0, 0xcd, 0x58, 0x51, 0x87, 138 0x63, 0x33, 0x99, 0x93, 0x90, 0xa5, 0x54, 0x45, 0x41, 0xfe, 0xb3, 0x43,
139 0x3d, 0xa5, 0x06, 0xa1, 0x23, 0x49, 0x29, 0x55, 0x46, 0xa5, 0x40, 0x3f, 139 0x90, 0xed, 0x7e, 0xa9, 0xfa, 0xb6, 0x94, 0x69, 0x53, 0xb7, 0xf7, 0x42,
140 0xb6, 0xb9, 0x07, 0xb6, 0x0b, 0xfb, 0x89, 0xf9, 0x71, 0xd3, 0x5a, 0xef, 140 0xd7, 0x20, 0xef, 0x29, 0x31, 0x7f, 0x1b, 0xcc, 0xf3, 0x1f, 0x45, 0xdc,
141 0xfa, 0xf7, 0x22, 0xf6, 0x1f, 0x83, 0x27, 0x89, 0xb8, 0xc8, 0xb0, 0xe4, 141 0xbf, 0xa3, 0x2c, 0xa6, 0x45, 0xce, 0x48, 0xc9, 0xeb, 0x75, 0x0a, 0xaa,
142 0x9d, 0x1e, 0x2b, 0xab, 0x27, 0x31, 0x8e, 0xed, 0xb8, 0xb6, 0xf7, 0x78, 142 0x1f, 0xfd, 0x58, 0xce, 0xaa, 0xfb, 0x8f, 0x5c, 0xaf, 0xf6, 0x1e, 0x21,
143 0x42, 0x1b, 0x3f, 0xce, 0x3d, 0x4d, 0x03, 0xe3, 0xaa, 0x32, 0x95, 0xa2, 143 0x5f, 0xa6, 0x81, 0x57, 0x75, 0x99, 0xcc, 0x52, 0xb7, 0xea, 0x72, 0x22,
144 0xad, 0x56, 0xe5, 0x54, 0x2a, 0x31, 0x58, 0x94, 0x56, 0x39, 0x12, 0x9d, 144 0x9b, 0x19, 0xaa, 0x48, 0x9b, 0x4c, 0x25, 0xa7, 0xb5, 0xad, 0xb5, 0x73,
145 0x56, 0xfe, 0xcd, 0x4c, 0x1f, 0x53, 0xfa, 0x51, 0xb0, 0x71, 0x2d, 0x77, 145 0x87, 0xb5, 0xbd, 0x2a, 0xbb, 0x78, 0xd6, 0x06, 0x54, 0xe9, 0x08, 0xf7,
146 0x6b, 0xf9, 0xe3, 0xf4, 0x3b, 0x3d, 0xf8, 0x85, 0x40, 0x0b, 0xe7, 0x37, 146 0xdf, 0x8b, 0x5f, 0x1c, 0xb4, 0x70, 0x7e, 0x5b, 0x86, 0x07, 0x1d, 0xf5,
147 0x65, 0x68, 0x40, 0xb4, 0x7d, 0xbd, 0x45, 0xa0, 0x62, 0xc2, 0x3a, 0x87, 147 0x40, 0x5f, 0x05, 0x08, 0x96, 0x71, 0xce, 0x62, 0xe5, 0xe2, 0x74, 0x6f,
148 0x95, 0x73, 0xd3, 0x3d, 0xb1, 0x9c, 0x6e, 0xca, 0x98, 0xa9, 0xc9, 0x04, 148 0xaa, 0xa8, 0x6c, 0x19, 0xb3, 0x2d, 0x19, 0x87, 0x7c, 0x0f, 0x67, 0xdf,
149 0xec, 0x65, 0x28, 0xf5, 0x7f, 0xd5, 0x23, 0x51, 0x3e, 0x6f, 0x96, 0xdf, 149 0xa9, 0x4f, 0x25, 0xd9, 0xbe, 0x4e, 0xbe, 0xae, 0x7d, 0x0e, 0xac, 0x5d,
150 0x51, 0x38, 0x8b, 0xb5, 0x4b, 0xb3, 0x58, 0x37, 0x04, 0xfe, 0x71, 0x5d, 150 0x3d, 0x8a, 0x75, 0xe3, 0x38, 0x03, 0xae, 0xcb, 0x79, 0x50, 0xae, 0xd9,
151 0xce, 0x83, 0x36, 0x30, 0xcf, 0xb4, 0x13, 0xa7, 0x8b, 0xb2, 0x1d, 0x76, 151 0x28, 0x67, 0x4e, 0x56, 0xc4, 0x87, 0x9e, 0x6c, 0x94, 0xc2, 0xce, 0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x58, 0x98, 0x8e, 0xaa, 0x67, 0x47, 0x1c, 0x37, 0x36, 174 0xdd, 0x36, 0xe5, 0x05, 0x7e, 0x9a, 0x82, 0x2f, 0x37, 0x07, 0x5f, 0xae,
175 0xd2, 0x11, 0x3f, 0xcd, 0x23, 0x7e, 0xca, 0x29, 0x1b, 0xb1, 0x32, 0x88, 175 0xa8, 0xf5, 0xcc, 0xc9, 0xc3, 0xd7, 0x87, 0x9e, 0x04, 0x3a, 0x56, 0xad,
176 0xaf, 0xe1, 0x67, 0x5d, 0xfb, 0x28, 0x95, 0x49, 0xcb, 0x3d, 0xa0, 0x2f, 176 0x91, 0x96, 0xbb, 0x40, 0x5f, 0xa6, 0x02, 0x62, 0x0e, 0xab, 0x1c, 0xce,
177 0x51, 0x04, 0x31, 0xc7, 0x74, 0xb8, 0xeb, 0xec, 0x80, 0x14, 0x19, 0x63, 177 0x7d, 0x50, 0x2a, 0xf4, 0xf7, 0xce, 0xc6, 0x9e, 0x92, 0xb1, 0x2a, 0xed,
178 0x9d, 0x33, 0x1e, 0x91, 0xb1, 0x12, 0xfd, 0x1b, 0x7e, 0x8e, 0x6d, 0x31, 178 0x11, 0x7e, 0x9e, 0xeb, 0x30, 0xbe, 0xc8, 0x6b, 0x5b, 0xd1, 0x0d, 0x39,
179 0xa6, 0xcf, 0x28, 0xdf, 0xd3, 0x03, 0x3d, 0x80, 0x5f, 0x4a, 0xb5, 0x8b, 179 0x80, 0x1d, 0xc9, 0x6e, 0x32, 0x7e, 0xce, 0x13, 0x38, 0xcf, 0x33, 0x38,
180 0xeb, 0x07, 0xf7, 0x40, 0x9e, 0xc3, 0x90, 0x7b, 0x5a, 0xc6, 0x4f, 0x8c, 180 0xf7, 0x9a, 0xec, 0x3d, 0xf6, 0x0a, 0x65, 0xba, 0xbf, 0x2a, 0x99, 0xfe,
181 0x53, 0xa7, 0x93, 0x25, 0x49, 0x24, 0x8f, 0xc8, 0x16, 0x6b, 0x01, 0xbe, 181 0x29, 0xd9,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0xef,
189 0xd5, 0xc9, 0x11, 0xb4, 0x69, 0x7f, 0x07, 0x25, 0xe7, 0x24, 0xb0, 0x4f, 189 0x80, 0x14, 0xbd, 0x0c, 0xf6, 0x09, 0x1d, 0xf3, 0x3b, 0xac, 0x60, 0x8f,
190 0xf0, 0xb6, 0x32, 0xe1, 0xed, 0x11, 0xfc, 0x1f, 0x39, 0x0c, 0x3e, 0x48, 190 0xe0, 0xff, 0xc8, 0x39, 0xf0, 0x41, 0x2a, 0x01, 0x6f, 0xc8, 0x17, 0xf2,
191 0xd1, 0xe5, 0x0d, 0xf9, 0x42, 0x9e, 0xfc, 0x16, 0x74, 0xff, 0x61, 0x8c, 191 0xa4, 0x03, 0xb2, 0x0f, 0xb9, 0x87, 0xdc, 0x96, 0x34, 0x0f, 0xfe, 0xbd,
192 0x81, 0x7f, 0x50, 0x3c, 0x58, 0xea, 0x70, 0x63, 0xd1, 0x44, 0x31, 0xc3, 192 0x33, 0xf0, 0x8b, 0x33, 0x95, 0x3c, 0xe3, 0xb9, 0x4e, 0xe2, 0x26, 0x30,
193 0xfc, 0xa9, 0x83, 0x98, 0x07, 0xfc, 0xa9, 0x40, 0xb1, 0x30, 0xf7, 0x92, 193 0xcc, 0x87, 0x70, 0x60, 0xee, 0x25, 0xb5, 0x9e, 0xf4, 0xa6, 0x97, 0x62,
194 0xbe, 0x86, 0xf4, 0xc6, 0x97, 0x0c, 0x83, 0xed, 0xe4, 0x12, 0x74, 0xb8, 194 0x7d, 0x2c, 0xf7, 0x2f, 0x41, 0x86, 0xab, 0x38, 0x9f, 0xc2, 0xce, 0x5e,
195 0x04, 0xf9, 0x64, 0xfb, 0x68, 0xb3, 0x36, 0xe4, 0x31, 0x63, 0x50, 0x5f, 195 0x83, 0x5b, 0xcf, 0xc6, 0x28, 0xaf, 0x55, 0x60, 0x4c, 0xc9, 0xdb, 0xe1,
196 0x4b, 0x88, 0x05, 0xf3, 0xce, 0x16, 0xeb, 0x5e, 0xf2, 0xcd, 0x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6d, 0x15, 0x21, 0x27, 0x55, 0x8f,
204 0x51, 0xcb, 0x41, 0x4f, 0x4a, 0x0e, 0x73, 0x06, 0xda, 0x8f, 0x85, 0xb5, 204 0xf1, 0x0b, 0xf5, 0xc7, 0xc1, 0xda, 0x99, 0xd4, 0x5b, 0xaa, 0x37, 0x3d,
205 0x13, 0xb1, 0xb7, 0xf5, 0x9e, 0xf8, 0x02, 0xb0, 0x60, 0x2f, 0x6c, 0x3a, 205 0x0f, 0x2c, 0xb8, 0x1f, 0x3a, 0x5d, 0xb4, 0x17, 0xa4, 0xec, 0xd7, 0xa4,
206 0x67, 0xee, 0x94, 0x02, 0xb0, 0x35, 0x7f, 0x62, 0x0b, 0xec, 0x2d, 0x1e, 206 0x74, 0x6c, 0x07, 0xf4, 0x2d, 0x1d, 0xa1, 0x8b, 0x78, 0x56, 0xa1, 0x1f,
207 0xa0, 0x8b, 0x78, 0x56, 0xa4, 0x4f, 0xd5, 0x76, 0x38, 0x52, 0x6c, 0x4a, 207 0x6e, 0xed, 0xf2, 0xa4, 0xd2, 0x92, 0x23, 0xae, 0x6d, 0x83, 0xec, 0xa0,
208 0x13, 0xd7, 0x36, 0x41, 0x77, 0xd0, 0x57, 0xae, 0xeb, 0xdf, 0x1d, 0x2b, 208 0xae, 0xb6, 0x2c, 0x7f, 0xb7, 0xad, 0xa2, 0x15, 0xb1, 0xee, 0xe0, 0x4a,
209 0x68, 0x45, 0x7e, 0x39, 0xb0, 0x9c, 0xde, 0x92, 0x5c, 0x99, 0xde, 0x1d, 209 0x7a, 0xab, 0x72, 0x71, 0x7a, 0x77, 0x35, 0xe8, 0x25, 0x66, 0x00, 0xff,
210 0x35, 0x7a, 0x89, 0x19, 0xc0, 0x7f, 0xd8, 0xcd, 0x4b, 0xd0, 0xdf, 0xe7, 210 0x3d, 0xe0, 0xbf, 0x07, 0xfc, 0xf7, 0x80, 0xff, 0x1e, 0xf0, 0xdf, 0x83,
211 0x1d, 0xe0, 0xbf, 0x03, 0x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, 0x9c, 0xa4, 0x5f, 0x12, 0xc1, 0xaa, 0x9b, 0x62, 0xe2,
241 0xe1, 0x34, 0xe3, 0x92, 0x00, 0x56, 0x6d, 0x35, 0xe0, 0x32, 0x8b, 0xcb, 241 0x2e, 0x63, 0x66, 0xb0, 0xaf, 0x2d, 0xf4, 0xfb, 0x2f, 0x61, 0xaf, 0x6b,
242 0xf7, 0xb5, 0x81, 0x79, 0xc4, 0x55, 0xec, 0x75, 0x75, 0x2c, 0xea, 0xd1, 242 0x63, 0x51, 0xaf, 0xba, 0xb8, 0x6e, 0xef, 0x69, 0xe8, 0x76, 0x28, 0x7b,
243 0xaf, 0x6c, 0xdb, 0xbb, 0x6a, 0xb6, 0xed, 0xeb, 0xde, 0x6a, 0x39, 0xf8, 243 0x6b, 0xe5, 0x03, 0x5e, 0xd5, 0x67, 0xf1, 0xac, 0x9f, 0x39, 0x5c, 0x81,
244 0xf7, 0x95, 0x2c, 0x9e, 0xaa, 0x24, 0x8e, 0x15, 0x61, 0x4b, 0x8b, 0x2a, 244 0x2e, 0x2d, 0xea, 0xd8, 0x37, 0x3c, 0x17, 0xfa, 0x38, 0x99, 0xe3, 0x73,
245 0xef, 0xf6, 0xe5, 0xc2, 0x18, 0x27, 0x71, 0x72, 0x1e, 0x6f, 0x8e, 0xab, 245 0x90, 0xed, 0xbd, 0x3a, 0x26, 0x60, 0x3c, 0x50, 0x97, 0x5d, 0xd9, 0x4f,
246 0x1c, 0x83, 0xf9, 0x45, 0x55, 0x76, 0xa4, 0x5a, 0xa3, 0xe4, 0x43, 0x46, 246 0x25, 0xc9, 0x87, 0xbc, 0xfa, 0x71, 0x9c, 0x3e, 0xc3, 0xa2, 0x47, 0x9e,
247 0xff, 0x76, 0x88, 0x31, 0xc3, 0xa2, 0x43, 0x9e, 0xa5, 0xf0, 0x3c, 0x05, 247 0x65, 0xd1, 0x9e, 0x05, 0x26, 0xfc, 0xab, 0x14, 0x93, 0xac, 0x7b, 0xab,
248 0x4c, 0xf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, 0xad, 0xe0, 0x56, 0xa0, 0x1f, 0x41,
300 0xb7, 0x16, 0x39, 0x3e, 0x1d, 0x46, 0x14, 0xca, 0xbf, 0x0e, 0x59, 0x18, 300 0xce, 0x70, 0xef, 0x74, 0x02, 0x96, 0x80, 0x7f, 0x9d, 0x32, 0x3f, 0xf4,
301 0xfc, 0x1b, 0xc8, 0x70, 0xcb, 0x69, 0x16, 0xb0, 0x74, 0xe0, 0xf0, 0x42, 301 0x16, 0xce, 0x70, 0xc7, 0x49, 0x26, 0x9c, 0x14, 0x70, 0x78, 0x3e, 0xd9,
302 0x34, 0xa2, 0xea, 0x33, 0xd7, 0xd9, 0xec, 0xb7, 0x20, 0xd3, 0x51, 0x59, 302 0xae, 0xf3, 0xc5, 0x9f, 0x70, 0x59, 0xef, 0xe0, 0x4c, 0x47, 0x65, 0x1e,
303 0x40, 0xfc, 0x50, 0x1a, 0x04, 0x8d, 0x7d, 0x9d, 0x18, 0x4f, 0xbb, 0x23, 303 0xfe, 0x43, 0x75, 0x08, 0x34, 0xee, 0xec, 0x42, 0x7f, 0xea, 0x1d, 0x79,
304 0xcf, 0x47, 0xe1, 0x7b, 0xc9, 0xd3, 0x28, 0xc6, 0xef, 0xc2, 0x98, 0x0e, 304 0x3e, 0x0a, 0xdb, 0x4b, 0x9e, 0x26, 0xd1, 0x7f, 0x0f, 0xfa, 0x74, 0xe2,
305 0x5c, 0xbf, 0x68, 0x2c, 0x58, 0xcc, 0x9d, 0x7f, 0x0e, 0x6d, 0xce, 0x11, 305 0x79, 0x5f, 0x6c, 0xde, 0x61, 0xec, 0xfc, 0x79, 0x94, 0x39, 0x47, 0xd4,
306 0xf4, 0x9d, 0x9f, 0x0e, 0x89, 0x9a, 0x93, 0xef, 0x74, 0x2a, 0xfb, 0xaf, 306 0x76, 0x7e, 0x2e, 0x2e, 0x7a, 0x4e, 0x8e, 0xe9, 0xd2, 0xfa, 0xbf, 0xbc,
307 0xaf, 0xc5, 0x75, 0xf8, 0xec, 0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 0x33, 0x9e, 0xf5, 0x6c, 0xff, 0xf3, 0xfa, 0x9f, 0x6a, 0xbe,
315 0x2b, 0xbe, 0xad, 0x07, 0xed, 0xaa, 0xee, 0x22, 0xf3, 0x1d, 0x26, 0xe4, 315 0x6d, 0x06, 0xed, 0x3a, 0xef, 0x22, 0x73, 0x9d, 0x36, 0xce, 0x93, 0xf1,
316 0xc9, 0xfc, 0x58, 0x93, 0x9b, 0x6c, 0x5d, 0xeb, 0xe9, 0xa7, 0xec, 0xd7, 316 0xb1, 0x25, 0x57, 0xbb, 0xca, 0xea, 0x1d, 0xe0, 0xd9, 0x6f, 0x34, 0x58,
317 0x79, 0x58, 0xda, 0xa2, 0x65, 0x8f, 0xb3, 0x5e, 0xd0, 0xea, 0xe5, 0x7c, 317 0xda, 0x6a, 0x15, 0x8e, 0x30, 0x5f, 0xd0, 0x66, 0x62, 0x3e, 0xc4, 0x1e,
318 0xc8, 0x3d, 0x94, 0x8f, 0x31, 0xbd, 0xe7, 0xf4, 0x31, 0x8c, 0x5b, 0xe8, 318 0xda, 0xc6, 0xd8, 0xa6, 0x9d, 0x36, 0x86, 0x7e, 0x0b, 0xed, 0xe7, 0x69,
319 0x3f, 0x33, 0xde, 0x3d, 0xae, 0xd0, 0xe1, 0x7d, 0xa5, 0x0e, 0x39, 0xaf, 319 0xf3, 0x8e, 0x27, 0x64, 0xf8, 0x81, 0x6a, 0xa7, 0xbc, 0xa8, 0x79, 0xea,
320 0x78, 0x6a, 0xc9, 0xb9, 0x1a, 0x4f, 0x43, 0xde, 0xb7, 0x90, 0x83, 0xde, 320 0xc8, 0xd9, 0x06, 0x4f, 0xe3, 0xe6, 0xbb, 0xcc, 0x01, 0xf3, 0xcd, 0xa3,
321 0x77, 0x06, 0x03, 0x71, 0x11, 0xee, 0xcb, 0x19, 0xd0, 0x10, 0x97, 0x9e, 321 0x0f, 0x7e, 0x11, 0xde, 0x6b, 0x79, 0xd0, 0x90, 0x96, 0xde, 0x01, 0xc6,
322 0x7e, 0xe6, 0x6e, 0x45, 0x5c, 0x59, 0xa7, 0xd0, 0x70, 0x75, 0xeb, 0x17, 322 0x6e, 0x15, 0x3c, 0x99, 0xa7, 0xb0, 0xf0, 0x0c, 0xf2, 0x17, 0xbd, 0x03,
323 0x3d, 0xfd, 0xf0, 0x4b, 0xc0, 0xa1, 0x9e, 0xfe, 0xef, 0xa8, 0x7c, 0xae, 323 0xb0, 0x4b, 0xc0, 0xa1, 0xde, 0x81, 0x73, 0x3a, 0x9e, 0xab, 0xfa, 0x8e,
324 0x54, 0xb1, 0xb4, 0x3b, 0x1c, 0xb7, 0x46, 0x74, 0xce, 0xbe, 0x5c, 0x8d, 324 0x75, 0x9b, 0x17, 0xe4, 0x88, 0xce, 0xba, 0x17, 0xca, 0x11, 0xdd, 0xb3,
325 0x68, 0xa0, 0x99, 0x75, 0x0d, 0xbf, 0x46, 0x74, 0x4e, 0x54, 0x8d, 0xe8, 325 0x8e, 0x79, 0x8d, 0x30, 0x47, 0x74, 0x56, 0x74, 0x8e, 0xe8, 0xf8, 0x45,
326 0xe4, 0x15, 0x6a, 0x44, 0x99, 0xab, 0xaf, 0x11, 0x71, 0x7e, 0x53, 0xee, 326 0x72, 0x44, 0xf9, 0x4b, 0xcf, 0x11, 0x71, 0x7e, 0x5b, 0xee, 0x1c, 0x74,
327 0x1e, 0x10, 0xed, 0x4b, 0x5e, 0x8d, 0xe8, 0x82, 0xb8, 0x35, 0xa2, 0xf3, 327 0xd4, 0xaf, 0x9a, 0x1c, 0xd1, 0x1b, 0x12, 0xe4, 0x88, 0x5e, 0x94, 0xb5,
328 0xb2, 0x7a, 0x8d, 0xe8, 0x68, 0x43, 0x8d, 0x68, 0xbd, 0xaa, 0x11, 0x71, 328 0x73, 0x44, 0x87, 0x9a, 0x72, 0x44, 0x9b, 0x75, 0x8e, 0x88, 0xf3, 0x04,
329 0x1e, 0xb7, 0x46, 0xc4, 0x76, 0xbe, 0x7f, 0x30, 0x50, 0xeb, 0x00, 0x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xf0, 0x7c, 0x97, 0x6d,
337 0x75, 0x9f, 0x92, 0xd5, 0x3f, 0xba, 0x1a, 0xca, 0x3e, 0x55, 0x43, 0xf9, 337 0x4a, 0x41, 0x7d, 0x7c, 0x39, 0x94, 0x07, 0x74, 0x0e, 0xe5, 0xc5, 0x75,
338 0x5a, 0x73, 0xb0, 0x86, 0x72, 0x4e, 0x2e, 0x5f, 0x43, 0xd9, 0xb7, 0x4a, 338 0xd1, 0x1c, 0xca, 0x59, 0xb9, 0x70, 0x0e, 0xe5, 0x81, 0x35, 0x72, 0x28,
339 0x0d, 0xe5, 0x15, 0xa9, 0xd7, 0x50, 0x5e, 0x11, 0xbf, 0x86, 0x62, 0xc8, 339 0x2f, 0xcb, 0x72, 0x0e, 0xe5, 0x65, 0x09, 0x73, 0x28, 0x31, 0x59, 0xda,
340 0xd2, 0x7a, 0xce, 0xb3, 0x1f, 0xef, 0x8c, 0xe0, 0x37, 0x8c, 0x9f, 0x5b, 340 0x1c, 0x48, 0xe3, 0x03, 0xfe, 0x12, 0x7e, 0x67, 0xf0, 0x0b, 0x72, 0x2a,
341 0x53, 0x39, 0x57, 0xa3, 0x7f, 0xb5, 0x9a, 0xca, 0x37, 0x9b, 0xdf, 0x4f, 341 0x67, 0x1b, 0xf4, 0xaf, 0x95, 0x53, 0x79, 0x7d, 0xdd, 0x07, 0xc9, 0xa9,
342 0x4d, 0xc5, 0xf5, 0x01, 0x7e, 0x4d, 0xa5, 0x05, 0xf1, 0x0e, 0x7c, 0x8e, 342 0x04, 0x36, 0x20, 0xcc, 0xa9, 0xe0, 0xe7, 0xc0, 0xe6, 0xa8, 0x68, 0x4e,
343 0x1e, 0xac, 0xa9, 0xfc, 0x2d, 0xed, 0x01, 0x7d, 0x2a, 0x46, 0x40, 0x3f, 343 0xe5, 0x27, 0xd4, 0x07, 0xd4, 0xb1, 0xcc, 0x7a, 0xe8, 0x05, 0xec, 0x52,
344 0xec, 0x02, 0x7e, 0x29, 0xa3, 0x6a, 0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xdc, 0x2b, 0x6d, 0xdd, 0x22, 0xe8, 0x43, 0x5d, 0x95, 0x31,
352 0x98, 0x03, 0xd2, 0xef, 0xf9, 0x39, 0x5a, 0x44, 0xe5, 0x68, 0x9d, 0x8a, 352 0x20, 0xed, 0x5e, 0x18, 0xa3, 0xb5, 0xeb, 0x18, 0xad, 0x4b, 0xf3, 0x83,
353 0x1f, 0xe4, 0xf5, 0x8d, 0x61, 0x62, 0x65, 0xa7, 0xcd, 0x3d, 0x0c, 0x7b, 353 0xbc, 0xbe, 0x35, 0x41, 0xac, 0xec, 0x72, 0xb9, 0x87, 0x33, 0x06, 0xeb,
354 0x58, 0xc7, 0xb6, 0x9b, 0x0b, 0x66, 0x74, 0xde, 0x3f, 0x02, 0xb9, 0xb2, 354 0x58, 0x0e, 0x62, 0xc1, 0xbc, 0xe2, 0xfb, 0xef, 0xe1, 0x5c, 0x99, 0xa7,
355 0x4e, 0xe3, 0xcb, 0xef, 0x21, 0x6f, 0xdf, 0x83, 0x52, 0xec, 0x94, 0xf0, 355 0x09, 0xcf, 0xef, 0x2b, 0x66, 0xdf, 0x43, 0x52, 0xe9, 0x92, 0xc4, 0x66,
356 0x7a, 0xd0, 0x93, 0x9f, 0x61, 0xdc, 0xfd, 0x09, 0x95, 0x83, 0x44, 0xed, 356 0xd0, 0x53, 0x9a, 0xa1, 0xdf, 0xfd, 0x69, 0x1d, 0x83, 0x24, 0xdd, 0xf3,
357 0x4b, 0xdb, 0xed, 0x5d, 0xd7, 0x60, 0xb7, 0x23, 0x97, 0xb5, 0xdb, 0xcf, 357 0xeb, 0xed, 0x1d, 0x97, 0xa1, 0xb7, 0x23, 0x17, 0xd4, 0xdb, 0xaf, 0x25,
358 0x85, 0x83, 0x76, 0x7b, 0xd7, 0x35, 0xd8, 0xed, 0xfe, 0x6b, 0xb2, 0x5b, 358 0xa2, 0x7a, 0x7b, 0xc7, 0x65, 0xe8, 0xed, 0xbe, 0xcb, 0xd2, 0x5b, 0xee,
359 0xee,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72, 0x93, 0xe9, 0xd7, 0xad,
374 0x7a, 0xd4, 0xf7, 0xcf, 0x6c, 0xea, 0x56, 0xef, 0xbb, 0x13, 0xfd, 0x4f, 374 0xbf, 0x57, 0x16, 0xb2, 0x37, 0x98, 0x6f, 0x57, 0xb4, 0x3f, 0x19, 0xda,
375 0x82, 0x3e, 0x7b, 0x99, 0x9c, 0x79, 0x46, 0x21, 0xa7, 0xf2, 0x19, 0xbe, 375 0xec, 0x15, 0xe7, 0xcc, 0xfb, 0x12, 0x45, 0x1d, 0xcf, 0x70, 0xbc, 0x96,
376 0xaf, 0x74, 0x12, 0x39, 0x88, 0x19, 0xa8, 0xa5, 0x87, 0xbd, 0xdc, 0x8d, 376 0x49, 0xc4, 0x20, 0x76, 0x24, 0x97, 0x9e, 0x30, 0xb1, 0x1b, 0x75, 0xac,
377 0x36, 0x16, 0x81, 0x0c, 0xb7, 0x7b, 0xb9, 0x0a, 0xf3, 0xd7, 0xe5, 0x67, 377 0x1d, 0x67, 0xe8, 0x9b, 0x58, 0x85, 0xf1, 0xeb, 0xca, 0x7b, 0x12, 0x6b,
378 0x13, 0x56, 0xd7, 0x81, 0x0d, 0xef, 0x43, 0x07, 0x1a, 0xe5, 0x17, 0x86, 378 0xcb, 0xc0, 0x96, 0x0f, 0x20, 0x03, 0xcd, 0xe7, 0x97, 0x80, 0xee, 0x87,
379 0xed, 0xfb, 0xf2, 0xf3, 0xe3, 0x98, 0x79, 0x6f, 0xdf, 0x3d, 0xae, 0x0c, 379 0xe7, 0x17, 0xfa, 0x31, 0x73, 0x66, 0xdf, 0xdd, 0xc1, 0x19, 0xfe, 0xbf,
380 0x7f, 0x2c, 0xf6, 0xa9, 0x05, 0xf6, 0xe9, 0xe3, 0xd1, 0x3e, 0x6f, 0x9f, 380 0xd8, 0xa7, 0x15, 0xd9, 0x67, 0x88, 0x47, 0x0f, 0x98, 0x7d, 0xde, 0xd4,
381 0x5b, 0x1b, 0xf0, 0x68, 0xa4, 0xc1, 0x66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0xab, 0xfd, 0x28, 0x19, 0x4e, 0x94, 0x9f, 484 0xc6, 0x5f, 0x91, 0xfb, 0xd1, 0x67, 0x38, 0x5e, 0xfb, 0x1e, 0xec, 0xdb,
485 0x04, 0x2f, 0x5e, 0x51, 0xfe, 0xed, 0x88, 0x23, 0x37, 0x19, 0x42, 0x79, 485 0x39, 0x8b, 0xf6, 0x6d, 0xca, 0x93, 0xab, 0x63, 0xc2, 0xf3, 0x10, 0x0b,
486 0x88, 0x06, 0x1e, 0xa8, 0x33, 0x1c, 0xee, 0xf7, 0xfd, 0x2e, 0x25, 0x57, 486 0x3c, 0xd0, 0x77, 0x38, 0x82, 0xef, 0xfb, 0x3d, 0xfa, 0x5c, 0x03, 0xac,
487 0x17, 0x2b, 0x76, 0x06, 0xce, 0x60, 0xd4, 0x65, 0xeb, 0x9e, 0xcd, 0x70, 487 0x58, 0x88, 0xdc, 0xc1, 0x58, 0x3e, 0xdb, 0xe0, 0x6e, 0x46, 0x70, 0x16,
488 0x65, 0xe1, 0x9e, 0x1f, 0x21, 0x3f, 0x97, 0x0e, 0xed, 0xb2, 0xdd, 0xf3, 488 0xc1, 0xfd, 0x11, 0xed, 0x6f, 0x1e, 0xdc, 0xe3, 0x06, 0xf7, 0x47, 0x7a,
489 0x23, 0x3d, 0x73, 0xec, 0xeb, 0x6c, 0xf0, 0x7d, 0x61, 0xe8, 0x00, 0xcf, 489 0x67, 0x59, 0xd7, 0xd5, 0x64, 0xfb, 0x12, 0x90, 0x01, 0xde, 0x3b, 0xe2,
490 0x1d, 0xf1, 0xcc, 0x37, 0x69, 0x56, 0xb5, 0x8e, 0x55, 0xbf, 0x6d, 0x5f, 490 0xbd, 0x71, 0xd2, 0xac, 0x73, 0x1d, 0xff, 0x47, 0xdd, 0xd5, 0xc7, 0xb6,
491 0x5b, 0xcd, 0xd5, 0x5d, 0xb3, 0x5b, 0xad, 0x79, 0x9d, 0x87, 0x59, 0xfe, 491 0x75, 0x5d, 0xf7, 0xc3, 0x47, 0xea, 0xc3, 0xb4, 0x2c, 0x53, 0x32, 0x25,
492 0x59, 0xef, 0x94, 0xf6, 0xff, 0xd4, 0x5d, 0x7b, 0x6c, 0x1b, 0xf7, 0x7d, 492 0xd3, 0x96, 0x2c, 0xbf, 0x27, 0x3d, 0x59, 0x72, 0xac, 0x14, 0xac, 0xab,
493 0xff, 0xf2, 0x48, 0x3d, 0xac, 0xe7, 0x49, 0xa6, 0x64, 0x5a, 0x52, 0x94, 493 0xad, 0x02, 0x46, 0xa4, 0x0c, 0x49, 0x7f, 0xb4, 0x08, 0x06, 0xfa, 0xa3,
494 0x3b, 0xe9, 0x64, 0x29, 0xb1, 0x12, 0x70, 0x9e, 0xba, 0x0a, 0x88, 0x9a, 494 0x99, 0x8b, 0x66, 0xab, 0x4b, 0xd9, 0x4e, 0x0a, 0xf4, 0x0f, 0xb7, 0xc5,
495 0xb0, 0x24, 0xfd, 0x58, 0x10, 0x0c, 0xb4, 0xad, 0x64, 0xee, 0x92, 0xad, 495 0x80, 0x6c, 0x58, 0x60, 0x86, 0xb4, 0x12, 0x63, 0x56, 0x4c, 0xd6, 0x66,
496 0x0e, 0x25, 0xa7, 0x1d, 0x30, 0x60, 0x6e, 0xd6, 0x02, 0x69, 0x07, 0xc7, 496 0x85, 0x0c, 0xd8, 0x30, 0x4e, 0x54, 0x9c, 0x14, 0x50, 0xc6, 0x04, 0x69,
497 0x0c, 0x65, 0x27, 0xc6, 0xaa, 0x88, 0x4c, 0xcc, 0x6a, 0x1d, 0xb0, 0x62, 497 0x83, 0xa2, 0x58, 0x61, 0x45, 0x76, 0x36, 0x6c, 0x7f, 0x65, 0x43, 0xd0,
498 0x1c, 0xa5, 0x38, 0x69, 0xa7, 0x80, 0x69, 0xda, 0x04, 0xc5, 0xfe, 0xb1, 498 0x05, 0x9b, 0xb3, 0x38, 0x76, 0xb0, 0x06, 0x45, 0xd6, 0x7d, 0x62, 0x18,
499 0x26, 0x3b, 0x7b, 0x61, 0x7f, 0x04, 0xdb, 0x80, 0x1a, 0x5b, 0x81, 0xba, 499 0xd0, 0x0d, 0xdc, 0xf9, 0xdd, 0x0f, 0xf2, 0xf1, 0xf1, 0x51, 0x1f, 0x89,
500 0x76, 0x8a, 0x65, 0x1b, 0xe0, 0x34, 0xdb, 0xb0, 0x75, 0x58, 0x0b, 0xee, 500 0x33, 0x60, 0x02, 0x04, 0xbe, 0xf7, 0x78, 0xdf, 0x7b, 0xf7, 0x9e, 0x7b,
501 0xfb, 0xf9, 0x3d, 0xc8, 0x23, 0x79, 0xd4, 0xc3, 0x71, 0x06, 0x4c, 0x80, 501 0xce, 0xb9, 0xbf, 0x73, 0xee, 0x39, 0x87, 0x9e, 0x7b, 0xdb, 0x9b, 0xf3,
502 0x40, 0xde, 0xf1, 0x77, 0x77, 0xbf, 0xdf, 0xf7, 0xf7, 0x7d, 0xbf, 0x6e, 502 0xb9, 0xca, 0x77, 0x8e, 0x8a, 0x77, 0x0e, 0x28, 0x9d, 0xa5, 0xe3, 0xc5,
503 0x2e, 0x33, 0x1e, 0xf2, 0x33, 0x7e, 0xcf, 0x15, 0x61, 0x5f, 0x37, 0xd2, 503 0x63, 0xc6, 0x6c, 0x61, 0x22, 0xe2, 0x67, 0xfe, 0x9e, 0xad, 0xc2, 0xbe,
504 0xe1, 0x36, 0x83, 0x67, 0xa4, 0x0e, 0x9e, 0xd5, 0x34, 0xc1, 0xf6, 0x78, 504 0x6e, 0x87, 0xe1, 0xd6, 0xa2, 0x67, 0xbc, 0x85, 0x9e, 0xcd, 0x32, 0xc1,
505 0x99, 0x77, 0x4b, 0xd8, 0xc9, 0xf3, 0xc8, 0x63, 0xd7, 0x39, 0x0e, 0x12, 505 0xf6, 0x78, 0x5d, 0x77, 0x4b, 0xda, 0xc9, 0xeb, 0x88, 0x85, 0xd7, 0x31,
506 0x76, 0x65, 0x1a, 0x5a, 0x72, 0xe7, 0x37, 0x54, 0x60, 0x77, 0xb2, 0x0c, 506 0x0e, 0x92, 0x76, 0x75, 0x19, 0xba, 0xe2, 0x8c, 0x6f, 0x68, 0xd0, 0xee,
507 0xbb, 0x3d, 0xff, 0x8f, 0x60, 0x77, 0x4d, 0xe8, 0xbf, 0xdf, 0x2e, 0x22, 507 0x74, 0x9d, 0x76, 0x3b, 0xff, 0x1f, 0xd1, 0xee, 0x1d, 0x81, 0x7f, 0x5f,
508 0x6f, 0x4d, 0xeb, 0x00, 0xba, 0x6e, 0x09, 0x70, 0x04, 0x3f, 0xb5, 0xf3, 508 0xad, 0x22, 0x6e, 0x4d, 0x63, 0x00, 0x9d, 0x3b, 0x04, 0x3a, 0x42, 0x9f,
509 0xeb, 0x04, 0x9e, 0x8a, 0xbc, 0xe2, 0x52, 0xe9, 0x3b, 0xe1, 0xb2, 0x9f, 509 0x5a, 0xe5, 0x15, 0x82, 0x4e, 0x45, 0x5c, 0x71, 0xad, 0xf6, 0x5a, 0xb4,
510 0x92, 0xed, 0x12, 0xd8, 0x27, 0xf0, 0xe7, 0x35, 0x96, 0x91, 0x47, 0x6f, 510 0xee, 0xa7, 0x64, 0xbb, 0x04, 0xf6, 0x09, 0xfc, 0x79, 0xed, 0xd7, 0xc8,
511 0x4b, 0x46, 0x42, 0x57, 0xaa, 0xb5, 0x4f, 0x7e, 0xbb, 0xcb, 0x6d, 0x9f, 511 0x63, 0x1f, 0x6b, 0x8d, 0x04, 0x56, 0x72, 0xdb, 0x27, 0x0c, 0x08, 0x1d,
512 0x1c, 0xdd, 0xa1, 0x7d, 0x72, 0x5a, 0xda, 0x27, 0xa9, 0xed, 0xdb, 0x27, 512 0xf6, 0xc9, 0xb1, 0x4d, 0xda, 0x27, 0xe7, 0xa5, 0x7d, 0x92, 0xdd, 0xb8,
513 0x03, 0x75, 0x79, 0x5d, 0x95, 0xf5, 0xec, 0xdc, 0x3e, 0x31, 0x36, 0xb5, 513 0x7d, 0xb2, 0xbb, 0x25, 0xae, 0xab, 0x31, 0x9e, 0xcd, 0xdb, 0x27, 0xc6,
514 0x4f, 0x46, 0x5d, 0xbe, 0x18, 0xcc, 0xf7, 0x57, 0x29, 0x75, 0x0c, 0x3c, 514 0x9a, 0xf6, 0xc9, 0x90, 0xc3, 0x17, 0x83, 0xfe, 0xfe, 0x06, 0x65, 0x8f,
515 0x4e, 0xc3, 0x19, 0x30, 0x3e, 0x56, 0xe3, 0x17, 0xfe, 0x38, 0x61, 0xfd, 515 0x43, 0xc7, 0x69, 0x3a, 0x83, 0xc6, 0xc7, 0x5d, 0x7e, 0xe1, 0x4f, 0x93,
516 0xd7, 0xff, 0xc7, 0xb0, 0x1e, 0xac, 0xf3, 0x79, 0x57, 0xd6, 0x03, 0x21, 516 0xd6, 0xbf, 0xf8, 0x3f, 0xa6, 0xf5, 0x50, 0x8b, 0xcf, 0xbb, 0x31, 0x1e,
517 0xfe, 0x51, 0x60, 0x3d, 0xd8, 0xd0, 0x77, 0xda, 0x38, 0x67, 0xb1, 0xda, 517 0x0a, 0xef, 0xd8, 0x14, 0x8e, 0x77, 0xd3, 0x7a, 0xa8, 0xad, 0xef, 0xb4,
518 0x77, 0x3a, 0x62, 0x34, 0xe2, 0xed, 0x7f, 0xe4, 0xf2, 0xa9, 0xba, 0xf9, 518 0x7d, 0xcc, 0x62, 0xb3, 0xef, 0x74, 0xd4, 0x68, 0xa7, 0xdb, 0xff, 0xd8,
519 0x3b, 0x68, 0x8a, 0x7c, 0x47, 0xc7, 0xf5, 0xb3, 0x40, 0x4b, 0x76, 0x2a, 519 0xe1, 0x53, 0x75, 0xea, 0x77, 0xc8, 0x14, 0xf9, 0x8e, 0x4d, 0xe8, 0x77,
520 0x45, 0xb0, 0x99, 0xf0, 0xbc, 0x90, 0xa0, 0xb5, 0x1a, 0x7d, 0x8b, 0x9f, 520 0x41, 0x96, 0xac, 0x6c, 0x96, 0x60, 0x33, 0xe1, 0x7d, 0x11, 0x21, 0x6b,
521 0xc7, 0xeb, 0x7b, 0xf5, 0x09, 0x21, 0xa7, 0xa4, 0xff, 0x01, 0xe3, 0x27, 521 0x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da, 0xca,
529 0xd7, 0x0f, 0x8e, 0x44, 0x51, 0xfb, 0x56, 0xae, 0x17, 0xab, 0xad, 0x77, 529 0xfb, 0x53, 0x62, 0x5c, 0xdf, 0xfc, 0x62, 0x02, 0xb9, 0x6a, 0xf5, 0xfc,
530 0x82, 0x1c, 0xd0, 0x74, 0xa8, 0x6b, 0xa2, 0x01, 0x8b, 0x61, 0x8f, 0x7a, 530 0x21, 0x77, 0xce, 0x14, 0xd6, 0x01, 0x2d, 0x87, 0x3a, 0x3f, 0x1b, 0xb4,
531 0x27, 0xb7, 0x2c, 0xc1, 0x75, 0xb5, 0xb0, 0xa8, 0xc8, 0x91, 0xf3, 0x4a, 531 0x18, 0xf1, 0xc8, 0x99, 0x72, 0xae, 0x25, 0xb8, 0xcf, 0x4d, 0x8b, 0xc6,
532 0x8e, 0x14, 0x5c, 0x7c, 0xbc, 0x5e, 0x6f, 0xef, 0xf5, 0xd0, 0xdb, 0xbd, 532 0x3a, 0x32, 0xa7, 0xd6, 0x91, 0x45, 0x87, 0x1e, 0x6f, 0xc5, 0xed, 0xfd,
533 0x6a, 0x9e, 0x30, 0xa7, 0x67, 0x58, 0x0f, 0xb9, 0x1f, 0x7a, 0x88, 0x89, 533 0x1e, 0xb8, 0xdd, 0x2b, 0x6f, 0x0a, 0x7d, 0x7a, 0x92, 0x71, 0xc8, 0x67,
534 0xba, 0x25, 0xa9, 0x8b, 0xe0, 0x77, 0x96, 0x35, 0xaf, 0x86, 0x18, 0x57, 534 0x80, 0x43, 0x42, 0xc8, 0x5b, 0x92, 0x58, 0x04, 0xdf, 0x17, 0x19, 0x8f,
535 0x8e, 0xd0, 0x53, 0xac, 0x6b, 0x5f, 0xa2, 0x7b, 0x94, 0x7d, 0x16, 0x71, 535 0x44, 0x98, 0x57, 0x7e, 0x44, 0xe7, 0x18, 0x6b, 0x5f, 0xa7, 0xfd, 0xca,
536 0xe5, 0x99, 0x22, 0x8f, 0xdf, 0x47, 0xa9, 0x27, 0xec, 0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6, 0x42, 0x2e, 0xbd, 0x6d, 0x88, 0xed, 0x96, 0x0e, 0xe6, 551 0xe9, 0x94, 0xb5, 0x80, 0x43, 0xd6, 0x22, 0x0e, 0xdc, 0x36, 0xcc, 0x76,
552 0x21, 0xb0, 0x5b, 0xda, 0xc8, 0xff, 0xb2, 0xdb, 0x6e, 0xa9, 0xad, 0x45, 552 0x4b, 0x0f, 0xeb, 0x90, 0x1e, 0xb1, 0x6d, 0xe2, 0xbf, 0xea, 0xb4, 0x5b,
553 0x07, 0xdd, 0x41, 0x37, 0x93, 0x36, 0x4c, 0x3c, 0x57, 0xae, 0x63, 0xe7, 553 0xdc, 0x79, 0xf1, 0x90, 0x3b, 0x60, 0x33, 0x69, 0xc3, 0xa4, 0x4a, 0xf5,
554 0x75, 0x57, 0x6a, 0x0e, 0x57, 0xea, 0xea, 0x23, 0xbd, 0xe6, 0x3b, 0x5c, 554 0x9c, 0x7a, 0x1e, 0x77, 0x23, 0x6f, 0xb1, 0xd2, 0x92, 0x63, 0xe9, 0xd5,
555 0x37, 0x5f, 0xc8, 0xaf, 0x48, 0x43, 0x9d, 0xce, 0xcb, 0xae, 0xba, 0x53, 555 0xdf, 0x91, 0x96, 0xfe, 0x62, 0xfd, 0x8a, 0xb7, 0xc5, 0x74, 0x5e, 0x76,
556 0xf3, 0xab, 0xe5, 0x67, 0x78, 0xd6, 0x88, 0xf0, 0x79, 0xa7, 0xca, 0xbc, 556 0xd5, 0xfd, 0xea, 0x9f, 0x5b, 0x9f, 0xe1, 0x5d, 0xa3, 0xc2, 0xe7, 0x9d,
557 0x6c, 0x5a, 0xce, 0x37, 0x53, 0x6d, 0x67, 0xf8, 0x97, 0x48, 0xc1, 0xce, 557 0xad, 0xeb, 0xb2, 0x19, 0xd9, 0xdf, 0x42, 0xb3, 0x9d, 0xe1, 0xbf, 0x42,
558 0x9b, 0xb7, 0xef, 0xcc, 0x7f, 0xd6, 0x5e, 0x23, 0x77, 0xdf, 0x33, 0xa5, 558 0x8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, 0x55, 0xde, 0xfb, 0xc0, 0xd8, 0xf3, 0x87, 0x9f, 0xba, 0x4a, 0x67,
581 0x36, 0x18, 0xdb, 0x46, 0x69, 0x21, 0x88, 0xba, 0x22, 0x51, 0x9b, 0xa3, 581 0xae, 0x81, 0x87, 0x0d, 0xe6, 0xb6, 0x31, 0xca, 0x87, 0x91, 0x57, 0x24,
582 0xe2, 0x86, 0xb2, 0x56, 0x68, 0x5e, 0xd4, 0x40, 0x8e, 0x85, 0x6e, 0xf2, 582 0x72, 0x73, 0xf4, 0xbe, 0xa1, 0xc8, 0x15, 0x3a, 0x23, 0x72, 0x20, 0xc7,
583 0xbc, 0xe7, 0x8b, 0x29, 0x3a, 0xc5, 0x32, 0xf6, 0xd4, 0x4a, 0x45, 0x77, 583 0x23, 0xf7, 0x78, 0x3d, 0x3c, 0x53, 0x7d, 0x9b, 0xce, 0x56, 0x82, 0xfc,
584 0xaf, 0xaf, 0x83, 0xac, 0xc6, 0xf1, 0x9b, 0x02, 0xc7, 0x87, 0x36, 0xc5, 584 0xdf, 0xc0, 0xee, 0xad, 0x79, 0x90, 0xcd, 0x3c, 0x7e, 0x4f, 0xf0, 0xf8,
585 0xf1, 0xc3, 0x65, 0x1c, 0xff, 0x44, 0xaf, 0xc4, 0xe7, 0x67, 0xf9, 0x5e, 585 0xf0, 0x9a, 0x3c, 0x7e, 0xa4, 0xce, 0xe3, 0x5f, 0xe9, 0x97, 0xfc, 0xdc,
586 0x5d, 0x74, 0x50, 0xdc, 0x37, 0xc5, 0xdf, 0xdb, 0xe9, 0xa0, 0xec, 0x61, 586 0xcb, 0xcf, 0xea, 0xa5, 0x43, 0xe2, 0xb9, 0x6f, 0xf3, 0xf1, 0x56, 0x3a,
587 0xc1, 0xcf, 0x66, 0x1e, 0x9f, 0x49, 0xd1, 0x53, 0x17, 0x53, 0xbe, 0xb8, 587 0x14, 0x92, 0xc7, 0x67, 0x2b, 0xac, 0xe3, 0x0b, 0x6f, 0xd3, 0xb9, 0x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0x7e, 0xfc, 0xfc, 0xdb, 0x17, 0xc2, 0x9b, 0xcf,
647 0xb7, 0xee, 0x6b, 0x76, 0x56, 0x7f, 0x6b, 0xf2, 0xda, 0x8d, 0x65, 0x59, 647 0xbf, 0x75, 0xde, 0xb3, 0xb9, 0xfc, 0xdb, 0x10, 0x8f, 0xdd, 0x58, 0x90,
648 0x7f, 0x5b, 0x1d, 0x93, 0x91, 0xfe, 0xc0, 0xa4, 0x4b, 0x7f, 0x90, 0xfa, 648 0xf9, 0xb7, 0xcd, 0x7b, 0x32, 0x32, 0xff, 0x36, 0xe3, 0xc0, 0x0f, 0x12,
649 0xfa, 0x6f, 0xb9, 0xf2, 0xb7, 0x65, 0x6d, 0x6d, 0xa1, 0xac, 0xb3, 0xca, 649 0xaf, 0xbf, 0xe5, 0x88, 0xdf, 0x96, 0xb9, 0xb5, 0x8b, 0x75, 0xcc, 0x2a,
650 0xda, 0x5a, 0x99, 0xef, 0xed, 0xee, 0x03, 0x23, 0x63, 0x3f, 0xf2, 0x39, 650 0x73, 0x6b, 0x65, 0xbc, 0xb7, 0xb3, 0x0e, 0x8c, 0xdc, 0xfb, 0x91, 0xef,
651 0x9d, 0x35, 0xb1, 0x1f, 0x59, 0x53, 0x6b, 0x19, 0x8d, 0x6c, 0x38, 0xd1, 651 0xd9, 0xe6, 0xda, 0xfb, 0x91, 0x39, 0xb5, 0xa6, 0xd1, 0xce, 0x86, 0xc3,
652 0xe7, 0xa2, 0x8f, 0xba, 0x22, 0x8c, 0xbb, 0xed, 0x0d, 0xfa, 0x21, 0x44, 652 0x1a, 0x81, 0x7a, 0x08, 0x71, 0xe6, 0xdd, 0xad, 0x6d, 0xea, 0x21, 0xc4,
653 0x1a, 0xf4, 0x43, 0x70, 0xf3, 0x7e, 0xb7, 0x8e, 0x05, 0x9d, 0x18, 0xb2, 653 0xdb, 0xd4, 0x43, 0x70, 0xea, 0x7e, 0x27, 0xc6, 0x02, 0x26, 0xc6, 0xda,
654 0x11, 0xba,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50, 0x1c, 0x32, 0x92, 0x59, 0xe8, 0xcc, 0xfc, 676 0xfc, 0x33, 0x94, 0xaf, 0x5e, 0xa7, 0x4c, 0x11, 0x98, 0x99, 0x3f, 0xcb,
677 0x99, 0x8f, 0xee, 0x91, 0x3e, 0x1a, 0x7d, 0x0d, 0xf8, 0xca, 0x6e, 0x1e, 677 0xe7, 0x76, 0x4a, 0x1f, 0x8d, 0xbe, 0x07, 0x7a, 0x65, 0x07, 0xb7, 0xff,
678 0xff, 0x7a, 0xbf, 0xcc, 0xcb, 0x76, 0x9f, 0xef, 0xe2, 0xf3, 0x7b, 0x42, 678 0xeb, 0x41, 0x19, 0x97, 0xed, 0xbc, 0xde, 0xcb, 0xd7, 0xbf, 0x10, 0x69,
679 0xd5, 0xe7, 0x77, 0xf1, 0xf9, 0xde, 0x04, 0xf6, 0xd0, 0x58, 0x82, 0x5f, 679 0xbe, 0xbe, 0x85, 0xaf, 0xf7, 0xa7, 0x31, 0x87, 0xc6, 0x15, 0xf8, 0x25,
680 0xd2, 0xa1, 0x34, 0xef, 0xcd, 0x42, 0x91, 0x65, 0xeb, 0xcb, 0xcc, 0x47, 680 0x27, 0x29, 0xc7, 0xf3, 0x93, 0xaf, 0xf2, 0xda, 0x7a, 0x95, 0xf5, 0x55,
681 0x57, 0xf4, 0xb8, 0x3e, 0xd4, 0xec, 0x88, 0x3d, 0x31, 0x78, 0xcc, 0xb9, 681 0x45, 0xb7, 0x1b, 0x40, 0xce, 0x8e, 0x98, 0x13, 0x83, 0xdb, 0x5c, 0x2c,
682 0xcc, 0x04, 0x8f, 0x1b, 0x24, 0xff, 0xcb, 0x6c, 0x8b, 0xae, 0x68, 0x5c, 682 0x4c, 0x71, 0xbb, 0x21, 0xf2, 0x5f, 0x35, 0x29, 0x5f, 0xd1, 0xbc, 0xaa,
683 0xd5, 0xf9, 0xf6, 0xdf, 0xe8, 0x93, 0x39, 0x55, 0xdf, 0xdd, 0x23, 0xe1, 683 0xe3, 0xed, 0xdf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9, 0xf3, 0x93, 0x01, 0x8c, 735 0x33, 0xbd, 0x59, 0x3f, 0x7f, 0x3d, 0x80, 0xf6, 0xb8, 0x66, 0xcb, 0x58,
736 0xc7, 0x39, 0x47, 0xe6, 0x4a, 0x8a, 0xb5, 0x85, 0xf8, 0xd8, 0x27, 0x6a, 736 0x49, 0x31, 0xb6, 0x08, 0x9f, 0x83, 0xb6, 0x11, 0x45, 0x87, 0x6e, 0x1e,
737 0xa4, 0x25, 0x1c, 0x5a, 0x79, 0x7d, 0x3e, 0x31, 0x3e, 0xb9, 0xda, 0x4a, 737 0x9f, 0x4f, 0xb4, 0xcf, 0x2c, 0x75, 0xd3, 0x99, 0x12, 0x63, 0x90, 0x92,
738 0xf3, 0x39, 0xd6, 0x41, 0x72, 0x7e, 0xb6, 0x61, 0x30, 0xf6, 0xef, 0x54, 738 0x9f, 0x6d, 0x18, 0xb4, 0x0d, 0xec, 0xd5, 0xf5, 0x5f, 0x2f, 0x72, 0xdf,
739 0x6f, 0x61, 0xdc, 0xbf, 0x8b, 0xd2, 0x62, 0x1c, 0x7f, 0xae, 0x76, 0xd1, 739 0x73, 0x25, 0x89, 0x41, 0x72, 0x4b, 0xbd, 0x94, 0x2f, 0xf5, 0xa8, 0xf3,
740 0x42, 0xae, 0x43, 0x1d, 0xdf, 0x2b, 0x72, 0xdc, 0x65, 0x1f, 0x23, 0xfc, 740 0x07, 0x44, 0x8c, 0xbb, 0xac, 0x63, 0x84, 0xef, 0xd6, 0xd2, 0x6f, 0x6f,
741 0xb6, 0x19, 0x7f, 0x7b, 0x97, 0x71, 0x0a, 0x32, 0x55, 0xda, 0xa5, 0xe0, 741 0x31, 0x4f, 0x61, 0x4d, 0x95, 0x76, 0x29, 0x74, 0xcd, 0x8d, 0x96, 0xba,
742 0x35, 0x97, 0xeb, 0x7a, 0x22, 0x03, 0xe7, 0xa6, 0xe8, 0x25, 0x96, 0xb7, 742 0xc4, 0xe0, 0xb9, 0x19, 0xfa, 0x2e, 0xaf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16, 0x7b, 0x2b, 0x86, 0xfd, 0x22, 0xcb, 0x98, 0xdc, 0x2b, 0x4f,
758 0x2f, 0x99, 0x97, 0xb1, 0xf2, 0x78, 0x4d, 0xac, 0x7c, 0x56, 0xc4, 0xca, 758 0xb9, 0xf6, 0xca, 0x4f, 0x8a, 0xbd, 0x72, 0xec, 0x93, 0x83, 0xae, 0xa0,
759 0x11, 0x27, 0x07, 0x5c, 0x01, 0x4b, 0xaf, 0x9c, 0x16, 0xec, 0x63, 0x98, 759 0xa5, 0x57, 0x4c, 0x0b, 0xe6, 0x31, 0xca, 0xf3, 0x68, 0xd2, 0xc5, 0x6b,
760 0x90, 0x1b, 0x7e, 0xee, 0xa2, 0xe0, 0x37, 0xe1, 0x98, 0x5f, 0xe6, 0x57, 760 0x42, 0xdf, 0x44, 0x93, 0x7e, 0x19, 0x5f, 0x9d, 0xa2, 0xac, 0x88, 0xbf,
761 0xc7, 0x79, 0xc6, 0x06, 0x5d, 0x60, 0x7c, 0xb0, 0x27, 0x36, 0x58, 0x97, 761 0x96, 0x9f, 0x71, 0x23, 0x61, 0x5b, 0x93, 0xab, 0x8c, 0x29, 0x2a, 0xc5,
762 0x58, 0xc9, 0x7e, 0x99, 0xae, 0xe4, 0x9b, 0x58, 0xd7, 0x5b, 0xa0, 0x8d, 762 0x2d, 0x74, 0xb3, 0xdc, 0xc1, 0x98, 0xef, 0x6f, 0x69, 0xb5, 0x4c, 0x8c,
763 0x3c, 0xb1, 0x4e, 0xd8, 0x4d, 0x0b, 0x61, 0xc6, 0xb1, 0x89, 0x36, 0xde, 763 0x0d, 0xb7, 0x53, 0x3e, 0xca, 0xbc, 0x36, 0x19, 0xe4, 0x79, 0x65, 0x7c,
764 0x4f, 0xd6, 0x6b, 0x27, 0x98, 0xee, 0x78, 0xee, 0x2b, 0xb9, 0xd2, 0x8f, 764 0x3b, 0xc9, 0xf2, 0xc7, 0x63, 0xa8, 0x94, 0x6a, 0xef, 0xe7, 0xa2, 0x71,
765 0x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0x92, 0xe1, 772 0x60, 0xbe, 0x76, 0x6f, 0x36, 0xea, 0x7c, 0x2f, 0x19, 0x99, 0xe8, 0x36,
773 0x4e, 0xa1, 0x23, 0xad, 0xac, 0xfa, 0xf8, 0xd9, 0x11, 0x2b, 0x39, 0xc5, 773 0x81, 0x99, 0x2a, 0x4b, 0xfb, 0xb9, 0x0f, 0x71, 0x33, 0x33, 0xcd, 0x7d,
774 0x73, 0xcc, 0xb9, 0xe7, 0x5d, 0xba, 0x19, 0x0b, 0x63, 0x9c, 0xbf, 0x66, 774 0x2d, 0x39, 0xfb, 0x5f, 0xbb, 0x97, 0x8c, 0xa2, 0x9d, 0xdf, 0xd5, 0x2e,
775 0x1c, 0xdb, 0xca, 0x53, 0x72, 0x3d, 0x85, 0x5c, 0xe9, 0xe7, 0xd1, 0xb0, 775 0x4e, 0xa2, 0xed, 0x12, 0xda, 0xd7, 0xfe, 0x27, 0x11, 0xd5, 0xe3, 0x74,
776 0x5e, 0x9f, 0xfb, 0x5a, 0xac, 0x03, 0xf4, 0xc4, 0x9f, 0x2b, 0x5d, 0xbe, 776 0xde, 0x8b, 0xf1, 0x40, 0xbe, 0xf8, 0xb3, 0x72, 0x9b, 0x6e, 0x16, 0x61,
777 0x2b, 0x59, 0xd8, 0xdf, 0x06, 0xe3, 0x39, 0x66, 0x34, 0x44, 0xa9, 0x15, 777 0x8f, 0x1b, 0xcc, 0xf7, 0xe8, 0x91, 0x49, 0xd9, 0x0a, 0x63, 0xc0, 0x6b,
778 0xa6, 0xef, 0x8b, 0x1d, 0xbe, 0x8d, 0xec, 0x95, 0x52, 0xb2, 0x2a, 0x97, 778 0x7b, 0x7d, 0xab, 0xc5, 0x37, 0x6a, 0x99, 0xa6, 0xd8, 0x96, 0x66, 0x3f,
779 0xa5, 0xda, 0xef, 0x2e, 0x6d, 0xae, 0x21, 0x72, 0x96, 0x20, 0x33, 0x21, 779 0xbc, 0xb4, 0xc1, 0x86, 0xc9, 0xbe, 0x82, 0x35, 0x14, 0xeb, 0x67, 0xb6,
780 0x2f, 0x53, 0x25, 0xbf, 0x03, 0xfd, 0x0e, 0xb6, 0xd0, 0x59, 0xe6, 0x57, 780 0xe6, 0xb7, 0x81, 0xf7, 0x60, 0x1b, 0x5d, 0x60, 0xfd, 0x25, 0xe3, 0x93,
781 0x32, 0x1f, 0x89, 0x79, 0x27, 0xf3, 0x2c, 0x49, 0x2f, 0xf1, 0xaa, 0xd7, 781 0x58, 0x97, 0xb2, 0x0e, 0x93, 0xf2, 0x93, 0x6a, 0xfa, 0x39, 0x04, 0xc9,
782 0x0d, 0x48, 0x9c, 0x1d, 0xa9, 0xe4, 0x41, 0xba, 0xe2, 0xe9, 0x01, 0x57, 782 0xc3, 0xa3, 0x8d, 0xb8, 0x48, 0xc7, 0xfe, 0x7a, 0xc0, 0xb1, 0xbf, 0x1e,
783 0x3c, 0xdd, 0x74, 0xe5, 0x41, 0x06, 0x85, 0x3e, 0x56, 0xd1, 0xa1, 0x82, 783 0x72, 0xc4, 0x45, 0x86, 0x05, 0x3e, 0x6b, 0x60, 0xaa, 0xb0, 0xc2, 0x54,
784 0x4a, 0x87, 0x82, 0xae, 0x25, 0x79, 0x59, 0xa1, 0xcc, 0xcb, 0x76, 0x6f, 784 0xc0, 0x5e, 0x52, 0xb7, 0x2d, 0xd6, 0x75, 0xdb, 0x8e, 0x75, 0x74, 0x9b,
785 0xc1, 0xcb, 0xbc, 0x6c, 0xd3, 0x75, 0xc5, 0x37, 0xec, 0x30, 0xe4, 0xfc, 785 0x97, 0xad, 0xba, 0xa2, 0xf4, 0x88, 0x15, 0xc5, 0x1a, 0x73, 0x83, 0xf5,
786 0xe5, 0xe2, 0x34, 0xbd, 0xcd, 0x3c, 0xe2, 0xad, 0x62, 0x98, 0xf9, 0xc6, 786 0xc5, 0xeb, 0xd5, 0x69, 0xd6, 0x23, 0x51, 0xd6, 0x23, 0x53, 0xac, 0x47,
787 0x24, 0xf3, 0x8d, 0x09, 0xe6, 0x1b, 0x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60, 0xf0, 0x7c,
898 0xc5, 0xfb, 0x2f, 0xd0, 0xeb, 0x73, 0xa1, 0xf8, 0x29, 0xbc, 0x47, 0xc6, 898 0xf5, 0x71, 0xfc, 0x5e, 0x8c, 0x2f, 0x2d, 0xb0, 0x71, 0x84, 0xb1, 0x0d,
899 0x97, 0x10, 0x3a, 0x6f, 0x88, 0x75, 0x17, 0xe8, 0x30, 0xa3, 0x22, 0xbe, 899 0x30, 0xce, 0x98, 0xd8, 0x17, 0x8b, 0x3f, 0x16, 0xf1, 0xe5, 0x97, 0x07,
900 0x15, 0x79, 0xc2, 0x32, 0x16, 0xd6, 0xfa, 0xc9, 0x0f, 0xbf, 0x9a, 0xa3, 900 0xc9, 0x0f, 0x7f, 0x9c, 0xad, 0x63, 0x29, 0xba, 0x45, 0xdc, 0xbb, 0xdc,
901 0x73, 0x22, 0x5a, 0x45, 0xfe, 0xba, 0x8c, 0x2b, 0x42, 0xfe, 0x82, 0x07, 901 0x8f, 0xc4, 0xfa, 0x0c, 0x9d, 0x78, 0x87, 0xed, 0x86, 0x09, 0x15, 0x87,
902 0xfe, 0xc4, 0x97, 0x5c, 0xf3, 0xf7, 0xe9, 0x7c, 0xb7, 0x48, 0xb0, 0x9c, 902 0xd3, 0x21, 0x6a, 0x53, 0xc9, 0xbd, 0x54, 0xad, 0x53, 0x34, 0xef, 0xe9,
903 0x4f, 0xa3, 0x78, 0x8a, 0xc6, 0x3d, 0x1d, 0xb3, 0x70, 0xbf, 0xd7, 0x0a, 903 0xbd, 0x0e, 0xe7, 0x6f, 0x73, 0x41, 0x76, 0x9d, 0x98, 0x02, 0xfe, 0x29,
904 0xb4, 0xeb, 0xd6, 0x19, 0xe0, 0x67, 0x12, 0x7b, 0x74, 0x01, 0x71, 0x5c, 904 0x31, 0x47, 0x97, 0x88, 0xe4, 0x1c, 0x37, 0xf6, 0x31, 0xba, 0x78, 0x9e,
905 0xa3, 0x2a, 0x1e, 0xd1, 0xc2, 0xfb, 0x04, 0x3b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 0x71, 0x00, 0xf9, 927 0x64, 0x33, 0xbe, 0x34, 0x0e, 0x22, 0xce, 0xdc, 0xe4, 0x7b, 0x50, 0x73,
928 0xe1, 0x16, 0x5f, 0x83, 0x5e, 0x51, 0x63, 0x56, 0x9c, 0x3a, 0xe0, 0x4f, 928 0x6a, 0xdc, 0x4c, 0x51, 0x0f, 0xfc, 0x10, 0xa8, 0x25, 0x6d, 0xe6, 0x9a,
929 0x40, 0x0f, 0x68, 0x2b, 0x5d, 0x45, 0x53, 0xb3, 0x82, 0xa6, 0xe2, 0x6b, 929 0x64, 0xec, 0x94, 0x90, 0xb1, 0xd4, 0xf2, 0x29, 0x25, 0x63, 0xa7, 0x94,
930 0xb3, 0x8a, 0xa6, 0x66, 0x95, 0xff, 0x7c, 0x56, 0xd1, 0xd4, 0xac, 0xa2, 930 0x1f, 0xfe, 0x94, 0x92, 0xb1, 0x53, 0x4a, 0xc6, 0x4e, 0x29, 0x19, 0x3b,
931 0xa9, 0x59, 0x45, 0x53, 0xb3, 0x8c, 0xd7, 0xa3, 0xac, 0xaf, 0x42, 0xf7, 931 0xc5, 0x7c, 0x3e, 0xc6, 0xf8, 0x16, 0x58, 0x44, 0xfb, 0x41, 0x7b, 0x29,
932 0xd0, 0xfe, 0xcb, 0x2e, 0x4a, 0xe6, 0x70, 0x1e, 0xf2, 0xb8, 0x96, 0xae, 932 0x53, 0xc2, 0x75, 0xac, 0xcf, 0x6e, 0x39, 0x7b, 0x69, 0x44, 0xca, 0x19,
933 0x7e, 0x6d, 0x58, 0xfb, 0x47, 0x0b, 0x32, 0xcf, 0x8e, 0x9f, 0x85, 0x3d, 933 0x63, 0x13, 0x19, 0xaf, 0xc7, 0xef, 0xc2, 0x1c, 0xfc, 0x1e, 0xd3, 0xef,
934 0x78, 0x98, 0xe1, 0x77, 0xcd, 0x37, 0xbf, 0x88, 0xb9, 0xfa, 0x28, 0x26, 934 0x23, 0x3a, 0x33, 0x8f, 0xbe, 0xfa, 0x28, 0x29, 0x6a, 0xc9, 0x76, 0x50,
935 0x7a, 0xc0, 0x36, 0x51, 0xd4, 0xad, 0xe3, 0x9a, 0xa8, 0xeb, 0x92, 0xb6, 935 0xc2, 0x89, 0x85, 0x43, 0xc8, 0x0f, 0x93, 0xb6, 0x5f, 0xb6, 0x6d, 0xae,
936 0x5c, 0xaa, 0x61, 0x8d, 0x97, 0xc6, 0x8b, 0x69, 0xb5, 0x5f, 0xb5, 0x76, 936 0x98, 0xe6, 0x93, 0x98, 0x9a, 0x2f, 0xb7, 0x5d, 0xd4, 0x45, 0xe9, 0x22,
937 0x4e, 0x0b, 0x25, 0xb2, 0x80, 0x2b, 0x72, 0x21, 0x2d, 0xde, 0x1b, 0x01, 937 0xe8, 0x8a, 0x98, 0x4a, 0x93, 0xe7, 0x46, 0xd0, 0x49, 0x86, 0x44, 0xb9,
938 0xa7, 0x94, 0xe9, 0x01, 0x83, 0xa3, 0x0a, 0x06, 0x4f, 0x8b, 0x35, 0x22, 938 0x68, 0x70, 0x4c, 0xd1, 0xe0, 0xdb, 0x62, 0x8c, 0x88, 0x49, 0x84, 0x2f,
939 0x97, 0x10, 0x3e, 0xc8, 0xc6, 0x70, 0x48, 0x67, 0x46, 0xf9, 0x3e, 0x8c, 939 0xb3, 0x3d, 0x1d, 0x72, 0x85, 0x31, 0x7e, 0x0e, 0xcb, 0xc2, 0xc1, 0x08,
940 0xfb, 0x07, 0x42, 0xcc, 0x83, 0xb6, 0x0b, 0x07, 0xf7, 0xda, 0x1b, 0xf1, 940 0xeb, 0xa4, 0x8d, 0xd3, 0xa1, 0x31, 0xf6, 0x76, 0xba, 0x67, 0xa3, 0x79,
941 0x9a, 0xed, 0xd6, 0xd3, 0x5c, 0x77, 0xc9, 0x8e, 0x90, 0x92, 0x1b, 0x52, 941 0x39, 0x77, 0x1c, 0x6b, 0x49, 0x44, 0xad, 0x23, 0x12, 0x17, 0x6f, 0xb1,
942 0xef, 0xdd, 0xe5, 0xd8, 0x89, 0x14, 0xcf, 0xed, 0x2f, 0xc2, 0x7f, 0x39, 942 0x6b, 0x74, 0x34, 0xba, 0x97, 0x8f, 0xad, 0x74, 0x96, 0x0e, 0x90, 0xd1,
943 0x44, 0x6d, 0x25, 0x3a, 0x12, 0x06, 0x3e, 0x77, 0xb1, 0x5d, 0xc9, 0x73, 943 0x57, 0xa3, 0xbf, 0x60, 0x39, 0xe8, 0x66, 0x39, 0x38, 0xaa, 0xec, 0x92,
944 0x18, 0x2b, 0xd1, 0x85, 0xf0, 0x3e, 0xb6, 0x5d, 0xf6, 0xb3, 0x0e, 0x3a, 944 0xa3, 0x75, 0xbb, 0x64, 0xcf, 0x1e, 0xc4, 0x65, 0x64, 0xc4, 0xbe, 0xd7,
945 0xca, 0xff, 0x4e, 0xc4, 0xef, 0xc3, 0xbc, 0x3a, 0xf8, 0xda, 0x7e, 0x32, 945 0x56, 0x55, 0x43, 0x00, 0xbe, 0x6f, 0x9c, 0x77, 0x51, 0x7c, 0x18, 0xe7,
946 0x7a, 0x52, 0x66, 0x2b, 0xeb, 0x07, 0x47, 0x2a, 0xf6, 0x88, 0x05, 0xff, 946 0xf8, 0x2d, 0x22, 0x6b, 0x32, 0xee, 0x1b, 0xdf, 0x23, 0xb0, 0xbb, 0xcf,
947 0x1c, 0xeb, 0xb6, 0xc6, 0x5c, 0xb8, 0x5b, 0xd5, 0x9c, 0xc1, 0x87, 0x8d, 947 0xc2, 0x3d, 0x47, 0xa5, 0xde, 0xf3, 0x91, 0x7f, 0xfc, 0x36, 0xe3, 0x89,
948 0xf8, 0xd6, 0x3f, 0x97, 0x64, 0xaf, 0x80, 0x21, 0x75, 0xfc, 0xe3, 0x52, 948 0x1a, 0x3d, 0xc1, 0xef, 0xcc, 0x17, 0xf7, 0xf1, 0xb3, 0x75, 0x4d, 0x09,
949 0x64, 0x08, 0xc7, 0x78, 0xe7, 0x90, 0x3d, 0x11, 0xf1, 0xfd, 0x58, 0xea, 949 0x3b, 0x6e, 0xf8, 0xb6, 0x92, 0xb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, 0x3c, 0x2f,
994 0xe6, 0x88, 0x19, 0xce, 0x88, 0x7a, 0x97, 0x82, 0xc0, 0x2b, 0x96, 0xe3, 994 0xcc, 0xd9, 0xbb, 0x99, 0xd7, 0x6d, 0xaa, 0xcc, 0x23, 0x67, 0x61, 0x25,
995 0x33, 0xa8, 0x69, 0xaa, 0xdb, 0x03, 0x12, 0xef, 0xa5, 0x14, 0xf0, 0x97, 995 0x6a, 0xd0, 0xbf, 0x08, 0x9b, 0x6c, 0x55, 0xd8, 0xfc, 0x31, 0x11, 0xc3,
996 0x7b, 0x12, 0xcb, 0xac, 0x9f, 0xf9, 0x73, 0xde, 0xc7, 0x2b, 0x6b, 0x81, 996 0xba, 0x28, 0xf8, 0x8b, 0xd7, 0xff, 0x18, 0x72, 0xaa, 0xdc, 0x73, 0xd1,
997 0x00, 0x7e, 0xf3, 0xcf, 0x04, 0x69, 0x63, 0x8d, 0xed, 0x54, 0xc6, 0xb1, 997 0x4d, 0x37, 0xa3, 0x98, 0x0b, 0x53, 0xcd, 0x05, 0xae, 0x75, 0xe9, 0xfa,
998 0xab, 0xb9, 0x21, 0xba, 0x92, 0x1b, 0xa0, 0x8d, 0xdc, 0x30, 0xbd, 0x93, 998 0x90, 0x01, 0xbe, 0x7e, 0xe1, 0x03, 0xf0, 0xe8, 0x72, 0x4f, 0x20, 0x59,
999 0xc3, 0x33, 0x00, 0x73, 0x3e, 0x16, 0x30, 0x37, 0xe8, 0x60, 0x90, 0xc7, 999 0xf8, 0xe6, 0x08, 0xf0, 0x5f, 0x7e, 0x99, 0x1c, 0xd7, 0x03, 0x7c, 0x3d,
1000 0xac, 0x0e, 0xd0, 0xfa, 0xaa, 0xc6, 0x57, 0xe0, 0x2a, 0xf6, 0x3f, 0xd2, 1000 0x2c, 0x7e, 0xfb, 0x09, 0xb2, 0xf2, 0x8f, 0x88, 0x71, 0x64, 0x9e, 0xbc,
1001 0x23, 0xeb, 0xd0, 0xea, 0x71, 0x20, 0x56, 0x85, 0x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0x22, 0x49, 0xaa, 0x5d, 0x30, 0x6c, 0xd4, 0x73, 0x4c,
1009 0x88, 0xa9, 0xf1, 0xf9, 0x55, 0xc4, 0x73, 0x87, 0x68, 0x63, 0x11, 0x34, 1009 0xf3, 0xf3, 0x0c, 0xe5, 0x6f, 0xda, 0xe6, 0xe0, 0x3f, 0x37, 0xd6, 0xc5,
1010 0x07, 0xff, 0x44, 0x25, 0x86, 0xba, 0xb1, 0x86, 0xf3, 0xf0, 0x51, 0x54, 1010 0x5e, 0xf2, 0x63, 0xdc, 0x67, 0xac, 0xc3, 0x8d, 0xfd, 0x1a, 0xaa, 0xef,
1011 0x62, 0xa8, 0x1b, 0x2a, 0x86, 0xba, 0xb1, 0x36, 0x2d, 0xf8, 0xf0, 0x42, 1011 0xd7, 0x74, 0xf3, 0xb8, 0xa5, 0xec, 0xcd, 0xda, 0xdc, 0xae, 0xca, 0xed,
1012 0x8e, 0x79, 0x40, 0xce, 0xaf, 0xf2, 0x07, 0xf7, 0xa9, 0x77, 0xf6, 0x9c, 1012 0xaa, 0xd8, 0xfb, 0xe3, 0xeb, 0x4b, 0xd8, 0x77, 0x1e, 0xa6, 0xd5, 0x79,
1013 0x10, 0x3e, 0xe4, 0x1e, 0x67, 0x73, 0x18, 0x1e, 0xac, 0x83, 0xe1, 0xb4, 1013 0xc8, 0x28, 0xfc, 0x21, 0x8d, 0xbd, 0xde, 0xd5, 0x65, 0x5c, 0x87, 0x4f,
1014 0xd0, 0x83, 0xe2, 0x7c, 0xcf, 0x58, 0xee, 0x04, 0xc3, 0x73, 0x96, 0x69, 1014 0xa4, 0xb1, 0xd7, 0xbb, 0xaa, 0xf6, 0x7a, 0x57, 0x97, 0x63, 0x42, 0x6f,
1015 0x69, 0xb7, 0xa2, 0x25, 0x1d, 0x93, 0xed, 0x26, 0xf5, 0xfe, 0x1f, 0xa1, 1015 0xe7, 0x4b, 0x4c, 0xf7, 0x92, 0x5f, 0xc5, 0x39, 0xee, 0x53, 0xbf, 0x2d,
1016 0xeb, 0x4b, 0xfe, 0x33, 0x54, 0xc3, 0x7f, 0x28, 0x10, 0x1d, 0x97, 0xd7, 1016 0xf4, 0x98, 0xf0, 0x69, 0xf7, 0xd9, 0x6b, 0xd3, 0xf0, 0x50, 0x0b, 0x0d,
1017 0xa7, 0x8b, 0xaf, 0x0c, 0x6b, 0xff, 0x5b, 0x9a, 0xef, 0xbb, 0x90, 0xdb, 1017 0x63, 0x02, 0x67, 0xa5, 0xf8, 0x99, 0xc9, 0xd2, 0x63, 0xff, 0x3b, 0x60,
1018 0x49, 0x4c, 0x97, 0xe5, 0xa6, 0x67, 0xce, 0xe0, 0x76, 0x9f, 0xad, 0x71, 1018 0x78, 0x46, 0x00, 0xf3, 0x9e, 0x30, 0x34, 0xef, 0xc1, 0xe6, 0x8e, 0xf9,
1019 0xe1, 0xc4, 0x6d, 0xe0, 0x93, 0xbc, 0x47, 0x05, 0x9f, 0xfe, 0x77, 0x16, 1019 0x19, 0x20, 0xf7, 0x14, 0xd9, 0x80, 0xfb, 0x16, 0x90, 0xf2, 0x4a, 0x06,
1020 0xc0, 0xb2, 0x93, 0x05, 0x98, 0x57, 0x84, 0x80, 0xf5, 0x03, 0x03, 0xb4, 1020 0xad, 0xbc, 0x02, 0xa6, 0x09, 0x75, 0x88, 0xfe, 0xa6, 0xf5, 0x9f, 0xe5,
1021 0x8e, 0x39, 0x00, 0x1e, 0x53, 0x68, 0x02, 0xe6, 0x19, 0xa7, 0xf5, 0x40, 1021 0x60, 0xe3, 0x80, 0x4d, 0x40, 0x73, 0x9b, 0xa7, 0x90, 0x32, 0xf7, 0x0c,
1022 0xfb, 0xfb, 0x95, 0xc1, 0xeb, 0x5d, 0x1b, 0xa0, 0x67, 0x4f, 0x2d, 0xea, 1022 0xac, 0x6f, 0xb1, 0xae, 0x6d, 0xb4, 0x01, 0xef, 0xb1, 0x5e, 0x34, 0x85,
1023 0x79, 0x2c, 0x07, 0xca, 0xa3, 0x4e, 0x2a, 0x0c, 0x24, 0xe6, 0x27, 0x90, 1023 0x85, 0x61, 0x49, 0x0f, 0x03, 0xb0, 0x7e, 0x00, 0xa5, 0x75, 0x50, 0x1d,
1024 0xff, 0x80, 0xfe, 0x00, 0xf9, 0x11, 0x98, 0x9f, 0x9c, 0x81, 0x72, 0xa0, 1024 0x01, 0x4f, 0xef, 0x02, 0x4d, 0x40, 0xf7, 0x39, 0x01, 0xdb, 0xa2, 0xce,
1025 0x35, 0x53, 0xcd, 0x6b, 0x40, 0xfa, 0x40, 0x61, 0x08, 0x2a, 0x53, 0x41, 1025 0xfd, 0xca, 0xe0, 0xb5, 0xb2, 0x0d, 0xd0, 0x73, 0xab, 0x16, 0xf5, 0x88,
1026 0x63, 0x1d, 0x40, 0xf6, 0x12, 0x21, 0x68, 0xd8, 0x01, 0x69, 0x20, 0xbb, 1026 0xc9, 0x83, 0xf2, 0x99, 0x93, 0x0a, 0x03, 0x19, 0x79, 0x81, 0x0d, 0x9a,
1027 0x79, 0x8a, 0x08, 0x98, 0x9f, 0x14, 0x20, 0xc4, 0xd0, 0x00, 0xcf, 0x4f, 1027 0x17, 0xc0, 0xe1, 0x04, 0x4c, 0xeb, 0xc0, 0x32, 0x6a, 0x8d, 0x2e, 0xd0,
1028 0xec, 0x40, 0x97, 0xc2, 0xdc, 0xf4, 0xff, 0xff, 0x31, 0x15, 0x16, 0x60, 1028 0x3c, 0x1e, 0x16, 0x97, 0x7e, 0x90, 0x18, 0x03, 0x54, 0x8c, 0x05, 0xc8,
1029 0xda, 0x03, 0xad, 0xf9, 0xfc, 0xfd, 0xff, 0x80, 0x08, 0x0b, 0x43, 0x0b, 1029 0x97, 0x01, 0xb6, 0x29, 0x41, 0x7e, 0x05, 0xe5, 0x05, 0x90, 0xd9, 0x20,
1030 0x7c, 0xed, 0x9e, 0xb0, 0x3c, 0xa8, 0x9c, 0x5b, 0x00, 0x64, 0xb5, 0xc1, 1030 0xbf, 0x83, 0xca, 0x4e, 0x50, 0x5e, 0x04, 0xb2, 0x97, 0x08, 0x41, 0xfd,
1031 0xeb, 0x6d, 0x16, 0xf0, 0x7d, 0xc4, 0x0b, 0x18, 0x7e, 0x01, 0xcb, 0x95, 1031 0x0c, 0xa4, 0x81, 0xec, 0xe6, 0x29, 0x22, 0x60, 0x7e, 0x52, 0x80, 0x10,
1032 0xff, 0xff, 0x97, 0xc2, 0xd5, 0x82, 0x00, 0x00, 0xd4, 0xc2, 0xcb, 0x42, 1032 0x43, 0x03, 0x3c, 0x1f, 0x10, 0x1b, 0xc6, 0x30, 0xf5, 0x31, 0x64, 0xe4,
1033 0x60, 0x7c, 0x00, 0x00, 0x00 }; 1033 0x1b, 0x88, 0x19, 0x88, 0x7c, 0xc3, 0xce, 0x70, 0x40, 0x00, 0x16, 0x56,
1034static u32 bnx2_COM_b09FwData[(0x0/4) + 1] = { 0x0 }; 1034 0xff, 0xff, 0x1f, 0x53, 0x61, 0x01, 0xa6, 0x53, 0xd0, 0x3a, 0xd6, 0xdf,
1035static u32 bnx2_COM_b09FwRodata[(0x88/4) + 1] = { 1035 0xff, 0x0f, 0x88, 0xb0, 0x30, 0xb4, 0xc0, 0xd7, 0x23, 0xe6, 0xc8, 0x83,
1036 0x08001ad8, 0x08001b14, 0x08001b14, 0x08001b14, 0x08001b14, 0x08001b14, 1036 0xca, 0xd0, 0x05, 0x40, 0x56, 0x1b, 0xbc, 0x4d, 0xc0, 0x02, 0xbe, 0xef,
1037 0x08001a24, 0x08001b14, 0x08001a98, 0x08001b14, 0x080019ac, 0x08001b14, 1037 0x79, 0x01, 0xc3, 0x2f, 0x60, 0x99, 0xf5, 0xff, 0xff, 0x52, 0xb8, 0x5a,
1038 0x08001b14, 0x08001b14, 0x080019b8, 0x0, 0x08002a2c, 0x08002a7c, 1038 0x10, 0x00, 0x00, 0x19, 0x3f, 0x16, 0x21, 0xc4, 0x7d, 0x00, 0x00, 0x00 };
1039 0x08002aac, 0x08002adc, 0x08002b0c, 0x0, 0x08005fac, 0x08005fac, 1039
1040 0x08005fac, 0x08005fac, 0x08005fac, 0x08005fd8, 0x08005fd8, 0x08006018, 1040static const u32 bnx2_COM_b09FwData[(0x0/4) + 1] = { 0x0 };
1041 0x08006024, 0x08006024, 0x08005fac, 0x0, 0x0 }; 1041static const u32 bnx2_COM_b09FwRodata[(0x88/4) + 1] = {
1042static u32 bnx2_COM_b09FwBss[(0x88/4) + 1] = { 0x0 }; 1042 0x08001b68, 0x08001ba4, 0x08001ba4, 0x08001ba4, 0x08001ba4, 0x08001ba4,
1043static u32 bnx2_COM_b09FwSbss[(0x5c/4) + 1] = { 0x0 }; 1043 0x08001ab4, 0x08001ba4, 0x08001b28, 0x08001ba4, 0x08001a3c, 0x08001ba4,
1044 0x08001ba4, 0x08001ba4, 0x08001a48, 0x00000000, 0x08002abc, 0x08002b0c,
1045 0x08002b3c, 0x08002b6c, 0x08002b9c, 0x00000000, 0x0800604c, 0x0800604c,
1046 0x0800604c, 0x0800604c, 0x0800604c, 0x08006078, 0x08006078, 0x080060b8,
1047 0x080060c4, 0x080060c4, 0x0800604c, 0x00000000, 0x00000000 };
1048static const u32 bnx2_COM_b09FwBss[(0x88/4) + 1] = { 0x0 };
1049static const u32 bnx2_COM_b09FwSbss[(0x60/4) + 1] = { 0x0 };
1044 1050
1045static struct fw_info bnx2_com_fw_09 = { 1051static struct fw_info bnx2_com_fw_09 = {
1046 .ver_major = 0x1, 1052 .ver_major = 0x3,
1047 .ver_minor = 0x0, 1053 .ver_minor = 0x4,
1048 .ver_fix = 0x0, 1054 .ver_fix = 0x3,
1049 1055
1050 .start_addr = 0x080000b0, 1056 .start_addr = 0x080000b4,
1051 1057
1052 .text_addr = 0x08000000, 1058 .text_addr = 0x08000000,
1053 .text_len = 0x7c5c, 1059 .text_len = 0x7dc0,
1054 .text_index = 0x0, 1060 .text_index = 0x0,
1055 .gz_text = bnx2_COM_b09FwText, 1061 .gz_text = bnx2_COM_b09FwText,
1056 .gz_text_len = sizeof(bnx2_COM_b09FwText), 1062 .gz_text_len = sizeof(bnx2_COM_b09FwText),
1057 1063
1058 .data_addr = 0x08007d00, 1064 .data_addr = 0x08007e60,
1059 .data_len = 0x0, 1065 .data_len = 0x0,
1060 .data_index = 0x0, 1066 .data_index = 0x0,
1061 .data = bnx2_COM_b09FwData, 1067 .data = bnx2_COM_b09FwData,
1062 1068
1063 .sbss_addr = 0x08007d00, 1069 .sbss_addr = 0x08007e60,
1064 .sbss_len = 0x5c, 1070 .sbss_len = 0x60,
1065 .sbss_index = 0x0, 1071 .sbss_index = 0x0,
1066 .sbss = bnx2_COM_b09FwSbss, 1072 .sbss = bnx2_COM_b09FwSbss,
1067 1073
1068 .bss_addr = 0x08007d60, 1074 .bss_addr = 0x08007ec0,
1069 .bss_len = 0x88, 1075 .bss_len = 0x88,
1070 .bss_index = 0x0, 1076 .bss_index = 0x0,
1071 .bss = bnx2_COM_b09FwBss, 1077 .bss = bnx2_COM_b09FwBss,
1072 1078
1073 .rodata_addr = 0x08007c60, 1079 .rodata_addr = 0x08007dc0,
1074 .rodata_len = 0x88, 1080 .rodata_len = 0x88,
1075 .rodata_index = 0x0, 1081 .rodata_index = 0x0,
1076 .rodata = bnx2_COM_b09FwRodata, 1082 .rodata = bnx2_COM_b09FwRodata,
1077}; 1083};
1078 1084
1079static u8 bnx2_CP_b09FwText[] = { 1085static u8 bnx2_CP_b09FwText[] = {
1080 0x1f, 0x8b, 0x08, 0x08, 0x8e, 0xfc, 0x2f, 0x45, 0x00, 0x03, 0x74, 0x65, 1086 0x1f, 0x8b, 0x08, 0x00, 0x0f, 0x34, 0xe7, 0x45, 0x00, 0x03, 0xbd, 0x7d,
1081 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xbd, 0x7d, 0x0d, 0x74, 1087 0x0d, 0x74, 0x5c, 0x57, 0x7d, 0xe7, 0xff, 0xdd, 0x19, 0x49, 0x63, 0x59,
1082 0x5c, 0x57, 0x7d, 0xe7, 0xff, 0xdd, 0x79, 0x92, 0xc6, 0xb2, 0x2c, 0x3f, 1088 0x96, 0x9f, 0xe5, 0x89, 0x32, 0x51, 0x84, 0x3d, 0x23, 0x3d, 0xd9, 0x22,
1083 0xcb, 0x63, 0x65, 0x22, 0x0b, 0x7b, 0x46, 0x7a, 0xb2, 0x95, 0x58, 0x64, 1089 0x12, 0xe1, 0xc5, 0x11, 0xac, 0xda, 0x2a, 0xe9, 0x30, 0x92, 0x3f, 0x12,
1084 0xc7, 0xae, 0x00, 0x6d, 0x3b, 0x85, 0xe9, 0x48, 0xb2, 0x9d, 0x0f, 0x8a, 1090 0x02, 0xab, 0x10, 0x43, 0xb3, 0x1c, 0x4a, 0xc5, 0x48, 0x4e, 0x02, 0x04,
1085 0x4c, 0x44, 0x4f, 0x5a, 0xe8, 0x22, 0xc6, 0x76, 0x48, 0x80, 0xb2, 0x4e, 1091 0xea, 0x40, 0xe8, 0x86, 0xdd, 0xec, 0x66, 0x32, 0x92, 0x3f, 0x9a, 0x8e,
1086 0x09, 0x69, 0x80, 0x04, 0x0f, 0x23, 0xf9, 0x83, 0x74, 0xec, 0x51, 0x12, 1092 0x3d, 0x93, 0x44, 0x89, 0xbd, 0xdd, 0x9c, 0xad, 0x90, 0x14, 0x3b, 0x74,
1087 0xc5, 0x76, 0x4f, 0x73, 0x58, 0x55, 0x92, 0x1d, 0x43, 0xa7, 0x1e, 0x27, 1093 0x07, 0x4f, 0xe2, 0x98, 0x96, 0x73, 0x0a, 0x8d, 0x50, 0x8c, 0x9b, 0xe6,
1088 0x71, 0x68, 0xf6, 0x6c, 0x68, 0xb4, 0x4a, 0xe2, 0xa6, 0x3d, 0xd9, 0xd6, 1094 0xb0, 0xdd, 0xd0, 0xa6, 0x34, 0xdb, 0x86, 0x22, 0x8c, 0x81, 0xf4, 0x2c,
1089 0xf4, 0x84, 0x6e, 0xda, 0x43, 0x77, 0x85, 0x71, 0x88, 0x4b, 0xb3, 0x4b, 1095 0xdd, 0x86, 0x42, 0x77, 0xd3, 0x36, 0xe5, 0xed, 0xef, 0x77, 0xef, 0x7d,
1090 0xf8, 0x68, 0x61, 0xa1, 0xe5, 0xed, 0xef, 0x77, 0xef, 0x7d, 0xd2, 0xe8, 1096 0x9a, 0x91, 0x34, 0xce, 0x07, 0xdd, 0xad, 0xcf, 0x79, 0x7e, 0xf3, 0xee,
1091 0xc3, 0x09, 0xa1, 0xbb, 0xf5, 0x39, 0xcf, 0x6f, 0xde, 0xfd, 0xfc, 0xdf, 1097 0xbb, 0x1f, 0xff, 0xfb, 0xbf, 0xff, 0xef, 0xfb, 0xbf, 0x4f, 0x97, 0x8b,
1092 0xff, 0xfd, 0x7f, 0xdf, 0x0f, 0xad, 0x17, 0xa9, 0x17, 0xfb, 0x6f, 0x15, 1098 0x34, 0x8b, 0xfd, 0xb7, 0x01, 0xd7, 0xd5, 0xc9, 0xfd, 0xe3, 0x57, 0x5f,
1093 0x9e, 0x6d, 0x89, 0x7d, 0xbb, 0xb7, 0x5e, 0xd7, 0x73, 0x1d, 0x7e, 0x6e, 1099 0x39, 0x70, 0x25, 0x9f, 0xa3, 0x91, 0x68, 0x44, 0xde, 0xc4, 0xbf, 0xe4,
1094 0x75, 0x57, 0x46, 0x95, 0xbc, 0x89, 0x7f, 0x89, 0x9f, 0xa1, 0x4c, 0x44, 1100 0x1b, 0xa8, 0x83, 0x0e, 0xdd, 0x70, 0x2c, 0x5e, 0x12, 0x53, 0x43, 0xde,
1095 0xc4, 0x0b, 0xfb, 0xe2, 0x23, 0x51, 0x95, 0x1e, 0xfc, 0x64, 0xd6, 0x97, 1101 0xfe, 0x8c, 0x27, 0xb1, 0xc8, 0x50, 0xee, 0xce, 0x71, 0x4f, 0x24, 0x5d,
1096 0x68, 0x24, 0x7d, 0xf6, 0xb3, 0xbb, 0x7d, 0x91, 0x4c, 0x79, 0x4b, 0xa2, 1102 0xee, 0x4b, 0x0e, 0xcb, 0x3f, 0x05, 0xb9, 0x78, 0x54, 0x58, 0xfe, 0x96,
1097 0x57, 0xfe, 0x25, 0xc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 0x5c, 1110 0x0d, 0xf5, 0xbc, 0x90, 0x89, 0x5c, 0x25, 0x7c, 0x7f, 0x56, 0x7a, 0xfc,
1105 0x29, 0x54, 0x2e, 0xac, 0x30, 0x6d, 0x96, 0xec, 0xfb, 0x6f, 0xa2, 0xe6, 1111 0xa7, 0x05, 0xe5, 0xe5, 0x98, 0x64, 0x2a, 0xd2, 0x82, 0x32, 0xdc, 0x9b,
1106 0x8d, 0x36, 0x4b, 0x51, 0x99, 0x8d, 0xc4, 0x05, 0xfd, 0x00, 0xe6, 0x06, 1112 0x51, 0x27, 0xe5, 0x66, 0x22, 0xae, 0xe4, 0x2b, 0x3f, 0x5e, 0x67, 0xc6,
1107 0x19, 0x2e, 0x25, 0x24, 0x5b, 0x64, 0xbf, 0xae, 0xe4, 0x3c, 0xf6, 0xd9, 1113 0x9d, 0xb3, 0xf7, 0xbf, 0x8e, 0x99, 0x3b, 0xc6, 0x2d, 0xc6, 0x64, 0x29,
1108 0x80, 0xfa, 0x2b, 0x9d, 0xe5, 0xcb, 0xb3, 0xec, 0x4b, 0x28, 0x9b, 0x40, 1114 0x92, 0x10, 0xc0, 0x82, 0x79, 0x25, 0x64, 0xb2, 0x98, 0x94, 0x4c, 0x81,
1109 0xb9, 0x56, 0x79, 0xbc, 0x12, 0x97, 0xc7, 0x2a, 0x31, 0x79, 0xb4, 0x72, 1115 0xb0, 0x45, 0x25, 0xeb, 0x12, 0xae, 0x04, 0xda, 0xb7, 0x39, 0xf5, 0xeb,
1110 0x87, 0x64, 0x50, 0xf7, 0x6c, 0x05, 0x7d, 0x97, 0x6a, 0xa5, 0x77, 0xac, 1116 0xb3, 0xee, 0x0b, 0xa8, 0x9b, 0x44, 0xbd, 0x4e, 0x79, 0x12, 0x75, 0x4f,
1111 0x5e, 0xb2, 0x63, 0xed, 0xf1, 0x9c, 0x04, 0xc1, 0x27, 0x52, 0x1f, 0x95, 1117 0x57, 0xe2, 0xf2, 0x44, 0xe5, 0x57, 0x25, 0x8d, 0xb6, 0x8f, 0x57, 0x30,
1112 0xa1, 0x26, 0x94, 0x2f, 0x31, 0x2f, 0xbe, 0x20, 0x2f, 0x97, 0xda, 0xe2, 1118 0x76, 0xb1, 0x51, 0x86, 0xa7, 0x9b, 0x25, 0x33, 0xdd, 0x9d, 0xc8, 0x4a,
1113 0xe5, 0x94, 0x23, 0x99, 0xc1, 0x64, 0x7c, 0x48, 0xf1, 0xbb, 0x46, 0xb2, 1119 0x10, 0x7c, 0xda, 0xff, 0xa8, 0x8c, 0xb5, 0xa1, 0x7e, 0x91, 0xef, 0x12,
1114 0x5d, 0xf8, 0x1e, 0x70, 0x25, 0xe2, 0x07, 0xc1, 0x1d, 0xa9, 0x26, 0xc0, 1120 0x2b, 0xde, 0x65, 0xfd, 0x3e, 0x37, 0xab, 0x1c, 0x49, 0xef, 0x4d, 0x25,
1115 0x91, 0x4c, 0x24, 0x14, 0xeb, 0xb2, 0x5e, 0x32, 0x9f, 0x50, 0x51, 0xc9, 1121 0xc6, 0x14, 0x9f, 0x1b, 0x24, 0xd3, 0x8f, 0xe7, 0xd1, 0xa8, 0x44, 0xbc,
1116 0x57, 0xae, 0x93, 0x44, 0x53, 0x10, 0xbc, 0x37, 0xe5, 0x21, 0x5d, 0xa4, 1122 0x20, 0xb8, 0xc3, 0xbf, 0x0c, 0x70, 0xa4, 0x92, 0x49, 0xc5, 0xb6, 0x6c,
1117 0xb7, 0x28, 0xfb, 0x54, 0xda, 0x47, 0x9b, 0x92, 0x52, 0xe9, 0xb5, 0x18, 1123 0x97, 0xca, 0x25, 0x55, 0x5c, 0x72, 0x95, 0x2b, 0x25, 0xd9, 0x16, 0x04,
1118 0xc7, 0x16, 0xe0, 0xa9, 0x56, 0x32, 0x31, 0xc9, 0xa8, 0xb4, 0x24, 0x54, 1124 0xef, 0xf3, 0x3b, 0x51, 0x2e, 0x32, 0x5c, 0x90, 0xfd, 0x58, 0x23, 0xf4,
1119 0x7a, 0x05, 0xd2, 0x1c, 0xa9, 0xf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0xf3, 0x9d, 0xc2, 0x3b, 0x54, 0x1d, 0xf2, 0xb1, 0x6e, 0xae, 0x1c, 0xc2,
1127 0xb9, 0x72, 0xd2, 0x9b, 0x05, 0x70, 0xbd, 0x63, 0x71, 0x8c, 0x1f, 0xe3, 1133 0xdc, 0xce, 0x4f, 0xa7, 0xdc, 0x2e, 0x85, 0xfb, 0x3c, 0x7f, 0x07, 0x41,
1128 0x88, 0x65, 0x92, 0x6b, 0xa4, 0xcb, 0xce, 0xcf, 0x5f, 0xa2, 0xef, 0x76, 1134 0xc6, 0xcf, 0xe9, 0x35, 0xfd, 0xee, 0x74, 0x02, 0xcf, 0x80, 0x3f, 0x9e,
1129 0xef, 0x0e, 0xd5, 0xee, 0xa5, 0x54, 0xd2, 0x9b, 0x90, 0x3f, 0xc4, 0x77, 1135 0x4e, 0x6d, 0x92, 0xab, 0xed, 0xba, 0x7c, 0x13, 0x63, 0x76, 0xbb, 0x77,
1130 0x10, 0xec, 0x4a, 0x25, 0xe3, 0x79, 0xcc, 0xdd, 0xa5, 0x62, 0x4c, 0x5e, 1136 0xa8, 0x6e, 0xd7, 0x57, 0x29, 0x77, 0x56, 0xce, 0xe0, 0x39, 0x08, 0x6e,
1131 0x2e, 0x26, 0x41, 0xa9, 0xc9, 0xce, 0x49, 0xd9, 0x92, 0x9a, 0x04, 0xdc, 1137 0xf4, 0x53, 0x89, 0x1c, 0xd6, 0xec, 0x42, 0x21, 0x2e, 0xdf, 0x2b, 0xa4,
1132 0x05, 0x3c, 0x07, 0x99, 0x57, 0x46, 0x5e, 0x99, 0x75, 0x83, 0xe0, 0xe6, 1138 0x40, 0xc5, 0xa9, 0xde, 0x39, 0xe9, 0xf3, 0xe7, 0x00, 0x6f, 0x1e, 0xd7,
1133 0xd4, 0x89, 0x60, 0xa8, 0xd9, 0xd0, 0xfe, 0xd3, 0x25, 0xcc, 0x2b, 0xe6, 1139 0x41, 0xbe, 0x2b, 0xe3, 0x5d, 0x99, 0x6d, 0x83, 0x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0x13, 0xe6, 0x90, 0x56, 0x21, 0x1b, 0xa6,
1156 0x28, 0x13, 0x82, 0xe0, 0xc1, 0x14, 0xe5, 0x42, 0x10, 0x3c, 0x96, 0xa2, 1162 0x3b, 0x65, 0x12, 0xb4, 0x3a, 0x2c, 0xf8, 0x3d, 0xcf, 0xb9, 0x10, 0xae,
1157 0x9c, 0x38, 0x07, 0xfe, 0xa7, 0x6c, 0x20, 0xaf, 0xae, 0x55, 0x9c, 0x83, 1163 0x0e, 0xfd, 0x7b, 0x72, 0x7a, 0x8b, 0x7e, 0xce, 0x8e, 0x76, 0x48, 0x6e,
1158 0x6c, 0x11, 0x7d, 0x40, 0x4e, 0xe4, 0xba, 0x4e, 0x40, 0x6e, 0x50, 0xae, 1164 0x3e, 0x9c, 0x33, 0xe5, 0x05, 0x65, 0x44, 0xea, 0xb0, 0x08, 0x65, 0x46,
1159 0x5c, 0xf8, 0x44, 0xd6, 0xcf, 0xc7, 0x23, 0x1a, 0x0f, 0x98, 0x6f, 0xc8, 1165 0x10, 0x3c, 0xe8, 0x53, 0x6e, 0x04, 0xc1, 0x69, 0x9f, 0x72, 0xe4, 0x0c,
1160 0xbc, 0x8c, 0x86, 0xbc, 0x4d, 0x0a, 0x5d, 0xa3, 0xb6, 0xcc, 0x65, 0x5d, 1166 0xe4, 0x03, 0x65, 0x07, 0x79, 0xd9, 0x53, 0x5c, 0xab, 0x4c, 0xa1, 0x17,
1161 0xc6, 0x5d, 0x52, 0xe6, 0x76, 0x65, 0xf8, 0xae, 0x15, 0xf3, 0xb1, 0x42, 1167 0xeb, 0xd1, 0x28, 0xd9, 0xfe, 0xe3, 0x84, 0x15, 0x72, 0xe7, 0xa5, 0x4f,
1162 0x11, 0x4f, 0x6d, 0x9b, 0xf8, 0x2d, 0xd1, 0x9a, 0xf4, 0x97, 0x90, 0x37, 1168 0x66, 0xbc, 0x5c, 0x22, 0xa2, 0xf1, 0x04, 0xca, 0x82, 0x3c, 0x4c, 0xeb,
1163 0x7d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xb7, 0x12,
1185 0x4c, 0x57, 0x2e, 0xfa, 0xc9, 0xf8, 0x8c, 0xe6, 0x89, 0x1f, 0x06, 0x7d, 1191 0x91, 0xc5, 0xb8, 0x23, 0x8b, 0x78, 0xce, 0xf8, 0x78, 0x57, 0x09, 0x79,
1186 0x68, 0x67, 0xc2, 0x4f, 0x7a, 0x7f, 0x8a, 0xef, 0xa1, 0x32, 0xed, 0x90, 1192 0x6b, 0x40, 0x0e, 0x14, 0x7d, 0x39, 0x5c, 0xbc, 0x41, 0x85, 0x7a, 0x6d,
1187 0xf9, 0xb6, 0x86, 0xd1, 0xd6, 0xa1, 0xd2, 0x2a, 0xf9, 0xb0, 0xad, 0xbf, 1193 0xa7, 0xbf, 0x5e, 0x1e, 0x73, 0x4d, 0xdf, 0xbb, 0xbd, 0x05, 0x68, 0xd4,
1188 0xdd, 0x9f, 0xee, 0x04, 0xcf, 0x79, 0xa7, 0x28, 0x23, 0x8a, 0x80, 0x6b, 1194 0xa8, 0x9c, 0xf7, 0x52, 0x89, 0x45, 0xcd, 0x13, 0xff, 0x27, 0x18, 0x41,
1189 0x10, 0xbc, 0x8d, 0xba, 0xcf, 0x69, 0x39, 0x05, 0xbb, 0xa5, 0xb8, 0x1a, 1195 0x3f, 0xb3, 0x5e, 0xca, 0xfd, 0x03, 0x3c, 0x8f, 0x95, 0x69, 0xcb, 0x54,
1190 0x72, 0xf7, 0x1f, 0x83, 0x0f, 0xc7, 0x58, 0x9e, 0x69, 0xd4, 0x25, 0x32, 1196 0xfb, 0x9a, 0x44, 0x5f, 0x87, 0x8a, 0x1b, 0xe4, 0x56, 0xdb, 0x7e, 0x97,
1191 0xaa, 0xd2, 0x90, 0x09, 0xdd, 0x94, 0x85, 0x09, 0xc8, 0x41, 0xc8, 0x96, 1197 0xb7, 0xd0, 0x0b, 0x9e, 0x73, 0x4f, 0x50, 0x86, 0x14, 0x00, 0xd7, 0x5e,
1192 0xd2, 0x4f, 0x83, 0x8c, 0x5b, 0x2d,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 0xcf, 0xdd, 0x24,
1207 0x28, 0xc9, 0x8d, 0x25, 0x4f, 0xe4, 0x25, 0x99, 0x1f, 0x07, 0x43, 0xec, 1213 0xa4, 0x81, 0x29, 0x67, 0xb8, 0xe2, 0xa4, 0x23, 0x43, 0x3d, 0x89, 0x49,
1208 0x4a, 0xb9, 0xf2, 0xde, 0x14, 0x68, 0xf7, 0x3a, 0x47, 0xb6, 0x5f, 0xe7, 1214 0x39, 0x8c, 0xdf, 0xe2, 0x46, 0x86, 0xbe, 0x84, 0xbb, 0xc1, 0xc1, 0x57,
1209 0xc2, 0xe6, 0xf1, 0xc7, 0xb7, 0x83, 0xfe, 0x31, 0xcf, 0x9a, 0x1e, 0xd4, 1215 0xb6, 0x43, 0xb6, 0x16, 0x29, 0x2f, 0x3d, 0xcc, 0x3d, 0x29, 0x67, 0x56,
1210 0x19, 0x81, 0x9d, 0x08, 0x6c, 0x9f, 0xe9, 0xea, 0x1b, 0x2e, 0xe6, 0x3e, 1216 0xd8, 0x58, 0xc4, 0x85, 0x92, 0xec, 0x74, 0xea, 0x78, 0x4e, 0x52, 0xb9,
1211 0xa6, 0xd2, 0xfb, 0x3e, 0x95, 0xed, 0xbe, 0x46, 0x72, 0x83, 0x0a, 0x38, 1217 0x19, 0x30, 0xc4, 0x8d, 0x7e, 0x54, 0xde, 0xe7, 0x83, 0x76, 0xaf, 0x74,
1212 0x6a, 0x1e, 0x82, 0x1e, 0xc4, 0xb8, 0x82, 0x00, 0xf4, 0x0c, 0x79, 0x7e, 1218 0x64, 0xd7, 0x95, 0x51, 0xd8, 0x44, 0xde, 0xcc, 0x2e, 0xc8, 0x58, 0xc8,
1213 0xf3, 0xcd, 0x91, 0x74, 0x8d, 0xf4, 0x0e, 0x36, 0xa3, 0x0e, 0xf3, 0x88, 1219 0xbe, 0x08, 0xe9, 0x41, 0x9d, 0x92, 0xb1, 0xe8, 0x10, 0xb0, 0x7d, 0xaa,
1214 0xaf, 0xaf, 0xa2, 0x9d, 0x64, 0xa2, 0x4f, 0xe4, 0x9e, 0x91, 0xee, 0x59, 1220 0x7f, 0x64, 0xb2, 0x90, 0xbd, 0x5d, 0x0d, 0xed, 0xff, 0x6c, 0x66, 0xe0,
1215 0x67, 0x78, 0xf4, 0x37, 0xc0, 0x93, 0x5b, 0x51, 0xff, 0x01, 0xd4, 0x7f, 1221 0xad, 0x92, 0xdd, 0xab, 0x80, 0xa3, 0xf6, 0x31, 0xc8, 0x4c, 0xcc, 0x2b,
1216 0xcd, 0x29, 0x8c, 0xfd, 0xc8, 0x19, 0x1e, 0xfb, 0x9e, 0x33, 0x32, 0xb6, 1222 0x08, 0x40, 0xcf, 0x90, 0xe7, 0x37, 0xdd, 0x14, 0x19, 0x6a, 0x90, 0xe1,
1217 0x61, 0x43, 0x7f, 0xcf, 0x86, 0x0d, 0xbb, 0x7b, 0x5c, 0x99, 0x00, 0x8f, 1223 0xbd, 0xed, 0x68, 0xc3, 0x77, 0xc4, 0xd7, 0x79, 0xe0, 0x33, 0x95, 0x1c,
1218 0x65, 0xbc, 0x0d, 0x1b, 0x46, 0x7a, 0xba, 0x80, 0x83, 0x2d, 0x5e, 0x9f, 1224 0x11, 0xb9, 0x7b, 0x6a, 0x60, 0xc9, 0x99, 0x2c, 0x7d, 0x10, 0x3c, 0x79,
1219 0xf8, 0xde, 0x76, 0x01, 0xff, 0xc4, 0xd8, 0x67, 0x14, 0xf9, 0x49, 0xe4, 1225 0x15, 0xda, 0x3f, 0x80, 0xf6, 0x2f, 0x3b, 0xf9, 0xe9, 0x57, 0x9c, 0xc9,
1220 0xb3, 0x7e, 0x5c, 0xe7, 0xf7, 0xca, 0x96, 0x78, 0x93, 0xb0, 0xff, 0x88, 1226 0xe9, 0xbf, 0x75, 0xa6, 0xa6, 0xb7, 0x6c, 0xd9, 0x39, 0xb8, 0x65, 0xcb,
1221 0x2d, 0x53, 0x13, 0x91, 0xfa, 0x07, 0xec, 0xfc, 0x66, 0x9c, 0x1a, 0x9f, 1227 0xf8, 0x60, 0xd4, 0xea, 0x97, 0x2d, 0x5b, 0xa6, 0x06, 0x07, 0x81, 0x83,
1222 0xe9, 0x1c, 0x0b, 0xd3, 0x39, 0xb7, 0x7f, 0x67, 0x6d, 0xd5, 0xd5, 0x48, 1228 0x3e, 0x77, 0x44, 0x3c, 0x77, 0x97, 0x80, 0x7f, 0xe2, 0x1c, 0x93, 0xfa,
1223 0xe7, 0x37, 0x71, 0x46, 0xbc, 0xd0, 0xc6, 0xa8, 0xd1, 0xb6, 0x61, 0xae, 1229 0x27, 0x85, 0xf7, 0x6c, 0xef, 0xe9, 0xf7, 0xc3, 0xd2, 0x97, 0x68, 0x13,
1224 0x48, 0x9a, 0x71, 0x65, 0x4f, 0xd1, 0x41, 0x1d, 0xd0, 0xc5, 0x19, 0xfb, 1230 0x8e, 0x1f, 0xb1, 0x75, 0xda, 0x01, 0xfb, 0x03, 0x76, 0x7d, 0x0b, 0xaa,
1225 0x1c, 0x05, 0x6c, 0x83, 0x68, 0xeb, 0xe8, 0x21, 0xd4, 0xa3, 0xcc, 0x48, 1231 0xc1, 0x63, 0x39, 0xe7, 0xc2, 0x72, 0xae, 0xed, 0x8f, 0xac, 0x2d, 0xbb,
1226 0x76, 0x8a, 0xfa, 0x00, 0xca, 0x6c, 0xf1, 0xd6, 0x0a, 0x6d, 0x89, 0x3b, 1232 0x11, 0xe5, 0x7c, 0x26, 0xce, 0x88, 0x17, 0xda, 0x22, 0x0d, 0xda, 0x76,
1227 0x25, 0x57, 0x22, 0x7f, 0x77, 0x00, 0x9e, 0xa8, 0x24, 0x9a, 0xf1, 0x5d, 1233 0xcc, 0x16, 0x48, 0x33, 0x51, 0x99, 0x28, 0xb4, 0xa1, 0x0d, 0xe8, 0xe2,
1228 0x81, 0x4d, 0xf1, 0x60, 0x8d, 0x58, 0xdb, 0x45, 0xe6, 0x6d, 0x91, 0x3b, 1234 0x94, 0xbd, 0x8e, 0x02, 0xb6, 0xbd, 0xe8, 0xeb, 0xe8, 0x21, 0xb4, 0xa3,
1229 0x94, 0xc0, 0xde, 0x18, 0x9a, 0x5c, 0x8f, 0x72, 0x0e, 0xf0, 0x42, 0xfb, 1235 0xcc, 0x48, 0xf5, 0x8a, 0xfa, 0x04, 0xea, 0xf4, 0xb9, 0x9b, 0x85, 0x36,
1230 0x03, 0xb4, 0x36, 0x99, 0x91, 0xec, 0x26, 0xf0, 0xc9, 0xa4, 0x87, 0x6f, 1236 0xc7, 0x71, 0xc9, 0x16, 0xc9, 0xdf, 0x3d, 0x80, 0x27, 0x26, 0xc9, 0x76,
1231 0xc0, 0x35, 0xf9, 0x16, 0xbc, 0x23, 0xfa, 0xdb, 0xc0, 0x09, 0xbc, 0xa6, 1237 0x3c, 0x57, 0x0e, 0xc0, 0x0e, 0x69, 0xb0, 0x3a, 0x33, 0x94, 0x17, 0xfc,
1232 0x22, 0x56, 0x67, 0x75, 0xa1, 0xef, 0xf7, 0x48, 0x76, 0x34, 0x4e, 0x5b, 1238 0x77, 0x87, 0x12, 0xef, 0x80, 0x8c, 0xcd, 0x5d, 0x8e, 0x7a, 0x0e, 0xf0,
1233 0x62, 0x75, 0xd6, 0xcf, 0x40, 0xd7, 0x2b, 0x28, 0x41, 0x8c, 0x61, 0xd2, 1239 0x42, 0x3b, 0x05, 0x36, 0xcb, 0x5c, 0x5a, 0x32, 0xdb, 0xee, 0xc5, 0xdd,
1234 0x81, 0x3c, 0xa9, 0x95, 0xdd, 0x8f, 0xe0, 0xf7, 0x83, 0xc6, 0xe6, 0xdd, 1240 0xc5, 0x73, 0x1e, 0xf7, 0xb7, 0xe0, 0x3e, 0x89, 0x7b, 0x08, 0x27, 0xf0,
1235 0x3d, 0xc9, 0x7e, 0x1a, 0x00, 0x13, 0x6c, 0x90, 0x47, 0x60, 0x9b, 0x3e, 1241 0xea, 0x47, 0xac, 0xce, 0xba, 0x06, 0x63, 0xff, 0x6b, 0xc9, 0x94, 0x12,
1236 0x02, 0x1b, 0xe4, 0x91, 0x66, 0x3c, 0x1c, 0x1b, 0xdb, 0x9f, 0x59, 0x03, 1242 0xb4, 0x39, 0x36, 0x66, 0xbc, 0xb4, 0xab, 0x44, 0x6d, 0x56, 0x32, 0x85,
1237 0x31, 0xa9, 0xbf, 0x73, 0xa4, 0x57, 0xd8, 0xea, 0xb9, 0x62, 0xca, 0x94, 1243 0xfa, 0xf0, 0x09, 0xbc, 0x83, 0x32, 0x7e, 0x12, 0xbf, 0x1f, 0xa4, 0x4d,
1238 0x2f, 0x76, 0xeb, 0xb7, 0xa1, 0xeb, 0x1e, 0xfb, 0x3b, 0xae, 0xf9, 0x3a, 1244 0x3c, 0x25, 0xe3, 0x73, 0x1c, 0xa7, 0x00, 0x98, 0x4a, 0x92, 0x3d, 0xf9,
1239 0xdf, 0x04, 0x9a, 0xaf, 0x74, 0x69, 0x99, 0x93, 0xf5, 0xf1, 0x86, 0xcd, 1245 0x00, 0xae, 0x69, 0x5c, 0x0f, 0xe3, 0xe2, 0xdc, 0xd8, 0xff, 0xe2, 0x26,
1240 0x99, 0x69, 0xe2, 0x18, 0xe3, 0x36, 0x2d, 0xae, 0xd3, 0x12, 0x4d, 0xd6, 1246 0x05, 0x5c, 0xf3, 0x39, 0x4b, 0x3a, 0xae, 0xe0, 0x37, 0x69, 0xb8, 0x42,
1241 0xde, 0x28, 0x59, 0x5b, 0x03, 0xb8, 0x19, 0x6a, 0x06, 0xc4, 0x94, 0xcf, 1247 0xdb, 0x06, 0xf4, 0x5b, 0x09, 0xe9, 0xda, 0xb7, 0xbf, 0x13, 0x9a, 0xaf,
1242 0x12, 0xe2, 0x93, 0x32, 0x00, 0xf4, 0x0b, 0x9b, 0xe2, 0xdc, 0x15, 0xe5, 1248 0x73, 0x6d, 0xa0, 0x99, 0xca, 0xa0, 0x96, 0x39, 0x19, 0x0f, 0xf7, 0x0a,
1243 0xdf, 0xac, 0xb6, 0xb1, 0xce, 0x56, 0x48, 0xc7, 0xa4, 0xed, 0x20, 0xb8, 1249 0x6c, 0x8f, 0x36, 0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3, 0x94, 0xc8,
1251 0x0b, 0xde, 0x28, 0x5b, 0xca, 0xc8, 0x6e, 0x6d, 0x87, 0x45, 0xe4, 0x57, 1257 0x6c, 0x81, 0xb8, 0x09, 0xed, 0x3f, 0xae, 0x33, 0xf1, 0xf3, 0x38, 0xe6,
1252 0xb4, 0x6c, 0xfb, 0x02, 0xe6, 0xb2, 0x48, 0xfa, 0x95, 0x7c, 0x2c, 0x02, 1258 0xcc, 0xfb, 0x19, 0x8b, 0xa7, 0x2f, 0x59, 0x3c, 0x7d, 0xd9, 0xde, 0x5d,
1253 0x9c, 0x14, 0xf0, 0xfb, 0x4e, 0xd7, 0xd0, 0x2a, 0x71, 0xb2, 0xc0, 0x57, 1259 0x27, 0xab, 0x6d, 0xc1, 0x05, 0x3c, 0x73, 0x7d, 0xa2, 0x1a, 0x67, 0xd9,
1254 0xaa, 0x82, 0x29, 0x66, 0xe5, 0x5c, 0x42, 0xdb, 0xfa, 0xb9, 0xe2, 0x07, 1260 0xc2, 0x0c, 0xee, 0xa8, 0x5b, 0x7c, 0x5c, 0xc6, 0xb5, 0x9d, 0x16, 0x91,
1255 0x34, 0x5c, 0xb7, 0x42, 0xde, 0xe5, 0x45, 0x35, 0x43, 0x37, 0x80, 0x16, 1261 0x77, 0x69, 0xd9, 0x06, 0x21, 0xdd, 0x5c, 0x00, 0xcc, 0x0d, 0x92, 0x8b,
1256 0x54, 0x0c, 0x9a, 0x2b, 0x78, 0x06, 0x7a, 0x29, 0x37, 0x49, 0xdb, 0xb8, 1262 0x47, 0xf4, 0xda, 0x47, 0xbd, 0x03, 0x51, 0x43, 0xab, 0xc4, 0xc9, 0x0a,
1257 0x8d, 0x7e, 0x49, 0x34, 0xd7, 0xd5, 0x48, 0x3a, 0x52, 0x0a, 0xf6, 0x17, 1263 0x5f, 0xaa, 0x06, 0xa6, 0xb8, 0x95, 0x73, 0x84, 0x8b, 0xb4, 0xfb, 0x88,
1258 0xbe, 0x55, 0xae, 0x4b, 0xd3, 0x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x98, 0x96, 1271 0xcf, 0x51, 0x7b, 0x77, 0xed, 0x3d, 0x69, 0xef, 0xb9, 0xe8, 0x00, 0xef,
1266 0x5b, 0x2b, 0xc4, 0xdb, 0xef, 0x02, 0x7f, 0x60, 0xe2, 0x7a, 0xea, 0x74, 1272 0x8e, 0x44, 0x87, 0x78, 0xc7, 0x1a, 0x0e, 0xb1, 0x0f, 0xcd, 0x57, 0x56,
1267 0xca, 0xdd, 0x3b, 0x61, 0xf7, 0xa2, 0x7c, 0x91, 0x38, 0x1f, 0xd2, 0x73, 1273 0xce, 0xf4, 0xb8, 0x79, 0x21, 0x5f, 0xfd, 0xa9, 0xdc, 0x32, 0x67, 0xe4,
1268 0x53, 0x28, 0xee, 0xd1, 0x73, 0x73, 0xb0, 0x38, 0x03, 0xfc, 0xdc, 0x06, 1274 0xef, 0x2e, 0xc8, 0x20, 0xf8, 0x6f, 0xee, 0xa2, 0x00, 0xfe, 0xbd, 0x65,
1269 0xba, 0x0f, 0x82, 0x99, 0x54, 0x01, 0x94, 0xf3, 0x11, 0xfc, 0x86, 0x1d, 1275 0xb9, 0xa5, 0x42, 0xbc, 0xfd, 0x06, 0xf0, 0xb7, 0x35, 0x4a, 0xde, 0x74,
1270 0x50, 0xfc, 0x18, 0xf2, 0x1b, 0xa5, 0x30, 0x4a, 0x9e, 0x73, 0x2d, 0x0f, 1276 0x85, 0x72, 0xf7, 0x4e, 0xd1, 0xf6, 0x69, 0x81, 0x38, 0x3f, 0x2b, 0x5c,
1271 0xbf, 0x13, 0xfc, 0x14, 0x45, 0xbb, 0x48, 0xeb, 0xe6, 0xef, 0x9f, 0x20, 1277 0x9b, 0x7c, 0xe1, 0x19, 0xbd, 0x36, 0x07, 0x0b, 0x8b, 0xc0, 0xcf, 0xd7,
1272 0x0f, 0xef, 0x49, 0x4c, 0x62, 0x33, 0x6d, 0x1d, 0xf6, 0xcd, 0xb9, 0xe3, 1278 0x41, 0xf7, 0x41, 0xb0, 0xe8, 0xe7, 0x41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, 0xe5, 0xe4, 0x2a, 0xa0, 0xe9, 1293 0xe4, 0x39, 0xf4, 0xf5, 0x43, 0x67, 0xa2, 0xf2, 0x32, 0xae, 0x9f, 0xe0,
1288 0xd2, 0x00, 0xfa, 0xde, 0xa3, 0x79, 0xa6, 0x0f, 0x32, 0x3f, 0x07, 0x19, 1294 0x7a, 0x15, 0xd7, 0x2b, 0xe8, 0xf7, 0x45, 0x94, 0xaf, 0x97, 0x05, 0xb7,
1289 0x37, 0xa4, 0x61, 0x6a, 0x07, 0x7c, 0x79, 0xcc, 0x05, 0xde, 0x93, 0xb5, 1295 0x19, 0xf5, 0x45, 0x8d, 0x57, 0x5e, 0x70, 0xc6, 0x4e, 0xbe, 0x84, 0x2b,
1290 0x32, 0x1b, 0xa3, 0x1d, 0x79, 0x93, 0x2e, 0x9f, 0x2b, 0x35, 0x69, 0xbb, 1296 0xaa, 0x26, 0x2a, 0xcf, 0x3b, 0xd9, 0xb9, 0x60, 0xe3, 0xa2, 0x47, 0x19,
1291 0x7a, 0x7c, 0x09, 0xff, 0xd0, 0xef, 0x0a, 0xe5, 0x81, 0x91, 0xc6, 0x13, 1297 0xf6, 0xa7, 0x8e, 0xe9, 0x7b, 0x08, 0x73, 0x00, 0x4d, 0x17, 0x17, 0x30,
1292 0x45, 0xca, 0x02, 0xe8, 0x9f, 0xe2, 0x08, 0xde, 0xb5, 0x5a, 0x26, 0x14, 1298 0xf6, 0x33, 0x9a, 0x67, 0x46, 0x20, 0xf3, 0xb3, 0xb0, 0x4b, 0xc6, 0x34,
1293 0x24, 0x94, 0x07, 0xac, 0x47, 0x99, 0x50, 0x2d, 0x77, 0x28, 0x6b, 0x28, 1299 0x4c, 0x97, 0x03, 0x3e, 0xf8, 0xba, 0x03, 0xb8, 0xcf, 0x35, 0xca, 0x52,
1294 0x7b, 0x28, 0x4b, 0xcc, 0x7c, 0xec, 0x7e, 0x90, 0x32, 0x1c, 0xb4, 0x10, 1300 0x9c, 0x76, 0xe4, 0x97, 0x75, 0xfd, 0x6c, 0xb1, 0x5b, 0xe3, 0x76, 0x66,
1295 0xa3, 0xfd, 0xe1, 0x19, 0x1f, 0x64, 0xec, 0x3e, 0x2b, 0x4f, 0x47, 0xf5, 1301 0x0d, 0xff, 0xd0, 0x3f, 0x0b, 0xe5, 0x81, 0x91, 0xc6, 0xb3, 0x05, 0xca,
1296 0x5c, 0xec, 0x29, 0xaa, 0x98, 0x2b, 0xa7, 0x91, 0x86, 0xe7, 0xf8, 0xc3, 1302 0x02, 0xe8, 0x9f, 0xc2, 0x14, 0xee, 0x8d, 0x5a, 0x26, 0xe4, 0x25, 0x94,
1297 0x78, 0x7f, 0x49, 0xf6, 0xe0, 0xc9, 0x1d, 0xff, 0x02, 0x7e, 0x73, 0x6e, 1303 0x07, 0x6c, 0x47, 0x99, 0x50, 0x2b, 0x77, 0x28, 0x6b, 0x28, 0x7b, 0x28,
1298 0xca, 0x28, 0x87, 0xa7, 0x74, 0x02, 0x6f, 0x3c, 0xa5, 0x31, 0x2b, 0x47, 1304 0x4b, 0xcc, 0x7a, 0x8c, 0x3f, 0x48, 0x19, 0x7e, 0x2d, 0xfc, 0x53, 0xda,
1299 0xc6, 0xad, 0x1c, 0xe1, 0x9c, 0xde, 0x04, 0x3c, 0x70, 0x7c, 0x4a, 0xc7, 1305 0x1f, 0x9d, 0xc6, 0x07, 0x99, 0xce, 0x28, 0x23, 0x4f, 0xf7, 0xe8, 0xb5,
1300 0x17, 0xc0, 0xcf, 0x4e, 0x6e, 0xf2, 0x5d, 0xd6, 0x8f, 0x6d, 0x14, 0xc3, 1306 0x98, 0x28, 0xa8, 0x38, 0x20, 0x47, 0x19, 0xae, 0x63, 0x7b, 0x71, 0xcf,
1301 0x83, 0x78, 0x3a, 0xc9, 0xcf, 0x0d, 0xda, 0x0e, 0xce, 0x69, 0xda, 0xfd, 1307 0xaa, 0x09, 0x5c, 0xd9, 0x63, 0x1f, 0xc0, 0x6f, 0xae, 0xcd, 0x04, 0xea,
1302 0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0xe5, 0x3e, 0x20, 0x2b, 0xe3, 0x31, 0x39, 0x59, 0x68, 0x91,
1317 0x44, 0xbd, 0x90, 0xfe, 0xa2, 0x9a, 0xd6, 0x72, 0x92, 0x77, 0xb6, 0x57, 1323 0xb9, 0x82, 0x82, 0xc1, 0x60, 0x64, 0x67, 0x44, 0x12, 0x5a, 0xff, 0xd2,
1318 0x46, 0x9c, 0x1d, 0x95, 0xc5, 0x3a, 0x68, 0x8b, 0xe7, 0x8a, 0x81, 0xf5, 1324 0xbe, 0x1b, 0x9e, 0x8e, 0x58, 0xba, 0x83, 0xc3, 0xd2, 0xfc, 0x1b, 0xd0,
1319 0x91, 0x22, 0x6d, 0xd4, 0x64, 0x2a, 0x0b, 0x9c, 0xec, 0x00, 0xcc, 0xcf, 1325 0xb1, 0x65, 0xe8, 0xd8, 0x56, 0xe8, 0xe0, 0xd5, 0x32, 0xa2, 0xab, 0x61,
1320 0x8c, 0xc2, 0x4f, 0xa7, 0x5c, 0x06, 0xcc, 0xa7, 0x01, 0xf3, 0xc4, 0xa8, 1326 0xad, 0x8c, 0x60, 0x9b, 0x14, 0xbc, 0xf2, 0x83, 0x68, 0x17, 0xd2, 0x5f,
1321 0x13, 0xda, 0x06, 0xc2, 0xa0, 0xc8, 0xc4, 0x58, 0x97, 0xcc, 0x4c, 0x91, 1327 0x4c, 0xd3, 0x5a, 0x56, 0x72, 0xce, 0xae, 0xca, 0x94, 0xb3, 0xbb, 0xb2,
1322 0x0e, 0x21, 0x03, 0x46, 0x31, 0x9f, 0xa9, 0x15, 0xb0, 0x03, 0xd8, 0x3f, 1328 0x5a, 0x07, 0xf5, 0xb9, 0x51, 0x31, 0xb0, 0x9e, 0xd4, 0x71, 0xbc, 0x94,
1323 0xe4, 0xf6, 0x58, 0x8b, 0xce, 0x33, 0xfa, 0xbc, 0x55, 0x66, 0xca, 0x69, 1329 0x9f, 0x01, 0x4e, 0x76, 0x83, 0xee, 0x9e, 0x2e, 0xc1, 0x8f, 0xa7,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e, 1344 0xd0, 0x87, 0x94, 0x37, 0x37, 0x1b, 0xdf, 0x5c, 0x4e, 0x00, 0xd6, 0xf0,
1339 0x33, 0x77, 0x8d, 0x73, 0x73, 0x37, 0x50, 0x59, 0x3c, 0x46, 0x91, 0xb6, 1345 0x99, 0xb4, 0xc9, 0xdf, 0x94, 0x49, 0x55, 0x5a, 0x34, 0xbe, 0x4b, 0xa7,
1340 0x07, 0x58, 0xcf, 0x85, 0x8d, 0x94, 0x92, 0x5a, 0x9f, 0xf2, 0x93, 0xb6, 1346 0x8e, 0x9f, 0x56, 0xed, 0xf5, 0xa8, 0x8c, 0x9a, 0x35, 0x3f, 0xcc, 0x35,
1341 0x12, 0xd2, 0x27, 0xb6, 0x78, 0x4d, 0xf0, 0x01, 0x9e, 0x5e, 0x62, 0x77, 1347 0xa7, 0x2f, 0xd2, 0xfd, 0xc0, 0xa8, 0xe5, 0xaf, 0x54, 0x29, 0x27, 0xbb,
1342 0x25, 0xac, 0xdc, 0xa4, 0x1f, 0x1c, 0xf6, 0x91, 0xb7, 0x72, 0x32, 0x8f, 1348 0xed, 0xdc, 0xbf, 0x5c, 0x67, 0xed, 0x5a, 0x97, 0xd7, 0x6e, 0xb4, 0xb2,
1343 0xf6, 0x47, 0x9c, 0xfe, 0xca, 0x72, 0xf2, 0x32, 0x94, 0x93, 0x1c, 0x8f, 1349 0x7a, 0x8e, 0x22, 0x5d, 0x0f, 0x44, 0xb5, 0x6f, 0x2b, 0xca, 0x97, 0x46,
1344 0x23, 0x77, 0x3c, 0x48, 0x1e, 0x7d, 0xbf, 0xb6, 0xaf, 0xb7, 0x6e, 0xab, 1350 0x8f, 0xf2, 0x93, 0xb6, 0x12, 0xca, 0x67, 0xfb, 0xdc, 0x36, 0xd0, 0xdb,
1345 0x01, 0xfe, 0x08, 0xc7, 0xcc, 0x1a, 0xa2, 0x33, 0xf7, 0x08, 0x6c, 0x22, 1351 0x53, 0x6b, 0xec, 0xae, 0xa4, 0x95, 0x9b, 0x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ef, 0x52, 0x59, 0x56, 0xad, 0x7b, 0xae, 0x9e, 0xc3, 0x5f, 1359 0x68, 0xa7, 0xae, 0x9e, 0xdf, 0x6a, 0xff, 0x91, 0x70, 0x12, 0x6e, 0x43,
1354 0xff, 0x82, 0x39, 0x0a, 0xf1, 0x17, 0xd2, 0x45, 0x35, 0x0e, 0x49, 0x13, 1360 0x5b, 0x49, 0x45, 0xd8, 0x02, 0x19, 0xf5, 0xaf, 0xd5, 0x6b, 0xa0, 0x68,
1355 0x86, 0x16, 0x0c, 0x2d, 0x6e, 0xb4, 0xfa, 0x26, 0xa4, 0xbd, 0xab, 0x40, 1361 0xbb, 0xee, 0xf8, 0x76, 0x83, 0x89, 0x31, 0x27, 0xd1, 0x3f, 0xc7, 0x24,
1356 0x7b, 0xf7, 0x81, 0xc6, 0x28, 0xc3, 0x19, 0x97, 0x5b, 0x8b, 0xef, 0x23, 1362 0xff, 0xf1, 0x4e, 0x3b, 0xbf, 0x9e, 0x2c, 0xab, 0xd5, 0x3d, 0x97, 0x2d,
1357 0xf8, 0x0e, 0xf9, 0xe4, 0x4a, 0x32, 0x9c, 0xf2, 0x9b, 0x75, 0xb2, 0x56, 1363 0xe3, 0x6f, 0xe7, 0x8a, 0x35, 0x0a, 0xf1, 0x17, 0xd2, 0x45, 0x2d, 0x0e,
1358 0xee, 0x87, 0x7e, 0x2e, 0xeb, 0x70, 0xdc, 0x94, 0xff, 0xff, 0x15, 0xed, 1364 0x49, 0x13, 0xa4, 0x85, 0x90, 0x16, 0xb7, 0x5a, 0x7d, 0x13, 0xd2, 0xde,
1359 0xac, 0xad, 0x35, 0xf6, 0xca, 0x8d, 0xb5, 0x94, 0xaf, 0x6b, 0xe4, 0x60, 1365 0xa5, 0xa0, 0xbd, 0xfb, 0x80, 0x27, 0xca, 0x70, 0xc6, 0xed, 0x36, 0xe3,
1360 0x55, 0xda, 0x95, 0xe4, 0x77, 0xf5, 0x98, 0xd7, 0xff, 0x3f, 0x18, 0x73, 1366 0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34, 0xc5, 1388 0xee, 0x8f, 0x71, 0x0d, 0xfc, 0xa4, 0x7a, 0x45, 0xaf, 0x4b, 0xdb, 0x8a,
1383 0xb7, 0x67, 0x75, 0x0d, 0x69, 0x8b, 0x32, 0x38, 0xa4, 0x87, 0x8d, 0xaf, 1389 0xb2, 0xd7, 0x92, 0x55, 0xa1, 0x7e, 0xda, 0x60, 0xe3, 0x46, 0x94, 0xb7,
1384 0x23, 0x7f, 0xaf, 0x48, 0x4f, 0xfb, 0xb9, 0x2e, 0xb3, 0xbb, 0x5b, 0x56, 1390 0xaf, 0x45, 0x5b, 0xa4, 0x11, 0x17, 0x78, 0x26, 0xfe, 0x48, 0x5b, 0xb5,
1385 0x33, 0x1e, 0x90, 0xad, 0xcc, 0xc7, 0x04, 0x94, 0x5f, 0x1d, 0x13, 0xa0, 1391 0xf3, 0xdf, 0xd4, 0x24, 0x5e, 0x67, 0x93, 0x34, 0xdf, 0x0b, 0xf9, 0x5a,
1386 0x9f, 0xf5, 0x01, 0xe0, 0xec, 0x16, 0x3c, 0xfb, 0x64, 0x88, 0x71, 0x87, 1392 0x4b, 0x53, 0xbc, 0xbb, 0x56, 0xd7, 0x90, 0xb6, 0x28, 0x83, 0x43, 0x7a,
1387 0x4a, 0x68, 0x97, 0x7f, 0xd5, 0xda, 0xe5, 0x21, 0x1c, 0x09, 0xc0, 0x61, 1393 0xd8, 0xfa, 0x1a, 0xf2, 0xf7, 0xa2, 0xf4, 0x74, 0x4f, 0x64, 0x28, 0x08,
1388 0xe4, 0xf3, 0x52, 0x3d, 0xb7, 0x50, 0x7f, 0xe7, 0xe7, 0x6c, 0xda, 0x84, 1394 0xc6, 0x07, 0x64, 0x23, 0xe3, 0x01, 0x99, 0x4a, 0x35, 0x26, 0xa0, 0xbc,
1389 0xec, 0x2a, 0x71, 0xdc, 0x94, 0xc1, 0xc4, 0x4d, 0xb5, 0x0c, 0x8e, 0x5b, 1395 0xda, 0x98, 0x00, 0xfd, 0xac, 0x47, 0x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 0x29, 0xbf, 0x11, 0xdf, 0xdd, 0xd2, 0x56, 1432 0x19, 0x27, 0xbd, 0x98, 0xed, 0x68, 0xe4, 0x53, 0x83, 0x96, 0x4f, 0xad,
1427 0x56, 0x72, 0xfb, 0x58, 0x83, 0xec, 0x2b, 0xba, 0xf2, 0x51, 0xd4, 0xff, 1433 0x63, 0xcc, 0x35, 0xa8, 0xca, 0xec, 0x01, 0xe8, 0x0a, 0xda, 0xd8, 0x5a,
1428 0x48, 0xd1, 0x83, 0x3f, 0x3e, 0x1e, 0xa5, 0x5d, 0xb8, 0xb7, 0xc8, 0xf5, 1434 0x4e, 0xe3, 0x5d, 0x67, 0x32, 0x53, 0x78, 0x35, 0x88, 0x78, 0x8c, 0x0f,
1429 0x49, 0xc7, 0xac, 0x19, 0x2d, 0x58, 0xf3, 0x8c, 0x48, 0x5b, 0x47, 0x01, 1435 0x71, 0x5f, 0x40, 0xc6, 0x1c, 0x94, 0x75, 0x95, 0xcd, 0xbc, 0x94, 0xd7,
1430 0x9e, 0x8a, 0xb8, 0x3b, 0x01, 0x47, 0x5d, 0x3a, 0x2d, 0xaf, 0x74, 0x0f, 1436 0x8a, 0xe7, 0x01, 0xe9, 0x2a, 0x2b, 0xf9, 0xe8, 0x74, 0x8b, 0xec, 0x2f,
1431 0x38, 0xda, 0x97, 0x70, 0x7a, 0xe4, 0xc6, 0x4a, 0x5a, 0x6e, 0xa8, 0x98, 1437 0x44, 0xe5, 0xe3, 0x68, 0xff, 0xb1, 0x82, 0x0b, 0x7f, 0xfc, 0x4c, 0x8c,
1432 0x75, 0xd2, 0xf9, 0x75, 0xd0, 0xa4, 0x37, 0x0d, 0x9d, 0x93, 0xf1, 0x82, 1438 0x76, 0xe1, 0xbe, 0x02, 0xf7, 0x27, 0x59, 0x37, 0xbe, 0x6a, 0x7f, 0x36,
1433 0xe0, 0x3c, 0xe4, 0xb7, 0x3a, 0xe2, 0x4a, 0xb4, 0x23, 0x19, 0x9f, 0x16, 1439 0x22, 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0x1b, 0xfc, 0x38,
1441 0xd5, 0xfd, 0x73, 0xed, 0x57, 0x14, 0x70, 0xe8, 0xee, 0xd8, 0xdc, 0x23, 1447 0x48, 0xee, 0xae, 0xb7, 0x81, 0x6e, 0xe2, 0xd0, 0xf9, 0x57, 0x01, 0xc6,
1442 0x7d, 0x18, 0x5f, 0xff, 0x92, 0xf1, 0xed, 0x17, 0xc6, 0x54, 0x2f, 0x16, 1448 0xab, 0x18, 0xfb, 0x62, 0xcc, 0x8b, 0xcf, 0x5f, 0xc7, 0xb8, 0x6c, 0xfb,
1443 0x39, 0x86, 0xf9, 0x71, 0xa9, 0x3f, 0x32, 0xe3, 0x8a, 0x76, 0x2c, 0x1e, 1449 0x1b, 0xd6, 0x5e, 0xe6, 0xfa, 0x1b, 0xde, 0xa9, 0xaf, 0x77, 0x5a, 0xc7,
1444 0x8f, 0xae, 0xaf, 0x4e, 0x01, 0x96, 0xe7, 0xf4, 0x1e, 0x81, 0x20, 0xb8, 1450 0x62, 0x43, 0xe2, 0xc4, 0xde, 0x91, 0x90, 0x75, 0x5e, 0xed, 0xf8, 0xdc,
1445 0xa6, 0xe3, 0x62, 0x90, 0x58, 0x97, 0xec, 0x9c, 0x9e, 0x5f, 0xd3, 0x19, 1451 0x27, 0x86, 0xc5, 0x38, 0x20, 0xd1, 0xdd, 0xdb, 0x07, 0x65, 0x04, 0xf3,
1446 0x8a, 0xa4, 0x33, 0x1a, 0xff, 0xf8, 0x4e, 0xe4, 0xca, 0xdd, 0x98, 0x3b, 1452 0xdb, 0xb9, 0x66, 0x7e, 0xf7, 0x08, 0xe3, 0xab, 0xe7, 0x0b, 0x9c, 0x43,
1447 0x71, 0x73, 0x5d, 0xae, 0xe6, 0x8d, 0x9c, 0xdf, 0x6d, 0xd7, 0xad, 0x42, 1453 0x75, 0x5e, 0xea, 0x0b, 0x66, 0x5e, 0xb1, 0x9e, 0xd5, 0xf3, 0xd1, 0xed,
1448 0xbf, 0x29, 0x08, 0x94, 0xbf,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1461 0x8c, 0x6c, 0x00, 0x2d, 0xf7, 0xe4, 0x94, 0x22, 0x6f, 0xba, 0xc9, 0xc9,
1456 0x55, 0x68, 0x27, 0x72, 0x4d, 0x27, 0x79, 0x62, 0x5c, 0x08, 0x47, 0x10, 1462 0x72, 0x3c, 0x59, 0x2a, 0x7f, 0x96, 0xed, 0x51, 0xb7, 0x5e, 0x2c, 0xcf,
1457 0x5c, 0x48, 0x19, 0x7d, 0xfd, 0x74, 0x85, 0xeb, 0x1a, 0x41, 0xf0, 0x5d, 1463 0xc8, 0x86, 0xa7, 0x2a, 0x1c, 0x83, 0xfe, 0xef, 0x1b, 0x19, 0x23, 0x6a,
1458 0xda, 0xc2, 0x83, 0x25, 0xf4, 0x17, 0xe2, 0x60, 0x63, 0xde, 0x85, 0x2c, 1464 0xfb, 0x66, 0x9f, 0x21, 0x5e, 0xa2, 0x74, 0xc9, 0xf1, 0x2f, 0x6d, 0x7d,
1459 0x1c, 0xe9, 0x26, 0x7e, 0x05, 0x5e, 0x69, 0x87, 0xb7, 0x4b, 0xa2, 0x89, 1465 0x13, 0xce, 0xef, 0xb3, 0x16, 0xee, 0xd5, 0xe3, 0xbe, 0xa0, 0xed, 0x97,
1460 0xdf, 0x2e, 0x37, 0x24, 0x3e, 0x51, 0xf6, 0x80, 0x67, 0x8e, 0x3b, 0x96, 1466 0xd3, 0x15, 0xda, 0x8c, 0xdc, 0xdf, 0x49, 0x1d, 0x9f, 0x11, 0xc2, 0x11,
1461 0xd8, 0x63, 0xc7, 0xcc, 0xfd, 0x20, 0xaf, 0xbf, 0x4f, 0xe3, 0xa5, 0x05, 1467 0x04, 0xcf, 0xf9, 0x46, 0x77, 0x3f, 0x55, 0xe1, 0x1e, 0x47, 0x10, 0xfc,
1462 0x3e, 0x12, 0x61, 0x9a, 0x87, 0x85, 0xb0, 0x25, 0x2c, 0x6e, 0x82, 0xe0, 1468 0x88, 0x76, 0xf1, 0xde, 0x22, 0xc6, 0x0b, 0x71, 0xb0, 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 0x7c, 0x27, 0xf4, 0x03, 0xd2, 0x1a, 0xe9, 0x63, 0x27, 1476 0xc3, 0x35, 0xef, 0xb5, 0x36, 0x5e, 0xf8, 0xac, 0x11, 0xd9, 0xae, 0xbc,
1471 0xb2, 0x91, 0x64, 0x62, 0x58, 0xb8, 0xc7, 0x89, 0xfb, 0x13, 0xb8, 0xef, 1477 0x7e, 0xd0, 0xd7, 0xe2, 0xa6, 0xa8, 0xfc, 0x22, 0xe4, 0x6e, 0x20, 0x8f,
1472 0x87, 0xf2, 0xc0, 0x85, 0x9c, 0xe3, 0x1c, 0x9a, 0xfe, 0x86, 0xcb, 0xf3, 1478 0x42, 0x9e, 0x2d, 0x6a, 0xba, 0xc9, 0x5c, 0xce, 0xff, 0x23, 0xf2, 0xeb,
1473 0x65, 0x0f, 0x08, 0xd7, 0x09, 0x93, 0xf1, 0xbd, 0xda, 0x26, 0x01, 0xd5, 1479 0xeb, 0x18, 0x5f, 0x1e, 0xf6, 0x68, 0xbb, 0x2e, 0x05, 0x8b, 0x1e, 0xe5,
1474 0x15, 0x59, 0x76, 0x33, 0x2c, 0x12, 0xbf, 0xaa, 0xbc, 0xde, 0x73, 0x05, 1480 0xf3, 0x06, 0x99, 0x71, 0x73, 0xbd, 0xd0, 0x15, 0x28, 0x6b, 0xa5, 0xbf,
1475 0x3e, 0x67, 0x1c, 0x21, 0x1a, 0xcd, 0x16, 0xe5, 0xb5, 0x48, 0xb7, 0xbc, 1481 0x9d, 0xcc, 0x44, 0x52, 0xc9, 0x49, 0x61, 0x3e, 0x14, 0x73, 0x15, 0x98,
1476 0x96, 0x4d, 0xd5, 0x4b, 0xaf, 0x96, 0xf9, 0xcc, 0xd3, 0xe9, 0xb3, 0x26, 1482 0x23, 0x44, 0xd9, 0x10, 0x85, 0xcc, 0xe3, 0x1a, 0x9a, 0xf1, 0x26, 0xcb,
1477 0xdd, 0x85, 0x2e, 0xe1, 0x9c, 0xf4, 0x40, 0x46, 0x4f, 0x00, 0x6e, 0xe2, 1483 0xd5, 0xba, 0x07, 0x84, 0x7b, 0x86, 0xa9, 0xc4, 0x3e, 0x6d, 0x9f, 0x88,
1478 0xb0, 0x87, 0x32, 0x89, 0xf3, 0xa7, 0x54, 0x3a, 0x16, 0xcd, 0x95, 0xa5, 1484 0x8c, 0x17, 0x58, 0x77, 0x3b, 0xac, 0x13, 0xaf, 0xa6, 0xbe, 0xce, 0xe1,
1479 0x2f, 0x57, 0xb4, 0xb1, 0x9e, 0x01, 0x8e, 0x7f, 0x95, 0xc5, 0x43, 0xa3, 1485 0x02, 0x9f, 0x87, 0x71, 0xac, 0x58, 0x2c, 0x53, 0x90, 0x97, 0x23, 0x03,
1480 0xb8, 0x80, 0xad, 0x2f, 0x92, 0x70, 0xe0, 0x2b, 0x43, 0xd7, 0x3f, 0xba, 1486 0xf2, 0x32, 0xed, 0xce, 0x61, 0xd0, 0xb6, 0xeb, 0xf1, 0xbd, 0x29, 0xcf,
1481 0x4a, 0x1a, 0x89, 0x9b, 0x1e, 0xf0, 0x52, 0x0d, 0x74, 0xd1, 0xfd, 0xcd, 1487 0xf8, 0xb2, 0x94, 0x19, 0xec, 0xa3, 0x9d, 0x9d, 0x53, 0x9a, 0x27, 0x44,
1482 0x5c, 0x37, 0xd5, 0x36, 0x64, 0xec, 0x63, 0xbf, 0xac, 0xd2, 0x7f, 0x1b, 1488 0xa1, 0x6d, 0x2c, 0x5b, 0x96, 0x91, 0x6c, 0xc1, 0xc6, 0x7a, 0x46, 0x39,
1483 0x57, 0xe9, 0x51, 0x2b, 0x2f, 0xa3, 0x7d, 0x94, 0x97, 0x4f, 0x97, 0x08, 1489 0xe7, 0x0d, 0x35, 0x73, 0x6f, 0x95, 0x28, 0x60, 0x1a, 0x89, 0x24, 0x9d,
1484 0x8f, 0x78, 0x11, 0x3f, 0xd1, 0xd7, 0x5b, 0x16, 0x15, 0x49, 0x7b, 0xd1, 1490 0x06, 0xef, 0x23, 0x2d, 0x46, 0xe7, 0x43, 0xee, 0xb7, 0xdd, 0xdf, 0xce,
1485 0xde, 0xf2, 0x42, 0xfa, 0x7f, 0xba, 0xf2, 0x61, 0x6b, 0x0b, 0x56, 0xc7, 1491 0x3d, 0x53, 0x05, 0x1f, 0x5a, 0xb5, 0xdf, 0x7e, 0x8d, 0x1a, 0xfa, 0xf3,
1486 0x54, 0xab, 0xf3, 0xc8, 0x83, 0xcb, 0xe5, 0x11, 0x26, 0x89, 0xae, 0x48, 1492 0x04, 0xf4, 0xa0, 0x95, 0x95, 0xb1, 0x91, 0xae, 0x65, 0xfa, 0xe6, 0xf8,
1487 0x5f, 0xf8, 0x54, 0x7b, 0x47, 0xde, 0xab, 0x15, 0xe2, 0x39, 0x80, 0xdc, 1493 0xd2, 0x1e, 0xf1, 0x92, 0x23, 0xc3, 0x65, 0x51, 0x91, 0x21, 0x37, 0x36,
1488 0x06, 0xae, 0xcb, 0x5c, 0xaf, 0xde, 0x8f, 0x79, 0xfb, 0x3f, 0x41, 0x26, 1494 0x5c, 0x5e, 0x49, 0xf3, 0x4f, 0x55, 0xfe, 0xbd, 0xb5, 0x05, 0x6b, 0x63,
1489 0xc6, 0x7c, 0x4f, 0xea, 0xe0, 0xdb, 0xbe, 0x0c, 0xdd, 0xf9, 0x8a, 0x7f, 1495 0xaa, 0xb5, 0xef, 0xc8, 0x77, 0x2b, 0xf6, 0x2b, 0x92, 0x26, 0x07, 0x86,
1490 0xe1, 0x53, 0x9d, 0x1d, 0x41, 0xf0, 0xac, 0x9f, 0x4f, 0xb8, 0x90, 0x1f, 1496 0xfb, 0xb4, 0x5c, 0x93, 0xf4, 0x5b, 0x1b, 0xa0, 0x7c, 0x66, 0xb4, 0x8f,
1491 0x87, 0x2d, 0xbe, 0x87, 0x81, 0xef, 0x89, 0x39, 0x7c, 0x27, 0xe4, 0x62, 1497 0xc6, 0x9c, 0x8b, 0x98, 0xcd, 0x3d, 0x33, 0xb8, 0x4e, 0x97, 0x1d, 0x99,
1492 0xd7, 0xf7, 0x03, 0xae,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xd2, 0xe0, 0xf5, 0xeb, 0xdf, 0x2c, 0xd3, 0xe0, 0x81, 0x4f, 0x17, 0x95, 1520 0x32, 0xe9, 0xcc, 0xc0, 0xda, 0xd5, 0x13, 0x04, 0xd7, 0xf9, 0x1c, 0x37,
1515 0x61, 0x1a, 0xf3, 0x0a, 0x6b, 0x94, 0xde, 0xab, 0xa4, 0xf7, 0x28, 0xc9, 1521 0x08, 0xae, 0xf7, 0xfb, 0xdc, 0x67, 0xe5, 0xf9, 0xc0, 0xd8, 0x54, 0x21,
1516 0x83, 0xa9, 0x64, 0x62, 0x48, 0x25, 0xbd, 0x71, 0xd9, 0x0f, 0xb9, 0x43, 1522 0xed, 0x3c, 0x67, 0xe5, 0x75, 0x10, 0xbc, 0xec, 0xf7, 0xca, 0xef, 0x54,
1517 0x39, 0x39, 0x73, 0x7f, 0x44, 0xb8, 0x9f, 0xef, 0x5d, 0x92, 0xf5, 0x29, 1523 0x52, 0x8f, 0xd3, 0xe7, 0x3e, 0x83, 0xe7, 0x33, 0xbe, 0xc9, 0x2b, 0xfa,
1518 0x3f, 0x0b, 0x9f, 0x57, 0x94, 0x75, 0x95, 0x97, 0x1a, 0xcc, 0xd8, 0xb8, 1524 0x13, 0xb4, 0x8b, 0xab, 0x7e, 0xd0, 0xb0, 0x27, 0x5f, 0xd4, 0x3e, 0x3a,
1519 0x0f, 0x01, 0x70, 0x36, 0xd1, 0x86, 0xbb, 0xb5, 0x81, 0x3c, 0x94, 0x50, 1525 0xf1, 0x67, 0x62, 0xfc, 0x55, 0x18, 0x30, 0x61, 0x2f, 0xb3, 0xc9, 0x65,
1520 0x11, 0xd9, 0x45, 0x3f, 0x5f, 0x7d, 0xb1, 0x5e, 0xea, 0xa7, 0xd7, 0x78, 1526 0x7e, 0xa0, 0xa6, 0xdf, 0xda, 0x77, 0x0a, 0xef, 0x58, 0x16, 0x04, 0x97,
1521 0x52, 0xd1, 0xe9, 0x66, 0x7f, 0x60, 0xb2, 0x73, 0x48, 0x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ef, 0xf3, 0x43, 0x98, 0xaa, 0xed, 0xb3, 0xfd, 0xeb,
1529 0xbd, 0xc7, 0x02, 0x93, 0xe1, 0x4d, 0x61, 0xde, 0x33, 0x03, 0x2c, 0x57, 1535 0xac, 0xcd, 0x19, 0x05, 0x2e, 0x3d, 0xb7, 0x4b, 0xfd, 0x4d, 0x60, 0x74,
1530 0x2f, 0xd3, 0x31, 0xf2, 0xba, 0xe6, 0x97, 0x4f, 0x65, 0xfd, 0x76, 0x4f, 1536 0x6b, 0x48, 0xc3, 0x7f, 0x17, 0x3c, 0x18, 0x37, 0xcf, 0x99, 0x6d, 0xec,
1531 0x39, 0xc3, 0x8c, 0x31, 0x00, 0xaf, 0xa4, 0xcd, 0x54, 0x6c, 0xbb, 0xcf, 1537 0x63, 0xab, 0x4c, 0x6e, 0xc3, 0x73, 0xf4, 0x5a, 0xdc, 0x87, 0x2f, 0x8b,
1532 0xb6, 0x58, 0xe6, 0x2a, 0xf9, 0xf6, 0xc0, 0x85, 0x7f, 0x78, 0xd6, 0xff, 1538 0xc8, 0x15, 0x89, 0x61, 0xb5, 0xcd, 0x7d, 0x50, 0xfa, 0xac, 0x8c, 0xfb,
1533 0x7b, 0xc0, 0x91, 0x81, 0x4c, 0xe0, 0xf3, 0x6a, 0x90, 0x8f, 0x31, 0xa6, 1539 0x1a, 0xf4, 0x7d, 0x0e, 0xfe, 0x78, 0x93, 0x3c, 0x08, 0x9a, 0x56, 0x03,
1534 0xf5, 0xbf, 0xeb, 0xad, 0x9d, 0xac, 0x79, 0x7f, 0x58, 0xef, 0x93, 0x79, 1540 0xa9, 0xe4, 0x82, 0x4a, 0xf5, 0xce, 0xa8, 0x94, 0x3f, 0xa6, 0xae, 0xe7,
1535 0xfe, 0x33, 0x59, 0xae, 0x77, 0xc0, 0x36, 0xc9, 0x69, 0xb9, 0x18, 0xfd, 1541 0xbc, 0x06, 0x89, 0x8b, 0x19, 0xe2, 0xb7, 0x08, 0xfc, 0x17, 0x81, 0xe3,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, 0x36, 0xa3, 0xd1, 0x69, 0x17, 0xfe, 1549 0x4c, 0x3a, 0x46, 0x19, 0x18, 0x31, 0xb1, 0xdf, 0xca, 0xcf, 0xa1, 0x9d,
1544 0x61, 0xc4, 0xbf, 0xb0, 0xba, 0x80, 0xb9, 0x81, 0x0e, 0x5b, 0x0c, 0x4b, 1550 0xce, 0x67, 0x89, 0x45, 0x21, 0xa3, 0xa6, 0xc0, 0xc5, 0x87, 0x8e, 0x49,
1545 0x8a, 0xb0, 0x0c, 0x6b, 0x58, 0x62, 0xc0, 0xa5, 0x0b, 0xd9, 0x77, 0x9b, 1551 0xb4, 0xc1, 0xfb, 0x5f, 0xcd, 0xc6, 0x6f, 0xa2, 0x0f, 0xc5, 0xb1, 0x1b,
1546 0x1c, 0x02, 0xde, 0x87, 0x06, 0x45, 0x9e, 0x85, 0x4d, 0x76, 0xbe, 0x0a, 1552 0x24, 0xbf, 0x26, 0xde, 0x52, 0x02, 0xfc, 0xcd, 0x32, 0x79, 0x8c, 0x6b,
1547 0x9e, 0x19, 0xc0, 0x73, 0xde, 0xe7, 0x5e, 0x00, 0xe6, 0xf9, 0xde, 0xb0, 1553 0x11, 0x85, 0xcc, 0xe1, 0xd8, 0x12, 0xcd, 0xf4, 0x07, 0xc1, 0x38, 0xcb,
1548 0x70, 0x2f, 0x00, 0x71, 0xd8, 0x81, 0xdf, 0x22, 0x33, 0xd0, 0xbf, 0x27, 1554 0x4f, 0x92, 0x7f, 0x25, 0xc5, 0x77, 0xb9, 0x93, 0x0b, 0x9b, 0xd4, 0x0a,
1549 0xfd, 0xd7, 0x82, 0xf1, 0x18, 0x75, 0x23, 0xda, 0x99, 0xdb, 0x1b, 0x14, 1555 0x59, 0xdb, 0x62, 0xe1, 0xd0, 0x78, 0x92, 0x92, 0x96, 0x23, 0xd4, 0x37,
1550 0xc8, 0xe7, 0x53, 0xd4, 0x43, 0xb5, 0xd2, 0xb6, 0x8e, 0x7e, 0x88, 0x91, 1556 0xb7, 0xd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 0xa5, 0xda, 0x37, 0xb3, 0xb8,
1558 0xe5, 0x6f, 0x53, 0xc7, 0x5b, 0xd9, 0x71, 0xe1, 0x33, 0x37, 0xf8, 0x84, 1564 0xc6, 0xdc, 0x62, 0x35, 0x73, 0x83, 0xfe, 0x53, 0xe1, 0xdc, 0x20, 0x13,
1559 0x0b, 0x79, 0x25, 0xae, 0x8b, 0xde, 0x26, 0x79, 0x2f, 0x79, 0x0b, 0x7b, 1565 0x51, 0xaf, 0x24, 0xf7, 0x5b, 0x5c, 0xb4, 0x62, 0x4e, 0xb1, 0x9a, 0xf9,
1560 0xfd, 0x66, 0xb1, 0x0e, 0xb2, 0x89, 0x7b, 0x80, 0x69, 0xb3, 0x6e, 0xf1, 1566 0x74, 0x27, 0xf6, 0xb3, 0xcc, 0xcc, 0xa7, 0x27, 0xef, 0xc5, 0x2c, 0x7e,
1561 0x5e, 0x96, 0xff, 0x40, 0xba, 0xeb, 0xc9, 0x38, 0x5f, 0x5b, 0xc9, 0xb8, 1567 0x57, 0xc3, 0x58, 0xf5, 0x17, 0x67, 0x24, 0x90, 0x29, 0x1f, 0x6b, 0xd4,
1562 0xd8, 0x88, 0x4f, 0xfb, 0x3a, 0x90, 0x9c, 0x5e, 0x3f, 0xa1, 0x7f, 0x5b, 1568 0x4b, 0xff, 0x24, 0x66, 0xf3, 0x98, 0x15, 0x9e, 0x37, 0x58, 0xfe, 0x72,
1563 0x44, 0x3a, 0xe9, 0x41, 0x35, 0x45, 0xf4, 0x3e, 0x2d, 0x7e, 0x47, 0x61, 1569 0x25, 0xaf, 0xfd, 0xb7, 0x2f, 0xad, 0x37, 0x7c, 0x1a, 0xb5, 0xf9, 0x6b,
1564 0xf7, 0x06, 0x42, 0x9f, 0x8f, 0x36, 0x5d, 0xc6, 0xe3, 0xda, 0x50, 0x98, 1570 0xfc, 0xdd, 0xb1, 0xde, 0xee, 0xef, 0xe7, 0xd2, 0xf2, 0xfb, 0xeb, 0x69,
1565 0xe7, 0x21, 0x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0x99, 0xf5,
1587 0xed, 0x73, 0x1c, 0x04, 0x0f, 0x1f, 0xf4, 0xb3, 0x6b, 0x6a, 0x75, 0xdb, 1593 0x66, 0x4f, 0xfc, 0xfd, 0x2d, 0x66, 0x4f, 0xea, 0x2f, 0x57, 0x3d, 0x6f,
1588 0x49, 0xef, 0x7a, 0x6d, 0x13, 0x6e, 0x94, 0x99, 0x14, 0xdb, 0x23, 0x5e, 1594 0xa2, 0xcd, 0x08, 0x5f, 0x2c, 0x7c, 0xae, 0x85, 0xf5, 0x0c, 0x60, 0xad,
1589 0xfe, 0x47, 0x30, 0xe4, 0xcd, 0xa0, 0x7f, 0x43, 0xff, 0x59, 0x5f, 0xb5, 1595 0x95, 0x35, 0x4d, 0x36, 0xee, 0xc6, 0xfd, 0x73, 0xfa, 0x7d, 0x51, 0x79,
1590 0xd4, 0x49, 0xf5, 0x3e, 0x53, 0xe2, 0xc9, 0x85, 0xbd, 0xd2, 0x01, 0xfc, 1596 0x14, 0x76, 0x50, 0xbe, 0xfc, 0x8f, 0xc1, 0x02, 0x7c, 0xbf, 0xa9, 0x65,
1591 0x18, 0x78, 0x73, 0xe5, 0xb7, 0x49, 0x21, 0xe6, 0xda, 0xb1, 0x45, 0xb4, 1597 0xdd, 0x7b, 0x5b, 0x0b, 0xf9, 0x6d, 0x06, 0xbf, 0x0e, 0xd6, 0xf8, 0x3c,
1592 0x2f, 0x37, 0x91, 0xaa, 0x83, 0x2d, 0xf8, 0x17, 0xc1, 0xe4, 0x82, 0x31, 1598 0x98, 0x2f, 0xca, 0xfe, 0x01, 0xeb, 0x01, 0xb9, 0xbc, 0x5c, 0x97, 0x31,
1593 0x1e, 0xac, 0x1a, 0xe3, 0x4c, 0x02, 0xd8, 0x68, 0x89, 0xcc, 0xc9, 0x01, 1599 0x0b, 0xe3, 0xe3, 0x30, 0x66, 0x68, 0xf6, 0x13, 0x29, 0xe7, 0xef, 0x84,
1594 0xf6, 0x65, 0x64, 0x52, 0x38, 0xc6, 0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x3c, 0x2d, 0xb7, 0x3f, 0xd5, 0x0b, 0xf9, 0xd4, 0xce, 0x73, 0x0b, 0x03, 1622 0xf8, 0x76, 0xa7, 0xb7, 0x05, 0x3e, 0x0a, 0x69, 0x88, 0xf1, 0xaf, 0xcb,
1617 0xf2, 0x2f, 0x77, 0x80, 0x06, 0x7f, 0xb8, 0xe9, 0x6b, 0xc1, 0x6c, 0xb3, 1623 0x75, 0x1e, 0x21, 0x03, 0x68, 0x33, 0x51, 0xc6, 0x09, 0x53, 0x83, 0x63,
1618 0x2b, 0x5b, 0x37, 0x25, 0xbd, 0xbc, 0xc2, 0x78, 0x4a, 0x18, 0x4f, 0x09, 1624 0xc2, 0x79, 0xa7, 0x12, 0x49, 0xa5, 0xed, 0xaa, 0xe0, 0x46, 0x9f, 0x39,
1619 0xe3, 0xe3, 0x98, 0x4b, 0x18, 0xd7, 0x15, 0xf7, 0x4a, 0xf5, 0x2c, 0x88, 1625 0xb6, 0xdc, 0x63, 0x21, 0x3f, 0xef, 0xff, 0xf4, 0x94, 0x97, 0x73, 0x23,
1620 0xcb, 0x1a, 0x3f, 0x2d, 0x93, 0x77, 0x65, 0x83, 0xdd, 0x2b, 0x35, 0x5c, 1626 0x36, 0x2f, 0x37, 0x53, 0x30, 0xb4, 0x39, 0x41, 0xda, 0x84, 0x3f, 0xb5,
1621 0x1f, 0xae, 0xb1, 0x65, 0x64, 0x3c, 0x28, 0xf8, 0x7f, 0x70, 0x55, 0xb6, 1627 0xd8, 0xff, 0xb7, 0x01, 0xed, 0xfb, 0xa4, 0x22, 0xed, 0xff, 0x4d, 0x30,
1622 0x2b, 0xb6, 0x58, 0xe7, 0xdc, 0x35, 0xaf, 0x73, 0x44, 0x9e, 0x33, 0xf3, 1628 0x17, 0x65, 0x5f, 0x84, 0x7b, 0xff, 0xa7, 0x33, 0x1a, 0x57, 0x77, 0xca,
1623 0x86, 0x39, 0xf3, 0xbd, 0x49, 0x6e, 0x86, 0x87, 0x0e, 0xdc, 0xaa, 0xf7, 1629 0x81, 0x22, 0x6d, 0xe1, 0x98, 0xce, 0xe7, 0x18, 0xf7, 0x69, 0xa7, 0xc5,
1624 0x3c, 0x77, 0xe0, 0x9b, 0x36, 0xd5, 0xa7, 0xf5, 0x3a, 0xe2, 0x4c, 0xf9, 1630 0x80, 0xc7, 0x0f, 0x01, 0x7f, 0x2d, 0xb0, 0xb9, 0x47, 0x50, 0x27, 0x22,
1625 0x1e, 0x3b, 0x77, 0xf7, 0x68, 0x3d, 0xbb, 0x75, 0xd3, 0xa5, 0x80, 0xfb, 1631 0x63, 0x60, 0xf1, 0xd9, 0x02, 0xf9, 0x93, 0xf7, 0x28, 0xea, 0xbb, 0x32,
1626 0xdc, 0xbc, 0x4d, 0xcb, 0xc5, 0x22, 0x68, 0xef, 0xd5, 0x69, 0xde, 0xe7, 1632 0x5f, 0xb8, 0x59, 0xe7, 0xdb, 0x9d, 0x46, 0xdb, 0x27, 0x71, 0xcd, 0x16,
1627 0x7a, 0x76, 0x41, 0x9f, 0x13, 0x01, 0xde, 0xe6, 0xe2, 0x62, 0xf5, 0x48, 1633 0x26, 0xd0, 0x66, 0xaf, 0xae, 0x3f, 0x5b, 0x62, 0x8e, 0xb2, 0x40, 0x2e,
1628 0xa3, 0xbe, 0xf8, 0x69, 0x83, 0x59, 0x47, 0xa5, 0x6c, 0x58, 0x83, 0x34, 1634 0xed, 0x97, 0xfc, 0x5c, 0x97, 0x8c, 0xc5, 0x17, 0x66, 0xa2, 0xcb, 0x71,
1629 0xd7, 0xec, 0x05, 0x5e, 0x90, 0xf7, 0xdf, 0xea, 0xcd, 0x9e, 0x8f, 0xea, 1635 0x99, 0x8f, 0x6f, 0xe0, 0x1e, 0x47, 0xfe, 0x4a, 0xee, 0x07, 0x4b, 0x74,
1630 0xb2, 0xe0, 0x31, 0xbd, 0x2f, 0x84, 0xfb, 0x03, 0x7f, 0x79, 0xa5, 0xb1, 1636 0x74, 0xbb, 0xea, 0x6d, 0xd3, 0x3e, 0xd7, 0xa0, 0xec, 0xac, 0x0c, 0xc9,
1631 0x4d, 0xc3, 0x7c, 0xa6, 0xff, 0x38, 0x98, 0xd0, 0x31, 0x36, 0xf6, 0xf5, 1637 0x4d, 0x95, 0xcf, 0x6e, 0x36, 0xb1, 0xa8, 0x15, 0xf1, 0xad, 0xc3, 0xc4,
1632 0x43, 0xfc, 0x5e, 0xbc, 0x5f, 0x24, 0xb4, 0x5d, 0xeb, 0x40, 0xf7, 0xda, 1638 0x8a, 0x3a, 0x1a, 0xe5, 0xb9, 0x25, 0x99, 0x3d, 0x25, 0x12, 0x39, 0x1a,
1633 0x5f, 0x16, 0x94, 0x89, 0xe7, 0x25, 0x22, 0x13, 0x55, 0x30, 0x4e, 0x10, 1639 0xc6, 0x12, 0x59, 0xe6, 0x4a, 0xd7, 0x95, 0x80, 0xeb, 0x14, 0x64, 0x6b,
1634 0xee, 0x52, 0xd7, 0xaa, 0xf9, 0xd8, 0xdd, 0x6a, 0xa4, 0x11, 0xc6, 0x75, 1640 0x3c, 0x26, 0x5f, 0xdc, 0x16, 0x8e, 0x95, 0x0b, 0xa6, 0xb7, 0xe5, 0xe4,
1635 0x8b, 0xf2, 0xc8, 0x1b, 0xad, 0x2b, 0x49, 0x37, 0xd3, 0xc2, 0xb4, 0xf9, 1641 0xd3, 0xb8, 0xb2, 0x57, 0xa6, 0x4a, 0x19, 0xc5, 0x71, 0xbf, 0x13, 0x50,
1636 0x31, 0xcd, 0x68, 0xfb, 0xb9, 0x6d, 0x95, 0xde, 0xfb, 0xc4, 0x35, 0x46, 1642 0x96, 0xa9, 0x21, 0x4f, 0x72, 0x6d, 0xe1, 0xd8, 0xf0, 0x6f, 0x76, 0x84,
1637 0xc6, 0x08, 0x63, 0x26, 0xdf, 0xf5, 0xff, 0x56, 0xd7, 0x19, 0x9a, 0xab, 1643 0xe3, 0xd3, 0xe6, 0x36, 0x67, 0x1e, 0xf2, 0xdc, 0x77, 0x01, 0xfd, 0x45,
1638 0xa3, 0xe7, 0x02, 0xf9, 0x6e, 0x55, 0x5e, 0x35, 0xdc, 0xd4, 0x5f, 0x43, 1644 0x86, 0xee, 0xde, 0x40, 0xdf, 0x61, 0x58, 0xd8, 0x0e, 0x32, 0x5d, 0xb1,
1639 0x9d, 0x75, 0xd0, 0x89, 0x17, 0x53, 0xab, 0xc3, 0xbd, 0xf0, 0xb0, 0x21, 1645 0x6f, 0xc2, 0x49, 0xf8, 0x6b, 0xe1, 0x5c, 0x4c, 0xc6, 0x81, 0xa3, 0xdc,
1640 0xb2, 0xd7, 0xd4, 0x5a, 0x99, 0x3f, 0x81, 0x79, 0x7d, 0x26, 0x65, 0x78, 1646 0xeb, 0xc2, 0xdb, 0xe7, 0x7a, 0xaa, 0x1e, 0xbc, 0xa3, 0x36, 0x96, 0xc8,
1641 0x51, 0xf3, 0x61, 0xf1, 0x36, 0xf8, 0xeb, 0xa1, 0xde, 0xa0, 0x9c, 0x26, 1647 0xf8, 0xe0, 0x3a, 0xe0, 0xad, 0x05, 0xe5, 0x1f, 0x94, 0xa9, 0x63, 0x6f,
1642 0x6f, 0x22, 0xad, 0x42, 0x9f, 0xe0, 0xc2, 0xea, 0x99, 0xae, 0x57, 0x03, 1648 0xdb, 0xcc, 0xbd, 0xec, 0x06, 0xcf, 0xb1, 0x39, 0xa7, 0x3c, 0xbf, 0x73,
1643 0xee, 0xb3, 0x7c, 0x45, 0xdb, 0x51, 0x43, 0xb2, 0xb0, 0xed, 0xd1, 0x7b, 1649 0x37, 0xea, 0xf0, 0xfd, 0xcd, 0x68, 0x93, 0xca, 0x65, 0x22, 0x9b, 0xe1,
1644 0x5e, 0xbf, 0xed, 0xa1, 0x65, 0xda, 0x1e, 0xb2, 0x6d, 0x8b, 0x6b, 0xda, 1650 0x13, 0x71, 0xdc, 0x20, 0xd2, 0xb5, 0xa3, 0x59, 0xe7, 0x90, 0xca, 0x29,
1645 0x8e, 0x5e, 0xa1, 0xed, 0x81, 0x37, 0x68, 0x7b, 0x70, 0x99, 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e, 0x84, 0xfd, 0x7f, 0x06, 0xf6, 0xff, 0x93, 0x58, 0x9b,
1653 0x21, 0xbd, 0x42, 0x1f, 0x97, 0xf5, 0x42, 0x19, 0x58, 0x67, 0xd7, 0x3e, 1659 0xd3, 0x2b, 0x78, 0x39, 0xad, 0x79, 0x39, 0x5f, 0xa4, 0xaf, 0xd6, 0x7f,
1654 0x68, 0x6b, 0x32, 0x0e, 0xa7, 0xed, 0x51, 0x29, 0x94, 0x7f, 0x12, 0x4c, 1660 0x11, 0x7e, 0x8d, 0xca, 0x70, 0x21, 0x05, 0x55, 0xe2, 0x44, 0xb3, 0xfd,
1655 0x83, 0x2e, 0x46, 0xe6, 0x74, 0xc8, 0x93, 0xab, 0x68, 0xb3, 0x8f, 0x53, 1661 0x9f, 0x24, 0xbf, 0xca, 0x83, 0xfe, 0x0d, 0x68, 0x73, 0x18, 0x34, 0x9e,
1656 0xb3, 0x54, 0xc5, 0xa0, 0x46, 0x7c, 0xa6, 0xfd, 0x98, 0x6d, 0xc2, 0x0e, 1662 0xa2, 0x1d, 0x48, 0xfb, 0x27, 0x07, 0xde, 0x3c, 0x4c, 0x5f, 0x4d, 0x5d,
1657 0x0c, 0xcb, 0x32, 0x6e, 0x6c, 0x62, 0x4e, 0x67, 0x21, 0x33, 0xcd, 0x9e, 1663 0xb9, 0x49, 0xa8, 0x5f, 0xa2, 0x3b, 0x98, 0x7b, 0xc8, 0xb9, 0x26, 0x57,
1658 0x0e, 0xfa, 0x2a, 0x4f, 0x81, 0x97, 0xf7, 0x43, 0x76, 0x24, 0xf3, 0x22, 1664 0xe1, 0xc9, 0xf0, 0xef, 0x84, 0x47, 0x3d, 0x43, 0xbe, 0x7d, 0x99, 0x7c,
1659 0x3d, 0x8d, 0xe6, 0xac, 0x45, 0x4c, 0x72, 0x5d, 0xbf, 0x69, 0xf1, 0xb8, 1665 0x5b, 0xc3, 0xab, 0x01, 0xe7, 0x17, 0xb8, 0xdb, 0xea, 0xb5, 0xad, 0xd6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, 0x43, 0x19, 0x7b, 0xe9, 0x1b,
1682 0x93, 0xec, 0x19, 0x32, 0x3e, 0x66, 0x3c, 0xa1, 0x18, 0x23, 0xe6, 0xfa, 1688 0x3e, 0x79, 0xe7, 0xe3, 0x3a, 0x0f, 0xe5, 0x71, 0xda, 0x4d, 0xc5, 0x36,
1683 0x05, 0xcf, 0x39, 0x70, 0x9d, 0x9b, 0xf1, 0x90, 0xf1, 0x7b, 0x47, 0xfc, 1689 0x19, 0x99, 0xae, 0x85, 0x9b, 0xf0, 0xe6, 0xb4, 0x1c, 0xcd, 0x62, 0x7e,
1684 0xbc, 0x17, 0xb1, 0x67, 0x23, 0xb2, 0x45, 0x43, 0x9b, 0x7b, 0xb4, 0xad, 1690 0xe3, 0x7e, 0x2f, 0xe4, 0x9b, 0xa6, 0x25, 0x94, 0xa7, 0x72, 0xc3, 0x91,
1685 0x1a, 0x05, 0x3f, 0x7d, 0x0f, 0x74, 0xcf, 0xba, 0xa4, 0xfd, 0xef, 0x04, 1691 0x26, 0x51, 0x0f, 0x7c, 0x08, 0x73, 0x8e, 0xca, 0x66, 0xaf, 0xdb, 0xdd,
1686 0x93, 0xae, 0x89, 0x4f, 0x29, 0xd4, 0xcb, 0x6a, 0x5c, 0x3d, 0x25, 0x07, 1692 0xa1, 0xa8, 0x0b, 0x2f, 0xab, 0xd1, 0x85, 0xed, 0x56, 0x17, 0x6e, 0xa2,
1687 0x4a, 0xe4, 0xff, 0xa8, 0x96, 0xe5, 0xbb, 0x53, 0x94, 0x07, 0x51, 0xe0, 1693 0x2e, 0x04, 0xdc, 0x77, 0xca, 0xe1, 0x22, 0xd7, 0x2f, 0x97, 0x6c, 0x82,
1688 0x71, 0x0a, 0xf8, 0x6b, 0x90, 0xdd, 0x5d, 0x45, 0x94, 0x89, 0xc8, 0xd0, 1694 0xfe, 0xff, 0x81, 0xc7, 0xb3, 0x27, 0x3a, 0x6e, 0x96, 0x38, 0xac, 0x69,
1689 0x40, 0x03, 0x78, 0x8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6, 0x39, 0x1a, 0xae, 1702 0x98, 0x73, 0x1c, 0x6d, 0xe9, 0xf3, 0x31, 0x8e, 0xd6, 0x28, 0xd1, 0xd9,
1697 0xe7, 0x30, 0xcd, 0x93, 0xb6, 0xeb, 0x00, 0xd7, 0x99, 0x7f, 0xd2, 0xf2, 1703 0xb8, 0xce, 0xad, 0xe7, 0xd9, 0xd1, 0xcc, 0x60, 0x1b, 0xde, 0x31, 0x9f,
1698 0xf5, 0x89, 0x4d, 0x61, 0x5f, 0xf9, 0x60, 0x6c, 0x53, 0x5e, 0x3e, 0x81, 1704 0xc1, 0xc5, 0x58, 0xa1, 0xec, 0x47, 0xbf, 0x47, 0xc5, 0xee, 0xf7, 0x0c,
1699 0x27, 0x77, 0x5d, 0x72, 0x34, 0xab, 0xd8, 0xef, 0x37, 0x02, 0xc6, 0x02, 1705 0x69, 0xfd, 0x17, 0x39, 0xea, 0xda, 0x33, 0x74, 0x83, 0x58, 0xf7, 0x7a,
1700 0x54, 0xba, 0x55, 0xf2, 0x4d, 0xd5, 0xfd, 0x33, 0xad, 0xc3, 0x2b, 0xa8, 1706 0x7a, 0xd1, 0x18, 0xb9, 0x19, 0xac, 0x9f, 0x3a, 0x15, 0xc5, 0xbd, 0x13,
1701 0xd7, 0x83, 0x63, 0x26, 0x11, 0x03, 0x0e, 0xf2, 0x6f, 0x08, 0xcf, 0x16, 1707 0xf7, 0xb0, 0xbf, 0x50, 0x8f, 0x40, 0x37, 0xbe, 0xb3, 0x6f, 0xa3, 0x34,
1702 0xcf, 0x57, 0xcb, 0xc1, 0x73, 0xc2, 0xae, 0xd7, 0x70, 0x0d, 0x66, 0x05, 1708 0x03, 0xdf, 0xb3, 0x0a, 0xb8, 0x36, 0x39, 0x59, 0x39, 0xcd, 0x0b, 0x55,
1703 0xf0, 0xd2, 0x80, 0xf4, 0x09, 0x19, 0x39, 0xfe, 0x3b, 0x31, 0xee, 0x17, 1709 0x7a, 0x78, 0xf2, 0x75, 0xf9, 0x81, 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f, 0x94, 0xc8, 0xa9, 0x84, 0x1c, 0x2a, 0x70, 0x0f, 0xe8, 0x24, 0xf0,
1726 0x70, 0x3e, 0x60, 0xf9, 0xea, 0x39, 0xa7, 0x0c, 0xa5, 0xec, 0x6c, 0xb0, 1732 0xa1, 0xcf, 0xa4, 0xa0, 0xce, 0x15, 0xb8, 0xa0, 0xec, 0x67, 0xb7, 0xe3,
1727 0xf1, 0x7e, 0xb6, 0x77, 0x61, 0xd1, 0x3c, 0x5d, 0x0a, 0x78, 0xce, 0x76, 1733 0xea, 0xc5, 0xf5, 0x56, 0x5c, 0x20, 0x87, 0xd9, 0x13, 0xb8, 0xfa, 0xd0,
1728 0xc4, 0x1f, 0xab, 0xa2, 0x95, 0xbf, 0xb2, 0xb4, 0xa2, 0x16, 0x8d, 0xe3, 1734 0xb7, 0x8a, 0x37, 0x09, 0x73, 0xa9, 0xbe, 0x8d, 0x36, 0xda, 0xb6, 0xcc,
1729 0x9c, 0xa5, 0x95, 0x10, 0xde, 0x58, 0x48, 0x2b, 0x75, 0x21, 0xad, 0xe4, 1735 0xa9, 0xa1, 0x01, 0xe0, 0x6f, 0x00, 0xb0, 0x25, 0x70, 0x31, 0xff, 0xf8,
1730 0xc7, 0x43, 0x5a, 0x61, 0xdd, 0x73, 0x21, 0xad, 0x24, 0xaa, 0x69, 0x25, 1736 0x87, 0x8e, 0x9c, 0x7a, 0x19, 0x17, 0x18, 0xec, 0x14, 0x08, 0xf3, 0xd4,
1731 0x3f, 0xee, 0xe0, 0x59, 0x0c, 0x07, 0xe9, 0x85, 0xed, 0x90, 0x5e, 0x00, 1737 0x20, 0x2e, 0x28, 0xb1, 0x53, 0x69, 0x5c, 0x23, 0xb8, 0xfe, 0xd2, 0x31,
1732 0x4b, 0xa5, 0x32, 0x47, 0x2f, 0x31, 0xb4, 0x73, 0xa8, 0xa4, 0x34, 0xad, 1738 0x3c, 0xd7, 0x09, 0x7c, 0x85, 0x3c, 0x02, 0x9c, 0xaf, 0xe0, 0xb9, 0xaf,
1733 0x0c, 0xa9, 0x50, 0x47, 0x78, 0x98, 0x73, 0xcc, 0xfd, 0x15, 0x69, 0x24, 1739 0x3b, 0x6f, 0x9c, 0xe7, 0x7e, 0xe2, 0x18, 0x9e, 0x7b, 0xc5, 0xa9, 0xf2,
1734 0x65, 0x69, 0x64, 0xfe, 0x2c, 0xd1, 0x22, 0xda, 0x00, 0xee, 0x79, 0x5e, 1740 0xdc, 0x59, 0x47, 0x3d, 0xfc, 0x8c, 0x13, 0x79, 0x98, 0xbe, 0xc4, 0x59,
1735 0x60, 0xb3, 0xa6, 0x8d, 0xfb, 0x53, 0x2f, 0xa0, 0xec, 0x28, 0x68, 0x23, 1741 0xc7, 0xf0, 0x7f, 0x44, 0x86, 0xf7, 0x82, 0x96, 0x1e, 0x5e, 0xc0, 0x45,
1736 0xc4, 0xc1, 0x03, 0x16, 0x07, 0x8b, 0xe7, 0xf2, 0xb4, 0xc5, 0xc1, 0xa8, 1742 0xba, 0x7a, 0x16, 0xe5, 0x2f, 0xac, 0x1a, 0xf7, 0xf9, 0x37, 0x31, 0xee,
1737 0xc5, 0x81, 0xe6, 0x97, 0x3c, 0xe7, 0x4c, 0x69, 0x1c, 0xd4, 0x69, 0x1c, 1743 0xab, 0x76, 0x5c, 0x51, 0xd5, 0x71, 0x2f, 0xa0, 0xef, 0x97, 0xec, 0xb8,
1738 0x88, 0x0a, 0xeb, 0x9e, 0x5e, 0x06, 0x07, 0x2c, 0x33, 0xaa, 0xc7, 0x1f, 1744 0x17, 0x6a, 0xc6, 0x05, 0xad, 0x3c, 0xbc, 0x84, 0x8b, 0x74, 0xf1, 0x22,
1739 0xc1, 0xf8, 0xf7, 0x61, 0xfc, 0x4a, 0x8f, 0x9f, 0xf3, 0xc0, 0xf1, 0x03, 1745 0xca, 0x43, 0x99, 0x80, 0x85, 0x6e, 0x6e, 0xd0, 0x67, 0x9d, 0xe2, 0x5e,
1740 0x96, 0xca, 0x77, 0xe6, 0xc6, 0xd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 0xf4, 0x8d, 0x31, 0x62, 0xb3, 0x98, 0x3f, 0x75, 0x86, 0x67, 0x8d, 1768 0x3f, 0x72, 0x82, 0x30, 0x89, 0xec, 0x9a, 0x65, 0x2c, 0xbd, 0xdb, 0x65,
1763 0x5b, 0xf1, 0x0e, 0xdb, 0x0b, 0xf5, 0x08, 0x74, 0xdf, 0xdb, 0x3f, 0xe1, 1769 0xdc, 0x94, 0xfb, 0x34, 0xb7, 0x0c, 0x70, 0x2c, 0xe8, 0x25, 0xe8, 0xb8,
1764 0x49, 0x3d, 0xf0, 0x3d, 0xa1, 0x80, 0x6b, 0x57, 0xd3, 0x42, 0x5e, 0x85, 1770 0xae, 0x1d, 0x46, 0x16, 0xa4, 0x67, 0x1b, 0x50, 0xce, 0x7e, 0xe1, 0x3f,
1765 0xb1, 0x69, 0x43, 0x0f, 0x8f, 0xbf, 0x21, 0x3f, 0x90, 0x26, 0x3a, 0x6d, 1771 0xee, 0x65, 0x3f, 0x61, 0x5b, 0x85, 0x39, 0x35, 0x6a, 0x7a, 0x59, 0x5a,
1766 0x6c, 0xc1, 0xb7, 0x31, 0x7e, 0xd2, 0xb6, 0xa1, 0x87, 0x47, 0x53, 0x19, 1772 0xa5, 0x3f, 0xce, 0xfc, 0x4c, 0xf6, 0x37, 0xfb, 0xe8, 0xd5, 0x7b, 0x21,
1767 0xc5, 0xbd, 0x51, 0x66, 0x1d, 0x94, 0xb4, 0x41, 0x9a, 0x4f, 0xe8, 0xf5, 1773 0xdc, 0x53, 0x36, 0xb6, 0x15, 0xd7, 0x44, 0xef, 0x29, 0xc0, 0xae, 0xba,
1768 0xd1, 0x8c, 0xbc, 0x2c, 0x99, 0xa6, 0x76, 0xd8, 0x5d, 0xff, 0xb6, 0x73, 1774 0x42, 0xdb, 0x17, 0x73, 0x15, 0xae, 0x20, 0x63, 0x51, 0xe1, 0x1a, 0x25,
1769 0x6c, 0xee, 0x2e, 0xd0, 0x34, 0x07, 0xdd, 0xc4, 0x7d, 0xca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, 0x8c, 0xcd, 0x1c, 0xe1, 0x27, 0x80, 0x87,
1777 0x68, 0x45, 0x22, 0x2a, 0x5d, 0xef, 0xd4, 0x9c, 0xba, 0x93, 0x73, 0x06, 1783 0x2a, 0xef, 0x4c, 0xd5, 0xc4, 0x9f, 0x38, 0x57, 0xad, 0x43, 0x31, 0xdf,
1778 0xba, 0xf2, 0x1c, 0x43, 0x57, 0x31, 0x67, 0x9e, 0xae, 0xd6, 0xd9, 0xdf, 1784 0xb8, 0x5e, 0x4f, 0x1d, 0x87, 0x2a, 0x36, 0xbe, 0x19, 0x7b, 0x2a, 0x41,
1779 0x2a, 0x5d, 0x27, 0x99, 0x64, 0x1d, 0xc6, 0xdb, 0x5b, 0x0c, 0x61, 0x3c, 1785 0x7b, 0x2a, 0x5b, 0x72, 0xcd, 0xf9, 0x80, 0x51, 0xf8, 0x4e, 0x5e, 0xef,
1780 0x0c, 0xb8, 0x08, 0xcf, 0xdd, 0x18, 0xc3, 0x30, 0x9e, 0x3c, 0x60, 0x01, 1786 0x26, 0xd2, 0xfa, 0xd8, 0x0c, 0xe1, 0x8a, 0x85, 0x70, 0xad, 0x58, 0x33,
1781 0xb3, 0x9f, 0x2a, 0x00, 0xe6, 0x83, 0x78, 0x18, 0x27, 0x6b, 0x76, 0x22, 1787 0x9e, 0xe7, 0x5a, 0x1b, 0xe7, 0x98, 0x5a, 0xce, 0x5f, 0x34, 0xb1, 0x7d,
1782 0x13, 0xd5, 0xf0, 0x12, 0xc6, 0x1f, 0x5b, 0x78, 0x5f, 0x0f, 0x56, 0x4f, 1788 0xc6, 0x51, 0x3a, 0xeb, 0xc0, 0x74, 0xa7, 0xb6, 0x61, 0x45, 0x8d, 0xc9,
1783 0x66, 0xba, 0x8b, 0x80, 0x87, 0x70, 0xde, 0x07, 0x18, 0x69, 0x97, 0x8e, 1789 0x81, 0x22, 0xcf, 0x82, 0x31, 0x9e, 0x78, 0x23, 0xe3, 0x49, 0xbd, 0xb3,
1784 0xe2, 0x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x12, 0x30, 0x1d,
1806 0xb1, 0xb5, 0x4f, 0x2e, 0xd5, 0x19, 0xa3, 0xbd, 0xf0, 0xcd, 0xb3, 0x47, 1812 0xc0, 0xda, 0x5c, 0x6b, 0x65, 0x32, 0xc7, 0xde, 0xd3, 0xc4, 0xd8, 0xc0,
1807 0x3f, 0x08, 0x9d, 0x51, 0x03, 0xb8, 0x9f, 0xd2, 0x77, 0x80, 0xec, 0x1a, 1813 0x7c, 0x21, 0x8c, 0x11, 0x46, 0xec, 0x99, 0x4a, 0x2f, 0xd2, 0xe8, 0xad,
1808 0x55, 0x23, 0x6b, 0x25, 0x2e, 0x37, 0x17, 0x6b, 0x61, 0xf7, 0x30, 0x56, 1814 0xab, 0x6b, 0xab, 0x9e, 0x7e, 0x5d, 0xdd, 0x44, 0x5a, 0xba, 0x53, 0xe7,
1809 0x5e, 0x2f, 0xed, 0xdb, 0xa2, 0xe6, 0x6c, 0x8d, 0x17, 0xc3, 0x6f, 0xcf, 1815 0xb9, 0xac, 0x1f, 0x48, 0xed, 0xd1, 0x39, 0xf2, 0x3a, 0xc6, 0x98, 0x13,
1810 0x9c, 0xf5, 0x89, 0xc5, 0x91, 0x1f, 0x69, 0xa2, 0x1c, 0x8c, 0xf9, 0xef, 1816 0xe6, 0x94, 0x7d, 0x57, 0xde, 0xa1, 0x65, 0xfe, 0x01, 0x9f, 0xfa, 0x6b,
1811 0xd4, 0xfb, 0x26, 0xdb, 0xb6, 0xd1, 0x6e, 0xb9, 0x41, 0xeb, 0x70, 0x77, 1817 0x87, 0xfe, 0xdd, 0x38, 0x14, 0x04, 0xe7, 0x06, 0xee, 0x86, 0xad, 0xe2,
1812 0x89, 0x9d, 0xa4, 0x5a, 0x3c, 0x99, 0xb7, 0xd1, 0x76, 0x17, 0x93, 0x09, 1818 0xb9, 0xdf, 0x97, 0xee, 0xc4, 0xb0, 0xb6, 0x9d, 0xb0, 0x46, 0x7b, 0x9b,
1813 0xc2, 0xf5, 0x90, 0x70, 0x3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e, 0x69, 0xd3, 1906 0x78, 0x41, 0x81, 0x97, 0xd5, 0xcf, 0xe3, 0x82, 0x6d, 0xdb, 0xa8, 0x6d,
1901 0x67, 0xed, 0xdf, 0x30, 0x46, 0x9c, 0xa9, 0x8e, 0x11, 0x8b, 0x63, 0x62, 1907 0x94, 0x7d, 0x3e, 0xeb, 0x6d, 0x75, 0x86, 0x4b, 0x5b, 0xb0, 0x8e, 0x7b,
1902 0xc4, 0x3b, 0x7f, 0x8e, 0x18, 0xb1, 0x38, 0x26, 0x46, 0xbc, 0x9c, 0x9f, 1908 0xa1, 0x3f, 0x1d, 0xd8, 0x69, 0xa0, 0x6d, 0x94, 0x4d, 0x02, 0x07, 0xe3,
1903 0x35, 0x52, 0x9a, 0xc5, 0xb8, 0xea, 0x21, 0x53, 0x94, 0x93, 0x9b, 0x6a, 1909 0xbe, 0x91, 0xe7, 0xc3, 0x92, 0xd3, 0x3e, 0x9e, 0xb9, 0xa7, 0x95, 0x89,
1904 0xc0, 0xbb, 0x16, 0x6f, 0xc0, 0x32, 0x56, 0xc0, 0xdb, 0xc3, 0xfb, 0x20, 1910 0x99, 0x05, 0xc1, 0x1c, 0xec, 0x83, 0x6c, 0x7f, 0x09, 0xbc, 0xf0, 0x08,
1905 0xde, 0x31, 0x19, 0x99, 0xd3, 0x1d, 0xb3, 0x90, 0x1f, 0xd4, 0x69, 0xac, 1911 0xae, 0xb7, 0xdb, 0x3d, 0xed, 0x17, 0x2e, 0xb2, 0xa7, 0xed, 0xca, 0xc9,
1906 0x6b, 0xfc, 0x82, 0xc9, 0x72, 0x33, 0xca, 0x5d, 0x72, 0x26, 0x58, 0xaf, 1912 0x8a, 0x3e, 0xd7, 0xae, 0xf3, 0xab, 0x92, 0xea, 0xbf, 0x5f, 0xa2, 0xd7,
1907 0xd4, 0x28, 0xc3, 0x63, 0x94, 0xdd, 0x4d, 0x32, 0x3a, 0x16, 0xda, 0xb8, 1913 0x4a, 0xf5, 0xe8, 0x9c, 0xb4, 0xb4, 0x7c, 0x38, 0x6e, 0xf4, 0x30, 0x61,
1908 0x9f, 0x5d, 0xcf, 0xb5, 0x81, 0x21, 0x09, 0x6d, 0xd8, 0x67, 0xd6, 0x9b, 1914 0x4a, 0x02, 0x9e, 0xad, 0xc0, 0x05, 0xe1, 0x31, 0x6d, 0x44, 0x6d, 0xba,
1909 0xb5, 0xdb, 0x2d, 0x31, 0xa9, 0x5f, 0x8d, 0x39, 0x38, 0xee, 0x5c, 0x1c, 1915 0x94, 0xfa, 0x70, 0x49, 0x3e, 0x12, 0x0f, 0xcf, 0x14, 0xa0, 0x1f, 0xc8,
1910 0x5f, 0xbd, 0xc0, 0x96, 0x4d, 0xd8, 0xd8, 0xe0, 0xb8, 0xd5, 0xc1, 0xcb, 1916 0xb8, 0x8f, 0x5d, 0x6a, 0xf4, 0xe4, 0xe6, 0x3a, 0xfd, 0x84, 0x73, 0x73,
1911 0xcb, 0x88, 0xea, 0xf9, 0x8f, 0xdb, 0x73, 0xbc, 0x51, 0x7b, 0xd7, 0x5f, 1917 0xec, 0xdc, 0x48, 0xb7, 0x7f, 0x96, 0xa0, 0x4f, 0xb1, 0x24, 0x4d, 0xab,
1912 0x42, 0xcf, 0xcf, 0x40, 0x65, 0x16, 0xfd, 0xad, 0x57, 0x99, 0x71, 0x8e, 1918 0xea, 0x33, 0xa6, 0xbf, 0xe1, 0x72, 0x73, 0x46, 0x81, 0x75, 0x5d, 0xd8,
1913 0x73, 0xee, 0x7e, 0x1e, 0xc8, 0xc5, 0x56, 0x35, 0x34, 0xbe, 0x80, 0x2e, 1919 0xa6, 0xb4, 0x73, 0x89, 0x47, 0xbd, 0x6e, 0x05, 0x25, 0x3c, 0x67, 0x00,
1914 0x41, 0xb7, 0x1c, 0x9b, 0x03, 0xda, 0xbd, 0x57, 0x26, 0x46, 0x09, 0x5f, 1920 0x6e, 0xae, 0x5c, 0xe1, 0xbe, 0x43, 0x91, 0x0e, 0x43, 0x5c, 0x7f, 0x5b,
1915 0x47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 0x9e, 0x78, 0x11, 0x3c, 0x71, 0x7e, 0x0d, 0x4f, 0x3c, 0x6d,
1930 0xfa, 0x86, 0x70, 0xdf, 0x09, 0xbd, 0x16, 0xec, 0x37, 0xf2, 0x6a, 0x56, 1936 0xe9, 0x7f, 0xa1, 0x86, 0x27, 0xe6, 0x6c, 0xd9, 0xcc, 0x45, 0x78, 0xe2,
1931 0x46, 0x2a, 0x5c, 0xc3, 0x64, 0x3b, 0x48, 0x2f, 0xd7, 0xc0, 0x1e, 0x58, 1937 0x52, 0x2f, 0xf5, 0xa5, 0x31, 0x79, 0x15, 0x3c, 0x21, 0x8a, 0x3c, 0x71,
1932 0x78, 0xbe, 0xba, 0x7f, 0x7e, 0x1e, 0x12, 0xe3, 0x42, 0x58, 0xee, 0xd6, 1938 0xa9, 0xe6, 0x09, 0xc6, 0x8e, 0xc8, 0x17, 0x9d, 0x90, 0x23, 0xe4, 0x8b,
1933 0x67, 0x17, 0xab, 0xef, 0x1e, 0xb9, 0xf2, 0xbf, 0x70, 0xfd, 0xd0, 0xc8, 1939 0xb3, 0xb2, 0x04, 0xbe, 0x78, 0x5e, 0x71, 0xec, 0x19, 0xda, 0x0a, 0x25,
1934 0x50, 0x0b, 0x47, 0x86, 0xf2, 0xce, 0xc8, 0x95, 0xaf, 0xcb, 0x41, 0xe0, 1940 0xfa, 0x64, 0x27, 0x8a, 0x5d, 0xe0, 0x77, 0x25, 0xff, 0x65, 0x3a, 0x08,
1935 0xf1, 0x30, 0x60, 0x52, 0xf7, 0xf3, 0xce, 0xab, 0x57, 0xa5, 0x30, 0x59, 1941 0x16, 0xe1, 0xa7, 0x3f, 0x08, 0x7b, 0x3e, 0xaa, 0xbf, 0xa9, 0xb8, 0x00,
1936 0x2f, 0xea, 0xa1, 0x82, 0xe3, 0x3e, 0x54, 0x2b, 0x91, 0x87, 0x94, 0x53, 1942 0xba, 0x0f, 0xe9, 0x7d, 0xc2, 0x01, 0xbd, 0x1f, 0x9e, 0xc5, 0x1c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0x3d, 0x05, 0x9e, 0x6c, 0x89, 0xd7, 0xcd, 1950 0xbb, 0xda, 0xde, 0x3f, 0x00, 0xf8, 0x76, 0x2f, 0xdb, 0xfb, 0xec, 0x83,
1945 0xd9, 0x43, 0x46, 0xf6, 0xd6, 0x01, 0x6e, 0xc0, 0x6f, 0xec, 0x3b, 0x21, 1951 0x76, 0x87, 0xc8, 0xf5, 0xb0, 0xf9, 0xde, 0x0d, 0x1e, 0xbc, 0x01, 0xbe,
1946 0x9d, 0x0a, 0x24, 0x37, 0x69, 0xb6, 0xa3, 0x67, 0x87, 0x98, 0x39, 0x33, 1952 0xd4, 0x7b, 0x0a, 0xae, 0xec, 0x29, 0xb4, 0xc3, 0xe7, 0xee, 0x94, 0xf7,
1947 0x34, 0xb3, 0xc2, 0xd8, 0x91, 0xf8, 0x36, 0x74, 0xa1, 0x64, 0xfb, 0xd8, 1953 0x4e, 0x6f, 0x95, 0x9d, 0x25, 0xff, 0x12, 0x69, 0xee, 0x80, 0x8d, 0x5a,
1948 0x4b, 0x4e, 0x3f, 0xcf, 0x3c, 0x8a, 0xb6, 0x1b, 0x97, 0xb3, 0x09, 0xc1, 1954 0x00, 0x9c, 0x11, 0x2b, 0xb7, 0xcf, 0x02, 0x6f, 0xdd, 0xc9, 0x9f, 0xa8,
1949 0x4b, 0xcf, 0x5b, 0xff, 0x32, 0x08, 0xc6, 0x52, 0x29, 0xde, 0x2b, 0xb8, 1955 0x17, 0xad, 0x5d, 0xc4, 0xb3, 0x8e, 0xf5, 0xfa, 0x89, 0xa3, 0x3d, 0x63,
1950 0x8c, 0x4f, 0xb9, 0xca, 0x99, 0x1c, 0x6d, 0x70, 0x26, 0x46, 0x03, 0xd9, 1956 0x29, 0x1d, 0x72, 0xea, 0x18, 0xbd, 0xaf, 0x24, 0xec, 0x72, 0x1f, 0x36,
1951 0x93, 0xe2, 0x9d, 0x49, 0xdc, 0x93, 0xa0, 0xe3, 0xe3, 0x48, 0x6b, 0x87, 1957 0xc9,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e, 0xec, 0xd4, 0xb3, 0xb8,
1959 0x4e, 0x16, 0x33, 0x5b, 0xd7, 0x81, 0x3e, 0xce, 0xa7, 0x3e, 0x46, 0xf9, 1965 0x9e, 0x91, 0xd4, 0x9e, 0x71, 0xa7, 0x2f, 0xd9, 0xed, 0x40, 0x77, 0xe2,
1960 0x05, 0xdb, 0xef, 0x45, 0xc9, 0x57, 0x3e, 0x24, 0xe3, 0x2d, 0xed, 0xde, 1966 0x8a, 0x3a, 0x7d, 0x6e, 0xa3, 0x73, 0x85, 0xed, 0xa3, 0x41, 0x9e, 0xd9,
1961 0xfd, 0x7a, 0x6e, 0x2e, 0x03, 0x67, 0x2d, 0x2a, 0x3b, 0xfa, 0xc4, 0x3a, 1967 0xab, 0x12, 0x2d, 0x58, 0x93, 0xed, 0x4e, 0x8f, 0x2d, 0xe3, 0x73, 0xca,
1962 0xea, 0xb7, 0xdd, 0x45, 0x05, 0x5e, 0x56, 0xbf, 0x88, 0x07, 0x36, 0x6e, 1968 0x78, 0x40, 0xa7, 0xd4, 0x96, 0x0d, 0x22, 0x5d, 0x2d, 0xb0, 0x79, 0x26,
1963 0xad, 0xb6, 0x51, 0xf6, 0xa6, 0x58, 0xae, 0xc1, 0xe9, 0x1d, 0x5d, 0x85, 1969 0x44, 0xb5, 0xb7, 0x48, 0x54, 0xba, 0x67, 0x55, 0x27, 0xca, 0x3c, 0x5b,
1964 0x79, 0xdc, 0x05, 0xfd, 0xe9, 0xc0, 0x46, 0x22, 0xae, 0x1b, 0x9c, 0x3d, 1970 0x16, 0x6f, 0x81, 0x7e, 0x40, 0x59, 0x07, 0xca, 0xb6, 0xd9, 0xb2, 0xb6,
1965 0xa3, 0x79, 0xf4, 0xc8, 0x7d, 0xd6, 0xbc, 0xf7, 0xf0, 0x30, 0xc6, 0xa8, 1971 0x16, 0x69, 0x44, 0xd9, 0x8c, 0xe6, 0xf9, 0xf3, 0x3d, 0x9e, 0x9b, 0x75,
1966 0xe5, 0x2b, 0x78, 0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 0x5b, 0x54, 1979 0x59, 0x50, 0x56, 0xf9, 0xc5, 0xc0, 0xac, 0x31, 0x79, 0xc1, 0xc8, 0xa5,
1974 0x9e, 0xf1, 0xfc, 0x5d, 0xad, 0x66, 0xdf, 0x11, 0xcb, 0x7a, 0xb0, 0x4b, 1980 0x0f, 0x18, 0xb9, 0xf4, 0xd8, 0x99, 0x15, 0x72, 0xe9, 0xbc, 0x96, 0x4b,
1975 0x69, 0xe3, 0x12, 0x77, 0x7a, 0xae, 0x8a, 0xdc, 0x5b, 0x9c, 0xf3, 0x2f, 1981 0x7b, 0x05, 0xf7, 0xf9, 0xf3, 0x90, 0x4b, 0x2f, 0xe2, 0xd9, 0xd5, 0x72,
1976 0x43, 0x9e, 0x5c, 0xeb, 0xbd, 0x4d, 0x91, 0xf6, 0x42, 0xfc, 0x12, 0xb7, 1982 0x29, 0x2e, 0xd6, 0x5e, 0x96, 0xaf, 0xea, 0xf1, 0xe7, 0x8a, 0x51, 0x6d,
1977 0x09, 0xe0, 0x95, 0x71, 0x95, 0xd3, 0x41, 0x66, 0x80, 0x7c, 0xc5, 0x36, 1983 0x57, 0xe5, 0x67, 0x60, 0x93, 0x14, 0xa7, 0xac, 0xfe, 0x96, 0xa1, 0x36,
1978 0x98, 0xff, 0xa2, 0x8e, 0xe5, 0x0e, 0xa6, 0x18, 0x27, 0x6a, 0x3f, 0x71, 1984 0xe9, 0x19, 0xfc, 0xa9, 0x84, 0x36, 0xe7, 0x7f, 0xba, 0x84, 0xdf, 0xee,
1979 0x87, 0x0a, 0x65, 0xd3, 0x2c, 0xd7, 0x10, 0x1c, 0xde, 0x21, 0xba, 0x0b, 1985 0x7c, 0x5e, 0x51, 0x86, 0xbd, 0x0a, 0x19, 0x26, 0xaa, 0xbe, 0x0c, 0xc3,
1980 0x1d, 0x5e, 0x9c, 0x52, 0xce, 0x37, 0xc7, 0x5c, 0x7c, 0xd7, 0xd8, 0xfb, 1986 0xbb, 0x32, 0xde, 0x95, 0xd9, 0xef, 0x8f, 0x7e, 0x3a, 0xe6, 0x52, 0x7e,
1981 0x42, 0x8d, 0x6e, 0x12, 0xf9, 0xeb, 0x70, 0xbc, 0xf1, 0x3c, 0xe6, 0xfb, 1987 0x50, 0x66, 0x40, 0x26, 0x15, 0x21, 0x93, 0x8a, 0x90, 0x53, 0x45, 0xc8,
1982 0x12, 0xe6, 0x7b, 0xf9, 0xfb, 0x41, 0x91, 0x57, 0x46, 0x5e, 0xf9, 0x43, 1988 0x25, 0xd8, 0x6c, 0x67, 0x8a, 0x90, 0x4b, 0x45, 0xc8, 0x25, 0xc8, 0xb8,
1983 0x41, 0xa6, 0x89, 0xf4, 0x47, 0x9a, 0x7b, 0x3d, 0x9f, 0x59, 0xef, 0x63, 1989 0x27, 0x20, 0xe3, 0x8c, 0x4c, 0x1b, 0x85, 0x4c, 0x9b, 0x91, 0xfb, 0xac,
1984 0x02, 0x6c, 0x67, 0xc1, 0x0b, 0x19, 0xae, 0x25, 0x07, 0xc7, 0x52, 0x37, 1990 0xae, 0x37, 0xb1, 0x92, 0x7e, 0xeb, 0x23, 0x0d, 0xe8, 0x18, 0xf2, 0x99,
1985 0x81, 0x17, 0x76, 0xca, 0x9f, 0xc0, 0x16, 0xf8, 0xe3, 0x4a, 0x1a, 0x3c, 1991 0x9a, 0xd8, 0xe0, 0x8d, 0x47, 0x34, 0xbf, 0xbb, 0x9e, 0xba, 0xc2, 0x61,
1986 0xd1, 0x03, 0x1e, 0xe9, 0x06, 0x5f, 0xa4, 0xb4, 0x5d, 0xfc, 0x28, 0x74, 1992 0x0e, 0xcd, 0x4f, 0xb4, 0xff, 0xbe, 0x9d, 0xbf, 0xa5, 0x09, 0x7c, 0xfd,
1987 0xde, 0xd9, 0x4a, 0xc9, 0xd9, 0x3b, 0x5a, 0x74, 0x72, 0xa3, 0x47, 0x41, 1993 0x03, 0xcb, 0xd7, 0xdb, 0x97, 0xf9, 0x3a, 0xe5, 0x30, 0x56, 0x5c, 0x9f,
1988 0x17, 0xdc, 0x03, 0xab, 0xae, 0xa9, 0x11, 0x37, 0x3e, 0x29, 0xa4, 0xff, 1994 0xaf, 0x3b, 0xec, 0xbb, 0x5c, 0xb0, 0x0e, 0x7c, 0xbd, 0x6e, 0x15, 0x5f,
1989 0x76, 0xee, 0xed, 0x68, 0x06, 0xae, 0xce, 0x10, 0x57, 0x93, 0x95, 0x2d, 1995 0xc7, 0xc0, 0xd7, 0x7b, 0xd6, 0xf0, 0xf5, 0x06, 0x67, 0x58, 0xb7, 0xe1,
1990 0xde, 0x3a, 0xf0, 0x41, 0xb3, 0xe6, 0x83, 0x46, 0x27, 0xe3, 0xdd, 0x64, 1996 0x19, 0x09, 0x3e, 0x37, 0x3a, 0x55, 0xbe, 0xbe, 0x47, 0xf3, 0xf5, 0x21,
1991 0xf9, 0x60, 0x04, 0x7c, 0x50, 0x58, 0xc2, 0x07, 0xcf, 0x58, 0x9a, 0x9f, 1997 0xf0, 0xf5, 0x75, 0x35, 0x7c, 0xbd, 0x47, 0x52, 0x37, 0x67, 0x22, 0x5b,
1992 0xae, 0xe2, 0x83, 0x49, 0x9b, 0x36, 0x7e, 0x05, 0x3e, 0xb8, 0xca, 0x4f, 1998 0x65, 0xfc, 0x7e, 0xd5, 0xbe, 0x49, 0xfe, 0x49, 0x4c, 0x7b, 0xc3, 0x63,
1993 0x3e, 0x39, 0x24, 0x27, 0xc0, 0x07, 0x0f, 0x6b, 0x3e, 0xb8, 0x4a, 0xf3, 1999 0xc3, 0xd3, 0xed, 0x92, 0x7d, 0xe8, 0x15, 0x94, 0x91, 0xcf, 0x52, 0x63,
1994 0x01, 0xe3, 0x46, 0xe4, 0x85, 0x56, 0xc8, 0x0e, 0xf2, 0xc2, 0xb3, 0x32, 2000 0x69, 0xc7, 0x95, 0x83, 0x47, 0x7e, 0x22, 0x0b, 0x9a, 0xb7, 0x44, 0x26,
1995 0x0b, 0x5e, 0x78, 0x51, 0xb1, 0xef, 0xcb, 0xb4, 0x0f, 0x46, 0xe9,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0x31,
2010 0x56, 0x56, 0x47, 0xc1, 0x03, 0xed, 0x89, 0x1f, 0xa8, 0x44, 0xab, 0x91, 2016 0xf5, 0x7c, 0x99, 0xdf, 0xb0, 0x81, 0xff, 0x59, 0xe6, 0xb7, 0xb0, 0xf6,
2011 0xed, 0x3c, 0x4b, 0xbe, 0x5c, 0x3b, 0x31, 0xd4, 0x67, 0x1c, 0xa5, 0x45, 2017 0xb7, 0x9b, 0xf8, 0x2c, 0xf9, 0xee, 0x87, 0x0e, 0xbf, 0x5d, 0x35, 0xa5,
2012 0xce, 0x1c, 0xa7, 0xe7, 0x95, 0x80, 0x2d, 0x9e, 0x82, 0x1d, 0xb2, 0x01, 2018 0x73, 0xbd, 0xf0, 0xbb, 0xcc, 0x67, 0xd6, 0x7f, 0x84, 0xf1, 0x8e, 0x64,
2013 0xed, 0x31, 0x96, 0xbc, 0x5a, 0x9e, 0xd9, 0xea, 0xde, 0x9d, 0xd3, 0x7c, 2019 0x52, 0xbd, 0xf7, 0x72, 0xe6, 0x1e, 0xec, 0x9d, 0x67, 0xdd, 0xad, 0x96,
2014 0x78, 0xc9, 0xc9, 0x8e, 0xdd, 0x24, 0x85, 0xc1, 0x28, 0xc6, 0xa0, 0x9a, 2020 0x47, 0xb7, 0x6a, 0xbf, 0x83, 0x36, 0xd6, 0x78, 0xe9, 0x45, 0xc9, 0xd3,
2015 0xd7, 0xca, 0xf5, 0xd2, 0xaf, 0xc7, 0x73, 0x59, 0x0e, 0x42, 0x1f, 0xff, 2021 0x36, 0x19, 0xdd, 0xea, 0xe4, 0x66, 0x92, 0x97, 0x1b, 0xfb, 0x79, 0xdd,
2016 0x69, 0xb1, 0x5f, 0x66, 0x07, 0x9a, 0xf0, 0x1d, 0x95, 0x67, 0x8a, 0x5b, 2022 0xa5, 0xcc, 0x3b, 0x4c, 0xab, 0xb5, 0x32, 0xf9, 0x84, 0x84, 0x32, 0x39,
2017 0xe0, 0xef, 0xfc, 0x0a, 0x70, 0x54, 0x8b,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xcd, 0x97, 0x69, 0x21, 0x39, 0xa9, 0xf3, 0xf5, 0x53, 0x39, 0x9e, 0x6f,
2025 0xd5, 0xdc, 0x20, 0xae, 0xb4, 0x4f, 0xa8, 0x56, 0xa4, 0xf9, 0x36, 0x2d, 2031 0xda, 0xa0, 0x18, 0x27, 0xa9, 0xae, 0x7f, 0xeb, 0xbf, 0xe8, 0xfa, 0xbf,
2026 0xd6, 0x00, 0x9d, 0x80, 0xb4, 0x16, 0xa4, 0x6d, 0xb2, 0x69, 0x4d, 0x0d, 2032 0xfc, 0xff, 0x79, 0xfd, 0xd5, 0xa5, 0xcc, 0xdd, 0xe7, 0x99, 0x55, 0x23,
2027 0x52, 0x8b, 0xb4, 0xcb, 0x9a, 0xe7, 0x2f, 0x76, 0xf8, 0x5e, 0xce, 0xa9, 2033 0x8f, 0x43, 0x7a, 0x88, 0x5d, 0x6a, 0xf4, 0x02, 0xd7, 0x98, 0xcf, 0x90,
2028 0x97, 0xb6, 0x53, 0x0d, 0x90, 0x0d, 0xab, 0x65, 0x66, 0x6b, 0x9d, 0xb4, 2034 0x67, 0x90, 0x7f, 0x67, 0x20, 0xff, 0x9e, 0x84, 0xfc, 0x3b, 0xbd, 0x62,
2029 0x21, 0x8f, 0x31, 0xee, 0xd4, 0xa9, 0xa8, 0xbc, 0xf3, 0x54, 0x7b, 0xfc, 2035 0x4f, 0x60, 0xd0, 0xc6, 0x23, 0x02, 0x39, 0xe8, 0x57, 0xf1, 0xb1, 0x38,
2030 0xa3, 0x18, 0x43, 0xfb, 0x19, 0xc6, 0xbc, 0xff, 0xac, 0x99, 0x31, 0x9f, 2036 0x40, 0x7c, 0x98, 0xfc, 0x13, 0xe6, 0xfe, 0xae, 0xc4, 0x49, 0x54, 0xe7,
2031 0xb6, 0x33, 0x7c, 0xd7, 0x69, 0xf9, 0x43, 0x7c, 0x98, 0x3b, 0xdf, 0x60, 2037 0x1c, 0x3d, 0xea, 0xd7, 0xe2, 0x84, 0x70, 0xbf, 0x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e3, 0xb0, 0x43, 0x4a, 0x23, 0x56, 0x67, 0x4b, 0xba, 2045 0x9f, 0x99, 0xef, 0x70, 0x13, 0x86, 0x59, 0xfd, 0xdd, 0x29, 0xfa, 0x80,
2040 0x49, 0x3a, 0x7a, 0x7e, 0x2a, 0xa1, 0x9d, 0x39, 0xdb, 0xcc, 0x3b, 0x8f, 2046 0xa4, 0x87, 0x04, 0x9e, 0x67, 0x6c, 0x5c, 0x29, 0x21, 0xf9, 0xc2, 0x05,
2041 0x5f, 0x54, 0x94, 0x61, 0x27, 0x20, 0xc3, 0x1e, 0xbe, 0x82, 0x0c, 0x43, 2047 0xf3, 0x6d, 0xcb, 0xc2, 0x4b, 0xb8, 0xbf, 0xde, 0x7a, 0x18, 0x3f, 0x64,
2042 0x5e, 0x19, 0x79, 0x65, 0xb6, 0xfb, 0xdd, 0x9f, 0x0e, 0x79, 0x94, 0x1f, 2048 0xd4, 0xdc, 0xd1, 0xd7, 0x92, 0xa4, 0xcb, 0x26, 0xc7, 0xa5, 0x1a, 0x37,
2043 0x94, 0x19, 0x90, 0x49, 0x25, 0xc8, 0xa4, 0x12, 0xe4, 0x54, 0x09, 0x72, 2049 0x99, 0x91, 0xc3, 0xda, 0x7e, 0x1e, 0xb2, 0xb9, 0x2d, 0xa9, 0xd1, 0x9c,
2044 0xa9, 0x04, 0xb9, 0x54, 0x82, 0x5c, 0x2a, 0x41, 0x2e, 0x41, 0xc6, 0x3d, 2050 0x18, 0x1b, 0xfa, 0x77, 0x60, 0x43, 0x7f, 0xb1, 0x92, 0xd6, 0xfb, 0x58,
2045 0x0a, 0x19, 0x67, 0x64, 0xda, 0x00, 0xed, 0x35, 0xb9, 0xcf, 0xea, 0x77, 2051 0xa7, 0x61, 0x43, 0x3f, 0x01, 0xdd, 0x43, 0x9d, 0x13, 0xb7, 0x3a, 0x67,
2046 0x13, 0x27, 0xe9, 0xb2, 0x7e, 0x91, 0xd9, 0xb3, 0x7a, 0xae, 0x2a, 0x2e, 2052 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 0xbc, 0x79,
2083 0x73, 0xaa, 0xe9, 0xe1, 0x37, 0xe7, 0xe8, 0x61, 0xdc, 0xf9, 0xd7, 0xd2, 2089 0xa7, 0x74, 0x0f, 0xe2, 0xfd, 0xe0, 0x05, 0xe9, 0xb9, 0xf9, 0x56, 0xa7,
2084 0xc3, 0x0d, 0x0b, 0xe8, 0x61, 0x44, 0xd3, 0x43, 0xff, 0x1c, 0x3d, 0x8c, 2090 0x71, 0x74, 0x04, 0x78, 0x4c, 0x3b, 0xa9, 0xc4, 0x98, 0xb3, 0x80, 0x71,
2085 0x1c, 0x61, 0xbf, 0x7a, 0x5d, 0xd4, 0x9b, 0x71, 0x38, 0xe7, 0x73, 0xb4, 2091 0x32, 0xdb, 0x23, 0xc2, 0xb8, 0xe5, 0x02, 0x63, 0x11, 0x37, 0x77, 0x47,
2086 0x90, 0x18, 0xd6, 0xfb, 0x44, 0x93, 0x79, 0x9e, 0x25, 0x5d, 0xa5, 0x18, 2092 0xfa, 0x92, 0xe3, 0x4e, 0x6a, 0x54, 0x45, 0x52, 0xa3, 0x23, 0x4e, 0x58,
2087 0x1b, 0x99, 0x9f, 0xff, 0xc6, 0x7f, 0xd3, 0xf9, 0x7f, 0x47, 0xfc, 0xff, 2093 0x8f, 0xdf, 0x48, 0x85, 0x9c, 0x01, 0xac, 0x07, 0x8a, 0xd3, 0xa0, 0xa7,
2088 0xef, 0xfc, 0x5f, 0x8f, 0xf6, 0x29, 0x8b, 0x43, 0x79, 0x1c, 0xd2, 0xc3, 2094 0xff, 0x28, 0xf9, 0x63, 0x2d, 0x32, 0x5f, 0xe8, 0x76, 0x33, 0x2a, 0xae,
2089 0x7b, 0xe2, 0x46, 0x2f, 0x70, 0x8e, 0xf9, 0x6d, 0xf6, 0xac, 0x9f, 0x83, 2095 0x73, 0x4b, 0xd4, 0x09, 0x10, 0xfd, 0xa9, 0x98, 0xcc, 0x96, 0xb6, 0x8a,
2090 0xfc, 0x7b, 0x1c, 0xf2, 0xef, 0xb1, 0x05, 0xeb, 0x01, 0x3d, 0x36, 0x06, 2096 0xd2, 0xb6, 0x7b, 0x87, 0x64, 0xa6, 0x4b, 0x72, 0x6e, 0x40, 0xda, 0x14,
2091 0x11, 0xc8, 0xc1, 0xd4, 0x3c, 0x3e, 0x66, 0xba, 0x89, 0x0f, 0xb3, 0xf7, 2097 0xfa, 0xe7, 0xb7, 0x67, 0xd5, 0x09, 0xee, 0x25, 0x86, 0xbc, 0x70, 0x39,
2092 0xe4, 0x6c, 0x65, 0x31, 0x4e, 0x5c, 0xbd, 0xdf, 0xe8, 0x64, 0xaa, 0x1a, 2098 0xf9, 0xa4, 0x04, 0x1c, 0x82, 0x6e, 0x19, 0xe3, 0x6d, 0x12, 0xca, 0xbd,
2093 0x27, 0x84, 0x7b, 0xb6, 0x6a, 0x8c, 0xf8, 0x5d, 0xe6, 0xf7, 0x65, 0xbd, 2099 0x8f, 0xea, 0xf8, 0x29, 0x63, 0xb6, 0xb5, 0x7b, 0x0f, 0xe4, 0x8f, 0x58,
2094 0x87, 0xa4, 0xa0, 0xd7, 0x9f, 0x88, 0x17, 0xae, 0x3f, 0x11, 0x27, 0xae, 2100 0x5d, 0xfe, 0x98, 0x2b, 0x72, 0x9f, 0x46, 0x72, 0x51, 0xc6, 0x88, 0x3d,
2095 0xb6, 0xf7, 0x0b, 0xe5, 0x3a, 0xbd, 0x2f, 0xfc, 0xc0, 0x54, 0x4c, 0x66, 2101 0xfc, 0x9e, 0x61, 0xdd, 0x26, 0x99, 0x1a, 0xc8, 0xd9, 0x3c, 0x8f, 0x47,
2096 0x62, 0x8c, 0xeb, 0xf1, 0xde, 0x57, 0xfa, 0xca, 0x7e, 0xbc, 0x20, 0x79, 2102 0x12, 0xcc, 0x21, 0x26, 0x4e, 0xc6, 0x07, 0xc8, 0xeb, 0xab, 0xf7, 0x36,
2097 0x7b, 0xd6, 0x67, 0x95, 0xa5, 0x6d, 0xc6, 0x03, 0x79, 0x27, 0x42, 0xb8, 2103 0x62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 0xe7, 0xb5, 0xca, 0xbb, 2125 0xde, 0x34, 0xcf, 0xb8, 0x3c, 0xbf, 0x47, 0xc5, 0x98, 0xfc, 0x3f, 0x67,
2120 0xc7, 0x36, 0xc8, 0xbe, 0x51, 0xff, 0x6a, 0xa9, 0xdf, 0x28, 0x23, 0xa3, 2126 0xfd, 0x7e, 0xe1, 0x32, 0x63, 0xcf, 0x6c, 0xb2, 0x76, 0x8c, 0x89, 0x53,
2121 0x2f, 0xea, 0xfb, 0x40, 0xd6, 0xe8, 0x7b, 0x92, 0x78, 0x7f, 0x98, 0x91, 2127 0xd5, 0xb7, 0x61, 0xd8, 0x4f, 0xed, 0x37, 0x14, 0xb7, 0x38, 0x93, 0xa5,
2122 0x91, 0xfd, 0x8e, 0x91, 0x91, 0x19, 0x35, 0x6f, 0xb3, 0x86, 0x6d, 0xf2, 2128 0xad, 0x4e, 0xbe, 0xc4, 0xbd, 0x6c, 0xfb, 0xf7, 0x2e, 0xdc, 0x3d, 0xce,
2123 0x6e, 0xa6, 0xbe, 0xd1, 0xb8, 0xbe, 0x43, 0x7a, 0xa2, 0x72, 0xad, 0xfc, 2129 0x01, 0x6f, 0x0b, 0xca, 0x18, 0xb3, 0x64, 0xcc, 0xe6, 0x97, 0x2e, 0x63,
2124 0xd1, 0x71, 0x75, 0xa7, 0x9a, 0xbf, 0x4b, 0x41, 0xdb, 0xac, 0x93, 0x0b, 2130 0x8c, 0x36, 0xe3, 0x71, 0x6c, 0x96, 0x6d, 0x71, 0xa6, 0x4a, 0xdd, 0xf0,
2125 0x6c, 0xd6, 0xbf, 0x97, 0x99, 0xf7, 0x45, 0x31, 0x4e, 0xd0, 0xf0, 0x75, 2131 0xcd, 0x79, 0xae, 0x8a, 0xef, 0x77, 0x72, 0xed, 0xa0, 0x83, 0x5d, 0x7d,
2126 0x2f, 0x73, 0x1d, 0xb4, 0x39, 0x26, 0x97, 0xa4, 0x4f, 0xe3, 0x8f, 0xf2, 2132 0x66, 0x77, 0x42, 0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, 0xb6,
2134 0x85, 0xb9, 0xf5, 0x80, 0x3c, 0xf9, 0x4c, 0x1d, 0xf5, 0xa6, 0x8d, 0x3c, 2140 0xed, 0x84, 0xdd, 0x93, 0xcf, 0xcb, 0xdc, 0x65, 0xd4, 0x83, 0x23, 0x91,
2135 0xf0, 0x90, 0xfe, 0x45, 0xe8, 0x0e, 0xd6, 0x45, 0xfa, 0xb1, 0x0c, 0xe6, 2141 0xf5, 0xfc, 0x7e, 0x22, 0xda, 0xf6, 0x18, 0xbd, 0x28, 0x61, 0x5f, 0x7c,
2136 0xf0, 0x24, 0xfc, 0x9f, 0x46, 0x7c, 0x37, 0xe3, 0x7b, 0x42, 0x7e, 0x75, 2142 0x6e, 0xa8, 0xe9, 0x9b, 0x76, 0x14, 0xef, 0xab, 0xcf, 0x91, 0x3d, 0xa3,
2137 0x30, 0xaa, 0xc7, 0x3d, 0x82, 0x71, 0x1c, 0x38, 0x82, 0x31, 0x39, 0xc6, 2143 0xf7, 0x19, 0xcd, 0xf7, 0x12, 0x42, 0x3e, 0x21, 0xef, 0x24, 0xf5, 0x59,
2138 0x76, 0x76, 0xcf, 0xb8, 0x52, 0x73, 0x86, 0x7c, 0xc7, 0x33, 0x86, 0x41, 2144 0x27, 0xef, 0x61, 0xda, 0x3d, 0xdc, 0x83, 0x75, 0x17, 0x26, 0xfd, 0x4f,
2139 0xb0, 0xb7, 0x8b, 0x74, 0x9b, 0xf4, 0xfa, 0xf5, 0xf9, 0xb7, 0xcd, 0xf1, 2145 0xe8, 0x6f, 0xfc, 0xcd, 0x88, 0x38, 0x79, 0xff, 0x36, 0x9d, 0x7b, 0x92,
2140 0x08, 0x70, 0x72, 0x00, 0xf3, 0x31, 0x52, 0xf4, 0xbd, 0xac, 0xe3, 0xc7, 2146 0xd7, 0xb1, 0xe6, 0x1c, 0xee, 0x55, 0x1f, 0xb5, 0xeb, 0x61, 0xfe, 0x4d,
2141 0x31, 0x4e, 0xd8, 0x80, 0xed, 0xb0, 0x05,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0xca, 0xb2, 0x2e, 0xc0, 0x32, 0x72, 0x94, 0xfa, 0xcc, 0xd3, 0x3c, 0x0e,
2149 0x19, 0xc0, 0x7a, 0xa0, 0xf4, 0x75, 0xd0, 0xd3, 0x79, 0x29, 0x1c, 0x6f, 2155 0x18, 0xdc, 0x06, 0xed, 0x87, 0x90, 0x2f, 0xdf, 0x22, 0xde, 0x03, 0x90,
2150 0x90, 0xa9, 0x62, 0xbb, 0x97, 0x55, 0x31, 0xe1, 0xbe, 0x12, 0x75, 0x0a, 2156 0x71, 0x47, 0x63, 0xd2, 0x73, 0xb4, 0x45, 0xb6, 0x1d, 0xa5, 0x1f, 0x52,
2151 0x44, 0x7f, 0x26, 0x2a, 0x13, 0xa3, 0x1b, 0x45, 0x69, 0xdb, 0xbd, 0x45, 2157 0xeb, 0x97, 0xd2, 0x2e, 0x7d, 0x04, 0x73, 0x7c, 0xb7, 0x96, 0x93, 0xdc,
2152 0xb2, 0x63, 0xa3, 0x72, 0xbe, 0x5b, 0x9a, 0x14, 0xda, 0xe7, 0xdd, 0xde, 2158 0xd3, 0xdc, 0x4f, 0xde, 0x45, 0xdd, 0x2c, 0x6c, 0xe6, 0xcc, 0x51, 0x57,
2153 0xea, 0x14, 0xd7, 0x11, 0x43, 0x5e, 0x58, 0x4f, 0x3e, 0x19, 0x05, 0x0e, 2159 0xef, 0x91, 0x66, 0x30, 0xe7, 0x6c, 0xd9, 0xc5, 0x38, 0x46, 0xe6, 0xe4,
2154 0x41, 0xb7, 0x8c, 0xeb, 0xd6, 0x09, 0xe5, 0xde, 0xed, 0x3a, 0x66, 0xca, 2160 0xe9, 0xa7, 0x8c, 0x76, 0x00, 0xc7, 0xef, 0xb5, 0xbc, 0xb3, 0xbe, 0xc3,
2155 0x38, 0x6d, 0xf5, 0x7a, 0x03, 0xf9, 0x23, 0xba, 0x2c, 0x7f, 0x4c, 0x96, 2161 0xf2, 0xe8, 0xcf, 0xc8, 0x7b, 0x5b, 0x3a, 0x8c, 0xec, 0x7c, 0x4b, 0x07,
2156 0xb8, 0x36, 0x23, 0x79, 0x97, 0x71, 0x61, 0x1f, 0xbf, 0xc7, 0x59, 0xb6, 2162 0x73, 0x93, 0x36, 0x7b, 0xbc, 0x37, 0x69, 0x7b, 0xc2, 0xc8, 0xd0, 0xd7,
2157 0x4e, 0x46, 0xba, 0xf3, 0x76, 0x8f, 0xc7, 0x37, 0xc1, 0x07, 0x1c, 0x9f, 2163 0xe2, 0x45, 0x01, 0x8e, 0xc2, 0x7d, 0x29, 0x7d, 0x96, 0x2f, 0x38, 0xe7,
2158 0x5e, 0x27, 0x01, 0xaf, 0x2f, 0x5e, 0xcf, 0x88, 0x56, 0xc9, 0x03, 0x47, 2164 0xeb, 0xf3, 0x2b, 0xfe, 0xa2, 0xfe, 0x3b, 0x21, 0xdc, 0x23, 0xab, 0x7e,
2159 0x66, 0x46, 0xc3, 0xf5, 0x0f, 0xb6, 0x87, 0xef, 0x71, 0x23, 0x6f, 0xb3, 2165 0x6f, 0x65, 0x57, 0x85, 0x71, 0xf2, 0xcf, 0x86, 0x7f, 0x97, 0xa4, 0x26,
2160 0x4b, 0xea, 0x11, 0x2e, 0xae, 0x55, 0x2e, 0x94, 0xb1, 0x4a, 0x9f, 0x13, 2166 0xef, 0xb0, 0x76, 0x0f, 0x8c, 0xb1, 0xa6, 0xe5, 0xdc, 0xa0, 0xa0, 0xa4,
2161 0xf6, 0xb4, 0x7c, 0x3d, 0x5d, 0x31, 0xb2, 0x75, 0xbc, 0x12, 0xea, 0x96, 2167 0xbf, 0x5f, 0xf4, 0x9c, 0x73, 0xbe, 0x70, 0xd6, 0xf9, 0xee, 0xb4, 0x04,
2162 0xa8, 0xd1, 0xa5, 0x4b, 0xf4, 0x89, 0x89, 0x60, 0xce, 0xeb, 0x93, 0x4b, 2168 0x51, 0xef, 0x27, 0xce, 0xf7, 0x3d, 0xee, 0x99, 0x7f, 0xdd, 0xf9, 0x5e,
2163 0x3a, 0x46, 0xf7, 0x6b, 0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 0xaf, 0x30, 0x36, 0xfe, 2227 0xb5, 0x90, 0x1f, 0xaa, 0x7f, 0xa7, 0x40, 0xe4, 0xff, 0x02, 0xfb, 0x2e,
2222 0x4c, 0xf8, 0x37, 0x9c, 0xaa, 0xf6, 0x19, 0x56, 0xaf, 0x75, 0x31, 0xbe, 2228 0x88, 0x71, 0xec, 0x6e, 0x00, 0x00, 0x00 };
2223 0x34, 0xb7, 0x17, 0x28, 0x18, 0xd5, 0x77, 0xc2, 0xc5, 0x9c, 0x8b, 0xc5, 2229
2224 0x5a, 0xe7, 0x9b, 0x63, 0x12, 0xb8, 0x7e, 0xdc, 0xf9, 0x96, 0xcf, 0xb5, 2230static const u32 bnx2_CP_b09FwData[(0x0/4) + 1] = { 0x0 };
2225 0x71, 0xcf, 0x79, 0xb9, 0xe8, 0x83, 0xf7, 0xfe, 0x02, 0xe3, 0x68, 0x75, 2231static const u32 bnx2_CP_b09FwRodata[(0x118/4) + 1] = {
2226 0x5e, 0xc1, 0x9c, 0x1e, 0x2c, 0x65, 0x92, 0x9e, 0x8d, 0x83, 0x3f, 0x5b, 2232 0x0800061c, 0x0800083c, 0x08000780, 0x080007a8, 0x080007d0, 0x080007f8,
2227 0x6c, 0x75, 0x9e, 0x9b, 0x8f, 0x21, 0xf5, 0x84, 0x74, 0x71, 0x88, 0x79, 2233 0x08000654, 0x08000640, 0x08000864, 0x08000864, 0x08000670, 0x0800068c,
2228 0x65, 0xe4, 0x95, 0x19, 0xeb, 0xad, 0x77, 0x26, 0xc7, 0xec, 0x7e, 0x12, 2234 0x0800068c, 0x08000864, 0x080006a4, 0x080006b8, 0x08000864, 0x080006cc,
2229 0xa3, 0x8b, 0xe6, 0xd6, 0x5f, 0x06, 0xf4, 0xfa, 0x84, 0xeb, 0x4c, 0x4e, 2235 0x08000864, 0x08000864, 0x080006e0, 0x08000864, 0x08000864, 0x08000864,
2230 0x4d, 0xaf, 0x37, 0xfb, 0x8a, 0x6a, 0x91, 0x67, 0xf6, 0x58, 0x4e, 0x4c, 2236 0x08000864, 0x08000864, 0x08000864, 0x08000864, 0x08000864, 0x08000864,
2231 0xd5, 0xa2, 0x4c, 0xbd, 0x33, 0xa1, 0x63, 0x5e, 0xda, 0xf6, 0x70, 0xc6, 2237 0x08000864, 0x080006f4, 0x08000864, 0x08000708, 0x0800071c, 0x08000730,
2232 0xa7, 0xea, 0x9d, 0x29, 0xbd, 0xd6, 0x1c, 0x75, 0x4e, 0x8e, 0xb1, 0xed, 2238 0x08000864, 0x08000744, 0x08000758, 0x0800076c, 0x08003200, 0x08003218,
2233 0x28, 0xca, 0x88, 0x73, 0x0a, 0xed, 0x4d, 0x8d, 0xb5, 0xc7, 0xf7, 0x49, 2239 0x08003228, 0x08003238, 0x08003250, 0x08003268, 0x08003278, 0x08003288,
2234 0x3b, 0x6c, 0x01, 0xfe, 0x8d, 0x34, 0xde, 0x17, 0xe0, 0x3a, 0x53, 0x73, 2240 0x080032a8, 0x080032b8, 0x080032c8, 0x08003358, 0x08003298, 0x080032d8,
2235 0xed, 0x2a, 0xb4, 0xc3, 0xb2, 0xa4, 0x41, 0xf6, 0xeb, 0xa2, 0xfd, 0xa5, 2241 0x080032e8, 0x08003300, 0x08003320, 0x08003358, 0x08003338, 0x08003338,
2236 0x6b, 0x52, 0x4b, 0x71, 0x32, 0x06, 0x9c, 0x1c, 0xb4, 0x38, 0x39, 0x61, 2242 0x080050d4, 0x080050d4, 0x080050d4, 0x080050d4, 0x080050d4, 0x080050fc,
2237 0x71, 0x32, 0x5a, 0x85, 0x93, 0x87, 0x17, 0xe1, 0xe4, 0x04, 0x70, 0xf2, 2243 0x080050fc, 0x08005124, 0x08005174, 0x08005144, 0x00000000 };
2238 0xf0, 0x15, 0x70, 0x82, 0xbc, 0xf2, 0xc3, 0x16, 0x27, 0xf7, 0x2d, 0xc2, 2244static const u32 bnx2_CP_b09FwBss[(0x3b0/4) + 1] = { 0x0 };
2239 0x49, 0x7e, 0x2e, 0x16, 0x6f, 0x70, 0x32, 0x02, 0x9c, 0xd4, 0xb4, 0x1a, 2245static const u32 bnx2_CP_b09FwSbss[(0xa1/4) + 1] = { 0x0 };
2240 0xd8, 0x0f, 0x5a, 0x9c, 0xe0, 0x3d, 0x75, 0x10, 0x65, 0xee, 0xab, 0xc2,
2241 0xc9, 0x41, 0xe0, 0xe4, 0x3e, 0x8b, 0x93, 0xc3, 0x16, 0x27, 0x87, 0x51,
2242 0x26, 0x0f, 0x9c, 0x14, 0x96, 0xc1, 0xc9, 0x08, 0x70, 0x12, 0xb6, 0x5b,
2243 0x40, 0x3b, 0x87, 0xab, 0x70, 0x32, 0xb2, 0x0c, 0x4e, 0xb8, 0xe6, 0x1a,
2244 0xee, 0xe1, 0xbe, 0xfc, 0x06, 0x7b, 0xb8, 0x53, 0x9f, 0x7d, 0xe3, 0x3d,
2245 0xdc, 0x2c, 0x73, 0xb9, 0xea, 0xcc, 0xfb, 0xb3, 0x76, 0x4f, 0x9a, 0xd9,
2246 0xfb, 0x37, 0x7f, 0x0f, 0x5e, 0x3b, 0xf8, 0xbc, 0x90, 0xf7, 0xc4, 0xec,
2247 0x21, 0x75, 0xb7, 0x4d, 0x81, 0xd7, 0x8e, 0xca, 0x81, 0xe3, 0xb5, 0x87,
2248 0x73, 0x36, 0xcd, 0xdf, 0xd6, 0x9e, 0x57, 0x8a, 0x79, 0xe1, 0xde, 0x83,
2249 0x17, 0xcd, 0x5d, 0x50, 0x31, 0x9e, 0xc7, 0xa8, 0x5e, 0x7b, 0x7e, 0xd1,
2250 0xde, 0x55, 0xe4, 0xdd, 0x9b, 0xf5, 0xa7, 0x13, 0xdc, 0x57, 0x55, 0xd0,
2251 0xf0, 0x72, 0x2d, 0xad, 0x47, 0xef, 0xa5, 0xca, 0x16, 0x69, 0x67, 0x27,
2252 0xb8, 0x27, 0x0d, 0xf6, 0x31, 0xf7, 0xed, 0x9a, 0x7d, 0xba, 0xbd, 0x0b,
2253 0xf6, 0xe9, 0x56, 0x9f, 0xef, 0x26, 0x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0xad,
2268 0xdf, 0x47, 0x52, 0xbc, 0x5f, 0x66, 0x99, 0xb2, 0xa3, 0x55, 0x65, 0xf5,
2269 0xb8, 0x3d, 0xf9, 0x43, 0xcc, 0xcd, 0x17, 0x61, 0x6f, 0xf6, 0x8e, 0xbd,
2270 0x0a, 0x9f, 0x31, 0x2e, 0x5f, 0x2a, 0xbd, 0x04, 0x7a, 0xcd, 0xaf, 0xb5,
2271 0x77, 0xe1, 0x65, 0x01, 0x37, 0xcf, 0x38, 0xeb, 0xfd, 0xc3, 0x91, 0x3f,
2272 0x02, 0x5d, 0xfc, 0xc1, 0x4b, 0xec, 0x03, 0xb0, 0x44, 0x60, 0xcf, 0xc3,
2273 0x36, 0x18, 0x7f, 0x49, 0xef, 0x95, 0xbb, 0xbe, 0xfc, 0x92, 0x8e, 0x53,
2274 0xf4, 0x97, 0x5b, 0x65, 0x7b, 0xb9, 0x41, 0x76, 0x40, 0x2f, 0xec, 0x28,
2275 0xfb, 0x78, 0xa2, 0x72, 0x63, 0xd9, 0xcc, 0xd3, 0x47, 0xca, 0x9c, 0xef,
2276 0x6d, 0x32, 0x71, 0xbc, 0x9a, 0x66, 0xa7, 0xed, 0xde, 0x31, 0xd2, 0x0f,
2277 0x9e, 0x52, 0x32, 0x3f, 0xad, 0xc7, 0xce, 0x5d, 0xac, 0xc9, 0xc3, 0xb3,
2278 0xc2, 0xbd, 0xf8, 0xfc, 0x1b, 0x74, 0xdf, 0x68, 0xe5, 0x19, 0x77, 0xde,
2279 0x8f, 0xd8, 0x5f, 0x09, 0xf7, 0x86, 0xbf, 0xfe, 0x19, 0x10, 0xfd, 0x77,
2280 0x5d, 0xf4, 0xde, 0x70, 0x4d, 0x7b, 0xd2, 0x76, 0x26, 0xa6, 0x75, 0x84,
2281 0xa1, 0xf1, 0xf9, 0xbf, 0xe7, 0x22, 0xf2, 0x7f, 0x01, 0x95, 0xf6, 0x2d,
2282 0x58, 0xd0, 0x73, 0x00, 0x00, 0x00 };
2283static u32 bnx2_CP_b09FwData[(0x50/4) + 1] = {
2284 0x00010030, 0x00000030, 0x00000000, 0x00000001, 0x00010fd0, 0x00000fd0,
2285 0x00001430, 0x0000007f, 0x00030400, 0x00001000, 0x00000030, 0x00000020,
2286 0x00050200, 0x00001000, 0x00000030, 0x00000010, 0x00010400, 0x00000400,
2287 0x00001030, 0x00000020, 0x00000000 };
2288static u32 bnx2_CP_b09FwRodata[(0x118/4) + 1] = {
2289 0x080005d8, 0x080007f8, 0x0800073c, 0x08000764, 0x0800078c, 0x080007b4,
2290 0x08000610, 0x080005fc, 0x08000820, 0x08000820, 0x0800062c, 0x08000648,
2291 0x08000648, 0x08000820, 0x08000660, 0x08000674, 0x08000820, 0x08000688,
2292 0x08000820, 0x08000820, 0x0800069c, 0x08000820, 0x08000820, 0x08000820,
2293 0x08000820, 0x08000820, 0x08000820, 0x08000820, 0x08000820, 0x08000820,
2294 0x08000820, 0x080006b0, 0x08000820, 0x080006c4, 0x080006d8, 0x080006ec,
2295 0x08000820, 0x08000700, 0x08000714, 0x08000728, 0x08003740, 0x08003758,
2296 0x08003768, 0x08003778, 0x08003790, 0x080037a8, 0x080037b8, 0x080037c8,
2297 0x080037e8, 0x080037f8, 0x08003808, 0x08003898, 0x080037d8, 0x08003818,
2298 0x08003828, 0x08003840, 0x08003860, 0x08003898, 0x08003878, 0x08003878,
2299 0x080055f0, 0x080055f0, 0x080055f0, 0x080055f0, 0x080055f0, 0x08005618,
2300 0x08005618, 0x08005640, 0x08005690, 0x08005660, 0x00000000 };
2301static u32 bnx2_CP_b09FwBss[(0x870/4) + 1] = { 0x0 };
2302static u32 bnx2_CP_b09FwSbss[(0xe9/4) + 1] = { 0x0 };
2303 2246
2304static struct fw_info bnx2_cp_fw_09 = { 2247static struct fw_info bnx2_cp_fw_09 = {
2305 .ver_major = 0x1, 2248 .ver_major = 0x3,
2306 .ver_minor = 0x0, 2249 .ver_minor = 0x4,
2307 .ver_fix = 0x0, 2250 .ver_fix = 0x3,
2308 2251
2309 .start_addr = 0x0800006c, 2252 .start_addr = 0x0800006c,
2310 2253
2311 .text_addr = 0x08000000, 2254 .text_addr = 0x08000000,
2312 .text_len = 0x73cc, 2255 .text_len = 0x6ee8,
2313 .text_index = 0x0, 2256 .text_index = 0x0,
2314 .gz_text = bnx2_CP_b09FwText, 2257 .gz_text = bnx2_CP_b09FwText,
2315 .gz_text_len = sizeof(bnx2_CP_b09FwText), 2258 .gz_text_len = sizeof(bnx2_CP_b09FwText),
2316 2259
2317 .data_addr = 0x08007500, 2260 .data_addr = 0x08007020,
2318 .data_len = 0x50, 2261 .data_len = 0x0,
2319 .data_index = 0x0, 2262 .data_index = 0x0,
2320 .data = bnx2_CP_b09FwData, 2263 .data = bnx2_CP_b09FwData,
2321 2264
2322 .sbss_addr = 0x08007554, 2265 .sbss_addr = 0x08007024,
2323 .sbss_len = 0xe9, 2266 .sbss_len = 0xa1,
2324 .sbss_index = 0x0, 2267 .sbss_index = 0x0,
2325 .sbss = bnx2_CP_b09FwSbss, 2268 .sbss = bnx2_CP_b09FwSbss,
2326 2269
2327 .bss_addr = 0x08007640, 2270 .bss_addr = 0x080070d0,
2328 .bss_len = 0x870, 2271 .bss_len = 0x3b0,
2329 .bss_index = 0x0, 2272 .bss_index = 0x0,
2330 .bss = bnx2_CP_b09FwBss, 2273 .bss = bnx2_CP_b09FwBss,
2331 2274
2332 .rodata_addr = 0x080073d0, 2275 .rodata_addr = 0x08006ee8,
2333 .rodata_len = 0x118, 2276 .rodata_len = 0x118,
2334 .rodata_index = 0x0, 2277 .rodata_index = 0x0,
2335 .rodata = bnx2_CP_b09FwRodata, 2278 .rodata = bnx2_CP_b09FwRodata,
2336}; 2279};
2337 2280
2338static u8 bnx2_RXP_b09FwText[] = { 2281static u8 bnx2_RXP_b09FwText[] = {
2339 0x1f, 0x8b, 0x08, 0x08, 0x19, 0xfd, 0x2f, 0x45, 0x00, 0x03, 0x74, 0x65, 2282 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, 0xec, 0x5c,
2340 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xec, 0x5c, 0x6b, 0x6c, 2283 0x5d, 0x6c, 0x1c, 0xd7, 0x75, 0x3e, 0xf3, 0x43, 0x6a, 0x49, 0xf1, 0x67,
2341 0x1c, 0xd7, 0x75, 0x3e, 0xf3, 0x20, 0xb5, 0xa2, 0xf8, 0x18, 0x2e, 0x57, 2284 0xb8, 0x5c, 0xb1, 0x2b, 0x99, 0x96, 0x77, 0xc9, 0x91, 0xc8, 0x58, 0x8a,
2342 0xcc, 0x4a, 0x66, 0xec, 0x5d, 0x71, 0x24, 0xb2, 0x16, 0x6b, 0x8c, 0xd8, 2285 0x31, 0xa2, 0x09, 0x5b, 0x48, 0x17, 0xf6, 0x76, 0x76, 0x25, 0xb1, 0xb1,
2343 0xad, 0x4d, 0x04, 0x6b, 0x7b, 0x33, 0xbb, 0x92, 0x98, 0x54, 0x85, 0x29, 2286 0x03, 0x53, 0xb6, 0x62, 0x07, 0x45, 0x6a, 0xb0, 0x4b, 0xb9, 0x0e, 0x8c,
2344 0x87, 0x75, 0x0c, 0xc3, 0x75, 0xd9, 0xa5, 0x1a, 0xbb, 0xae, 0x51, 0xc8, 2287 0x06, 0x90, 0xff, 0x52, 0xbf, 0xb0, 0xde, 0x2c, 0xa9, 0x58, 0x4d, 0x17,
2345 0x8f, 0xc4, 0x06, 0x6a, 0xd6, 0x9b, 0x25, 0xdd, 0xa8, 0xe9, 0x82, 0x43, 2288 0x9c, 0xb5, 0x4d, 0x9b, 0x0e, 0x60, 0xb7, 0x0b, 0x92, 0x12, 0xf5, 0xb0,
2346 0x4b, 0xaa, 0xe9, 0x02, 0x69, 0xbb, 0x20, 0xa9, 0xc7, 0x8f, 0x85, 0x56, 2289 0xd0, 0xb2, 0xa9, 0xdb, 0xea, 0xc1, 0x8e, 0x09, 0x56, 0xb1, 0x53, 0xa0,
2347 0x76, 0x52,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, 0x56, 0x1c, 0x8a, 0xe8, 0x93, 0x0c, 0xe9, 0x2f, 0xaf, 0xe8, 2319 0xd2, 0x6f, 0x88, 0xef, 0xcf, 0x38, 0x7b, 0x92, 0xc7, 0xe5, 0x0c, 0xf0,
2377 0xa0, 0x73, 0x8b, 0x94, 0xeb, 0x96, 0x4c, 0xad, 0x6c, 0x5c, 0x7f, 0xd9, 2320 0xd6, 0x80, 0x4f, 0x2c, 0x3d, 0x43, 0xfa, 0x22, 0x9a, 0x8b, 0x5a, 0x6e,
2378 0x7f, 0x71, 0x28, 0x25, 0xcf, 0x36, 0xb3, 0x47, 0x2a, 0x92, 0x90, 0x39, 2321 0x28, 0xa2, 0x4f, 0x52, 0xa4, 0xbf, 0xb0, 0xa4, 0x83, 0xce, 0xed, 0x52,
2379 0x2f, 0x23, 0x7a, 0x5e, 0x0a, 0x6e, 0x6e, 0x40, 0xce, 0x35, 0xd3, 0xf2, 2322 0xa8, 0x5a, 0x32, 0xb1, 0xb4, 0x15, 0xfe, 0xa2, 0xff, 0xea, 0x50, 0x42,
2380 0x5c, 0xd3, 0x4e, 0x57, 0x65, 0x93, 0x94, 0x53, 0x96, 0x9c, 0x6d, 0xa6, 2323 0xfe, 0xb2, 0x9e, 0x3e, 0x55, 0x04, 0x2f, 0x66, 0xbc, 0x94, 0x80, 0xcf,
2381 0x70, 0x46, 0xff, 0x9c, 0x6e, 0xdb, 0x56, 0x15, 0x6b, 0xab, 0xcd, 0x97, 2324 0x59, 0x77, 0xb4, 0x5f, 0x5e, 0xab, 0x27, 0xe5, 0xbb, 0x75, 0x3b, 0x59,
2382 0xf8, 0xef, 0x5f, 0xac, 0xe9, 0x9c, 0x82, 0xa9, 0x80, 0xee, 0x70, 0x2d, 2325 0x92, 0x6d, 0x52, 0x48, 0x58, 0xb2, 0x82, 0x35, 0xd3, 0xa0, 0x43, 0xb7,
2383 0xcf, 0xa1, 0xd6, 0xaa, 0xb3, 0x04, 0x6b, 0xa5, 0x32, 0x9d, 0xc3, 0x5c, 2326 0x6d, 0xab, 0x04, 0xd8, 0x52, 0xfd, 0x27, 0xfc, 0xb7, 0x32, 0xd6, 0xe4,
2384 0x73, 0x34, 0xe4, 0xef, 0x16, 0x9c, 0x97, 0x4f, 0x4b, 0xaa, 0x9e, 0x01, 2327 0xa8, 0x5a, 0x53, 0x04, 0xdd, 0x21, 0x2c, 0xcf, 0xa1, 0x60, 0xd5, 0x59,
2385 0xde, 0xb0, 0xff, 0xcf, 0xc0, 0x37, 0x80, 0xf3, 0x5e, 0xab, 0x7e, 0xee, 2328 0x02, 0x58, 0x29, 0x4e, 0x8e, 0x62, 0xae, 0xfe, 0x85, 0x50, 0x16, 0xad,
2386 0xa2, 0xa4, 0x74, 0xd9, 0x99, 0x2e, 0x0b, 0x78, 0xdb, 0xec, 0xc4, 0x98, 2329 0x38, 0x2f, 0x9f, 0xbb, 0x71, 0xbe, 0xdd, 0xe0, 0x89, 0x24, 0x74, 0xd9,
2387 0xf4, 0xf9, 0xfe, 0x7e, 0x47, 0xac, 0xaa, 0xd3, 0x03, 0x98, 0x8c, 0x54, 2330 0x93, 0x2c, 0x60, 0x66, 0xba, 0xde, 0x81, 0x31, 0x69, 0xf1, 0xfd, 0x23,
2388 0x9d, 0x6e, 0xe0, 0x69, 0x13, 0xcb, 0xe6, 0xb9, 0xb8, 0xd7, 0x66, 0xcc, 2331 0x8e, 0x58, 0x25, 0xa7, 0x1b, 0xbc, 0x4b, 0x49, 0xc9, 0xe9, 0xc2, 0x9a,
2389 0xfb, 0x5d, 0x46, 0xde, 0xf7, 0xa7, 0x73, 0xd2, 0x1d, 0xcc, 0xed, 0x56, 2332 0x16, 0xb1, 0x6c, 0x9e, 0x81, 0x78, 0xdb, 0x30, 0xef, 0x77, 0x1a, 0x19,
2390 0x38, 0xa6, 0x26, 0x34, 0xac, 0xfb, 0x05, 0x69, 0x4e, 0x24, 0xf3, 0xec, 2333 0xdf, 0x9f, 0x1c, 0x95, 0xae, 0x60, 0x6e, 0x1f, 0x70, 0x98, 0x32, 0x31,
2391 0xf3, 0x99, 0x13, 0x77, 0xfe, 0xda, 0x90, 0x96, 0x34, 0x68, 0xb9, 0x26, 2334 0xae, 0x01, 0xee, 0x03, 0xd2, 0x17, 0x8b, 0x67, 0xd8, 0xe7, 0x73, 0x54,
2392 0xec, 0x83, 0xff, 0x1e, 0xf8, 0xe0, 0x7c, 0x06, 0x63, 0xed, 0x3a, 0xe0, 2335 0xdc, 0xd9, 0x54, 0xb8, 0x6f, 0x87, 0x94, 0xbc, 0xeb, 0xc3, 0x3e, 0x78,
2393 0x19, 0xae, 0x0a, 0xf7, 0xe8, 0x93, 0xa5, 0x94, 0xe8, 0x57, 0x9c, 0xde, 2336 0xed, 0xe1, 0xcc, 0xce, 0x4e, 0x8c, 0xb5, 0x1b, 0x80, 0xc7, 0x29, 0x09,
2394 0x70, 0x5d, 0x37, 0x68, 0x8d, 0xf4, 0xa0, 0x5f, 0xe6, 0x16, 0xc9, 0xeb, 2337 0xf7, 0xd8, 0x21, 0x6b, 0x09, 0xd1, 0x2f, 0x39, 0xbd, 0x21, 0x5c, 0x17,
2395 0x1a, 0x64, 0x83, 0xe7, 0x8d, 0x15, 0xad, 0xd0, 0x3c, 0x82, 0xbe, 0x29, 2338 0x68, 0x8d, 0x64, 0xde, 0x2e, 0x33, 0xf3, 0xad, 0x72, 0x72, 0x9e, 0xbc,
2396 0xd3, 0xb6, 0x7f, 0x6e, 0xce, 0x99, 0xd7, 0x8a, 0xa7, 0x4e, 0x6a, 0xa5, 2339 0x2d, 0x43, 0x16, 0x78, 0xde, 0x52, 0xd4, 0xb2, 0xf5, 0x53, 0xe8, 0x9b,
2397 0x53, 0x2f, 0x68, 0x7b, 0x9b, 0x2f, 0x74, 0x49, 0x47, 0x16, 0xa7, 0x4e, 2340 0x32, 0x69, 0xfb, 0xaf, 0xcd, 0x38, 0xb3, 0x5a, 0x6e, 0xf9, 0x8c, 0x96,
2398 0xc8, 0x93, 0x9e, 0x26, 0x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0x76, 0x45, 0x38, 0x75, 0x46,
2413 0x54, 0xf4, 0x8d, 0x61, 0x2f, 0xda, 0x1e, 0x6c, 0xc8, 0xe6, 0x59, 0x38, 2356 0x21, 0x7f, 0xa6, 0x3d, 0xd1, 0x0a, 0x8e, 0xb5, 0x8e, 0x0b, 0x7a, 0xa1,
2414 0x97, 0x87, 0x8d, 0x67, 0xd9, 0x97, 0xf2, 0x02, 0xed, 0x9d, 0xb4, 0x9d, 2357 0x1b, 0x99, 0x0e, 0xc9, 0x29, 0xfa, 0x0e, 0x62, 0x2f, 0xda, 0x1b, 0xec,
2415 0xcf, 0xaa, 0x7f, 0x8e, 0x45, 0x5d, 0x3c, 0xd6, 0x03, 0xda, 0x38, 0x86, 2358 0xc6, 0xe6, 0x59, 0x38, 0x97, 0x81, 0xed, 0xa6, 0x95, 0xfe, 0x14, 0x2a,
2416 0x1d, 0xda, 0x78, 0x3f, 0xa2, 0x89, 0x3b, 0x36, 0x08, 0xfe, 0x70, 0x9d, 2359 0xf4, 0x07, 0xa4, 0x6d, 0x35, 0xad, 0x4b, 0x80, 0xaf, 0xf4, 0x6c, 0x37,
2417 0x9d, 0x81, 0x9c, 0x0b, 0x2e, 0xf6, 0x74, 0x9d, 0xdf, 0x50, 0x3c, 0xe8, 2360 0x68, 0xe3, 0x18, 0xb6, 0x67, 0xe3, 0xfd, 0x7e, 0xd8, 0xfa, 0xc1, 0x41,
2418 0xc5, 0x79, 0x06, 0xe7, 0xc9, 0xaf, 0x0e, 0xe8, 0xb6, 0x26, 0x65, 0x27, 2361 0xf0, 0x87, 0x70, 0x76, 0x0a, 0xf2, 0xce, 0xba, 0xd8, 0xd3, 0x75, 0x6e,
2419 0x9b, 0xa1, 0xdc, 0x03, 0xda, 0x75, 0xd9, 0x74, 0x63, 0x2b, 0xed, 0x91, 2362 0x56, 0x3c, 0xe8, 0xc1, 0x79, 0x06, 0x67, 0xc9, 0xaf, 0x76, 0xe8, 0xb3,
2420 0xac, 0xa8, 0x87, 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x85, 0x73, 2370 0x27, 0x52, 0xf2, 0xea, 0x10, 0xfc, 0xda, 0x86, 0x5f, 0x41, 0x1b, 0x43,
2428 0xb0, 0xed, 0x95, 0x12, 0x9e, 0xb6, 0x54, 0x1b, 0xd4, 0xab, 0xc8, 0x97, 2371 0x5f, 0x17, 0x03, 0x7e, 0x65, 0xba, 0xaa, 0xc3, 0x76, 0x61, 0x43, 0x4b,
2429 0xd2, 0xe7, 0xa4, 0xe1, 0x5f, 0xe8, 0x77, 0xe8, 0x57, 0xb8, 0xd6, 0xf7, 2372 0x9c, 0xb3, 0xf0, 0xcc, 0xe3, 0x69, 0xc3, 0x8f, 0x52, 0xaf, 0x22, 0xff,
2430 0x4b, 0x0e, 0x61, 0x7d, 0x99, 0x70, 0x68, 0x43, 0x9d, 0xa2, 0x27, 0x2b, 2373 0x49, 0x3f, 0x93, 0x84, 0x4f, 0xa1, 0xaf, 0xa1, 0x2f, 0x21, 0xac, 0xef,
2431 0xda, 0xc1, 0x21, 0xd8, 0xd6, 0xf5, 0x6d, 0xa0, 0x95, 0x36, 0x76, 0x8d, 2374 0xe7, 0x1d, 0xae, 0xf5, 0x65, 0xdc, 0xa1, 0x1d, 0x75, 0x88, 0x1e, 0x2f,
2432 0x48, 0x3b, 0xf7, 0xfb, 0x69, 0x57, 0xf0, 0xef, 0xee, 0x36, 0x61, 0x0d, 2375 0x6a, 0x47, 0x87, 0x60, 0x63, 0x37, 0xb6, 0x80, 0x56, 0xda, 0xda, 0x75,
2433 0x9f, 0xef, 0x86, 0x63, 0x2d, 0xf4, 0x2d, 0x7c, 0x9f, 0xcd, 0x14, 0xa4, 2376 0x74, 0x15, 0x68, 0xbf, 0xe8, 0x0c, 0xfe, 0x5d, 0xde, 0x36, 0xc0, 0x28,
2434 0x3f, 0x1c, 0xb3, 0xbf, 0x4a, 0xaf, 0xa3, 0xdf, 0x98, 0x90, 0x1d, 0x27, 2377 0xa1, 0x76, 0x05, 0xe3, 0xb6, 0xd0, 0x9f, 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, 0x88, 0x11, 0xda, 0x56, 0x34, 0x6f, 0xdd, 0xef, 0xda, 0xee, 2385 0xff, 0x1b, 0xd8, 0xf7, 0x45, 0xe3, 0x69, 0xd0, 0xe5, 0xfb, 0xd3, 0xc0,
2443 0xaf, 0x19, 0x52, 0x19, 0x6e, 0x93, 0xec, 0xf0, 0x12, 0x70, 0x4f, 0x3b, 2386 0x59, 0xd8, 0x6f, 0x84, 0xb6, 0x15, 0xcd, 0xa7, 0x10, 0xf3, 0xdc, 0xcf,
2444 0x81, 0x1d, 0x53, 0xd7, 0x97, 0x81, 0x7f, 0xce, 0x1b, 0x82, 0x1e, 0xd3, 2387 0x19, 0x52, 0x1c, 0x6e, 0x91, 0xf4, 0xf0, 0x02, 0x70, 0x4f, 0x3a, 0x81,
2445 0x0e, 0x40, 0x17, 0xf0, 0x2f, 0x03, 0xff, 0x5c, 0xb3, 0x4d, 0xbe, 0x6e, 2388 0x1d, 0x53, 0xd7, 0x17, 0x81, 0x7f, 0xc6, 0x1b, 0x82, 0x1e, 0xd3, 0x0e,
2446 0x46, 0xb1, 0x32, 0x3a, 0x4f, 0x37, 0x96, 0x45, 0xfb, 0x1e, 0x96, 0x2f, 2389 0x40, 0x17, 0xf0, 0x2f, 0x02, 0xff, 0x4c, 0xbd, 0x45, 0xbe, 0x69, 0x46,
2447 0x7a, 0x49, 0xcd, 0x3d, 0x46, 0xff, 0x5a, 0x1d, 0x86, 0x9d, 0x68, 0x55, 2390 0xb1, 0x34, 0x3a, 0x4f, 0x1b, 0xc0, 0xa2, 0x7d, 0x4f, 0xc8, 0x17, 0xbd,
2448 0x87, 0x7b, 0x1b, 0xb2, 0xbc, 0xba, 0x46, 0x0a, 0xd5, 0xc0, 0x06, 0x0b, 2391 0xb8, 0xe6, 0x3e, 0x4b, 0x3f, 0x5b, 0x1a, 0x86, 0x9d, 0x68, 0x25, 0x87,
2449 0xee, 0x50, 0x25, 0x6d, 0x28, 0x5f, 0x22, 0xb2, 0x0f, 0xb6, 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1e, 0x1c,
2464 0xe6, 0x1e, 0x17, 0xbc, 0x32, 0x85, 0x3e, 0x4e, 0x93, 0x2a, 0xe4, 0x7c, 2407 0xff, 0xa2, 0x20, 0xe6, 0xed, 0xdf, 0x16, 0xfa, 0x64, 0xf3, 0x80, 0x0b,
2465 0x7f, 0x43, 0xf6, 0x5c, 0x68, 0x98, 0xa1, 0x2e, 0x51, 0x27, 0xde, 0x86, 2408 0x5e, 0x99, 0x42, 0x1f, 0xa7, 0x49, 0x09, 0x72, 0x7e, 0xa8, 0x26, 0x07,
2466 0x8d, 0x75, 0x4e, 0x99, 0x88, 0xc3, 0xe7, 0x94, 0x8d, 0xc9, 0x44, 0xb5, 2409 0xd6, 0x6a, 0x12, 0xea, 0x12, 0x75, 0xe2, 0x32, 0x6c, 0x4c, 0x8a, 0xbb,
2467 0x26, 0x95, 0xed, 0xf9, 0x27, 0x7c, 0xe8, 0xe2, 0x94, 0x05, 0x3f, 0x5a, 2410 0x32, 0x1d, 0x13, 0x66, 0xc6, 0x82, 0xad, 0xc9, 0x78, 0x09, 0x3e, 0xd9,
2468 0x94, 0xce, 0x31, 0x37, 0x87, 0xf9, 0x06, 0x6d, 0x0b, 0x7e, 0x05, 0xb0, 2411 0xc8, 0xec, 0x79, 0x3b, 0x67, 0x3c, 0xe9, 0x1b, 0x88, 0xdb, 0x39, 0xe9,
2469 0xd0, 0xb5, 0x84, 0x31, 0xbf, 0xf3, 0x55, 0xd7, 0xe0, 0x3e, 0x19, 0xe4, 2412 0x38, 0xe8, 0x8e, 0x62, 0xbe, 0x46, 0xdb, 0x82, 0x5f, 0xa9, 0x13, 0xf7,
2470 0x4d, 0x89, 0x84, 0x3e, 0x7f, 0xd5, 0xa7, 0x9e, 0x4d, 0x8f, 0x5c, 0x45, 2413 0x7c, 0xb7, 0x74, 0x21, 0x2e, 0xd6, 0x5e, 0xda, 0x11, 0xd8, 0x8e, 0x98,
2471 0x9e, 0x62, 0xc1, 0x57, 0xc2, 0x7f, 0x40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 0x15, 0x1b, 0x4a, 0xa6, 0x98, 0x1b, 0x83, 0x5f, 0x0c, 2436 0x42, 0xcf, 0x24, 0x24, 0x57, 0x0b, 0xf8, 0x8b, 0x78, 0x0b, 0xff, 0xc8,
2494 0xf2, 0xa2, 0x73, 0xde, 0x46, 0xd9, 0x59, 0xe0, 0x77, 0x01, 0x3c, 0xce, 2437 0x2e, 0x64, 0xb2, 0xee, 0x07, 0x23, 0x99, 0x53, 0xcf, 0xb2, 0x90, 0x4d,
2495 0x40, 0x87, 0xc6, 0x01, 0x2b, 0x87, 0x81, 0x83, 0xf1, 0xd7, 0xd1, 0xf3, 2438 0x0a, 0xba, 0x34, 0x86, 0xb5, 0x72, 0x02, 0x38, 0x18, 0x87, 0x1d, 0x3d,
2496 0x49, 0x29, 0x5b, 0xcc, 0x13, 0xda, 0x49, 0x67, 0x81, 0xf6, 0xaf, 0xe7, 2439 0x13, 0x97, 0x82, 0xc5, 0x7c, 0x41, 0xe5, 0x7a, 0x59, 0xfa, 0x01, 0x3d,
2497 0x37, 0x63, 0x8e, 0xfd, 0x7b, 0x7b, 0x02, 0x99, 0x75, 0x71, 0x3c, 0xa1, 2440 0xd3, 0x86, 0x39, 0xf6, 0x1f, 0xee, 0x0e, 0x64, 0xdd, 0xc9, 0xf1, 0xb8,
2498 0xe7, 0x7b, 0x36, 0xcc, 0x7f, 0xbf, 0x2b, 0xa0, 0x4d, 0x8d, 0x31, 0xff, 2441 0x9e, 0xe9, 0xde, 0x32, 0xff, 0x7a, 0x67, 0x40, 0x9b, 0x1a, 0x63, 0xfe,
2499 0xf2, 0x86, 0xf1, 0xef, 0x25, 0xd7, 0x8f, 0xef, 0xda, 0x16, 0xea, 0x20, 2442 0x5f, 0xb6, 0x8c, 0xbf, 0x1e, 0xdf, 0x3c, 0x7e, 0x60, 0x67, 0xa4, 0x0f,
2500 0xfa, 0x8f, 0x85, 0xf4, 0x82, 0xb6, 0x55, 0x5a, 0xa3, 0x9c, 0x57, 0x16, 2443 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a, 0x76, 0x79, 0x0e, 0xf9,
2508 0xff, 0x1b, 0x2b, 0xd0, 0xb3, 0xe3, 0x29, 0xf9, 0x86, 0xad, 0xf7, 0xe9, 2451 0xe9, 0x12, 0x7e, 0x67, 0xf1, 0xab, 0xe1, 0x17, 0xd5, 0x01, 0x2f, 0xa0,
2509 0x81, 0x5f, 0x29, 0x20, 0x8f, 0xb5, 0xde, 0x96, 0xdf, 0x0e, 0xf3, 0x22, 2452 0x8e, 0x50, 0xfe, 0x1e, 0xb1, 0x29, 0xd8, 0xff, 0x67, 0x4b, 0xc8, 0x8f,
2510 0x91, 0xd7, 0x16, 0xc0, 0xc7, 0x91, 0xfd, 0xa1, 0xce, 0x16, 0xee, 0x75, 2453 0xe7, 0x12, 0xf2, 0x94, 0xad, 0xf7, 0xea, 0x81, 0x8f, 0xcb, 0x22, 0xb7,
2511 0x95, 0xff, 0x0c, 0xf3, 0x1e, 0xe4, 0x5f, 0x05, 0xb5, 0xea, 0x5b, 0xe0, 2454 0xb6, 0x2e, 0xcb, 0x97, 0xc2, 0x1c, 0x4d, 0xe4, 0x9d, 0x0a, 0x64, 0xb9,
2512 0x8d, 0x26, 0x6f, 0x41, 0x87, 0x5e, 0x5b, 0xe8, 0x00, 0x3d, 0xb6, 0x94, 2455 0xff, 0x48, 0xe8, 0x9f, 0xbe, 0xf6, 0xa0, 0xab, 0x7c, 0x79, 0x98, 0x83,
2513 0x27, 0x91, 0x2f, 0x68, 0x83, 0xd6, 0x26, 0xad, 0x03, 0x76, 0x0c, 0x1b, 2456 0xc1, 0xef, 0x64, 0x15, 0xd4, 0x1b, 0xe0, 0x8f, 0x26, 0xef, 0x41, 0x8f,
2514 0x57, 0x63, 0x49, 0xb4, 0xe5, 0x2f, 0xcd, 0x2c, 0xd5, 0x74, 0xac, 0x45, 2457 0xdf, 0xa9, 0xb4, 0x83, 0x1e, 0x5b, 0x0a, 0xc7, 0x90, 0xbb, 0x68, 0x83,
2515 0xee, 0x93, 0x43, 0x1f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x6f, 2465 0xf2, 0xe3, 0xf3, 0xe4, 0xb3, 0x01, 0x1d, 0xe2, 0x98, 0xef, 0xe8, 0xcf,
2523 0x2c, 0xc1, 0x4e, 0x38, 0x9e, 0x10, 0x25, 0x83, 0x75, 0xf2, 0x94, 0x84, 2466 0x89, 0x2f, 0x7d, 0x30, 0x8b, 0xc3, 0x5c, 0xaa, 0x04, 0xfd, 0x68, 0x4e,
2524 0x99, 0x3f, 0x3b, 0x33, 0x67, 0x53, 0xae, 0xf0, 0x71, 0xb5, 0x48, 0xae, 2467 0xb4, 0x28, 0xa6, 0xd2, 0x4f, 0xe7, 0x61, 0xab, 0x1c, 0x8f, 0x8b, 0x92,
2525 0x94, 0x51, 0xbb, 0x54, 0x17, 0xbe, 0x09, 0xb9, 0xea, 0x61, 0xbe, 0x0f, 2468 0xc1, 0x26, 0x79, 0x52, 0x8f, 0x56, 0xa7, 0x66, 0x6c, 0xca, 0xd5, 0x92,
2526 0x1b, 0x3f, 0x4e, 0xf9, 0xa2, 0xfe, 0x5b, 0x40, 0xee, 0xb3, 0x20, 0xc9, 2469 0xe9, 0x72, 0x24, 0x57, 0xca, 0x08, 0x75, 0x66, 0xe5, 0xdb, 0x90, 0xab,
2527 0xa0, 0x5e, 0x39, 0x8a, 0x3c, 0x1f, 0xf2, 0xab, 0x1d, 0x07, 0x0e, 0xd8, 2470 0x1e, 0xd6, 0x20, 0xf0, 0x03, 0x73, 0x94, 0x2f, 0xea, 0xc4, 0x0a, 0xf2,
2528 0x69, 0x6d, 0x05, 0x4f, 0xd4, 0x16, 0xb5, 0xd3, 0x78, 0x0e, 0xe0, 0xd9, 2471 0xb0, 0x8a, 0xc4, 0x83, 0x1a, 0xea, 0x19, 0xd4, 0x1d, 0x90, 0x5f, 0x79,
2529 0xa0, 0x6e, 0x86, 0xb9, 0xc6, 0x87, 0xe8, 0x81, 0x3d, 0x95, 0x68, 0x4f, 2472 0x0e, 0x38, 0x12, 0x78, 0x2e, 0xe1, 0x99, 0x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d, 0xc5, 0x8b,
2559 0x23, 0x37, 0x98, 0xfc, 0x40, 0x7e, 0x39, 0xda, 0x23, 0x3f, 0xfe, 0x72, 2502 0xbb, 0x9d, 0xf4, 0x15, 0x84, 0x28, 0xff, 0x92, 0x3d, 0x38, 0x3c, 0xa0,
2560 0xf6, 0x99, 0x3f, 0xd5, 0x61, 0x03, 0xa3, 0x9d, 0xb4, 0x6d, 0xf4, 0x39, 2503 0xef, 0x92, 0x6a, 0xf2, 0x46, 0xeb, 0xbb, 0x88, 0x07, 0xd9, 0x44, 0xfa,
2561 0x9f, 0xbd, 0x5a, 0xd0, 0xa9, 0xdb, 0x3f, 0x02, 0x4f, 0xb3, 0x0b, 0x81, 2504 0xd4, 0x45, 0x59, 0x9d, 0xba, 0x60, 0x53, 0x17, 0x69, 0xc3, 0xff, 0x80,
2562 0x1d, 0x10, 0x37, 0xf1, 0x42, 0x37, 0xec, 0xef, 0x01, 0x27, 0xde, 0x35, 2505 0x9c, 0xd4, 0x92, 0x4a, 0x8d, 0xbe, 0x8b, 0xb8, 0x58, 0x17, 0xec, 0xb5,
2563 0x06, 0x81, 0xeb, 0x7b, 0x8a, 0x17, 0xb7, 0x3b, 0xd9, 0xab, 0x08, 0x49, 2506 0x4e, 0x80, 0x06, 0x77, 0x3f, 0xde, 0x61, 0xde, 0xf8, 0x3c, 0xe5, 0xd6,
2564 0xfe, 0x15, 0x7b, 0x70, 0x78, 0x87, 0xbe, 0x5d, 0xea, 0xe9, 0xeb, 0xad, 2507 0xc2, 0xb5, 0xc3, 0x59, 0xbd, 0x7f, 0x0b, 0x8f, 0x06, 0xad, 0x43, 0x3a,
2565 0xe7, 0xe0, 0xff, 0x0b, 0xa9, 0xec, 0x91, 0xcb, 0x72, 0x76, 0xe6, 0xa2, 2508 0xf7, 0xfb, 0x2f, 0xec, 0xfb, 0x3e, 0x68, 0x1d, 0xc4, 0x5a, 0xc4, 0xd0,
2566 0x4d, 0xfd, 0xa7, 0xdf, 0x78, 0x09, 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x4b, 0x2c, 0xf4, 0x7f, 0x71, 0x79, 0xeb, 0x79, 0xe8, 0x7d, 0x9c, 0xfa,
2574 0xec, 0x1a, 0x04, 0x0d, 0xa8, 0x43, 0xd3, 0xe4, 0xf9, 0xd9, 0x19, 0x17, 2517 0x93, 0xe8, 0xd9, 0xd0, 0x9f, 0x46, 0xfc, 0xad, 0x92, 0xaf, 0xc4, 0x80,
2575 0x38, 0x8a, 0x0a, 0xf7, 0x25, 0x59, 0x01, 0xee, 0x09, 0xf2, 0x01, 0xb8, 2518 0x17, 0x39, 0xf7, 0x28, 0xf1, 0x62, 0x5c, 0xa5, 0x2e, 0x17, 0x43, 0x5d,
2576 0xe7, 0x38, 0xaf, 0x64, 0x80, 0xf9, 0x46, 0x06, 0x78, 0x23, 0xfd, 0x4c, 2519 0xee, 0x08, 0x71, 0xaf, 0x41, 0x97, 0xd3, 0xa9, 0x55, 0x9d, 0xf5, 0xd5,
2577 0x42, 0xd7, 0x76, 0x5b, 0xb7, 0x07, 0xba, 0x9e, 0x60, 0x6c, 0x7b, 0x0e, 2520 0x4e, 0x55, 0xf3, 0x1a, 0xb0, 0xaf, 0x42, 0x99, 0xb1, 0x88, 0xb6, 0x75,
2578 0xba, 0x57, 0x48, 0x52, 0x7f, 0xda, 0x7b, 0xd7, 0xf4, 0xa7, 0x15, 0x7f, 2521 0x71, 0x6a, 0x12, 0x35, 0x6c, 0xa1, 0x7c, 0x50, 0x2f, 0xd4, 0x47, 0xf5,
2579 0xbb, 0x94, 0x16, 0x12, 0xc0, 0x6b, 0xca, 0x5c, 0x8e, 0x78, 0x31, 0xae, 2522 0x82, 0x47, 0x7d, 0xdb, 0x6b, 0x2d, 0x28, 0x1e, 0x27, 0x65, 0xa1, 0xfe,
2580 0x53, 0xf7, 0x2b, 0xa1, 0xee, 0x77, 0x86, 0xb8, 0x17, 0xc1, 0x93, 0x6c, 2523 0x81, 0x5f, 0xda, 0xbb, 0x0d, 0x7d, 0xe8, 0xfe, 0x38, 0xe5, 0x7b, 0x3d,
2581 0xa6, 0xae, 0xb3, 0x8e, 0xda, 0xa6, 0x6a, 0x5b, 0x03, 0x36, 0x5d, 0xae, 2524 0xe9, 0x42, 0x50, 0x27, 0xbf, 0x13, 0x72, 0x66, 0xe8, 0x7b, 0xdd, 0xcc,
2582 0xb1, 0x0e, 0xe5, 0xfd, 0xc8, 0xa5, 0x99, 0x69, 0xd4, 0xaa, 0xe5, 0xda, 2525 0xd1, 0x96, 0x87, 0x88, 0x1f, 0x74, 0x24, 0x12, 0xb2, 0xe8, 0x71, 0x8f,
2583 0x88, 0x56, 0x6e, 0xda, 0x5a, 0xd9, 0xa3, 0xbe, 0xed, 0xb2, 0x2e, 0x28, 2526 0xd5, 0x29, 0xf2, 0xb2, 0x30, 0x67, 0xc9, 0x09, 0x25, 0x3f, 0x9e, 0x9b,
2584 0x1e, 0xa7, 0x65, 0xa9, 0xf9, 0x4b, 0xbf, 0xba, 0x6b, 0x13, 0xfa, 0xd0, 2527 0xf7, 0x47, 0x86, 0x4c, 0xc6, 0x07, 0xad, 0x47, 0x25, 0x7d, 0x65, 0xcd,
2585 0xfd, 0x09, 0xca, 0xf7, 0xb3, 0xa4, 0x0b, 0x41, 0x9c, 0xfc, 0x4e, 0xc9, 2528 0x48, 0xbf, 0x30, 0x81, 0xb8, 0xba, 0x30, 0x6f, 0x88, 0xab, 0xea, 0x30,
2586 0xc9, 0x21, 0x14, 0xbd, 0xc8, 0xad, 0x4e, 0x0d, 0x11, 0x3f, 0xe8, 0x48, 2529 0xca, 0x28, 0x5d, 0x81, 0x35, 0x86, 0x67, 0xbf, 0xa7, 0xe1, 0xec, 0x5d,
2587 0xa5, 0x64, 0xd9, 0xe3, 0x1e, 0x67, 0x67, 0xc8, 0xcb, 0xf2, 0x71, 0x4b, 2530 0x72, 0xe1, 0xf9, 0xcf, 0xc3, 0xee, 0x5f, 0x81, 0x2c, 0xcc, 0xd4, 0x71,
2588 0x0e, 0x2b, 0xf9, 0xbd, 0xac,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f2, 0x4d, 0xe4, 0xad,
2632 0x76, 0x73, 0x9d, 0x8c, 0xb9, 0xa8, 0x3d, 0x0b, 0x93, 0xcc, 0x91, 0x82, 2575 0xcf, 0xa9, 0xfb, 0xb4, 0xf1, 0x21, 0xca, 0xbc, 0xf2, 0x09, 0xb9, 0x6b,
2633 0x98, 0x15, 0xe4, 0xe7, 0xaf, 0x22, 0x4f, 0xca, 0x20, 0x4f, 0x1a, 0x40, 2576 0xc4, 0xdf, 0xe0, 0x1e, 0x50, 0x5f, 0x20, 0xff, 0x44, 0x7a, 0xce, 0x81,
2634 0x4e, 0xc4, 0x7b, 0xea, 0xe8, 0x2e, 0xa9, 0xa0, 0x1d, 0xf4, 0xc6, 0xb5, 2577 0xe1, 0xe7, 0x62, 0x12, 0x3f, 0xb3, 0x1d, 0x73, 0x96, 0xf4, 0xaa, 0xbb,
2635 0x2f, 0x79, 0xcc, 0xdf, 0xed, 0x4c, 0x59, 0xd7, 0x8f, 0xf7, 0x89, 0x2f, 2578 0x24, 0x88, 0xf2, 0xdc, 0x55, 0xc8, 0xcb, 0x16, 0xfd, 0x1c, 0x6f, 0x1c,
2636 0xc5, 0xd1, 0xaf, 0x23, 0x57, 0xfe, 0x4b, 0x75, 0x6f, 0x36, 0x31, 0x44, 2579 0x88, 0x97, 0xfe, 0x75, 0x65, 0x2a, 0x57, 0x5d, 0x51, 0x3a, 0x75, 0xb4,
2637 0x99, 0xdf, 0xf7, 0x31, 0xf9, 0x72, 0xc4, 0xdf, 0xe0, 0xbe, 0x4f, 0x5f, 2580 0x96, 0x47, 0x7d, 0xd4, 0xd3, 0x2b, 0xed, 0x26, 0x6a, 0xab, 0x08, 0x37,
2638 0x22, 0xff, 0x44, 0x7a, 0xcf, 0x80, 0xe1, 0x67, 0x12, 0x92, 0x3c, 0xb9, 2581 0x71, 0xfe, 0x32, 0xae, 0x6a, 0x9e, 0x73, 0xeb, 0xf2, 0x84, 0xac, 0xb9,
2639 0x05, 0x73, 0x96, 0xf4, 0xa9, 0x3b, 0x23, 0x88, 0xf2, 0xcc, 0x7f, 0x40, 2582 0xcf, 0xca, 0x54, 0xa9, 0x92, 0x4e, 0xb2, 0x56, 0xce, 0x5a, 0x2b, 0x53,
2640 0x5e, 0xb6, 0xe8, 0x67, 0x78, 0xb3, 0x40, 0xbc, 0xf4, 0xaf, 0xf5, 0x99, 2583 0x27, 0x81, 0x63, 0x11, 0xb9, 0x81, 0xa1, 0xf6, 0x5e, 0x99, 0x9a, 0xae,
2641 0x62, 0xbd, 0xae, 0x74, 0xea, 0x60, 0xa3, 0x84, 0x3c, 0xca, 0xe8, 0x93, 2584 0x04, 0xf7, 0x59, 0x01, 0x0d, 0x8c, 0x57, 0xed, 0x62, 0x2c, 0x04, 0xf7,
2642 0x0e, 0x13, 0xb5, 0x54, 0x84, 0x9b, 0x38, 0xdf, 0x4c, 0xaa, 0x1a, 0xe7, 2585 0x5a, 0xba, 0x5a, 0xcb, 0x75, 0x5c, 0x6f, 0x62, 0x1d, 0xe5, 0x36, 0x8c,
2643 0xcc, 0xaa, 0x3c, 0x21, 0x6b, 0xee, 0x53, 0x9f, 0xa9, 0x2e, 0x64, 0xd3, 2586 0xb5, 0x94, 0x1d, 0x69, 0x58, 0x99, 0x2a, 0x56, 0x1b, 0x69, 0x20, 0x1e,
2644 0xac, 0x71, 0x0b, 0x56, 0x7d, 0xe6, 0x49, 0xe0, 0x58, 0x46, 0x6e, 0x60, 2587 0xe2, 0x8d, 0xce, 0xc3, 0xb3, 0xc4, 0x45, 0x3f, 0xe3, 0xfb, 0x85, 0x91,
2645 0xa8, 0xbd, 0xeb, 0x33, 0xb3, 0x0b, 0xc1, 0xbd, 0x55, 0x40, 0x03, 0xe3, 2588 0xfe, 0x30, 0xef, 0x3a, 0x89, 0xfc, 0xce, 0x0c, 0xf4, 0x5c, 0x8d, 0xbf,
2646 0x55, 0x87, 0x18, 0x4b, 0xc1, 0xfd, 0x95, 0xae, 0x60, 0x09, 0x47, 0x78, 2589 0xa3, 0xe2, 0x54, 0x4a, 0xe7, 0x3c, 0x9f, 0x78, 0x37, 0xba, 0x80, 0x39,
2647 0x13, 0x70, 0x94, 0xdb, 0x30, 0x60, 0x29, 0x3b, 0xd2, 0x50, 0x9f, 0xa9, 2590 0x8c, 0x17, 0x23, 0x58, 0x3d, 0x84, 0xed, 0x6c, 0xe0, 0x67, 0x4b, 0xb8,
2648 0xd4, 0x5b, 0x69, 0x20, 0x1e, 0xe2, 0x8d, 0xce, 0xc3, 0xb3, 0x24, 0x45, 2591 0x1f, 0x69, 0xe2, 0x39, 0x2f, 0x61, 0x2f, 0xd2, 0x45, 0x98, 0x38, 0x68,
2649 0x3f, 0xe9, 0xfb, 0xe5, 0xd1, 0x81, 0xb0, 0xae, 0x44, 0x1d, 0x79, 0xcc, 2592 0x83, 0x2c, 0xbd, 0xff, 0x2d, 0xef, 0x1b, 0xcf, 0x44, 0x9e, 0x9a, 0x58,
2650 0x0c, 0xf4, 0x5c, 0x8d, 0xff, 0x58, 0xc5, 0xa9, 0x8c, 0xce, 0x79, 0x3e, 2593 0x43, 0x78, 0xe2, 0x88, 0xd6, 0xe0, 0xc5, 0xb9, 0x60, 0x9d, 0xbe, 0x7e,
2651 0xf1, 0x2e, 0xf7, 0x28, 0xe6, 0x30, 0x5e, 0x8e, 0xd6, 0xea, 0xe1, 0xda, 2594 0xff, 0xf7, 0x69, 0xfb, 0x36, 0xd2, 0x1a, 0xed, 0x1f, 0xe1, 0x19, 0x0e,
2652 0xae, 0x16, 0x7e, 0xb6, 0x85, 0xfb, 0x91, 0x26, 0x9e, 0xf3, 0x15, 0xec, 2595 0xe4, 0xb6, 0xbe, 0x5e, 0xfd, 0x9f, 0x61, 0x78, 0x42, 0x17, 0x3f, 0x76,
2653 0x45, 0xba, 0xb8, 0xc6, 0x04, 0x6d, 0x90, 0xa5, 0xf7, 0xbf, 0xe5, 0x7d, 2596 0x8f, 0x3a, 0xdc, 0x50, 0x87, 0x46, 0xf7, 0x17, 0xbc, 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0xea, 0x33, 0xf0, 0x94, 0x1b, 0x78,
2705 0xa5, 0xa3, 0x86, 0xba, 0x3b, 0x2d, 0x8f, 0x52, 0xd6, 0x7c, 0x7e, 0x14, 2648 0x63, 0x6e, 0x91, 0x61, 0x71, 0xa3, 0x86, 0x1f, 0x4f, 0xc2, 0x0e, 0xbf,
2706 0xef, 0xa2, 0x33, 0xfd, 0x4d, 0x78, 0xa6, 0xd1, 0xb0, 0x6e, 0x8f, 0xce, 2649 0xd1, 0x1b, 0xdd, 0x0d, 0x1b, 0xb6, 0xcf, 0xba, 0x07, 0x8d, 0xf3, 0xfd,
2707 0x94, 0x90, 0xd7, 0xe7, 0x2d, 0xc0, 0x8e, 0x80, 0x1f, 0x25, 0x59, 0x69, 2650 0xb0, 0xc5, 0x14, 0xec, 0x93, 0x39, 0x53, 0x9e, 0xb5, 0x0a, 0xed, 0xc9,
2708 0x66, 0x3e, 0x05, 0x4f, 0xad, 0x85, 0x37, 0xe6, 0x06, 0x19, 0x46, 0x75, 2651 0x72, 0x8d, 0xb4, 0x75, 0x4c, 0x86, 0x51, 0xef, 0xf0, 0xfc, 0x19, 0x59,
2709 0x0f, 0x78, 0x30, 0x91, 0x86, 0x1d, 0xde, 0xd7, 0x17, 0xdd, 0xe9, 0x1a, 2652 0xac, 0x47, 0x34, 0x8c, 0xc2, 0x1e, 0x0f, 0xe2, 0xb7, 0x1f, 0xef, 0x1c,
2710 0xb6, 0xae, 0x05, 0x75, 0x3c, 0xe7, 0x07, 0x60, 0x8b, 0x19, 0xd8, 0x27, 2653 0xfc, 0x58, 0x2b, 0xad, 0xc8, 0xe3, 0x2a, 0x17, 0x47, 0xae, 0x3d, 0x44,
2711 0x73, 0xa6, 0x12, 0x6b, 0x15, 0xda, 0x93, 0xe5, 0x1a, 0x59, 0x6b, 0x52, 2654 0xfa, 0xee, 0x04, 0x3c, 0xf5, 0x99, 0x7a, 0x7a, 0xa7, 0xb8, 0x7d, 0xf4,
2712 0x86, 0x51, 0xef, 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f, 0x99,
2734 0x91, 0xf7, 0x13, 0x43, 0xea, 0x4e, 0xab, 0x04, 0xd9, 0x2e, 0xf1, 0x3b, 2677 0x08, 0xbf, 0xfd, 0x56, 0x83, 0x3c, 0xe2, 0xe1, 0x9a, 0x29, 0x13, 0xb5,
2735 0x63, 0x2a, 0xc8, 0x27, 0x83, 0xfa, 0x2b, 0x43, 0x5f, 0x88, 0xf6, 0xb8, 2678 0xe8, 0x6f, 0x28, 0x28, 0x07, 0xf8, 0xe6, 0x5a, 0x94, 0x3b, 0xf8, 0x41,
2736 0xf2, 0x93, 0x25, 0xf5, 0x5d, 0x31, 0x89, 0x35, 0x3e, 0x9e, 0xad, 0x7f, 2679 0x4d, 0xb3, 0x49, 0x96, 0x4b, 0x61, 0x4e, 0xc4, 0x1a, 0x80, 0x3c, 0xc4,
2737 0x27, 0xf1, 0xa3, 0x42, 0xf0, 0x77, 0x12, 0xe1, 0x37, 0xde, 0x7a, 0x90, 2680 0x78, 0x31, 0xaa, 0x2f, 0x07, 0x20, 0x3f, 0xf0, 0x1c, 0x74, 0xbd, 0x3b,
2738 0x47, 0x3c, 0xd8, 0x30, 0x65, 0xaa, 0x11, 0xfd, 0xdd, 0x04, 0xe5, 0x60, 2681 0x1b, 0xd4, 0xb9, 0x25, 0xfa, 0xc5, 0xfe, 0xa8, 0xee, 0xdd, 0x25, 0xa5,
2739 0x4b, 0xb9, 0x11, 0xe5, 0x0e, 0x7e, 0x50, 0xd3, 0xac, 0x93, 0xe5, 0xe3, 2682 0x63, 0x7c, 0x1f, 0x93, 0x77, 0x66, 0x63, 0xea, 0x7d, 0x41, 0x62, 0xe1,
2740 0x61, 0x4e, 0xc4, 0x1a, 0x80, 0x3c, 0xc4, 0x78, 0x39, 0x90, 0xdf, 0x92, 2683 0x7b, 0x8e, 0xe3, 0x52, 0x50, 0xef, 0xab, 0x21, 0x3e, 0xd4, 0x69, 0x5f,
2741 0xbe, 0x03, 0xf2, 0x03, 0xcf, 0x3d, 0x13, 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f7, 0x90, 0x00, 0x8e, 0xf9, 0x1e, 0xe1, 0x2a, 0x9a, 2706 0xf0, 0xdd, 0x7d, 0xac, 0x27, 0x0a, 0xb5, 0xa4, 0x14, 0x17, 0xa3, 0xfc,
2764 0x6e, 0x13, 0x2e, 0xc8, 0xf9, 0x58, 0x67, 0xad, 0x87, 0xe1, 0x77, 0x37, 2707 0x07, 0xeb, 0xbc, 0x7d, 0x5a, 0xbe, 0x42, 0xd9, 0xea, 0x32, 0x9d, 0x00,
2765 0xfa, 0xb6, 0xe0, 0x9b, 0x4f, 0xf0, 0x7d, 0xa9, 0x76, 0x87, 0x8b, 0x58, 2708 0x53, 0xec, 0xc6, 0xbc, 0xee, 0x4d, 0x55, 0x23, 0xad, 0xd4, 0x49, 0xcf,
2766 0x5c, 0x6e, 0xa8, 0x78, 0x8c, 0x71, 0xe3, 0x0e, 0xfe, 0xad, 0x02, 0x64, 2709 0x7e, 0xd0, 0x16, 0xdd, 0xe3, 0x8a, 0x18, 0xb3, 0x09, 0xd1, 0x67, 0x91,
2767 0xc0, 0x77, 0x5f, 0x66, 0x6d, 0x51, 0x6e, 0x20, 0x2f, 0x5a, 0x8e, 0x72, 2710 0xd3, 0xda, 0x43, 0xea, 0x6f, 0x1d, 0x7a, 0xb0, 0x8f, 0x3e, 0x3b, 0x10,
2768 0x21, 0xc0, 0x79, 0x6f, 0x6a, 0xa5, 0x05, 0xca, 0x59, 0x97, 0xd9, 0x14, 2711 0xfd, 0x2d, 0x06, 0xeb, 0xae, 0xec, 0xc6, 0xfd, 0x2b, 0xcf, 0x91, 0x80,
2769 0x98, 0x62, 0xb7, 0xe6, 0x78, 0x97, 0x54, 0xbd, 0x74, 0xb6, 0x49, 0x7a, 2712 0xbd, 0x7e, 0x69, 0x27, 0xce, 0x06, 0xb9, 0x5e, 0xde, 0xa1, 0xf2, 0x6e,
2770 0x46, 0x40, 0x5b, 0x74, 0x8f, 0x2c, 0x62, 0xcc, 0xa7, 0x44, 0x9f, 0x47,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x38, 0x0c, 0xc9, 0x21, 0x8b, 0x7f, 0xff, 0xb3,
2778 0x4d, 0xb0, 0x27, 0x1d, 0xfb, 0x47, 0xb8, 0xff, 0x45, 0xe1, 0xee, 0xb5, 2721 0x4f, 0x7b, 0xa0, 0x4a, 0x18, 0x1b, 0x7d, 0xd6, 0xe1, 0xcb, 0xb0, 0xe5,
2779 0x9d, 0x6d, 0x4a, 0x37, 0xf4, 0xac, 0x95, 0xd1, 0x41, 0xfb, 0xff, 0x14, 2722 0xff, 0x29, 0xdc, 0xea, 0x62, 0xdb, 0x3a, 0xcb, 0xf0, 0xfb, 0x1d, 0xe7,
2780 0x6e, 0x6d, 0x31, 0x71, 0x5c, 0x67, 0xf8, 0x3f, 0xb3, 0xdc, 0x8c, 0xd7, 2723 0xc7, 0x4d, 0xdd, 0xe4, 0x34, 0x71, 0x12, 0x27, 0xca, 0xc0, 0xc7, 0x39,
2781 0x30, 0x86, 0xf5, 0xb2, 0x58, 0xae, 0xba, 0x03, 0x63, 0x33, 0xd1, 0x62, 2724 0x49, 0x3d, 0x39, 0xd5, 0x4e, 0xa2, 0x14, 0x22, 0x88, 0x84, 0xe5, 0xfc,
2782 0x65, 0xb0, 0xec, 0x16, 0x55, 0x96, 0xba, 0xda, 0x05, 0x42, 0xe2, 0x3a, 2725 0xcc, 0x63, 0x14, 0x3c, 0xc8, 0xa6, 0x4e, 0x42, 0x55, 0x94, 0x74, 0x5b,
2783 0xdd, 0x24, 0xb4, 0x72, 0xd5, 0x2a, 0x42, 0x60, 0x37, 0x8e, 0xfa, 0xd2, 2726 0x27, 0xee, 0xb8, 0x40, 0x5c, 0x80, 0x6a, 0x39, 0x69, 0xe9, 0x86, 0x3d,
2784 0x46, 0x55, 0xdb, 0x37, 0xaf, 0x16, 0xec, 0x38, 0xcd, 0xac, 0x17, 0x37, 2727 0xa7, 0x5b, 0xba, 0x00, 0x57, 0x9e, 0xe3, 0xa4, 0x4d, 0xe7, 0xcc, 0x1a,
2785 0x38, 0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0x85, 0xe1, 0xd6, 0xd0, 2735 0xdf, 0xa1, 0xf7, 0xde, 0xff, 0xd1, 0x9e, 0xe5, 0xc3, 0xf4, 0xc0, 0x75,
2793 0xf7, 0xda, 0x19, 0xf2, 0x73, 0x77, 0x3c, 0xd4, 0x57, 0x1a, 0x57, 0x16, 2736 0x5a, 0x53, 0x1a, 0xfd, 0xf2, 0x93, 0x6a, 0x39, 0x6f, 0x25, 0xa9, 0x0b,
2794 0x34, 0xb6, 0xee, 0xde, 0xf5, 0xed, 0x49, 0xac, 0x29, 0x41, 0x5f, 0x79, 2737 0xcc, 0x88, 0xab, 0x66, 0x9c, 0x36, 0x60, 0x5c, 0x9b, 0xac, 0xae, 0x83,
2795 0x5c, 0xcb, 0x26, 0x83, 0xef, 0x7d, 0xbb, 0xde, 0xe3, 0xbb, 0xde, 0x0f, 2738 0xe6, 0xb1, 0x8f, 0x76, 0x9b, 0xf1, 0xf2, 0x89, 0x3e, 0xf2, 0x4c, 0x10,
2796 0xfc, 0x8f, 0xf6, 0x2c, 0xef, 0xa6, 0x07, 0xae, 0xd3, 0x1a, 0xe5, 0x2c, 2739 0xd7, 0x60, 0xd8, 0xc3, 0x11, 0xb4, 0x73, 0x5f, 0x74, 0x12, 0xe6, 0x39,
2797 0x05, 0xcf, 0x36, 0x66, 0x3d, 0x2b, 0x4d, 0x5c, 0x90, 0x15, 0x5f, 0x65, 2740 0xed, 0xbf, 0xa1, 0x0e, 0xe3, 0xaa, 0x9c, 0xce, 0xfd, 0x60, 0x9b, 0x16,
2798 0xdd, 0x36, 0xc8, 0xbb, 0x36, 0x99, 0x5f, 0x04, 0xcd, 0x63, 0x1f, 0xed, 2741 0xb9, 0x6d, 0xa7, 0xba, 0xfd, 0xdc, 0x20, 0xd8, 0xbb, 0xa9, 0x3e, 0xea,
2799 0x36, 0x63, 0xe4, 0x43, 0x71, 0xf2, 0x4c, 0x07, 0xae, 0xc1, 0xb0, 0x07, 2742 0x17, 0x2f, 0x38, 0xcd, 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18, 0x73, 0x0a, 0x6d, 0x88, 0x33, 0x53,
2829 0x97, 0xc2, 0x1a, 0xa7, 0x74, 0x2e, 0x57, 0x1f, 0xcf, 0x9c, 0x58, 0x3e, 2772 0xd0, 0x1f, 0x86, 0xd4, 0xec, 0x7a, 0x18, 0xf2, 0xbb, 0x4f, 0x66, 0xcd,
2830 0xa8, 0xb3, 0x41, 0x23, 0xac, 0x23, 0x7d, 0xa7, 0x35, 0xa6, 0x82, 0x0e, 2773 0x23, 0x07, 0xf6, 0x98, 0xd5, 0xf6, 0x81, 0x61, 0x8c, 0xf9, 0x6b, 0xea,
2831 0xc5, 0x78, 0xc3, 0x92, 0xd1, 0xe5, 0x2e, 0x8c, 0x77, 0x41, 0x32, 0x6e, 2774 0x3c, 0xb0, 0x26, 0xf6, 0xc7, 0x0f, 0xb6, 0x71, 0x6a, 0x7d, 0x0d, 0x38,
2832 0x73, 0xcc, 0x51, 0xb4, 0xa1, 0x9c, 0x19, 0x05, 0x96, 0xf8, 0x58, 0x8d, 2775 0xb5, 0xf6, 0x61, 0xca, 0x39, 0x2b, 0x33, 0x61, 0xae, 0x89, 0xf5, 0x61,
2833 0x2d, 0xc6, 0xa0, 0xcb, 0xe3, 0x32, 0x66, 0xee, 0xd9, 0xb1, 0xc7, 0xbc, 2776 0xac, 0x99, 0x7e, 0xac, 0x67, 0x81, 0x43, 0x47, 0xfc, 0x3a, 0xb6, 0x15,
2834 0xb6, 0x15, 0x0c, 0x63, 0x38, 0x5c, 0x53, 0xd7, 0x8e, 0x35, 0xb1, 0x3f, 2777 0x23, 0x85, 0xb3, 0xf7, 0xec, 0x5a, 0xd6, 0x7d, 0x56, 0x52, 0x6b, 0x19,
2835 0x7e, 0xb0, 0x93, 0x33, 0x8b, 0x0b, 0x90, 0x53, 0x0b, 0x1f, 0x66, 0xdc, 2778 0x99, 0xd7, 0xfd, 0x78, 0x86, 0x83, 0x5a, 0xf7, 0x20, 0xaf, 0xc6, 0x7a,
2836 0x67, 0x25, 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x5b, 0xfd, 0xf0, 0xf4, 2786 0x87, 0xdb, 0x31, 0x57, 0xc2, 0xdc, 0x52, 0x23, 0x58, 0x0f, 0xcb, 0x3d,
2844 0xbc, 0xe2, 0xf7, 0xc3, 0xe7, 0x57, 0x54, 0x07, 0xda, 0x46, 0xd1, 0x8e, 2787 0xe4, 0x89, 0xc8, 0x9e, 0x70, 0x7c, 0x2b, 0xbd, 0xa9, 0x12, 0xd1, 0x61,
2845 0xeb, 0x30, 0x65, 0xdc, 0xfb, 0xab, 0x3f, 0x73, 0xc4, 0xf7, 0x27, 0x74, 2788 0x65, 0x25, 0x73, 0xf8, 0xb5, 0x28, 0x1d, 0x47, 0x8c, 0x44, 0x15, 0x78,
2846 0x4e, 0x58, 0xca, 0x9c, 0x57, 0x4d, 0x7c, 0xee, 0x88, 0x17, 0x6b, 0xc7, 2789 0x17, 0x7b, 0xb2, 0x4f, 0xba, 0x6e, 0xda, 0x66, 0x7d, 0xc2, 0x0c, 0x29,
2847 0x5c, 0x29, 0x73, 0x45, 0x1d, 0xc6, 0x7a, 0x58, 0xee, 0x25, 0x4f, 0x24, 2790 0xfa, 0x5b, 0x3a, 0x74, 0xbc, 0xf1, 0x72, 0x6f, 0xc2, 0x3c, 0xa9, 0x8e,
2848 0x36, 0x84, 0xe3, 0x5b, 0x93, 0xcb, 0x2a, 0x95, 0x1c, 0x54, 0x56, 0xba, 2791 0xfb, 0xef, 0x53, 0xc0, 0xcc, 0xe6, 0x78, 0x67, 0x36, 0x95, 0x29, 0x2f,
2849 0x80, 0x5f, 0x8b, 0xd2, 0x71, 0xcc, 0x44, 0x52, 0x81, 0x77, 0xb1, 0x27, 2792 0xe5, 0x13, 0xd1, 0x65, 0x65, 0x65, 0x30, 0x66, 0x66, 0x56, 0x11, 0x37,
2850 0xfb, 0xa8, 0xef, 0x4f, 0xda, 0xac, 0x4f, 0x99, 0x51, 0x45, 0xdf, 0x4b, 2793 0x12, 0x66, 0x87, 0xa2, 0x4f, 0xb4, 0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1a, 0x3f, 0xdf, 0x3f, 0x91, 0xd7, 0xb9, 0x8b, 0x0d, 0x35, 0x10, 2801 0xd0, 0x35, 0xa1, 0xa3, 0x56, 0x30, 0x4e, 0x6e, 0x5d, 0xb2, 0x5e, 0x7f,
2859 0xee, 0x7b, 0xfb, 0xce, 0x92, 0x19, 0xf7, 0x4b, 0x1c, 0x67, 0x21, 0x72, 2802 0x09, 0x32, 0x27, 0x35, 0x57, 0xf9, 0xb4, 0x31, 0x38, 0x37, 0xe6, 0xc0,
2860 0xb2, 0x5d, 0x98, 0x23, 0x3a, 0x5e, 0x6a, 0xd2, 0x06, 0x7d, 0x03, 0xcc, 2803 0xfb, 0xfd, 0x53, 0xa4, 0x4f, 0x9e, 0x4d, 0x54, 0xcd, 0x6d, 0x70, 0x3d,
2861 0x15, 0x68, 0xc6, 0xdd, 0x2f, 0x88, 0x71, 0xac, 0x63, 0x07, 0x9d, 0x00, 2804 0x83, 0x32, 0xbf, 0x3e, 0x24, 0xcb, 0xf8, 0xad, 0xae, 0x7b, 0xf7, 0xb6,
2862 0x77, 0x02, 0xaf, 0x56, 0x31, 0x4e, 0x61, 0x51, 0xf2, 0x41, 0x7f, 0xe9, 2805 0x0d, 0xdd, 0x7a, 0x3e, 0x6f, 0x6a, 0x7e, 0x5d, 0x76, 0x18, 0x33, 0x01,
2863 0x60, 0x4e, 0x6a, 0xa1, 0xfa, 0x45, 0x63, 0x04, 0x3a, 0x70, 0x1c, 0xef, 2806 0xaf, 0xe8, 0x9c, 0x2a, 0xf6, 0x65, 0x5e, 0xe1, 0x10, 0xe5, 0xa3, 0x53,
2864 0xf7, 0x4f, 0x90, 0x3e, 0x79, 0x36, 0x49, 0x35, 0xbe, 0xc4, 0xf5, 0x1c, 2807 0x87, 0x5c, 0xdd, 0xae, 0x51, 0x4f, 0x65, 0xbd, 0x35, 0x15, 0x0d, 0x74,
2865 0x94, 0x89, 0x45, 0x60, 0x23, 0xfc, 0xe6, 0x17, 0x83, 0x7b, 0xbb, 0x0e, 2808 0xc9, 0x2a, 0xf0, 0xae, 0x0c, 0xd9, 0x99, 0x7b, 0x25, 0x24, 0xcb, 0x79,
2866 0x9c, 0x3d, 0xe1, 0x99, 0x9a, 0x5f, 0x67, 0x5d, 0xc6, 0x4f, 0xc0, 0x2b, 2809 0x1d, 0x4f, 0x8e, 0xfe, 0x5e, 0x39, 0x52, 0xad, 0x4d, 0xca, 0x6e, 0x2d,
2867 0x3a, 0x8f, 0x8a, 0x7d, 0x99, 0x4b, 0x78, 0x88, 0xfa, 0xd1, 0x6d, 0x48, 2810 0xae, 0xbf, 0x51, 0xae, 0xe5, 0x5e, 0x37, 0xe4, 0xf9, 0x51, 0x9d, 0x57,
2868 0x0c, 0x6d, 0x89, 0x59, 0x59, 0x6f, 0x8d, 0x26, 0x23, 0xdd, 0x32, 0x0f, 2811 0x17, 0x2f, 0x4b, 0xef, 0x00, 0x75, 0x9e, 0x2d, 0x9d, 0x63, 0x07, 0xec,
2869 0x79, 0x57, 0x81, 0xee, 0x2c, 0x5c, 0x89, 0xca, 0xac, 0xa7, 0xe3, 0xd9, 2812 0x80, 0xce, 0xf1, 0x33, 0xe8, 0x1c, 0xef, 0x40, 0xe7, 0xf8, 0x69, 0x11,
2870 0xc9, 0x8f, 0x95, 0x2b, 0xb5, 0xfa, 0x71, 0xb9, 0x51, 0x77, 0xf4, 0x37, 2813 0xf8, 0x52, 0x4c, 0xfb, 0xf8, 0xbf, 0x08, 0x1c, 0xa2, 0xac, 0xb6, 0xce,
2871 0xea, 0xb5, 0xc2, 0xab, 0x86, 0x7c, 0xff, 0x88, 0xce, 0xa5, 0x73, 0x2a, 2814 0xe0, 0x4e, 0x17, 0xb3, 0xa0, 0xc1, 0x5b, 0x92, 0x06, 0xde, 0xa6, 0xe4,
2872 0xd2, 0xd9, 0x4f, 0xcc, 0xb3, 0xa2, 0xf3, 0xea, 0x20, 0x3b, 0x80, 0x39, 2815 0xfa, 0xc6, 0xbc, 0xec, 0x6c, 0x78,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, 0x97, 0x7f, 0x0a, 0xef, 0x5e, 0xe9, 0xdc, 0xba, 0x19, 0xb3, 0x1b, 2823 0xac, 0x68, 0x16, 0xf4, 0xb7, 0x0b, 0x5b, 0xed, 0x3a, 0xee, 0x60, 0x07,
2881 0xed, 0x9a, 0xb2, 0x6b, 0x30, 0x88, 0xb9, 0xab, 0xdb, 0x68, 0x83, 0x39, 2824 0x67, 0x70, 0xa3, 0x46, 0x39, 0x7f, 0x57, 0x63, 0xef, 0x66, 0xed, 0x4f,
2882 0x80, 0x19, 0xaf, 0x43, 0x87, 0x34, 0x9c, 0x6e, 0x8d, 0xfd, 0x1a, 0xce, 2825 0x18, 0xc7, 0x3a, 0x93, 0x94, 0x3f, 0xf6, 0x13, 0x03, 0xe9, 0x8f, 0x9a,
2883 0x21, 0x9d, 0x77, 0xcb, 0x71, 0x0a, 0x45, 0x5b, 0xe6, 0x8a, 0x56, 0x32, 2826 0xd1, 0xfd, 0xbd, 0x7e, 0xd7, 0xd1, 0x76, 0xa7, 0x46, 0x3c, 0x16, 0xb9,
2884 0x0f, 0xfa, 0xbb, 0x01, 0xbb, 0x6d, 0x15, 0x77, 0xb0, 0x86, 0x33, 0x58, 2827 0x94, 0xb7, 0x21, 0x4b, 0x5e, 0x8f, 0x50, 0x07, 0x28, 0xa9, 0x46, 0x3f,
2885 0xaf, 0x53, 0xcf, 0x6f, 0x6a, 0xd9, 0xbb, 0x5c, 0xff, 0x23, 0xc6, 0xb1, 2828 0xd7, 0x5f, 0xb3, 0xeb, 0x1e, 0xb5, 0xb9, 0xae, 0xb8, 0x8f, 0xdb, 0x94,
2886 0xce, 0xa4, 0xe5, 0x0f, 0x7d, 0x94, 0x81, 0xf4, 0x4d, 0x65, 0x75, 0xff, 2829 0xfd, 0x7b, 0x5a, 0xee, 0xe7, 0x8b, 0x67, 0xe5, 0x2d, 0xdc, 0xb7, 0xa7,
2887 0xa0, 0xdf, 0x2a, 0xda, 0xae, 0xd5, 0x29, 0x8f, 0x45, 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 0x2e, 0x0d, 0x1c, 0xf2, 0x04, 0xca, 0x11, 2852 0x5e, 0xb6, 0xf1, 0xac, 0x0e, 0xab, 0x99, 0x35, 0x96, 0xf1, 0x2c, 0x79,
2910 0xd4, 0x25, 0xc3, 0xb2, 0x81, 0xf2, 0x34, 0xca, 0x2d, 0x78, 0xb2, 0xcd, 2853 0xdf, 0x1f, 0xc2, 0x24, 0xf4, 0x49, 0x5d, 0xf5, 0x30, 0xe9, 0xa3, 0x26,
2911 0x61, 0xe0, 0x0a, 0x3c, 0x5f, 0xc3, 0x78, 0x23, 0x58, 0x73, 0xce, 0x94, 2854 0x26, 0xb1, 0xae, 0x5d, 0x66, 0xaf, 0x90, 0xd7, 0x4d, 0xd0, 0x5b, 0x87,
2912 0x8f, 0x4e, 0x50, 0x97, 0x38, 0x06, 0x73, 0x91, 0x67, 0x6d, 0x3c, 0x6b, 2855 0xcc, 0x5c, 0x0d, 0x6b, 0x7d, 0xb4, 0x0c, 0x5a, 0xdc, 0x06, 0x5d, 0x6d,
2913 0x45, 0x95, 0x5d, 0x60, 0x19, 0xcf, 0x72, 0xf0, 0xfd, 0x21, 0x99, 0x84, 2856 0x82, 0xa6, 0x52, 0x05, 0x6b, 0x6a, 0x51, 0x45, 0xb5, 0x2f, 0xe0, 0x09,
2914 0x3e, 0x99, 0x6b, 0x81, 0x4c, 0xfa, 0x68, 0x5b, 0x26, 0xb1, 0xae, 0x5d, 2857 0xd0, 0x6b, 0xf0, 0x15, 0xea, 0xa2, 0xe4, 0xe5, 0x38, 0x68, 0x4f, 0xdc,
2915 0xc6, 0xae, 0x92, 0xd7, 0x4d, 0xd0, 0x5b, 0xa7, 0x64, 0xaf, 0xc5, 0x34, 2858 0xa0, 0x6d, 0xa7, 0xe3, 0xca, 0x06, 0x0d, 0x82, 0x2e, 0x0b, 0x1e, 0x4f,
2916 0x1e, 0xad, 0x80, 0x16, 0xaf, 0x83, 0xae, 0x96, 0x41, 0x53, 0x99, 0xa2, 2859 0xbf, 0xa7, 0x34, 0xae, 0x4e, 0xdd, 0x96, 0x44, 0xf2, 0xb6, 0x58, 0xc0,
2917 0x35, 0x3a, 0xad, 0x92, 0xda, 0x2f, 0xf0, 0x38, 0xe8, 0xb5, 0xe3, 0x0a, 2860 0x02, 0xcb, 0xf9, 0x50, 0x1c, 0x8c, 0x39, 0x29, 0xd7, 0x30, 0x8f, 0x01,
2918 0xb1, 0x28, 0x79, 0xd9, 0x01, 0xed, 0x89, 0xdf, 0x61, 0xdb, 0x93, 0x8e, 2861 0xfe, 0x1e, 0x3d, 0xa1, 0xf9, 0x7b, 0x4a, 0x02, 0x87, 0x79, 0x1c, 0xf4,
2919 0xb2, 0x41, 0x83, 0xa0, 0xcb, 0x62, 0xc0, 0xd3, 0xef, 0x29, 0x2d, 0x57, 2862 0x06, 0x0c, 0xf2, 0x78, 0x3a, 0xe9, 0xd3, 0xe8, 0xd7, 0xc1, 0xbf, 0x16,
2920 0x47, 0xef, 0x48, 0x2a, 0x7d, 0x47, 0x2c, 0xc8, 0x02, 0xcb, 0xfd, 0x50, 2863 0x2c, 0xb1, 0xb0, 0xac, 0x82, 0xff, 0xb7, 0xf1, 0xfd, 0x66, 0x6d, 0x44,
2921 0x5c, 0x8c, 0x79, 0x5c, 0x5e, 0xc7, 0x3c, 0x06, 0xf8, 0xfb, 0xc8, 0x90, 2864 0xad, 0xac, 0x29, 0x3f, 0x97, 0xe4, 0x19, 0xe8, 0xc9, 0xb7, 0x70, 0x76,
2922 0xe6, 0xef, 0x51, 0x89, 0xec, 0xe6, 0x71, 0xd0, 0x1b, 0x64, 0x50, 0xc0, 2865 0x9d, 0x5a, 0x77, 0x8f, 0x8d, 0x33, 0x7e, 0x96, 0x56, 0x97, 0xed, 0x93,
2923 0xd3, 0xe9, 0x90, 0x46, 0x9f, 0x06, 0xff, 0x5a, 0xb0, 0xca, 0x92, 0x32, 2866 0xb2, 0x3f, 0x36, 0x89, 0xf2, 0x31, 0x3c, 0x0d, 0x9c, 0x43, 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, 0xfb, 0x3f, 2881 0xf4, 0x7d, 0x43, 0xd7, 0xa4, 0xcf, 0x68, 0x12, 0x74, 0x43, 0x5a, 0x27,
2939 0xfb, 0x20, 0x9d, 0x0c, 0x1b, 0x41, 0x0e, 0x06, 0x9e, 0x35, 0x9e, 0xe7, 2882 0x6f, 0x99, 0x52, 0x02, 0x1d, 0x95, 0x80, 0x4f, 0x25, 0xd0, 0x54, 0x19,
2940 0xa7, 0xc0, 0xf7, 0x3b, 0xe9, 0xa7, 0xe9, 0x67, 0x0c, 0xe8, 0xe7, 0x91, 2883 0xf8, 0x56, 0x02, 0xbe, 0x95, 0x6a, 0x56, 0xbc, 0x82, 0x3d, 0x53, 0x66,
2941 0x6d, 0xfa, 0x21, 0xdd, 0x74, 0xca, 0xd8, 0x35, 0x5b, 0x26, 0x8a, 0xfa, 2884 0x6f, 0x81, 0x8e, 0xb6, 0x6b, 0xbc, 0x7f, 0xbd, 0x66, 0x93, 0x72, 0xf0,
2942 0xbe, 0x81, 0x35, 0xe9, 0x3f, 0x3a, 0x0e, 0xba, 0x21, 0xad, 0x93, 0xb7, 2885 0x66, 0xf3, 0xee, 0xff, 0x81, 0xbb, 0x1f, 0x92, 0x5d, 0xd8, 0x2d, 0x6f,
2943 0x4c, 0x29, 0x83, 0x8e, 0xca, 0x90, 0x4f, 0x65, 0xd0, 0x14, 0x31, 0x50, 2886 0x15, 0xc7, 0x80, 0x49, 0x02, 0x8c, 0x72, 0x40, 0x1b, 0x53, 0x72, 0xbd,
2944 0x19, 0xf2, 0xad, 0x5c, 0xb7, 0x9c, 0x2a, 0xf6, 0x4c, 0x9d, 0xbd, 0x02, 2887 0x38, 0x2d, 0x3b, 0x90, 0x4f, 0x37, 0x36, 0x62, 0xd0, 0xa7, 0x23, 0xb2,
2945 0x3a, 0xba, 0x5e, 0xe7, 0xfd, 0xeb, 0x35, 0x9b, 0xd4, 0x83, 0xb7, 0xb6, 2888 0xf2, 0xda, 0xa8, 0xbc, 0xb9, 0xa1, 0x64, 0x09, 0xf4, 0x9b, 0xdb, 0xa4,
2946 0xef, 0xfe, 0xef, 0xb8, 0xfb, 0x43, 0x72, 0x03, 0x76, 0xcb, 0x9b, 0xa5, 2889 0xdf, 0x1d, 0xf4, 0x5c, 0xea, 0xd0, 0x71, 0xfa, 0xd9, 0x8a, 0xe7, 0x7f,
2947 0x61, 0xc8, 0x24, 0x21, 0x5e, 0x04, 0x6d, 0x8c, 0xca, 0x6a, 0xe9, 0xa4, 2890 0x9f, 0xab, 0x74, 0xca, 0x7c, 0xc5, 0x94, 0xc7, 0x2b, 0xdd, 0xf2, 0xe5,
2948 0xac, 0x41, 0x3f, 0xad, 0x2f, 0x0d, 0x00, 0x4f, 0x43, 0x8e, 0xbe, 0x72, 2891 0x4a, 0x58, 0x4e, 0xc3, 0x0e, 0xfc, 0x4a, 0x65, 0x50, 0x9e, 0xac, 0x0c,
2949 0x44, 0xde, 0x58, 0x52, 0x32, 0x63, 0x43, 0xbf, 0x2c, 0xd3, 0x07, 0x0f, 2892 0xc9, 0x57, 0xab, 0x51, 0xf9, 0x5a, 0xd5, 0x96, 0x4c, 0x35, 0x2e, 0xe9,
2950 0x7a, 0x2e, 0x77, 0xea, 0x98, 0xfd, 0x58, 0x35, 0xf0, 0xc5, 0x8f, 0x57, 2893 0xea, 0x98, 0x3c, 0x51, 0xa5, 0x5f, 0x1d, 0xf3, 0xe1, 0x37, 0xd3, 0xf4,
2951 0xbb, 0x64, 0xa2, 0x6a, 0xca, 0x63, 0xd5, 0x1e, 0x79, 0xa2, 0x1a, 0x93, 2894 0x57, 0x70, 0x5d, 0x41, 0xac, 0x2b, 0xae, 0xe6, 0x74, 0x9c, 0x52, 0x32,
2952 0xd3, 0xb5, 0x84, 0x7c, 0xa3, 0x7a, 0x50, 0x4e, 0x55, 0x0f, 0xc9, 0x93, 2895 0x9e, 0xcf, 0x43, 0xe4, 0x39, 0x8c, 0x75, 0xf1, 0x35, 0x25, 0x65, 0x3d,
2953 0xb5, 0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0x3f, 0x52, 0xe5,
2975 0x51, 0xf9, 0x8b, 0xa9, 0x7d, 0x0a, 0xe1, 0xb7, 0x3d, 0xf2, 0x94, 0xc9, 2918 0x3c, 0xf0, 0xce, 0x6e, 0xd1, 0xfc, 0x98, 0xab, 0xfe, 0xdb, 0xdd, 0xd3,
2976 0xdc, 0xf5, 0xb4, 0x1a, 0x2b, 0xfd, 0x34, 0xcc, 0xd3, 0xdd, 0x52, 0xfb, 2919 0xfc, 0xdc, 0xf0, 0x31, 0xfc, 0x6e, 0x80, 0xb6, 0x2d, 0x71, 0xe3, 0x92,
2977 0x2b, 0x6f, 0xf7, 0x07, 0x79, 0xee, 0x1c, 0x7b, 0x67, 0x6e, 0xfb, 0x4e, 2920 0x97, 0x3b, 0xaa, 0x6d, 0x68, 0x60, 0x05, 0xea, 0xc8, 0xab, 0xe0, 0x93,
2978 0x3a, 0x61, 0x8e, 0x7b, 0x3b, 0x70, 0xab, 0x56, 0x62, 0xe0, 0x41, 0xc8, 2921 0x66, 0x5b, 0xfe, 0xfd, 0x07, 0x69, 0x3f, 0x51, 0x42, 0x6c, 0x67, 0x00,
2979 0x3b, 0xbb, 0x45, 0xf3, 0x63, 0xa1, 0xf6, 0x2f, 0x7f, 0x43, 0xf3, 0x73, 2922 0x00, 0x00 };
2980 0xd3, 0xc7, 0xf0, 0xdb, 0x7e, 0xda, 0xb6, 0x94, 0x1b, 0x97, 0x02, 0xbf, 2923
2981 0x91, 0xb6, 0xa1, 0x21, 0x2b, 0x50, 0x47, 0x5e, 0x05, 0x9f, 0x6c, 0xb7, 2924static const u32 bnx2_RXP_b09FwData[(0x0/4) + 1] = { 0x0 };
2982 0xe5, 0xdf, 0x7f, 0x01, 0x99, 0xe7, 0xd3, 0x46, 0x40, 0x67, 0x00, 0x00, 2925static const u32 bnx2_RXP_b09FwRodata[(0x278/4) + 1] = {
2983 0x00 }; 2926 0x08004050, 0x08003f50, 0x08003ff4, 0x0800400c, 0x08004024, 0x08004044,
2984static u32 bnx2_RXP_b09FwData[(0x0/4) + 1] = { 0x0 }; 2927 0x08004050, 0x08004050, 0x08003f58, 0x00000000, 0x08004a0c, 0x08004a44,
2985static u32 bnx2_RXP_b09FwRodata[(0x278/4) + 1] = { 2928 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004a7c, 0x08004c40,
2986 0x08003fa4, 0x08003ea4, 0x08003f48, 0x08003f60, 0x08003f78, 0x08003f98, 2929 0x08004b88, 0x08004bc0, 0x08004c40, 0x08004b10, 0x08004c40, 0x08004c40,
2987 0x08003fa4, 0x08003fa4, 0x08003eac, 0x00000000, 0x080049d4, 0x08004a0c, 2930 0x08004bc0, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2988 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004a44, 0x08004c08, 2931 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c00,
2989 0x08004b50, 0x08004b88, 0x08004c08, 0x08004ad8, 0x08004c08, 0x08004c08, 2932 0x08004c40, 0x08004c00, 0x08004b88, 0x08004c40, 0x08004c40, 0x08004c00,
2990 0x08004b88, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2933 0x08004c00, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2991 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004bc8, 2934 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2992 0x08004c08, 0x08004bc8, 0x08004b50, 0x08004c08, 0x08004c08, 0x08004bc8, 2935 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2993 0x08004bc8, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2936 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2994 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2937 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2995 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2938 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2996 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2939 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2997 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2940 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2998 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2941 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
2999 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2942 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3000 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2943 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3001 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2944 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3002 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2945 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3003 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2946 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3004 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2947 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3005 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2948 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40,
3006 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2949 0x08004aec, 0x00000000, 0x08006058, 0x08006070, 0x08006070, 0x08006070,
3007 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2950 0x08006058, 0x08006070, 0x08006070, 0x08006070, 0x08006058, 0x08006070,
3008 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 0x08004c08, 2951 0x08006070, 0x08006070, 0x08006058, 0x08006070, 0x08006070, 0x08006070,
3009 0x08004ab4, 0x00000000, 0x0800602c, 0x08006044, 0x08006044, 0x08006044, 2952 0x08006064, 0x00000000, 0x00000000 };
3010 0x0800602c, 0x08006044, 0x08006044, 0x08006044, 0x0800602c, 0x08006044, 2953static const u32 bnx2_RXP_b09FwBss[(0x13dc/4) + 1] = { 0x0 };
3011 0x08006044, 0x08006044, 0x0800602c, 0x08006044, 0x08006044, 0x08006044, 2954static const u32 bnx2_RXP_b09FwSbss[(0x20/4) + 1] = { 0x0 };
3012 0x08006038, 0x00000000, 0x00000000 };
3013static u32 bnx2_RXP_b09FwBss[(0x13dc/4) + 1] = { 0x0 };
3014static u32 bnx2_RXP_b09FwSbss[(0x2c/4) + 1] = { 0x0 };
3015 2955
3016static struct fw_info bnx2_rxp_fw_09 = { 2956static struct fw_info bnx2_rxp_fw_09 = {
3017 .ver_major = 0x1, 2957 .ver_major = 0x3,
3018 .ver_minor = 0x0, 2958 .ver_minor = 0x4,
3019 .ver_fix = 0x0, 2959 .ver_fix = 0x3,
3020 2960
3021 .start_addr = 0x08003184, 2961 .start_addr = 0x08003184,
3022 2962
3023 .text_addr = 0x08000000, 2963 .text_addr = 0x08000000,
3024 .text_len = 0x673c, 2964 .text_len = 0x6768,
3025 .text_index = 0x0, 2965 .text_index = 0x0,
3026 .gz_text = bnx2_RXP_b09FwText, 2966 .gz_text = bnx2_RXP_b09FwText,
3027 .gz_text_len = sizeof(bnx2_RXP_b09FwText), 2967 .gz_text_len = sizeof(bnx2_RXP_b09FwText),
3028 2968
3029 .data_addr = 0x080069e0, 2969 .data_addr = 0x08006a00,
3030 .data_len = 0x0, 2970 .data_len = 0x0,
3031 .data_index = 0x0, 2971 .data_index = 0x0,
3032 .data = bnx2_RXP_b09FwData, 2972 .data = bnx2_RXP_b09FwData,
3033 2973
3034 .sbss_addr = 0x080069e0, 2974 .sbss_addr = 0x08006a00,
3035 .sbss_len = 0x2c, 2975 .sbss_len = 0x20,
3036 .sbss_index = 0x0, 2976 .sbss_index = 0x0,
3037 .sbss = bnx2_RXP_b09FwSbss, 2977 .sbss = bnx2_RXP_b09FwSbss,
3038 2978
3039 .bss_addr = 0x08006a10, 2979 .bss_addr = 0x08006a20,
3040 .bss_len = 0x13dc, 2980 .bss_len = 0x13dc,
3041 .bss_index = 0x0, 2981 .bss_index = 0x0,
3042 .bss = bnx2_RXP_b09FwBss, 2982 .bss = bnx2_RXP_b09FwBss,
3043 2983
3044 .rodata_addr = 0x08006740, 2984 .rodata_addr = 0x08006768,
3045 .rodata_len = 0x278, 2985 .rodata_len = 0x278,
3046 .rodata_index = 0x0, 2986 .rodata_index = 0x0,
3047 .rodata = bnx2_RXP_b09FwRodata, 2987 .rodata = bnx2_RXP_b09FwRodata,
3048}; 2988};
3049 2989
3050static u8 bnx2_TPAT_b09FwText[] = { 2990static u8 bnx2_TPAT_b09FwText[] = {
3051 0x1f, 0x8b, 0x08, 0x08, 0xdb, 0xfd, 0x2f, 0x45, 0x00, 0x03, 0x74, 0x65, 2991 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, 0xcd, 0x58,
3052 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xc5, 0x58, 0x5d, 0x6c, 2992 0x5d, 0x68, 0x1c, 0xd7, 0x15, 0x3e, 0xf3, 0xb7, 0x3b, 0x52, 0x24, 0xeb,
3053 0x1c, 0x57, 0x15, 0x3e, 0xf3, 0xbb, 0x13, 0x77, 0xed, 0xbd, 0x49, 0x97, 2993 0x5a, 0xd9, 0xa6, 0xeb, 0xa0, 0x34, 0x33, 0xda, 0x91, 0xac, 0x22, 0x13,
3054 0x6a, 0x13, 0xb9, 0x74, 0xc6, 0x1e, 0x3b, 0x8b, 0x1c, 0x35, 0x93, 0xb0, 2994 0x4f, 0x9d, 0x25, 0x16, 0x65, 0x21, 0x93, 0xd9, 0x91, 0xac, 0x98, 0x3c,
3055 0x24, 0x16, 0x5a, 0xd1, 0xc9, 0xcc, 0xae, 0x6b, 0xe5, 0x29, 0x86, 0xbc, 2995 0x28, 0xc5, 0x90, 0x87, 0x52, 0x50, 0x57, 0x32, 0x09, 0x79, 0x69, 0xda,
3056 0xf1, 0xb2, 0xac, 0xed, 0x46, 0x54, 0x48, 0x4d, 0x51, 0x84, 0x22, 0x81, 2996 0xc6, 0x90, 0x3e, 0x79, 0x3b, 0x2b, 0xc7, 0x0e, 0x6c, 0xbc, 0x8d, 0x52,
3057 0x94, 0x65, 0x76, 0x53, 0x40, 0x5a, 0x65, 0xc1, 0xa0, 0x04, 0x21, 0x84, 2997 0xe4, 0x52, 0xfa, 0x60, 0xd6, 0xb1, 0x05, 0xcd, 0x46, 0x93, 0xd4, 0x7e,
3058 0x22, 0x9b, 0x66, 0x91, 0x58, 0x3c, 0x4d, 0xe9, 0x6b, 0x94, 0xbc, 0x90, 2998 0x35, 0x36, 0x4e, 0x93, 0xa7, 0x42, 0x9f, 0x52, 0xf4, 0x18, 0xd2, 0x12,
3059 0x96, 0x17, 0x9e, 0x4b, 0x9e, 0xac, 0x02, 0x12, 0x0f, 0xa8, 0x8a, 0x78, 2999 0xda, 0x52, 0x8a, 0x69, 0xa1, 0x09, 0x8d, 0xeb, 0xdb, 0xef, 0xdc, 0x99,
3060 0x40, 0x15, 0x0d, 0x1e, 0xbe, 0x33, 0x3f, 0x9b, 0x5d, 0xd7, 0x29, 0x79, 3000 0x91, 0x57, 0xb6, 0xec, 0xa4, 0x25, 0x85, 0x0a, 0x56, 0x77, 0xe6, 0xce,
3061 0xa8, 0x84, 0xa5, 0xf1, 0xcc, 0xfd, 0x39, 0xf7, 0xe7, 0x7c, 0xdf, 0x77, 3001 0x3d, 0xe7, 0x9e, 0x7b, 0xee, 0x77, 0xbe, 0x73, 0xee, 0x2d, 0xeb, 0x34,
3062 0xee, 0xb9, 0x5b, 0x92, 0x69, 0x82, 0xd2, 0xbf, 0x49, 0x3c, 0x97, 0xbe, 3002 0x48, 0xd9, 0xdf, 0x30, 0x7e, 0x2f, 0x7e, 0xf7, 0x85, 0x17, 0xab, 0x8f,
3063 0x71, 0xf1, 0xd2, 0xe2, 0x8b, 0x27, 0x4d, 0x3a, 0x71, 0xe2, 0x45, 0xe9, 3003 0x3c, 0xea, 0x10, 0x3d, 0xfa, 0x88, 0x66, 0x98, 0x06, 0x7d, 0x09, 0x7f,
3064 0x19, 0x43, 0xa6, 0xcf, 0xe0, 0x4f, 0x21, 0x12, 0xd9, 0xf8, 0xfc, 0x90, 3004 0x50, 0x22, 0x72, 0xfd, 0xfc, 0x23, 0x5b, 0xaf, 0x9d, 0x72, 0x42, 0x8f,
3065 0x21, 0x57, 0x6f, 0x4e, 0x7b, 0x36, 0x19, 0x4a, 0xd5, 0x79, 0x61, 0xd5, 3005 0x6c, 0xa3, 0x26, 0xbe, 0xbe, 0xe4, 0x11, 0x05, 0xbd, 0x69, 0xa7, 0x4e,
3066 0x26, 0x72, 0x07, 0x0b, 0xa6, 0x4f, 0xff, 0x89, 0x5a, 0x45, 0x95, 0xb8, 3006 0xff, 0x92, 0xcd, 0x92, 0x49, 0xdc,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a, 0x3c, 0x22, 0xe5,
3096 0xcb, 0x12, 0x96, 0x42, 0x1f, 0x74, 0xdf, 0x63, 0x7f, 0x94, 0x97, 0x62, 3036 0x8a, 0x2f, 0xa5, 0x55, 0xf3, 0x9c, 0x13, 0x34, 0x5d, 0x36, 0x69, 0x52,
3097 0x9b, 0x28, 0xda, 0x5c, 0xfc, 0x34, 0x9b, 0xef, 0xa7, 0x36, 0x51, 0x54, 3037 0xa0, 0x85, 0x8f, 0xbd, 0x72, 0x83, 0x2c, 0x60, 0xa1, 0x1f, 0xff, 0xfc,
3098 0xaf, 0xf0, 0xbc, 0x16, 0xf6, 0xcc, 0x5c, 0x25, 0xaa, 0x0f, 0x1c, 0xa3, 3038 0xf7, 0xa6, 0x86, 0x25, 0xd0, 0xb5, 0x36, 0xeb, 0x98, 0x70, 0x66, 0x95,
3099 0xd9, 0xc5, 0xfa, 0x6c, 0xbc, 0x07, 0x25, 0xec, 0xc1, 0x2a, 0x9b, 0x92, 3039 0x8c, 0x94, 0xf1, 0xcc, 0xbd, 0x64, 0x2e, 0x65, 0x32, 0x52, 0x46, 0x55,
3100 0x41, 0x81, 0x1d, 0xbd, 0x00, 0x7e, 0xb8, 0xbe, 0x6d, 0xbd, 0xef, 0x2b, 3040 0x81, 0x3d, 0x6f, 0x0a, 0xd8, 0x87, 0x75, 0x31, 0xc6, 0x89, 0xa2, 0x9e,
3101 0x05, 0xda, 0x72, 0xf2, 0xd4, 0x09, 0x4b, 0x14, 0x84, 0x1d, 0xf2, 0x42, 3041 0x6f, 0x37, 0xda, 0xb0, 0xd1, 0x43, 0xdb, 0x13, 0xf0, 0x0f, 0x51, 0x0b,
3102 0x19, 0x73, 0x14, 0x68, 0xd3, 0x7e, 0x18, 0xd5, 0x1d, 0x07, 0x7e, 0x21, 3042 0x63, 0xf5, 0xea, 0x7d, 0x8c, 0x0d, 0xec, 0xef, 0x82, 0x1d, 0xb5, 0xdd,
3103 0xb6, 0x2b, 0xd5, 0x69, 0x1a, 0xed, 0x0b, 0x62, 0x8d, 0x1c, 0x60, 0x21, 3043 0xf2, 0x29, 0x5a, 0xb0, 0xeb, 0xbd, 0xe9, 0xf2, 0x32, 0x3d, 0xc4, 0x73,
3104 0xc3, 0x37, 0xb3, 0xf1, 0x77, 0x10, 0x3a, 0x68, 0xa7, 0x96, 0x5c, 0xb1, 3044 0xd8, 0x56, 0xed, 0x88, 0xdd, 0x55, 0x72, 0x88, 0xc4, 0x41, 0x3c, 0xf7,
3105 0x44, 0x40, 0x56, 0xc9, 0x53, 0x48, 0xc8, 0x55, 0x81, 0x3e, 0x2d, 0xaa, 3045 0x88, 0xe2, 0x36, 0x69, 0xa1, 0x7f, 0x1f, 0xaf, 0x15, 0x72, 0xf3, 0x99,
3106 0x85, 0x06, 0xed, 0x28, 0x97, 0x63, 0x7e, 0xb7, 0x7b, 0x3b, 0xd1, 0x9d, 3046 0xdc, 0x7c, 0x26, 0x37, 0x92, 0xc9, 0x3d, 0xd5, 0x27, 0xf7, 0x14, 0xcb,
3107 0xa3, 0x25, 0xba, 0x1b, 0x16, 0xe9, 0x76, 0x48, 0x72, 0xd3, 0x01, 0x37, 3047 0x61, 0x6c, 0x90, 0x8d, 0x0d, 0xb2, 0xb1, 0x66, 0x36, 0x36, 0xca, 0xc6,
3108 0x8a, 0x82, 0xde, 0x0a, 0x47, 0xf7, 0xf2, 0x1b, 0xec, 0x25, 0x38, 0xa2, 3048 0xa2, 0xed, 0x8d, 0xc1, 0x36, 0x77, 0xca, 0xd1, 0x6c, 0x8a, 0x3d, 0xf9,
3109 0x40, 0x83, 0xab, 0xce, 0x3d, 0x30, 0xc8, 0x02, 0x46, 0x2d, 0xec, 0x3d, 3049 0x70, 0xe8, 0x53, 0x50, 0xf7, 0xdc, 0xcd, 0xba, 0x31, 0x42, 0xe7, 0xfc,
3110 0x7b, 0xf3, 0xbe, 0x76, 0xa6, 0x57, 0x6d, 0xeb, 0x87, 0x3e, 0xa3, 0x76, 3050 0x21, 0x5a, 0x49,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0xff, 0x88,
3118 0xea, 0x36, 0xb9, 0xed, 0x61, 0x5a, 0xcf, 0x63, 0x44, 0x91, 0xe7, 0x3c, 3058 0x7d, 0x6e, 0xdf, 0x5f, 0x23, 0x7b, 0xb4, 0xc6, 0x38, 0x4b, 0x39, 0xa0,
3119 0x4b, 0x1e, 0xf3, 0xff, 0x3c, 0xdb, 0xe4, 0x68, 0x66, 0x83, 0x75, 0x83, 3059 0x9e, 0x72, 0x80, 0xc2, 0x52, 0xab, 0x13, 0x3f, 0x68, 0x80, 0x7f, 0x96,
3120 0xf7, 0x26, 0x97, 0x79, 0x6d, 0x07, 0xa8, 0x89, 0x1d, 0x35, 0xcb, 0x45, 3060 0xfc, 0x60, 0xb7, 0xa1, 0xf6, 0xa3, 0x89, 0x3d, 0xcc, 0x5b, 0xde, 0x9b,
3121 0xf8, 0x41, 0x8e, 0x35, 0xd2, 0xc4, 0x8e, 0x65, 0x7b, 0x02, 0x6f, 0x9e, 3061 0xab, 0xce, 0x92, 0xe7, 0x9e, 0xaa, 0x33, 0x6a, 0x4f, 0x5b, 0x39, 0x2e,
3122 0xef, 0xac, 0x92, 0xf0, 0x9d, 0xe3, 0x46, 0x9e, 0x7c, 0xe0, 0xab, 0x62, 3062 0xfb, 0xe6, 0xf8, 0x33, 0xe6, 0x18, 0xa2, 0x06, 0xe2, 0xec, 0x09, 0x13,
3123 0x3d, 0x6b, 0x34, 0x57, 0x5a, 0x8f, 0xdb, 0x50, 0x37, 0xe0, 0x36, 0xb1, 3063 0xb1, 0xe3, 0xfd, 0xdd, 0x60, 0x5c, 0x39, 0x1b, 0x8c, 0x6f, 0xa2, 0xf1,
3124 0xa7, 0x0d, 0xe5, 0x41, 0xb6, 0x06, 0x70, 0xda, 0x6e, 0x63, 0x16, 0x2d, 3064 0x0d, 0x9b, 0xd6, 0xdb, 0x45, 0x72, 0xba, 0x43, 0xb4, 0xd4, 0x19, 0xa4,
3125 0xde, 0x6b, 0xdd, 0xe1, 0xfe, 0xdc,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
3147 0xa2, 0x55, 0xa7, 0x40, 0x4d, 0xe0, 0xee, 0x42, 0xc3, 0x4d, 0x68, 0xd8, 3087 0x4f, 0xbc, 0xd5, 0x29, 0xec, 0xeb, 0x54, 0x66, 0x23, 0xef, 0x97, 0x49,
3148 0x1f, 0xd1, 0xb0, 0xff, 0x3f, 0x35, 0x0c, 0x7d, 0x42, 0x23, 0xb7, 0xc1, 3088 0x2b, 0x55, 0x9d, 0xce, 0x57, 0x3f, 0x93, 0xba, 0xc7, 0xfc, 0x5a, 0x80,
3149 0xa9, 0xb7, 0x7a, 0xfb, 0xe9, 0x99, 0xb5, 0xcc, 0x9a, 0x36, 0xe9, 0xce, 3089 0x6f, 0x31, 0xae, 0x8b, 0x71, 0x49, 0x01, 0x3e, 0xfc, 0x07, 0x78, 0x45,
3150 0xd1, 0xa7, 0xd5, 0x74, 0x49, 0x7e, 0x4a, 0x4d, 0xb7, 0x58, 0xd3, 0x2a, 3090 0xca, 0xf3, 0x55, 0xf4, 0xaf, 0x1e, 0x87, 0xad, 0x06, 0x64, 0x53, 0x8c,
3151 0x6b, 0xba, 0xb8, 0x57, 0xd3, 0xd3, 0x18, 0x23, 0xd1, 0xe6, 0x19, 0xb5, 3091 0xb1, 0x3d, 0x73, 0xed, 0x7c, 0x7d, 0xde, 0xcc, 0x7b, 0x4a, 0xdf, 0x10,
3152 0x48, 0xda, 0x3c, 0xf0, 0xd8, 0xc8, 0x93, 0x72, 0xed, 0x31, 0xef, 0x98, 3092 0x4d, 0x6e, 0x0c, 0xd1, 0xb3, 0xbd, 0x21, 0x1a, 0x3f, 0xcd, 0x32, 0xe0,
3153 0xcb, 0xfe, 0x00, 0xff, 0xb6, 0x35, 0xb4, 0x49, 0xe3, 0xf5, 0x88, 0x81, 3093 0xa6, 0xaa, 0x27, 0x22, 0xc6, 0xa8, 0xa7, 0xfc, 0x50, 0x36, 0x74, 0x5e,
3154 0x6a, 0xd5, 0x2a, 0xad, 0xc5, 0x7d, 0x54, 0xd2, 0xe1, 0xff, 0xd7, 0x8f, 3094 0x27, 0xbe, 0x6f, 0x10, 0x2d, 0xf7, 0x78, 0x0e, 0xb3, 0x4f, 0xa7, 0x4e,
3155 0x5a, 0xa6, 0x29, 0x8f, 0x6a, 0x1f, 0xea, 0xdf, 0x88, 0xae, 0x68, 0x55, 3095 0x87, 0x7e, 0x4a, 0x74, 0xa8, 0xc7, 0xb2, 0x5b, 0xbe, 0x83, 0x5e, 0x01,
3156 0x9e, 0xa7, 0x65, 0x82, 0xf3, 0xe6, 0x4f, 0x80, 0x55, 0xbb, 0xcb, 0x7c, 3096 0x9d, 0x82, 0x38, 0x0f, 0x19, 0x1e, 0xf2, 0xdd, 0x7a, 0x88, 0xfc, 0x15,
3157 0xb7, 0x45, 0x3d, 0xe6, 0x19, 0xca, 0xd0, 0x84, 0x06, 0xde, 0xe6, 0xd0, 3097 0xe1, 0x37, 0x87, 0x9c, 0xc6, 0xeb, 0x9f, 0x42, 0xfc, 0x31, 0x8f, 0xdf,
3158 0x4f, 0xdd, 0x48, 0x74, 0x74, 0x1b, 0xe3, 0x6e, 0x75, 0x99, 0x67, 0x06, 3098 0xc4, 0xda, 0x0b, 0xb4, 0xe2, 0xcf, 0x63, 0x0c, 0xef, 0xf1, 0x61, 0x7c,
3159 0xe9, 0xd7, 0xed, 0xd2, 0x85, 0x38, 0x06, 0xcf, 0x8a, 0x25, 0x62, 0x0d, 3099 0x1f, 0x46, 0x1e, 0xc8, 0xf2, 0x84, 0xe0, 0x3c, 0xb1, 0x1b, 0x71, 0x30,
3160 0xf2, 0xb9, 0x88, 0xf6, 0x41, 0x8e, 0x94, 0x58, 0xf7, 0x13, 0xa9, 0xee, 3100 0x00, 0xee, 0xdf, 0x63, 0x6e, 0xcf, 0x13, 0x18, 0x57, 0xda, 0x83, 0xbc,
3161 0x9f, 0x87, 0xaf, 0x26, 0x50, 0x66, 0xed, 0x1f, 0x4e, 0xb5, 0x3f, 0x85, 3101 0x70, 0x3f, 0xfa, 0x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, 0x23,
3169 0x02, 0x4d, 0x5c, 0x54, 0x13, 0x8d, 0xbc, 0x86, 0xf7, 0x19, 0x94, 0x57, 3109 0xd4, 0x00, 0x2e, 0x03, 0xf0, 0x59, 0x03, 0x7c, 0x56, 0xef, 0xe3, 0xb3,
3170 0xf6, 0x68, 0x24, 0xb3, 0x7b, 0xf2, 0x39, 0x1e, 0xf4, 0x4a, 0xf1, 0x99, 3110 0xfa, 0xe7, 0xf2, 0x19, 0xb8, 0xaa, 0x03, 0xae, 0xea, 0x80, 0xab, 0x50,
3171 0xcb, 0xf3, 0x29, 0x1b, 0xd4, 0xd2, 0x52, 0x3d, 0xd4, 0x87, 0x7a, 0x98, 3111 0x1b, 0xbc, 0x03, 0xec, 0xbf, 0xdd, 0xd9, 0x89, 0xe3, 0x98, 0xdf, 0x98,
3172 0x40, 0xcc, 0xc8, 0xa5, 0x5c, 0xc7, 0xdb, 0xfe, 0x48, 0xf1, 0x1d, 0x4b, 3112 0xe7, 0xa6, 0xe8, 0xf2, 0xde, 0xff, 0x94, 0xe7, 0x8e, 0x83, 0x13, 0x6c,
3173 0xb4, 0x89, 0xb5, 0x31, 0x7a, 0x9e, 0xfd, 0xbf, 0xf4, 0x41, 0xe0, 0x51, 3113 0xfa, 0xfe, 0xde, 0x7b, 0x73, 0xdd, 0x09, 0x70, 0x9d, 0xf5, 0xf9, 0x5c,
3174 0x3c, 0x37, 0x72, 0x11, 0x3e, 0x17, 0xa2, 0xe8, 0x15, 0x07, 0xed, 0x59, 3114 0xd7, 0x64, 0xae, 0x33, 0x81, 0xbd, 0x26, 0x78, 0x40, 0x5f, 0xed, 0x9f,
3175 0x4e, 0x12, 0x63, 0x9f, 0xc3, 0xd9, 0xcb, 0x78, 0x20, 0x0f, 0xb4, 0x67, 3115 0xe7, 0x24, 0xe6, 0xe1, 0x3e, 0x33, 0xcb, 0xa5, 0x3a, 0x75, 0x81, 0x7b,
3176 0xa1, 0x07, 0x8e, 0x05, 0xbb, 0xd1, 0x96, 0xed, 0xa1, 0xae, 0x06, 0xff, 3116 0xc3, 0xe3, 0x79, 0x60, 0x73, 0x92, 0x72, 0xd1, 0x13, 0x66, 0x89, 0xac,
3177 0x33, 0x26, 0xcb, 0xd2, 0x52, 0xdf, 0x60, 0x3b, 0xe8, 0x6d, 0xbf, 0x5c, 3117 0x49, 0xe0, 0x61, 0x75, 0x88, 0x8c, 0xd3, 0xb7, 0xf0, 0x8e, 0x7a, 0x00,
3178 0x4c, 0x87, 0xae, 0x1e, 0xe3, 0xc4, 0x3c, 0x6a, 0x8e, 0xe0, 0xd4, 0x88, 3118 0x71, 0x8e, 0x7f, 0x1b, 0xb9, 0x8e, 0x41, 0x70, 0x8d, 0x49, 0x85, 0x55,
3179 0x71, 0xda, 0x19, 0xe2, 0xd4, 0x4c, 0x71, 0x6a, 0xc6, 0x38, 0x3d, 0x48, 3119 0x0b, 0xef, 0xda, 0xb6, 0x71, 0x87, 0x90, 0x6f, 0x8c, 0x9a, 0x3b, 0xf3,
3180 0x71, 0xfa, 0xf3, 0x13, 0x70, 0xda, 0x79, 0x0a, 0x9c, 0x0c, 0xda, 0xb2, 3120 0x7b, 0x7e, 0xee, 0xf1, 0x98, 0x41, 0xd2, 0xd7, 0x5c, 0xc7, 0xd1, 0x5d,
3181 0x4b, 0x38, 0x6f, 0xf5, 0x38, 0x77, 0xbd, 0xef, 0xec, 0x97, 0x7b, 0xb1, 3121 0xff, 0x1a, 0xb8, 0xe1, 0x7d, 0x8f, 0xf9, 0x2f, 0x06, 0x0a, 0x0a, 0x64,
3182 0xdf, 0xc7, 0xb0, 0x8a, 0x18, 0xab, 0x2d, 0x1a, 0xcd, 0x43, 0x2c, 0xf3, 3122 0xae, 0xca, 0xe3, 0x56, 0x8d, 0xe7, 0x6e, 0x3a, 0x88, 0x73, 0xe7, 0x35,
3183 0x1e, 0x15, 0x70, 0x6e, 0xe4, 0xe9, 0xea, 0x9e, 0x5c, 0x24, 0x00, 0x4e, 3123 0xe0, 0x87, 0x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0xee, 0x46, 0xcb, 0x7d,
3191 0x9c, 0xc3, 0x9f, 0xd0, 0x68, 0x62, 0x39, 0xc5, 0x93, 0x79, 0x3d, 0x89, 3131 0x37, 0xb2, 0x38, 0x31, 0x61, 0x2f, 0xeb, 0x1d, 0x24, 0x03, 0x76, 0x45,
3192 0xb6, 0xb3, 0x31, 0xee, 0x6d, 0xc4, 0xf2, 0x55, 0xf8, 0xa0, 0x19, 0xf3, 3132 0x6a, 0x4d, 0x7f, 0x93, 0x4b, 0x1e, 0x73, 0x04, 0xe3, 0x53, 0x71, 0x29,
3193 0x13, 0x79, 0x57, 0xca, 0x5d, 0xe4, 0xbb, 0xe4, 0x87, 0x09, 0x4f, 0x3f, 3133 0xfa, 0x27, 0x60, 0x33, 0xf3, 0x02, 0xcb, 0xb1, 0xfc, 0x4e, 0x72, 0x7f,
3194 0xdb, 0x5c, 0xec, 0xef, 0x88, 0xd9, 0x46, 0x43, 0xc5, 0x1d, 0xe0, 0x6e, 3134 0x85, 0x9c, 0xd8, 0x41, 0x0e, 0x7d, 0x1b, 0x2c, 0xc3, 0xdc, 0x30, 0x8a,
3195 0x18, 0xc7, 0xea, 0x73, 0x41, 0x97, 0x5a, 0x47, 0xaa, 0x57, 0x22, 0xe0, 3135 0xf1, 0x21, 0xf3, 0x02, 0x7c, 0xc6, 0xb2, 0xe5, 0x2c, 0x0e, 0x23, 0x7c,
3196 0xee, 0x7e, 0xfd, 0x34, 0x9f, 0x39, 0xf9, 0x45, 0xaf, 0x82, 0xfa, 0x81, 3136 0xe3, 0xba, 0x97, 0xe3, 0x23, 0x20, 0xab, 0xc6, 0xeb, 0xe0, 0x9a, 0x98,
3197 0x41, 0xc8, 0x83, 0x70, 0xa7, 0xa1, 0x96, 0x77, 0x5a, 0x42, 0xbe, 0x83, 3137 0xf3, 0x22, 0xd7, 0xa1, 0x5c, 0x6f, 0xe6, 0xf5, 0xa9, 0x37, 0x35, 0x7b,
3198 0x32, 0x6c, 0x82, 0x70, 0xba,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 0x63, 0xff, 0xe5, 0x58, 0x2b, 0xf7, 0xd5, 0xee, 0x85, 0xec, 0xbc, 0x4a,
3235 0xde, 0xa8, 0x36, 0x5e, 0xd5, 0xc7, 0xb5, 0x91, 0x8d, 0x93, 0x69, 0x23, 3175 0xca, 0x07, 0xec, 0xdf, 0xd0, 0x7b, 0xbe, 0x90, 0xdf, 0xc7, 0xb4, 0x10,
3236 0x19, 0x73, 0x47, 0x29, 0xe1, 0x0c, 0x2c, 0x23, 0x1e, 0x09, 0xbe, 0xa3, 3176 0xf3, 0x8d, 0x7d, 0x8c, 0x43, 0x0d, 0x78, 0xc3, 0x98, 0x84, 0xfb, 0x90,
3237 0x21, 0x5e, 0x54, 0xf3, 0xb8, 0xa7, 0x14, 0x78, 0xec, 0x76, 0xf8, 0x2c, 3177 0x57, 0xf6, 0x21, 0x37, 0x97, 0x8a, 0xaa, 0x6d, 0x26, 0xc7, 0xb2, 0xf1,
3238 0x35, 0x8a, 0x8c, 0x0b, 0xaf, 0xff, 0x61, 0x7c, 0x7f, 0xc0, 0xba, 0x0b, 3178 0xba, 0x1a, 0xc7, 0x39, 0x21, 0x4e, 0xd4, 0x59, 0x41, 0x8b, 0x3a, 0xe4,
3239 0x01, 0xff, 0xfe, 0xf1, 0x09, 0x3e, 0xbe, 0x06, 0x3e, 0x66, 0xfb, 0x19, 3179 0x34, 0x7c, 0x9c, 0x81, 0x50, 0x5b, 0xac, 0x24, 0x9c, 0xcf, 0xf7, 0xd9,
3240 0xad, 0xbf, 0x34, 0x52, 0x5f, 0x4e, 0x31, 0x4f, 0x7c, 0x7e, 0x2f, 0xd5, 3180 0xba, 0xe2, 0xb9, 0x4d, 0xc8, 0xe0, 0x79, 0x83, 0xf4, 0x86, 0xcf, 0xf7,
3241 0xc8, 0x26, 0x72, 0xb7, 0xfb, 0xc8, 0x8b, 0xde, 0x44, 0xfc, 0x0e, 0x06, 3181 0x07, 0xd9, 0xdd, 0x46, 0x89, 0x86, 0x21, 0x0f, 0x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x36, 0x88, 0xcf, 3196 0x99, 0x3f, 0xf3, 0xfd, 0x08, 0x38, 0x38, 0xe3, 0xb6, 0x18, 0xdc, 0x16,
3257 0x44, 0x87, 0xb9, 0xe6, 0x87, 0x07, 0x65, 0x7e, 0xbb, 0x21, 0x7f, 0xeb, 3197 0xa9, 0x1c, 0xe7, 0x96, 0x23, 0x4a, 0xe3, 0x78, 0x19, 0x71, 0x1c, 0x19,
3258 0x98, 0xc7, 0x7c, 0x02, 0x0f, 0x8b, 0xa2, 0x76, 0xc3, 0x14, 0xf5, 0x9e, 3198 0x9c, 0xf3, 0x38, 0x86, 0x59, 0x8e, 0xe3, 0x98, 0xe5, 0x46, 0x32, 0x39,
3259 0x29, 0x96, 0x7a, 0x32, 0x54, 0x52, 0xc8, 0xd1, 0x14, 0xe7, 0x08, 0x3a, 3199 0xb4, 0x88, 0xe7, 0x28, 0x8b, 0xe7, 0x16, 0x78, 0x37, 0xca, 0xe2, 0xb9,
3260 0xd1, 0x73, 0x58, 0xcb, 0x2d, 0x53, 0xf8, 0xc8, 0xa3, 0xbe, 0xad, 0x58, 3200 0x85, 0x18, 0x5e, 0xc9, 0xe2, 0xb9, 0x95, 0xc5, 0x33, 0xdf, 0xdb, 0x19,
3261 0x62, 0x85, 0x76, 0xb1, 0xc7, 0x47, 0x51, 0x72, 0xa7, 0x35, 0x45, 0x6d, 3201 0x55, 0x95, 0x8b, 0x9d, 0x3a, 0x78, 0x6d, 0x45, 0xe9, 0x6c, 0x62, 0x9d,
3262 0x38, 0xf7, 0x23, 0xcc, 0xcd, 0x6b, 0x62, 0x2d, 0xf3, 0x79, 0xb6, 0x2c, 3202 0xb0, 0xb1, 0x93, 0xc7, 0xc5, 0x1d, 0xf7, 0x5b, 0x58, 0xcf, 0xad, 0xbc,
3263 0x9d, 0x83, 0x8f, 0xce, 0xf7, 0x77, 0x11, 0x43, 0xf9, 0x3c, 0xcb, 0x23, 3203 0x32, 0x8b, 0xbc, 0x72, 0x0e, 0x79, 0xa5, 0xdb, 0x77, 0xbf, 0x75, 0x56,
3264 0xe6, 0x59, 0x26, 0x5f, 0xf6, 0xef, 0x62, 0xff, 0xef, 0xf4, 0x80, 0x0f, 3204 0xe5, 0x95, 0x27, 0x8b, 0x79, 0x5e, 0xe9, 0x66, 0x79, 0xa5, 0xab, 0xf2,
3265 0x72, 0xc7, 0xb7, 0x87, 0x79, 0x1a, 0x63, 0x58, 0x06, 0x17, 0xd9, 0x3e, 3205 0xca, 0x13, 0x45, 0xce, 0x2b, 0x31, 0x05, 0xc5, 0xfe, 0xbc, 0x12, 0x6f,
3266 0x8a, 0x82, 0xc5, 0x38, 0x47, 0xc1, 0x5a, 0xe6, 0xca, 0xb7, 0x90, 0xa7, 3206 0xcb, 0x2b, 0xb9, 0x2c, 0xf7, 0xef, 0x94, 0x57, 0x72, 0x9f, 0x71, 0x6e,
3267 0xd7, 0x69, 0xa1, 0x5c, 0x8f, 0xdf, 0x11, 0x72, 0x12, 0xfe, 0x5d, 0xc0, 3207 0xb1, 0x72, 0x5e, 0xbd, 0x2d, 0x9f, 0xe4, 0x63, 0xd8, 0x56, 0xe6, 0x25,
3268 0x12, 0x4d, 0x7c, 0xd7, 0xd2, 0xef, 0x80, 0x73, 0xf8, 0x45, 0x1e, 0x83, 3208 0xe6, 0xe0, 0xb4, 0xae, 0xbf, 0x92, 0xe4, 0xb1, 0x74, 0x0c, 0xf3, 0xe0,
3269 0x73, 0x79, 0xd6, 0xe1, 0x7f, 0x01, 0x17, 0xc6, 0xf1, 0xb2, 0x84, 0x14, 3209 0xbd, 0xb3, 0x53, 0x2c, 0xd9, 0x59, 0x2c, 0x0d, 0xa7, 0x32, 0x9d, 0xfe,
3270 0x00, 0x00, 0x00 }; 3210 0x78, 0x3a, 0x56, 0xdc, 0x1e, 0x4f, 0xb9, 0x9e, 0x3c, 0x9e, 0x52, 0x9d,
3271static u32 bnx2_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 }; 3211 0x1f, 0x1a, 0x65, 0xae, 0x07, 0x70, 0x96, 0x76, 0xfd, 0x39, 0xf4, 0x5e,
3272static u32 bnx2_TPAT_b09FwRodata[(0x0/4) + 1] = { 0x0 }; 3212 0xe8, 0x4d, 0xa3, 0xae, 0x36, 0xe9, 0x6a, 0xce, 0x37, 0xea, 0xbe, 0x07,
3273static u32 bnx2_TPAT_b09FwBss[(0x250/4) + 1] = { 0x0 }; 3213 0x6d, 0x2f, 0xb7, 0xb5, 0xb8, 0xf5, 0xad, 0x8b, 0xda, 0xfa, 0x7d, 0xf0,
3274static u32 bnx2_TPAT_b09FwSbss[(0x34/4) + 1] = { 0x0 }; 3214 0xc8, 0x79, 0xf5, 0xfd, 0x33, 0x79, 0xb5, 0x84, 0x33, 0xb0, 0x97, 0x8f,
3215 0x7b, 0x1d, 0xf3, 0xb9, 0xe2, 0x2c, 0x9e, 0x5e, 0xee, 0xdd, 0x82, 0xf9,
3216 0x8a, 0xc7, 0x7d, 0xff, 0x44, 0x0e, 0x41, 0x5d, 0xbe, 0x35, 0x96, 0xcf,
3217 0x38, 0x1e, 0xd6, 0xec, 0xd0, 0xa5, 0x6d, 0xe7, 0x9c, 0xf4, 0x7c, 0x83,
3218 0x75, 0xa3, 0x3e, 0xe1, 0x3a, 0x25, 0xfc, 0x8a, 0x4e, 0x2f, 0xd1, 0xb7,
3219 0x7c, 0xee, 0xd3, 0x69, 0xf6, 0x31, 0x29, 0x5f, 0x40, 0xcd, 0xf2, 0xf4,
3220 0xb6, 0x9a, 0xa5, 0x48, 0xe3, 0x07, 0xfa, 0xcf, 0x87, 0x37, 0xe5, 0xf8,
3221 0xa4, 0x7b, 0x36, 0xa0, 0x40, 0x9b, 0x5d, 0xe7, 0x5a, 0x76, 0xab, 0x76,
3222 0x25, 0x1a, 0xbd, 0x21, 0xf5, 0x49, 0xce, 0x85, 0x57, 0x33, 0x5f, 0xe1,
3223 0xdb, 0x99, 0x1b, 0xe0, 0xd6, 0x48, 0xdd, 0xf1, 0x06, 0xeb, 0x3c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8, 0xae, 0x8b, 0x6b, 0x27, 0x89, 0xf8,
3239 0x4f, 0x9f, 0x63, 0x3e, 0x13, 0xcd, 0xb0, 0x0e, 0x3e, 0x1b, 0x71, 0xfc,
3240 0xfc, 0x1b, 0x2f, 0xf3, 0x0a, 0xbd, 0x68, 0x18, 0x00, 0x00, 0x00 };
3241
3242static const u32 bnx2_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 };
3243static const u32 bnx2_TPAT_b09FwRodata[(0x0/4) + 1] = { 0x0 };
3244static const u32 bnx2_TPAT_b09FwBss[(0x850/4) + 1] = { 0x0 };
3245static const u32 bnx2_TPAT_b09FwSbss[(0x2c/4) + 1] = { 0x0 };
3275 3246
3276static struct fw_info bnx2_tpat_fw_09 = { 3247static struct fw_info bnx2_tpat_fw_09 = {
3277 .ver_major = 0x1, 3248 .ver_major = 0x3,
3278 .ver_minor = 0x0, 3249 .ver_minor = 0x4,
3279 .ver_fix = 0x0, 3250 .ver_fix = 0x3,
3280 3251
3281 .start_addr = 0x08000860, 3252 .start_addr = 0x08000860,
3282 3253
3283 .text_addr = 0x08000800, 3254 .text_addr = 0x08000800,
3284 .text_len = 0x1480, 3255 .text_len = 0x1864,
3285 .text_index = 0x0, 3256 .text_index = 0x0,
3286 .gz_text = bnx2_TPAT_b09FwText, 3257 .gz_text = bnx2_TPAT_b09FwText,
3287 .gz_text_len = sizeof(bnx2_TPAT_b09FwText), 3258 .gz_text_len = sizeof(bnx2_TPAT_b09FwText),
3288 3259
3289 .data_addr = 0x08001ca0, 3260 .data_addr = 0x08002080,
3290 .data_len = 0x0, 3261 .data_len = 0x0,
3291 .data_index = 0x0, 3262 .data_index = 0x0,
3292 .data = bnx2_TPAT_b09FwData, 3263 .data = bnx2_TPAT_b09FwData,
3293 3264
3294 .sbss_addr = 0x08001ca0, 3265 .sbss_addr = 0x08002088,
3295 .sbss_len = 0x34, 3266 .sbss_len = 0x2c,
3296 .sbss_index = 0x0, 3267 .sbss_index = 0x0,
3297 .sbss = bnx2_TPAT_b09FwSbss, 3268 .sbss = bnx2_TPAT_b09FwSbss,
3298 3269
3299 .bss_addr = 0x08001ce0, 3270 .bss_addr = 0x080020c0,
3300 .bss_len = 0x250, 3271 .bss_len = 0x850,
3301 .bss_index = 0x0, 3272 .bss_index = 0x0,
3302 .bss = bnx2_TPAT_b09FwBss, 3273 .bss = bnx2_TPAT_b09FwBss,
3303 3274
@@ -3308,732 +3279,769 @@ static struct fw_info bnx2_tpat_fw_09 = {
3308}; 3279};
3309 3280
3310static u8 bnx2_TXP_b09FwText[] = { 3281static u8 bnx2_TXP_b09FwText[] = {
3311 0x1f, 0x8b, 0x08, 0x08, 0x51, 0xfe, 0x2f, 0x45, 0x00, 0x03, 0x74, 0x65, 3282 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, 0xcd, 0x7c,
3312 0x73, 0x74, 0x31, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0xcd, 0x7b, 0x7f, 0x70, 3283 0x6f, 0x70, 0x5b, 0xd7, 0x95, 0xdf, 0x79, 0xef, 0x81, 0x24, 0x48, 0xd1,
3313 0x1b, 0xe7, 0x99, 0xde, 0xbb, 0x0b, 0x80, 0x04, 0x29, 0x8a, 0x5a, 0x31, 3284 0xd4, 0x13, 0x17, 0x56, 0x60, 0x87, 0x71, 0x00, 0xf1, 0x81, 0x66, 0x42,
3314 0x30, 0x83, 0x38, 0xb4, 0x8d, 0x15, 0x17, 0x34, 0x6d, 0xf2, 0x1c, 0x58, 3285 0xae, 0x04, 0x2b, 0x4c, 0xc2, 0x6d, 0xd1, 0xf8, 0x05, 0x00, 0x29, 0x48,
3315 0xe5, 0xf9, 0xd8, 0x06, 0xb5, 0xd7, 0xc0, 0x92, 0xa2, 0x63, 0x26, 0x47, 3286 0xd1, 0x6c, 0x68, 0x95, 0x49, 0x94, 0x54, 0xe3, 0x62, 0x41, 0x52, 0xf1,
3316 0xbb, 0xcc, 0x9d, 0x92, 0x51, 0x7d, 0x28, 0x48, 0x29, 0x6e, 0xe3, 0xb4, 3287 0xb6, 0xce, 0x54, 0x9b, 0x78, 0x5a, 0x4d, 0xeb, 0xad, 0x11, 0x90, 0xfa,
3317 0xaa, 0xe3, 0x3f, 0x34, 0x4d, 0x5b, 0xc3, 0x00, 0x25, 0xcb, 0x2e, 0x44, 3288 0xe7, 0x85, 0x04, 0xda, 0x62, 0x44, 0x7f, 0xc8, 0x07, 0x18, 0x80, 0x24,
3318 0xd0, 0x16, 0x63, 0xa5, 0x33, 0x37, 0x53, 0x18, 0x80, 0x28, 0xe7, 0xba, 3289 0x6f, 0xf2, 0x44, 0x28, 0x9b, 0x7f, 0xfd, 0xd0, 0xac, 0x50, 0x4a, 0xd6,
3319 0x24, 0xdc, 0xe4, 0x2e, 0xe9, 0x1f, 0xc9, 0x99, 0xa5, 0x6c, 0xc5, 0x6d, 3290 0xba, 0x9b, 0xb4, 0xa3, 0xed, 0x66, 0x67, 0x3b, 0xd3, 0x2f, 0x1c, 0x49,
3320 0xae, 0x33, 0xbe, 0x3f, 0xda, 0xa6, 0x37, 0xd7, 0x19, 0x8d, 0xfc, 0x23, 3291 0xf6, 0x7a, 0x77, 0x67, 0x36, 0xda, 0x6e, 0xb6, 0xab, 0xb6, 0xb2, 0xd1,
3321 0xce, 0x8f, 0xb9, 0xb8, 0x69, 0x7a, 0x56, 0x5b, 0xd9, 0xe8, 0xf3, 0x7c, 3292 0xdf, 0xef, 0xbe, 0xf7, 0x28, 0x90, 0xa6, 0x6c, 0xcb, 0xb3, 0xed, 0x94,
3322 0xbb, 0x4b, 0x82, 0x32, 0x15, 0x5b, 0xd7, 0x76, 0xa6, 0x9c, 0xc1, 0x10, 3293 0x33, 0x18, 0xe0, 0xdd, 0x77, 0xdf, 0xb9, 0xe7, 0x9e, 0x73, 0xee, 0x39,
3323 0xfb, 0xed, 0xb7, 0xdf, 0xf7, 0xfe, 0x7e, 0xdf, 0xe7, 0xfd, 0x16, 0x71, 3294 0xe7, 0x77, 0xee, 0x7d, 0x0c, 0x8b, 0x74, 0x89, 0xf7, 0xf7, 0x00, 0x3e,
3324 0x91, 0x6e, 0xf1, 0xff, 0x76, 0xe3, 0x93, 0x38, 0x7a, 0xec, 0xb1, 0x3b, 3295 0x91, 0x43, 0x87, 0x9f, 0xd9, 0x3e, 0xb2, 0xfd, 0x13, 0xf8, 0xf9, 0x09,
3325 0xc6, 0xef, 0xd8, 0x2f, 0x72, 0xe7, 0x9d, 0xb2, 0x2b, 0xaa, 0xf3, 0xe6, 3296 0x31, 0x02, 0x06, 0x6f, 0xbe, 0x69, 0x88, 0x64, 0xff, 0x42, 0x3e, 0xf0,
3326 0xdb, 0x21, 0x91, 0xdc, 0x4f, 0xe5, 0xaf, 0xfc, 0x87, 0xc7, 0x8d, 0x60, 3297 0x1f, 0x1e, 0x37, 0x7d, 0xfa, 0xfc, 0x48, 0x50, 0x4f, 0x4c, 0xec, 0x4a,
3327 0x7d, 0x7e, 0x24, 0xaa, 0xa7, 0x5f, 0xcc, 0x64, 0x2c, 0x89, 0x86, 0xd2, 3298 0x5a, 0x12, 0x34, 0x12, 0xb2, 0x6f, 0xca, 0x12, 0xb1, 0x9d, 0xa1, 0x48,
3328 0x33, 0x9f, 0x9d, 0xb3, 0x44, 0x6c, 0x77, 0x24, 0x91, 0x95, 0xf7, 0x5a, 3299 0x4a, 0xde, 0x6a, 0xe6, 0x43, 0x01, 0x61, 0xfb, 0x47, 0x12, 0x77, 0x9e,
3329 0x85, 0x58, 0x58, 0x38, 0x7e, 0x53, 0xfa, 0xca, 0xe3, 0xdf, 0xff, 0x2d, 3300 0xfb, 0xc9, 0xa7, 0xa3, 0xb7, 0xca, 0x86, 0x04, 0xcd, 0x44, 0x56, 0xcc,
3330 0xf3, 0x9d, 0x6a, 0x48, 0xa2, 0x46, 0x3a, 0x27, 0xc6, 0x90, 0x44, 0x07, 3301 0x01, 0x09, 0xf6, 0xe1, 0x99, 0x6f, 0x3f, 0x6a, 0x18, 0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bd, 0xd9, 0x66, 0x4d, 0x5b, 0x37, 0x34, 0x29, 0xfe, 0x86, 3309 0xd1, 0x1b, 0xa6, 0x26, 0x85, 0x5f, 0x15, 0x33, 0x9c, 0xb8, 0xd5, 0x7c,
3339 0x18, 0xbd, 0xe9, 0xcb, 0xad, 0x4f, 0x58, 0x86, 0xec, 0xb5, 0x64, 0xcf, 3310 0xc8, 0xd2, 0xc4, 0xb4, 0x6e, 0x37, 0xb7, 0x58, 0x41, 0xc9, 0x9d, 0xee,
3340 0x1e, 0x4b, 0x9e, 0x88, 0xa7, 0xa3, 0x92, 0x3f, 0xdd, 0x25, 0xb6, 0xe2, 3311 0x14, 0x5b, 0xcd, 0xc9, 0x94, 0xdc, 0xe2, 0x90, 0xb9, 0x2c, 0x6d, 0x62,
3341 0xc9, 0x90, 0xfc, 0x99, 0x11, 0x63, 0x43, 0x22, 0x62, 0xc7, 0x82, 0xeb, 3312 0x87, 0xfc, 0xeb, 0x66, 0x33, 0x19, 0xff, 0x32, 0xe5, 0x8a, 0x71, 0xa4,
3342 0x56, 0x2b, 0x93, 0xfa, 0x02, 0xe5, 0x8a, 0xbd, 0xa4, 0x77, 0xb2, 0x29, 3313 0x67, 0xbc, 0x2e, 0x92, 0x2c, 0x05, 0x25, 0x19, 0x7f, 0xab, 0xe9, 0x3e,
3343 0x92, 0xa9, 0x44, 0x25, 0x93, 0x7a, 0xaf, 0xe5, 0x3d, 0x13, 0xc5, 0xbe, 3314 0x13, 0xc4, 0x98, 0x81, 0x9e, 0xb1, 0x52, 0xb3, 0x99, 0x8e, 0x83, 0x7e,
3344 0xe1, 0xde, 0x89, 0x4a, 0xab, 0xe5, 0xa4, 0xb0, 0x47, 0x2a, 0x78, 0x36, 3315 0xdc, 0x7f, 0xb6, 0x4d, 0xca, 0x21, 0xbb, 0x3c, 0x1b, 0xff, 0x6f, 0xba,
3345 0x22, 0xd5, 0x98, 0x5d, 0x2d, 0xa5, 0x4c, 0xdd, 0xd3, 0x09, 0x79, 0xe4, 3316 0xab, 0x13, 0xce, 0x91, 0xd7, 0xb6, 0xe8, 0x56, 0x5e, 0x72, 0x21, 0x29,
3346 0xb5, 0x2d, 0xba, 0xf5, 0xdb, 0x92, 0x8f, 0x49, 0xb5, 0x98, 0xba, 0x4b, 3317 0x17, 0xe2, 0x9f, 0x92, 0x13, 0xf1, 0x30, 0xe6, 0x17, 0x94, 0x63, 0x71,
3347 0x9e, 0x4e, 0x19, 0x72, 0x12, 0xeb, 0x3d, 0x95, 0x82, 0x1c, 0xad, 0x63, 3318 0xc8, 0xd1, 0x3a, 0xac, 0x25, 0xeb, 0xd1, 0x48, 0x56, 0x9e, 0x97, 0xe4,
3348 0x5a, 0xa6, 0x69, 0xc6, 0x45, 0x7b, 0x5a, 0x32, 0x67, 0x06, 0x8d, 0xac, 3319 0x62, 0xbf, 0x99, 0x16, 0x8c, 0x6d, 0x35, 0x3f, 0x9a, 0x8c, 0x63, 0xbc,
3349 0x60, 0x6f, 0xab, 0x75, 0x4b, 0x26, 0x85, 0xfd, 0x46, 0xff, 0x67, 0xcb, 3320 0xe1, 0xff, 0xd5, 0xb4, 0x43, 0xd1, 0x6c, 0x59, 0x06, 0xa5, 0x50, 0xea,
3350 0x8e, 0x99, 0xb9, 0xaa, 0x0c, 0x48, 0xb1, 0x32, 0x98, 0xfa, 0x13, 0xd1, 3321 0x8f, 0xff, 0x4c, 0x34, 0x09, 0x5a, 0x62, 0x4f, 0x59, 0x26, 0xe4, 0x16,
3351 0xa4, 0xd3, 0xa2, 0x7c, 0x5a, 0x72, 0x3f, 0xf6, 0xcd, 0x58, 0x18, 0x6f, 3322 0x1d, 0x4c, 0x19, 0x4d, 0xd9, 0x83, 0xf1, 0x93, 0x16, 0xee, 0xd7, 0x65,
3352 0x8a, 0xad, 0x27, 0x23, 0xf2, 0x0f, 0x0c, 0x33, 0x91, 0x09, 0xf5, 0x4b, 3323 0xb3, 0x6e, 0xb5, 0x4b, 0xc1, 0x94, 0x50, 0x97, 0x3c, 0x22, 0x85, 0xd3,
3353 0xf1, 0x74, 0x27, 0xe8, 0xb4, 0xfb, 0x74, 0xcc, 0x3d, 0x30, 0x26, 0xb1, 3324 0x68, 0x8f, 0xdb, 0xbd, 0x3a, 0x9e, 0xc9, 0x8c, 0xb0, 0x4d, 0x34, 0x23,
3354 0x5d, 0x22, 0x5a, 0x28, 0x9d, 0xc4, 0xba, 0x22, 0x45, 0x77, 0x00, 0xcf, 3325 0x11, 0x33, 0x53, 0xe0, 0xa8, 0xe2, 0x0c, 0x62, 0xfc, 0x98, 0xdd, 0xa9,
3355 0x26, 0xc7, 0x7f, 0x2a, 0x7b, 0x24, 0xb1, 0x37, 0x2c, 0x25, 0xb7, 0x1b, 3326 0x99, 0xb2, 0x62, 0x06, 0xa4, 0xea, 0xc4, 0xec, 0xb0, 0xd6, 0x2e, 0xc7,
3356 0x72, 0x34, 0xa0, 0x83, 0xe4, 0xf8, 0x5f, 0x40, 0x29, 0xba, 0x95, 0x8c, 3327 0x62, 0x5d, 0x90, 0x69, 0x18, 0xb4, 0xe5, 0x9b, 0x7a, 0x22, 0x16, 0xce,
3357 0x1f, 0x93, 0x9c, 0x96, 0x6d, 0x76, 0x48, 0x29, 0x19, 0x95, 0x05, 0xd0, 3328 0x41, 0x51, 0x3a, 0x64, 0x35, 0x07, 0x7e, 0xe6, 0xe2, 0x59, 0x2d, 0x55,
3358 0xb1, 0x90, 0xfa, 0xa2, 0x96, 0x39, 0x77, 0x50, 0xcb, 0x9e, 0xc3, 0xbc, 3329 0xff, 0x8a, 0x96, 0x3c, 0xbf, 0x5f, 0xdb, 0x75, 0x1e, 0x7d, 0xea, 0xe7,
3359 0x66, 0xdd, 0xb7, 0x35, 0x03, 0xeb, 0xe8, 0x52, 0x4c, 0x1e, 0xc4, 0xbd, 3330 0x3c, 0xbb, 0x0b, 0x83, 0x37, 0x1d, 0xcf, 0xb2, 0x1d, 0x3c, 0x2b, 0xde,
3360 0xa8, 0xcc, 0x61, 0xde, 0x1c, 0x78, 0x2a, 0x35, 0xf7, 0xc8, 0xfa, 0x6c, 3331 0xd1, 0x06, 0x5d, 0x36, 0x26, 0x43, 0x3d, 0x49, 0xa5, 0x4b, 0xf2, 0xa6,
3361 0xac, 0x37, 0x03, 0x1d, 0x16, 0x71, 0xff, 0xb7, 0x67, 0x34, 0x31, 0x2c, 3332 0x4b, 0x6e, 0x42, 0x93, 0x5e, 0xcb, 0x96, 0xe0, 0x27, 0xa1, 0xcf, 0x45,
3362 0x5b, 0x7e, 0x3c, 0x06, 0x1d, 0x9e, 0x81, 0xfe, 0xce, 0xc4, 0xe5, 0x78, 3333 0xe8, 0x72, 0x31, 0x22, 0x47, 0x4a, 0x12, 0xd2, 0x85, 0x63, 0x65, 0xf5,
3363 0x45, 0x62, 0xba, 0x24, 0xe3, 0x79, 0x79, 0x41, 0xea, 0x2e, 0xf5, 0x0f, 3334 0xaa, 0x43, 0x7b, 0x80, 0x6e, 0xa1, 0xfb, 0x82, 0xc3, 0x67, 0xa1, 0xc3,
3364 0x7d, 0x42, 0xdf, 0x45, 0x97, 0xcf, 0x41, 0x6f, 0x15, 0x07, 0xf2, 0x98, 3335 0x52, 0x1a, 0xf2, 0xc9, 0x60, 0xec, 0x7d, 0xda, 0x9e, 0xea, 0xa4, 0x96,
3365 0x02, 0x0d, 0x0f, 0x6a, 0xf7, 0xd7, 0x67, 0xb5, 0x03, 0xcd, 0x1f, 0x6b, 3336 0x81, 0x9d, 0x14, 0x4e, 0x0f, 0x41, 0x77, 0xd1, 0xc8, 0x8a, 0x6c, 0x96,
3366 0xd2, 0x7d, 0x4c, 0xfb, 0x5c, 0xf3, 0x88, 0xe6, 0xcb, 0x1e, 0xba, 0x8b, 3337 0x82, 0x65, 0x45, 0xbe, 0x2c, 0xdd, 0x72, 0x6c, 0xd1, 0x92, 0x23, 0x8b,
3367 0x8a, 0x3d, 0x13, 0x95, 0x95, 0xa6, 0xa7, 0xbb, 0x1a, 0xec, 0xd3, 0x36, 3338 0x21, 0xc9, 0x9b, 0x51, 0xb3, 0x26, 0x7d, 0xd9, 0x4d, 0x89, 0x1e, 0x79,
3368 0x6c, 0xe8, 0xe1, 0x6f, 0x6f, 0xce, 0x59, 0x69, 0xc6, 0x64, 0x01, 0xb4, 3339 0xfe, 0x74, 0x34, 0x53, 0x96, 0x7e, 0xfb, 0x75, 0xdc, 0xcf, 0x9d, 0xa4,
3369 0x1d, 0x6f, 0x72, 0xfe, 0xef, 0x41, 0x3f, 0x51, 0x71, 0x6f, 0xed, 0x91, 3340 0x4e, 0x25, 0x9f, 0x8a, 0x1b, 0x92, 0x85, 0x4d, 0x18, 0xd6, 0x1f, 0x81,
3370 0x1c, 0xc6, 0x8b, 0x67, 0xc4, 0xce, 0xa4, 0x74, 0x3c, 0xd3, 0x2b, 0x21, 3341 0xff, 0xe6, 0x73, 0xc9, 0x78, 0x34, 0x2c, 0xa2, 0x4b, 0xea, 0x0b, 0xfd,
3371 0xab, 0x1f, 0x9f, 0x6e, 0x99, 0xab, 0x77, 0xda, 0x21, 0x2b, 0x26, 0x73, 3342 0xe6, 0x6e, 0x89, 0x9a, 0x19, 0xca, 0x3f, 0x3e, 0x04, 0x3d, 0xfc, 0x77,
3372 0x4d, 0xca, 0x10, 0xff, 0x2b, 0x81, 0x1c, 0x49, 0x2b, 0xc7, 0xf9, 0x1c, 3343 0xca, 0x1e, 0xb4, 0xa8, 0xe3, 0xa1, 0xf0, 0x31, 0xe8, 0x32, 0xab, 0x74,
3373 0xc7, 0x0d, 0x8c, 0xb7, 0x8f, 0xd1, 0x2e, 0x7a, 0x41, 0x8f, 0x39, 0x2c, 3344 0xdc, 0x83, 0xf1, 0x03, 0x9e, 0xed, 0xf4, 0x48, 0xbe, 0x7a, 0xc3, 0x93,
3374 0x18, 0xcb, 0x57, 0x92, 0xc6, 0xe7, 0xf8, 0xbf, 0x49, 0xd9, 0x06, 0x32, 3345 0x43, 0x8f, 0xcc, 0x57, 0xbb, 0xa5, 0x00, 0x1d, 0x16, 0xc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 0x56, 0x42, 3360 0x00, 0xbe, 0xa6, 0xb1, 0xe0, 0x30, 0x0f, 0x8f, 0xc7, 0x06, 0xee, 0xf7,
3390 0x92, 0x35, 0xb8, 0xc6, 0x9f, 0x71, 0x3c, 0xe7, 0xad, 0x05, 0xbb, 0x3d, 3361 0xca, 0xd4, 0x79, 0xf6, 0xe5, 0x18, 0x85, 0x2d, 0xba, 0x24, 0xc0, 0x1b,
3391 0x35, 0x68, 0xdc, 0x07, 0x5f, 0xa2, 0x8f, 0x15, 0x57, 0x29, 0x63, 0xac, 3362 0x3e, 0x56, 0x14, 0xf7, 0x3b, 0x31, 0x4e, 0x37, 0x6c, 0x27, 0x83, 0x31,
3392 0x33, 0x46, 0x19, 0x1b, 0x8a, 0xc6, 0xcc, 0x19, 0xda, 0x91, 0x0c, 0x84, 3363 0x9b, 0x8f, 0x27, 0xe3, 0xbd, 0x92, 0x5d, 0xed, 0x2b, 0xb0, 0x3b, 0xf6,
3393 0x84, 0x76, 0x8e, 0x98, 0x01, 0xbb, 0x2a, 0xf9, 0x76, 0x95, 0x77, 0xa9, 3364 0x1f, 0x5c, 0xd7, 0x17, 0xf2, 0x3d, 0x0f, 0x9a, 0x8b, 0x9d, 0x90, 0x21,
3394 0xff, 0xbb, 0x7d, 0xff, 0xd4, 0x65, 0x28, 0x49, 0x7b, 0x7f, 0x5a, 0xb2, 3365 0xdb, 0x75, 0xf0, 0xdc, 0x01, 0x1e, 0x82, 0x98, 0x4f, 0x3f, 0xd6, 0x43,
3395 0xf0, 0xf1, 0x39, 0xec, 0x54, 0x07, 0x4f, 0xb5, 0xca, 0x20, 0x64, 0x15, 3366 0x07, 0xe8, 0x6f, 0xc2, 0x9c, 0x3a, 0x65, 0xfa, 0x74, 0x2f, 0x74, 0x61,
3396 0xf8, 0x1d, 0xf4, 0x3b, 0xfa, 0x6e, 0x2b, 0x88, 0x05, 0xc5, 0x0a, 0x7d, 3367 0xa2, 0x6f, 0x50, 0x9e, 0x2f, 0x45, 0x61, 0x03, 0xec, 0x0f, 0x1d, 0x2c,
3397 0xa6, 0x68, 0xe8, 0x52, 0xc0, 0x07, 0x76, 0x63, 0x99, 0xc3, 0x99, 0x90, 3368 0x46, 0xc3, 0x55, 0xb1, 0x65, 0x2e, 0xde, 0x01, 0xfb, 0x6a, 0x36, 0x67,
3398 0x39, 0x93, 0x03, 0x6d, 0xb0, 0x7b, 0xc9, 0xdc, 0x49, 0x7b, 0xc6, 0x9c, 3369 0x60, 0x1f, 0xdf, 0x51, 0xfe, 0x62, 0xc8, 0x1c, 0xd3, 0x24, 0xdf, 0x91,
3399 0xa6, 0xec, 0x0f, 0xfc, 0xac, 0xe6, 0x52, 0x4f, 0xdd, 0xd8, 0x37, 0xa0, 3370 0x38, 0x0c, 0x7e, 0xa2, 0x4f, 0x89, 0xf0, 0x7a, 0x87, 0xc6, 0x35, 0x0b,
3400 0x29, 0x8c, 0x31, 0xae, 0x13, 0x85, 0xcd, 0x07, 0x36, 0x43, 0xfb, 0x33, 3371 0x39, 0x72, 0x6c, 0xf8, 0xa4, 0xad, 0x90, 0x21, 0xfd, 0x56, 0x1f, 0xec,
3401 0xed, 0x75, 0xe9, 0x90, 0xe1, 0x24, 0x62, 0xd9, 0x19, 0x1d, 0xfa, 0x1b, 3372 0x39, 0xac, 0xfc, 0xc9, 0xd8, 0x86, 0xfe, 0x24, 0x3a, 0x51, 0xc6, 0x58,
3402 0x40, 0x4c, 0x09, 0xcb, 0x11, 0xc8, 0xea, 0x4b, 0x15, 0xd2, 0xe7, 0xc0, 3373 0x85, 0xf3, 0x01, 0xfa, 0xb0, 0x51, 0x2c, 0x57, 0x79, 0x00, 0x6b, 0x6f,
3403 0xef, 0x10, 0xdb, 0xce, 0x4c, 0xc2, 0xcf, 0xa6, 0xb4, 0x09, 0xf8, 0xc4, 3374 0x56, 0xd9, 0xc7, 0x09, 0xce, 0xb7, 0xf9, 0xf9, 0x38, 0xf9, 0xe2, 0x7c,
3404 0x67, 0xea, 0xa4, 0x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0x8e, 0x77, 0x87, 0x3d, 0x1e, 0xc6, 0xb5, 0x99, 0x66, 0xc1, 0x1f, 3426 0xa1, 0x8c, 0xd8, 0x9f, 0x3e, 0x77, 0x5a, 0xaf, 0xac, 0xca, 0x65, 0x2f,
3456 0xbb, 0x0c, 0xb9, 0xb7, 0x5a, 0x0b, 0xc8, 0x3d, 0x45, 0xeb, 0x32, 0xea, 3427 0x78, 0xe8, 0xe0, 0xdc, 0xbd, 0x79, 0x90, 0x7e, 0xaf, 0x47, 0xff, 0x6f,
3457 0x24, 0xc6, 0x9f, 0xeb, 0x89, 0x37, 0xdb, 0x62, 0x8d, 0x91, 0x09, 0x51, 3428 0xd1, 0x87, 0xfe, 0x75, 0xa3, 0x71, 0x39, 0x26, 0x73, 0xc6, 0x77, 0x9b,
3458 0x9f, 0x51, 0xf1, 0xd6, 0xe4, 0xfd, 0x4e, 0xc4, 0x9d, 0xcb, 0xf8, 0xce, 3429 0x0f, 0x72, 0x66, 0xac, 0x81, 0xef, 0x21, 0x96, 0x5f, 0x44, 0x2c, 0x59,
3459 0x3c, 0x17, 0xc4, 0x3c, 0xce, 0xe1, 0xf3, 0x6f, 0x5f, 0x43, 0xe7, 0x31, 3430 0x31, 0x22, 0xf2, 0x93, 0x47, 0xaf, 0x21, 0x97, 0x96, 0xfc, 0xc3, 0x89,
3460 0xe8, 0xfc, 0xff, 0x1b, 0xdd, 0xe2, 0x4f, 0xe9, 0x56, 0xc5, 0x9d, 0x97, 3431 0x66, 0x24, 0x90, 0x78, 0xab, 0x39, 0x37, 0x82, 0x18, 0x97, 0x88, 0x86,
3461 0xb6, 0xd9, 0x2c, 0xe9, 0xef, 0xf6, 0x69, 0x96, 0x68, 0x38, 0x6d, 0x38, 3432 0x93, 0xc6, 0xb0, 0x5c, 0xaa, 0x0f, 0xca, 0x8f, 0xea, 0x96, 0xfc, 0xb0,
3462 0x0b, 0xd6, 0x8d, 0x12, 0x41, 0x0d, 0x4b, 0x9b, 0x2d, 0x35, 0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 0x7d, 0x59, 0x3d, 0x11, 0x94, 0x74, 0x91,
3470 0x42, 0x97, 0xee, 0x8b, 0x4e, 0x1e, 0x9f, 0x39, 0xd2, 0x54, 0xe1, 0x7d, 3441 0x6b, 0x2a, 0x24, 0xb3, 0x55, 0x28, 0xff, 0x3c, 0xd7, 0x85, 0x3c, 0x3b,
3471 0xe3, 0xe6, 0x8c, 0x15, 0x56, 0xf9, 0xf6, 0x4b, 0x98, 0x73, 0x04, 0x73, 3442 0x17, 0xef, 0x86, 0xed, 0xff, 0x9a, 0xe1, 0xae, 0x03, 0x18, 0x50, 0x75,
3472 0x0e, 0xbb, 0x01, 0x3f, 0xea, 0xbe, 0x93, 0xc5, 0xfd, 0xc3, 0x65, 0xc3, 3443 0x50, 0xf2, 0xe0, 0x37, 0x5f, 0x7f, 0xcb, 0xc3, 0x0e, 0xf0, 0x2a, 0x5b,
3473 0x71, 0xca, 0xe6, 0x38, 0x6a, 0x8e, 0xf8, 0x71, 0xe4, 0xe3, 0x1c, 0x72, 3444 0x21, 0xf8, 0xc4, 0x70, 0xda, 0x76, 0xfe, 0x30, 0x88, 0xb6, 0xe0, 0x56,
3474 0xa0, 0x2d, 0xe6, 0x70, 0x41, 0xd2, 0x5d, 0x93, 0xa8, 0xe5, 0x56, 0x90, 3445 0xeb, 0xce, 0x26, 0x7c, 0x3f, 0x10, 0xb2, 0x88, 0x4d, 0x24, 0xf3, 0x05,
3475 0x4f, 0x50, 0x87, 0xa4, 0xaa, 0x32, 0xd8, 0x95, 0x39, 0xad, 0xc3, 0x3e, 3446 0x7c, 0xff, 0x4a, 0x42, 0x36, 0xf7, 0xe2, 0x7b, 0x4b, 0x02, 0x26, 0x99,
3476 0xef, 0x80, 0xbd, 0x1a, 0x8e, 0x9e, 0x44, 0x5c, 0x47, 0xdc, 0x5c, 0xa8, 3447 0x60, 0xcc, 0xd5, 0x5a, 0x62, 0xae, 0x68, 0x69, 0xc8, 0x6e, 0x0e, 0x73,
3477 0x58, 0x5a,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93, 0xef, 0x88, 0x07, 0x37, 0x8c, 0xd6, 0x78, 0x60, 0x20,
3492 0x60, 0x89, 0x66, 0xc6, 0x7a, 0xb0, 0xfe, 0xf7, 0x30, 0x8e, 0x09, 0xc9, 3463 0x1e, 0xec, 0x7a, 0x97, 0x78, 0x70, 0xe2, 0x1d, 0xf1, 0x40, 0x83, 0x6c,
3493 0xcd, 0xf1, 0x27, 0xbc, 0xf1, 0xb7, 0x41, 0x0b, 0x9f, 0x63, 0x8d, 0x22, 3464 0x38, 0xbf, 0xbf, 0x35, 0xfc, 0x78, 0x50, 0x58, 0x13, 0x0f, 0x7c, 0x5d,
3494 0xd1, 0xb9, 0x31, 0x03, 0x34, 0x70, 0x6e, 0x4c, 0xcd, 0x75, 0xce, 0xd0, 3465 0x59, 0x0a, 0x0b, 0xdc, 0xd5, 0x5b, 0x97, 0xa7, 0x2b, 0x09, 0x06, 0x12,
3495 0x06, 0x0c, 0xa7, 0x66, 0xdd, 0x2c, 0xd9, 0xe5, 0x7e, 0x99, 0x5c, 0xee, 3466 0x8d, 0xcc, 0x9c, 0xf5, 0xb0, 0xb4, 0xc1, 0xe7, 0x5e, 0xaa, 0x8f, 0x40,
3496 0x93, 0x03, 0xcb, 0xe6, 0x4c, 0x95, 0xd8, 0x0f, 0x3c, 0x0b, 0xea, 0x30, 3467 0x67, 0x97, 0x30, 0xf7, 0x68, 0x9c, 0x89, 0x65, 0x5b, 0x82, 0xeb, 0xe1,
3497 0x7d, 0x55, 0x20, 0x01, 0x33, 0x7e, 0x44, 0x06, 0xe3, 0x5f, 0x92, 0x5f, 3468 0xcd, 0x08, 0x30, 0xe2, 0x6e, 0xe0, 0xbe, 0xdd, 0x67, 0xd5, 0xfa, 0x78,
3498 0xb6, 0x90, 0xef, 0x91, 0xeb, 0x7b, 0x24, 0xac, 0xd6, 0x89, 0x07, 0x7b, 3469 0x33, 0xea, 0x61, 0xf7, 0x6d, 0xc0, 0xee, 0x78, 0x3e, 0x00, 0x4c, 0xc8,
3499 0xd2, 0x46, 0xb7, 0xed, 0xeb, 0x9c, 0xb9, 0xd6, 0xba, 0x70, 0xfe, 0xd5, 3470 0xf6, 0x2b, 0x66, 0x12, 0x7a, 0xaa, 0x3a, 0xf6, 0xee, 0x02, 0x3e, 0x73,
3500 0xf8, 0x55, 0xeb, 0xfe, 0x85, 0xbf, 0xae, 0x81, 0x75, 0x07, 0xb0, 0x26, 3471 0xaa, 0xef, 0xad, 0x08, 0xfb, 0x76, 0x24, 0x12, 0xd1, 0x3f, 0xc3, 0x77,
3501 0x79, 0x34, 0xbb, 0x26, 0x4e, 0x8b, 0xdd, 0x09, 0xfa, 0x9c, 0xe4, 0x8d, 3472 0x7b, 0x22, 0xbc, 0xed, 0xaa, 0x45, 0xba, 0x87, 0xa2, 0x67, 0x15, 0x8d,
3502 0xc0, 0x86, 0xfd, 0x72, 0x62, 0x99, 0xf1, 0x42, 0xfa, 0xf1, 0x19, 0x8d, 3473 0x80, 0x14, 0xd4, 0xb3, 0x91, 0x6d, 0x7c, 0xf6, 0x18, 0x62, 0xf6, 0x51,
3503 0x48, 0x72, 0xf8, 0x1c, 0xea, 0xae, 0x09, 0xb5, 0x86, 0x57, 0x93, 0xe9, 3474 0xc7, 0x94, 0x23, 0x4e, 0x76, 0x77, 0x0e, 0x1f, 0x62, 0xd5, 0x4b, 0x25,
3504 0xab, 0x29, 0xd4, 0xc4, 0x3f, 0x05, 0x3d, 0xac, 0x15, 0xc8, 0x73, 0x18, 3475 0xde, 0x1f, 0xc5, 0xfd, 0x80, 0x30, 0x97, 0xfc, 0x2a, 0xfa, 0x1c, 0x44,
3505 0xfc, 0xa6, 0x50, 0x8b, 0x11, 0x47, 0xb5, 0x1e, 0xcf, 0xa4, 0xf0, 0xfd, 3476 0x9f, 0x19, 0xc7, 0xd7, 0x05, 0xef, 0x37, 0x32, 0x29, 0xdc, 0x9f, 0x29,
3506 0x5c, 0xa2, 0x2b, 0x8b, 0x98, 0x08, 0xff, 0xbe, 0x39, 0xa4, 0x72, 0x18, 3477 0x36, 0x32, 0xe9, 0x22, 0xf3, 0xd6, 0xa1, 0xf0, 0x11, 0xc8, 0x33, 0x8b,
3507 0xf5, 0x32, 0xda, 0x45, 0x3c, 0x83, 0xe7, 0xa1, 0x27, 0xca, 0x68, 0xbc, 3478 0x5c, 0xcd, 0x96, 0xe8, 0x60, 0x5e, 0x9e, 0xee, 0x1c, 0x07, 0x4e, 0x3a,
3508 0xcb, 0xa9, 0x50, 0x46, 0x02, 0x7a, 0x2c, 0xd8, 0x64, 0x58, 0x61, 0x29, 3479 0x87, 0x1c, 0xc2, 0x9e, 0x8c, 0xc6, 0xcb, 0xf2, 0xe1, 0xce, 0xe4, 0x69,
3509 0x7d, 0xd5, 0xc6, 0xbc, 0xb7, 0x42, 0xac, 0x77, 0x33, 0x16, 0xbf, 0x23, 3480 0xe4, 0x0b, 0xf1, 0xed, 0x90, 0x61, 0x23, 0xa3, 0xc7, 0x04, 0xb6, 0x1e,
3510 0xe6, 0xac, 0x4e, 0x61, 0x2e, 0xbf, 0xdf, 0x85, 0x75, 0x07, 0x87, 0x8b, 3481 0x87, 0x5f, 0x1e, 0xd1, 0x53, 0xc5, 0x7e, 0x73, 0x56, 0x1e, 0x95, 0x86,
3511 0xd2, 0x31, 0x7c, 0x18, 0xf1, 0x4e, 0x1f, 0x1b, 0x01, 0x6d, 0xb4, 0xf3, 3482 0x19, 0x0d, 0x8f, 0xcb, 0x26, 0x49, 0x05, 0xd0, 0x6f, 0xf0, 0x43, 0x92,
3512 0x16, 0xb0, 0xc0, 0x6f, 0x81, 0x1f, 0xf8, 0x46, 0xd2, 0x92, 0xf9, 0x25, 3483 0x0d, 0x53, 0xd6, 0x0f, 0xc2, 0xdf, 0x6b, 0xd2, 0x61, 0xb5, 0xc6, 0x9e,
3513 0xca, 0x55, 0x3e, 0x0e, 0x1e, 0xc0, 0x7f, 0x12, 0x71, 0x8d, 0x3c, 0x70, 3484 0x5b, 0x10, 0x6f, 0x2e, 0x40, 0x9f, 0xdd, 0x61, 0x75, 0x7a, 0x3a, 0xd9,
3514 0x6f, 0x41, 0x8e, 0xbe, 0x5b, 0xf2, 0x4b, 0x51, 0x55, 0xeb, 0xdb, 0x06, 3485 0x24, 0xcb, 0xef, 0xe8, 0x77, 0xbb, 0xa5, 0x5f, 0x6b, 0xfb, 0xdb, 0x68,
3515 0xf7, 0xd7, 0x34, 0x3d, 0xdd, 0x0d, 0x1d, 0x93, 0xb7, 0x1c, 0x68, 0x7b, 3486 0xdf, 0x84, 0x9c, 0xb3, 0x91, 0x09, 0xc4, 0x20, 0x7f, 0xcc, 0xa1, 0x0d,
3516 0x0c, 0x79, 0x80, 0xbc, 0x91, 0x2f, 0xfa, 0xca, 0x28, 0xfc, 0x84, 0xf4, 3487 0x76, 0x72, 0x15, 0xf3, 0x61, 0x1c, 0x2c, 0x94, 0x99, 0xf7, 0x18, 0x52,
3517 0xfb, 0xb6, 0xa7, 0xad, 0x23, 0xa6, 0xa8, 0x38, 0x98, 0xca, 0x20, 0xb0, 3488 0x36, 0x71, 0xcf, 0x69, 0x36, 0x2b, 0x16, 0xf8, 0xbd, 0x40, 0x9e, 0x83,
3518 0xbd, 0xd4, 0x1c, 0x97, 0x3f, 0x6e, 0x8e, 0xc9, 0x77, 0x9b, 0x29, 0xe4, 3489 0x32, 0xee, 0x0c, 0x88, 0x5d, 0xa3, 0x1c, 0xa2, 0xf0, 0x4a, 0x0f, 0x77,
3519 0xc0, 0x51, 0xe4, 0xc0, 0x61, 0xe4, 0x40, 0x0b, 0x39, 0x30, 0x81, 0x1c, 3490 0xa5, 0x16, 0xa3, 0x76, 0x1e, 0x14, 0x8d, 0x0b, 0x7d, 0x5d, 0x49, 0xe4,
3520 0x38, 0x80, 0x1c, 0x18, 0x47, 0x9c, 0x14, 0x39, 0xa1, 0xf2, 0x6d, 0x2c, 3491 0x39, 0xfa, 0x85, 0x48, 0x57, 0x0a, 0x36, 0x6b, 0x5c, 0x78, 0xa8, 0x2b,
3521 0x0a, 0xcc, 0x1d, 0xb5, 0x9b, 0x0e, 0x78, 0x99, 0xc1, 0x5e, 0xb3, 0xe0, 3492 0x7d, 0x9a, 0x7c, 0x19, 0xc8, 0x73, 0x3e, 0x0a, 0x9c, 0xdf, 0x94, 0xdf,
3522 0xeb, 0x50, 0xd7, 0x44, 0x65, 0x1c, 0x31, 0xd7, 0x42, 0x3c, 0x4a, 0x20, 3493 0x45, 0x2e, 0x5b, 0x18, 0x44, 0x0e, 0x80, 0xd5, 0xaf, 0x83, 0xef, 0xbc,
3523 0xdf, 0x8c, 0x01, 0x6b, 0x89, 0x6c, 0x2c, 0x25, 0x10, 0x13, 0x5b, 0xe2, 3494 0x29, 0xc1, 0xae, 0xc4, 0xab, 0xe0, 0x6f, 0x18, 0xb2, 0xd9, 0x84, 0x3e,
3524 0x00, 0x13, 0x97, 0x8c, 0x14, 0x9e, 0xdd, 0xab, 0xec, 0x33, 0x94, 0xbe, 3495 0x06, 0xda, 0x07, 0x58, 0x13, 0x68, 0x69, 0xb7, 0xba, 0x10, 0x4f, 0x11,
3525 0x3b, 0x2c, 0xdd, 0xa3, 0x92, 0x2f, 0x9f, 0xc4, 0x58, 0x1c, 0xeb, 0x75, 3496 0xbb, 0x24, 0x98, 0x1c, 0xe9, 0x06, 0xfd, 0x2b, 0x01, 0xe6, 0x82, 0xc1,
3526 0x21, 0x2f, 0x31, 0x2e, 0x30, 0x06, 0x2c, 0x39, 0xbf, 0x6b, 0xd1, 0xd7, 3497 0xd8, 0x6a, 0xfb, 0x37, 0xdd, 0xf6, 0x41, 0xf0, 0xc2, 0xe7, 0x88, 0x09,
3527 0xba, 0xb5, 0xcc, 0xe9, 0x82, 0x30, 0x96, 0x23, 0x0f, 0xc0, 0x1e, 0x38, 3498 0x24, 0x38, 0x35, 0x62, 0x82, 0x07, 0xf6, 0x0d, 0xa9, 0xbe, 0xe9, 0x45,
3528 0x36, 0x89, 0xe7, 0xf8, 0xfd, 0x2f, 0xfd, 0x98, 0xf9, 0xb1, 0x4e, 0x81, 3499 0xda, 0x40, 0x23, 0x53, 0xb1, 0x1e, 0x91, 0xd4, 0xc2, 0x56, 0x19, 0x5f,
3529 0xd1, 0xbe, 0xc4, 0x9c, 0x67, 0x61, 0x3d, 0xb7, 0xdd, 0x4f, 0x9f, 0x47, 3500 0xe8, 0x95, 0x5d, 0x0b, 0xc4, 0x30, 0xac, 0x69, 0x60, 0x2a, 0xc0, 0x18,
3530 0xad, 0x14, 0xdc, 0x27, 0xae, 0x66, 0x3f, 0xe1, 0x24, 0x68, 0x1e, 0x04, 3501 0xfa, 0x05, 0xe6, 0x76, 0xd1, 0xf0, 0x41, 0xe9, 0x0f, 0x7f, 0x15, 0xeb,
3531 0xbe, 0x47, 0x6d, 0x75, 0xb0, 0x8a, 0xef, 0xed, 0xf3, 0x5d, 0xcc, 0x57, 3502 0x60, 0xca, 0x8a, 0x45, 0x66, 0xb1, 0xc6, 0x02, 0x8a, 0x4e, 0xd8, 0x1f,
3532 0x63, 0x51, 0x23, 0x6d, 0xb1, 0x9e, 0x43, 0xac, 0x3c, 0x86, 0xb8, 0x68, 3503 0x93, 0x36, 0xba, 0x66, 0xdc, 0xf4, 0xe2, 0xbd, 0xe8, 0x62, 0xe1, 0x5c,
3533 0x3b, 0xfa, 0x5a, 0x03, 0x7c, 0x42, 0x8e, 0x65, 0xdb, 0x09, 0x0f, 0xbd, 3504 0x08, 0xaf, 0xa3, 0xfb, 0x57, 0x1e, 0x5d, 0x13, 0x74, 0xfb, 0x40, 0x93,
3534 0xd6, 0x7a, 0xd6, 0x1a, 0x96, 0x89, 0xb5, 0x31, 0xc9, 0xae, 0x0d, 0xc6, 3505 0x73, 0x7c, 0xa8, 0x73, 0xec, 0xb4, 0xd8, 0x1d, 0xe0, 0x2f, 0x1d, 0x7b,
3535 0xcf, 0x4b, 0xd7, 0x65, 0x5b, 0x5e, 0x6b, 0x95, 0x5c, 0xf3, 0xa4, 0x0d, 3506 0x58, 0x66, 0x41, 0xe7, 0xe8, 0x02, 0xfd, 0xa4, 0x6c, 0xc5, 0x67, 0xb8,
3536 0xbb, 0xdc, 0xb7, 0xdf, 0x90, 0x1a, 0x30, 0xdc, 0xbe, 0xfd, 0x9d, 0xac, 3507 0x4d, 0x62, 0x83, 0xe7, 0x81, 0x73, 0xc6, 0x14, 0x0d, 0x17, 0x73, 0xe8,
3537 0xe9, 0x5f, 0x14, 0x3d, 0x21, 0x99, 0x45, 0x5b, 0xc6, 0xf6, 0x07, 0xb5, 3508 0x17, 0x12, 0xc0, 0xa9, 0x1f, 0x07, 0x3f, 0xcc, 0xb1, 0x38, 0xe7, 0x00,
3538 0xe7, 0x2f, 0x3b, 0xa4, 0x1b, 0x63, 0x6b, 0x09, 0xcc, 0x61, 0xdd, 0xaf, 3509 0xe6, 0x9b, 0xc0, 0x3a, 0x64, 0x7d, 0x85, 0xeb, 0x1b, 0xbf, 0xcf, 0x87,
3539 0xfa, 0x27, 0xe0, 0x59, 0xf3, 0x9e, 0x51, 0x39, 0x8f, 0x98, 0x19, 0xbc, 3510 0x3b, 0x53, 0xa7, 0xdb, 0xb1, 0xee, 0xe4, 0x11, 0x43, 0xc5, 0x7e, 0xea,
3540 0x37, 0x6d, 0xe7, 0xfc, 0x22, 0x70, 0x0d, 0xe4, 0x99, 0x59, 0x24, 0xee, 3511 0xc5, 0xea, 0x4c, 0x96, 0x14, 0xdf, 0x9d, 0xa9, 0x12, 0x65, 0x14, 0xef,
3541 0xda, 0x05, 0x39, 0x45, 0x60, 0x23, 0xd4, 0xfd, 0x20, 0x9e, 0x6d, 0xc9, 3512 0x4c, 0x97, 0x28, 0x23, 0x01, 0x3f, 0x71, 0xd8, 0x64, 0x40, 0x22, 0x5b,
3542 0x57, 0x53, 0xb4, 0x87, 0xc7, 0x20, 0x4b, 0xac, 0x15, 0x0e, 0xf8, 0xf9, 3513 0xa8, 0xc7, 0x43, 0xe8, 0xf7, 0x57, 0x01, 0xe2, 0xb8, 0xa4, 0xc5, 0xdf,
3543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 0xfe, 0x4a, 0x95, 0x08, 3521 0x4e, 0xc8, 0xbf, 0x67, 0x7b, 0x5a, 0x03, 0x3e, 0x45, 0xf9, 0x7f, 0xe4,
3551 0x6c, 0x59, 0x0a, 0x91, 0x34, 0x78, 0x1a, 0xc3, 0x77, 0x38, 0xff, 0x09, 3522 0xea, 0x09, 0xf8, 0x91, 0x51, 0xf9, 0x7d, 0xf8, 0x92, 0x1f, 0xd7, 0xe3,
3552 0xe8, 0xf3, 0x2c, 0x9e, 0x5f, 0x00, 0x5f, 0x1b, 0x65, 0xd2, 0x9d, 0x4c, 3523 0xc8, 0x1b, 0x86, 0x91, 0x37, 0x0c, 0x22, 0x6f, 0xb0, 0x90, 0x37, 0x44,
3553 0x1c, 0x57, 0xbe, 0x8b, 0x6b, 0x97, 0xb5, 0xcc, 0xd7, 0xe4, 0xbc, 0xe2, 3524 0x90, 0x37, 0xf4, 0x21, 0x6f, 0x08, 0x23, 0x3e, 0x88, 0x1c, 0xad, 0xe7,
3554 0xef, 0x13, 0xac, 0x9d, 0xa1, 0xa7, 0xeb, 0xe1, 0x6f, 0xf2, 0x3a, 0xf9, 3525 0x61, 0x63, 0x0d, 0xf8, 0x41, 0x33, 0x68, 0xd7, 0x43, 0xc1, 0x64, 0x3d,
3555 0xf3, 0xd6, 0x67, 0xce, 0xca, 0x58, 0x09, 0xc9, 0x96, 0x5f, 0x6a, 0x85, 3526 0x1c, 0x4c, 0xd5, 0x03, 0x98, 0xd3, 0x01, 0x8e, 0x89, 0xf9, 0xe5, 0x3b,
3556 0x2d, 0x2b, 0x3e, 0xef, 0xeb, 0x31, 0xeb, 0x46, 0x41, 0x07, 0xfb, 0x00, 3527 0xc7, 0x4a, 0xc3, 0x88, 0x39, 0x36, 0xfc, 0x52, 0x1a, 0xf1, 0x36, 0x2e,
3557 0xfb, 0x95, 0x2e, 0x41, 0x07, 0x6d, 0xa7, 0x10, 0x4d, 0x3f, 0x2e, 0x2b, 3528 0x47, 0xf0, 0xcc, 0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 0x26, 0x9a, 0xdc, 0x73, 0x3b, 0x4f, 0x45, 3543 0xdb, 0x52, 0x04, 0x7d, 0x88, 0x53, 0x39, 0xef, 0x2c, 0xe6, 0xac, 0xb9,
3573 0x77, 0x7d, 0x2f, 0x01, 0x52, 0xa6, 0xc9, 0x7d, 0x0b, 0x12, 0x4a, 0x87, 3544 0xcf, 0x78, 0xf5, 0xc9, 0x42, 0x09, 0x73, 0xaf, 0xdf, 0xca, 0x5c, 0x3e,
3574 0xb0, 0x2f, 0xc7, 0x7a, 0x10, 0x63, 0x06, 0xa2, 0xd9, 0xe6, 0xcf, 0x31, 3545 0x05, 0xec, 0x0e, 0x1d, 0x25, 0x4f, 0xb1, 0xae, 0xb0, 0x09, 0x72, 0x1a,
3575 0x4e, 0x5f, 0x66, 0x7c, 0x0f, 0x68, 0x1f, 0xc5, 0x9a, 0x8c, 0xbb, 0x63, 3546 0x83, 0xad, 0xd0, 0x06, 0xfa, 0xf1, 0x6c, 0x53, 0xbe, 0x11, 0xa7, 0x5d,
3576 0xe0, 0x99, 0x35, 0x26, 0xe3, 0x26, 0xf2, 0x48, 0xe3, 0x47, 0xcc, 0x2d, 3547 0xbc, 0x04, 0x59, 0x82, 0x56, 0xc0, 0x9f, 0x0f, 0x70, 0xde, 0x3c, 0xe5,
3577 0xf8, 0x3e, 0xe0, 0x7f, 0xe7, 0x7d, 0x89, 0xde, 0x9c, 0x36, 0xab, 0x05, 3548 0x17, 0x46, 0x6e, 0xce, 0xb1, 0x25, 0xd8, 0x99, 0x58, 0x9f, 0x77, 0xdf,
3578 0x31, 0xb1, 0x27, 0x74, 0x6e, 0xc5, 0xa5, 0xd8, 0x30, 0x5f, 0x20, 0x66, 3549 0xca, 0x2c, 0x9f, 0x02, 0xfd, 0x01, 0xd6, 0xde, 0xe0, 0xb3, 0x8b, 0xac,
3579 0xd4, 0x29, 0x83, 0x35, 0xca, 0x89, 0xfd, 0x27, 0xd4, 0x7f, 0xb5, 0xe7, 3550 0x1d, 0x32, 0x27, 0xdd, 0x05, 0x3d, 0xed, 0x55, 0xb5, 0xb8, 0x64, 0x35,
3580 0x21, 0x8f, 0xa8, 0xec, 0xb5, 0x0e, 0x22, 0xa6, 0x80, 0xfe, 0xca, 0x18, 3551 0x2e, 0xd6, 0x49, 0xfa, 0x2c, 0x89, 0x18, 0xd6, 0x7e, 0xe4, 0xaf, 0x62,
3581 0x78, 0x63, 0x8f, 0x66, 0x10, 0xf9, 0x2b, 0x04, 0x21, 0xa0, 0x96, 0x5a, 3552 0xea, 0x89, 0x49, 0xdc, 0xa3, 0x3c, 0x35, 0xe4, 0x1c, 0xb8, 0x7f, 0x61,
3582 0x0b, 0xc9, 0xbd, 0xe1, 0x11, 0xa3, 0x28, 0x8f, 0x46, 0x58, 0x36, 0x17, 3553 0x45, 0xe9, 0xc4, 0x80, 0xee, 0x72, 0x3b, 0x99, 0x84, 0xc9, 0xbc, 0x91,
3583 0xd6, 0x98, 0x07, 0xc2, 0xb2, 0xb0, 0x26, 0x72, 0x69, 0x91, 0x71, 0x45, 3554 0x80, 0x2f, 0x1c, 0xe1, 0x1c, 0xd4, 0xd8, 0xc8, 0xc7, 0xb9, 0xfe, 0x30,
3584 0xfd, 0x41, 0xe6, 0x86, 0x33, 0x8f, 0x3c, 0x5b, 0x5a, 0x62, 0x8c, 0x61, 3555 0x67, 0xd8, 0x55, 0x4b, 0x5e, 0xae, 0xfe, 0x66, 0x4b, 0x47, 0x60, 0xd3,
3585 0x9c, 0xb8, 0x01, 0xba, 0x48, 0x7e, 0xe3, 0xab, 0xc8, 0x49, 0xa5, 0xf2, 3556 0x92, 0x6f, 0x43, 0x3e, 0x90, 0x1c, 0xc1, 0x6f, 0x38, 0x81, 0xa3, 0xd0,
3586 0x20, 0x62, 0xa6, 0xac, 0xeb, 0x90, 0x29, 0x72, 0x19, 0x6b, 0xd4, 0x1d, 3557 0xe7, 0xd9, 0x11, 0xd6, 0x3f, 0x5f, 0x02, 0xb6, 0x27, 0xdf, 0xb1, 0xc8,
3587 0xfa, 0x32, 0x41, 0x4f, 0x26, 0x2a, 0xc5, 0x45, 0xf6, 0x63, 0xa2, 0xa0, 3558 0x11, 0xb5, 0x86, 0x71, 0xed, 0x30, 0x97, 0xdb, 0x24, 0x97, 0xd5, 0xfc,
3588 0x85, 0x35, 0x76, 0x48, 0xd5, 0x3f, 0x37, 0xa8, 0xd8, 0xca, 0xff, 0xe1, 3559 0x1e, 0x22, 0xf6, 0x80, 0x9e, 0xee, 0x67, 0x7e, 0xe3, 0xf7, 0x39, 0x3f,
3589 0xb6, 0x7d, 0x93, 0x27, 0xf7, 0xe9, 0x8c, 0x63, 0x37, 0x8b, 0x3d, 0x63, 3560 0x97, 0x3e, 0x63, 0x57, 0xd2, 0x8a, 0x48, 0xaa, 0x78, 0xa9, 0x19, 0xb0,
3590 0x77, 0x1d, 0xa8, 0x74, 0x48, 0xb5, 0x8f, 0x76, 0x49, 0xfd, 0xbf, 0xa0, 3561 0x2c, 0x60, 0x67, 0x57, 0x8f, 0x29, 0x27, 0x08, 0x3e, 0x58, 0x6b, 0xdb,
3591 0x62, 0xed, 0x02, 0x78, 0x2a, 0x2e, 0x12, 0xe3, 0x86, 0x31, 0x2f, 0xe6, 3562 0xa9, 0x74, 0x09, 0x3e, 0x68, 0x3b, 0xf9, 0x60, 0x62, 0xb3, 0x9c, 0x9b,
3592 0xcf, 0xa3, 0x5c, 0xff, 0x89, 0xcc, 0xed, 0x7f, 0x17, 0x74, 0x79, 0x71, 3563 0xef, 0x91, 0xca, 0xfc, 0xcf, 0xa5, 0x3a, 0xdf, 0x25, 0xe7, 0xe7, 0x9b,
3593 0x2d, 0xbf, 0x1f, 0xf1, 0x76, 0x46, 0x97, 0x3b, 0xef, 0x1a, 0xc7, 0xb3, 3564 0x72, 0x35, 0xae, 0x7c, 0x93, 0xd5, 0xae, 0xd6, 0xb5, 0x3c, 0xec, 0xd6,
3594 0xcc, 0x81, 0xef, 0xf8, 0x78, 0x92, 0x63, 0xec, 0x61, 0x81, 0xbe, 0x15, 3565 0x61, 0x62, 0xa3, 0xd7, 0xe5, 0x79, 0x39, 0x57, 0x76, 0x79, 0xcf, 0xb4,
3595 0x03, 0xff, 0xfb, 0xa4, 0xb0, 0x12, 0x85, 0x1c, 0x90, 0x4b, 0x6b, 0xde, 3566 0xf0, 0x7e, 0x15, 0xb6, 0xf6, 0xaa, 0x45, 0xfe, 0x47, 0xa4, 0x52, 0x24,
3596 0x5a, 0xac, 0x77, 0x4f, 0x42, 0x47, 0xfa, 0xa9, 0xa8, 0x44, 0x4e, 0xf5, 3567 0xef, 0xfb, 0x14, 0xef, 0xbb, 0x56, 0x79, 0x97, 0xac, 0x61, 0x91, 0xff,
3597 0x49, 0xf8, 0xeb, 0xdd, 0xd2, 0xf1, 0xf5, 0x21, 0x09, 0x7d, 0xdd, 0x64, 3568 0x8d, 0x78, 0xef, 0x90, 0xec, 0x56, 0xf2, 0x1f, 0xc1, 0xb3, 0xef, 0xb4,
3598 0x4e, 0x4f, 0x9c, 0x80, 0xbe, 0xe6, 0x65, 0x5c, 0x9e, 0x44, 0xde, 0x62, 3569 0xbf, 0x8a, 0x73, 0xad, 0xb9, 0x5c, 0x6c, 0x53, 0x3c, 0x1b, 0x89, 0x11,
3599 0x5e, 0x57, 0x76, 0x6a, 0xf4, 0x4b, 0x08, 0x05, 0xab, 0xfe, 0x8c, 0x2d, 3570 0xc8, 0xe7, 0x5a, 0xb3, 0xe1, 0x70, 0x1d, 0xe1, 0xb7, 0xf3, 0x2f, 0xe0,
3600 0x8f, 0xee, 0xff, 0x85, 0xea, 0x33, 0x01, 0xc3, 0x8b, 0xfe, 0xfc, 0x94, 3571 0xab, 0x7a, 0x55, 0xce, 0x92, 0x9b, 0xec, 0xee, 0x4c, 0x2e, 0x8e, 0x42,
3601 0xd8, 0xcd, 0x77, 0x21, 0x6b, 0xc3, 0x79, 0xed, 0xd6, 0xa0, 0xa6, 0x1c, 3572 0xb7, 0x9d, 0x6a, 0x1d, 0xc2,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3609 0x7a, 0x18, 0xdc, 0x5b, 0x9f, 0x75, 0x07, 0x62, 0x4c, 0x93, 0x74, 0x70, 3580 0x9f, 0x6b, 0x99, 0x7e, 0xde, 0xe7, 0x7d, 0x18, 0x34, 0xe9, 0x7f, 0x87,
3610 0xdf, 0x01, 0x09, 0x3d, 0x17, 0x93, 0xf0, 0x73, 0xb4, 0x3f, 0x33, 0xe1, 3581 0x31, 0x67, 0xe6, 0xd8, 0xf4, 0x9f, 0x88, 0x27, 0xb5, 0x70, 0x57, 0xf2,
3611 0x40, 0x7e, 0x0b, 0x16, 0x31, 0xd0, 0x0a, 0xb0, 0xc5, 0xcd, 0xa2, 0xaf, 3582 0xb4, 0x5b, 0x1b, 0x74, 0x7f, 0xf3, 0xbe, 0x04, 0x1f, 0x49, 0x44, 0xcb,
3612 0x0c, 0xc0, 0x77, 0xcc, 0x78, 0x55, 0x92, 0x12, 0xaa, 0x45, 0xe5, 0xad, 3583 0x79, 0xe4, 0x7e, 0x29, 0xac, 0xd1, 0xa4, 0x85, 0x3c, 0xbb, 0x16, 0x7d,
3613 0x45, 0x33, 0x41, 0x7b, 0x39, 0x6b, 0x61, 0xbc, 0xd9, 0x75, 0x79, 0x5d, 3584 0x85, 0x98, 0x5b, 0xa7, 0x0c, 0x96, 0x28, 0x27, 0xd6, 0xa9, 0x4c, 0xc9,
3614 0x51, 0xc1, 0xb1, 0x2f, 0x87, 0x80, 0x19, 0x86, 0x6d, 0xbd, 0x47, 0x5e, 3585 0x57, 0xbe, 0x0b, 0x79, 0x04, 0x65, 0x8b, 0x95, 0x85, 0x4f, 0x01, 0xff,
3615 0x87, 0xbe, 0x73, 0x6a, 0xec, 0x66, 0xac, 0x0b, 0x1a, 0x9e, 0x33, 0xc1, 3586 0x98, 0xfb, 0x5c, 0x89, 0xb5, 0xc8, 0x7e, 0xc4, 0x31, 0x03, 0x42, 0x40,
3616 0x03, 0xd7, 0xfd, 0x1e, 0xd6, 0x54, 0xf8, 0xca, 0xd9, 0x60, 0x4d, 0xba, 3587 0x4e, 0xb5, 0x64, 0xc8, 0x67, 0x03, 0x43, 0xc8, 0x01, 0x9f, 0x45, 0xdf,
3617 0x48, 0xdb, 0xed, 0x83, 0xdd, 0xe1, 0xba, 0xd9, 0x21, 0xb9, 0xd9, 0x84, 3588 0x80, 0xe4, 0x97, 0x18, 0x0f, 0x02, 0x32, 0xb7, 0x24, 0x72, 0xfd, 0x14,
3618 0xe8, 0x8b, 0x9f, 0x91, 0xc1, 0xfd, 0xba, 0xc7, 0x8f, 0xe2, 0x91, 0x63, 3589 0xfd, 0x8a, 0xfa, 0x83, 0xcc, 0x1b, 0x99, 0x69, 0x62, 0xed, 0x79, 0xfa,
3619 0xec, 0xc7, 0xdd, 0xae, 0xfc, 0x51, 0x5f, 0x83, 0xcd, 0x3c, 0x48, 0x1d, 3590 0x18, 0xfa, 0x89, 0x07, 0xa1, 0x8b, 0xd8, 0x4b, 0xdf, 0x40, 0x6c, 0x9a,
3620 0x23, 0xf7, 0x23, 0x8f, 0x31, 0x8e, 0x85, 0x90, 0xc7, 0xb2, 0x4d, 0x4f, 3591 0x2d, 0xf6, 0xc3, 0x67, 0x4a, 0x43, 0x87, 0x4c, 0x11, 0xd3, 0x98, 0xa3,
3621 0xef, 0xd5, 0x07, 0xfb, 0xe5, 0xc9, 0xe7, 0x68, 0x4f, 0xb8, 0xb7, 0x69, 3592 0x6f, 0x50, 0x77, 0xf4, 0x6b, 0x8e, 0x41, 0x29, 0x9c, 0x62, 0xbd, 0x31,
3622 0x53, 0x41, 0x0f, 0x98, 0xf7, 0x2c, 0x39, 0xf9, 0x6c, 0x50, 0x73, 0xb0, 3593 0x08, 0x5e, 0x98, 0xb7, 0x1a, 0x2a, 0x0f, 0x7a, 0x50, 0xf9, 0x56, 0x7e,
3623 0xbe, 0x32, 0xe3, 0x07, 0xc0, 0x8f, 0x7e, 0x27, 0xe3, 0x81, 0xae, 0x6c, 3594 0x07, 0x5a, 0xc6, 0x8d, 0x1d, 0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,
3631 0x0e, 0x11, 0xad, 0x66, 0x51, 0x27, 0x9a, 0x9c, 0x57, 0xbd, 0x58, 0x11, 3602 0x27, 0x7b, 0x25, 0xf0, 0xad, 0x2e, 0x69, 0xff, 0xd6, 0x80, 0x18, 0xdf,
3632 0xc7, 0x3d, 0x42, 0x19, 0x68, 0xf5, 0xea, 0x3e, 0xad, 0x50, 0x0d, 0xc9, 3603 0x62, 0x2d, 0x29, 0x1a, 0x39, 0xaa, 0xea, 0x58, 0x69, 0x39, 0x86, 0xf8,
3633 0xc5, 0x18, 0xe9, 0x4e, 0xa8, 0xfa, 0x7d, 0xbf, 0xb2, 0xb5, 0x1e, 0xe4, 3604 0xa5, 0x23, 0x16, 0x2b, 0x3b, 0x35, 0xb7, 0x8a, 0x81, 0xc4, 0x55, 0x7f,
3634 0x12, 0xd8, 0x4c, 0xea, 0x93, 0xd8, 0x57, 0x8d, 0xc1, 0xa6, 0xa8, 0x7b, 3605 0xc1, 0x96, 0xaf, 0xef, 0xfc, 0x85, 0xaa, 0xa3, 0x26, 0x47, 0x70, 0xfd,
3635 0xea, 0x5d, 0xc5, 0x48, 0x5f, 0xf7, 0x3b, 0xe5, 0x4c, 0xd0, 0x51, 0x26, 3606 0x72, 0x06, 0xd8, 0x44, 0x83, 0xad, 0x34, 0x32, 0xd7, 0x1e, 0xf5, 0x73,
3636 0x7e, 0xef, 0xf4, 0xf1, 0xfb, 0xa2, 0x5f, 0x0f, 0x3d, 0x26, 0xac, 0x53, 3607 0xcb, 0x41, 0x55, 0x93, 0xff, 0xfa, 0x4e, 0x37, 0xb7, 0x9c, 0x45, 0x6e,
3637 0x16, 0x2a, 0xa4, 0x05, 0xf1, 0xd6, 0xdd, 0xc9, 0x96, 0x28, 0x47, 0x2f, 3608 0x99, 0x56, 0xb9, 0x25, 0xfc, 0x6b, 0x80, 0xfd, 0xb6, 0x8a, 0x8e, 0xb1,
3638 0xa6, 0x1c, 0x45, 0x1d, 0xa3, 0xaf, 0x19, 0xbe,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a8, 0x39, 0xb2,
3653 0x67, 0x3a, 0xec, 0xa3, 0x05, 0x7d, 0x33, 0xae, 0x07, 0x4c, 0x00, 0x7d, 3624 0x8d, 0x35, 0xe7, 0x11, 0xb5, 0x1e, 0xf5, 0x25, 0xd8, 0xcc, 0x3e, 0xea,
3654 0x7f, 0x17, 0x3a, 0xfe, 0x4e, 0x05, 0x98, 0xa0, 0x02, 0x4c, 0x80, 0x3d, 3625 0x18, 0xb1, 0x1f, 0x71, 0x8c, 0x7e, 0xcc, 0x40, 0x1c, 0x4b, 0xd5, 0x5d,
3655 0xbe, 0x0d, 0x1d, 0x7f, 0xab, 0x02, 0x4c, 0x50, 0x89, 0xfb, 0x3d, 0x0a, 3626 0xbd, 0x97, 0xf7, 0x6d, 0x95, 0x63, 0x67, 0x68, 0x4f, 0xb8, 0xb7, 0x6a,
3656 0x9b, 0x98, 0xfe, 0x23, 0xda, 0x6e, 0xd0, 0x93, 0xb9, 0xda, 0x2e, 0x39, 3627 0x53, 0xfe, 0xde, 0x10, 0xef, 0x59, 0x72, 0xfc, 0x45, 0xe6, 0x1e, 0xcc,
3657 0xce, 0xf9, 0x01, 0x36, 0x8e, 0xc2, 0x8e, 0x78, 0x6e, 0x11, 0xf4, 0x3b, 3628 0x39, 0x98, 0x67, 0x45, 0xc3, 0xbb, 0x30, 0x1f, 0xfd, 0x31, 0xfa, 0x03,
3658 0xfc, 0x1c, 0xd1, 0xe0, 0xb9, 0x00, 0x72, 0x44, 0x83, 0xe7, 0x18, 0x23, 3629 0x5d, 0xd9, 0x6e, 0x0e, 0x3e, 0xba, 0x50, 0xa7, 0xde, 0x86, 0xb9, 0x7f,
3659 0xf1, 0x10, 0x30, 0x61, 0x48, 0xe2, 0xc2, 0x5e, 0xef, 0xdc, 0x18, 0xd6, 3630 0x66, 0x32, 0x5f, 0xb3, 0xc3, 0xae, 0xbc, 0x0b, 0x68, 0x9b, 0x85, 0xef,
3660 0x1a, 0x1d, 0x84, 0x27, 0x75, 0xa8, 0xbe, 0xd6, 0x71, 0xd5, 0x6f, 0x40, 3631 0x4f, 0x39, 0x6d, 0xb2, 0x32, 0x69, 0x43, 0xf7, 0x5f, 0x02, 0x5f, 0x07,
3661 0x5c, 0xa8, 0x06, 0xb5, 0x5b, 0x52, 0x26, 0x96, 0x88, 0x33, 0x65, 0xaf, 3632 0x3a, 0x59, 0x23, 0x58, 0x99, 0x4c, 0xe3, 0xfa, 0x80, 0xca, 0xd1, 0x8c,
3662 0x9e, 0x86, 0x0e, 0x5c, 0x62, 0xc3, 0xcd, 0xbe, 0xf4, 0x70, 0x1d, 0x7b, 3633 0xc7, 0x6c, 0xd0, 0xd8, 0xca, 0x75, 0xe4, 0xe9, 0x29, 0xae, 0x17, 0xe6,
3663 0x16, 0x2d, 0x8f, 0xbe, 0xe3, 0xee, 0xd6, 0x33, 0x07, 0x10, 0x9f, 0xa7, 3634 0x1f, 0xd3, 0x67, 0xe1, 0xb3, 0xc7, 0xe3, 0x8c, 0xf1, 0xdc, 0x4b, 0xe8,
3664 0xca, 0x09, 0x99, 0x2c, 0x7b, 0x98, 0x00, 0xf5, 0xcf, 0x55, 0xfd, 0x51, 3635 0x00, 0x1f, 0xdd, 0x0a, 0x57, 0xe8, 0xd6, 0x4e, 0xbd, 0x50, 0xa6, 0x9f,
3665 0x9b, 0x7a, 0x80, 0xfe, 0x36, 0x6d, 0x23, 0x71, 0x3e, 0x45, 0x19, 0x53, 3636 0xcf, 0x87, 0xdb, 0x85, 0x78, 0xc4, 0xd4, 0x2b, 0x16, 0x75, 0xa2, 0xc9,
3666 0xff, 0xd3, 0xaa, 0x67, 0x7d, 0xa0, 0xee, 0xf5, 0xe5, 0x27, 0x95, 0x2d, 3637 0x65, 0xb5, 0xef, 0x20, 0x92, 0x76, 0x0e, 0x61, 0xac, 0xb8, 0x5e, 0x2d,
3667 0x84, 0x19, 0x67, 0xa8, 0x3f, 0xcf, 0x87, 0x61, 0x17, 0x79, 0x37, 0x90, 3638 0xef, 0xd4, 0xf3, 0x65, 0x43, 0x56, 0x42, 0xe4, 0x3b, 0xa2, 0xf2, 0xf8,
3668 0x4b, 0x3b, 0x1e, 0xf9, 0xbc, 0x26, 0xd6, 0x4e, 0xe3, 0xb9, 0xb6, 0xf1, 3639 0x9d, 0xca, 0xd6, 0x8a, 0x88, 0x25, 0xb0, 0x99, 0xf8, 0x87, 0x31, 0xae,
3669 0xcd, 0xfb, 0x3e, 0xbd, 0x88, 0x7d, 0x9b, 0x3d, 0x06, 0xc6, 0xa9, 0xad, 3640 0x6a, 0x83, 0x4d, 0x51, 0xf7, 0xd4, 0xbb, 0xf2, 0x91, 0x9e, 0xee, 0x37,
3670 0xf1, 0x10, 0xea, 0x87, 0xb0, 0xba, 0x8f, 0x18, 0xde, 0x88, 0x49, 0xb6, 3641 0x8a, 0x99, 0x45, 0xf8, 0x5f, 0xd6, 0x2f, 0x3a, 0xbc, 0x5a, 0xe3, 0x4b,
3671 0x61, 0x89, 0x53, 0xe5, 0x3c, 0xf6, 0x2d, 0x18, 0x8f, 0x9e, 0x90, 0xec, 3642 0x5e, 0x3e, 0xf4, 0x8c, 0x30, 0x4f, 0x99, 0x2b, 0x91, 0x97, 0x22, 0xfc,
3672 0x52, 0xaf, 0xe4, 0x62, 0x66, 0xca, 0x96, 0xbf, 0x27, 0x1b, 0xcb, 0x85, 3643 0xe1, 0x46, 0xb6, 0x44, 0x39, 0xba, 0x3e, 0xe5, 0x10, 0xec, 0x42, 0x5f,
3673 0x04, 0xcf, 0x0d, 0x0b, 0x33, 0x1a, 0x9e, 0x7b, 0x18, 0xd7, 0xa4, 0xd9, 3644 0x32, 0x3d, 0x1b, 0xe0, 0xdf, 0x28, 0xee, 0x31, 0x06, 0xe0, 0xbb, 0xde,
3674 0x92, 0xc3, 0x65, 0xe6, 0x9d, 0x91, 0x78, 0x03, 0xf7, 0x72, 0xb3, 0xec, 3645 0x86, 0xf5, 0xbe, 0x17, 0x32, 0xa2, 0x6e, 0xa0, 0xbf, 0x25, 0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0x6d,
3704 0x80, 0xd1, 0x3b, 0xfc, 0xf8, 0xce, 0xba, 0x28, 0xc0, 0x2a, 0x77, 0x75, 3675 0xd4, 0xfe, 0x1b, 0x2d, 0xed, 0xab, 0xf7, 0x3d, 0x7e, 0xe1, 0xfb, 0x56,
3705 0x7b, 0xb5, 0xd1, 0x2e, 0xcd, 0xab, 0x3f, 0x13, 0xfe, 0x9c, 0xf0, 0x26, 3676 0x6b, 0x0d, 0xf4, 0x53, 0x77, 0xdb, 0x81, 0xdd, 0x24, 0xa0, 0xee, 0xc3,
3706 0x16, 0x0e, 0x6f, 0x62, 0xe1, 0x6d, 0xe7, 0x30, 0xa2, 0xde, 0x6d, 0x50, 3677 0x87, 0xd7, 0x42, 0x92, 0xaa, 0x59, 0x92, 0x2e, 0xb3, 0x1f, 0xeb, 0x17,
3707 0xe7, 0x39, 0x3c, 0xdf, 0x11, 0x4d, 0x4f, 0xf3, 0x8c, 0x07, 0x38, 0xc7, 3678 0xf4, 0x47, 0x7f, 0x22, 0x29, 0xe4, 0xab, 0xd9, 0x50, 0x34, 0x6e, 0xcb,
3708 0xe2, 0x99, 0x0f, 0x7d, 0xe9, 0x41, 0x2d, 0x5b, 0x37, 0x10, 0xef, 0x99, 3679 0x7f, 0x96, 0xe5, 0x85, 0x7c, 0x84, 0xe7, 0x0a, 0xf2, 0x13, 0x1a, 0x9e,
3709 0x7f, 0x90, 0x6b, 0xcb, 0xc1, 0xd9, 0x62, 0xa0, 0x27, 0xca, 0x8e, 0x63, 3680 0xfb, 0x19, 0xae, 0xc9, 0xb3, 0x25, 0x33, 0x45, 0xc6, 0x9d, 0xa1, 0x70,
3710 0x7f, 0xaa, 0xa1, 0xe6, 0x4d, 0x45, 0xac, 0x43, 0xa0, 0x65, 0x0a, 0xff, 3681 0x0d, 0xf7, 0xb2, 0x93, 0xac, 0xd9, 0x7c, 0x07, 0x36, 0x19, 0x8d, 0x94,
3711 0x03, 0x99, 0xde, 0xa3, 0x72, 0x5f, 0x27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d, 0x61, 0xda,
3755 0x14, 0x36, 0xae, 0xad, 0x05, 0xd8, 0x38, 0x73, 0x0d, 0x6c, 0xfc, 0xdf, 3726 0x0f, 0xeb, 0x27, 0xc8, 0x5d, 0x99, 0xc3, 0x9e, 0xe2, 0xf8, 0x6b, 0x75,
3756 0xba, 0xbc, 0xf8, 0x1f, 0x95, 0x82, 0xc2, 0xc6, 0xd7, 0x7a, 0xc7, 0x86, 3727 0xb2, 0xec, 0x10, 0x7f, 0x35, 0x32, 0x8d, 0x25, 0xe2, 0xc7, 0xf7, 0x8b,
3757 0xf7, 0xba, 0x89, 0x03, 0xc4, 0x3b, 0x17, 0xef, 0xbb, 0x86, 0xaf, 0x05, 3728 0x25, 0xa9, 0x07, 0xe2, 0xc9, 0xfb, 0xc1, 0x91, 0xd1, 0x79, 0x60, 0xc8,
3758 0x78, 0x99, 0xb9, 0xbe, 0x5f, 0x66, 0x9e, 0xdb, 0xc2, 0xcb, 0x1e, 0x26, 3729 0x57, 0x1a, 0x7a, 0x2b, 0x8e, 0x74, 0x31, 0x64, 0x72, 0x29, 0x0b, 0x9a,
3759 0x36, 0x13, 0x47, 0x55, 0x2e, 0x04, 0x3e, 0x68, 0xb2, 0xef, 0x7d, 0x48, 3730 0x71, 0x85, 0x95, 0x91, 0xc7, 0xc1, 0xed, 0xf5, 0xe3, 0xd9, 0x7e, 0xe4,
3760 0xd9, 0x6e, 0xa9, 0x32, 0xab, 0x70, 0x59, 0x1e, 0xb5, 0x6d, 0x51, 0xe1, 3731 0xe4, 0x2e, 0x66, 0x4c, 0x01, 0x33, 0xfe, 0x06, 0x30, 0xe3, 0xac, 0x74,
3761 0x60, 0x62, 0xe0, 0x2e, 0x91, 0xbe, 0x20, 0x17, 0x05, 0x18, 0x33, 0xec, 3732 0x76, 0x11, 0x33, 0xda, 0x1e, 0x66, 0x4c, 0xc3, 0x9e, 0x73, 0x6b, 0xec,
3762 0xc7, 0x67, 0x9e, 0x29, 0xbc, 0x1d, 0xca, 0x10, 0x03, 0xbb, 0x41, 0x8d, 3733 0x59, 0x53, 0xb5, 0x28, 0xde, 0xcb, 0x01, 0xf3, 0xa5, 0x4e, 0x45, 0xef,
3763 0x40, 0x39, 0x0f, 0x23, 0x76, 0x19, 0xbe, 0xac, 0x3c, 0x9f, 0xdd, 0xb7, 3734 0x03, 0x27, 0x6a, 0x12, 0x52, 0xe7, 0x52, 0x02, 0x2d, 0x34, 0x7d, 0x3c,
3764 0xff, 0x87, 0xef, 0xdb, 0x06, 0xe3, 0x5a, 0x80, 0x11, 0x51, 0x03, 0x55, 3735 0xb8, 0x4d, 0xe1, 0xbc, 0xdd, 0xa5, 0x4d, 0xc8, 0x51, 0x14, 0xee, 0xf3,
3765 0xc6, 0xd5, 0xbb, 0x0e, 0x1e, 0x46, 0xf4, 0xf0, 0x61, 0xd6, 0x9d, 0x01, 3736 0xf6, 0x4b, 0x03, 0xeb, 0xf6, 0x90, 0x03, 0x2d, 0x7b, 0xc8, 0x77, 0xf1,
3766 0x4e, 0x9e, 0x95, 0x09, 0xe0, 0xf3, 0xf5, 0xdf, 0x65, 0xef, 0x29, 0xc0, 3737 0x21, 0x9e, 0xf3, 0x6a, 0x7d, 0x6d, 0xf0, 0x05, 0xff, 0x13, 0x3c, 0x71,
3767 0x44, 0x36, 0xfe, 0xb7, 0xf7, 0xa2, 0x78, 0xdd, 0xa1, 0xce, 0xfe, 0xce, 3738 0x7d, 0x71, 0x2d, 0x68, 0xee, 0x7a, 0x59, 0x83, 0x13, 0xff, 0x7a, 0x1d,
3768 0x0f, 0x45, 0xdb, 0xc6, 0xff, 0x3e, 0xe2, 0x37, 0xea, 0xa1, 0x0a, 0x73, 3739 0x4e, 0x44, 0xec, 0x3a, 0x17, 0x92, 0x24, 0x30, 0xa2, 0xbd, 0x44, 0x5a,
3769 0x1d, 0xb1, 0xd0, 0x6f, 0x40, 0x07, 0x63, 0xd7, 0xc0, 0x42, 0x57, 0xe7, 3740 0x5c, 0xd3, 0xc3, 0xd2, 0x8e, 0xf9, 0x75, 0x9c, 0xea, 0x05, 0x36, 0xea,
3770 0x26, 0xe6, 0xcb, 0xad, 0xbc, 0xe4, 0x6c, 0xe6, 0x25, 0xee, 0xf1, 0xeb, 3741 0x92, 0x20, 0x30, 0x52, 0x9b, 0xc2, 0x48, 0x03, 0xc4, 0x32, 0x83, 0x33,
3771 0x72, 0x27, 0xc7, 0x6c, 0x23, 0x62, 0x4d, 0xe1, 0x33, 0x8f, 0x7c, 0xbd, 3742 0xc0, 0x36, 0xb5, 0x55, 0x9c, 0x14, 0x8d, 0xff, 0x01, 0xf4, 0xf2, 0x94,
3772 0x3d, 0x37, 0xcd, 0x5d, 0x47, 0x6e, 0x9a, 0x50, 0xb9, 0x89, 0xf4, 0xa2, 3743 0xf2, 0x3d, 0x69, 0x39, 0x01, 0x5f, 0xda, 0xbe, 0x04, 0x7c, 0x77, 0xce,
3773 0x9e, 0x83, 0x4c, 0xbe, 0x0b, 0x59, 0x7e, 0x07, 0xb4, 0xff, 0x11, 0xf8, 3744 0xc5, 0x4f, 0x6d, 0xeb, 0xf0, 0xd3, 0xc1, 0x0d, 0xf1, 0x93, 0xaa, 0xdf,
3774 0xf9, 0x43, 0x60, 0xac, 0x6f, 0x03, 0x63, 0x7d, 0xab, 0xd2, 0xfe, 0x0e, 3745 0x8f, 0x52, 0x26, 0x37, 0x1c, 0xb7, 0x7e, 0x7f, 0xdd, 0x71, 0xeb, 0xf7,
3775 0xc3, 0xb8, 0xb0, 0x0e, 0xf4, 0xea, 0x66, 0x0f, 0xc3, 0x1f, 0x86, 0x57, 3746 0x37, 0x9c, 0xd6, 0xfa, 0xfd, 0x47, 0xa4, 0x60, 0x46, 0xed, 0x15, 0x59,
3776 0x35, 0xca, 0x86, 0x33, 0x57, 0x1e, 0x31, 0xe6, 0xbd, 0xf3, 0xd2, 0x44, 3747 0x57, 0xbf, 0x9f, 0x60, 0x3d, 0xdc, 0xe9, 0x72, 0xeb, 0xf4, 0x5d, 0x5e,
3777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 0xbc, 0x07, 0x46, 0x6e, 0x76, 0xb9, 0x71, 0x20, 0x28, 0x79, 0x85,
3792 0x9a, 0xa8, 0xe1, 0xe3, 0x61, 0x9b, 0xef, 0xd9, 0x1e, 0xb6, 0x59, 0xfa, 3763 0x91, 0xef, 0x75, 0x96, 0x8c, 0xf7, 0xba, 0x88, 0x07, 0xc4, 0x3d, 0x5f,
3793 0xeb, 0xd4, 0xbb, 0x87, 0x6b, 0x1e, 0x4e, 0xd3, 0xaf, 0xeb, 0xc0, 0x1c, 3764 0xd0, 0x7b, 0x8f, 0xb5, 0xe6, 0xe3, 0x66, 0xc6, 0xfe, 0xad, 0x32, 0x71,
3794 0x35, 0xf8, 0x64, 0xa1, 0x69, 0xab, 0xcf, 0xf1, 0x8a, 0x6d, 0x46, 0x20, 3765 0xe6, 0x2e, 0x6e, 0x76, 0xb1, 0x71, 0x34, 0x72, 0x48, 0xc5, 0x44, 0xe0,
3795 0x1f, 0xf6, 0x58, 0x4f, 0xd1, 0x0b, 0x5d, 0xd3, 0x28, 0x13, 0x81, 0xba, 3766 0x84, 0x3a, 0xeb, 0xdf, 0xc4, 0xbe, 0x8c, 0x39, 0x01, 0x85, 0xcf, 0x72,
3796 0x66, 0xfc, 0x9f, 0xf9, 0xd7, 0x4f, 0xfb, 0xd7, 0x4f, 0xf9, 0xd7, 0x27, 3767 0x45, 0xe6, 0x01, 0x6c, 0x23, 0x16, 0xee, 0xe4, 0x31, 0x2b, 0x2f, 0x26,
3797 0x91, 0x77, 0x9f, 0x54, 0xb9, 0x93, 0xe3, 0x1c, 0x83, 0x72, 0x5d, 0xac, 3768 0xf9, 0x58, 0xd3, 0x3f, 0xd7, 0xc2, 0x3d, 0x86, 0x37, 0x8d, 0xa4, 0x85,
3798 0x85, 0xf5, 0xce, 0x8e, 0xfe, 0xb4, 0x55, 0x8d, 0x79, 0xfe, 0x5c, 0x68, 3769 0x76, 0xc7, 0xcf, 0x15, 0xe2, 0xea, 0x3c, 0x50, 0x12, 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27, 0x4e, 0x6f, 0xec, 0xf5, 0x62, 0xa9, 0x69, 0xbc, 0x81, 3777 0x7b, 0xc7, 0x50, 0xb6, 0x61, 0x76, 0x56, 0x06, 0x9f, 0x69, 0x29, 0xac,
3807 0x4d, 0xeb, 0xe0, 0xc3, 0x46, 0xec, 0x9b, 0x82, 0x9d, 0x1f, 0x71, 0xc3, 3778 0x8b, 0x51, 0x73, 0x1f, 0x20, 0x46, 0xb9, 0xf8, 0xc0, 0xe5, 0xfb, 0xf7,
3808 0xda, 0x04, 0x62, 0xe0, 0x84, 0xab, 0x6a, 0x3d, 0xc4, 0x2a, 0xc3, 0x49, 3779 0x21, 0x9b, 0x1f, 0x43, 0xa6, 0x3f, 0x02, 0xe6, 0xfa, 0x21, 0xe6, 0xf5,
3809 0x9e, 0x8a, 0xe1, 0x9a, 0xef, 0xd0, 0x20, 0x0f, 0x2a, 0x5b, 0xd9, 0x00, 3780 0x03, 0xe0, 0xa1, 0xef, 0x97, 0xd6, 0x9f, 0x07, 0x19, 0x15, 0xe6, 0x87,
3810 0x8e, 0xd1, 0x54, 0xbf, 0xaf, 0xb4, 0x79, 0x0e, 0xa4, 0xfa, 0xff, 0x4e, 3781 0x2e, 0x66, 0x72, 0x31, 0xfd, 0x0c, 0x56, 0x57, 0xad, 0xd8, 0xc8, 0x4c,
3811 0x32, 0xa9, 0x4b, 0x7e, 0x8c, 0x38, 0xd6, 0x56, 0xb9, 0xa8, 0x51, 0xb6, 3782 0x15, 0x87, 0xcc, 0x69, 0x77, 0x1f, 0x35, 0x92, 0x95, 0xa7, 0x3b, 0x53,
3812 0x3f, 0xc1, 0xda, 0xf0, 0x75, 0x61, 0x5e, 0xbb, 0x07, 0xf3, 0x06, 0x10, 3783 0x8b, 0x8c, 0x19, 0xea, 0x3a, 0xcc, 0xfa, 0x25, 0xb1, 0x43, 0x55, 0xe5,
3813 0x7f, 0x71, 0xaf, 0x09, 0x5e, 0x4e, 0x93, 0x57, 0x3e, 0x83, 0xda, 0xb6, 3784 0x99, 0x03, 0x52, 0xae, 0xb9, 0x78, 0x6b, 0x6e, 0xd1, 0xa5, 0x31, 0xe5,
3814 0xfa, 0x49, 0xbd, 0xb8, 0xe4, 0xd7, 0x44, 0xaa, 0x76, 0x48, 0x48, 0x7d, 3785 0xe1, 0xad, 0x9c, 0x87, 0xb7, 0xb2, 0xb5, 0xe5, 0x48, 0x00, 0xfd, 0xe7,
3815 0xf3, 0xcc, 0xc9, 0xeb, 0x93, 0xd4, 0xdd, 0x00, 0x3b, 0xf4, 0x60, 0x0e, 3786 0xe2, 0x6b, 0x31, 0xd6, 0x8c, 0x87, 0xb1, 0xa6, 0x3f, 0x20, 0xc6, 0xe2,
3816 0xeb, 0x08, 0xc8, 0xc8, 0x3b, 0x27, 0x53, 0x67, 0x64, 0x45, 0xf7, 0x93, 3787 0x58, 0x39, 0x3c, 0x33, 0x3e, 0x1f, 0x91, 0x5d, 0x90, 0xf3, 0x58, 0x91,
3817 0x7a, 0x69, 0x29, 0x83, 0x71, 0xf6, 0xa4, 0xf1, 0xbd, 0xaa, 0x2b, 0xec, 3788 0xfa, 0xe2, 0x19, 0xb2, 0xf7, 0xd2, 0x19, 0xf5, 0xe5, 0xea, 0x2a, 0x10,
3818 0x7f, 0x31, 0x74, 0x58, 0x1a, 0xd5, 0x16, 0xe8, 0x45, 0x8e, 0xdd, 0x7b, 3789 0xdb, 0xa7, 0x8d, 0x43, 0x57, 0x63, 0xef, 0xa9, 0x2b, 0x31, 0xdf, 0x18,
3819 0x58, 0x6a, 0xd5, 0x79, 0x79, 0xa1, 0xba, 0xb1, 0x0b, 0xd8, 0x09, 0x32, 3790 0x09, 0xe2, 0xf3, 0xf7, 0xa5, 0x2b, 0xce, 0x83, 0xfa, 0x5a, 0x8f, 0xc5,
3820 0x25, 0xfd, 0x3d, 0x3e, 0xfd, 0x54, 0x41, 0x30, 0x0e, 0x79, 0x9e, 0x2e, 3791 0xee, 0x07, 0x93, 0xad, 0xc5, 0x63, 0xb6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bd, 0xad, 0x39, 0x65, 3806 0x0c, 0x4a, 0xaa, 0xfe, 0x12, 0xf4, 0xf8, 0x1c, 0x74, 0x7b, 0x58, 0x0a,
3836 0xf5, 0x8e, 0x39, 0xf4, 0xd2, 0xd2, 0xe6, 0x21, 0x37, 0x3c, 0x3f, 0xc3, 3807 0xd5, 0x3f, 0x95, 0xd9, 0x79, 0x4d, 0xba, 0x2c, 0xe8, 0xb4, 0x0a, 0x5b,
3837 0x04, 0xa8, 0x5b, 0x83, 0x09, 0x47, 0x72, 0xec, 0x71, 0x49, 0x7e, 0x59, 3808 0x9e, 0x77, 0xf7, 0x13, 0x3b, 0x13, 0x7b, 0xd1, 0xb7, 0x29, 0x4f, 0xc5,
3838 0xf6, 0x65, 0x10, 0x47, 0xed, 0x99, 0x0e, 0x99, 0x6f, 0x18, 0xce, 0xe0, 3809 0x9f, 0x13, 0xfd, 0xb1, 0x39, 0xf4, 0x13, 0xbd, 0x30, 0xfc, 0x31, 0xb5,
3839 0xe2, 0x51, 0xac, 0x31, 0x87, 0xb5, 0xa6, 0x51, 0x83, 0xcc, 0x22, 0x27, 3810 0x6f, 0x56, 0x8d, 0xbb, 0x32, 0xde, 0x65, 0xd9, 0x51, 0xe8, 0x7c, 0xf0,
3840 0x53, 0xae, 0x8c, 0xd5, 0x0f, 0x43, 0x46, 0x37, 0xf1, 0xcc, 0x78, 0x3c, 3811 0x18, 0x68, 0x27, 0xd5, 0xd9, 0xd8, 0x8c, 0x1c, 0x3d, 0xbd, 0xbc, 0xc5,
3841 0x27, 0xe6, 0x4c, 0x41, 0xad, 0xfb, 0x9e, 0x96, 0x1f, 0xfd, 0x18, 0x72, 3812 0xf5, 0xad, 0x51, 0xf3, 0x26, 0xf5, 0x8e, 0x79, 0xd8, 0xf0, 0x85, 0x19,
3842 0x5a, 0x58, 0x0e, 0x24, 0x45, 0x9f, 0x4e, 0x86, 0xdf, 0x9f, 0xb3, 0x38, 3813 0xd8, 0xfb, 0x41, 0x27, 0xa0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,
3850 0xf6, 0x7a, 0xa5, 0xb0, 0xf3, 0x5b, 0x87, 0xa6, 0x77, 0x7b, 0xfd, 0x00, 3821 0x29, 0xba, 0xd1, 0x87, 0x79, 0x05, 0x64, 0xe4, 0xee, 0x9f, 0xa9, 0xbd,
3851 0x9e, 0x67, 0x8c, 0x62, 0xec, 0x4a, 0x6b, 0xc5, 0xe2, 0x18, 0xef, 0x5d, 3822 0xb3, 0x82, 0x33, 0x0a, 0x39, 0x25, 0xd1, 0xce, 0x5a, 0x35, 0x7e, 0x97,
3852 0x69, 0xd5, 0xad, 0x11, 0x23, 0xab, 0x45, 0xfd, 0x73, 0xed, 0x79, 0xc5, 3823 0x75, 0x55, 0x13, 0x58, 0x31, 0x66, 0xa4, 0x56, 0x6e, 0x82, 0x5f, 0xc4,
3853 0x7b, 0xa1, 0x3a, 0x68, 0xd4, 0xe4, 0x16, 0x2d, 0x7b, 0x03, 0xf2, 0x83, 3824 0xdc, 0x2d, 0x33, 0x52, 0x29, 0x4f, 0xcb, 0x2b, 0xe5, 0x9f, 0x77, 0x03,
3854 0xfb, 0x19, 0xcc, 0xbd, 0xd2, 0xca, 0x58, 0xf3, 0xaa, 0x7f, 0x5f, 0x93, 3825 0x53, 0x41, 0xa6, 0xe4, 0xbf, 0x5b, 0xee, 0x9e, 0xbf, 0xf5, 0xdb, 0x21,
3855 0xe0, 0x9a, 0xeb, 0x8c, 0x18, 0x93, 0xea, 0xd9, 0x11, 0xe3, 0x84, 0xd6, 3826 0xcf, 0xd3, 0xf9, 0xb0, 0x9b, 0xe7, 0xe6, 0x55, 0x2d, 0xc6, 0xfd, 0xb6,
3856 0xfe, 0xac, 0xa1, 0x4d, 0x6e, 0x7b, 0xb6, 0x5b, 0xc9, 0x28, 0x64, 0x79, 3827 0xf5, 0x29, 0x2b, 0x1a, 0x9e, 0x45, 0xcf, 0x83, 0x0b, 0xb4, 0xcd, 0xfc,
3857 0x73, 0x4a, 0xd5, 0x69, 0x79, 0xda, 0xe5, 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, 0x75, 0x73, 0xb7, 0x5b, 0x6f, 0x89, 0x9a, 0xb6, 0xc6, 0xf7,
3865 0x98, 0xdb, 0xa0, 0xa7, 0x7d, 0xcf, 0xc0, 0x67, 0x47, 0x6d, 0x35, 0xe7, 3836 0x52, 0xdc, 0xf5, 0x98, 0xc1, 0xba, 0xba, 0xb4, 0x8a, 0xa1, 0x61, 0xa4,
3866 0x92, 0x35, 0x2d, 0xfb, 0x4e, 0x0d, 0x1a, 0x97, 0x10, 0xdb, 0x9c, 0x18, 3837 0x2f, 0x5f, 0x81, 0x7e, 0x03, 0xd2, 0x7e, 0xb2, 0xf9, 0xf8, 0x54, 0x7c,
3867 0xaf, 0x51, 0x2b, 0x59, 0x7c, 0x27, 0xfe, 0x4e, 0xd6, 0x01, 0xd0, 0xe5, 3838 0x28, 0x72, 0x50, 0x78, 0x02, 0x8b, 0x79, 0x75, 0x34, 0x9e, 0x95, 0x2b,
3868 0xe0, 0xf0, 0xcf, 0xe4, 0xa8, 0x9c, 0xa8, 0x1c, 0x43, 0x2e, 0x9c, 0x93, 3839 0x88, 0x93, 0x77, 0x88, 0x1d, 0x06, 0x2f, 0xcb, 0x9d, 0xc7, 0x93, 0xf1,
3869 0xe1, 0x67, 0x90, 0x37, 0x2a, 0x05, 0x3c, 0x49, 0x9f, 0xf5, 0x72, 0xe0, 3840 0x51, 0xad, 0x32, 0x89, 0xac, 0xe5, 0xe5, 0x49, 0xc6, 0xd9, 0x43, 0x22,
3870 0x9c, 0x7a, 0xcf, 0xfc, 0x24, 0xea, 0x64, 0xd8, 0x6e, 0x79, 0x70, 0x78, 3841 0xc0, 0x97, 0x27, 0x47, 0x24, 0x5d, 0x54, 0xef, 0xa9, 0xf0, 0x9c, 0xad,
3871 0x05, 0xcf, 0xbc, 0xa0, 0x70, 0xa8, 0x2b, 0x0d, 0xf8, 0x40, 0xe2, 0xf9, 3842 0x36, 0x0d, 0xf9, 0xe1, 0xf9, 0x09, 0x06, 0x46, 0xdd, 0xea, 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xcf, 0x1b, 0xb7, 0xf1, 0xf9, 0x14, 0x62, 3850 0xac, 0x29, 0xee, 0x4d, 0x3c, 0x20, 0x5d, 0x7b, 0xa5, 0xe7, 0x42, 0x74,
3880 0xea, 0xd0, 0x90, 0xc7, 0xeb, 0xab, 0x4b, 0x1f, 0xce, 0xeb, 0x37, 0x37, 3851 0xf4, 0x06, 0x78, 0x09, 0x28, 0x5f, 0x3f, 0x25, 0xba, 0xd7, 0xde, 0xbd,
3881 0x79, 0x0d, 0x49, 0x43, 0xd5, 0xaf, 0x5d, 0xbd, 0xd2, 0x8d, 0xa8, 0x07, 3852 0xda, 0x1e, 0xf0, 0xda, 0xf7, 0x4a, 0xd7, 0x85, 0x21, 0xf3, 0x75, 0x99,
3882 0x7b, 0xf8, 0x09, 0xf6, 0x9a, 0x12, 0xd2, 0xe0, 0xed, 0xb7, 0xe1, 0x92, 3853 0x01, 0x4d, 0x43, 0xae, 0x23, 0xd7, 0xb1, 0x06, 0xa6, 0x60, 0x8b, 0x4f,
3883 0x96, 0x80, 0x76, 0xd2, 0x73, 0x9f, 0xaf, 0x2f, 0xee, 0x7f, 0x74, 0xc7, 3854 0x92, 0x97, 0xfd, 0xc0, 0x1a, 0x58, 0x1b, 0xc8, 0xbf, 0xad, 0x0f, 0xcb,
3884 0x7b, 0x97, 0xc4, 0x70, 0x86, 0x31, 0xa6, 0x2b, 0x9d, 0x65, 0x7d, 0xff, 3855 0x57, 0xcd, 0x4e, 0xc9, 0xa9, 0x5c, 0x37, 0xe0, 0xd6, 0x52, 0x61, 0xef,
3885 0x9a, 0x16, 0x5d, 0xe9, 0xcc, 0xde, 0xd4, 0xd9, 0xeb, 0xd0, 0x59, 0x5d, 3856 0x8f, 0x0e, 0x1c, 0xec, 0x71, 0xeb, 0x05, 0xdc, 0xef, 0x18, 0x46, 0xdb,
3886 0x7e, 0x13, 0xbc, 0xc0, 0x9f, 0x9f, 0x19, 0x31, 0x0e, 0x13, 0x5b, 0x18, 3857 0x9d, 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886 0x0c, 0xb8, 0x73, 0x7e, 0x6d, 0xfe, 0xfd, 0xcf, 0xf9, 0x77, 0x57, 0xe7,
3916 0xce, 0x46, 0x72, 0x88, 0x7d, 0xb7, 0x3e, 0x69, 0x2c, 0x4b, 0x22, 0x94, 3887 0x6c, 0x48, 0x55, 0xe5, 0xb9, 0xb1, 0xcd, 0xd2, 0x95, 0x93, 0x06, 0xec,
3917 0x7e, 0x48, 0xdc, 0x86, 0x87, 0xb9, 0x17, 0x34, 0xf6, 0xdf, 0x6c, 0x69, 3888 0xe3, 0xcf, 0x85, 0x67, 0xc6, 0xc9, 0x8b, 0x3b, 0xee, 0xb2, 0x43, 0x9e,
3918 0x6c, 0x9f, 0x63, 0x84, 0xd2, 0x87, 0xe4, 0x0f, 0xfc, 0x39, 0x8e, 0x9a, 3889 0xfc, 0x39, 0x90, 0xaf, 0x29, 0x4f, 0x7f, 0xe4, 0xe3, 0xd9, 0x0d, 0xef,
3919 0xf3, 0x1f, 0x76, 0xf3, 0xec, 0xab, 0xe1, 0xf6, 0x82, 0x06, 0xd2, 0x76, 3890 0x5d, 0x97, 0x46, 0x66, 0x10, 0x6d, 0xba, 0xd2, 0xe1, 0x98, 0xb7, 0xde,
3920 0x63, 0xfb, 0xbe, 0x89, 0xad, 0x7d, 0xb9, 0x27, 0x6a, 0x98, 0xbd, 0x36, 3891 0xf6, 0x8a, 0xae, 0x74, 0x98, 0x5c, 0xd5, 0xe1, 0x0d, 0xe8, 0xb0, 0x2a,
3921 0xf6, 0x7d, 0x15, 0xcf, 0x3c, 0x04, 0x3a, 0xae, 0x84, 0x74, 0xeb, 0x21, 3892 0x9f, 0xc6, 0x9c, 0xb0, 0xbe, 0x5f, 0x18, 0x32, 0x67, 0x64, 0xab, 0xd2,
3922 0x29, 0x36, 0xae, 0xde, 0xa3, 0x9d, 0x06, 0x3e, 0xc3, 0xf5, 0xb9, 0xcf, 3893 0xbf, 0x35, 0x00, 0x9f, 0xea, 0xe9, 0xb2, 0xfd, 0x3e, 0x74, 0xf9, 0xba,
3923 0x21, 0xd0, 0x77, 0x45, 0xd3, 0xad, 0x43, 0x90, 0xa5, 0xb7, 0x47, 0xe8, 3894 0x28, 0x7d, 0xaa, 0x73, 0x44, 0x55, 0x45, 0x87, 0xbe, 0x8d, 0x73, 0x6b,
3924 0x39, 0xd3, 0xf8, 0xa1, 0x0c, 0x89, 0xbe, 0xa2, 0x29, 0xf9, 0xeb, 0xb5, 3895 0x57, 0x3e, 0x81, 0x3c, 0xaa, 0xb3, 0x01, 0x13, 0xae, 0x7e, 0xd5, 0x9a,
3925 0x51, 0x38, 0xc4, 0x94, 0x74, 0xaf, 0xcd, 0x4a, 0x68, 0x8d, 0x3d, 0x00, 3896 0xf7, 0xf4, 0x9b, 0x9d, 0xa0, 0x0e, 0x7f, 0xad, 0xc7, 0xd5, 0x67, 0x87,
3926 0xda, 0x22, 0xf5, 0xb8, 0x0b, 0x7e, 0x2c, 0x76, 0xd8, 0x22, 0xde, 0x67, 3897 0xea, 0x73, 0x2a, 0x36, 0xaa, 0xd6, 0xbb, 0x35, 0xf0, 0xe9, 0x1e, 0xea,
3927 0x1f, 0x77, 0xb5, 0x57, 0x7a, 0x89, 0xf7, 0x59, 0x0f, 0x1c, 0xc4, 0x7f, 3898 0xf4, 0x79, 0xc7, 0xfd, 0x2e, 0x22, 0xce, 0x9d, 0x72, 0xde, 0x4b, 0xaf,
3928 0xd6, 0x04, 0x2f, 0xb5, 0x32, 0xa9, 0x77, 0x54, 0xde, 0xcc, 0x37, 0x78, 3899 0xae, 0x4e, 0xc7, 0xc4, 0x5d, 0x57, 0xeb, 0xf5, 0xa9, 0x5f, 0x08, 0x28,
3929 0xdf, 0x4c, 0x88, 0xf0, 0x1e, 0xe3, 0x43, 0x9f, 0x44, 0xbe, 0x3e, 0x8c, 3900 0x1b, 0x1e, 0x83, 0x0c, 0x8f, 0x97, 0x1e, 0xf4, 0xec, 0xde, 0x9d, 0xf3,
3930 0x98, 0x90, 0x03, 0x76, 0xc6, 0xba, 0xa7, 0x86, 0x24, 0xec, 0xbd, 0xeb, 3901 0xc0, 0xfb, 0x9c, 0xf3, 0x91, 0x62, 0xbf, 0xf9, 0x26, 0xee, 0x8d, 0x63,
3931 0xa0, 0xfa, 0x25, 0x6f, 0x2d, 0x9b, 0xfe, 0xef, 0x53, 0x64, 0xdf, 0xf9, 3902 0xce, 0x33, 0xd2, 0x26, 0x29, 0x6f, 0xce, 0x91, 0xd5, 0x39, 0xfb, 0x3c,
3932 0x14, 0x7b, 0x9a, 0x03, 0xb0, 0x53, 0xd6, 0x23, 0xa2, 0x6f, 0xa0, 0xde, 3903 0xba, 0xfd, 0x52, 0xcc, 0x63, 0x1d, 0xfa, 0xaf, 0x7f, 0xab, 0xde, 0x37,
3933 0xbc, 0xd4, 0x88, 0xf6, 0xf2, 0x7d, 0xcb, 0xd7, 0x5d, 0x5c, 0x13, 0xbb, 3904 0xb9, 0x59, 0xa4, 0xdf, 0x06, 0x56, 0x0a, 0xf5, 0xca, 0xf5, 0x5a, 0x44,
3934 0xc7, 0x14, 0x56, 0xf4, 0xef, 0xf1, 0x3b, 0xea, 0xa0, 0x6d, 0x98, 0x32, 3905 0xae, 0x13, 0x83, 0x8c, 0xe0, 0xdb, 0x99, 0xf3, 0x62, 0x78, 0x50, 0x5e,
3935 0x01, 0x4c, 0xc9, 0x3a, 0x69, 0xca, 0x7f, 0xe7, 0xcd, 0x70, 0x4e, 0x6c, 3906 0x2f, 0x6e, 0xc4, 0xc7, 0xb0, 0xdc, 0x28, 0xfa, 0xbc, 0x10, 0x0b, 0x33,
3936 0xab, 0x95, 0x86, 0x65, 0x03, 0x38, 0x6b, 0xdd, 0xb5, 0x10, 0x07, 0xdf, 3907 0x5f, 0x98, 0x92, 0x37, 0xe6, 0xfb, 0xa5, 0x31, 0x81, 0xb8, 0x3f, 0x40,
3937 0xd6, 0xea, 0x65, 0xf5, 0xbb, 0x34, 0xed, 0x01, 0x60, 0xac, 0x44, 0x9f, 3908 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 0x3e, 0x81, 0x7c, 0x81,
3945 0x41, 0x80, 0x5a, 0x1b, 0x12, 0x59, 0x81, 0xbf, 0xc2, 0x77, 0xc3, 0x6b, 3916 0xb9, 0xea, 0x04, 0xf0, 0x1a, 0x65, 0x12, 0x91, 0xd9, 0x22, 0x69, 0x49,
3946 0xd4, 0x01, 0x65, 0x3b, 0x2b, 0x11, 0xc8, 0x9e, 0x58, 0x22, 0xb4, 0x48, 3917 0x68, 0x13, 0xf2, 0xfb, 0x9c, 0x8c, 0x83, 0x9f, 0x08, 0x72, 0x7b, 0xc6,
3947 0x19, 0xc7, 0x61, 0x17, 0x5c, 0x07, 0x32, 0xe6, 0xbb, 0x2c, 0xcb, 0x1d, 3918 0x87, 0x47, 0x65, 0x39, 0xe4, 0xc6, 0x01, 0x9e, 0xfb, 0x5a, 0x46, 0x6c,
3948 0xf2, 0x4c, 0xc3, 0xf4, 0xdf, 0x3d, 0x7f, 0x89, 0xef, 0xa3, 0xeb, 0x73, 3919 0x58, 0x5e, 0x8d, 0x0d, 0x5b, 0x71, 0xdd, 0xc8, 0xc4, 0x07, 0xfe, 0x06,
3949 0x63, 0x03, 0xc4, 0x4f, 0x52, 0x6a, 0x00, 0x63, 0x9c, 0x66, 0x0d, 0xce, 3920 0xf4, 0x59, 0xb7, 0x61, 0x6c, 0x18, 0x45, 0x7f, 0xb6, 0xf5, 0xca, 0xec,
3950 0x18, 0x50, 0x88, 0x47, 0x94, 0xaf, 0xb3, 0x06, 0xf6, 0x7c, 0x9f, 0xf8, 3921 0x02, 0x92, 0x08, 0xe4, 0x2c, 0x15, 0xe1, 0x99, 0x8e, 0xac, 0x9c, 0xaa,
3951 0x3a, 0x62, 0x11, 0xdb, 0x8e, 0x62, 0x8f, 0x9d, 0xe4, 0xea, 0xd5, 0x9e, 3922 0xf5, 0x87, 0x2f, 0x6b, 0x69, 0x75, 0xf6, 0x23, 0x36, 0xc0, 0xf3, 0x2c,
3952 0x93, 0xa0, 0xf3, 0xfc, 0x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x7b, 0x66, 0x42, 0xd5, 0x5b, 0xde,
3967 0x6a, 0xb5, 0x1c, 0xd4, 0x59, 0xa5, 0xd1, 0x79, 0x75, 0x46, 0xaa, 0xa7, 3938 0x58, 0x88, 0x7a, 0xef, 0x73, 0xc9, 0xb6, 0xcb, 0x71, 0xd6, 0x44, 0xfb,
3968 0xbf, 0x71, 0x6f, 0xc6, 0x2a, 0xc4, 0xc3, 0x0a, 0x7b, 0xa0, 0x92, 0x82, 3939 0x58, 0xf3, 0x41, 0x3f, 0xd1, 0x97, 0x91, 0x9f, 0x5e, 0xaf, 0x59, 0x9b,
3969 0x1d, 0x16, 0xc4, 0xc3, 0xdc, 0x3c, 0xb7, 0xf3, 0xce, 0xf5, 0xba, 0xa1, 3940 0x79, 0x7e, 0xf3, 0x86, 0x83, 0x6b, 0x62, 0xff, 0x90, 0xc2, 0x98, 0xde,
3970 0xc3, 0x1c, 0x72, 0x86, 0x91, 0x39, 0x67, 0x49, 0x61, 0xdf, 0x6f, 0xea, 3941 0x3d, 0xfe, 0x46, 0xbe, 0xf4, 0x8e, 0x77, 0x13, 0x98, 0x4f, 0x4d, 0x7a,
3971 0xb0, 0xf3, 0x5e, 0xe4, 0x87, 0x9f, 0xc0, 0x66, 0x8c, 0x4c, 0xbd, 0x91, 3942 0x67, 0xe7, 0x1a, 0x99, 0xa3, 0x6b, 0x72, 0xaa, 0x41, 0x55, 0xef, 0x6d,
3972 0x43, 0xbd, 0xc3, 0xf9, 0x77, 0x40, 0x8f, 0x85, 0x4c, 0xad, 0x51, 0xc8, 3943 0x38, 0x16, 0xfc, 0xe3, 0x08, 0xec, 0x93, 0x6b, 0xa0, 0xa9, 0x3d, 0x01,
3973 0x9c, 0xe5, 0x79, 0x0e, 0xe6, 0xd5, 0x1a, 0x3d, 0x90, 0x7b, 0x8f, 0xea, 3944 0x6c, 0x16, 0xe9, 0x55, 0x39, 0xd1, 0xf1, 0x27, 0xc4, 0xb5, 0x77, 0x58,
3974 0x8b, 0xbc, 0x5c, 0x8e, 0x31, 0x06, 0xc1, 0xd6, 0x63, 0x18, 0x8b, 0xab, 3945 0x99, 0xf2, 0x65, 0x8d, 0xb2, 0x9b, 0x83, 0x2c, 0x97, 0x33, 0xf2, 0x47,
3975 0xdf, 0x68, 0xd5, 0xdd, 0x65, 0xf8, 0x74, 0x02, 0xe3, 0xd5, 0xae, 0x49, 3946 0xce, 0x15, 0x55, 0x6b, 0x9d, 0x47, 0x5e, 0x12, 0x38, 0xa5, 0x72, 0xb2,
3976 0x85, 0x47, 0x2d, 0x59, 0x71, 0x7f, 0xa5, 0x15, 0xcb, 0x97, 0xb5, 0x52, 3947 0x16, 0x7c, 0x0b, 0xbf, 0xf7, 0xe2, 0xd7, 0xb1, 0x16, 0xa3, 0xea, 0x8c,
3977 0x79, 0x18, 0x73, 0x46, 0xf9, 0x5b, 0x9f, 0x3d, 0xc0, 0x49, 0x53, 0xd5, 3948 0x82, 0x7e, 0xae, 0xd9, 0x4c, 0xc1, 0x7f, 0xe8, 0x96, 0x65, 0x16, 0x10,
3978 0x1d, 0x69, 0x4a, 0x80, 0x26, 0xbd, 0x8d, 0xa6, 0x04, 0xe8, 0x41, 0xcc, 3949 0x0f, 0x53, 0xea, 0x9c, 0x0b, 0xd7, 0xf1, 0x6f, 0x2b, 0xff, 0x2c, 0x15,
3979 0x3c, 0xc5, 0xde, 0xf1, 0xa8, 0x9c, 0x28, 0xf3, 0x9d, 0x26, 0xfe, 0x46, 3950 0xc8, 0xe6, 0x4c, 0x04, 0x74, 0x34, 0x65, 0x9f, 0x86, 0xd2, 0xc3, 0x13,
3980 0xd5, 0x90, 0x30, 0xb0, 0x65, 0xe4, 0x94, 0x19, 0x5f, 0x57, 0xbd, 0x1a, 3951 0x0a, 0xf3, 0x1a, 0xe7, 0xe0, 0xb0, 0x96, 0x06, 0x44, 0xce, 0x65, 0x64,
3981 0x73, 0xb8, 0x2e, 0x23, 0xa9, 0xba, 0xa8, 0xfc, 0x92, 0x38, 0x81, 0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xd8, 0x7d, 0x84, 0xbf, 4003 0x22, 0xf7, 0xda, 0x62, 0xe0, 0x69, 0x9f, 0x96, 0xae, 0x76, 0x81, 0xc6,
4033 0x65, 0xc0, 0xdf, 0x23, 0xb0, 0x13, 0xf8, 0xc1, 0xe6, 0x38, 0xaf, 0x59, 4004 0x00, 0x9e, 0xa7, 0x4d, 0xed, 0xf7, 0xc6, 0x67, 0xcd, 0xe9, 0x63, 0xaa,
4034 0x4b, 0x04, 0xd7, 0x4c, 0x58, 0xff, 0x1b, 0xed, 0xcc, 0xfa, 0xa1, 0x98, 4005 0xe6, 0x64, 0x24, 0x32, 0xc0, 0xc9, 0x87, 0x91, 0x07, 0x68, 0x92, 0xb6,
4035 0x41, 0x00, 0x00, 0x00 }; 4006 0x9e, 0x93, 0x42, 0x1c, 0x7e, 0xa5, 0x6a, 0x48, 0x2a, 0x94, 0xc7, 0xef,
4036static u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = { 4007 0xbc, 0x24, 0x47, 0x71, 0xbf, 0x4a, 0x5b, 0x60, 0xbf, 0x3f, 0x95, 0x42,
4008 0x99, 0xb8, 0x9f, 0x75, 0x26, 0xd6, 0xa6, 0x58, 0x5f, 0xca, 0x41, 0x06,
4009 0x21, 0xda, 0xef, 0x06, 0x35, 0x31, 0xf7, 0x8c, 0x34, 0xe2, 0xb2, 0x96,
4010 0xac, 0x72, 0xdf, 0xaf, 0x91, 0xb9, 0x6c, 0xf1, 0xfd, 0xb1, 0x69, 0xee,
4011 0x23, 0x16, 0x8c, 0x04, 0xeb, 0x23, 0xaa, 0xbe, 0x1e, 0x77, 0xf7, 0x07,
4012 0x5b, 0xcf, 0xa4, 0xf8, 0xeb, 0x85, 0xe3, 0x7e, 0x0d, 0xcf, 0xbb, 0xf5,
4013 0xac, 0x54, 0xfd, 0x9d, 0xba, 0xe0, 0x3b, 0x00, 0xe7, 0xa0, 0x8b, 0xcb,
4014 0x2a, 0x37, 0xe6, 0x1e, 0xee, 0xbb, 0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, 0xd5, 0x50, 0x99, 0x57, 0xbb, 0x76, 0x79, 0x16, 0xb1, 0xb0, 0x5c,
4030 0x76, 0x73, 0xec, 0xb2, 0xc3, 0x5a, 0xf6, 0xbb, 0xf1, 0xc0, 0x77, 0xb9,
4031 0xbe, 0xa8, 0xce, 0xbb, 0xcc, 0x3a, 0x6e, 0xdd, 0xab, 0x5c, 0x6e, 0x8d,
4032 0xa9, 0x0f, 0x32, 0x9e, 0x0e, 0xe6, 0x65, 0x82, 0xef, 0x94, 0xe3, 0xfa,
4033 0x11, 0xb9, 0xb2, 0xa0, 0xf6, 0xac, 0xbc, 0xbd, 0x21, 0xee, 0xf9, 0xa8,
4034 0xfd, 0x6f, 0xf8, 0xb5, 0x49, 0xe5, 0xd7, 0x97, 0x17, 0xd4, 0x3d, 0x17,
4035 0x2b, 0x39, 0x13, 0xf0, 0xfb, 0xc8, 0x25, 0xac, 0x07, 0xa4, 0x80, 0x9c,
4036 0xfb, 0xac, 0x75, 0x78, 0x0b, 0x71, 0x0e, 0x69, 0x2d, 0x83, 0xd6, 0xe5,
4037 0x05, 0xd9, 0xc2, 0x33, 0x25, 0x65, 0xb5, 0xcf, 0xe6, 0xd6, 0xc5, 0xa7,
4038 0xc5, 0xff, 0x7f, 0x1d, 0x41, 0x2f, 0x16, 0xf2, 0x5c, 0x0b, 0xdf, 0x73,
4039 0xa6, 0xaf, 0x40, 0x1e, 0x34, 0xc1, 0x7d, 0x9c, 0x66, 0xd3, 0xad, 0x9b,
4040 0x37, 0xb1, 0x2e, 0xda, 0xf8, 0x0e, 0x05, 0xfe, 0x0e, 0xc3, 0x7e, 0xb0,
4041 0x4e, 0x56, 0xdb, 0x79, 0xcd, 0xdc, 0xc3, 0xbf, 0x66, 0x60, 0xfb, 0x3f,
4042 0xe8, 0xf3, 0x49, 0x14, 0x38, 0x46, 0x00, 0x00, 0x00 };
4043
4044static const u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = {
4037 0x00000000, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000010, 4045 0x00000000, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000010,
4038 0x00000030, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 4046 0x00000030, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x00000010,
4039 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00008002, 0x00000000, 4047 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00008002, 0x00000000,
@@ -4043,42 +4051,42 @@ static u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = {
4043 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 4051 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
4044 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4052 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4045 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; 4053 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
4046static u32 bnx2_TXP_b09FwRodata[(0x30/4) + 1] = { 4054static const u32 bnx2_TXP_b09FwRodata[(0x30/4) + 1] = {
4047 0x08003be8, 0x08003c14, 0x08003c5c, 0x08003c5c, 0x08003ae8, 0x08003b14, 4055 0x08004060, 0x0800408c, 0x080040d4, 0x080040d4, 0x08003f60, 0x08003f8c,
4048 0x08003b14, 0x08003c5c, 0x08003c5c, 0x08003c5c, 0x08003b7c, 0x00000000, 4056 0x08003f8c, 0x080040d4, 0x080040d4, 0x080040d4, 0x08003ff4, 0x00000000,
4049 0x00000000 }; 4057 0x00000000 };
4050static u32 bnx2_TXP_b09FwBss[(0xa20/4) + 1] = { 0x0 }; 4058static const u32 bnx2_TXP_b09FwBss[(0xa20/4) + 1] = { 0x0 };
4051static u32 bnx2_TXP_b09FwSbss[(0x80/4) + 1] = { 0x0 }; 4059static const u32 bnx2_TXP_b09FwSbss[(0x8c/4) + 1] = { 0x0 };
4052 4060
4053static struct fw_info bnx2_txp_fw_09 = { 4061static struct fw_info bnx2_txp_fw_09 = {
4054 .ver_major = 0x1, 4062 .ver_major = 0x3,
4055 .ver_minor = 0x0, 4063 .ver_minor = 0x4,
4056 .ver_fix = 0x0, 4064 .ver_fix = 0x3,
4057 4065
4058 .start_addr = 0x08000060, 4066 .start_addr = 0x08000060,
4059 4067
4060 .text_addr = 0x08000000, 4068 .text_addr = 0x08000000,
4061 .text_len = 0x4194, 4069 .text_len = 0x4634,
4062 .text_index = 0x0, 4070 .text_index = 0x0,
4063 .gz_text = bnx2_TXP_b09FwText, 4071 .gz_text = bnx2_TXP_b09FwText,
4064 .gz_text_len = sizeof(bnx2_TXP_b09FwText), 4072 .gz_text_len = sizeof(bnx2_TXP_b09FwText),
4065 4073
4066 .data_addr = 0x080041e0, 4074 .data_addr = 0x08004680,
4067 .data_len = 0xd0, 4075 .data_len = 0xd0,
4068 .data_index = 0x0, 4076 .data_index = 0x0,
4069 .data = bnx2_TXP_b09FwData, 4077 .data = bnx2_TXP_b09FwData,
4070 4078
4071 .sbss_addr = 0x080042b0, 4079 .sbss_addr = 0x08004750,
4072 .sbss_len = 0x80, 4080 .sbss_len = 0x8c,
4073 .sbss_index = 0x0, 4081 .sbss_index = 0x0,
4074 .sbss = bnx2_TXP_b09FwSbss, 4082 .sbss = bnx2_TXP_b09FwSbss,
4075 4083
4076 .bss_addr = 0x08004330, 4084 .bss_addr = 0x080047e0,
4077 .bss_len = 0xa20, 4085 .bss_len = 0xa20,
4078 .bss_index = 0x0, 4086 .bss_index = 0x0,
4079 .bss = bnx2_TXP_b09FwBss, 4087 .bss = bnx2_TXP_b09FwBss,
4080 4088
4081 .rodata_addr = 0x08004198, 4089 .rodata_addr = 0x08004638,
4082 .rodata_len = 0x30, 4090 .rodata_len = 0x30,
4083 .rodata_index = 0x0, 4091 .rodata_index = 0x0,
4084 .rodata = bnx2_TXP_b09FwRodata, 4092 .rodata = bnx2_TXP_b09FwRodata,
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index 042e27e291cd..b112317f033e 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -38,7 +38,7 @@
38#define DRV_VERSION "1.0-ko" 38#define DRV_VERSION "1.0-ko"
39 39
40/* Firmware version */ 40/* Firmware version */
41#define FW_VERSION_MAJOR 3 41#define FW_VERSION_MAJOR 4
42#define FW_VERSION_MINOR 3 42#define FW_VERSION_MINOR 0
43#define FW_VERSION_MICRO 0 43#define FW_VERSION_MICRO 0
44#endif /* __CHELSIO_VERSION_H */ 44#endif /* __CHELSIO_VERSION_H */
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index e824d5d231af..88efe9731bab 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -19,7 +19,6 @@
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/pci.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/netdevice.h> 24#include <linux/netdevice.h>
diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c
index e79700abf7b6..b3fa0d6a159c 100644
--- a/drivers/net/fec_8xx/fec_mii.c
+++ b/drivers/net/fec_8xx/fec_mii.c
@@ -19,7 +19,6 @@
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/pci.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/netdevice.h> 24#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index e2ddd617493a..a4a2a0ea43d3 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -24,7 +24,6 @@
24#include <linux/ioport.h> 24#include <linux/ioport.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/pci.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 8545e84fc9a0..5603121132cd 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -21,7 +21,6 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/pci.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index cdcfb96f360f..04b4f80a1cde 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -21,7 +21,6 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/pci.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 65925b5a224f..d0f28981b55a 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -21,7 +21,6 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/pci.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index f91447837fd4..d3840108ffbd 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -22,7 +22,6 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/pci.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/netdevice.h> 27#include <linux/netdevice.h>
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 235b177fb9ac..0a563a83016f 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -21,7 +21,6 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/pci.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 3d82d46f4998..50035ebd4f52 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/pci.h>
31#include <linux/netdevice.h> 30#include <linux/netdevice.h>
32#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
33#include <linux/skbuff.h> 32#include <linux/skbuff.h>
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index fb196fd91855..55ff0fbe525a 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -134,7 +134,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
134 DCSR(si->rxdma) &= ~DCSR_RUN; 134 DCSR(si->rxdma) &= ~DCSR_RUN;
135 /* disable FICP */ 135 /* disable FICP */
136 ICCR0 = 0; 136 ICCR0 = 0;
137 pxa_set_cken(CKEN13_FICP, 0); 137 pxa_set_cken(CKEN_FICP, 0);
138 138
139 /* set board transceiver to SIR mode */ 139 /* set board transceiver to SIR mode */
140 si->pdata->transceiver_mode(si->dev, IR_SIRMODE); 140 si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
@@ -144,7 +144,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
144 pxa_gpio_mode(GPIO47_STTXD_MD); 144 pxa_gpio_mode(GPIO47_STTXD_MD);
145 145
146 /* enable the STUART clock */ 146 /* enable the STUART clock */
147 pxa_set_cken(CKEN5_STUART, 1); 147 pxa_set_cken(CKEN_STUART, 1);
148 } 148 }
149 149
150 /* disable STUART first */ 150 /* disable STUART first */
@@ -169,7 +169,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
169 /* disable STUART */ 169 /* disable STUART */
170 STIER = 0; 170 STIER = 0;
171 STISR = 0; 171 STISR = 0;
172 pxa_set_cken(CKEN5_STUART, 0); 172 pxa_set_cken(CKEN_STUART, 0);
173 173
174 /* disable FICP first */ 174 /* disable FICP first */
175 ICCR0 = 0; 175 ICCR0 = 0;
@@ -182,7 +182,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
182 pxa_gpio_mode(GPIO47_ICPTXD_MD); 182 pxa_gpio_mode(GPIO47_ICPTXD_MD);
183 183
184 /* enable the FICP clock */ 184 /* enable the FICP clock */
185 pxa_set_cken(CKEN13_FICP, 1); 185 pxa_set_cken(CKEN_FICP, 1);
186 186
187 si->speed = speed; 187 si->speed = speed;
188 pxa_irda_fir_dma_rx_start(si); 188 pxa_irda_fir_dma_rx_start(si);
@@ -593,7 +593,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
593 /* disable STUART SIR mode */ 593 /* disable STUART SIR mode */
594 STISR = 0; 594 STISR = 0;
595 /* disable the STUART clock */ 595 /* disable the STUART clock */
596 pxa_set_cken(CKEN5_STUART, 0); 596 pxa_set_cken(CKEN_STUART, 0);
597 597
598 /* disable DMA */ 598 /* disable DMA */
599 DCSR(si->txdma) &= ~DCSR_RUN; 599 DCSR(si->txdma) &= ~DCSR_RUN;
@@ -601,7 +601,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
601 /* disable FICP */ 601 /* disable FICP */
602 ICCR0 = 0; 602 ICCR0 = 0;
603 /* disable the FICP clock */ 603 /* disable the FICP clock */
604 pxa_set_cken(CKEN13_FICP, 0); 604 pxa_set_cken(CKEN_FICP, 0);
605 605
606 DRCMR17 = 0; 606 DRCMR17 = 0;
607 DRCMR18 = 0; 607 DRCMR18 = 0;
diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index 8434d752fd81..9e04a6b3ae0d 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -34,7 +34,6 @@
34#define _IXGB_OSDEP_H_ 34#define _IXGB_OSDEP_H_
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/pci.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <asm/io.h> 38#include <asm/io.h>
40#include <linux/interrupt.h> 39#include <linux/interrupt.h>
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index d34afb52ea7f..75f6f441e876 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -88,6 +88,23 @@ static unsigned short known_revisions[] =
88 0xffff /* end of list */ 88 0xffff /* end of list */
89}; 89};
90 90
91static int jazzsonic_open(struct net_device* dev)
92{
93 if (request_irq(dev->irq, &sonic_interrupt, IRQF_DISABLED, "sonic", dev)) {
94 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
95 return -EAGAIN;
96 }
97 return sonic_open(dev);
98}
99
100static int jazzsonic_close(struct net_device* dev)
101{
102 int err;
103 err = sonic_close(dev);
104 free_irq(dev->irq, dev);
105 return err;
106}
107
91static int __init sonic_probe1(struct net_device *dev) 108static int __init sonic_probe1(struct net_device *dev)
92{ 109{
93 static unsigned version_printed; 110 static unsigned version_printed;
@@ -169,8 +186,8 @@ static int __init sonic_probe1(struct net_device *dev)
169 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS 186 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
170 * SONIC_BUS_SCALE(lp->dma_bitmode)); 187 * SONIC_BUS_SCALE(lp->dma_bitmode));
171 188
172 dev->open = sonic_open; 189 dev->open = jazzsonic_open;
173 dev->stop = sonic_close; 190 dev->stop = jazzsonic_close;
174 dev->hard_start_xmit = sonic_send_packet; 191 dev->hard_start_xmit = sonic_send_packet;
175 dev->get_stats = sonic_get_stats; 192 dev->get_stats = sonic_get_stats;
176 dev->set_multicast_list = &sonic_multicast_list; 193 dev->set_multicast_list = &sonic_multicast_list;
@@ -260,8 +277,6 @@ MODULE_DESCRIPTION("Jazz SONIC ethernet driver");
260module_param(sonic_debug, int, 0); 277module_param(sonic_debug, int, 0);
261MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); 278MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
262 279
263#define SONIC_IRQ_FLAG IRQF_DISABLED
264
265#include "sonic.c" 280#include "sonic.c"
266 281
267static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) 282static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
@@ -269,11 +284,11 @@ static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
269 struct net_device *dev = platform_get_drvdata(pdev); 284 struct net_device *dev = platform_get_drvdata(pdev);
270 struct sonic_local* lp = netdev_priv(dev); 285 struct sonic_local* lp = netdev_priv(dev);
271 286
272 unregister_netdev (dev); 287 unregister_netdev(dev);
273 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 288 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
274 lp->descriptors, lp->descriptors_laddr); 289 lp->descriptors, lp->descriptors_laddr);
275 release_region (dev->base_addr, SONIC_MEM_SIZE); 290 release_region (dev->base_addr, SONIC_MEM_SIZE);
276 free_netdev (dev); 291 free_netdev(dev);
277 292
278 return 0; 293 return 0;
279} 294}
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index 0edcd125fd61..6b49fc4bd1a1 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -81,7 +81,6 @@
81#include <linux/etherdevice.h> 81#include <linux/etherdevice.h>
82#include <linux/skbuff.h> 82#include <linux/skbuff.h>
83#include <linux/init.h> 83#include <linux/init.h>
84#include <linux/pci.h>
85#include <linux/types.h> 84#include <linux/types.h>
86#include <linux/bitops.h> 85#include <linux/bitops.h>
87 86
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c
index a12bb64e3694..90b0c3ed4bb6 100644
--- a/drivers/net/mac8390.c
+++ b/drivers/net/mac8390.c
@@ -14,6 +14,8 @@
14/* 2001-05-15: support for Cabletron ported from old daynaport driver 14/* 2001-05-15: support for Cabletron ported from old daynaport driver
15 * and fixed access to Sonic Sys card which masquerades as a Farallon 15 * and fixed access to Sonic Sys card which masquerades as a Farallon
16 * by rayk@knightsmanor.org */ 16 * by rayk@knightsmanor.org */
17/* 2002-12-30: Try to support more cards, some clues from NetBSD driver */
18/* 2003-12-26: Make sure Asante cards always work. */
17 19
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -61,25 +63,21 @@ static char version[] =
61#define DAYNA_8390_BASE 0x80000 63#define DAYNA_8390_BASE 0x80000
62#define DAYNA_8390_MEM 0x00000 64#define DAYNA_8390_MEM 0x00000
63 65
64#define KINETICS_8390_BASE 0x80000
65#define KINETICS_8390_MEM 0x00000
66
67#define CABLETRON_8390_BASE 0x90000 66#define CABLETRON_8390_BASE 0x90000
68#define CABLETRON_8390_MEM 0x00000 67#define CABLETRON_8390_MEM 0x00000
69 68
69#define INTERLAN_8390_BASE 0xE0000
70#define INTERLAN_8390_MEM 0xD0000
71
70enum mac8390_type { 72enum mac8390_type {
71 MAC8390_NONE = -1, 73 MAC8390_NONE = -1,
72 MAC8390_APPLE, 74 MAC8390_APPLE,
73 MAC8390_ASANTE, 75 MAC8390_ASANTE,
74 MAC8390_FARALLON, /* Apple, Asante, and Farallon are all compatible */ 76 MAC8390_FARALLON,
75 MAC8390_CABLETRON, 77 MAC8390_CABLETRON,
76 MAC8390_DAYNA, 78 MAC8390_DAYNA,
77 MAC8390_INTERLAN, 79 MAC8390_INTERLAN,
78 MAC8390_KINETICS, 80 MAC8390_KINETICS,
79 MAC8390_FOCUS,
80 MAC8390_SONICSYS,
81 MAC8390_DAYNA2,
82 MAC8390_DAYNA3,
83}; 81};
84 82
85static const char * cardname[] = { 83static const char * cardname[] = {
@@ -90,10 +88,6 @@ static const char * cardname[] = {
90 "dayna", 88 "dayna",
91 "interlan", 89 "interlan",
92 "kinetics", 90 "kinetics",
93 "focus",
94 "sonic systems",
95 "dayna2",
96 "dayna_lc",
97}; 91};
98 92
99static int word16[] = { 93static int word16[] = {
@@ -104,10 +98,6 @@ static int word16[] = {
104 0, /* dayna */ 98 0, /* dayna */
105 1, /* interlan */ 99 1, /* interlan */
106 0, /* kinetics */ 100 0, /* kinetics */
107 1, /* focus (??) */
108 1, /* sonic systems */
109 1, /* dayna2 */
110 1, /* dayna-lc */
111}; 101};
112 102
113/* on which cards do we use NuBus resources? */ 103/* on which cards do we use NuBus resources? */
@@ -119,10 +109,12 @@ static int useresources[] = {
119 0, /* dayna */ 109 0, /* dayna */
120 0, /* interlan */ 110 0, /* interlan */
121 0, /* kinetics */ 111 0, /* kinetics */
122 0, /* focus (??) */ 112};
123 1, /* sonic systems */ 113
124 1, /* dayna2 */ 114enum mac8390_access {
125 1, /* dayna-lc */ 115 ACCESS_UNKNOWN = 0,
116 ACCESS_32,
117 ACCESS_16,
126}; 118};
127 119
128extern enum mac8390_type mac8390_ident(struct nubus_dev * dev); 120extern enum mac8390_type mac8390_ident(struct nubus_dev * dev);
@@ -134,8 +126,9 @@ static int mac8390_initdev(struct net_device * dev, struct nubus_dev * ndev,
134static int mac8390_open(struct net_device * dev); 126static int mac8390_open(struct net_device * dev);
135static int mac8390_close(struct net_device * dev); 127static int mac8390_close(struct net_device * dev);
136static void mac8390_no_reset(struct net_device *dev); 128static void mac8390_no_reset(struct net_device *dev);
129static void interlan_reset(struct net_device *dev);
137 130
138/* Sane (32-bit chunk memory read/write) - Apple/Asante/Farallon do this*/ 131/* Sane (32-bit chunk memory read/write) - Some Farallon and Apple do this*/
139static void sane_get_8390_hdr(struct net_device *dev, 132static void sane_get_8390_hdr(struct net_device *dev,
140 struct e8390_pkt_hdr *hdr, int ring_page); 133 struct e8390_pkt_hdr *hdr, int ring_page);
141static void sane_block_input(struct net_device * dev, int count, 134static void sane_block_input(struct net_device * dev, int count,
@@ -172,23 +165,93 @@ static void word_memcpy_fromcard(void *tp, const void *fp, int count);
172 165
173enum mac8390_type __init mac8390_ident(struct nubus_dev * dev) 166enum mac8390_type __init mac8390_ident(struct nubus_dev * dev)
174{ 167{
175 if (dev->dr_sw == NUBUS_DRSW_ASANTE) 168 switch (dev->dr_sw) {
176 return MAC8390_ASANTE; 169 case NUBUS_DRSW_3COM:
177 if (dev->dr_sw == NUBUS_DRSW_FARALLON) 170 switch (dev->dr_hw) {
178 return MAC8390_FARALLON; 171 case NUBUS_DRHW_APPLE_SONIC_NB:
179 if (dev->dr_sw == NUBUS_DRSW_KINETICS) 172 case NUBUS_DRHW_APPLE_SONIC_LC:
180 return MAC8390_KINETICS; 173 case NUBUS_DRHW_SONNET:
181 if (dev->dr_sw == NUBUS_DRSW_DAYNA) 174 return MAC8390_NONE;
182 return MAC8390_DAYNA; 175 break;
183 if (dev->dr_sw == NUBUS_DRSW_DAYNA2) 176 default:
184 return MAC8390_DAYNA2; 177 return MAC8390_APPLE;
185 if (dev->dr_sw == NUBUS_DRSW_DAYNA_LC) 178 break;
186 return MAC8390_DAYNA3; 179 }
187 if (dev->dr_hw == NUBUS_DRHW_CABLETRON) 180 break;
188 return MAC8390_CABLETRON; 181
182 case NUBUS_DRSW_APPLE:
183 switch (dev->dr_hw) {
184 case NUBUS_DRHW_ASANTE_LC:
185 return MAC8390_NONE;
186 break;
187 case NUBUS_DRHW_CABLETRON:
188 return MAC8390_CABLETRON;
189 break;
190 default:
191 return MAC8390_APPLE;
192 break;
193 }
194 break;
195
196 case NUBUS_DRSW_ASANTE:
197 return MAC8390_ASANTE;
198 break;
199
200 case NUBUS_DRSW_TECHWORKS:
201 case NUBUS_DRSW_DAYNA2:
202 case NUBUS_DRSW_DAYNA_LC:
203 if (dev->dr_hw == NUBUS_DRHW_CABLETRON)
204 return MAC8390_CABLETRON;
205 else
206 return MAC8390_APPLE;
207 break;
208
209 case NUBUS_DRSW_FARALLON:
210 return MAC8390_FARALLON;
211 break;
212
213 case NUBUS_DRSW_KINETICS:
214 switch (dev->dr_hw) {
215 case NUBUS_DRHW_INTERLAN:
216 return MAC8390_INTERLAN;
217 break;
218 default:
219 return MAC8390_KINETICS;
220 break;
221 }
222 break;
223
224 case NUBUS_DRSW_DAYNA:
225 // These correspond to Dayna Sonic cards
226 // which use the macsonic driver
227 if (dev->dr_hw == NUBUS_DRHW_SMC9194 ||
228 dev->dr_hw == NUBUS_DRHW_INTERLAN )
229 return MAC8390_NONE;
230 else
231 return MAC8390_DAYNA;
232 break;
233 }
189 return MAC8390_NONE; 234 return MAC8390_NONE;
190} 235}
191 236
237enum mac8390_access __init mac8390_testio(volatile unsigned long membase)
238{
239 unsigned long outdata = 0xA5A0B5B0;
240 unsigned long indata = 0x00000000;
241 /* Try writing 32 bits */
242 memcpy((char *)membase, (char *)&outdata, 4);
243 /* Now compare them */
244 if (memcmp((char *)&outdata, (char *)membase, 4) == 0)
245 return ACCESS_32;
246 /* Write 16 bit output */
247 word_memcpy_tocard((char *)membase, (char *)&outdata, 4);
248 /* Now read it back */
249 word_memcpy_fromcard((char *)&indata, (char *)membase, 4);
250 if (outdata == indata)
251 return ACCESS_16;
252 return ACCESS_UNKNOWN;
253}
254
192int __init mac8390_memsize(unsigned long membase) 255int __init mac8390_memsize(unsigned long membase)
193{ 256{
194 unsigned long flags; 257 unsigned long flags;
@@ -287,14 +350,6 @@ struct net_device * __init mac8390_probe(int unit)
287 continue; 350 continue;
288 } else { 351 } else {
289 nubus_get_rsrc_mem(dev->dev_addr, &ent, 6); 352 nubus_get_rsrc_mem(dev->dev_addr, &ent, 6);
290 /* Some Sonic Sys cards masquerade as Farallon */
291 if (cardtype == MAC8390_FARALLON &&
292 dev->dev_addr[0] == 0x0 &&
293 dev->dev_addr[1] == 0x40 &&
294 dev->dev_addr[2] == 0x10) {
295 /* This is really Sonic Sys card */
296 cardtype = MAC8390_SONICSYS;
297 }
298 } 353 }
299 354
300 if (useresources[cardtype] == 1) { 355 if (useresources[cardtype] == 1) {
@@ -334,6 +389,17 @@ struct net_device * __init mac8390_probe(int unit)
334 dev->mem_start + 389 dev->mem_start +
335 mac8390_memsize(dev->mem_start); 390 mac8390_memsize(dev->mem_start);
336 break; 391 break;
392 case MAC8390_INTERLAN:
393 dev->base_addr =
394 (int)(ndev->board->slot_addr +
395 INTERLAN_8390_BASE);
396 dev->mem_start =
397 (int)(ndev->board->slot_addr +
398 INTERLAN_8390_MEM);
399 dev->mem_end =
400 dev->mem_start +
401 mac8390_memsize(dev->mem_start);
402 break;
337 case MAC8390_CABLETRON: 403 case MAC8390_CABLETRON:
338 dev->base_addr = 404 dev->base_addr =
339 (int)(ndev->board->slot_addr + 405 (int)(ndev->board->slot_addr +
@@ -356,8 +422,8 @@ struct net_device * __init mac8390_probe(int unit)
356 422
357 default: 423 default:
358 printk(KERN_ERR "Card type %s is" 424 printk(KERN_ERR "Card type %s is"
359 " unsupported, sorry\n", 425 " unsupported, sorry\n",
360 cardname[cardtype]); 426 ndev->board->name);
361 continue; 427 continue;
362 } 428 }
363 } 429 }
@@ -438,7 +504,7 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
438 24, 26, 28, 30 504 24, 26, 28, 30
439 }; 505 };
440 506
441 int access_bitmode; 507 int access_bitmode = 0;
442 508
443 /* Now fill in our stuff */ 509 /* Now fill in our stuff */
444 dev->open = &mac8390_open; 510 dev->open = &mac8390_open;
@@ -468,29 +534,47 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
468 534
469 /* Fill in model-specific information and functions */ 535 /* Fill in model-specific information and functions */
470 switch(type) { 536 switch(type) {
471 case MAC8390_SONICSYS:
472 /* 16 bit card, register map is reversed */
473 ei_status.reset_8390 = &mac8390_no_reset;
474 ei_status.block_input = &slow_sane_block_input;
475 ei_status.block_output = &slow_sane_block_output;
476 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
477 ei_status.reg_offset = back4_offsets;
478 access_bitmode = 0;
479 break;
480 case MAC8390_FARALLON: 537 case MAC8390_FARALLON:
481 case MAC8390_APPLE: 538 case MAC8390_APPLE:
539 switch(mac8390_testio(dev->mem_start)) {
540 case ACCESS_UNKNOWN:
541 printk("Don't know how to access card memory!\n");
542 return -ENODEV;
543 break;
544
545 case ACCESS_16:
546 /* 16 bit card, register map is reversed */
547 ei_status.reset_8390 = &mac8390_no_reset;
548 ei_status.block_input = &slow_sane_block_input;
549 ei_status.block_output = &slow_sane_block_output;
550 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
551 ei_status.reg_offset = back4_offsets;
552 break;
553
554 case ACCESS_32:
555 /* 32 bit card, register map is reversed */
556 ei_status.reset_8390 = &mac8390_no_reset;
557 ei_status.block_input = &sane_block_input;
558 ei_status.block_output = &sane_block_output;
559 ei_status.get_8390_hdr = &sane_get_8390_hdr;
560 ei_status.reg_offset = back4_offsets;
561 access_bitmode = 1;
562 break;
563 }
564 break;
565
482 case MAC8390_ASANTE: 566 case MAC8390_ASANTE:
483 case MAC8390_DAYNA2: 567 /* Some Asante cards pass the 32 bit test
484 case MAC8390_DAYNA3: 568 * but overwrite system memory when run at 32 bit.
485 /* 32 bit card, register map is reversed */ 569 * so we run them all at 16 bit.
486 /* sane */ 570 */
487 ei_status.reset_8390 = &mac8390_no_reset; 571 ei_status.reset_8390 = &mac8390_no_reset;
488 ei_status.block_input = &sane_block_input; 572 ei_status.block_input = &slow_sane_block_input;
489 ei_status.block_output = &sane_block_output; 573 ei_status.block_output = &slow_sane_block_output;
490 ei_status.get_8390_hdr = &sane_get_8390_hdr; 574 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
491 ei_status.reg_offset = back4_offsets; 575 ei_status.reg_offset = back4_offsets;
492 access_bitmode = 1;
493 break; 576 break;
577
494 case MAC8390_CABLETRON: 578 case MAC8390_CABLETRON:
495 /* 16 bit card, register map is short forward */ 579 /* 16 bit card, register map is short forward */
496 ei_status.reset_8390 = &mac8390_no_reset; 580 ei_status.reset_8390 = &mac8390_no_reset;
@@ -498,21 +582,30 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
498 ei_status.block_output = &slow_sane_block_output; 582 ei_status.block_output = &slow_sane_block_output;
499 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; 583 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
500 ei_status.reg_offset = fwrd2_offsets; 584 ei_status.reg_offset = fwrd2_offsets;
501 access_bitmode = 0;
502 break; 585 break;
586
503 case MAC8390_DAYNA: 587 case MAC8390_DAYNA:
504 case MAC8390_KINETICS: 588 case MAC8390_KINETICS:
505 /* 16 bit memory */ 589 /* 16 bit memory, register map is forward */
506 /* dayna and similar */ 590 /* dayna and similar */
507 ei_status.reset_8390 = &mac8390_no_reset; 591 ei_status.reset_8390 = &mac8390_no_reset;
508 ei_status.block_input = &dayna_block_input; 592 ei_status.block_input = &dayna_block_input;
509 ei_status.block_output = &dayna_block_output; 593 ei_status.block_output = &dayna_block_output;
510 ei_status.get_8390_hdr = &dayna_get_8390_hdr; 594 ei_status.get_8390_hdr = &dayna_get_8390_hdr;
511 ei_status.reg_offset = fwrd4_offsets; 595 ei_status.reg_offset = fwrd4_offsets;
512 access_bitmode = 0;
513 break; 596 break;
597
598 case MAC8390_INTERLAN:
599 /* 16 bit memory, register map is forward */
600 ei_status.reset_8390 = &interlan_reset;
601 ei_status.block_input = &slow_sane_block_input;
602 ei_status.block_output = &slow_sane_block_output;
603 ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
604 ei_status.reg_offset = fwrd4_offsets;
605 break;
606
514 default: 607 default:
515 printk(KERN_ERR "Card type %s is unsupported, sorry\n", cardname[type]); 608 printk(KERN_ERR "Card type %s is unsupported, sorry\n", ndev->board->name);
516 return -ENODEV; 609 return -ENODEV;
517 } 610 }
518 611
@@ -530,9 +623,9 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
530 printk(":"); 623 printk(":");
531 } 624 }
532 } 625 }
533 printk(" IRQ %d, shared memory at %#lx-%#lx, %d-bit access.\n", 626 printk(" IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n",
534 dev->irq, dev->mem_start, dev->mem_end-1, 627 dev->irq, (int)((dev->mem_end - dev->mem_start)/0x1000) * 4,
535 access_bitmode?32:16); 628 dev->mem_start, access_bitmode?32:16);
536 return 0; 629 return 0;
537} 630}
538 631
@@ -561,6 +654,18 @@ static void mac8390_no_reset(struct net_device *dev)
561 return; 654 return;
562} 655}
563 656
657static void interlan_reset(struct net_device *dev)
658{
659 unsigned char *target=nubus_slot_addr(IRQ2SLOT(dev->irq));
660 if (ei_debug > 1)
661 printk("Need to reset the NS8390 t=%lu...", jiffies);
662 ei_status.txing = 0;
663 target[0xC0000] = 0;
664 if (ei_debug > 1)
665 printk("reset complete\n");
666 return;
667}
668
564/* dayna_memcpy_fromio/dayna_memcpy_toio */ 669/* dayna_memcpy_fromio/dayna_memcpy_toio */
565/* directly from daynaport.c by Alan Cox */ 670/* directly from daynaport.c by Alan Cox */
566static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count) 671static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 90e695d53266..26a3b45a4a34 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -128,7 +128,7 @@ struct net_local {
128extern void reset_chip(struct net_device *dev); 128extern void reset_chip(struct net_device *dev);
129#endif 129#endif
130static int net_open(struct net_device *dev); 130static int net_open(struct net_device *dev);
131static int net_send_packet(struct sk_buff *skb, struct net_device *dev); 131static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
132static irqreturn_t net_interrupt(int irq, void *dev_id); 132static irqreturn_t net_interrupt(int irq, void *dev_id);
133static void set_multicast_list(struct net_device *dev); 133static void set_multicast_list(struct net_device *dev);
134static void net_rx(struct net_device *dev); 134static void net_rx(struct net_device *dev);
@@ -374,56 +374,39 @@ net_open(struct net_device *dev)
374static int 374static int
375net_send_packet(struct sk_buff *skb, struct net_device *dev) 375net_send_packet(struct sk_buff *skb, struct net_device *dev)
376{ 376{
377 if (dev->tbusy) { 377 struct net_local *lp = netdev_priv(dev);
378 /* If we get here, some higher level has decided we are broken. 378 unsigned long flags;
379 There should really be a "kick me" function call instead. */
380 int tickssofar = jiffies - dev->trans_start;
381 if (tickssofar < 5)
382 return 1;
383 if (net_debug > 0) printk("%s: transmit timed out, %s?\n", dev->name,
384 tx_done(dev) ? "IRQ conflict" : "network cable problem");
385 /* Try to restart the adaptor. */
386 dev->tbusy=0;
387 dev->trans_start = jiffies;
388 }
389
390 /* Block a timer-based transmit from overlapping. This could better be
391 done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
392 if (test_and_set_bit(0, (void*)&dev->tbusy) != 0)
393 printk("%s: Transmitter access conflict.\n", dev->name);
394 else {
395 struct net_local *lp = netdev_priv(dev);
396 unsigned long flags;
397
398 if (net_debug > 3)
399 printk("%s: sent %d byte packet of type %x\n",
400 dev->name, skb->len,
401 (skb->data[ETH_ALEN+ETH_ALEN] << 8)
402 | skb->data[ETH_ALEN+ETH_ALEN+1]);
403
404 /* keep the upload from being interrupted, since we
405 ask the chip to start transmitting before the
406 whole packet has been completely uploaded. */
407 local_irq_save(flags);
408 379
409 /* initiate a transmit sequence */ 380 if (net_debug > 3)
410 writereg(dev, PP_TxCMD, lp->send_cmd); 381 printk("%s: sent %d byte packet of type %x\n",
411 writereg(dev, PP_TxLength, skb->len); 382 dev->name, skb->len,
383 (skb->data[ETH_ALEN+ETH_ALEN] << 8)
384 | skb->data[ETH_ALEN+ETH_ALEN+1]);
412 385
413 /* Test to see if the chip has allocated memory for the packet */ 386 /* keep the upload from being interrupted, since we
414 if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) { 387 ask the chip to start transmitting before the
415 /* Gasp! It hasn't. But that shouldn't happen since 388 whole packet has been completely uploaded. */
416 we're waiting for TxOk, so return 1 and requeue this packet. */ 389 local_irq_save(flags);
417 local_irq_restore(flags); 390 netif_stop_queue(dev);
418 return 1;
419 }
420 391
421 /* Write the contents of the packet */ 392 /* initiate a transmit sequence */
422 memcpy_toio(dev->mem_start + PP_TxFrame, skb->data, skb->len+1); 393 writereg(dev, PP_TxCMD, lp->send_cmd);
394 writereg(dev, PP_TxLength, skb->len);
423 395
396 /* Test to see if the chip has allocated memory for the packet */
397 if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) {
398 /* Gasp! It hasn't. But that shouldn't happen since
399 we're waiting for TxOk, so return 1 and requeue this packet. */
424 local_irq_restore(flags); 400 local_irq_restore(flags);
425 dev->trans_start = jiffies; 401 return 1;
426 } 402 }
403
404 /* Write the contents of the packet */
405 skb_copy_from_linear_data(skb, (void *)(dev->mem_start + PP_TxFrame),
406 skb->len+1);
407
408 local_irq_restore(flags);
409 dev->trans_start = jiffies;
427 dev_kfree_skb (skb); 410 dev_kfree_skb (skb);
428 411
429 return 0; 412 return 0;
@@ -441,9 +424,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
441 printk ("net_interrupt(): irq %d for unknown device.\n", irq); 424 printk ("net_interrupt(): irq %d for unknown device.\n", irq);
442 return IRQ_NONE; 425 return IRQ_NONE;
443 } 426 }
444 if (dev->interrupt)
445 printk("%s: Re-entering the interrupt handler.\n", dev->name);
446 dev->interrupt = 1;
447 427
448 ioaddr = dev->base_addr; 428 ioaddr = dev->base_addr;
449 lp = netdev_priv(dev); 429 lp = netdev_priv(dev);
@@ -464,8 +444,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
464 break; 444 break;
465 case ISQ_TRANSMITTER_EVENT: 445 case ISQ_TRANSMITTER_EVENT:
466 lp->stats.tx_packets++; 446 lp->stats.tx_packets++;
467 dev->tbusy = 0; 447 netif_wake_queue(dev);
468 mark_bh(NET_BH); /* Inform upper layers. */
469 if ((status & TX_OK) == 0) lp->stats.tx_errors++; 448 if ((status & TX_OK) == 0) lp->stats.tx_errors++;
470 if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++; 449 if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++;
471 if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++; 450 if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++;
@@ -479,8 +458,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
479 That shouldn't happen since we only ever 458 That shouldn't happen since we only ever
480 load one packet. Shrug. Do the right 459 load one packet. Shrug. Do the right
481 thing anyway. */ 460 thing anyway. */
482 dev->tbusy = 0; 461 netif_wake_queue(dev);
483 mark_bh(NET_BH); /* Inform upper layers. */
484 } 462 }
485 if (status & TX_UNDERRUN) { 463 if (status & TX_UNDERRUN) {
486 if (net_debug > 0) printk("%s: transmit underrun\n", dev->name); 464 if (net_debug > 0) printk("%s: transmit underrun\n", dev->name);
@@ -497,7 +475,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
497 break; 475 break;
498 } 476 }
499 } 477 }
500 dev->interrupt = 0;
501 return IRQ_HANDLED; 478 return IRQ_HANDLED;
502} 479}
503 480
@@ -531,7 +508,8 @@ net_rx(struct net_device *dev)
531 } 508 }
532 skb_put(skb, length); 509 skb_put(skb, length);
533 510
534 memcpy_fromio(skb->data, dev->mem_start + PP_RxFrame, length); 511 skb_copy_to_linear_data(skb, (void *)(dev->mem_start + PP_RxFrame),
512 length);
535 513
536 if (net_debug > 3)printk("%s: received %d byte packet of type %x\n", 514 if (net_debug > 3)printk("%s: received %d byte packet of type %x\n",
537 dev->name, length, 515 dev->name, length,
@@ -610,8 +588,6 @@ static void set_multicast_list(struct net_device *dev)
610static int set_mac_address(struct net_device *dev, void *addr) 588static int set_mac_address(struct net_device *dev, void *addr)
611{ 589{
612 int i; 590 int i;
613 if (dev->start)
614 return -EBUSY;
615 printk("%s: Setting MAC address to ", dev->name); 591 printk("%s: Setting MAC address to ", dev->name);
616 for (i = 0; i < 6; i++) 592 for (i = 0; i < 6; i++)
617 printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]); 593 printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 27911c07558d..fef3193121f9 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -12,6 +12,11 @@
12 * Copyright (C) 1998 Alan Cox <alan@redhat.com> 12 * Copyright (C) 1998 Alan Cox <alan@redhat.com>
13 * 13 *
14 * Modified heavily by Joshua M. Thompson based on Dave Huang's NetBSD driver 14 * Modified heavily by Joshua M. Thompson based on Dave Huang's NetBSD driver
15 *
16 * Copyright (C) 2007 Finn Thain
17 *
18 * Converted to DMA API, converted to unified driver model,
19 * sync'd some routines with mace.c and fixed various bugs.
15 */ 20 */
16 21
17 22
@@ -23,8 +28,9 @@
23#include <linux/string.h> 28#include <linux/string.h>
24#include <linux/crc32.h> 29#include <linux/crc32.h>
25#include <linux/bitrev.h> 30#include <linux/bitrev.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_device.h>
26#include <asm/io.h> 33#include <asm/io.h>
27#include <asm/pgtable.h>
28#include <asm/irq.h> 34#include <asm/irq.h>
29#include <asm/macintosh.h> 35#include <asm/macintosh.h>
30#include <asm/macints.h> 36#include <asm/macints.h>
@@ -32,13 +38,20 @@
32#include <asm/page.h> 38#include <asm/page.h>
33#include "mace.h" 39#include "mace.h"
34 40
35#define N_TX_RING 1 41static char mac_mace_string[] = "macmace";
36#define N_RX_RING 8 42static struct platform_device *mac_mace_device;
37#define N_RX_PAGES ((N_RX_RING * 0x0800 + PAGE_SIZE - 1) / PAGE_SIZE) 43
44#define N_TX_BUFF_ORDER 0
45#define N_TX_RING (1 << N_TX_BUFF_ORDER)
46#define N_RX_BUFF_ORDER 3
47#define N_RX_RING (1 << N_RX_BUFF_ORDER)
48
38#define TX_TIMEOUT HZ 49#define TX_TIMEOUT HZ
39 50
40/* Bits in transmit DMA status */ 51#define MACE_BUFF_SIZE 0x800
41#define TX_DMA_ERR 0x80 52
53/* Chip rev needs workaround on HW & multicast addr change */
54#define BROKEN_ADDRCHG_REV 0x0941
42 55
43/* The MACE is simply wired down on a Mac68K box */ 56/* The MACE is simply wired down on a Mac68K box */
44 57
@@ -47,40 +60,46 @@
47 60
48struct mace_data { 61struct mace_data {
49 volatile struct mace *mace; 62 volatile struct mace *mace;
50 volatile unsigned char *tx_ring; 63 unsigned char *tx_ring;
51 volatile unsigned char *tx_ring_phys; 64 dma_addr_t tx_ring_phys;
52 volatile unsigned char *rx_ring; 65 unsigned char *rx_ring;
53 volatile unsigned char *rx_ring_phys; 66 dma_addr_t rx_ring_phys;
54 int dma_intr; 67 int dma_intr;
55 struct net_device_stats stats; 68 struct net_device_stats stats;
56 int rx_slot, rx_tail; 69 int rx_slot, rx_tail;
57 int tx_slot, tx_sloti, tx_count; 70 int tx_slot, tx_sloti, tx_count;
71 int chipid;
72 struct device *device;
58}; 73};
59 74
60struct mace_frame { 75struct mace_frame {
61 u16 len; 76 u8 rcvcnt;
62 u16 status; 77 u8 pad1;
63 u16 rntpc; 78 u8 rcvsts;
64 u16 rcvcc; 79 u8 pad2;
65 u32 pad1; 80 u8 rntpc;
66 u32 pad2; 81 u8 pad3;
82 u8 rcvcc;
83 u8 pad4;
84 u32 pad5;
85 u32 pad6;
67 u8 data[1]; 86 u8 data[1];
68 /* And frame continues.. */ 87 /* And frame continues.. */
69}; 88};
70 89
71#define PRIV_BYTES sizeof(struct mace_data) 90#define PRIV_BYTES sizeof(struct mace_data)
72 91
73extern void psc_debug_dump(void);
74
75static int mace_open(struct net_device *dev); 92static int mace_open(struct net_device *dev);
76static int mace_close(struct net_device *dev); 93static int mace_close(struct net_device *dev);
77static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); 94static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
78static struct net_device_stats *mace_stats(struct net_device *dev); 95static struct net_device_stats *mace_stats(struct net_device *dev);
79static void mace_set_multicast(struct net_device *dev); 96static void mace_set_multicast(struct net_device *dev);
80static int mace_set_address(struct net_device *dev, void *addr); 97static int mace_set_address(struct net_device *dev, void *addr);
98static void mace_reset(struct net_device *dev);
81static irqreturn_t mace_interrupt(int irq, void *dev_id); 99static irqreturn_t mace_interrupt(int irq, void *dev_id);
82static irqreturn_t mace_dma_intr(int irq, void *dev_id); 100static irqreturn_t mace_dma_intr(int irq, void *dev_id);
83static void mace_tx_timeout(struct net_device *dev); 101static void mace_tx_timeout(struct net_device *dev);
102static void __mace_set_address(struct net_device *dev, void *addr);
84 103
85/* 104/*
86 * Load a receive DMA channel with a base address and ring length 105 * Load a receive DMA channel with a base address and ring length
@@ -88,7 +107,7 @@ static void mace_tx_timeout(struct net_device *dev);
88 107
89static void mace_load_rxdma_base(struct net_device *dev, int set) 108static void mace_load_rxdma_base(struct net_device *dev, int set)
90{ 109{
91 struct mace_data *mp = (struct mace_data *) dev->priv; 110 struct mace_data *mp = netdev_priv(dev);
92 111
93 psc_write_word(PSC_ENETRD_CMD + set, 0x0100); 112 psc_write_word(PSC_ENETRD_CMD + set, 0x0100);
94 psc_write_long(PSC_ENETRD_ADDR + set, (u32) mp->rx_ring_phys); 113 psc_write_long(PSC_ENETRD_ADDR + set, (u32) mp->rx_ring_phys);
@@ -103,7 +122,7 @@ static void mace_load_rxdma_base(struct net_device *dev, int set)
103 122
104static void mace_rxdma_reset(struct net_device *dev) 123static void mace_rxdma_reset(struct net_device *dev)
105{ 124{
106 struct mace_data *mp = (struct mace_data *) dev->priv; 125 struct mace_data *mp = netdev_priv(dev);
107 volatile struct mace *mace = mp->mace; 126 volatile struct mace *mace = mp->mace;
108 u8 maccc = mace->maccc; 127 u8 maccc = mace->maccc;
109 128
@@ -130,7 +149,7 @@ static void mace_rxdma_reset(struct net_device *dev)
130 149
131static void mace_txdma_reset(struct net_device *dev) 150static void mace_txdma_reset(struct net_device *dev)
132{ 151{
133 struct mace_data *mp = (struct mace_data *) dev->priv; 152 struct mace_data *mp = netdev_priv(dev);
134 volatile struct mace *mace = mp->mace; 153 volatile struct mace *mace = mp->mace;
135 u8 maccc; 154 u8 maccc;
136 155
@@ -168,7 +187,7 @@ static void mace_dma_off(struct net_device *dev)
168 * model of Macintrash has a MACE (AV macintoshes) 187 * model of Macintrash has a MACE (AV macintoshes)
169 */ 188 */
170 189
171struct net_device *mace_probe(int unit) 190static int __devinit mace_probe(struct platform_device *pdev)
172{ 191{
173 int j; 192 int j;
174 struct mace_data *mp; 193 struct mace_data *mp;
@@ -179,24 +198,28 @@ struct net_device *mace_probe(int unit)
179 int err; 198 int err;
180 199
181 if (found || macintosh_config->ether_type != MAC_ETHER_MACE) 200 if (found || macintosh_config->ether_type != MAC_ETHER_MACE)
182 return ERR_PTR(-ENODEV); 201 return -ENODEV;
183 202
184 found = 1; /* prevent 'finding' one on every device probe */ 203 found = 1; /* prevent 'finding' one on every device probe */
185 204
186 dev = alloc_etherdev(PRIV_BYTES); 205 dev = alloc_etherdev(PRIV_BYTES);
187 if (!dev) 206 if (!dev)
188 return ERR_PTR(-ENOMEM); 207 return -ENOMEM;
189 208
190 if (unit >= 0) 209 mp = netdev_priv(dev);
191 sprintf(dev->name, "eth%d", unit); 210
211 mp->device = &pdev->dev;
212 SET_NETDEV_DEV(dev, &pdev->dev);
213 SET_MODULE_OWNER(dev);
192 214
193 mp = (struct mace_data *) dev->priv;
194 dev->base_addr = (u32)MACE_BASE; 215 dev->base_addr = (u32)MACE_BASE;
195 mp->mace = (volatile struct mace *) MACE_BASE; 216 mp->mace = (volatile struct mace *) MACE_BASE;
196 217
197 dev->irq = IRQ_MAC_MACE; 218 dev->irq = IRQ_MAC_MACE;
198 mp->dma_intr = IRQ_MAC_MACE_DMA; 219 mp->dma_intr = IRQ_MAC_MACE_DMA;
199 220
221 mp->chipid = mp->mace->chipid_hi << 8 | mp->mace->chipid_lo;
222
200 /* 223 /*
201 * The PROM contains 8 bytes which total 0xFF when XOR'd 224 * The PROM contains 8 bytes which total 0xFF when XOR'd
202 * together. Due to the usual peculiar apple brain damage 225 * together. Due to the usual peculiar apple brain damage
@@ -217,7 +240,7 @@ struct net_device *mace_probe(int unit)
217 240
218 if (checksum != 0xFF) { 241 if (checksum != 0xFF) {
219 free_netdev(dev); 242 free_netdev(dev);
220 return ERR_PTR(-ENODEV); 243 return -ENODEV;
221 } 244 }
222 245
223 memset(&mp->stats, 0, sizeof(mp->stats)); 246 memset(&mp->stats, 0, sizeof(mp->stats));
@@ -237,22 +260,98 @@ struct net_device *mace_probe(int unit)
237 260
238 err = register_netdev(dev); 261 err = register_netdev(dev);
239 if (!err) 262 if (!err)
240 return dev; 263 return 0;
241 264
242 free_netdev(dev); 265 free_netdev(dev);
243 return ERR_PTR(err); 266 return err;
267}
268
269/*
270 * Reset the chip.
271 */
272
273static void mace_reset(struct net_device *dev)
274{
275 struct mace_data *mp = netdev_priv(dev);
276 volatile struct mace *mb = mp->mace;
277 int i;
278
279 /* soft-reset the chip */
280 i = 200;
281 while (--i) {
282 mb->biucc = SWRST;
283 if (mb->biucc & SWRST) {
284 udelay(10);
285 continue;
286 }
287 break;
288 }
289 if (!i) {
290 printk(KERN_ERR "macmace: cannot reset chip!\n");
291 return;
292 }
293
294 mb->maccc = 0; /* turn off tx, rx */
295 mb->imr = 0xFF; /* disable all intrs for now */
296 i = mb->ir;
297
298 mb->biucc = XMTSP_64;
299 mb->utr = RTRD;
300 mb->fifocc = XMTFW_8 | RCVFW_64 | XMTFWU | RCVFWU;
301
302 mb->xmtfc = AUTO_PAD_XMIT; /* auto-pad short frames */
303 mb->rcvfc = 0;
304
305 /* load up the hardware address */
306 __mace_set_address(dev, dev->dev_addr);
307
308 /* clear the multicast filter */
309 if (mp->chipid == BROKEN_ADDRCHG_REV)
310 mb->iac = LOGADDR;
311 else {
312 mb->iac = ADDRCHG | LOGADDR;
313 while ((mb->iac & ADDRCHG) != 0)
314 ;
315 }
316 for (i = 0; i < 8; ++i)
317 mb->ladrf = 0;
318
319 /* done changing address */
320 if (mp->chipid != BROKEN_ADDRCHG_REV)
321 mb->iac = 0;
322
323 mb->plscc = PORTSEL_AUI;
244} 324}
245 325
246/* 326/*
247 * Load the address on a mace controller. 327 * Load the address on a mace controller.
248 */ 328 */
249 329
250static int mace_set_address(struct net_device *dev, void *addr) 330static void __mace_set_address(struct net_device *dev, void *addr)
251{ 331{
252 unsigned char *p = addr; 332 struct mace_data *mp = netdev_priv(dev);
253 struct mace_data *mp = (struct mace_data *) dev->priv;
254 volatile struct mace *mb = mp->mace; 333 volatile struct mace *mb = mp->mace;
334 unsigned char *p = addr;
255 int i; 335 int i;
336
337 /* load up the hardware address */
338 if (mp->chipid == BROKEN_ADDRCHG_REV)
339 mb->iac = PHYADDR;
340 else {
341 mb->iac = ADDRCHG | PHYADDR;
342 while ((mb->iac & ADDRCHG) != 0)
343 ;
344 }
345 for (i = 0; i < 6; ++i)
346 mb->padr = dev->dev_addr[i] = p[i];
347 if (mp->chipid != BROKEN_ADDRCHG_REV)
348 mb->iac = 0;
349}
350
351static int mace_set_address(struct net_device *dev, void *addr)
352{
353 struct mace_data *mp = netdev_priv(dev);
354 volatile struct mace *mb = mp->mace;
256 unsigned long flags; 355 unsigned long flags;
257 u8 maccc; 356 u8 maccc;
258 357
@@ -260,15 +359,10 @@ static int mace_set_address(struct net_device *dev, void *addr)
260 359
261 maccc = mb->maccc; 360 maccc = mb->maccc;
262 361
263 /* load up the hardware address */ 362 __mace_set_address(dev, addr);
264 mb->iac = ADDRCHG | PHYADDR;
265 while ((mb->iac & ADDRCHG) != 0);
266
267 for (i = 0; i < 6; ++i) {
268 mb->padr = dev->dev_addr[i] = p[i];
269 }
270 363
271 mb->maccc = maccc; 364 mb->maccc = maccc;
365
272 local_irq_restore(flags); 366 local_irq_restore(flags);
273 367
274 return 0; 368 return 0;
@@ -281,31 +375,11 @@ static int mace_set_address(struct net_device *dev, void *addr)
281 375
282static int mace_open(struct net_device *dev) 376static int mace_open(struct net_device *dev)
283{ 377{
284 struct mace_data *mp = (struct mace_data *) dev->priv; 378 struct mace_data *mp = netdev_priv(dev);
285 volatile struct mace *mb = mp->mace; 379 volatile struct mace *mb = mp->mace;
286#if 0
287 int i;
288 380
289 i = 200; 381 /* reset the chip */
290 while (--i) { 382 mace_reset(dev);
291 mb->biucc = SWRST;
292 if (mb->biucc & SWRST) {
293 udelay(10);
294 continue;
295 }
296 break;
297 }
298 if (!i) {
299 printk(KERN_ERR "%s: software reset failed!!\n", dev->name);
300 return -EAGAIN;
301 }
302#endif
303
304 mb->biucc = XMTSP_64;
305 mb->fifocc = XMTFW_16 | RCVFW_64 | XMTFWU | RCVFWU | XMTBRST | RCVBRST;
306 mb->xmtfc = AUTO_PAD_XMIT;
307 mb->plscc = PORTSEL_AUI;
308 /* mb->utr = RTRD; */
309 383
310 if (request_irq(dev->irq, mace_interrupt, 0, dev->name, dev)) { 384 if (request_irq(dev->irq, mace_interrupt, 0, dev->name, dev)) {
311 printk(KERN_ERR "%s: can't get irq %d\n", dev->name, dev->irq); 385 printk(KERN_ERR "%s: can't get irq %d\n", dev->name, dev->irq);
@@ -319,25 +393,21 @@ static int mace_open(struct net_device *dev)
319 393
320 /* Allocate the DMA ring buffers */ 394 /* Allocate the DMA ring buffers */
321 395
322 mp->rx_ring = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, N_RX_PAGES); 396 mp->tx_ring = dma_alloc_coherent(mp->device,
323 mp->tx_ring = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, 0); 397 N_TX_RING * MACE_BUFF_SIZE,
324 398 &mp->tx_ring_phys, GFP_KERNEL);
325 if (mp->tx_ring==NULL || mp->rx_ring==NULL) { 399 if (mp->tx_ring == NULL) {
326 if (mp->rx_ring) free_pages((u32) mp->rx_ring, N_RX_PAGES); 400 printk(KERN_ERR "%s: unable to allocate DMA tx buffers\n", dev->name);
327 if (mp->tx_ring) free_pages((u32) mp->tx_ring, 0); 401 goto out1;
328 free_irq(dev->irq, dev);
329 free_irq(mp->dma_intr, dev);
330 printk(KERN_ERR "%s: unable to allocate DMA buffers\n", dev->name);
331 return -ENOMEM;
332 } 402 }
333 403
334 mp->rx_ring_phys = (unsigned char *) virt_to_bus((void *)mp->rx_ring); 404 mp->rx_ring = dma_alloc_coherent(mp->device,
335 mp->tx_ring_phys = (unsigned char *) virt_to_bus((void *)mp->tx_ring); 405 N_RX_RING * MACE_BUFF_SIZE,
336 406 &mp->rx_ring_phys, GFP_KERNEL);
337 /* We want the Rx buffer to be uncached and the Tx buffer to be writethrough */ 407 if (mp->rx_ring == NULL) {
338 408 printk(KERN_ERR "%s: unable to allocate DMA rx buffers\n", dev->name);
339 kernel_set_cachemode((void *)mp->rx_ring, N_RX_PAGES * PAGE_SIZE, IOMAP_NOCACHE_NONSER); 409 goto out2;
340 kernel_set_cachemode((void *)mp->tx_ring, PAGE_SIZE, IOMAP_WRITETHROUGH); 410 }
341 411
342 mace_dma_off(dev); 412 mace_dma_off(dev);
343 413
@@ -348,34 +418,22 @@ static int mace_open(struct net_device *dev)
348 psc_write_word(PSC_ENETWR_CTL, 0x0400); 418 psc_write_word(PSC_ENETWR_CTL, 0x0400);
349 psc_write_word(PSC_ENETRD_CTL, 0x0400); 419 psc_write_word(PSC_ENETRD_CTL, 0x0400);
350 420
351#if 0
352 /* load up the hardware address */
353
354 mb->iac = ADDRCHG | PHYADDR;
355
356 while ((mb->iac & ADDRCHG) != 0);
357
358 for (i = 0; i < 6; ++i)
359 mb->padr = dev->dev_addr[i];
360
361 /* clear the multicast filter */
362 mb->iac = ADDRCHG | LOGADDR;
363
364 while ((mb->iac & ADDRCHG) != 0);
365
366 for (i = 0; i < 8; ++i)
367 mb->ladrf = 0;
368
369 mb->plscc = PORTSEL_GPSI + ENPLSIO;
370
371 mb->maccc = ENXMT | ENRCV;
372 mb->imr = RCVINT;
373#endif
374
375 mace_rxdma_reset(dev); 421 mace_rxdma_reset(dev);
376 mace_txdma_reset(dev); 422 mace_txdma_reset(dev);
377 423
424 /* turn it on! */
425 mb->maccc = ENXMT | ENRCV;
426 /* enable all interrupts except receive interrupts */
427 mb->imr = RCVINT;
378 return 0; 428 return 0;
429
430out2:
431 dma_free_coherent(mp->device, N_TX_RING * MACE_BUFF_SIZE,
432 mp->tx_ring, mp->tx_ring_phys);
433out1:
434 free_irq(dev->irq, dev);
435 free_irq(mp->dma_intr, dev);
436 return -ENOMEM;
379} 437}
380 438
381/* 439/*
@@ -384,19 +442,13 @@ static int mace_open(struct net_device *dev)
384 442
385static int mace_close(struct net_device *dev) 443static int mace_close(struct net_device *dev)
386{ 444{
387 struct mace_data *mp = (struct mace_data *) dev->priv; 445 struct mace_data *mp = netdev_priv(dev);
388 volatile struct mace *mb = mp->mace; 446 volatile struct mace *mb = mp->mace;
389 447
390 mb->maccc = 0; /* disable rx and tx */ 448 mb->maccc = 0; /* disable rx and tx */
391 mb->imr = 0xFF; /* disable all irqs */ 449 mb->imr = 0xFF; /* disable all irqs */
392 mace_dma_off(dev); /* disable rx and tx dma */ 450 mace_dma_off(dev); /* disable rx and tx dma */
393 451
394 free_irq(dev->irq, dev);
395 free_irq(IRQ_MAC_MACE_DMA, dev);
396
397 free_pages((u32) mp->rx_ring, N_RX_PAGES);
398 free_pages((u32) mp->tx_ring, 0);
399
400 return 0; 452 return 0;
401} 453}
402 454
@@ -406,15 +458,20 @@ static int mace_close(struct net_device *dev)
406 458
407static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) 459static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
408{ 460{
409 struct mace_data *mp = (struct mace_data *) dev->priv; 461 struct mace_data *mp = netdev_priv(dev);
462 unsigned long flags;
410 463
411 /* Stop the queue if the buffer is full */ 464 /* Stop the queue since there's only the one buffer */
412 465
466 local_irq_save(flags);
467 netif_stop_queue(dev);
413 if (!mp->tx_count) { 468 if (!mp->tx_count) {
414 netif_stop_queue(dev); 469 printk(KERN_ERR "macmace: tx queue running but no free buffers.\n");
415 return 1; 470 local_irq_restore(flags);
471 return NETDEV_TX_BUSY;
416 } 472 }
417 mp->tx_count--; 473 mp->tx_count--;
474 local_irq_restore(flags);
418 475
419 mp->stats.tx_packets++; 476 mp->stats.tx_packets++;
420 mp->stats.tx_bytes += skb->len; 477 mp->stats.tx_bytes += skb->len;
@@ -432,23 +489,26 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
432 489
433 dev_kfree_skb(skb); 490 dev_kfree_skb(skb);
434 491
435 return 0; 492 dev->trans_start = jiffies;
493 return NETDEV_TX_OK;
436} 494}
437 495
438static struct net_device_stats *mace_stats(struct net_device *dev) 496static struct net_device_stats *mace_stats(struct net_device *dev)
439{ 497{
440 struct mace_data *p = (struct mace_data *) dev->priv; 498 struct mace_data *mp = netdev_priv(dev);
441 return &p->stats; 499 return &mp->stats;
442} 500}
443 501
444static void mace_set_multicast(struct net_device *dev) 502static void mace_set_multicast(struct net_device *dev)
445{ 503{
446 struct mace_data *mp = (struct mace_data *) dev->priv; 504 struct mace_data *mp = netdev_priv(dev);
447 volatile struct mace *mb = mp->mace; 505 volatile struct mace *mb = mp->mace;
448 int i, j; 506 int i, j;
449 u32 crc; 507 u32 crc;
450 u8 maccc; 508 u8 maccc;
509 unsigned long flags;
451 510
511 local_irq_save(flags);
452 maccc = mb->maccc; 512 maccc = mb->maccc;
453 mb->maccc &= ~PROM; 513 mb->maccc &= ~PROM;
454 514
@@ -473,116 +533,122 @@ static void mace_set_multicast(struct net_device *dev)
473 } 533 }
474 } 534 }
475 535
476 mb->iac = ADDRCHG | LOGADDR; 536 if (mp->chipid == BROKEN_ADDRCHG_REV)
477 while (mb->iac & ADDRCHG); 537 mb->iac = LOGADDR;
478 538 else {
479 for (i = 0; i < 8; ++i) { 539 mb->iac = ADDRCHG | LOGADDR;
480 mb->ladrf = multicast_filter[i]; 540 while ((mb->iac & ADDRCHG) != 0)
541 ;
481 } 542 }
543 for (i = 0; i < 8; ++i)
544 mb->ladrf = multicast_filter[i];
545 if (mp->chipid != BROKEN_ADDRCHG_REV)
546 mb->iac = 0;
482 } 547 }
483 548
484 mb->maccc = maccc; 549 mb->maccc = maccc;
550 local_irq_restore(flags);
485} 551}
486 552
487/*
488 * Miscellaneous interrupts are handled here. We may end up
489 * having to bash the chip on the head for bad errors
490 */
491
492static void mace_handle_misc_intrs(struct mace_data *mp, int intr) 553static void mace_handle_misc_intrs(struct mace_data *mp, int intr)
493{ 554{
494 volatile struct mace *mb = mp->mace; 555 volatile struct mace *mb = mp->mace;
495 static int mace_babbles, mace_jabbers; 556 static int mace_babbles, mace_jabbers;
496 557
497 if (intr & MPCO) { 558 if (intr & MPCO)
498 mp->stats.rx_missed_errors += 256; 559 mp->stats.rx_missed_errors += 256;
499 } 560 mp->stats.rx_missed_errors += mb->mpc; /* reading clears it */
500 mp->stats.rx_missed_errors += mb->mpc; /* reading clears it */ 561 if (intr & RNTPCO)
501
502 if (intr & RNTPCO) {
503 mp->stats.rx_length_errors += 256; 562 mp->stats.rx_length_errors += 256;
504 } 563 mp->stats.rx_length_errors += mb->rntpc; /* reading clears it */
505 mp->stats.rx_length_errors += mb->rntpc; /* reading clears it */ 564 if (intr & CERR)
506
507 if (intr & CERR) {
508 ++mp->stats.tx_heartbeat_errors; 565 ++mp->stats.tx_heartbeat_errors;
509 } 566 if (intr & BABBLE)
510 if (intr & BABBLE) { 567 if (mace_babbles++ < 4)
511 if (mace_babbles++ < 4) { 568 printk(KERN_DEBUG "macmace: babbling transmitter\n");
512 printk(KERN_DEBUG "mace: babbling transmitter\n"); 569 if (intr & JABBER)
513 } 570 if (mace_jabbers++ < 4)
514 } 571 printk(KERN_DEBUG "macmace: jabbering transceiver\n");
515 if (intr & JABBER) {
516 if (mace_jabbers++ < 4) {
517 printk(KERN_DEBUG "mace: jabbering transceiver\n");
518 }
519 }
520} 572}
521 573
522/* 574static irqreturn_t mace_interrupt(int irq, void *dev_id)
523 * A transmit error has occurred. (We kick the transmit side from
524 * the DMA completion)
525 */
526
527static void mace_xmit_error(struct net_device *dev)
528{ 575{
529 struct mace_data *mp = (struct mace_data *) dev->priv; 576 struct net_device *dev = (struct net_device *) dev_id;
577 struct mace_data *mp = netdev_priv(dev);
530 volatile struct mace *mb = mp->mace; 578 volatile struct mace *mb = mp->mace;
531 u8 xmtfs, xmtrc; 579 int intr, fs;
580 unsigned int flags;
532 581
533 xmtfs = mb->xmtfs; 582 /* don't want the dma interrupt handler to fire */
534 xmtrc = mb->xmtrc; 583 local_irq_save(flags);
535 584
536 if (xmtfs & XMTSV) { 585 intr = mb->ir; /* read interrupt register */
537 if (xmtfs & UFLO) { 586 mace_handle_misc_intrs(mp, intr);
538 printk("%s: DMA underrun.\n", dev->name); 587
539 mp->stats.tx_errors++; 588 if (intr & XMTINT) {
540 mp->stats.tx_fifo_errors++; 589 fs = mb->xmtfs;
541 mace_txdma_reset(dev); 590 if ((fs & XMTSV) == 0) {
591 printk(KERN_ERR "macmace: xmtfs not valid! (fs=%x)\n", fs);
592 mace_reset(dev);
593 /*
594 * XXX mace likes to hang the machine after a xmtfs error.
595 * This is hard to reproduce, reseting *may* help
596 */
542 } 597 }
543 if (xmtfs & RTRY) { 598 /* dma should have finished */
544 mp->stats.collisions++; 599 if (!mp->tx_count) {
600 printk(KERN_DEBUG "macmace: tx ring ran out? (fs=%x)\n", fs);
601 }
602 /* Update stats */
603 if (fs & (UFLO|LCOL|LCAR|RTRY)) {
604 ++mp->stats.tx_errors;
605 if (fs & LCAR)
606 ++mp->stats.tx_carrier_errors;
607 else if (fs & (UFLO|LCOL|RTRY)) {
608 ++mp->stats.tx_aborted_errors;
609 if (mb->xmtfs & UFLO) {
610 printk(KERN_ERR "%s: DMA underrun.\n", dev->name);
611 mp->stats.tx_fifo_errors++;
612 mace_txdma_reset(dev);
613 }
614 }
545 } 615 }
546 } 616 }
547}
548 617
549/* 618 if (mp->tx_count)
550 * A receive interrupt occurred. 619 netif_wake_queue(dev);
551 */
552 620
553static void mace_recv_interrupt(struct net_device *dev) 621 local_irq_restore(flags);
554{
555/* struct mace_data *mp = (struct mace_data *) dev->priv; */
556// volatile struct mace *mb = mp->mace;
557}
558 622
559/* 623 return IRQ_HANDLED;
560 * Process the chip interrupt 624}
561 */
562 625
563static irqreturn_t mace_interrupt(int irq, void *dev_id) 626static void mace_tx_timeout(struct net_device *dev)
564{ 627{
565 struct net_device *dev = (struct net_device *) dev_id; 628 struct mace_data *mp = netdev_priv(dev);
566 struct mace_data *mp = (struct mace_data *) dev->priv;
567 volatile struct mace *mb = mp->mace; 629 volatile struct mace *mb = mp->mace;
568 u8 ir; 630 unsigned long flags;
569 631
570 ir = mb->ir; 632 local_irq_save(flags);
571 mace_handle_misc_intrs(mp, ir);
572 633
573 if (ir & XMTINT) { 634 /* turn off both tx and rx and reset the chip */
574 mace_xmit_error(dev); 635 mb->maccc = 0;
575 } 636 printk(KERN_ERR "macmace: transmit timeout - resetting\n");
576 if (ir & RCVINT) { 637 mace_txdma_reset(dev);
577 mace_recv_interrupt(dev); 638 mace_reset(dev);
578 }
579 return IRQ_HANDLED;
580}
581 639
582static void mace_tx_timeout(struct net_device *dev) 640 /* restart rx dma */
583{ 641 mace_rxdma_reset(dev);
584/* struct mace_data *mp = (struct mace_data *) dev->priv; */ 642
585// volatile struct mace *mb = mp->mace; 643 mp->tx_count = N_TX_RING;
644 netif_wake_queue(dev);
645
646 /* turn it on! */
647 mb->maccc = ENXMT | ENRCV;
648 /* enable all interrupts except receive interrupts */
649 mb->imr = RCVINT;
650
651 local_irq_restore(flags);
586} 652}
587 653
588/* 654/*
@@ -591,40 +657,39 @@ static void mace_tx_timeout(struct net_device *dev)
591 657
592static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf) 658static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf)
593{ 659{
594 struct mace_data *mp = (struct mace_data *) dev->priv; 660 struct mace_data *mp = netdev_priv(dev);
595 struct sk_buff *skb; 661 struct sk_buff *skb;
662 unsigned int frame_status = mf->rcvsts;
596 663
597 if (mf->status & RS_OFLO) { 664 if (frame_status & (RS_OFLO | RS_CLSN | RS_FRAMERR | RS_FCSERR)) {
598 printk("%s: fifo overflow.\n", dev->name);
599 mp->stats.rx_errors++;
600 mp->stats.rx_fifo_errors++;
601 }
602 if (mf->status&(RS_CLSN|RS_FRAMERR|RS_FCSERR))
603 mp->stats.rx_errors++; 665 mp->stats.rx_errors++;
666 if (frame_status & RS_OFLO) {
667 printk(KERN_DEBUG "%s: fifo overflow.\n", dev->name);
668 mp->stats.rx_fifo_errors++;
669 }
670 if (frame_status & RS_CLSN)
671 mp->stats.collisions++;
672 if (frame_status & RS_FRAMERR)
673 mp->stats.rx_frame_errors++;
674 if (frame_status & RS_FCSERR)
675 mp->stats.rx_crc_errors++;
676 } else {
677 unsigned int frame_length = mf->rcvcnt + ((frame_status & 0x0F) << 8 );
604 678
605 if (mf->status&RS_CLSN) { 679 skb = dev_alloc_skb(frame_length + 2);
606 mp->stats.collisions++; 680 if (!skb) {
607 } 681 mp->stats.rx_dropped++;
608 if (mf->status&RS_FRAMERR) { 682 return;
609 mp->stats.rx_frame_errors++; 683 }
610 } 684 skb_reserve(skb, 2);
611 if (mf->status&RS_FCSERR) { 685 memcpy(skb_put(skb, frame_length), mf->data, frame_length);
612 mp->stats.rx_crc_errors++; 686
613 } 687 skb->protocol = eth_type_trans(skb, dev);
614 688 netif_rx(skb);
615 skb = dev_alloc_skb(mf->len+2); 689 dev->last_rx = jiffies;
616 if (!skb) { 690 mp->stats.rx_packets++;
617 mp->stats.rx_dropped++; 691 mp->stats.rx_bytes += frame_length;
618 return;
619 } 692 }
620 skb_reserve(skb,2);
621 memcpy(skb_put(skb, mf->len), mf->data, mf->len);
622
623 skb->protocol = eth_type_trans(skb, dev);
624 netif_rx(skb);
625 dev->last_rx = jiffies;
626 mp->stats.rx_packets++;
627 mp->stats.rx_bytes += mf->len;
628} 693}
629 694
630/* 695/*
@@ -634,7 +699,7 @@ static void mace_dma_rx_frame(struct net_device *dev, struct mace_frame *mf)
634static irqreturn_t mace_dma_intr(int irq, void *dev_id) 699static irqreturn_t mace_dma_intr(int irq, void *dev_id)
635{ 700{
636 struct net_device *dev = (struct net_device *) dev_id; 701 struct net_device *dev = (struct net_device *) dev_id;
637 struct mace_data *mp = (struct mace_data *) dev->priv; 702 struct mace_data *mp = netdev_priv(dev);
638 int left, head; 703 int left, head;
639 u16 status; 704 u16 status;
640 u32 baka; 705 u32 baka;
@@ -661,7 +726,8 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
661 /* Loop through the ring buffer and process new packages */ 726 /* Loop through the ring buffer and process new packages */
662 727
663 while (mp->rx_tail < head) { 728 while (mp->rx_tail < head) {
664 mace_dma_rx_frame(dev, (struct mace_frame *) (mp->rx_ring + (mp->rx_tail * 0x0800))); 729 mace_dma_rx_frame(dev, (struct mace_frame*) (mp->rx_ring
730 + (mp->rx_tail * MACE_BUFF_SIZE)));
665 mp->rx_tail++; 731 mp->rx_tail++;
666 } 732 }
667 733
@@ -688,9 +754,76 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
688 psc_write_word(PSC_ENETWR_CMD + mp->tx_sloti, 0x0100); 754 psc_write_word(PSC_ENETWR_CMD + mp->tx_sloti, 0x0100);
689 mp->tx_sloti ^= 0x10; 755 mp->tx_sloti ^= 0x10;
690 mp->tx_count++; 756 mp->tx_count++;
691 netif_wake_queue(dev);
692 } 757 }
693 return IRQ_HANDLED; 758 return IRQ_HANDLED;
694} 759}
695 760
696MODULE_LICENSE("GPL"); 761MODULE_LICENSE("GPL");
762MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
763
764static int __devexit mac_mace_device_remove (struct platform_device *pdev)
765{
766 struct net_device *dev = platform_get_drvdata(pdev);
767 struct mace_data *mp = netdev_priv(dev);
768
769 unregister_netdev(dev);
770
771 free_irq(dev->irq, dev);
772 free_irq(IRQ_MAC_MACE_DMA, dev);
773
774 dma_free_coherent(mp->device, N_RX_RING * MACE_BUFF_SIZE,
775 mp->rx_ring, mp->rx_ring_phys);
776 dma_free_coherent(mp->device, N_TX_RING * MACE_BUFF_SIZE,
777 mp->tx_ring, mp->tx_ring_phys);
778
779 free_netdev(dev);
780
781 return 0;
782}
783
784static struct platform_driver mac_mace_driver = {
785 .probe = mace_probe,
786 .remove = __devexit_p(mac_mace_device_remove),
787 .driver = {
788 .name = mac_mace_string,
789 },
790};
791
792static int __init mac_mace_init_module(void)
793{
794 int err;
795
796 if ((err = platform_driver_register(&mac_mace_driver))) {
797 printk(KERN_ERR "Driver registration failed\n");
798 return err;
799 }
800
801 mac_mace_device = platform_device_alloc(mac_mace_string, 0);
802 if (!mac_mace_device)
803 goto out_unregister;
804
805 if (platform_device_add(mac_mace_device)) {
806 platform_device_put(mac_mace_device);
807 mac_mace_device = NULL;
808 }
809
810 return 0;
811
812out_unregister:
813 platform_driver_unregister(&mac_mace_driver);
814
815 return -ENOMEM;
816}
817
818static void __exit mac_mace_cleanup_module(void)
819{
820 platform_driver_unregister(&mac_mace_driver);
821
822 if (mac_mace_device) {
823 platform_device_unregister(mac_mace_device);
824 mac_mace_device = NULL;
825 }
826}
827
828module_init(mac_mace_init_module);
829module_exit(mac_mace_cleanup_module);
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 8ca57a0a4c11..e9ecdbf352ae 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -130,6 +130,46 @@ static inline void bit_reverse_addr(unsigned char addr[6])
130 addr[i] = bitrev8(addr[i]); 130 addr[i] = bitrev8(addr[i]);
131} 131}
132 132
133static irqreturn_t macsonic_interrupt(int irq, void *dev_id)
134{
135 irqreturn_t result;
136 unsigned long flags;
137
138 local_irq_save(flags);
139 result = sonic_interrupt(irq, dev_id);
140 local_irq_restore(flags);
141 return result;
142}
143
144static int macsonic_open(struct net_device* dev)
145{
146 if (request_irq(dev->irq, &sonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
147 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
148 return -EAGAIN;
149 }
150 /* Under the A/UX interrupt scheme, the onboard SONIC interrupt comes
151 * in at priority level 3. However, we sometimes get the level 2 inter-
152 * rupt as well, which must prevent re-entrance of the sonic handler.
153 */
154 if (dev->irq == IRQ_AUTO_3)
155 if (request_irq(IRQ_NUBUS_9, &macsonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
156 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, IRQ_NUBUS_9);
157 free_irq(dev->irq, dev);
158 return -EAGAIN;
159 }
160 return sonic_open(dev);
161}
162
163static int macsonic_close(struct net_device* dev)
164{
165 int err;
166 err = sonic_close(dev);
167 free_irq(dev->irq, dev);
168 if (dev->irq == IRQ_AUTO_3)
169 free_irq(IRQ_NUBUS_9, dev);
170 return err;
171}
172
133int __init macsonic_init(struct net_device* dev) 173int __init macsonic_init(struct net_device* dev)
134{ 174{
135 struct sonic_local* lp = netdev_priv(dev); 175 struct sonic_local* lp = netdev_priv(dev);
@@ -160,8 +200,8 @@ int __init macsonic_init(struct net_device* dev)
160 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS 200 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
161 * SONIC_BUS_SCALE(lp->dma_bitmode)); 201 * SONIC_BUS_SCALE(lp->dma_bitmode));
162 202
163 dev->open = sonic_open; 203 dev->open = macsonic_open;
164 dev->stop = sonic_close; 204 dev->stop = macsonic_close;
165 dev->hard_start_xmit = sonic_send_packet; 205 dev->hard_start_xmit = sonic_send_packet;
166 dev->get_stats = sonic_get_stats; 206 dev->get_stats = sonic_get_stats;
167 dev->set_multicast_list = &sonic_multicast_list; 207 dev->set_multicast_list = &sonic_multicast_list;
@@ -402,7 +442,7 @@ int __init macsonic_ident(struct nubus_dev* ndev)
402 ndev->dr_sw == NUBUS_DRSW_DAYNA) 442 ndev->dr_sw == NUBUS_DRSW_DAYNA)
403 return MACSONIC_DAYNA; 443 return MACSONIC_DAYNA;
404 444
405 if (ndev->dr_hw == NUBUS_DRHW_SONIC_LC && 445 if (ndev->dr_hw == NUBUS_DRHW_APPLE_SONIC_LC &&
406 ndev->dr_sw == 0) { /* huh? */ 446 ndev->dr_sw == 0) { /* huh? */
407 return MACSONIC_APPLE16; 447 return MACSONIC_APPLE16;
408 } 448 }
@@ -522,7 +562,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
522 return macsonic_init(dev); 562 return macsonic_init(dev);
523} 563}
524 564
525static int __init mac_sonic_probe(struct platform_device *device) 565static int __init mac_sonic_probe(struct platform_device *pdev)
526{ 566{
527 struct net_device *dev; 567 struct net_device *dev;
528 struct sonic_local *lp; 568 struct sonic_local *lp;
@@ -534,8 +574,8 @@ static int __init mac_sonic_probe(struct platform_device *device)
534 return -ENOMEM; 574 return -ENOMEM;
535 575
536 lp = netdev_priv(dev); 576 lp = netdev_priv(dev);
537 lp->device = &device->dev; 577 lp->device = &pdev->dev;
538 SET_NETDEV_DEV(dev, &device->dev); 578 SET_NETDEV_DEV(dev, &pdev->dev);
539 SET_MODULE_OWNER(dev); 579 SET_MODULE_OWNER(dev);
540 580
541 /* This will catch fatal stuff like -ENOMEM as well as success */ 581 /* This will catch fatal stuff like -ENOMEM as well as success */
@@ -572,19 +612,17 @@ MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
572module_param(sonic_debug, int, 0); 612module_param(sonic_debug, int, 0);
573MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); 613MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
574 614
575#define SONIC_IRQ_FLAG IRQ_FLG_FAST
576
577#include "sonic.c" 615#include "sonic.c"
578 616
579static int __devexit mac_sonic_device_remove (struct platform_device *device) 617static int __devexit mac_sonic_device_remove (struct platform_device *pdev)
580{ 618{
581 struct net_device *dev = platform_get_drvdata(device); 619 struct net_device *dev = platform_get_drvdata(pdev);
582 struct sonic_local* lp = netdev_priv(dev); 620 struct sonic_local* lp = netdev_priv(dev);
583 621
584 unregister_netdev (dev); 622 unregister_netdev(dev);
585 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 623 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
586 lp->descriptors, lp->descriptors_laddr); 624 lp->descriptors, lp->descriptors_laddr);
587 free_netdev (dev); 625 free_netdev(dev);
588 626
589 return 0; 627 return 0;
590} 628}
@@ -607,9 +645,8 @@ static int __init mac_sonic_init_module(void)
607 } 645 }
608 646
609 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); 647 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
610 if (!mac_sonic_device) { 648 if (!mac_sonic_device)
611 goto out_unregister; 649 goto out_unregister;
612 }
613 650
614 if (platform_device_add(mac_sonic_device)) { 651 if (platform_device_add(mac_sonic_device)) {
615 platform_device_put(mac_sonic_device); 652 platform_device_put(mac_sonic_device);
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index d2767e6584a9..7053026d6c76 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -55,6 +55,53 @@
55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) 55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) 56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
57 57
58#elif defined(CONFIG_BFIN)
59
60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
61
62# if defined (CONFIG_BFIN561_EZKIT)
63#define SMC_CAN_USE_8BIT 0
64#define SMC_CAN_USE_16BIT 1
65#define SMC_CAN_USE_32BIT 1
66#define SMC_IO_SHIFT 0
67#define SMC_NOWAIT 1
68#define SMC_USE_BFIN_DMA 0
69
70
71#define SMC_inw(a, r) readw((a) + (r))
72#define SMC_outw(v, a, r) writew(v, (a) + (r))
73#define SMC_inl(a, r) readl((a) + (r))
74#define SMC_outl(v, a, r) writel(v, (a) + (r))
75#define SMC_outsl(a, r, p, l) outsl((unsigned long *)((a) + (r)), p, l)
76#define SMC_insl(a, r, p, l) insl ((unsigned long *)((a) + (r)), p, l)
77# else
78#define SMC_CAN_USE_8BIT 0
79#define SMC_CAN_USE_16BIT 1
80#define SMC_CAN_USE_32BIT 0
81#define SMC_IO_SHIFT 0
82#define SMC_NOWAIT 1
83#define SMC_USE_BFIN_DMA 0
84
85
86#define SMC_inw(a, r) readw((a) + (r))
87#define SMC_outw(v, a, r) writew(v, (a) + (r))
88#define SMC_outsw(a, r, p, l) outsw((unsigned long *)((a) + (r)), p, l)
89#define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l)
90# endif
91/* check if the mac in reg is valid */
92#define SMC_GET_MAC_ADDR(addr) \
93 do { \
94 unsigned int __v; \
95 __v = SMC_inw(ioaddr, ADDR0_REG); \
96 addr[0] = __v; addr[1] = __v >> 8; \
97 __v = SMC_inw(ioaddr, ADDR1_REG); \
98 addr[2] = __v; addr[3] = __v >> 8; \
99 __v = SMC_inw(ioaddr, ADDR2_REG); \
100 addr[4] = __v; addr[5] = __v >> 8; \
101 if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \
102 random_ether_addr(addr); \
103 } \
104 } while (0)
58#elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6) 105#elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6)
59 106
60/* We can only do 16-bit reads and writes in the static memory space. */ 107/* We can only do 16-bit reads and writes in the static memory space. */
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c
index c6320c719931..8069f3e32d83 100644
--- a/drivers/net/sonic.c
+++ b/drivers/net/sonic.c
@@ -50,29 +50,6 @@ static int sonic_open(struct net_device *dev)
50 if (sonic_debug > 2) 50 if (sonic_debug > 2)
51 printk("sonic_open: initializing sonic driver.\n"); 51 printk("sonic_open: initializing sonic driver.\n");
52 52
53 /*
54 * We don't need to deal with auto-irq stuff since we
55 * hardwire the sonic interrupt.
56 */
57/*
58 * XXX Horrible work around: We install sonic_interrupt as fast interrupt.
59 * This means that during execution of the handler interrupt are disabled
60 * covering another bug otherwise corrupting data. This doesn't mean
61 * this glue works ok under all situations.
62 *
63 * Note (dhd): this also appears to prevent lockups on the Macintrash
64 * when more than one Ethernet card is installed (knock on wood)
65 *
66 * Note (fthain): whether the above is still true is anyones guess. Certainly
67 * the buffer handling algorithms will not tolerate re-entrance without some
68 * mutual exclusion added. Anyway, the memcpy has now been eliminated from the
69 * rx code to make this a faster "fast interrupt".
70 */
71 if (request_irq(dev->irq, &sonic_interrupt, SONIC_IRQ_FLAG, "sonic", dev)) {
72 printk(KERN_ERR "\n%s: unable to get IRQ %d .\n", dev->name, dev->irq);
73 return -EAGAIN;
74 }
75
76 for (i = 0; i < SONIC_NUM_RRS; i++) { 53 for (i = 0; i < SONIC_NUM_RRS; i++) {
77 struct sk_buff *skb = dev_alloc_skb(SONIC_RBSIZE + 2); 54 struct sk_buff *skb = dev_alloc_skb(SONIC_RBSIZE + 2);
78 if (skb == NULL) { 55 if (skb == NULL) {
@@ -169,8 +146,6 @@ static int sonic_close(struct net_device *dev)
169 } 146 }
170 } 147 }
171 148
172 free_irq(dev->irq, dev); /* release the IRQ */
173
174 return 0; 149 return 0;
175} 150}
176 151
@@ -178,8 +153,13 @@ static void sonic_tx_timeout(struct net_device *dev)
178{ 153{
179 struct sonic_local *lp = netdev_priv(dev); 154 struct sonic_local *lp = netdev_priv(dev);
180 int i; 155 int i;
181 /* Stop the interrupts for this */ 156 /*
157 * put the Sonic into software-reset mode and
158 * disable all interrupts before releasing DMA buffers
159 */
182 SONIC_WRITE(SONIC_IMR, 0); 160 SONIC_WRITE(SONIC_IMR, 0);
161 SONIC_WRITE(SONIC_ISR, 0x7fff);
162 SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
183 /* We could resend the original skbs. Easier to re-initialise. */ 163 /* We could resend the original skbs. Easier to re-initialise. */
184 for (i = 0; i < SONIC_NUM_TDS; i++) { 164 for (i = 0; i < SONIC_NUM_TDS; i++) {
185 if(lp->tx_laddr[i]) { 165 if(lp->tx_laddr[i]) {
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c
index 396c3d961f88..a123ea87893b 100644
--- a/drivers/net/sun3_82586.c
+++ b/drivers/net/sun3_82586.c
@@ -1023,10 +1023,11 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
1023 { 1023 {
1024 len = skb->len; 1024 len = skb->len;
1025 if (len < ETH_ZLEN) { 1025 if (len < ETH_ZLEN) {
1026 memset((char *)p->xmit_cbuffs[p->xmit_count], 0, ETH_ZLEN); 1026 memset((void *)p->xmit_cbuffs[p->xmit_count], 0,
1027 ETH_ZLEN);
1027 len = ETH_ZLEN; 1028 len = ETH_ZLEN;
1028 } 1029 }
1029 skb_copy_from_linear_data(skb, p->xmit_cbuffs[p->xmit_count], skb->len); 1030 skb_copy_from_linear_data(skb, (void *)p->xmit_cbuffs[p->xmit_count], skb->len);
1030 1031
1031#if (NUM_XMIT_BUFFS == 1) 1032#if (NUM_XMIT_BUFFS == 1)
1032# ifdef NO_NOPCOMMANDS 1033# ifdef NO_NOPCOMMANDS
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 9488f49ea569..e5e901ecd808 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.75" 67#define DRV_MODULE_VERSION "3.76"
68#define DRV_MODULE_RELDATE "March 23, 2007" 68#define DRV_MODULE_RELDATE "May 5, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -1300,9 +1300,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
1300 msleep(1); 1300 msleep(1);
1301 } 1301 }
1302 } 1302 }
1303 tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE | 1303 if (tp->tg3_flags & TG3_FLAG_WOL_CAP)
1304 WOL_DRV_STATE_SHUTDOWN | 1304 tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE |
1305 WOL_DRV_WOL | WOL_SET_MAGIC_PKT); 1305 WOL_DRV_STATE_SHUTDOWN |
1306 WOL_DRV_WOL |
1307 WOL_SET_MAGIC_PKT);
1306 1308
1307 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); 1309 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
1308 1310
@@ -2593,10 +2595,8 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
2593{ 2595{
2594 int current_link_up = 0; 2596 int current_link_up = 0;
2595 2597
2596 if (!(mac_status & MAC_STATUS_PCS_SYNCED)) { 2598 if (!(mac_status & MAC_STATUS_PCS_SYNCED))
2597 tp->tg3_flags &= ~TG3_FLAG_GOT_SERDES_FLOWCTL;
2598 goto out; 2599 goto out;
2599 }
2600 2600
2601 if (tp->link_config.autoneg == AUTONEG_ENABLE) { 2601 if (tp->link_config.autoneg == AUTONEG_ENABLE) {
2602 u32 flags; 2602 u32 flags;
@@ -2614,7 +2614,6 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
2614 2614
2615 tg3_setup_flow_control(tp, local_adv, remote_adv); 2615 tg3_setup_flow_control(tp, local_adv, remote_adv);
2616 2616
2617 tp->tg3_flags |= TG3_FLAG_GOT_SERDES_FLOWCTL;
2618 current_link_up = 1; 2617 current_link_up = 1;
2619 } 2618 }
2620 for (i = 0; i < 30; i++) { 2619 for (i = 0; i < 30; i++) {
@@ -2637,7 +2636,6 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
2637 } else { 2636 } else {
2638 /* Forcing 1000FD link up. */ 2637 /* Forcing 1000FD link up. */
2639 current_link_up = 1; 2638 current_link_up = 1;
2640 tp->tg3_flags |= TG3_FLAG_GOT_SERDES_FLOWCTL;
2641 2639
2642 tw32_f(MAC_MODE, (tp->mac_mode | MAC_MODE_SEND_CONFIGS)); 2640 tw32_f(MAC_MODE, (tp->mac_mode | MAC_MODE_SEND_CONFIGS));
2643 udelay(40); 2641 udelay(40);
@@ -3021,6 +3019,16 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
3021 } 3019 }
3022 } 3020 }
3023 3021
3022 if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND) {
3023 u32 val = tr32(PCIE_PWR_MGMT_THRESH);
3024 if (!netif_carrier_ok(tp->dev))
3025 val = (val & ~PCIE_PWR_MGMT_L1_THRESH_MSK) |
3026 tp->pwrmgmt_thresh;
3027 else
3028 val |= PCIE_PWR_MGMT_L1_THRESH_MSK;
3029 tw32(PCIE_PWR_MGMT_THRESH, val);
3030 }
3031
3024 return err; 3032 return err;
3025} 3033}
3026 3034
@@ -3582,8 +3590,12 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
3582 * Writing non-zero to intr-mbox-0 additional tells the 3590 * Writing non-zero to intr-mbox-0 additional tells the
3583 * NIC to stop sending us irqs, engaging "in-intr-handler" 3591 * NIC to stop sending us irqs, engaging "in-intr-handler"
3584 * event coalescing. 3592 * event coalescing.
3593 *
3594 * Flush the mailbox to de-assert the IRQ immediately to prevent
3595 * spurious interrupts. The flush impacts performance but
3596 * excessive spurious interrupts can be worse in some cases.
3585 */ 3597 */
3586 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 3598 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3587 if (tg3_irq_sync(tp)) 3599 if (tg3_irq_sync(tp))
3588 goto out; 3600 goto out;
3589 sblk->status &= ~SD_STATUS_UPDATED; 3601 sblk->status &= ~SD_STATUS_UPDATED;
@@ -3627,8 +3639,12 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
3627 * writing non-zero to intr-mbox-0 additional tells the 3639 * writing non-zero to intr-mbox-0 additional tells the
3628 * NIC to stop sending us irqs, engaging "in-intr-handler" 3640 * NIC to stop sending us irqs, engaging "in-intr-handler"
3629 * event coalescing. 3641 * event coalescing.
3642 *
3643 * Flush the mailbox to de-assert the IRQ immediately to prevent
3644 * spurious interrupts. The flush impacts performance but
3645 * excessive spurious interrupts can be worse in some cases.
3630 */ 3646 */
3631 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 3647 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3632 if (tg3_irq_sync(tp)) 3648 if (tg3_irq_sync(tp))
3633 goto out; 3649 goto out;
3634 if (netif_rx_schedule_prep(dev)) { 3650 if (netif_rx_schedule_prep(dev)) {
@@ -3895,8 +3911,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3895 entry = tp->tx_prod; 3911 entry = tp->tx_prod;
3896 base_flags = 0; 3912 base_flags = 0;
3897 mss = 0; 3913 mss = 0;
3898 if (skb->len > (tp->dev->mtu + ETH_HLEN) && 3914 if ((mss = skb_shinfo(skb)->gso_size) != 0) {
3899 (mss = skb_shinfo(skb)->gso_size) != 0) {
3900 int tcp_opt_len, ip_tcp_len; 3915 int tcp_opt_len, ip_tcp_len;
3901 3916
3902 if (skb_header_cloned(skb) && 3917 if (skb_header_cloned(skb) &&
@@ -4053,8 +4068,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4053 if (skb->ip_summed == CHECKSUM_PARTIAL) 4068 if (skb->ip_summed == CHECKSUM_PARTIAL)
4054 base_flags |= TXD_FLAG_TCPUDP_CSUM; 4069 base_flags |= TXD_FLAG_TCPUDP_CSUM;
4055 mss = 0; 4070 mss = 0;
4056 if (skb->len > (tp->dev->mtu + ETH_HLEN) && 4071 if ((mss = skb_shinfo(skb)->gso_size) != 0) {
4057 (mss = skb_shinfo(skb)->gso_size) != 0) {
4058 struct iphdr *iph; 4072 struct iphdr *iph;
4059 int tcp_opt_len, ip_tcp_len, hdr_len; 4073 int tcp_opt_len, ip_tcp_len, hdr_len;
4060 4074
@@ -5934,7 +5948,7 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
5934 5948
5935 5949
5936/* tp->lock is held. */ 5950/* tp->lock is held. */
5937static void __tg3_set_mac_addr(struct tg3 *tp) 5951static void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
5938{ 5952{
5939 u32 addr_high, addr_low; 5953 u32 addr_high, addr_low;
5940 int i; 5954 int i;
@@ -5946,6 +5960,8 @@ static void __tg3_set_mac_addr(struct tg3 *tp)
5946 (tp->dev->dev_addr[4] << 8) | 5960 (tp->dev->dev_addr[4] << 8) |
5947 (tp->dev->dev_addr[5] << 0)); 5961 (tp->dev->dev_addr[5] << 0));
5948 for (i = 0; i < 4; i++) { 5962 for (i = 0; i < 4; i++) {
5963 if (i == 1 && skip_mac_1)
5964 continue;
5949 tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high); 5965 tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high);
5950 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low); 5966 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
5951 } 5967 }
@@ -5972,7 +5988,7 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
5972{ 5988{
5973 struct tg3 *tp = netdev_priv(dev); 5989 struct tg3 *tp = netdev_priv(dev);
5974 struct sockaddr *addr = p; 5990 struct sockaddr *addr = p;
5975 int err = 0; 5991 int err = 0, skip_mac_1 = 0;
5976 5992
5977 if (!is_valid_ether_addr(addr->sa_data)) 5993 if (!is_valid_ether_addr(addr->sa_data))
5978 return -EINVAL; 5994 return -EINVAL;
@@ -5983,22 +5999,21 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
5983 return 0; 5999 return 0;
5984 6000
5985 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { 6001 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
5986 /* Reset chip so that ASF can re-init any MAC addresses it 6002 u32 addr0_high, addr0_low, addr1_high, addr1_low;
5987 * needs.
5988 */
5989 tg3_netif_stop(tp);
5990 tg3_full_lock(tp, 1);
5991 6003
5992 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 6004 addr0_high = tr32(MAC_ADDR_0_HIGH);
5993 err = tg3_restart_hw(tp, 0); 6005 addr0_low = tr32(MAC_ADDR_0_LOW);
5994 if (!err) 6006 addr1_high = tr32(MAC_ADDR_1_HIGH);
5995 tg3_netif_start(tp); 6007 addr1_low = tr32(MAC_ADDR_1_LOW);
5996 tg3_full_unlock(tp); 6008
5997 } else { 6009 /* Skip MAC addr 1 if ASF is using it. */
5998 spin_lock_bh(&tp->lock); 6010 if ((addr0_high != addr1_high || addr0_low != addr1_low) &&
5999 __tg3_set_mac_addr(tp); 6011 !(addr1_high == 0 && addr1_low == 0))
6000 spin_unlock_bh(&tp->lock); 6012 skip_mac_1 = 1;
6001 } 6013 }
6014 spin_lock_bh(&tp->lock);
6015 __tg3_set_mac_addr(tp, skip_mac_1);
6016 spin_unlock_bh(&tp->lock);
6002 6017
6003 return err; 6018 return err;
6004} 6019}
@@ -6315,7 +6330,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6315 tp->rx_jumbo_ptr); 6330 tp->rx_jumbo_ptr);
6316 6331
6317 /* Initialize MAC address and backoff seed. */ 6332 /* Initialize MAC address and backoff seed. */
6318 __tg3_set_mac_addr(tp); 6333 __tg3_set_mac_addr(tp, 0);
6319 6334
6320 /* MTU + ethernet header + FCS + optional VLAN tag */ 6335 /* MTU + ethernet header + FCS + optional VLAN tag */
6321 tw32(MAC_RX_MTU_SIZE, tp->dev->mtu + ETH_HLEN + 8); 6336 tw32(MAC_RX_MTU_SIZE, tp->dev->mtu + ETH_HLEN + 8);
@@ -6346,8 +6361,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6346 tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) || 6361 tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) ||
6347 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)) { 6362 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)) {
6348 if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE && 6363 if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE &&
6349 (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 || 6364 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
6350 tp->pci_chip_rev_id == CHIPREV_ID_5705_A2)) {
6351 rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128; 6365 rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128;
6352 } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) && 6366 } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
6353 !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { 6367 !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
@@ -6457,6 +6471,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6457 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) 6471 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
6458 gpio_mask |= GRC_LCLCTRL_GPIO_UART_SEL; 6472 gpio_mask |= GRC_LCLCTRL_GPIO_UART_SEL;
6459 6473
6474 tp->grc_local_ctrl &= ~gpio_mask;
6460 tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; 6475 tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask;
6461 6476
6462 /* GPIO1 must be driven high for eeprom write protect */ 6477 /* GPIO1 must be driven high for eeprom write protect */
@@ -7036,11 +7051,7 @@ static int tg3_open(struct net_device *dev)
7036 if (err) 7051 if (err)
7037 return err; 7052 return err;
7038 7053
7039 if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && 7054 if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSI) {
7040 (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) &&
7041 (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX) &&
7042 !((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) &&
7043 (tp->pdev_peer == tp->pdev))) {
7044 /* All MSI supporting chips should support tagged 7055 /* All MSI supporting chips should support tagged
7045 * status. Assert that this is the case. 7056 * status. Assert that this is the case.
7046 */ 7057 */
@@ -7399,9 +7410,7 @@ static int tg3_close(struct net_device *dev)
7399 7410
7400 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 7411 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
7401 tg3_free_rings(tp); 7412 tg3_free_rings(tp);
7402 tp->tg3_flags &= 7413 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
7403 ~(TG3_FLAG_INIT_COMPLETE |
7404 TG3_FLAG_GOT_SERDES_FLOWCTL);
7405 7414
7406 tg3_full_unlock(tp); 7415 tg3_full_unlock(tp);
7407 7416
@@ -8036,7 +8045,10 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
8036{ 8045{
8037 struct tg3 *tp = netdev_priv(dev); 8046 struct tg3 *tp = netdev_priv(dev);
8038 8047
8039 wol->supported = WAKE_MAGIC; 8048 if (tp->tg3_flags & TG3_FLAG_WOL_CAP)
8049 wol->supported = WAKE_MAGIC;
8050 else
8051 wol->supported = 0;
8040 wol->wolopts = 0; 8052 wol->wolopts = 0;
8041 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) 8053 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)
8042 wol->wolopts = WAKE_MAGIC; 8054 wol->wolopts = WAKE_MAGIC;
@@ -8050,8 +8062,7 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
8050 if (wol->wolopts & ~WAKE_MAGIC) 8062 if (wol->wolopts & ~WAKE_MAGIC)
8051 return -EINVAL; 8063 return -EINVAL;
8052 if ((wol->wolopts & WAKE_MAGIC) && 8064 if ((wol->wolopts & WAKE_MAGIC) &&
8053 tp->tg3_flags2 & TG3_FLG2_ANY_SERDES && 8065 !(tp->tg3_flags & TG3_FLAG_WOL_CAP))
8054 !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP))
8055 return -EINVAL; 8066 return -EINVAL;
8056 8067
8057 spin_lock_bh(&tp->lock); 8068 spin_lock_bh(&tp->lock);
@@ -9289,7 +9300,7 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp)
9289 return; 9300 return;
9290 } 9301 }
9291 } 9302 }
9292 tp->nvram_size = 0x20000; 9303 tp->nvram_size = 0x80000;
9293} 9304}
9294 9305
9295static void __devinit tg3_get_nvram_info(struct tg3 *tp) 9306static void __devinit tg3_get_nvram_info(struct tg3 *tp)
@@ -9408,33 +9419,31 @@ static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp)
9408 9419
9409static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp) 9420static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp)
9410{ 9421{
9411 u32 nvcfg1; 9422 u32 nvcfg1, protect = 0;
9412 9423
9413 nvcfg1 = tr32(NVRAM_CFG1); 9424 nvcfg1 = tr32(NVRAM_CFG1);
9414 9425
9415 /* NVRAM protection for TPM */ 9426 /* NVRAM protection for TPM */
9416 if (nvcfg1 & (1 << 27)) 9427 if (nvcfg1 & (1 << 27)) {
9417 tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM; 9428 tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM;
9429 protect = 1;
9430 }
9418 9431
9419 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { 9432 nvcfg1 &= NVRAM_CFG1_5752VENDOR_MASK;
9420 case FLASH_5755VENDOR_ATMEL_EEPROM_64KHZ: 9433 switch (nvcfg1) {
9421 case FLASH_5755VENDOR_ATMEL_EEPROM_376KHZ:
9422 tp->nvram_jedecnum = JEDEC_ATMEL;
9423 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9424 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
9425
9426 nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
9427 tw32(NVRAM_CFG1, nvcfg1);
9428 break;
9429 case FLASH_5752VENDOR_ATMEL_FLASH_BUFFERED:
9430 case FLASH_5755VENDOR_ATMEL_FLASH_1: 9434 case FLASH_5755VENDOR_ATMEL_FLASH_1:
9431 case FLASH_5755VENDOR_ATMEL_FLASH_2: 9435 case FLASH_5755VENDOR_ATMEL_FLASH_2:
9432 case FLASH_5755VENDOR_ATMEL_FLASH_3: 9436 case FLASH_5755VENDOR_ATMEL_FLASH_3:
9433 case FLASH_5755VENDOR_ATMEL_FLASH_4:
9434 tp->nvram_jedecnum = JEDEC_ATMEL; 9437 tp->nvram_jedecnum = JEDEC_ATMEL;
9435 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; 9438 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9436 tp->tg3_flags2 |= TG3_FLG2_FLASH; 9439 tp->tg3_flags2 |= TG3_FLG2_FLASH;
9437 tp->nvram_pagesize = 264; 9440 tp->nvram_pagesize = 264;
9441 if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_1)
9442 tp->nvram_size = (protect ? 0x3e200 : 0x80000);
9443 else if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_2)
9444 tp->nvram_size = (protect ? 0x1f200 : 0x40000);
9445 else
9446 tp->nvram_size = (protect ? 0x1f200 : 0x20000);
9438 break; 9447 break;
9439 case FLASH_5752VENDOR_ST_M45PE10: 9448 case FLASH_5752VENDOR_ST_M45PE10:
9440 case FLASH_5752VENDOR_ST_M45PE20: 9449 case FLASH_5752VENDOR_ST_M45PE20:
@@ -9443,6 +9452,12 @@ static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp)
9443 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; 9452 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9444 tp->tg3_flags2 |= TG3_FLG2_FLASH; 9453 tp->tg3_flags2 |= TG3_FLG2_FLASH;
9445 tp->nvram_pagesize = 256; 9454 tp->nvram_pagesize = 256;
9455 if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE10)
9456 tp->nvram_size = (protect ? 0x10000 : 0x20000);
9457 else if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE20)
9458 tp->nvram_size = (protect ? 0x10000 : 0x40000);
9459 else
9460 tp->nvram_size = (protect ? 0x20000 : 0x80000);
9446 break; 9461 break;
9447 } 9462 }
9448} 9463}
@@ -9518,6 +9533,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
9518 } 9533 }
9519 tg3_enable_nvram_access(tp); 9534 tg3_enable_nvram_access(tp);
9520 9535
9536 tp->nvram_size = 0;
9537
9521 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 9538 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
9522 tg3_get_5752_nvram_info(tp); 9539 tg3_get_5752_nvram_info(tp);
9523 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) 9540 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
@@ -9529,7 +9546,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
9529 else 9546 else
9530 tg3_get_nvram_info(tp); 9547 tg3_get_nvram_info(tp);
9531 9548
9532 tg3_get_nvram_size(tp); 9549 if (tp->nvram_size == 0)
9550 tg3_get_nvram_size(tp);
9533 9551
9534 tg3_disable_nvram_access(tp); 9552 tg3_disable_nvram_access(tp);
9535 tg3_nvram_unlock(tp); 9553 tg3_nvram_unlock(tp);
@@ -9996,14 +10014,16 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9996 tp->phy_id = PHY_ID_INVALID; 10014 tp->phy_id = PHY_ID_INVALID;
9997 tp->led_ctrl = LED_CTRL_MODE_PHY_1; 10015 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
9998 10016
9999 /* Assume an onboard device by default. */ 10017 /* Assume an onboard device and WOL capable by default. */
10000 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 10018 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT | TG3_FLAG_WOL_CAP;
10001 10019
10002 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 10020 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
10003 if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) { 10021 if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) {
10004 tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; 10022 tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
10005 tp->tg3_flags2 |= TG3_FLG2_IS_NIC; 10023 tp->tg3_flags2 |= TG3_FLG2_IS_NIC;
10006 } 10024 }
10025 if (tr32(VCPU_CFGSHDW) & VCPU_CFGSHDW_ASPM_DBNC)
10026 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
10007 return; 10027 return;
10008 } 10028 }
10009 10029
@@ -10120,8 +10140,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10120 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 10140 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
10121 tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; 10141 tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE;
10122 } 10142 }
10123 if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL) 10143 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES &&
10124 tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP; 10144 !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
10145 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
10125 10146
10126 if (cfg2 & (1 << 17)) 10147 if (cfg2 & (1 << 17))
10127 tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING; 10148 tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING;
@@ -10130,6 +10151,14 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10130 /* bootcode if bit 18 is set */ 10151 /* bootcode if bit 18 is set */
10131 if (cfg2 & (1 << 18)) 10152 if (cfg2 & (1 << 18))
10132 tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; 10153 tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS;
10154
10155 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
10156 u32 cfg3;
10157
10158 tg3_read_mem(tp, NIC_SRAM_DATA_CFG_3, &cfg3);
10159 if (cfg3 & NIC_SRAM_ASPM_DEBOUNCE)
10160 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
10161 }
10133 } 10162 }
10134} 10163}
10135 10164
@@ -10399,6 +10428,8 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
10399 } 10428 }
10400} 10429}
10401 10430
10431static struct pci_dev * __devinit tg3_find_peer(struct tg3 *);
10432
10402static int __devinit tg3_get_invariants(struct tg3 *tp) 10433static int __devinit tg3_get_invariants(struct tg3 *tp)
10403{ 10434{
10404 static struct pci_device_id write_reorder_chipsets[] = { 10435 static struct pci_device_id write_reorder_chipsets[] = {
@@ -10554,6 +10585,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10554 tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff; 10585 tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff;
10555 tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; 10586 tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff;
10556 10587
10588 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
10589 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714))
10590 tp->pdev_peer = tg3_find_peer(tp);
10591
10557 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || 10592 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
10558 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || 10593 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
10559 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || 10594 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
@@ -10567,6 +10602,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10567 tp->tg3_flags2 |= TG3_FLG2_5705_PLUS; 10602 tp->tg3_flags2 |= TG3_FLG2_5705_PLUS;
10568 10603
10569 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { 10604 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {
10605 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSI;
10606 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX ||
10607 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_BX ||
10608 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 &&
10609 tp->pci_chip_rev_id <= CHIPREV_ID_5714_A2 &&
10610 tp->pdev_peer == tp->pdev))
10611 tp->tg3_flags &= ~TG3_FLAG_SUPPORT_MSI;
10612
10570 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || 10613 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
10571 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || 10614 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
10572 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 10615 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
@@ -10668,17 +10711,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10668 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) 10711 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX)
10669 tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG; 10712 tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG;
10670 10713
10671 /* Back to back register writes can cause problems on this chip,
10672 * the workaround is to read back all reg writes except those to
10673 * mailbox regs. See tg3_write_indirect_reg32().
10674 *
10675 * PCI Express 5750_A0 rev chips need this workaround too.
10676 */
10677 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
10678 ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
10679 tp->pci_chip_rev_id == CHIPREV_ID_5750_A0))
10680 tp->tg3_flags |= TG3_FLAG_5701_REG_WRITE_BUG;
10681
10682 if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0) 10714 if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0)
10683 tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED; 10715 tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED;
10684 if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0) 10716 if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0)
@@ -10702,8 +10734,19 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10702 /* Various workaround register access methods */ 10734 /* Various workaround register access methods */
10703 if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) 10735 if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG)
10704 tp->write32 = tg3_write_indirect_reg32; 10736 tp->write32 = tg3_write_indirect_reg32;
10705 else if (tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) 10737 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
10738 ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
10739 tp->pci_chip_rev_id == CHIPREV_ID_5750_A0)) {
10740 /*
10741 * Back to back register writes can cause problems on these
10742 * chips, the workaround is to read back all reg writes
10743 * except those to mailbox regs.
10744 *
10745 * See tg3_write_indirect_reg32().
10746 */
10706 tp->write32 = tg3_write_flush_reg32; 10747 tp->write32 = tg3_write_flush_reg32;
10748 }
10749
10707 10750
10708 if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) || 10751 if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) ||
10709 (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) { 10752 (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) {
@@ -10983,6 +11026,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10983 */ 11026 */
10984 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE; 11027 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
10985 11028
11029 if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND)
11030 tp->pwrmgmt_thresh = tr32(PCIE_PWR_MGMT_THRESH) &
11031 PCIE_PWR_MGMT_L1_THRESH_MSK;
11032
10986 return err; 11033 return err;
10987} 11034}
10988 11035
@@ -11892,10 +11939,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11892 tp->rx_pending = 63; 11939 tp->rx_pending = 63;
11893 } 11940 }
11894 11941
11895 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
11896 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714))
11897 tp->pdev_peer = tg3_find_peer(tp);
11898
11899 err = tg3_get_device_address(tp); 11942 err = tg3_get_device_address(tp);
11900 if (err) { 11943 if (err) {
11901 printk(KERN_ERR PFX "Could not obtain valid ethernet address, " 11944 printk(KERN_ERR PFX "Could not obtain valid ethernet address, "
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d515ed23841b..4d334cf5a243 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -131,6 +131,7 @@
131#define CHIPREV_ID_5752_A0_HW 0x5000 131#define CHIPREV_ID_5752_A0_HW 0x5000
132#define CHIPREV_ID_5752_A0 0x6000 132#define CHIPREV_ID_5752_A0 0x6000
133#define CHIPREV_ID_5752_A1 0x6001 133#define CHIPREV_ID_5752_A1 0x6001
134#define CHIPREV_ID_5714_A2 0x9002
134#define CHIPREV_ID_5906_A1 0xc001 135#define CHIPREV_ID_5906_A1 0xc001
135#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) 136#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
136#define ASIC_REV_5700 0x07 137#define ASIC_REV_5700 0x07
@@ -1149,6 +1150,9 @@
1149#define VCPU_STATUS_INIT_DONE 0x04000000 1150#define VCPU_STATUS_INIT_DONE 0x04000000
1150#define VCPU_STATUS_DRV_RESET 0x08000000 1151#define VCPU_STATUS_DRV_RESET 0x08000000
1151 1152
1153#define VCPU_CFGSHDW 0x00005104
1154#define VCPU_CFGSHDW_ASPM_DBNC 0x00001000
1155
1152/* Mailboxes */ 1156/* Mailboxes */
1153#define GRCMBOX_BASE 0x00005600 1157#define GRCMBOX_BASE 0x00005600
1154#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ 1158#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */
@@ -1506,6 +1510,8 @@
1506#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000 1510#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000
1507#define PCIE_TRANS_CFG_LOM 0x00000020 1511#define PCIE_TRANS_CFG_LOM 0x00000020
1508 1512
1513#define PCIE_PWR_MGMT_THRESH 0x00007d28
1514#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00
1509 1515
1510#define TG3_EEPROM_MAGIC 0x669955aa 1516#define TG3_EEPROM_MAGIC 0x669955aa
1511#define TG3_EEPROM_MAGIC_FW 0xa5000000 1517#define TG3_EEPROM_MAGIC_FW 0xa5000000
@@ -1592,6 +1598,9 @@
1592#define SHASTA_EXT_LED_MAC 0x00010000 1598#define SHASTA_EXT_LED_MAC 0x00010000
1593#define SHASTA_EXT_LED_COMBO 0x00018000 1599#define SHASTA_EXT_LED_COMBO 0x00018000
1594 1600
1601#define NIC_SRAM_DATA_CFG_3 0x00000d3c
1602#define NIC_SRAM_ASPM_DEBOUNCE 0x00000002
1603
1595#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 1604#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000
1596 1605
1597#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 1606#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000
@@ -2199,7 +2208,7 @@ struct tg3 {
2199#define TG3_FLAG_USE_LINKCHG_REG 0x00000008 2208#define TG3_FLAG_USE_LINKCHG_REG 0x00000008
2200#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010 2209#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010
2201#define TG3_FLAG_ENABLE_ASF 0x00000020 2210#define TG3_FLAG_ENABLE_ASF 0x00000020
2202#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040 2211#define TG3_FLAG_ASPM_WORKAROUND 0x00000040
2203#define TG3_FLAG_POLL_SERDES 0x00000080 2212#define TG3_FLAG_POLL_SERDES 0x00000080
2204#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100 2213#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100
2205#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200 2214#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200
@@ -2215,14 +2224,14 @@ struct tg3 {
2215#define TG3_FLAG_PCI_32BIT 0x00080000 2224#define TG3_FLAG_PCI_32BIT 0x00080000
2216#define TG3_FLAG_SRAM_USE_CONFIG 0x00100000 2225#define TG3_FLAG_SRAM_USE_CONFIG 0x00100000
2217#define TG3_FLAG_TX_RECOVERY_PENDING 0x00200000 2226#define TG3_FLAG_TX_RECOVERY_PENDING 0x00200000
2218#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 2227#define TG3_FLAG_WOL_CAP 0x00400000
2219#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 2228#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000
2220#define TG3_FLAG_10_100_ONLY 0x01000000 2229#define TG3_FLAG_10_100_ONLY 0x01000000
2221#define TG3_FLAG_PAUSE_AUTONEG 0x02000000 2230#define TG3_FLAG_PAUSE_AUTONEG 0x02000000
2222#define TG3_FLAG_IN_RESET_TASK 0x04000000 2231#define TG3_FLAG_IN_RESET_TASK 0x04000000
2223#define TG3_FLAG_40BIT_DMA_BUG 0x08000000 2232#define TG3_FLAG_40BIT_DMA_BUG 0x08000000
2224#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 2233#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000
2225#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 2234#define TG3_FLAG_SUPPORT_MSI 0x20000000
2226#define TG3_FLAG_CHIP_RESETTING 0x40000000 2235#define TG3_FLAG_CHIP_RESETTING 0x40000000
2227#define TG3_FLAG_INIT_COMPLETE 0x80000000 2236#define TG3_FLAG_INIT_COMPLETE 0x80000000
2228 u32 tg3_flags2; 2237 u32 tg3_flags2;
@@ -2288,6 +2297,7 @@ struct tg3 {
2288 u32 grc_local_ctrl; 2297 u32 grc_local_ctrl;
2289 u32 dma_rwctrl; 2298 u32 dma_rwctrl;
2290 u32 coalesce_mode; 2299 u32 coalesce_mode;
2300 u32 pwrmgmt_thresh;
2291 2301
2292 /* PCI block */ 2302 /* PCI block */
2293 u16 pci_chip_rev_id; 2303 u16 pci_chip_rev_id;
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
index ed274d6909d0..f8f4d74f01f1 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -23,7 +23,6 @@ static const char version[] = "madgemc.c: v0.91 23/01/2000 by Adam Fritzler\n";
23#include <linux/mca.h> 23#include <linux/mca.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/pci.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/netdevice.h> 27#include <linux/netdevice.h>
29#include <linux/trdevice.h> 28#include <linux/trdevice.h>
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 9bbea5c8acf4..58d7e5d452fa 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -41,7 +41,6 @@
41#include <linux/time.h> 41#include <linux/time.h>
42#include <linux/errno.h> 42#include <linux/errno.h>
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/pci.h>
45#include <linux/mca-legacy.h> 44#include <linux/mca-legacy.h>
46#include <linux/delay.h> 45#include <linux/delay.h>
47#include <linux/netdevice.h> 46#include <linux/netdevice.h>
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index 942b839ccc5b..6c400ccd38b4 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -14,7 +14,6 @@
14 14
15*/ 15*/
16 16
17#include <linux/pci.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include "tulip.h" 18#include "tulip.h"
20 19
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c
index 85a521e0d052..be82a2effee3 100644
--- a/drivers/net/tulip/pnic.c
+++ b/drivers/net/tulip/pnic.c
@@ -15,7 +15,6 @@
15*/ 15*/
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/pci.h>
19#include <linux/jiffies.h> 18#include <linux/jiffies.h>
20#include "tulip.h" 19#include "tulip.h"
21 20
diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/tulip/pnic2.c
index c31be0e377a8..4e4a879c3fa5 100644
--- a/drivers/net/tulip/pnic2.c
+++ b/drivers/net/tulip/pnic2.c
@@ -76,7 +76,6 @@
76 76
77 77
78 78
79#include <linux/pci.h>
80#include "tulip.h" 79#include "tulip.h"
81#include <linux/delay.h> 80#include <linux/delay.h>
82 81
diff --git a/drivers/net/tulip/timer.c b/drivers/net/tulip/timer.c
index df326fe1cc8f..d2c1f42109b0 100644
--- a/drivers/net/tulip/timer.c
+++ b/drivers/net/tulip/timer.c
@@ -14,7 +14,6 @@
14 14
15*/ 15*/
16 16
17#include <linux/pci.h>
18#include "tulip.h" 17#include "tulip.h"
19 18
20 19
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index c840d2e67b23..16f26a8364f0 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -22,6 +22,7 @@
22#include <linux/netdevice.h> 22#include <linux/netdevice.h>
23#include <linux/timer.h> 23#include <linux/timer.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/pci.h>
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/irq.h> 27#include <asm/irq.h>
27 28
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c
index ae01555d24cf..574737b55f39 100644
--- a/drivers/net/wan/lmc/lmc_media.c
+++ b/drivers/net/wan/lmc/lmc_media.c
@@ -8,7 +8,6 @@
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/pci.h>
12#include <linux/in.h> 11#include <linux/in.h>
13#include <linux/if_arp.h> 12#include <linux/if_arp.h>
14#include <linux/netdevice.h> 13#include <linux/netdevice.h>
diff --git a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c
index 74876c0073e8..31e1799571ad 100644
--- a/drivers/net/wan/lmc/lmc_proto.c
+++ b/drivers/net/wan/lmc/lmc_proto.c
@@ -27,7 +27,6 @@
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/pci.h>
31#include <linux/in.h> 30#include <linux/in.h>
32#include <linux/if_arp.h> 31#include <linux/if_arp.h>
33#include <linux/netdevice.h> 32#include <linux/netdevice.h>
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c
index 07dbdfbfc15d..e24a7b095dd6 100644
--- a/drivers/net/wan/pc300_tty.c
+++ b/drivers/net/wan/pc300_tty.c
@@ -38,7 +38,6 @@
38 38
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/kernel.h> 40#include <linux/kernel.h>
41#include <linux/pci.h>
42#include <linux/errno.h> 41#include <linux/errno.h>
43#include <linux/string.h> 42#include <linux/string.h>
44#include <linux/init.h> 43#include <linux/init.h>
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index c4b3dc291a5a..0184614517f9 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -153,8 +153,8 @@ config IPW2100
153 153
154 If you want to compile the driver as a module ( = code which can be 154 If you want to compile the driver as a module ( = code which can be
155 inserted in and removed from the running kernel whenever you want), 155 inserted in and removed from the running kernel whenever you want),
156 say M here and read <file:Documentation/modules.txt>. The module 156 say M here and read <file:Documentation/kbuild/modules.txt>.
157 will be called ipw2100.ko. 157 The module will be called ipw2100.ko.
158 158
159config IPW2100_MONITOR 159config IPW2100_MONITOR
160 bool "Enable promiscuous mode" 160 bool "Enable promiscuous mode"
@@ -208,8 +208,8 @@ config IPW2200
208 208
209 If you want to compile the driver as a module ( = code which can be 209 If you want to compile the driver as a module ( = code which can be
210 inserted in and removed from the running kernel whenever you want), 210 inserted in and removed from the running kernel whenever you want),
211 say M here and read <file:Documentation/modules.txt>. The module 211 say M here and read <file:Documentation/kbuild/modules.txt>.
212 will be called ipw2200.ko. 212 The module will be called ipw2200.ko.
213 213
214config IPW2200_MONITOR 214config IPW2200_MONITOR
215 bool "Enable promiscuous mode" 215 bool "Enable promiscuous mode"
@@ -517,8 +517,8 @@ config PRISM54
517 517
518 If you want to compile the driver as a module ( = code which can be 518 If you want to compile the driver as a module ( = code which can be
519 inserted in and removed from the running kernel whenever you want), 519 inserted in and removed from the running kernel whenever you want),
520 say M here and read <file:Documentation/modules.txt>. The module 520 say M here and read <file:Documentation/kbuild/modules.txt>.
521 will be called prism54.ko. 521 The module will be called prism54.ko.
522 522
523config USB_ZD1201 523config USB_ZD1201
524 tristate "USB ZD1201 based Wireless device support" 524 tristate "USB ZD1201 based Wireless device support"
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 2a299a0676a6..ef32a5c1e818 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1971,8 +1971,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
1971 sizeof(zero_address))) { 1971 sizeof(zero_address))) {
1972 struct net_device *dev; 1972 struct net_device *dev;
1973 read_lock_bh(&dev_base_lock); 1973 read_lock_bh(&dev_base_lock);
1974 dev = dev_base; 1974 for_each_netdev(dev) {
1975 while (dev) {
1976 if (dev->type == strip_info->dev->type && 1975 if (dev->type == strip_info->dev->type &&
1977 !memcmp(dev->dev_addr, 1976 !memcmp(dev->dev_addr,
1978 &strip_info->true_dev_addr, 1977 &strip_info->true_dev_addr,
@@ -1983,7 +1982,6 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
1983 read_unlock_bh(&dev_base_lock); 1982 read_unlock_bh(&dev_base_lock);
1984 return (dev); 1983 return (dev);
1985 } 1984 }
1986 dev = dev->next;
1987 } 1985 }
1988 read_unlock_bh(&dev_base_lock); 1986 read_unlock_bh(&dev_base_lock);
1989 } 1987 }
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
index 9bb4db552f3c..a68b3b3761a2 100644
--- a/drivers/parisc/hppb.c
+++ b/drivers/parisc/hppb.c
@@ -22,8 +22,6 @@
22#include <asm/hardware.h> 22#include <asm/hardware.h>
23#include <asm/parisc-device.h> 23#include <asm/parisc-device.h>
24 24
25#include <linux/pci.h>
26
27struct hppb_card { 25struct hppb_card {
28 unsigned long hpa; 26 unsigned long hpa;
29 struct resource mmio_region; 27 struct resource mmio_region;
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 3df82fe9ce8c..98be2880757d 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -365,7 +365,7 @@ static __inline__ int led_get_net_activity(void)
365 * for reading should be OK */ 365 * for reading should be OK */
366 read_lock(&dev_base_lock); 366 read_lock(&dev_base_lock);
367 rcu_read_lock(); 367 rcu_read_lock();
368 for (dev = dev_base; dev; dev = dev->next) { 368 for_each_netdev(dev) {
369 struct net_device_stats *stats; 369 struct net_device_stats *stats;
370 struct in_device *in_dev = __in_dev_get_rcu(dev); 370 struct in_device *in_dev = __in_dev_get_rcu(dev);
371 if (!in_dev || !in_dev->ifa_list) 371 if (!in_dev || !in_dev->ifa_list)
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index ea1b7a63598e..815e445c3125 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -520,17 +520,17 @@ static struct pdcspath_entry *pdcspath_entries[] = {
520 520
521/** 521/**
522 * pdcs_size_read - Stable Storage size output. 522 * pdcs_size_read - Stable Storage size output.
523 * @entry: An allocated and populated subsytem struct. We don't use it tho. 523 * @kset: An allocated and populated struct kset. We don't use it tho.
524 * @buf: The output buffer to write to. 524 * @buf: The output buffer to write to.
525 */ 525 */
526static ssize_t 526static ssize_t
527pdcs_size_read(struct subsystem *entry, char *buf) 527pdcs_size_read(struct kset *kset, char *buf)
528{ 528{
529 char *out = buf; 529 char *out = buf;
530 530
531 if (!entry || !buf) 531 if (!kset || !buf)
532 return -EINVAL; 532 return -EINVAL;
533 533
534 /* show the size of the stable storage */ 534 /* show the size of the stable storage */
535 out += sprintf(out, "%ld\n", pdcs_size); 535 out += sprintf(out, "%ld\n", pdcs_size);
536 536
@@ -539,17 +539,17 @@ pdcs_size_read(struct subsystem *entry, char *buf)
539 539
540/** 540/**
541 * pdcs_auto_read - Stable Storage autoboot/search flag output. 541 * pdcs_auto_read - Stable Storage autoboot/search flag output.
542 * @entry: An allocated and populated subsytem struct. We don't use it tho. 542 * @kset: An allocated and populated struct kset. We don't use it tho.
543 * @buf: The output buffer to write to. 543 * @buf: The output buffer to write to.
544 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag 544 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
545 */ 545 */
546static ssize_t 546static ssize_t
547pdcs_auto_read(struct subsystem *entry, char *buf, int knob) 547pdcs_auto_read(struct kset *kset, char *buf, int knob)
548{ 548{
549 char *out = buf; 549 char *out = buf;
550 struct pdcspath_entry *pathentry; 550 struct pdcspath_entry *pathentry;
551 551
552 if (!entry || !buf) 552 if (!kset || !buf)
553 return -EINVAL; 553 return -EINVAL;
554 554
555 /* Current flags are stored in primary boot path entry */ 555 /* Current flags are stored in primary boot path entry */
@@ -565,40 +565,40 @@ pdcs_auto_read(struct subsystem *entry, char *buf, int knob)
565 565
566/** 566/**
567 * pdcs_autoboot_read - Stable Storage autoboot flag output. 567 * pdcs_autoboot_read - Stable Storage autoboot flag output.
568 * @entry: An allocated and populated subsytem struct. We don't use it tho. 568 * @kset: An allocated and populated struct kset. We don't use it tho.
569 * @buf: The output buffer to write to. 569 * @buf: The output buffer to write to.
570 */ 570 */
571static inline ssize_t 571static inline ssize_t
572pdcs_autoboot_read(struct subsystem *entry, char *buf) 572pdcs_autoboot_read(struct kset *kset, char *buf)
573{ 573{
574 return pdcs_auto_read(entry, buf, PF_AUTOBOOT); 574 return pdcs_auto_read(kset, buf, PF_AUTOBOOT);
575} 575}
576 576
577/** 577/**
578 * pdcs_autosearch_read - Stable Storage autoboot flag output. 578 * pdcs_autosearch_read - Stable Storage autoboot flag output.
579 * @entry: An allocated and populated subsytem struct. We don't use it tho. 579 * @kset: An allocated and populated struct kset. We don't use it tho.
580 * @buf: The output buffer to write to. 580 * @buf: The output buffer to write to.
581 */ 581 */
582static inline ssize_t 582static inline ssize_t
583pdcs_autosearch_read(struct subsystem *entry, char *buf) 583pdcs_autosearch_read(struct kset *kset, char *buf)
584{ 584{
585 return pdcs_auto_read(entry, buf, PF_AUTOSEARCH); 585 return pdcs_auto_read(kset, buf, PF_AUTOSEARCH);
586} 586}
587 587
588/** 588/**
589 * pdcs_timer_read - Stable Storage timer count output (in seconds). 589 * pdcs_timer_read - Stable Storage timer count output (in seconds).
590 * @entry: An allocated and populated subsytem struct. We don't use it tho. 590 * @kset: An allocated and populated struct kset. We don't use it tho.
591 * @buf: The output buffer to write to. 591 * @buf: The output buffer to write to.
592 * 592 *
593 * The value of the timer field correponds to a number of seconds in powers of 2. 593 * The value of the timer field correponds to a number of seconds in powers of 2.
594 */ 594 */
595static ssize_t 595static ssize_t
596pdcs_timer_read(struct subsystem *entry, char *buf) 596pdcs_timer_read(struct kset *kset, char *buf)
597{ 597{
598 char *out = buf; 598 char *out = buf;
599 struct pdcspath_entry *pathentry; 599 struct pdcspath_entry *pathentry;
600 600
601 if (!entry || !buf) 601 if (!kset || !buf)
602 return -EINVAL; 602 return -EINVAL;
603 603
604 /* Current flags are stored in primary boot path entry */ 604 /* Current flags are stored in primary boot path entry */
@@ -615,15 +615,15 @@ pdcs_timer_read(struct subsystem *entry, char *buf)
615 615
616/** 616/**
617 * pdcs_osid_read - Stable Storage OS ID register output. 617 * pdcs_osid_read - Stable Storage OS ID register output.
618 * @entry: An allocated and populated subsytem struct. We don't use it tho. 618 * @kset: An allocated and populated struct kset. We don't use it tho.
619 * @buf: The output buffer to write to. 619 * @buf: The output buffer to write to.
620 */ 620 */
621static ssize_t 621static ssize_t
622pdcs_osid_read(struct subsystem *entry, char *buf) 622pdcs_osid_read(struct kset *kset, char *buf)
623{ 623{
624 char *out = buf; 624 char *out = buf;
625 625
626 if (!entry || !buf) 626 if (!kset || !buf)
627 return -EINVAL; 627 return -EINVAL;
628 628
629 out += sprintf(out, "%s dependent data (0x%.4x)\n", 629 out += sprintf(out, "%s dependent data (0x%.4x)\n",
@@ -634,18 +634,18 @@ pdcs_osid_read(struct subsystem *entry, char *buf)
634 634
635/** 635/**
636 * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. 636 * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output.
637 * @entry: An allocated and populated subsytem struct. We don't use it tho. 637 * @kset: An allocated and populated struct kset. We don't use it tho.
638 * @buf: The output buffer to write to. 638 * @buf: The output buffer to write to.
639 * 639 *
640 * This can hold 16 bytes of OS-Dependent data. 640 * This can hold 16 bytes of OS-Dependent data.
641 */ 641 */
642static ssize_t 642static ssize_t
643pdcs_osdep1_read(struct subsystem *entry, char *buf) 643pdcs_osdep1_read(struct kset *kset, char *buf)
644{ 644{
645 char *out = buf; 645 char *out = buf;
646 u32 result[4]; 646 u32 result[4];
647 647
648 if (!entry || !buf) 648 if (!kset || !buf)
649 return -EINVAL; 649 return -EINVAL;
650 650
651 if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) 651 if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK)
@@ -661,18 +661,18 @@ pdcs_osdep1_read(struct subsystem *entry, char *buf)
661 661
662/** 662/**
663 * pdcs_diagnostic_read - Stable Storage Diagnostic register output. 663 * pdcs_diagnostic_read - Stable Storage Diagnostic register output.
664 * @entry: An allocated and populated subsytem struct. We don't use it tho. 664 * @kset: An allocated and populated struct kset. We don't use it tho.
665 * @buf: The output buffer to write to. 665 * @buf: The output buffer to write to.
666 * 666 *
667 * I have NFC how to interpret the content of that register ;-). 667 * I have NFC how to interpret the content of that register ;-).
668 */ 668 */
669static ssize_t 669static ssize_t
670pdcs_diagnostic_read(struct subsystem *entry, char *buf) 670pdcs_diagnostic_read(struct kset *kset, char *buf)
671{ 671{
672 char *out = buf; 672 char *out = buf;
673 u32 result; 673 u32 result;
674 674
675 if (!entry || !buf) 675 if (!kset || !buf)
676 return -EINVAL; 676 return -EINVAL;
677 677
678 /* get diagnostic */ 678 /* get diagnostic */
@@ -686,18 +686,18 @@ pdcs_diagnostic_read(struct subsystem *entry, char *buf)
686 686
687/** 687/**
688 * pdcs_fastsize_read - Stable Storage FastSize register output. 688 * pdcs_fastsize_read - Stable Storage FastSize register output.
689 * @entry: An allocated and populated subsytem struct. We don't use it tho. 689 * @kset: An allocated and populated struct kset. We don't use it tho.
690 * @buf: The output buffer to write to. 690 * @buf: The output buffer to write to.
691 * 691 *
692 * This register holds the amount of system RAM to be tested during boot sequence. 692 * This register holds the amount of system RAM to be tested during boot sequence.
693 */ 693 */
694static ssize_t 694static ssize_t
695pdcs_fastsize_read(struct subsystem *entry, char *buf) 695pdcs_fastsize_read(struct kset *kset, char *buf)
696{ 696{
697 char *out = buf; 697 char *out = buf;
698 u32 result; 698 u32 result;
699 699
700 if (!entry || !buf) 700 if (!kset || !buf)
701 return -EINVAL; 701 return -EINVAL;
702 702
703 /* get fast-size */ 703 /* get fast-size */
@@ -715,13 +715,13 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf)
715 715
716/** 716/**
717 * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. 717 * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output.
718 * @entry: An allocated and populated subsytem struct. We don't use it tho. 718 * @kset: An allocated and populated struct kset. We don't use it tho.
719 * @buf: The output buffer to write to. 719 * @buf: The output buffer to write to.
720 * 720 *
721 * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. 721 * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available.
722 */ 722 */
723static ssize_t 723static ssize_t
724pdcs_osdep2_read(struct subsystem *entry, char *buf) 724pdcs_osdep2_read(struct kset *kset, char *buf)
725{ 725{
726 char *out = buf; 726 char *out = buf;
727 unsigned long size; 727 unsigned long size;
@@ -733,7 +733,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
733 733
734 size = pdcs_size - 224; 734 size = pdcs_size - 224;
735 735
736 if (!entry || !buf) 736 if (!kset || !buf)
737 return -EINVAL; 737 return -EINVAL;
738 738
739 for (i=0; i<size; i+=4) { 739 for (i=0; i<size; i+=4) {
@@ -748,7 +748,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
748 748
749/** 749/**
750 * pdcs_auto_write - This function handles autoboot/search flag modifying. 750 * pdcs_auto_write - This function handles autoboot/search flag modifying.
751 * @entry: An allocated and populated subsytem struct. We don't use it tho. 751 * @kset: An allocated and populated struct kset. We don't use it tho.
752 * @buf: The input buffer to read from. 752 * @buf: The input buffer to read from.
753 * @count: The number of bytes to be read. 753 * @count: The number of bytes to be read.
754 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag 754 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
@@ -758,7 +758,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
758 * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On 758 * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On
759 */ 759 */
760static ssize_t 760static ssize_t
761pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob) 761pdcs_auto_write(struct kset *kset, const char *buf, size_t count, int knob)
762{ 762{
763 struct pdcspath_entry *pathentry; 763 struct pdcspath_entry *pathentry;
764 unsigned char flags; 764 unsigned char flags;
@@ -768,7 +768,7 @@ pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob
768 if (!capable(CAP_SYS_ADMIN)) 768 if (!capable(CAP_SYS_ADMIN))
769 return -EACCES; 769 return -EACCES;
770 770
771 if (!entry || !buf || !count) 771 if (!kset || !buf || !count)
772 return -EINVAL; 772 return -EINVAL;
773 773
774 /* We'll use a local copy of buf */ 774 /* We'll use a local copy of buf */
@@ -823,7 +823,7 @@ parse_error:
823 823
824/** 824/**
825 * pdcs_autoboot_write - This function handles autoboot flag modifying. 825 * pdcs_autoboot_write - This function handles autoboot flag modifying.
826 * @entry: An allocated and populated subsytem struct. We don't use it tho. 826 * @kset: An allocated and populated struct kset. We don't use it tho.
827 * @buf: The input buffer to read from. 827 * @buf: The input buffer to read from.
828 * @count: The number of bytes to be read. 828 * @count: The number of bytes to be read.
829 * 829 *
@@ -832,14 +832,14 @@ parse_error:
832 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On 832 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
833 */ 833 */
834static inline ssize_t 834static inline ssize_t
835pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count) 835pdcs_autoboot_write(struct kset *kset, const char *buf, size_t count)
836{ 836{
837 return pdcs_auto_write(entry, buf, count, PF_AUTOBOOT); 837 return pdcs_auto_write(kset, buf, count, PF_AUTOBOOT);
838} 838}
839 839
840/** 840/**
841 * pdcs_autosearch_write - This function handles autosearch flag modifying. 841 * pdcs_autosearch_write - This function handles autosearch flag modifying.
842 * @entry: An allocated and populated subsytem struct. We don't use it tho. 842 * @kset: An allocated and populated struct kset. We don't use it tho.
843 * @buf: The input buffer to read from. 843 * @buf: The input buffer to read from.
844 * @count: The number of bytes to be read. 844 * @count: The number of bytes to be read.
845 * 845 *
@@ -848,14 +848,14 @@ pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count)
848 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On 848 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
849 */ 849 */
850static inline ssize_t 850static inline ssize_t
851pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count) 851pdcs_autosearch_write(struct kset *kset, const char *buf, size_t count)
852{ 852{
853 return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH); 853 return pdcs_auto_write(kset, buf, count, PF_AUTOSEARCH);
854} 854}
855 855
856/** 856/**
857 * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. 857 * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input.
858 * @entry: An allocated and populated subsytem struct. We don't use it tho. 858 * @kset: An allocated and populated struct kset. We don't use it tho.
859 * @buf: The input buffer to read from. 859 * @buf: The input buffer to read from.
860 * @count: The number of bytes to be read. 860 * @count: The number of bytes to be read.
861 * 861 *
@@ -864,14 +864,14 @@ pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count)
864 * its input buffer. 864 * its input buffer.
865 */ 865 */
866static ssize_t 866static ssize_t
867pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count) 867pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count)
868{ 868{
869 u8 in[16]; 869 u8 in[16];
870 870
871 if (!capable(CAP_SYS_ADMIN)) 871 if (!capable(CAP_SYS_ADMIN))
872 return -EACCES; 872 return -EACCES;
873 873
874 if (!entry || !buf || !count) 874 if (!kset || !buf || !count)
875 return -EINVAL; 875 return -EINVAL;
876 876
877 if (unlikely(pdcs_osid != OS_ID_LINUX)) 877 if (unlikely(pdcs_osid != OS_ID_LINUX))
@@ -892,7 +892,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
892 892
893/** 893/**
894 * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. 894 * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input.
895 * @entry: An allocated and populated subsytem struct. We don't use it tho. 895 * @kset: An allocated and populated struct kset. We don't use it tho.
896 * @buf: The input buffer to read from. 896 * @buf: The input buffer to read from.
897 * @count: The number of bytes to be read. 897 * @count: The number of bytes to be read.
898 * 898 *
@@ -901,7 +901,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
901 * constructing its input buffer. 901 * constructing its input buffer.
902 */ 902 */
903static ssize_t 903static ssize_t
904pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) 904pdcs_osdep2_write(struct kset *kset, const char *buf, size_t count)
905{ 905{
906 unsigned long size; 906 unsigned long size;
907 unsigned short i; 907 unsigned short i;
@@ -910,7 +910,7 @@ pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count)
910 if (!capable(CAP_SYS_ADMIN)) 910 if (!capable(CAP_SYS_ADMIN))
911 return -EACCES; 911 return -EACCES;
912 912
913 if (!entry || !buf || !count) 913 if (!kset || !buf || !count)
914 return -EINVAL; 914 return -EINVAL;
915 915
916 if (unlikely(pdcs_size <= 224)) 916 if (unlikely(pdcs_size <= 224))
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 5ea5bc70cb82..7a1d6d512837 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -1,10 +1,14 @@
1# 1#
2# PCI configuration 2# PCI configuration
3# 3#
4config ARCH_SUPPORTS_MSI
5 bool
6 default n
7
4config PCI_MSI 8config PCI_MSI
5 bool "Message Signaled Interrupts (MSI and MSI-X)" 9 bool "Message Signaled Interrupts (MSI and MSI-X)"
6 depends on PCI 10 depends on PCI
7 depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 || SPARC64 11 depends on ARCH_SUPPORTS_MSI
8 help 12 help
9 This allows device drivers to enable MSI (Message Signaled 13 This allows device drivers to enable MSI (Message Signaled
10 Interrupts). Message Signaled Interrupts enable a device to 14 Interrupts). Message Signaled Interrupts enable a device to
@@ -17,31 +21,6 @@ config PCI_MSI
17 21
18 If you don't know what to do here, say N. 22 If you don't know what to do here, say N.
19 23
20config PCI_MULTITHREAD_PROBE
21 bool "PCI Multi-threaded probe (EXPERIMENTAL)"
22 depends on PCI && EXPERIMENTAL && BROKEN
23 help
24 Say Y here if you want the PCI core to spawn a new thread for
25 every PCI device that is probed. This can cause a huge
26 speedup in boot times on multiprocessor machines, and even a
27 smaller speedup on single processor machines.
28
29 But it can also cause lots of bad things to happen. A number
30 of PCI drivers cannot properly handle running in this way,
31 some will just not work properly at all, while others might
32 decide to blow up power supplies with a huge load all at once,
33 so use this option at your own risk.
34
35 It is very unwise to use this option if you are not using a
36 boot process that can handle devices being created in any
37 order. A program that can create persistent block and network
38 device names (like udev) is a good idea if you wish to use
39 this option.
40
41 Again, use this option at your own risk, you have been warned!
42
43 When in doubt, say N.
44
45config PCI_DEBUG 24config PCI_DEBUG
46 bool "PCI Debugging" 25 bool "PCI Debugging"
47 depends on PCI && DEBUG_KERNEL 26 depends on PCI && DEBUG_KERNEL
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index aadaa3c8096b..9e5ea074ad20 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -77,7 +77,7 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
77 * This adds a single pci device to the global 77 * This adds a single pci device to the global
78 * device list and adds sysfs and procfs entries 78 * device list and adds sysfs and procfs entries
79 */ 79 */
80int __devinit pci_bus_add_device(struct pci_dev *dev) 80int pci_bus_add_device(struct pci_dev *dev)
81{ 81{
82 int retval; 82 int retval;
83 retval = device_add(&dev->dev); 83 retval = device_add(&dev->dev);
@@ -105,7 +105,7 @@ int __devinit pci_bus_add_device(struct pci_dev *dev)
105 * 105 *
106 * Call hotplug for each new devices. 106 * Call hotplug for each new devices.
107 */ 107 */
108void __devinit pci_bus_add_devices(struct pci_bus *bus) 108void pci_bus_add_devices(struct pci_bus *bus)
109{ 109{
110 struct pci_dev *dev; 110 struct pci_dev *dev;
111 int retval; 111 int retval;
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index be92695a7833..63d62752fb91 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -2,9 +2,7 @@
2# PCI Hotplug support 2# PCI Hotplug support
3# 3#
4 4
5menu "PCI Hotplug Support" 5menuconfig HOTPLUG_PCI
6
7config HOTPLUG_PCI
8 tristate "Support for PCI Hotplug (EXPERIMENTAL)" 6 tristate "Support for PCI Hotplug (EXPERIMENTAL)"
9 depends on PCI && EXPERIMENTAL && HOTPLUG 7 depends on PCI && EXPERIMENTAL && HOTPLUG
10 ---help--- 8 ---help---
@@ -17,9 +15,10 @@ config HOTPLUG_PCI
17 15
18 When in doubt, say N. 16 When in doubt, say N.
19 17
18if HOTPLUG_PCI
19
20config HOTPLUG_PCI_FAKE 20config HOTPLUG_PCI_FAKE
21 tristate "Fake PCI Hotplug driver" 21 tristate "Fake PCI Hotplug driver"
22 depends on HOTPLUG_PCI
23 help 22 help
24 Say Y here if you want to use the fake PCI hotplug driver. It can 23 Say Y here if you want to use the fake PCI hotplug driver. It can
25 be used to simulate PCI hotplug events if even if your system is 24 be used to simulate PCI hotplug events if even if your system is
@@ -42,7 +41,7 @@ config HOTPLUG_PCI_FAKE
42 41
43config HOTPLUG_PCI_COMPAQ 42config HOTPLUG_PCI_COMPAQ
44 tristate "Compaq PCI Hotplug driver" 43 tristate "Compaq PCI Hotplug driver"
45 depends on HOTPLUG_PCI && X86 && PCI_BIOS 44 depends on X86 && PCI_BIOS
46 help 45 help
47 Say Y here if you have a motherboard with a Compaq PCI Hotplug 46 Say Y here if you have a motherboard with a Compaq PCI Hotplug
48 controller. 47 controller.
@@ -64,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM
64 63
65config HOTPLUG_PCI_IBM 64config HOTPLUG_PCI_IBM
66 tristate "IBM PCI Hotplug driver" 65 tristate "IBM PCI Hotplug driver"
67 depends on HOTPLUG_PCI && X86_IO_APIC && X86 && PCI_BIOS 66 depends on X86_IO_APIC && X86 && PCI_BIOS
68 help 67 help
69 Say Y here if you have a motherboard with a IBM PCI Hotplug 68 Say Y here if you have a motherboard with a IBM PCI Hotplug
70 controller. 69 controller.
@@ -76,7 +75,6 @@ config HOTPLUG_PCI_IBM
76 75
77config HOTPLUG_PCI_ACPI 76config HOTPLUG_PCI_ACPI
78 tristate "ACPI PCI Hotplug driver" 77 tristate "ACPI PCI Hotplug driver"
79 depends on HOTPLUG_PCI
80 depends on (!ACPI_DOCK && ACPI) || (ACPI_DOCK) 78 depends on (!ACPI_DOCK && ACPI) || (ACPI_DOCK)
81 help 79 help
82 Say Y here if you have a system that supports PCI Hotplug using 80 Say Y here if you have a system that supports PCI Hotplug using
@@ -101,7 +99,6 @@ config HOTPLUG_PCI_ACPI_IBM
101 99
102config HOTPLUG_PCI_CPCI 100config HOTPLUG_PCI_CPCI
103 bool "CompactPCI Hotplug driver" 101 bool "CompactPCI Hotplug driver"
104 depends on HOTPLUG_PCI
105 help 102 help
106 Say Y here if you have a CompactPCI system card with CompactPCI 103 Say Y here if you have a CompactPCI system card with CompactPCI
107 hotswap support per the PICMG 2.1 specification. 104 hotswap support per the PICMG 2.1 specification.
@@ -110,7 +107,7 @@ config HOTPLUG_PCI_CPCI
110 107
111config HOTPLUG_PCI_CPCI_ZT5550 108config HOTPLUG_PCI_CPCI_ZT5550
112 tristate "Ziatech ZT5550 CompactPCI Hotplug driver" 109 tristate "Ziatech ZT5550 CompactPCI Hotplug driver"
113 depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86 110 depends on HOTPLUG_PCI_CPCI && X86
114 help 111 help
115 Say Y here if you have an Performance Technologies (formerly Intel, 112 Say Y here if you have an Performance Technologies (formerly Intel,
116 formerly just Ziatech) Ziatech ZT5550 CompactPCI system card. 113 formerly just Ziatech) Ziatech ZT5550 CompactPCI system card.
@@ -122,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
122 119
123config HOTPLUG_PCI_CPCI_GENERIC 120config HOTPLUG_PCI_CPCI_GENERIC
124 tristate "Generic port I/O CompactPCI Hotplug driver" 121 tristate "Generic port I/O CompactPCI Hotplug driver"
125 depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86 122 depends on HOTPLUG_PCI_CPCI && X86
126 help 123 help
127 Say Y here if you have a CompactPCI system card that exposes the #ENUM 124 Say Y here if you have a CompactPCI system card that exposes the #ENUM
128 hotswap signal as a bit in a system register that can be read through 125 hotswap signal as a bit in a system register that can be read through
@@ -135,7 +132,6 @@ config HOTPLUG_PCI_CPCI_GENERIC
135 132
136config HOTPLUG_PCI_SHPC 133config HOTPLUG_PCI_SHPC
137 tristate "SHPC PCI Hotplug driver" 134 tristate "SHPC PCI Hotplug driver"
138 depends on HOTPLUG_PCI
139 help 135 help
140 Say Y here if you have a motherboard with a SHPC PCI Hotplug 136 Say Y here if you have a motherboard with a SHPC PCI Hotplug
141 controller. 137 controller.
@@ -147,7 +143,7 @@ config HOTPLUG_PCI_SHPC
147 143
148config HOTPLUG_PCI_RPA 144config HOTPLUG_PCI_RPA
149 tristate "RPA PCI Hotplug driver" 145 tristate "RPA PCI Hotplug driver"
150 depends on HOTPLUG_PCI && PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE 146 depends on PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE
151 help 147 help
152 Say Y here if you have a RPA system that supports PCI Hotplug. 148 Say Y here if you have a RPA system that supports PCI Hotplug.
153 149
@@ -170,12 +166,11 @@ config HOTPLUG_PCI_RPA_DLPAR
170 166
171config HOTPLUG_PCI_SGI 167config HOTPLUG_PCI_SGI
172 tristate "SGI PCI Hotplug Support" 168 tristate "SGI PCI Hotplug Support"
173 depends on HOTPLUG_PCI && (IA64_SGI_SN2 || IA64_GENERIC) 169 depends on IA64_SGI_SN2 || IA64_GENERIC
174 help 170 help
175 Say Y here if you want to use the SGI Altix Hotplug 171 Say Y here if you want to use the SGI Altix Hotplug
176 Driver for PCI devices. 172 Driver for PCI devices.
177 173
178 When in doubt, say N. 174 When in doubt, say N.
179 175
180endmenu 176endif # HOTPLUG_PCI
181
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 7f03881a8b68..e7322c25d377 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -424,7 +424,7 @@ static int __init ibm_acpiphp_init(void)
424 int retval = 0; 424 int retval = 0;
425 acpi_status status; 425 acpi_status status;
426 struct acpi_device *device; 426 struct acpi_device *device;
427 struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; 427 struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
428 428
429 dbg("%s\n", __FUNCTION__); 429 dbg("%s\n", __FUNCTION__);
430 430
@@ -471,7 +471,7 @@ init_return:
471static void __exit ibm_acpiphp_exit(void) 471static void __exit ibm_acpiphp_exit(void)
472{ 472{
473 acpi_status status; 473 acpi_status status;
474 struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; 474 struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
475 475
476 dbg("%s\n", __FUNCTION__); 476 dbg("%s\n", __FUNCTION__);
477 477
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c
index 1c12e9171097..41f6a8d79c81 100644
--- a/drivers/pci/hotplug/cpcihp_zt5550.c
+++ b/drivers/pci/hotplug/cpcihp_zt5550.c
@@ -296,13 +296,17 @@ static struct pci_driver zt5550_hc_driver = {
296static int __init zt5550_init(void) 296static int __init zt5550_init(void)
297{ 297{
298 struct resource* r; 298 struct resource* r;
299 int rc;
299 300
300 info(DRIVER_DESC " version: " DRIVER_VERSION); 301 info(DRIVER_DESC " version: " DRIVER_VERSION);
301 r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register"); 302 r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register");
302 if(!r) 303 if(!r)
303 return -EBUSY; 304 return -EBUSY;
304 305
305 return pci_register_driver(&zt5550_hc_driver); 306 rc = pci_register_driver(&zt5550_hc_driver);
307 if(rc < 0)
308 release_region(ENUM_PORT, 1);
309 return rc;
306} 310}
307 311
308static void __exit 312static void __exit
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index e27907c91d92..027f6865d7e3 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -238,7 +238,7 @@ static void pci_rescan_bus(const struct pci_bus *bus)
238{ 238{
239 unsigned int devfn; 239 unsigned int devfn;
240 struct pci_dev *dev; 240 struct pci_dev *dev;
241 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 241 dev = alloc_pci_dev();
242 if (!dev) 242 if (!dev)
243 return; 243 return;
244 244
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index f5d632e72323..63f3bd1eecc4 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -62,7 +62,7 @@ static int debug;
62 62
63static LIST_HEAD(pci_hotplug_slot_list); 63static LIST_HEAD(pci_hotplug_slot_list);
64 64
65struct subsystem pci_hotplug_slots_subsys; 65struct kset pci_hotplug_slots_subsys;
66 66
67static ssize_t hotplug_slot_attr_show(struct kobject *kobj, 67static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
68 struct attribute *attr, char *buf) 68 struct attribute *attr, char *buf)
@@ -764,7 +764,7 @@ static int __init pci_hotplug_init (void)
764{ 764{
765 int result; 765 int result;
766 766
767 kset_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys); 767 kobj_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys);
768 result = subsystem_register(&pci_hotplug_slots_subsys); 768 result = subsystem_register(&pci_hotplug_slots_subsys);
769 if (result) { 769 if (result) {
770 err("Register subsys with error %d\n", result); 770 err("Register subsys with error %d\n", result);
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index d19fcae8a7c0..ccc57627201e 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -43,6 +43,7 @@ extern int pciehp_poll_mode;
43extern int pciehp_poll_time; 43extern int pciehp_poll_time;
44extern int pciehp_debug; 44extern int pciehp_debug;
45extern int pciehp_force; 45extern int pciehp_force;
46extern struct workqueue_struct *pciehp_wq;
46 47
47#define dbg(format, arg...) \ 48#define dbg(format, arg...) \
48 do { \ 49 do { \
@@ -70,14 +71,16 @@ struct slot {
70 struct list_head slot_list; 71 struct list_head slot_list;
71 char name[SLOT_NAME_SIZE]; 72 char name[SLOT_NAME_SIZE];
72 unsigned long last_emi_toggle; 73 unsigned long last_emi_toggle;
74 struct delayed_work work; /* work for button event */
75 struct mutex lock;
73}; 76};
74 77
75struct event_info { 78struct event_info {
76 u32 event_type; 79 u32 event_type;
77 u8 hp_slot; 80 struct slot *p_slot;
81 struct work_struct work;
78}; 82};
79 83
80#define MAX_EVENTS 10
81struct controller { 84struct controller {
82 struct controller *next; 85 struct controller *next;
83 struct mutex crit_sect; /* critical section mutex */ 86 struct mutex crit_sect; /* critical section mutex */
@@ -86,11 +89,9 @@ struct controller {
86 int slot_num_inc; /* 1 or -1 */ 89 int slot_num_inc; /* 1 or -1 */
87 struct pci_dev *pci_dev; 90 struct pci_dev *pci_dev;
88 struct list_head slot_list; 91 struct list_head slot_list;
89 struct event_info event_queue[MAX_EVENTS];
90 struct slot *slot; 92 struct slot *slot;
91 struct hpc_ops *hpc_ops; 93 struct hpc_ops *hpc_ops;
92 wait_queue_head_t queue; /* sleep & wake process */ 94 wait_queue_head_t queue; /* sleep & wake process */
93 u8 next_event;
94 u8 bus; 95 u8 bus;
95 u8 device; 96 u8 device;
96 u8 function; 97 u8 function;
@@ -149,21 +150,17 @@ struct controller {
149#define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP) 150#define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP)
150#define EMI(cap) (cap & EMI_PRSN) 151#define EMI(cap) (cap & EMI_PRSN)
151 152
152extern int pciehp_event_start_thread(void); 153extern int pciehp_sysfs_enable_slot(struct slot *slot);
153extern void pciehp_event_stop_thread(void); 154extern int pciehp_sysfs_disable_slot(struct slot *slot);
154extern int pciehp_enable_slot(struct slot *slot);
155extern int pciehp_disable_slot(struct slot *slot);
156extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); 155extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
157extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); 156extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
158extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); 157extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
159extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); 158extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
160extern int pciehp_configure_device(struct slot *p_slot); 159extern int pciehp_configure_device(struct slot *p_slot);
161extern int pciehp_unconfigure_device(struct slot *p_slot); 160extern int pciehp_unconfigure_device(struct slot *p_slot);
161extern void pciehp_queue_pushbutton_work(struct work_struct *work);
162int pcie_init(struct controller *ctrl, struct pcie_device *dev); 162int pcie_init(struct controller *ctrl, struct pcie_device *dev);
163 163
164/* Global variables */
165extern struct controller *pciehp_ctrl_list;
166
167static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) 164static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
168{ 165{
169 struct slot *slot; 166 struct slot *slot;
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index a92eda6e02f6..e5d3f0b4f45a 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -41,7 +41,7 @@ int pciehp_debug;
41int pciehp_poll_mode; 41int pciehp_poll_mode;
42int pciehp_poll_time; 42int pciehp_poll_time;
43int pciehp_force; 43int pciehp_force;
44struct controller *pciehp_ctrl_list; 44struct workqueue_struct *pciehp_wq;
45 45
46#define DRIVER_VERSION "0.4" 46#define DRIVER_VERSION "0.4"
47#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 47#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
@@ -62,7 +62,6 @@ MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"
62 62
63#define PCIE_MODULE_NAME "pciehp" 63#define PCIE_MODULE_NAME "pciehp"
64 64
65static int pcie_start_thread (void);
66static int set_attention_status (struct hotplug_slot *slot, u8 value); 65static int set_attention_status (struct hotplug_slot *slot, u8 value);
67static int enable_slot (struct hotplug_slot *slot); 66static int enable_slot (struct hotplug_slot *slot);
68static int disable_slot (struct hotplug_slot *slot); 67static int disable_slot (struct hotplug_slot *slot);
@@ -229,6 +228,8 @@ static int init_slots(struct controller *ctrl)
229 slot->device = ctrl->slot_device_offset + i; 228 slot->device = ctrl->slot_device_offset + i;
230 slot->hpc_ops = ctrl->hpc_ops; 229 slot->hpc_ops = ctrl->hpc_ops;
231 slot->number = ctrl->first_slot; 230 slot->number = ctrl->first_slot;
231 mutex_init(&slot->lock);
232 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
232 233
233 /* register this slot with the hotplug pci core */ 234 /* register this slot with the hotplug pci core */
234 hotplug_slot->private = slot; 235 hotplug_slot->private = slot;
@@ -286,6 +287,9 @@ static void cleanup_slots(struct controller *ctrl)
286 if (EMI(ctrl->ctrlcap)) 287 if (EMI(ctrl->ctrlcap))
287 sysfs_remove_file(&slot->hotplug_slot->kobj, 288 sysfs_remove_file(&slot->hotplug_slot->kobj,
288 &hotplug_slot_attr_lock.attr); 289 &hotplug_slot_attr_lock.attr);
290 cancel_delayed_work(&slot->work);
291 flush_scheduled_work();
292 flush_workqueue(pciehp_wq);
289 pci_hp_deregister(slot->hotplug_slot); 293 pci_hp_deregister(slot->hotplug_slot);
290 } 294 }
291} 295}
@@ -314,7 +318,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
314 318
315 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 319 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
316 320
317 return pciehp_enable_slot(slot); 321 return pciehp_sysfs_enable_slot(slot);
318} 322}
319 323
320 324
@@ -324,7 +328,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
324 328
325 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 329 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
326 330
327 return pciehp_disable_slot(slot); 331 return pciehp_sysfs_disable_slot(slot);
328} 332}
329 333
330static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 334static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
@@ -466,17 +470,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
466 470
467 t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 471 t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
468 472
469 /* Finish setting up the hot plug ctrl device */
470 ctrl->next_event = 0;
471
472 if (!pciehp_ctrl_list) {
473 pciehp_ctrl_list = ctrl;
474 ctrl->next = NULL;
475 } else {
476 ctrl->next = pciehp_ctrl_list;
477 pciehp_ctrl_list = ctrl;
478 }
479
480 t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ 473 t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */
481 if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { 474 if ((POWER_CTRL(ctrl->ctrlcap)) && !value) {
482 rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ 475 rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/
@@ -496,48 +489,14 @@ err_out_none:
496 return -ENODEV; 489 return -ENODEV;
497} 490}
498 491
499 492static void pciehp_remove (struct pcie_device *dev)
500static int pcie_start_thread(void)
501{ 493{
502 int retval = 0; 494 struct pci_dev *pdev = dev->port;
503 495 struct controller *ctrl = pci_get_drvdata(pdev);
504 dbg("Initialize + Start the notification/polling mechanism \n");
505
506 retval = pciehp_event_start_thread();
507 if (retval) {
508 dbg("pciehp_event_start_thread() failed\n");
509 return retval;
510 }
511
512 return retval;
513}
514
515static void __exit unload_pciehpd(void)
516{
517 struct controller *ctrl;
518 struct controller *tctrl;
519
520 ctrl = pciehp_ctrl_list;
521
522 while (ctrl) {
523 cleanup_slots(ctrl);
524 496
525 ctrl->hpc_ops->release_ctlr(ctrl); 497 cleanup_slots(ctrl);
526 498 ctrl->hpc_ops->release_ctlr(ctrl);
527 tctrl = ctrl; 499 kfree(ctrl);
528 ctrl = ctrl->next;
529
530 kfree(tctrl);
531 }
532
533 /* Stop the notification mechanism */
534 pciehp_event_stop_thread();
535
536}
537
538static void pciehp_remove (struct pcie_device *device)
539{
540 /* XXX - Needs to be adapted to device driver model */
541} 500}
542 501
543#ifdef CONFIG_PM 502#ifdef CONFIG_PM
@@ -585,31 +544,18 @@ static int __init pcied_init(void)
585 pciehp_poll_mode = 1; 544 pciehp_poll_mode = 1;
586#endif 545#endif
587 546
588 retval = pcie_start_thread();
589 if (retval)
590 goto error_hpc_init;
591
592 retval = pcie_port_service_register(&hpdriver_portdrv); 547 retval = pcie_port_service_register(&hpdriver_portdrv);
593 dbg("pcie_port_service_register = %d\n", retval); 548 dbg("pcie_port_service_register = %d\n", retval);
594 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 549 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
595 if (retval) 550 if (retval)
596 dbg("%s: Failure to register service\n", __FUNCTION__); 551 dbg("%s: Failure to register service\n", __FUNCTION__);
597
598error_hpc_init:
599 if (retval) {
600 pciehp_event_stop_thread();
601 };
602
603 return retval; 552 return retval;
604} 553}
605 554
606static void __exit pcied_cleanup(void) 555static void __exit pcied_cleanup(void)
607{ 556{
608 dbg("unload_pciehpd()\n"); 557 dbg("unload_pciehpd()\n");
609 unload_pciehpd();
610
611 pcie_port_service_unregister(&hpdriver_portdrv); 558 pcie_port_service_unregister(&hpdriver_portdrv);
612
613 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 559 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
614} 560}
615 561
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 4283ef56dbd9..7f22caa70178 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -32,92 +32,61 @@
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/workqueue.h>
35#include "../pci.h" 36#include "../pci.h"
36#include "pciehp.h" 37#include "pciehp.h"
37 38
38static void interrupt_event_handler(struct controller *ctrl); 39static void interrupt_event_handler(struct work_struct *work);
40static int pciehp_enable_slot(struct slot *p_slot);
41static int pciehp_disable_slot(struct slot *p_slot);
39 42
40static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */ 43static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
41static struct semaphore event_exit; /* guard ensure thread has exited before calling it quits */
42static int event_finished;
43static unsigned long pushbutton_pending; /* = 0 */
44static unsigned long surprise_rm_pending; /* = 0 */
45
46static inline char *slot_name(struct slot *p_slot)
47{ 44{
48 return p_slot->hotplug_slot->name; 45 struct event_info *info;
46
47 info = kmalloc(sizeof(*info), GFP_ATOMIC);
48 if (!info)
49 return -ENOMEM;
50
51 info->event_type = event_type;
52 info->p_slot = p_slot;
53 INIT_WORK(&info->work, interrupt_event_handler);
54
55 schedule_work(&info->work);
56
57 return 0;
49} 58}
50 59
51u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) 60u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
52{ 61{
53 struct slot *p_slot; 62 struct slot *p_slot;
54 u8 rc = 0; 63 u32 event_type;
55 u8 getstatus;
56 struct event_info *taskInfo;
57 64
58 /* Attention Button Change */ 65 /* Attention Button Change */
59 dbg("pciehp: Attention button interrupt received.\n"); 66 dbg("pciehp: Attention button interrupt received.\n");
60
61 /* This is the structure that tells the worker thread what to do */
62 taskInfo = &(ctrl->event_queue[ctrl->next_event]);
63 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
64
65 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
66
67 ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS;
68 taskInfo->hp_slot = hp_slot;
69 67
70 rc++; 68 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
71 69
72 /* 70 /*
73 * Button pressed - See if need to TAKE ACTION!!! 71 * Button pressed - See if need to TAKE ACTION!!!
74 */ 72 */
75 info("Button pressed on Slot(%s)\n", slot_name(p_slot)); 73 info("Button pressed on Slot(%s)\n", p_slot->name);
76 taskInfo->event_type = INT_BUTTON_PRESS; 74 event_type = INT_BUTTON_PRESS;
77
78 if ((p_slot->state == BLINKINGON_STATE)
79 || (p_slot->state == BLINKINGOFF_STATE)) {
80 /* Cancel if we are still blinking; this means that we press the
81 * attention again before the 5 sec. limit expires to cancel hot-add
82 * or hot-remove
83 */
84 taskInfo->event_type = INT_BUTTON_CANCEL;
85 info("Button cancel on Slot(%s)\n", slot_name(p_slot));
86 } else if ((p_slot->state == POWERON_STATE)
87 || (p_slot->state == POWEROFF_STATE)) {
88 /* Ignore if the slot is on power-on or power-off state; this
89 * means that the previous attention button action to hot-add or
90 * hot-remove is undergoing
91 */
92 taskInfo->event_type = INT_BUTTON_IGNORE;
93 info("Button ignore on Slot(%s)\n", slot_name(p_slot));
94 }
95 75
96 if (rc) 76 queue_interrupt_event(p_slot, event_type);
97 up(&event_semaphore); /* signal event thread that new event is posted */
98 77
99 return 0; 78 return 0;
100
101} 79}
102 80
103u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) 81u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
104{ 82{
105 struct slot *p_slot; 83 struct slot *p_slot;
106 u8 rc = 0;
107 u8 getstatus; 84 u8 getstatus;
108 struct event_info *taskInfo; 85 u32 event_type;
109 86
110 /* Switch Change */ 87 /* Switch Change */
111 dbg("pciehp: Switch interrupt received.\n"); 88 dbg("pciehp: Switch interrupt received.\n");
112 89
113 /* This is the structure that tells the worker thread
114 * what to do
115 */
116 taskInfo = &(ctrl->event_queue[ctrl->next_event]);
117 ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS;
118 taskInfo->hp_slot = hp_slot;
119
120 rc++;
121 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 90 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
122 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 91 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
123 92
@@ -125,39 +94,30 @@ u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
125 /* 94 /*
126 * Switch opened 95 * Switch opened
127 */ 96 */
128 info("Latch open on Slot(%s)\n", slot_name(p_slot)); 97 info("Latch open on Slot(%s)\n", p_slot->name);
129 taskInfo->event_type = INT_SWITCH_OPEN; 98 event_type = INT_SWITCH_OPEN;
130 } else { 99 } else {
131 /* 100 /*
132 * Switch closed 101 * Switch closed
133 */ 102 */
134 info("Latch close on Slot(%s)\n", slot_name(p_slot)); 103 info("Latch close on Slot(%s)\n", p_slot->name);
135 taskInfo->event_type = INT_SWITCH_CLOSE; 104 event_type = INT_SWITCH_CLOSE;
136 } 105 }
137 106
138 if (rc) 107 queue_interrupt_event(p_slot, event_type);
139 up(&event_semaphore); /* signal event thread that new event is posted */
140 108
141 return rc; 109 return 1;
142} 110}
143 111
144u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) 112u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
145{ 113{
146 struct slot *p_slot; 114 struct slot *p_slot;
147 u8 presence_save, rc = 0; 115 u32 event_type;
148 struct event_info *taskInfo; 116 u8 presence_save;
149 117
150 /* Presence Change */ 118 /* Presence Change */
151 dbg("pciehp: Presence/Notify input change.\n"); 119 dbg("pciehp: Presence/Notify input change.\n");
152 120
153 /* This is the structure that tells the worker thread
154 * what to do
155 */
156 taskInfo = &(ctrl->event_queue[ctrl->next_event]);
157 ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS;
158 taskInfo->hp_slot = hp_slot;
159
160 rc++;
161 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 121 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
162 122
163 /* Switch is open, assume a presence change 123 /* Switch is open, assume a presence change
@@ -168,59 +128,49 @@ u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
168 /* 128 /*
169 * Card Present 129 * Card Present
170 */ 130 */
171 info("Card present on Slot(%s)\n", slot_name(p_slot)); 131 info("Card present on Slot(%s)\n", p_slot->name);
172 taskInfo->event_type = INT_PRESENCE_ON; 132 event_type = INT_PRESENCE_ON;
173 } else { 133 } else {
174 /* 134 /*
175 * Not Present 135 * Not Present
176 */ 136 */
177 info("Card not present on Slot(%s)\n", slot_name(p_slot)); 137 info("Card not present on Slot(%s)\n", p_slot->name);
178 taskInfo->event_type = INT_PRESENCE_OFF; 138 event_type = INT_PRESENCE_OFF;
179 } 139 }
180 140
181 if (rc) 141 queue_interrupt_event(p_slot, event_type);
182 up(&event_semaphore); /* signal event thread that new event is posted */
183 142
184 return rc; 143 return 1;
185} 144}
186 145
187u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) 146u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
188{ 147{
189 struct slot *p_slot; 148 struct slot *p_slot;
190 u8 rc = 0; 149 u32 event_type;
191 struct event_info *taskInfo;
192 150
193 /* power fault */ 151 /* power fault */
194 dbg("pciehp: Power fault interrupt received.\n"); 152 dbg("pciehp: Power fault interrupt received.\n");
195 153
196 /* this is the structure that tells the worker thread
197 * what to do
198 */
199 taskInfo = &(ctrl->event_queue[ctrl->next_event]);
200 ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS;
201 taskInfo->hp_slot = hp_slot;
202
203 rc++;
204 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 154 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
205 155
206 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 156 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
207 /* 157 /*
208 * power fault Cleared 158 * power fault Cleared
209 */ 159 */
210 info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); 160 info("Power fault cleared on Slot(%s)\n", p_slot->name);
211 taskInfo->event_type = INT_POWER_FAULT_CLEAR; 161 event_type = INT_POWER_FAULT_CLEAR;
212 } else { 162 } else {
213 /* 163 /*
214 * power fault 164 * power fault
215 */ 165 */
216 info("Power fault on Slot(%s)\n", slot_name(p_slot)); 166 info("Power fault on Slot(%s)\n", p_slot->name);
217 taskInfo->event_type = INT_POWER_FAULT; 167 event_type = INT_POWER_FAULT;
218 info("power fault bit %x set\n", hp_slot); 168 info("power fault bit %x set\n", hp_slot);
219 } 169 }
220 if (rc)
221 up(&event_semaphore); /* signal event thread that new event is posted */
222 170
223 return rc; 171 queue_interrupt_event(p_slot, event_type);
172
173 return 1;
224} 174}
225 175
226/* The following routines constitute the bulk of the 176/* The following routines constitute the bulk of the
@@ -357,13 +307,10 @@ static int remove_board(struct slot *p_slot)
357 return 0; 307 return 0;
358} 308}
359 309
360 310struct power_work_info {
361static void pushbutton_helper_thread(unsigned long data) 311 struct slot *p_slot;
362{ 312 struct work_struct work;
363 pushbutton_pending = data; 313};
364
365 up(&event_semaphore);
366}
367 314
368/** 315/**
369 * pciehp_pushbutton_thread 316 * pciehp_pushbutton_thread
@@ -372,276 +319,214 @@ static void pushbutton_helper_thread(unsigned long data)
372 * Handles all pending events and exits. 319 * Handles all pending events and exits.
373 * 320 *
374 */ 321 */
375static void pciehp_pushbutton_thread(unsigned long slot) 322static void pciehp_power_thread(struct work_struct *work)
376{ 323{
377 struct slot *p_slot = (struct slot *) slot; 324 struct power_work_info *info =
378 u8 getstatus; 325 container_of(work, struct power_work_info, work);
379 326 struct slot *p_slot = info->p_slot;
380 pushbutton_pending = 0; 327
381 328 mutex_lock(&p_slot->lock);
382 if (!p_slot) { 329 switch (p_slot->state) {
383 dbg("%s: Error! slot NULL\n", __FUNCTION__); 330 case POWEROFF_STATE:
384 return; 331 mutex_unlock(&p_slot->lock);
385 } 332 dbg("%s: disabling bus:device(%x:%x)\n",
386 333 __FUNCTION__, p_slot->bus, p_slot->device);
387 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
388 if (getstatus) {
389 p_slot->state = POWEROFF_STATE;
390 dbg("%s: disabling bus:device(%x:%x)\n", __FUNCTION__,
391 p_slot->bus, p_slot->device);
392
393 pciehp_disable_slot(p_slot); 334 pciehp_disable_slot(p_slot);
335 mutex_lock(&p_slot->lock);
394 p_slot->state = STATIC_STATE; 336 p_slot->state = STATIC_STATE;
395 } else { 337 break;
396 p_slot->state = POWERON_STATE; 338 case POWERON_STATE:
397 dbg("%s: adding bus:device(%x:%x)\n", __FUNCTION__, 339 mutex_unlock(&p_slot->lock);
398 p_slot->bus, p_slot->device);
399
400 if (pciehp_enable_slot(p_slot) && 340 if (pciehp_enable_slot(p_slot) &&
401 PWR_LED(p_slot->ctrl->ctrlcap)) 341 PWR_LED(p_slot->ctrl->ctrlcap))
402 p_slot->hpc_ops->green_led_off(p_slot); 342 p_slot->hpc_ops->green_led_off(p_slot);
403 343 mutex_lock(&p_slot->lock);
404 p_slot->state = STATIC_STATE; 344 p_slot->state = STATIC_STATE;
345 break;
346 default:
347 break;
405 } 348 }
349 mutex_unlock(&p_slot->lock);
406 350
407 return; 351 kfree(info);
408} 352}
409 353
410/** 354void pciehp_queue_pushbutton_work(struct work_struct *work)
411 * pciehp_surprise_rm_thread
412 *
413 * Scheduled procedure to handle blocking stuff for the surprise removal
414 * Handles all pending events and exits.
415 *
416 */
417static void pciehp_surprise_rm_thread(unsigned long slot)
418{ 355{
419 struct slot *p_slot = (struct slot *) slot; 356 struct slot *p_slot = container_of(work, struct slot, work.work);
420 u8 getstatus; 357 struct power_work_info *info;
421
422 surprise_rm_pending = 0;
423 358
424 if (!p_slot) { 359 info = kmalloc(sizeof(*info), GFP_KERNEL);
425 dbg("%s: Error! slot NULL\n", __FUNCTION__); 360 if (!info) {
361 err("%s: Cannot allocate memory\n", __FUNCTION__);
426 return; 362 return;
427 } 363 }
364 info->p_slot = p_slot;
365 INIT_WORK(&info->work, pciehp_power_thread);
428 366
429 p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 367 mutex_lock(&p_slot->lock);
430 if (!getstatus) { 368 switch (p_slot->state) {
369 case BLINKINGOFF_STATE:
431 p_slot->state = POWEROFF_STATE; 370 p_slot->state = POWEROFF_STATE;
432 dbg("%s: removing bus:device(%x:%x)\n", 371 break;
433 __FUNCTION__, p_slot->bus, p_slot->device); 372 case BLINKINGON_STATE:
434
435 pciehp_disable_slot(p_slot);
436 p_slot->state = STATIC_STATE;
437 } else {
438 p_slot->state = POWERON_STATE; 373 p_slot->state = POWERON_STATE;
439 dbg("%s: adding bus:device(%x:%x)\n", 374 break;
440 __FUNCTION__, p_slot->bus, p_slot->device); 375 default:
441 376 goto out;
442 if (pciehp_enable_slot(p_slot) &&
443 PWR_LED(p_slot->ctrl->ctrlcap))
444 p_slot->hpc_ops->green_led_off(p_slot);
445
446 p_slot->state = STATIC_STATE;
447 } 377 }
448 378 queue_work(pciehp_wq, &info->work);
449 return; 379 out:
380 mutex_unlock(&p_slot->lock);
450} 381}
451 382
452
453
454/* this is the main worker thread */
455static int event_thread(void* data)
456{
457 struct controller *ctrl;
458 lock_kernel();
459 daemonize("pciehpd_event");
460
461 unlock_kernel();
462
463 while (1) {
464 dbg("!!!!event_thread sleeping\n");
465 down_interruptible (&event_semaphore);
466 dbg("event_thread woken finished = %d\n", event_finished);
467 if (event_finished || signal_pending(current))
468 break;
469 /* Do stuff here */
470 if (pushbutton_pending)
471 pciehp_pushbutton_thread(pushbutton_pending);
472 else if (surprise_rm_pending)
473 pciehp_surprise_rm_thread(surprise_rm_pending);
474 else
475 for (ctrl = pciehp_ctrl_list; ctrl; ctrl=ctrl->next)
476 interrupt_event_handler(ctrl);
477 }
478 dbg("event_thread signals exit\n");
479 up(&event_exit);
480 return 0;
481}
482
483int pciehp_event_start_thread(void)
484{
485 int pid;
486
487 /* initialize our semaphores */
488 init_MUTEX_LOCKED(&event_exit);
489 event_finished=0;
490
491 init_MUTEX_LOCKED(&event_semaphore);
492 pid = kernel_thread(event_thread, NULL, 0);
493
494 if (pid < 0) {
495 err ("Can't start up our event thread\n");
496 return -1;
497 }
498 return 0;
499}
500
501
502void pciehp_event_stop_thread(void)
503{
504 event_finished = 1;
505 up(&event_semaphore);
506 down(&event_exit);
507}
508
509
510static int update_slot_info(struct slot *slot) 383static int update_slot_info(struct slot *slot)
511{ 384{
512 struct hotplug_slot_info *info; 385 struct hotplug_slot_info *info;
513 /* char buffer[SLOT_NAME_SIZE]; */
514 int result; 386 int result;
515 387
516 info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); 388 info = kmalloc(sizeof(*info), GFP_KERNEL);
517 if (!info) 389 if (!info)
518 return -ENOMEM; 390 return -ENOMEM;
519 391
520 /* make_slot_name (&buffer[0], SLOT_NAME_SIZE, slot); */
521
522 slot->hpc_ops->get_power_status(slot, &(info->power_status)); 392 slot->hpc_ops->get_power_status(slot, &(info->power_status));
523 slot->hpc_ops->get_attention_status(slot, &(info->attention_status)); 393 slot->hpc_ops->get_attention_status(slot, &(info->attention_status));
524 slot->hpc_ops->get_latch_status(slot, &(info->latch_status)); 394 slot->hpc_ops->get_latch_status(slot, &(info->latch_status));
525 slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status)); 395 slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status));
526 396
527 /* result = pci_hp_change_slot_info(buffer, info); */
528 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 397 result = pci_hp_change_slot_info(slot->hotplug_slot, info);
529 kfree (info); 398 kfree (info);
530 return result; 399 return result;
531} 400}
532 401
533static void interrupt_event_handler(struct controller *ctrl) 402/*
403 * Note: This function must be called with slot->lock held
404 */
405static void handle_button_press_event(struct slot *p_slot)
534{ 406{
535 int loop = 0; 407 struct controller *ctrl = p_slot->ctrl;
536 int change = 1;
537 u8 hp_slot;
538 u8 getstatus; 408 u8 getstatus;
539 struct slot *p_slot;
540 409
541 while (change) { 410 switch (p_slot->state) {
542 change = 0; 411 case STATIC_STATE:
543 412 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
544 for (loop = 0; loop < MAX_EVENTS; loop++) { 413 if (getstatus) {
545 if (ctrl->event_queue[loop].event_type != 0) { 414 p_slot->state = BLINKINGOFF_STATE;
546 hp_slot = ctrl->event_queue[loop].hp_slot; 415 info("PCI slot #%s - powering off due to button "
547 416 "press.\n", p_slot->name);
548 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 417 } else {
549 418 p_slot->state = BLINKINGON_STATE;
550 if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) { 419 info("PCI slot #%s - powering on due to button "
551 dbg("button cancel\n"); 420 "press.\n", p_slot->name);
552 del_timer(&p_slot->task_event); 421 }
553 422 /* blink green LED and turn off amber */
554 switch (p_slot->state) { 423 if (PWR_LED(ctrl->ctrlcap))
555 case BLINKINGOFF_STATE: 424 p_slot->hpc_ops->green_led_blink(p_slot);
556 if (PWR_LED(ctrl->ctrlcap)) 425 if (ATTN_LED(ctrl->ctrlcap))
557 p_slot->hpc_ops->green_led_on(p_slot); 426 p_slot->hpc_ops->set_attention_status(p_slot, 0);
558 427
559 if (ATTN_LED(ctrl->ctrlcap)) 428 schedule_delayed_work(&p_slot->work, 5*HZ);
560 p_slot->hpc_ops->set_attention_status(p_slot, 0); 429 break;
561 break; 430 case BLINKINGOFF_STATE:
562 case BLINKINGON_STATE: 431 case BLINKINGON_STATE:
563 if (PWR_LED(ctrl->ctrlcap)) 432 /*
564 p_slot->hpc_ops->green_led_off(p_slot); 433 * Cancel if we are still blinking; this means that we
565 434 * press the attention again before the 5 sec. limit
566 if (ATTN_LED(ctrl->ctrlcap)) 435 * expires to cancel hot-add or hot-remove
567 p_slot->hpc_ops->set_attention_status(p_slot, 0); 436 */
568 break; 437 info("Button cancel on Slot(%s)\n", p_slot->name);
569 default: 438 dbg("%s: button cancel\n", __FUNCTION__);
570 warn("Not a valid state\n"); 439 cancel_delayed_work(&p_slot->work);
571 return; 440 if (p_slot->state == BLINKINGOFF_STATE) {
572 } 441 if (PWR_LED(ctrl->ctrlcap))
573 info("PCI slot #%s - action canceled due to button press.\n", slot_name(p_slot)); 442 p_slot->hpc_ops->green_led_on(p_slot);
574 p_slot->state = STATIC_STATE; 443 } else {
575 } 444 if (PWR_LED(ctrl->ctrlcap))
576 /* ***********Button Pressed (No action on 1st press...) */ 445 p_slot->hpc_ops->green_led_off(p_slot);
577 else if (ctrl->event_queue[loop].event_type == INT_BUTTON_PRESS) { 446 }
578 447 if (ATTN_LED(ctrl->ctrlcap))
579 if (ATTN_BUTTN(ctrl->ctrlcap)) { 448 p_slot->hpc_ops->set_attention_status(p_slot, 0);
580 dbg("Button pressed\n"); 449 info("PCI slot #%s - action canceled due to button press\n",
581 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 450 p_slot->name);
582 if (getstatus) { 451 p_slot->state = STATIC_STATE;
583 /* slot is on */ 452 break;
584 dbg("slot is on\n"); 453 case POWEROFF_STATE:
585 p_slot->state = BLINKINGOFF_STATE; 454 case POWERON_STATE:
586 info("PCI slot #%s - powering off due to button press.\n", slot_name(p_slot)); 455 /*
587 } else { 456 * Ignore if the slot is on power-on or power-off state;
588 /* slot is off */ 457 * this means that the previous attention button action
589 dbg("slot is off\n"); 458 * to hot-add or hot-remove is undergoing
590 p_slot->state = BLINKINGON_STATE; 459 */
591 info("PCI slot #%s - powering on due to button press.\n", slot_name(p_slot)); 460 info("Button ignore on Slot(%s)\n", p_slot->name);
592 } 461 update_slot_info(p_slot);
593 462 break;
594 /* blink green LED and turn off amber */ 463 default:
595 if (PWR_LED(ctrl->ctrlcap)) 464 warn("Not a valid state\n");
596 p_slot->hpc_ops->green_led_blink(p_slot); 465 break;
597
598 if (ATTN_LED(ctrl->ctrlcap))
599 p_slot->hpc_ops->set_attention_status(p_slot, 0);
600
601 init_timer(&p_slot->task_event);
602 p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */
603 p_slot->task_event.function = (void (*)(unsigned long)) pushbutton_helper_thread;
604 p_slot->task_event.data = (unsigned long) p_slot;
605
606 add_timer(&p_slot->task_event);
607 }
608 }
609 /***********POWER FAULT********************/
610 else if (ctrl->event_queue[loop].event_type == INT_POWER_FAULT) {
611 if (POWER_CTRL(ctrl->ctrlcap)) {
612 dbg("power fault\n");
613 if (ATTN_LED(ctrl->ctrlcap))
614 p_slot->hpc_ops->set_attention_status(p_slot, 1);
615
616 if (PWR_LED(ctrl->ctrlcap))
617 p_slot->hpc_ops->green_led_off(p_slot);
618 }
619 }
620 /***********SURPRISE REMOVAL********************/
621 else if ((ctrl->event_queue[loop].event_type == INT_PRESENCE_ON) ||
622 (ctrl->event_queue[loop].event_type == INT_PRESENCE_OFF)) {
623 if (HP_SUPR_RM(ctrl->ctrlcap)) {
624 dbg("Surprise Removal\n");
625 if (p_slot) {
626 surprise_rm_pending = (unsigned long) p_slot;
627 up(&event_semaphore);
628 update_slot_info(p_slot);
629 }
630 }
631 } else {
632 /* refresh notification */
633 if (p_slot)
634 update_slot_info(p_slot);
635 }
636
637 ctrl->event_queue[loop].event_type = 0;
638
639 change = 1;
640 }
641 } /* End of FOR loop */
642 } 466 }
643} 467}
644 468
469/*
470 * Note: This function must be called with slot->lock held
471 */
472static void handle_surprise_event(struct slot *p_slot)
473{
474 u8 getstatus;
475 struct power_work_info *info;
476
477 info = kmalloc(sizeof(*info), GFP_KERNEL);
478 if (!info) {
479 err("%s: Cannot allocate memory\n", __FUNCTION__);
480 return;
481 }
482 info->p_slot = p_slot;
483 INIT_WORK(&info->work, pciehp_power_thread);
484
485 p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
486 if (!getstatus)
487 p_slot->state = POWEROFF_STATE;
488 else
489 p_slot->state = POWERON_STATE;
490
491 queue_work(pciehp_wq, &info->work);
492}
493
494static void interrupt_event_handler(struct work_struct *work)
495{
496 struct event_info *info = container_of(work, struct event_info, work);
497 struct slot *p_slot = info->p_slot;
498 struct controller *ctrl = p_slot->ctrl;
499
500 mutex_lock(&p_slot->lock);
501 switch (info->event_type) {
502 case INT_BUTTON_PRESS:
503 handle_button_press_event(p_slot);
504 break;
505 case INT_POWER_FAULT:
506 if (!POWER_CTRL(ctrl->ctrlcap))
507 break;
508 if (ATTN_LED(ctrl->ctrlcap))
509 p_slot->hpc_ops->set_attention_status(p_slot, 1);
510 if (PWR_LED(ctrl->ctrlcap))
511 p_slot->hpc_ops->green_led_off(p_slot);
512 break;
513 case INT_PRESENCE_ON:
514 case INT_PRESENCE_OFF:
515 if (!HP_SUPR_RM(ctrl->ctrlcap))
516 break;
517 dbg("Surprise Removal\n");
518 update_slot_info(p_slot);
519 handle_surprise_event(p_slot);
520 break;
521 default:
522 update_slot_info(p_slot);
523 break;
524 }
525 mutex_unlock(&p_slot->lock);
526
527 kfree(info);
528}
529
645int pciehp_enable_slot(struct slot *p_slot) 530int pciehp_enable_slot(struct slot *p_slot)
646{ 531{
647 u8 getstatus = 0; 532 u8 getstatus = 0;
@@ -653,7 +538,7 @@ int pciehp_enable_slot(struct slot *p_slot)
653 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 538 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
654 if (rc || !getstatus) { 539 if (rc || !getstatus) {
655 info("%s: no adapter on slot(%s)\n", __FUNCTION__, 540 info("%s: no adapter on slot(%s)\n", __FUNCTION__,
656 slot_name(p_slot)); 541 p_slot->name);
657 mutex_unlock(&p_slot->ctrl->crit_sect); 542 mutex_unlock(&p_slot->ctrl->crit_sect);
658 return -ENODEV; 543 return -ENODEV;
659 } 544 }
@@ -661,7 +546,7 @@ int pciehp_enable_slot(struct slot *p_slot)
661 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 546 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
662 if (rc || getstatus) { 547 if (rc || getstatus) {
663 info("%s: latch open on slot(%s)\n", __FUNCTION__, 548 info("%s: latch open on slot(%s)\n", __FUNCTION__,
664 slot_name(p_slot)); 549 p_slot->name);
665 mutex_unlock(&p_slot->ctrl->crit_sect); 550 mutex_unlock(&p_slot->ctrl->crit_sect);
666 return -ENODEV; 551 return -ENODEV;
667 } 552 }
@@ -671,7 +556,7 @@ int pciehp_enable_slot(struct slot *p_slot)
671 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 556 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
672 if (rc || getstatus) { 557 if (rc || getstatus) {
673 info("%s: already enabled on slot(%s)\n", __FUNCTION__, 558 info("%s: already enabled on slot(%s)\n", __FUNCTION__,
674 slot_name(p_slot)); 559 p_slot->name);
675 mutex_unlock(&p_slot->ctrl->crit_sect); 560 mutex_unlock(&p_slot->ctrl->crit_sect);
676 return -EINVAL; 561 return -EINVAL;
677 } 562 }
@@ -706,7 +591,7 @@ int pciehp_disable_slot(struct slot *p_slot)
706 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 591 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
707 if (ret || !getstatus) { 592 if (ret || !getstatus) {
708 info("%s: no adapter on slot(%s)\n", __FUNCTION__, 593 info("%s: no adapter on slot(%s)\n", __FUNCTION__,
709 slot_name(p_slot)); 594 p_slot->name);
710 mutex_unlock(&p_slot->ctrl->crit_sect); 595 mutex_unlock(&p_slot->ctrl->crit_sect);
711 return -ENODEV; 596 return -ENODEV;
712 } 597 }
@@ -716,7 +601,7 @@ int pciehp_disable_slot(struct slot *p_slot)
716 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 601 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
717 if (ret || getstatus) { 602 if (ret || getstatus) {
718 info("%s: latch open on slot(%s)\n", __FUNCTION__, 603 info("%s: latch open on slot(%s)\n", __FUNCTION__,
719 slot_name(p_slot)); 604 p_slot->name);
720 mutex_unlock(&p_slot->ctrl->crit_sect); 605 mutex_unlock(&p_slot->ctrl->crit_sect);
721 return -ENODEV; 606 return -ENODEV;
722 } 607 }
@@ -726,7 +611,7 @@ int pciehp_disable_slot(struct slot *p_slot)
726 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 611 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
727 if (ret || !getstatus) { 612 if (ret || !getstatus) {
728 info("%s: already disabled slot(%s)\n", __FUNCTION__, 613 info("%s: already disabled slot(%s)\n", __FUNCTION__,
729 slot_name(p_slot)); 614 p_slot->name);
730 mutex_unlock(&p_slot->ctrl->crit_sect); 615 mutex_unlock(&p_slot->ctrl->crit_sect);
731 return -EINVAL; 616 return -EINVAL;
732 } 617 }
@@ -739,3 +624,66 @@ int pciehp_disable_slot(struct slot *p_slot)
739 return ret; 624 return ret;
740} 625}
741 626
627int pciehp_sysfs_enable_slot(struct slot *p_slot)
628{
629 int retval = -ENODEV;
630
631 mutex_lock(&p_slot->lock);
632 switch (p_slot->state) {
633 case BLINKINGON_STATE:
634 cancel_delayed_work(&p_slot->work);
635 case STATIC_STATE:
636 p_slot->state = POWERON_STATE;
637 mutex_unlock(&p_slot->lock);
638 retval = pciehp_enable_slot(p_slot);
639 mutex_lock(&p_slot->lock);
640 p_slot->state = STATIC_STATE;
641 break;
642 case POWERON_STATE:
643 info("Slot %s is already in powering on state\n",
644 p_slot->name);
645 break;
646 case BLINKINGOFF_STATE:
647 case POWEROFF_STATE:
648 info("Already enabled on slot %s\n", p_slot->name);
649 break;
650 default:
651 err("Not a valid state on slot %s\n", p_slot->name);
652 break;
653 }
654 mutex_unlock(&p_slot->lock);
655
656 return retval;
657}
658
659int pciehp_sysfs_disable_slot(struct slot *p_slot)
660{
661 int retval = -ENODEV;
662
663 mutex_lock(&p_slot->lock);
664 switch (p_slot->state) {
665 case BLINKINGOFF_STATE:
666 cancel_delayed_work(&p_slot->work);
667 case STATIC_STATE:
668 p_slot->state = POWEROFF_STATE;
669 mutex_unlock(&p_slot->lock);
670 retval = pciehp_disable_slot(p_slot);
671 mutex_lock(&p_slot->lock);
672 p_slot->state = STATIC_STATE;
673 break;
674 case POWEROFF_STATE:
675 info("Slot %s is already in powering off state\n",
676 p_slot->name);
677 break;
678 case BLINKINGON_STATE:
679 case POWERON_STATE:
680 info("Already disabled on slot %s\n", p_slot->name);
681 break;
682 default:
683 err("Not a valid state on slot %s\n", p_slot->name);
684 break;
685 }
686 mutex_unlock(&p_slot->lock);
687
688 return retval;
689}
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index fbc64aa2dd68..9aac6a87eb53 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -71,6 +71,8 @@
71#define DBG_LEAVE_ROUTINE 71#define DBG_LEAVE_ROUTINE
72#endif /* DEBUG */ 72#endif /* DEBUG */
73 73
74static atomic_t pciehp_num_controllers = ATOMIC_INIT(0);
75
74struct ctrl_reg { 76struct ctrl_reg {
75 u8 cap_id; 77 u8 cap_id;
76 u8 nxt_ptr; 78 u8 nxt_ptr;
@@ -219,10 +221,7 @@ static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value)
219#define EMI_STATE 0x0080 221#define EMI_STATE 0x0080
220#define EMI_STATUS_BIT 7 222#define EMI_STATUS_BIT 7
221 223
222static spinlock_t hpc_event_lock;
223
224DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ 224DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */
225static int ctlr_seq_num = 0; /* Controller sequence # */
226 225
227static irqreturn_t pcie_isr(int irq, void *dev_id); 226static irqreturn_t pcie_isr(int irq, void *dev_id);
228static void start_int_poll_timer(struct controller *ctrl, int sec); 227static void start_int_poll_timer(struct controller *ctrl, int sec);
@@ -656,6 +655,13 @@ static void hpc_release_ctlr(struct controller *ctrl)
656 else 655 else
657 free_irq(ctrl->pci_dev->irq, ctrl); 656 free_irq(ctrl->pci_dev->irq, ctrl);
658 657
658 /*
659 * If this is the last controller to be released, destroy the
660 * pciehp work queue
661 */
662 if (atomic_dec_and_test(&pciehp_num_controllers))
663 destroy_workqueue(pciehp_wq);
664
659 DBG_LEAVE_ROUTINE 665 DBG_LEAVE_ROUTINE
660} 666}
661 667
@@ -1152,7 +1158,6 @@ int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1152int pcie_init(struct controller * ctrl, struct pcie_device *dev) 1158int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1153{ 1159{
1154 int rc; 1160 int rc;
1155 static int first = 1;
1156 u16 temp_word; 1161 u16 temp_word;
1157 u16 cap_reg; 1162 u16 cap_reg;
1158 u16 intr_enable = 0; 1163 u16 intr_enable = 0;
@@ -1221,11 +1226,6 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1221 dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n", 1226 dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n",
1222 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); 1227 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl);
1223 1228
1224 if (first) {
1225 spin_lock_init(&hpc_event_lock);
1226 first = 0;
1227 }
1228
1229 for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) 1229 for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++)
1230 if (pci_resource_len(pdev, rc) > 0) 1230 if (pci_resource_len(pdev, rc) > 0)
1231 dbg("pci resource[%d] start=0x%llx(len=0x%llx)\n", rc, 1231 dbg("pci resource[%d] start=0x%llx(len=0x%llx)\n", rc,
@@ -1286,7 +1286,8 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1286 rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED, 1286 rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED,
1287 MY_NAME, (void *)ctrl); 1287 MY_NAME, (void *)ctrl);
1288 dbg("%s: request_irq %d for hpc%d (returns %d)\n", 1288 dbg("%s: request_irq %d for hpc%d (returns %d)\n",
1289 __FUNCTION__, ctrl->pci_dev->irq, ctlr_seq_num, rc); 1289 __FUNCTION__, ctrl->pci_dev->irq,
1290 atomic_read(&pciehp_num_controllers), rc);
1290 if (rc) { 1291 if (rc) {
1291 err("Can't get irq %d for the hotplug controller\n", 1292 err("Can't get irq %d for the hotplug controller\n",
1292 ctrl->pci_dev->irq); 1293 ctrl->pci_dev->irq);
@@ -1296,6 +1297,18 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1296 dbg("pciehp ctrl b:d:f:irq=0x%x:%x:%x:%x\n", pdev->bus->number, 1297 dbg("pciehp ctrl b:d:f:irq=0x%x:%x:%x:%x\n", pdev->bus->number,
1297 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), dev->irq); 1298 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), dev->irq);
1298 1299
1300 /*
1301 * If this is the first controller to be initialized,
1302 * initialize the pciehp work queue
1303 */
1304 if (atomic_add_return(1, &pciehp_num_controllers) == 1) {
1305 pciehp_wq = create_singlethread_workqueue("pciehpd");
1306 if (!pciehp_wq) {
1307 rc = -ENOMEM;
1308 goto abort_free_irq;
1309 }
1310 }
1311
1299 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 1312 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
1300 if (rc) { 1313 if (rc) {
1301 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 1314 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__);
@@ -1349,7 +1362,6 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1349 goto abort_disable_intr; 1362 goto abort_disable_intr;
1350 } 1363 }
1351 1364
1352 ctlr_seq_num++;
1353 ctrl->hpc_ops = &pciehp_hpc_ops; 1365 ctrl->hpc_ops = &pciehp_hpc_ops;
1354 1366
1355 DBG_LEAVE_ROUTINE 1367 DBG_LEAVE_ROUTINE
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 72383467a0d5..bb3c101c2c5a 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -98,7 +98,15 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type)
98 return NULL; 98 return NULL;
99} 99}
100 100
101static struct slot *find_slot(struct device_node *dn) 101/**
102 * find_php_slot - return hotplug slot structure for device node
103 *
104 * This routine will return the hotplug slot structure
105 * for a given device node. Note that built-in PCI slots
106 * may be dlpar-able, but not hot-pluggable, so this routine
107 * will return NULL for built-in PCI slots.
108 */
109static struct slot *find_php_slot(struct device_node *dn)
102{ 110{
103 struct list_head *tmp, *n; 111 struct list_head *tmp, *n;
104 struct slot *slot; 112 struct slot *slot;
@@ -224,9 +232,9 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
224 if (!pcibios_find_pci_bus(dn)) 232 if (!pcibios_find_pci_bus(dn))
225 return -EINVAL; 233 return -EINVAL;
226 234
227 slot = find_slot(dn); 235 /* If pci slot is hotplugable, use hotplug to remove it */
236 slot = find_php_slot(dn);
228 if (slot) { 237 if (slot) {
229 /* Remove hotplug slot */
230 if (rpaphp_deregister_slot(slot)) { 238 if (rpaphp_deregister_slot(slot)) {
231 printk(KERN_ERR 239 printk(KERN_ERR
232 "%s: unable to remove hotplug slot %s\n", 240 "%s: unable to remove hotplug slot %s\n",
@@ -370,22 +378,17 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
370 if (!bus) 378 if (!bus)
371 return -EINVAL; 379 return -EINVAL;
372 380
373 slot = find_slot(dn); 381 /* If pci slot is hotplugable, use hotplug to remove it */
382 slot = find_php_slot(dn);
374 if (slot) { 383 if (slot) {
375 /* Remove hotplug slot */
376 if (rpaphp_deregister_slot(slot)) { 384 if (rpaphp_deregister_slot(slot)) {
377 printk(KERN_ERR 385 printk(KERN_ERR
378 "%s: unable to remove hotplug slot %s\n", 386 "%s: unable to remove hotplug slot %s\n",
379 __FUNCTION__, drc_name); 387 __FUNCTION__, drc_name);
380 return -EIO; 388 return -EIO;
381 } 389 }
382 } else { 390 } else
383 struct pci_dev *dev, *tmp; 391 pcibios_remove_pci_devices(bus);
384 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
385 eeh_remove_bus_device(dev);
386 pci_remove_bus_device(dev);
387 }
388 }
389 392
390 if (unmap_bus_range(bus)) { 393 if (unmap_bus_range(bus)) {
391 printk(KERN_ERR "%s: failed to unmap bus range\n", 394 printk(KERN_ERR "%s: failed to unmap bus range\n",
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
index 2e7accf0f734..c822a779653f 100644
--- a/drivers/pci/hotplug/rpaphp.h
+++ b/drivers/pci/hotplug/rpaphp.h
@@ -83,19 +83,15 @@ struct slot {
83 83
84extern struct hotplug_slot_ops rpaphp_hotplug_slot_ops; 84extern struct hotplug_slot_ops rpaphp_hotplug_slot_ops;
85extern struct list_head rpaphp_slot_head; 85extern struct list_head rpaphp_slot_head;
86extern int num_slots;
87 86
88/* function prototypes */ 87/* function prototypes */
89 88
90/* rpaphp_pci.c */ 89/* rpaphp_pci.c */
91extern int rpaphp_enable_pci_slot(struct slot *slot); 90extern int rpaphp_enable_slot(struct slot *slot);
92extern int rpaphp_register_pci_slot(struct slot *slot);
93extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
94extern int rpaphp_get_sensor_state(struct slot *slot, int *state); 91extern int rpaphp_get_sensor_state(struct slot *slot, int *state);
95 92
96/* rpaphp_core.c */ 93/* rpaphp_core.c */
97extern int rpaphp_add_slot(struct device_node *dn); 94extern int rpaphp_add_slot(struct device_node *dn);
98extern int rpaphp_remove_slot(struct slot *slot);
99extern int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, 95extern int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
100 char **drc_name, char **drc_type, int *drc_power_domain); 96 char **drc_name, char **drc_type, int *drc_power_domain);
101 97
@@ -104,7 +100,5 @@ extern void dealloc_slot_struct(struct slot *slot);
104extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain); 100extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
105extern int rpaphp_register_slot(struct slot *slot); 101extern int rpaphp_register_slot(struct slot *slot);
106extern int rpaphp_deregister_slot(struct slot *slot); 102extern int rpaphp_deregister_slot(struct slot *slot);
107extern int rpaphp_get_power_status(struct slot *slot, u8 * value);
108extern int rpaphp_set_attention_status(struct slot *slot, u8 status);
109 103
110#endif /* _PPC64PHP_H */ 104#endif /* _PPC64PHP_H */
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 353da5b296ef..899eed002748 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -39,9 +39,7 @@
39#include "rpaphp.h" 39#include "rpaphp.h"
40 40
41int debug; 41int debug;
42static struct semaphore rpaphp_sem;
43LIST_HEAD(rpaphp_slot_head); 42LIST_HEAD(rpaphp_slot_head);
44int num_slots;
45 43
46#define DRIVER_VERSION "0.1" 44#define DRIVER_VERSION "0.1"
47#define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>" 45#define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>"
@@ -55,11 +53,6 @@ MODULE_LICENSE("GPL");
55 53
56module_param(debug, bool, 0644); 54module_param(debug, bool, 0644);
57 55
58static int rpaphp_get_attention_status(struct slot *slot)
59{
60 return slot->hotplug_slot->info->attention_status;
61}
62
63/** 56/**
64 * set_attention_status - set attention LED 57 * set_attention_status - set attention LED
65 * echo 0 > attention -- set LED OFF 58 * echo 0 > attention -- set LED OFF
@@ -69,79 +62,75 @@ static int rpaphp_get_attention_status(struct slot *slot)
69 */ 62 */
70static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) 63static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
71{ 64{
72 int retval = 0; 65 int rc;
73 struct slot *slot = (struct slot *)hotplug_slot->private; 66 struct slot *slot = (struct slot *)hotplug_slot->private;
74 67
75 down(&rpaphp_sem);
76 switch (value) { 68 switch (value) {
77 case 0: 69 case 0:
78 retval = rpaphp_set_attention_status(slot, LED_OFF);
79 hotplug_slot->info->attention_status = 0;
80 break;
81 case 1: 70 case 1:
82 default:
83 retval = rpaphp_set_attention_status(slot, LED_ON);
84 hotplug_slot->info->attention_status = 1;
85 break;
86 case 2: 71 case 2:
87 retval = rpaphp_set_attention_status(slot, LED_ID); 72 break;
88 hotplug_slot->info->attention_status = 2; 73 default:
74 value = 1;
89 break; 75 break;
90 } 76 }
91 up(&rpaphp_sem); 77
92 return retval; 78 rc = rtas_set_indicator(DR_INDICATOR, slot->index, value);
79 if (!rc)
80 hotplug_slot->info->attention_status = value;
81
82 return rc;
93} 83}
94 84
95/** 85/**
96 * get_power_status - get power status of a slot 86 * get_power_status - get power status of a slot
97 * @hotplug_slot: slot to get status 87 * @hotplug_slot: slot to get status
98 * @value: pointer to store status 88 * @value: pointer to store status
99 *
100 *
101 */ 89 */
102static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 90static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
103{ 91{
104 int retval; 92 int retval, level;
105 struct slot *slot = (struct slot *)hotplug_slot->private; 93 struct slot *slot = (struct slot *)hotplug_slot->private;
106 94
107 down(&rpaphp_sem); 95 retval = rtas_get_power_level (slot->power_domain, &level);
108 retval = rpaphp_get_power_status(slot, value); 96 if (!retval)
109 up(&rpaphp_sem); 97 *value = level;
110 return retval; 98 return retval;
111} 99}
112 100
113/** 101/**
114 * get_attention_status - get attention LED status 102 * get_attention_status - get attention LED status
115 *
116 *
117 */ 103 */
118static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 104static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
119{ 105{
120 int retval = 0;
121 struct slot *slot = (struct slot *)hotplug_slot->private; 106 struct slot *slot = (struct slot *)hotplug_slot->private;
122 107 *value = slot->hotplug_slot->info->attention_status;
123 down(&rpaphp_sem); 108 return 0;
124 *value = rpaphp_get_attention_status(slot);
125 up(&rpaphp_sem);
126 return retval;
127} 109}
128 110
129static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) 111static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
130{ 112{
131 struct slot *slot = (struct slot *)hotplug_slot->private; 113 struct slot *slot = (struct slot *)hotplug_slot->private;
132 int retval = 0; 114 int rc, state;
133 115
134 down(&rpaphp_sem); 116 rc = rpaphp_get_sensor_state(slot, &state);
135 retval = rpaphp_get_pci_adapter_status(slot, 0, value); 117
136 up(&rpaphp_sem); 118 *value = NOT_VALID;
137 return retval; 119 if (rc)
120 return rc;
121
122 if (state == EMPTY)
123 *value = EMPTY;
124 else if (state == PRESENT)
125 *value = slot->state;
126
127 return 0;
138} 128}
139 129
140static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) 130static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
141{ 131{
142 struct slot *slot = (struct slot *)hotplug_slot->private; 132 struct slot *slot = (struct slot *)hotplug_slot->private;
143 133
144 down(&rpaphp_sem);
145 switch (slot->type) { 134 switch (slot->type) {
146 case 1: 135 case 1:
147 case 2: 136 case 2:
@@ -172,7 +161,6 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
172 break; 161 break;
173 162
174 } 163 }
175 up(&rpaphp_sem);
176 return 0; 164 return 0;
177} 165}
178 166
@@ -265,6 +253,14 @@ static int is_php_type(char *drc_type)
265 return 1; 253 return 1;
266} 254}
267 255
256/**
257 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0
258 *
259 * This routine will return true only if the device node is
260 * a hotpluggable slot. This routine will return false
261 * for built-in pci slots (even when the built-in slots are
262 * dlparable.)
263 */
268static int is_php_dn(struct device_node *dn, const int **indexes, 264static int is_php_dn(struct device_node *dn, const int **indexes,
269 const int **names, const int **types, const int **power_domains) 265 const int **names, const int **types, const int **power_domains)
270{ 266{
@@ -272,24 +268,31 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
272 int rc; 268 int rc;
273 269
274 rc = get_children_props(dn, indexes, names, &drc_types, power_domains); 270 rc = get_children_props(dn, indexes, names, &drc_types, power_domains);
275 if (rc >= 0) { 271 if (rc < 0)
276 if (is_php_type((char *) &drc_types[1])) { 272 return 0;
277 *types = drc_types;
278 return 1;
279 }
280 }
281 273
282 return 0; 274 if (!is_php_type((char *) &drc_types[1]))
275 return 0;
276
277 *types = drc_types;
278 return 1;
283} 279}
284 280
285/** 281/**
286 * rpaphp_add_slot -- add hotplug or dlpar slot 282 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem.
283 * @dn device node of slot
284 *
285 * This subroutine will register a hotplugable slot with the
286 * PCI hotplug infrastructure. This routine is typicaly called
287 * during boot time, if the hotplug slots are present at boot time,
288 * or is called later, by the dlpar add code, if the slot is
289 * being dynamically added during runtime.
290 *
291 * If the device node points at an embedded (built-in) slot, this
292 * routine will just return without doing anything, since embedded
293 * slots cannot be hotplugged.
287 * 294 *
288 * rpaphp not only registers PCI hotplug slots(HOTPLUG), 295 * To remove a slot, it suffices to call rpaphp_deregister_slot()
289 * but also logical DR slots(EMBEDDED).
290 * HOTPLUG slot: An adapter can be physically added/removed.
291 * EMBEDDED slot: An adapter can be logically removed/added
292 * from/to a partition with the slot.
293 */ 296 */
294int rpaphp_add_slot(struct device_node *dn) 297int rpaphp_add_slot(struct device_node *dn)
295{ 298{
@@ -299,34 +302,42 @@ int rpaphp_add_slot(struct device_node *dn)
299 const int *indexes, *names, *types, *power_domains; 302 const int *indexes, *names, *types, *power_domains;
300 char *name, *type; 303 char *name, *type;
301 304
305 if (!dn->name || strcmp(dn->name, "pci"))
306 return 0;
307
308 /* If this is not a hotplug slot, return without doing anything. */
309 if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
310 return 0;
311
302 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); 312 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
303 313
304 /* register PCI devices */ 314 /* register PCI devices */
305 if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { 315 name = (char *) &names[1];
306 if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) 316 type = (char *) &types[1];
307 goto exit; 317 for (i = 0; i < indexes[0]; i++) {
308 318
309 name = (char *) &names[1]; 319 slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]);
310 type = (char *) &types[1]; 320 if (!slot)
311 for (i = 0; i < indexes[0]; i++, 321 return -ENOMEM;
312 name += (strlen(name) + 1), type += (strlen(type) + 1)) { 322
313 323 slot->type = simple_strtoul(type, NULL, 10);
314 if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name,
315 power_domains[i + 1]))) {
316 retval = -ENOMEM;
317 goto exit;
318 }
319 slot->type = simple_strtoul(type, NULL, 10);
320 324
321 dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", 325 dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
322 indexes[i + 1], name, type); 326 indexes[i + 1], name, type);
323 327
324 retval = rpaphp_register_pci_slot(slot); 328 retval = rpaphp_enable_slot(slot);
325 } 329 if (!retval)
330 retval = rpaphp_register_slot(slot);
331
332 if (retval)
333 dealloc_slot_struct(slot);
334
335 name += strlen(name) + 1;
336 type += strlen(type) + 1;
326 } 337 }
327exit: 338 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
328 dbg("%s - Exit: num_slots=%d rc[%d]\n", 339
329 __FUNCTION__, num_slots, retval); 340 /* XXX FIXME: reports a failure only if last entry in loop failed */
330 return retval; 341 return retval;
331} 342}
332 343
@@ -354,7 +365,6 @@ static int __init rpaphp_init(void)
354 struct device_node *dn = NULL; 365 struct device_node *dn = NULL;
355 366
356 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 367 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
357 init_MUTEX(&rpaphp_sem);
358 368
359 while ((dn = of_find_node_by_name(dn, "pci"))) 369 while ((dn = of_find_node_by_name(dn, "pci")))
360 rpaphp_add_slot(dn); 370 rpaphp_add_slot(dn);
@@ -367,8 +377,9 @@ static void __exit rpaphp_exit(void)
367 cleanup_slots(); 377 cleanup_slots();
368} 378}
369 379
370static int __enable_slot(struct slot *slot) 380static int enable_slot(struct hotplug_slot *hotplug_slot)
371{ 381{
382 struct slot *slot = (struct slot *)hotplug_slot->private;
372 int state; 383 int state;
373 int retval; 384 int retval;
374 385
@@ -392,46 +403,17 @@ static int __enable_slot(struct slot *slot)
392 return 0; 403 return 0;
393} 404}
394 405
395static int enable_slot(struct hotplug_slot *hotplug_slot) 406static int disable_slot(struct hotplug_slot *hotplug_slot)
396{ 407{
397 int retval;
398 struct slot *slot = (struct slot *)hotplug_slot->private; 408 struct slot *slot = (struct slot *)hotplug_slot->private;
399
400 down(&rpaphp_sem);
401 retval = __enable_slot(slot);
402 up(&rpaphp_sem);
403
404 return retval;
405}
406
407static int __disable_slot(struct slot *slot)
408{
409 struct pci_dev *dev, *tmp;
410
411 if (slot->state == NOT_CONFIGURED) 409 if (slot->state == NOT_CONFIGURED)
412 return -EINVAL; 410 return -EINVAL;
413 411
414 list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) { 412 pcibios_remove_pci_devices(slot->bus);
415 eeh_remove_bus_device(dev);
416 pci_remove_bus_device(dev);
417 }
418
419 slot->state = NOT_CONFIGURED; 413 slot->state = NOT_CONFIGURED;
420 return 0; 414 return 0;
421} 415}
422 416
423static int disable_slot(struct hotplug_slot *hotplug_slot)
424{
425 struct slot *slot = (struct slot *)hotplug_slot->private;
426 int retval;
427
428 down(&rpaphp_sem);
429 retval = __disable_slot (slot);
430 up(&rpaphp_sem);
431
432 return retval;
433}
434
435struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { 417struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
436 .owner = THIS_MODULE, 418 .owner = THIS_MODULE,
437 .enable_slot = enable_slot, 419 .enable_slot = enable_slot,
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 6f6cbede5135..54ca8650d511 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -64,75 +64,6 @@ int rpaphp_get_sensor_state(struct slot *slot, int *state)
64 return rc; 64 return rc;
65} 65}
66 66
67/**
68 * get_pci_adapter_status - get the status of a slot
69 *
70 * 0-- slot is empty
71 * 1-- adapter is configured
72 * 2-- adapter is not configured
73 * 3-- not valid
74 */
75int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value)
76{
77 struct pci_bus *bus;
78 int state, rc;
79
80 *value = NOT_VALID;
81 rc = rpaphp_get_sensor_state(slot, &state);
82 if (rc)
83 goto exit;
84
85 if (state == EMPTY)
86 *value = EMPTY;
87 else if (state == PRESENT) {
88 if (!is_init) {
89 /* at run-time slot->state can be changed by */
90 /* config/unconfig adapter */
91 *value = slot->state;
92 } else {
93 bus = pcibios_find_pci_bus(slot->dn);
94 if (bus && !list_empty(&bus->devices))
95 *value = CONFIGURED;
96 else
97 *value = NOT_CONFIGURED;
98 }
99 }
100exit:
101 return rc;
102}
103
104static void print_slot_pci_funcs(struct pci_bus *bus)
105{
106 struct device_node *dn;
107 struct pci_dev *dev;
108
109 dn = pci_bus_to_OF_node(bus);
110 if (!dn)
111 return;
112
113 dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, dn->full_name);
114 list_for_each_entry (dev, &bus->devices, bus_list)
115 dbg("\t%s\n", pci_name(dev));
116 return;
117}
118
119static int setup_pci_hotplug_slot_info(struct slot *slot)
120{
121 struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info;
122
123 dbg("%s Initilize the PCI slot's hotplug->info structure ...\n",
124 __FUNCTION__);
125 rpaphp_get_power_status(slot, &hotplug_slot_info->power_status);
126 rpaphp_get_pci_adapter_status(slot, 1,
127 &hotplug_slot_info->adapter_status);
128 if (hotplug_slot_info->adapter_status == NOT_VALID) {
129 err("%s: NOT_VALID: skip dn->full_name=%s\n",
130 __FUNCTION__, slot->dn->full_name);
131 return -EINVAL;
132 }
133 return 0;
134}
135
136static void set_slot_name(struct slot *slot) 67static void set_slot_name(struct slot *slot)
137{ 68{
138 struct pci_bus *bus = slot->bus; 69 struct pci_bus *bus = slot->bus;
@@ -146,69 +77,73 @@ static void set_slot_name(struct slot *slot)
146 bus->number); 77 bus->number);
147} 78}
148 79
149static int setup_pci_slot(struct slot *slot) 80/**
81 * rpaphp_enable_slot - record slot state, config pci device
82 *
83 * Initialize values in the slot, and the hotplug_slot info
84 * structures to indicate if there is a pci card plugged into
85 * the slot. If the slot is not empty, run the pcibios routine
86 * to get pcibios stuff correctly set up.
87 */
88int rpaphp_enable_slot(struct slot *slot)
150{ 89{
151 struct device_node *dn = slot->dn; 90 int rc, level, state;
152 struct pci_bus *bus; 91 struct pci_bus *bus;
92 struct hotplug_slot_info *info = slot->hotplug_slot->info;
93
94 info->adapter_status = NOT_VALID;
95 slot->state = EMPTY;
96
97 /* Find out if the power is turned on for the slot */
98 rc = rtas_get_power_level(slot->power_domain, &level);
99 if (rc)
100 return rc;
101 info->power_status = level;
102
103 /* Figure out if there is an adapter in the slot */
104 rc = rpaphp_get_sensor_state(slot, &state);
105 if (rc)
106 return rc;
153 107
154 BUG_ON(!dn); 108 bus = pcibios_find_pci_bus(slot->dn);
155 bus = pcibios_find_pci_bus(dn);
156 if (!bus) { 109 if (!bus) {
157 err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name); 110 err("%s: no pci_bus for dn %s\n", __FUNCTION__, slot->dn->full_name);
158 goto exit_rc; 111 return -EINVAL;
159 } 112 }
160 113
114 info->adapter_status = EMPTY;
161 slot->bus = bus; 115 slot->bus = bus;
162 slot->pci_devs = &bus->devices; 116 slot->pci_devs = &bus->devices;
163 set_slot_name(slot); 117 set_slot_name(slot);
164 118
165 /* find slot's pci_dev if it's not empty */ 119 /* if there's an adapter in the slot, go add the pci devices */
166 if (slot->hotplug_slot->info->adapter_status == EMPTY) { 120 if (state == PRESENT) {
167 slot->state = EMPTY; /* slot is empty */ 121 info->adapter_status = NOT_CONFIGURED;
168 } else { 122 slot->state = NOT_CONFIGURED;
169 /* slot is occupied */ 123
170 if (!dn->child) { 124 /* non-empty slot has to have child */
171 /* non-empty slot has to have child */ 125 if (!slot->dn->child) {
172 err("%s: slot[%s]'s device_node doesn't have child for adapter\n", 126 err("%s: slot[%s]'s device_node doesn't have child for adapter\n",
173 __FUNCTION__, slot->name); 127 __FUNCTION__, slot->name);
174 goto exit_rc; 128 return -EINVAL;
175 } 129 }
176 130
177 if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) { 131 if (list_empty(&bus->devices))
178 dbg("%s CONFIGURING pci adapter in slot[%s]\n", 132 pcibios_add_pci_devices(bus);
179 __FUNCTION__, slot->name);
180 pcibios_add_pci_devices(slot->bus);
181 133
182 } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) { 134 if (!list_empty(&bus->devices)) {
183 err("%s: slot[%s]'s adapter_status is NOT_VALID.\n", 135 info->adapter_status = CONFIGURED;
184 __FUNCTION__, slot->name);
185 goto exit_rc;
186 }
187 print_slot_pci_funcs(slot->bus);
188 if (!list_empty(slot->pci_devs)) {
189 slot->state = CONFIGURED; 136 slot->state = CONFIGURED;
190 } else { 137 }
191 /* DLPAR add as opposed to 138
192 * boot time */ 139 if (debug) {
193 slot->state = NOT_CONFIGURED; 140 struct pci_dev *dev;
141 dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, slot->dn->full_name);
142 list_for_each_entry (dev, &bus->devices, bus_list)
143 dbg("\t%s\n", pci_name(dev));
194 } 144 }
195 } 145 }
196 return 0;
197exit_rc:
198 dealloc_slot_struct(slot);
199 return -EINVAL;
200}
201 146
202int rpaphp_register_pci_slot(struct slot *slot) 147 return 0;
203{
204 int rc = -EINVAL;
205
206 if (setup_pci_hotplug_slot_info(slot))
207 goto exit_rc;
208 if (setup_pci_slot(slot))
209 goto exit_rc;
210 rc = rpaphp_register_slot(slot);
211exit_rc:
212 return rc;
213} 148}
214 149
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 3009193f0058..d4ee8723fcb3 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -56,7 +56,6 @@ static struct hotplug_slot_attribute php_attr_location = {
56static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) 56static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
57{ 57{
58 struct slot *slot = (struct slot *) hotplug_slot->private; 58 struct slot *slot = (struct slot *) hotplug_slot->private;
59
60 dealloc_slot_struct(slot); 59 dealloc_slot_struct(slot);
61} 60}
62 61
@@ -65,12 +64,12 @@ void dealloc_slot_struct(struct slot *slot)
65 kfree(slot->hotplug_slot->info); 64 kfree(slot->hotplug_slot->info);
66 kfree(slot->hotplug_slot->name); 65 kfree(slot->hotplug_slot->name);
67 kfree(slot->hotplug_slot); 66 kfree(slot->hotplug_slot);
67 kfree(slot->location);
68 kfree(slot); 68 kfree(slot);
69 return;
70} 69}
71 70
72struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, 71struct slot *alloc_slot_struct(struct device_node *dn,
73 int power_domain) 72 int drc_index, char *drc_name, int power_domain)
74{ 73{
75 struct slot *slot; 74 struct slot *slot;
76 75
@@ -115,7 +114,7 @@ error_nomem:
115 114
116static int is_registered(struct slot *slot) 115static int is_registered(struct slot *slot)
117{ 116{
118 struct slot *tmp_slot; 117 struct slot *tmp_slot;
119 118
120 list_for_each_entry(tmp_slot, &rpaphp_slot_head, rpaphp_slot_list) { 119 list_for_each_entry(tmp_slot, &rpaphp_slot_head, rpaphp_slot_list) {
121 if (!strcmp(tmp_slot->name, slot->name)) 120 if (!strcmp(tmp_slot->name, slot->name))
@@ -140,8 +139,6 @@ int rpaphp_deregister_slot(struct slot *slot)
140 retval = pci_hp_deregister(php_slot); 139 retval = pci_hp_deregister(php_slot);
141 if (retval) 140 if (retval)
142 err("Problem unregistering a slot %s\n", slot->name); 141 err("Problem unregistering a slot %s\n", slot->name);
143 else
144 num_slots--;
145 142
146 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); 143 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
147 return retval; 144 return retval;
@@ -160,14 +157,13 @@ int rpaphp_register_slot(struct slot *slot)
160 /* should not try to register the same slot twice */ 157 /* should not try to register the same slot twice */
161 if (is_registered(slot)) { 158 if (is_registered(slot)) {
162 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); 159 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
163 retval = -EAGAIN; 160 return -EAGAIN;
164 goto register_fail;
165 } 161 }
166 162
167 retval = pci_hp_register(php_slot); 163 retval = pci_hp_register(php_slot);
168 if (retval) { 164 if (retval) {
169 err("pci_hp_register failed with error %d\n", retval); 165 err("pci_hp_register failed with error %d\n", retval);
170 goto register_fail; 166 return retval;
171 } 167 }
172 168
173 /* create "phy_location" file */ 169 /* create "phy_location" file */
@@ -181,43 +177,10 @@ int rpaphp_register_slot(struct slot *slot)
181 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); 177 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head);
182 info("Slot [%s](PCI location=%s) registered\n", slot->name, 178 info("Slot [%s](PCI location=%s) registered\n", slot->name,
183 slot->location); 179 slot->location);
184 num_slots++;
185 return 0; 180 return 0;
186 181
187sysfs_fail: 182sysfs_fail:
188 pci_hp_deregister(php_slot); 183 pci_hp_deregister(php_slot);
189register_fail:
190 rpaphp_release_slot(php_slot);
191 return retval; 184 return retval;
192} 185}
193 186
194int rpaphp_get_power_status(struct slot *slot, u8 * value)
195{
196 int rc = 0, level;
197
198 rc = rtas_get_power_level(slot->power_domain, &level);
199 if (rc < 0) {
200 err("failed to get power-level for slot(%s), rc=0x%x\n",
201 slot->location, rc);
202 return rc;
203 }
204
205 dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n",
206 __FUNCTION__, slot->name, slot->power_domain, level);
207 *value = level;
208
209 return rc;
210}
211
212int rpaphp_set_attention_status(struct slot *slot, u8 status)
213{
214 int rc;
215
216 /* status: LED_OFF or LED_ON */
217 rc = rtas_set_indicator(DR_INDICATOR, slot->index, status);
218 if (rc < 0)
219 err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n",
220 slot->name, slot->location, slot->index, status, rc);
221
222 return rc;
223}
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index 01d31a1f697c..37ed0884b972 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -166,7 +166,7 @@ extern u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
166extern int shpchp_configure_device(struct slot *p_slot); 166extern int shpchp_configure_device(struct slot *p_slot);
167extern int shpchp_unconfigure_device(struct slot *p_slot); 167extern int shpchp_unconfigure_device(struct slot *p_slot);
168extern void cleanup_slots(struct controller *ctrl); 168extern void cleanup_slots(struct controller *ctrl);
169extern void queue_pushbutton_work(struct work_struct *work); 169extern void shpchp_queue_pushbutton_work(struct work_struct *work);
170extern int shpc_init( struct controller *ctrl, struct pci_dev *pdev); 170extern int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
171 171
172#ifdef CONFIG_ACPI 172#ifdef CONFIG_ACPI
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 5f4bc08a633a..80dec9796b31 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -136,7 +136,7 @@ static int init_slots(struct controller *ctrl)
136 slot->hpc_ops = ctrl->hpc_ops; 136 slot->hpc_ops = ctrl->hpc_ops;
137 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); 137 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
138 mutex_init(&slot->lock); 138 mutex_init(&slot->lock);
139 INIT_DELAYED_WORK(&slot->work, queue_pushbutton_work); 139 INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work);
140 140
141 /* register this slot with the hotplug pci core */ 141 /* register this slot with the hotplug pci core */
142 hotplug_slot->private = slot; 142 hotplug_slot->private = slot;
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index b746bd265bc6..2c94d44279a3 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -433,7 +433,7 @@ static void shpchp_pushbutton_thread(struct work_struct *work)
433 kfree(info); 433 kfree(info);
434} 434}
435 435
436void queue_pushbutton_work(struct work_struct *work) 436void shpchp_queue_pushbutton_work(struct work_struct *work)
437{ 437{
438 struct slot *p_slot = container_of(work, struct slot, work.work); 438 struct slot *p_slot = container_of(work, struct slot, work.work);
439 struct pushbutton_work_info *info; 439 struct pushbutton_work_info *info;
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 435c1958a7b7..9e1321d0d5e6 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -24,20 +24,8 @@
24#include "pci.h" 24#include "pci.h"
25#include "msi.h" 25#include "msi.h"
26 26
27static struct kmem_cache* msi_cachep;
28
29static int pci_msi_enable = 1; 27static int pci_msi_enable = 1;
30 28
31static int msi_cache_init(void)
32{
33 msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc),
34 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
35 if (!msi_cachep)
36 return -ENOMEM;
37
38 return 0;
39}
40
41static void msi_set_enable(struct pci_dev *dev, int enable) 29static void msi_set_enable(struct pci_dev *dev, int enable)
42{ 30{
43 int pos; 31 int pos;
@@ -68,6 +56,29 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
68 } 56 }
69} 57}
70 58
59static void msix_flush_writes(unsigned int irq)
60{
61 struct msi_desc *entry;
62
63 entry = get_irq_msi(irq);
64 BUG_ON(!entry || !entry->dev);
65 switch (entry->msi_attrib.type) {
66 case PCI_CAP_ID_MSI:
67 /* nothing to do */
68 break;
69 case PCI_CAP_ID_MSIX:
70 {
71 int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
72 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET;
73 readl(entry->mask_base + offset);
74 break;
75 }
76 default:
77 BUG();
78 break;
79 }
80}
81
71static void msi_set_mask_bit(unsigned int irq, int flag) 82static void msi_set_mask_bit(unsigned int irq, int flag)
72{ 83{
73 struct msi_desc *entry; 84 struct msi_desc *entry;
@@ -187,41 +198,28 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg)
187void mask_msi_irq(unsigned int irq) 198void mask_msi_irq(unsigned int irq)
188{ 199{
189 msi_set_mask_bit(irq, 1); 200 msi_set_mask_bit(irq, 1);
201 msix_flush_writes(irq);
190} 202}
191 203
192void unmask_msi_irq(unsigned int irq) 204void unmask_msi_irq(unsigned int irq)
193{ 205{
194 msi_set_mask_bit(irq, 0); 206 msi_set_mask_bit(irq, 0);
207 msix_flush_writes(irq);
195} 208}
196 209
197static int msi_free_irq(struct pci_dev* dev, int irq); 210static int msi_free_irqs(struct pci_dev* dev);
198
199static int msi_init(void)
200{
201 static int status = -ENOMEM;
202
203 if (!status)
204 return status;
205 211
206 status = msi_cache_init();
207 if (status < 0) {
208 pci_msi_enable = 0;
209 printk(KERN_WARNING "PCI: MSI cache init failed\n");
210 return status;
211 }
212
213 return status;
214}
215 212
216static struct msi_desc* alloc_msi_entry(void) 213static struct msi_desc* alloc_msi_entry(void)
217{ 214{
218 struct msi_desc *entry; 215 struct msi_desc *entry;
219 216
220 entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL); 217 entry = kzalloc(sizeof(struct msi_desc), GFP_KERNEL);
221 if (!entry) 218 if (!entry)
222 return NULL; 219 return NULL;
223 220
224 entry->link.tail = entry->link.head = 0; /* single message */ 221 INIT_LIST_HEAD(&entry->list);
222 entry->irq = 0;
225 entry->dev = NULL; 223 entry->dev = NULL;
226 224
227 return entry; 225 return entry;
@@ -256,7 +254,6 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
256static void __pci_restore_msix_state(struct pci_dev *dev) 254static void __pci_restore_msix_state(struct pci_dev *dev)
257{ 255{
258 int pos; 256 int pos;
259 int irq, head, tail = 0;
260 struct msi_desc *entry; 257 struct msi_desc *entry;
261 u16 control; 258 u16 control;
262 259
@@ -266,18 +263,15 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
266 /* route the table */ 263 /* route the table */
267 pci_intx(dev, 0); /* disable intx */ 264 pci_intx(dev, 0); /* disable intx */
268 msix_set_enable(dev, 0); 265 msix_set_enable(dev, 0);
269 irq = head = dev->first_msi_irq;
270 entry = get_irq_msi(irq);
271 pos = entry->msi_attrib.pos;
272 while (head != tail) {
273 entry = get_irq_msi(irq);
274 write_msi_msg(irq, &entry->msg);
275 msi_set_mask_bit(irq, entry->msi_attrib.masked);
276 266
277 tail = entry->link.tail; 267 list_for_each_entry(entry, &dev->msi_list, list) {
278 irq = tail; 268 write_msi_msg(entry->irq, &entry->msg);
269 msi_set_mask_bit(entry->irq, entry->msi_attrib.masked);
279 } 270 }
280 271
272 BUG_ON(list_empty(&dev->msi_list));
273 entry = list_entry(dev->msi_list.next, struct msi_desc, list);
274 pos = entry->msi_attrib.pos;
281 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); 275 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
282 control &= ~PCI_MSIX_FLAGS_MASKALL; 276 control &= ~PCI_MSIX_FLAGS_MASKALL;
283 control |= PCI_MSIX_FLAGS_ENABLE; 277 control |= PCI_MSIX_FLAGS_ENABLE;
@@ -303,7 +297,7 @@ void pci_restore_msi_state(struct pci_dev *dev)
303static int msi_capability_init(struct pci_dev *dev) 297static int msi_capability_init(struct pci_dev *dev)
304{ 298{
305 struct msi_desc *entry; 299 struct msi_desc *entry;
306 int pos, irq; 300 int pos, ret;
307 u16 control; 301 u16 control;
308 302
309 msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */ 303 msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */
@@ -340,23 +334,21 @@ static int msi_capability_init(struct pci_dev *dev)
340 msi_mask_bits_reg(pos, is_64bit_address(control)), 334 msi_mask_bits_reg(pos, is_64bit_address(control)),
341 maskbits); 335 maskbits);
342 } 336 }
337 list_add(&entry->list, &dev->msi_list);
338
343 /* Configure MSI capability structure */ 339 /* Configure MSI capability structure */
344 irq = arch_setup_msi_irq(dev, entry); 340 ret = arch_setup_msi_irqs(dev, 1, PCI_CAP_ID_MSI);
345 if (irq < 0) { 341 if (ret) {
346 kmem_cache_free(msi_cachep, entry); 342 msi_free_irqs(dev);
347 return irq; 343 return ret;
348 } 344 }
349 entry->link.head = irq;
350 entry->link.tail = irq;
351 dev->first_msi_irq = irq;
352 set_irq_msi(irq, entry);
353 345
354 /* Set MSI enabled bits */ 346 /* Set MSI enabled bits */
355 pci_intx(dev, 0); /* disable intx */ 347 pci_intx(dev, 0); /* disable intx */
356 msi_set_enable(dev, 1); 348 msi_set_enable(dev, 1);
357 dev->msi_enabled = 1; 349 dev->msi_enabled = 1;
358 350
359 dev->irq = irq; 351 dev->irq = entry->irq;
360 return 0; 352 return 0;
361} 353}
362 354
@@ -373,8 +365,8 @@ static int msi_capability_init(struct pci_dev *dev)
373static int msix_capability_init(struct pci_dev *dev, 365static int msix_capability_init(struct pci_dev *dev,
374 struct msix_entry *entries, int nvec) 366 struct msix_entry *entries, int nvec)
375{ 367{
376 struct msi_desc *head = NULL, *tail = NULL, *entry = NULL; 368 struct msi_desc *entry;
377 int irq, pos, i, j, nr_entries, temp = 0; 369 int pos, i, j, nr_entries, ret;
378 unsigned long phys_addr; 370 unsigned long phys_addr;
379 u32 table_offset; 371 u32 table_offset;
380 u16 control; 372 u16 control;
@@ -413,44 +405,34 @@ static int msix_capability_init(struct pci_dev *dev,
413 entry->dev = dev; 405 entry->dev = dev;
414 entry->mask_base = base; 406 entry->mask_base = base;
415 407
416 /* Configure MSI-X capability structure */ 408 list_add(&entry->list, &dev->msi_list);
417 irq = arch_setup_msi_irq(dev, entry);
418 if (irq < 0) {
419 kmem_cache_free(msi_cachep, entry);
420 break;
421 }
422 entries[i].vector = irq;
423 if (!head) {
424 entry->link.head = irq;
425 entry->link.tail = irq;
426 head = entry;
427 } else {
428 entry->link.head = temp;
429 entry->link.tail = tail->link.tail;
430 tail->link.tail = irq;
431 head->link.head = irq;
432 }
433 temp = irq;
434 tail = entry;
435
436 set_irq_msi(irq, entry);
437 } 409 }
438 if (i != nvec) { 410
439 int avail = i - 1; 411 ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
440 i--; 412 if (ret) {
441 for (; i >= 0; i--) { 413 int avail = 0;
442 irq = (entries + i)->vector; 414 list_for_each_entry(entry, &dev->msi_list, list) {
443 msi_free_irq(dev, irq); 415 if (entry->irq != 0) {
444 (entries + i)->vector = 0; 416 avail++;
417 }
445 } 418 }
419
420 msi_free_irqs(dev);
421
446 /* If we had some success report the number of irqs 422 /* If we had some success report the number of irqs
447 * we succeeded in setting up. 423 * we succeeded in setting up.
448 */ 424 */
449 if (avail <= 0) 425 if (avail == 0)
450 avail = -EBUSY; 426 avail = ret;
451 return avail; 427 return avail;
452 } 428 }
453 dev->first_msi_irq = entries[0].vector; 429
430 i = 0;
431 list_for_each_entry(entry, &dev->msi_list, list) {
432 entries[i].vector = entry->irq;
433 set_irq_msi(entry->irq, entry);
434 i++;
435 }
454 /* Set MSI-X enabled bits */ 436 /* Set MSI-X enabled bits */
455 pci_intx(dev, 0); /* disable intx */ 437 pci_intx(dev, 0); /* disable intx */
456 msix_set_enable(dev, 1); 438 msix_set_enable(dev, 1);
@@ -460,21 +442,32 @@ static int msix_capability_init(struct pci_dev *dev,
460} 442}
461 443
462/** 444/**
463 * pci_msi_supported - check whether MSI may be enabled on device 445 * pci_msi_check_device - check whether MSI may be enabled on a device
464 * @dev: pointer to the pci_dev data structure of MSI device function 446 * @dev: pointer to the pci_dev data structure of MSI device function
447 * @nvec: how many MSIs have been requested ?
448 * @type: are we checking for MSI or MSI-X ?
465 * 449 *
466 * Look at global flags, the device itself, and its parent busses 450 * Look at global flags, the device itself, and its parent busses
467 * to return 0 if MSI are supported for the device. 451 * to determine if MSI/-X are supported for the device. If MSI/-X is
452 * supported return 0, else return an error code.
468 **/ 453 **/
469static 454static int pci_msi_check_device(struct pci_dev* dev, int nvec, int type)
470int pci_msi_supported(struct pci_dev * dev)
471{ 455{
472 struct pci_bus *bus; 456 struct pci_bus *bus;
457 int ret;
473 458
474 /* MSI must be globally enabled and supported by the device */ 459 /* MSI must be globally enabled and supported by the device */
475 if (!pci_msi_enable || !dev || dev->no_msi) 460 if (!pci_msi_enable || !dev || dev->no_msi)
476 return -EINVAL; 461 return -EINVAL;
477 462
463 /*
464 * You can't ask to have 0 or less MSIs configured.
465 * a) it's stupid ..
466 * b) the list manipulation code assumes nvec >= 1.
467 */
468 if (nvec < 1)
469 return -ERANGE;
470
478 /* Any bridge which does NOT route MSI transactions from it's 471 /* Any bridge which does NOT route MSI transactions from it's
479 * secondary bus to it's primary bus must set NO_MSI flag on 472 * secondary bus to it's primary bus must set NO_MSI flag on
480 * the secondary pci_bus. 473 * the secondary pci_bus.
@@ -485,6 +478,13 @@ int pci_msi_supported(struct pci_dev * dev)
485 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) 478 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
486 return -EINVAL; 479 return -EINVAL;
487 480
481 ret = arch_msi_check_device(dev, nvec, type);
482 if (ret)
483 return ret;
484
485 if (!pci_find_capability(dev, type))
486 return -EINVAL;
487
488 return 0; 488 return 0;
489} 489}
490 490
@@ -500,19 +500,12 @@ int pci_msi_supported(struct pci_dev * dev)
500 **/ 500 **/
501int pci_enable_msi(struct pci_dev* dev) 501int pci_enable_msi(struct pci_dev* dev)
502{ 502{
503 int pos, status; 503 int status;
504
505 if (pci_msi_supported(dev) < 0)
506 return -EINVAL;
507 504
508 status = msi_init(); 505 status = pci_msi_check_device(dev, 1, PCI_CAP_ID_MSI);
509 if (status < 0) 506 if (status)
510 return status; 507 return status;
511 508
512 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
513 if (!pos)
514 return -EINVAL;
515
516 WARN_ON(!!dev->msi_enabled); 509 WARN_ON(!!dev->msi_enabled);
517 510
518 /* Check whether driver already requested for MSI-X irqs */ 511 /* Check whether driver already requested for MSI-X irqs */
@@ -525,69 +518,54 @@ int pci_enable_msi(struct pci_dev* dev)
525 status = msi_capability_init(dev); 518 status = msi_capability_init(dev);
526 return status; 519 return status;
527} 520}
521EXPORT_SYMBOL(pci_enable_msi);
528 522
529void pci_disable_msi(struct pci_dev* dev) 523void pci_disable_msi(struct pci_dev* dev)
530{ 524{
531 struct msi_desc *entry; 525 struct msi_desc *entry;
532 int default_irq; 526 int default_irq;
533 527
534 if (!pci_msi_enable) 528 if (!pci_msi_enable || !dev || !dev->msi_enabled)
535 return;
536 if (!dev)
537 return;
538
539 if (!dev->msi_enabled)
540 return; 529 return;
541 530
542 msi_set_enable(dev, 0); 531 msi_set_enable(dev, 0);
543 pci_intx(dev, 1); /* enable intx */ 532 pci_intx(dev, 1); /* enable intx */
544 dev->msi_enabled = 0; 533 dev->msi_enabled = 0;
545 534
546 entry = get_irq_msi(dev->first_msi_irq); 535 BUG_ON(list_empty(&dev->msi_list));
547 if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { 536 entry = list_entry(dev->msi_list.next, struct msi_desc, list);
537 if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) {
548 return; 538 return;
549 } 539 }
550 if (irq_has_action(dev->first_msi_irq)) { 540
551 printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without " 541 default_irq = entry->msi_attrib.default_irq;
552 "free_irq() on MSI irq %d\n", 542 msi_free_irqs(dev);
553 pci_name(dev), dev->first_msi_irq); 543
554 BUG_ON(irq_has_action(dev->first_msi_irq)); 544 /* Restore dev->irq to its default pin-assertion irq */
555 } else { 545 dev->irq = default_irq;
556 default_irq = entry->msi_attrib.default_irq;
557 msi_free_irq(dev, dev->first_msi_irq);
558
559 /* Restore dev->irq to its default pin-assertion irq */
560 dev->irq = default_irq;
561 }
562 dev->first_msi_irq = 0;
563} 546}
547EXPORT_SYMBOL(pci_disable_msi);
564 548
565static int msi_free_irq(struct pci_dev* dev, int irq) 549static int msi_free_irqs(struct pci_dev* dev)
566{ 550{
567 struct msi_desc *entry; 551 struct msi_desc *entry, *tmp;
568 int head, entry_nr, type;
569 void __iomem *base;
570 552
571 entry = get_irq_msi(irq); 553 list_for_each_entry(entry, &dev->msi_list, list)
572 if (!entry || entry->dev != dev) { 554 BUG_ON(irq_has_action(entry->irq));
573 return -EINVAL; 555
574 } 556 arch_teardown_msi_irqs(dev);
575 type = entry->msi_attrib.type; 557
576 entry_nr = entry->msi_attrib.entry_nr; 558 list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) {
577 head = entry->link.head; 559 if (entry->msi_attrib.type == PCI_CAP_ID_MSIX) {
578 base = entry->mask_base; 560 if (list_is_last(&entry->list, &dev->msi_list))
579 get_irq_msi(entry->link.head)->link.tail = entry->link.tail; 561 iounmap(entry->mask_base);
580 get_irq_msi(entry->link.tail)->link.head = entry->link.head; 562
581 563 writel(1, entry->mask_base + entry->msi_attrib.entry_nr
582 arch_teardown_msi_irq(irq); 564 * PCI_MSIX_ENTRY_SIZE
583 kmem_cache_free(msi_cachep, entry); 565 + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
584 566 }
585 if (type == PCI_CAP_ID_MSIX) { 567 list_del(&entry->list);
586 writel(1, base + entry_nr * PCI_MSIX_ENTRY_SIZE + 568 kfree(entry);
587 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
588
589 if (head == irq)
590 iounmap(base);
591 } 569 }
592 570
593 return 0; 571 return 0;
@@ -614,17 +592,14 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
614 int i, j; 592 int i, j;
615 u16 control; 593 u16 control;
616 594
617 if (!entries || pci_msi_supported(dev) < 0) 595 if (!entries)
618 return -EINVAL; 596 return -EINVAL;
619 597
620 status = msi_init(); 598 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX);
621 if (status < 0) 599 if (status)
622 return status; 600 return status;
623 601
624 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); 602 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
625 if (!pos)
626 return -EINVAL;
627
628 pci_read_config_word(dev, msi_control_reg(pos), &control); 603 pci_read_config_word(dev, msi_control_reg(pos), &control);
629 nr_entries = multi_msix_capable(control); 604 nr_entries = multi_msix_capable(control);
630 if (nvec > nr_entries) 605 if (nvec > nr_entries)
@@ -651,41 +626,25 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
651 status = msix_capability_init(dev, entries, nvec); 626 status = msix_capability_init(dev, entries, nvec);
652 return status; 627 return status;
653} 628}
629EXPORT_SYMBOL(pci_enable_msix);
654 630
655void pci_disable_msix(struct pci_dev* dev) 631static void msix_free_all_irqs(struct pci_dev *dev)
656{ 632{
657 int irq, head, tail = 0, warning = 0; 633 msi_free_irqs(dev);
658 634}
659 if (!pci_msi_enable)
660 return;
661 if (!dev)
662 return;
663 635
664 if (!dev->msix_enabled) 636void pci_disable_msix(struct pci_dev* dev)
637{
638 if (!pci_msi_enable || !dev || !dev->msix_enabled)
665 return; 639 return;
666 640
667 msix_set_enable(dev, 0); 641 msix_set_enable(dev, 0);
668 pci_intx(dev, 1); /* enable intx */ 642 pci_intx(dev, 1); /* enable intx */
669 dev->msix_enabled = 0; 643 dev->msix_enabled = 0;
670 644
671 irq = head = dev->first_msi_irq; 645 msix_free_all_irqs(dev);
672 while (head != tail) {
673 tail = get_irq_msi(irq)->link.tail;
674 if (irq_has_action(irq))
675 warning = 1;
676 else if (irq != head) /* Release MSI-X irq */
677 msi_free_irq(dev, irq);
678 irq = tail;
679 }
680 msi_free_irq(dev, irq);
681 if (warning) {
682 printk(KERN_WARNING "PCI: %s: pci_disable_msix() called without "
683 "free_irq() on all MSI-X irqs\n",
684 pci_name(dev));
685 BUG_ON(warning > 0);
686 }
687 dev->first_msi_irq = 0;
688} 646}
647EXPORT_SYMBOL(pci_disable_msix);
689 648
690/** 649/**
691 * msi_remove_pci_irq_vectors - reclaim MSI(X) irqs to unused state 650 * msi_remove_pci_irq_vectors - reclaim MSI(X) irqs to unused state
@@ -701,38 +660,11 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
701 if (!pci_msi_enable || !dev) 660 if (!pci_msi_enable || !dev)
702 return; 661 return;
703 662
704 if (dev->msi_enabled) { 663 if (dev->msi_enabled)
705 if (irq_has_action(dev->first_msi_irq)) { 664 msi_free_irqs(dev);
706 printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() " 665
707 "called without free_irq() on MSI irq %d\n", 666 if (dev->msix_enabled)
708 pci_name(dev), dev->first_msi_irq); 667 msix_free_all_irqs(dev);
709 BUG_ON(irq_has_action(dev->first_msi_irq));
710 } else /* Release MSI irq assigned to this device */
711 msi_free_irq(dev, dev->first_msi_irq);
712 }
713 if (dev->msix_enabled) {
714 int irq, head, tail = 0, warning = 0;
715 void __iomem *base = NULL;
716
717 irq = head = dev->first_msi_irq;
718 while (head != tail) {
719 tail = get_irq_msi(irq)->link.tail;
720 base = get_irq_msi(irq)->mask_base;
721 if (irq_has_action(irq))
722 warning = 1;
723 else if (irq != head) /* Release MSI-X irq */
724 msi_free_irq(dev, irq);
725 irq = tail;
726 }
727 msi_free_irq(dev, irq);
728 if (warning) {
729 iounmap(base);
730 printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() "
731 "called without free_irq() on all MSI-X irqs\n",
732 pci_name(dev));
733 BUG_ON(warning > 0);
734 }
735 }
736} 668}
737 669
738void pci_no_msi(void) 670void pci_no_msi(void)
@@ -740,7 +672,53 @@ void pci_no_msi(void)
740 pci_msi_enable = 0; 672 pci_msi_enable = 0;
741} 673}
742 674
743EXPORT_SYMBOL(pci_enable_msi); 675void pci_msi_init_pci_dev(struct pci_dev *dev)
744EXPORT_SYMBOL(pci_disable_msi); 676{
745EXPORT_SYMBOL(pci_enable_msix); 677 INIT_LIST_HEAD(&dev->msi_list);
746EXPORT_SYMBOL(pci_disable_msix); 678}
679
680
681/* Arch hooks */
682
683int __attribute__ ((weak))
684arch_msi_check_device(struct pci_dev* dev, int nvec, int type)
685{
686 return 0;
687}
688
689int __attribute__ ((weak))
690arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry)
691{
692 return 0;
693}
694
695int __attribute__ ((weak))
696arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
697{
698 struct msi_desc *entry;
699 int ret;
700
701 list_for_each_entry(entry, &dev->msi_list, list) {
702 ret = arch_setup_msi_irq(dev, entry);
703 if (ret)
704 return ret;
705 }
706
707 return 0;
708}
709
710void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq)
711{
712 return;
713}
714
715void __attribute__ ((weak))
716arch_teardown_msi_irqs(struct pci_dev *dev)
717{
718 struct msi_desc *entry;
719
720 list_for_each_entry(entry, &dev->msi_list, list) {
721 if (entry->irq != 0)
722 arch_teardown_msi_irq(entry->irq);
723 }
724}
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 39e80fcef4b3..3bb7739d26a5 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -14,20 +14,6 @@
14#include "pci.h" 14#include "pci.h"
15 15
16/* 16/*
17 * Registration of PCI drivers and handling of hot-pluggable devices.
18 */
19
20/* multithreaded probe logic */
21static int pci_multithread_probe =
22#ifdef CONFIG_PCI_MULTITHREAD_PROBE
23 1;
24#else
25 0;
26#endif
27__module_param_call("", pci_multithread_probe, param_set_bool, param_get_bool, &pci_multithread_probe, 0644);
28
29
30/*
31 * Dynamic device IDs are disabled for !CONFIG_HOTPLUG 17 * Dynamic device IDs are disabled for !CONFIG_HOTPLUG
32 */ 18 */
33 19
@@ -52,7 +38,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
52{ 38{
53 struct pci_dynid *dynid; 39 struct pci_dynid *dynid;
54 struct pci_driver *pdrv = to_pci_driver(driver); 40 struct pci_driver *pdrv = to_pci_driver(driver);
55 __u32 vendor=PCI_ANY_ID, device=PCI_ANY_ID, subvendor=PCI_ANY_ID, 41 __u32 vendor, device, subvendor=PCI_ANY_ID,
56 subdevice=PCI_ANY_ID, class=0, class_mask=0; 42 subdevice=PCI_ANY_ID, class=0, class_mask=0;
57 unsigned long driver_data=0; 43 unsigned long driver_data=0;
58 int fields=0; 44 int fields=0;
@@ -61,7 +47,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
61 fields = sscanf(buf, "%x %x %x %x %x %x %lux", 47 fields = sscanf(buf, "%x %x %x %x %x %x %lux",
62 &vendor, &device, &subvendor, &subdevice, 48 &vendor, &device, &subvendor, &subdevice,
63 &class, &class_mask, &driver_data); 49 &class, &class_mask, &driver_data);
64 if (fields < 0) 50 if (fields < 2)
65 return -EINVAL; 51 return -EINVAL;
66 52
67 dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); 53 dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
@@ -569,7 +555,6 @@ struct bus_type pci_bus_type = {
569 555
570static int __init pci_driver_init(void) 556static int __init pci_driver_init(void)
571{ 557{
572 pci_bus_type.multithread_probe = pci_multithread_probe;
573 return bus_register(&pci_bus_type); 558 return bus_register(&pci_bus_type);
574} 559}
575 560
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index cd913a2a416f..284e83a527f9 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -620,7 +620,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
620 goto err_bin_file; 620 goto err_bin_file;
621 621
622 /* If the device has a ROM, try to expose it in sysfs. */ 622 /* If the device has a ROM, try to expose it in sysfs. */
623 if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) { 623 if (pci_resource_len(pdev, PCI_ROM_RESOURCE) ||
624 (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)) {
624 rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC); 625 rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC);
625 if (rom_attr) { 626 if (rom_attr) {
626 pdev->rom_attr = rom_attr; 627 pdev->rom_attr = rom_attr;
@@ -635,7 +636,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
635 goto err_rom; 636 goto err_rom;
636 } else { 637 } else {
637 retval = -ENOMEM; 638 retval = -ENOMEM;
638 goto err_bin_file; 639 goto err_resource_files;
639 } 640 }
640 } 641 }
641 /* add platform-specific attributes */ 642 /* add platform-specific attributes */
@@ -645,6 +646,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
645 646
646err_rom: 647err_rom:
647 kfree(rom_attr); 648 kfree(rom_attr);
649err_resource_files:
650 pci_remove_resource_files(pdev);
648err_bin_file: 651err_bin_file:
649 if (pdev->cfg_size < 4096) 652 if (pdev->cfg_size < 4096)
650 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); 653 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
@@ -695,4 +698,4 @@ static int __init pci_sysfs_init(void)
695 return 0; 698 return 0;
696} 699}
697 700
698__initcall(pci_sysfs_init); 701late_initcall(pci_sysfs_init);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2a458279327a..fd47ac0c4730 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -35,8 +35,7 @@ unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;
35 * Given a PCI bus, returns the highest PCI bus number present in the set 35 * Given a PCI bus, returns the highest PCI bus number present in the set
36 * including the given PCI bus and its list of child PCI buses. 36 * including the given PCI bus and its list of child PCI buses.
37 */ 37 */
38unsigned char __devinit 38unsigned char pci_bus_max_busnr(struct pci_bus* bus)
39pci_bus_max_busnr(struct pci_bus* bus)
40{ 39{
41 struct list_head *tmp; 40 struct list_head *tmp;
42 unsigned char max, n; 41 unsigned char max, n;
@@ -892,6 +891,34 @@ pci_disable_device(struct pci_dev *dev)
892} 891}
893 892
894/** 893/**
894 * pcibios_set_pcie_reset_state - set reset state for device dev
895 * @dev: the PCI-E device reset
896 * @state: Reset state to enter into
897 *
898 *
899 * Sets the PCI-E reset state for the device. This is the default
900 * implementation. Architecture implementations can override this.
901 */
902int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev,
903 enum pcie_reset_state state)
904{
905 return -EINVAL;
906}
907
908/**
909 * pci_set_pcie_reset_state - set reset state for device dev
910 * @dev: the PCI-E device reset
911 * @state: Reset state to enter into
912 *
913 *
914 * Sets the PCI reset state for the device.
915 */
916int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
917{
918 return pcibios_set_pcie_reset_state(dev, state);
919}
920
921/**
895 * pci_enable_wake - enable PCI device as wakeup event source 922 * pci_enable_wake - enable PCI device as wakeup event source
896 * @dev: PCI device affected 923 * @dev: PCI device affected
897 * @state: PCI state from which device will issue wakeup events 924 * @state: PCI state from which device will issue wakeup events
@@ -1295,7 +1322,7 @@ pci_intx(struct pci_dev *pdev, int enable)
1295 1322
1296/** 1323/**
1297 * pci_msi_off - disables any msi or msix capabilities 1324 * pci_msi_off - disables any msi or msix capabilities
1298 * @pdev: the PCI device to operate on 1325 * @dev: the PCI device to operate on
1299 * 1326 *
1300 * If you want to use msi see pci_enable_msi and friends. 1327 * If you want to use msi see pci_enable_msi and friends.
1301 * This is a lower level primitive that allows us to disable 1328 * This is a lower level primitive that allows us to disable
@@ -1427,4 +1454,5 @@ EXPORT_SYMBOL(pci_set_power_state);
1427EXPORT_SYMBOL(pci_save_state); 1454EXPORT_SYMBOL(pci_save_state);
1428EXPORT_SYMBOL(pci_restore_state); 1455EXPORT_SYMBOL(pci_restore_state);
1429EXPORT_SYMBOL(pci_enable_wake); 1456EXPORT_SYMBOL(pci_enable_wake);
1457EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
1430 1458
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 62ea04c8af64..3fec13d3add7 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -47,8 +47,10 @@ extern unsigned int pci_pm_d3_delay;
47 47
48#ifdef CONFIG_PCI_MSI 48#ifdef CONFIG_PCI_MSI
49void pci_no_msi(void); 49void pci_no_msi(void);
50extern void pci_msi_init_pci_dev(struct pci_dev *dev);
50#else 51#else
51static inline void pci_no_msi(void) { } 52static inline void pci_no_msi(void) { }
53static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
52#endif 54#endif
53 55
54#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM) 56#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2fe1d690eb13..e48fcf089621 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -364,7 +364,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
364 } 364 }
365} 365}
366 366
367static struct pci_bus * __devinit pci_alloc_bus(void) 367static struct pci_bus * pci_alloc_bus(void)
368{ 368{
369 struct pci_bus *b; 369 struct pci_bus *b;
370 370
@@ -432,7 +432,7 @@ error_register:
432 return NULL; 432 return NULL;
433} 433}
434 434
435struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 435struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr)
436{ 436{
437 struct pci_bus *child; 437 struct pci_bus *child;
438 438
@@ -461,7 +461,7 @@ static void pci_enable_crs(struct pci_dev *dev)
461 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); 461 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
462} 462}
463 463
464static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) 464static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
465{ 465{
466 struct pci_bus *parent = child->parent; 466 struct pci_bus *parent = child->parent;
467 467
@@ -477,7 +477,7 @@ static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child,
477 } 477 }
478} 478}
479 479
480unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus); 480unsigned int pci_scan_child_bus(struct pci_bus *bus);
481 481
482/* 482/*
483 * If it's a bridge, configure it and scan the bus behind it. 483 * If it's a bridge, configure it and scan the bus behind it.
@@ -489,7 +489,7 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus);
489 * them, we proceed to assigning numbers to the remaining buses in 489 * them, we proceed to assigning numbers to the remaining buses in
490 * order to avoid overlaps between old and new bus numbers. 490 * order to avoid overlaps between old and new bus numbers.
491 */ 491 */
492int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) 492int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass)
493{ 493{
494 struct pci_bus *child; 494 struct pci_bus *child;
495 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 495 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
@@ -846,6 +846,23 @@ static void pci_release_bus_bridge_dev(struct device *dev)
846 kfree(dev); 846 kfree(dev);
847} 847}
848 848
849struct pci_dev *alloc_pci_dev(void)
850{
851 struct pci_dev *dev;
852
853 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
854 if (!dev)
855 return NULL;
856
857 INIT_LIST_HEAD(&dev->global_list);
858 INIT_LIST_HEAD(&dev->bus_list);
859
860 pci_msi_init_pci_dev(dev);
861
862 return dev;
863}
864EXPORT_SYMBOL(alloc_pci_dev);
865
849/* 866/*
850 * Read the config data for a PCI device, sanity-check it 867 * Read the config data for a PCI device, sanity-check it
851 * and fill in the dev structure... 868 * and fill in the dev structure...
@@ -885,7 +902,7 @@ pci_scan_device(struct pci_bus *bus, int devfn)
885 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type)) 902 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
886 return NULL; 903 return NULL;
887 904
888 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 905 dev = alloc_pci_dev();
889 if (!dev) 906 if (!dev)
890 return NULL; 907 return NULL;
891 908
@@ -912,7 +929,7 @@ pci_scan_device(struct pci_bus *bus, int devfn)
912 return dev; 929 return dev;
913} 930}
914 931
915void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus) 932void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
916{ 933{
917 device_initialize(&dev->dev); 934 device_initialize(&dev->dev);
918 dev->dev.release = pci_release_dev; 935 dev->dev.release = pci_release_dev;
@@ -935,8 +952,7 @@ void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
935 up_write(&pci_bus_sem); 952 up_write(&pci_bus_sem);
936} 953}
937 954
938struct pci_dev * __devinit 955struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn)
939pci_scan_single_device(struct pci_bus *bus, int devfn)
940{ 956{
941 struct pci_dev *dev; 957 struct pci_dev *dev;
942 958
@@ -958,7 +974,7 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
958 * discovered devices to the @bus->devices list. New devices 974 * discovered devices to the @bus->devices list. New devices
959 * will have an empty dev->global_list head. 975 * will have an empty dev->global_list head.
960 */ 976 */
961int __devinit pci_scan_slot(struct pci_bus *bus, int devfn) 977int pci_scan_slot(struct pci_bus *bus, int devfn)
962{ 978{
963 int func, nr = 0; 979 int func, nr = 0;
964 int scan_all_fns; 980 int scan_all_fns;
@@ -991,7 +1007,7 @@ int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
991 return nr; 1007 return nr;
992} 1008}
993 1009
994unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) 1010unsigned int pci_scan_child_bus(struct pci_bus *bus)
995{ 1011{
996 unsigned int devfn, pass, max = bus->secondary; 1012 unsigned int devfn, pass, max = bus->secondary;
997 struct pci_dev *dev; 1013 struct pci_dev *dev;
@@ -1041,7 +1057,7 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
1041 return max; 1057 return max;
1042} 1058}
1043 1059
1044struct pci_bus * __devinit pci_create_bus(struct device *parent, 1060struct pci_bus * pci_create_bus(struct device *parent,
1045 int bus, struct pci_ops *ops, void *sysdata) 1061 int bus, struct pci_ops *ops, void *sysdata)
1046{ 1062{
1047 int error; 1063 int error;
@@ -1119,7 +1135,7 @@ err_out:
1119} 1135}
1120EXPORT_SYMBOL_GPL(pci_create_bus); 1136EXPORT_SYMBOL_GPL(pci_create_bus);
1121 1137
1122struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, 1138struct pci_bus *pci_scan_bus_parented(struct device *parent,
1123 int bus, struct pci_ops *ops, void *sysdata) 1139 int bus, struct pci_ops *ops, void *sysdata)
1124{ 1140{
1125 struct pci_bus *b; 1141 struct pci_bus *b;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 3411483240cd..147d86f8edbf 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1648,6 +1648,8 @@ static void __devinit quirk_disable_msi(struct pci_dev *dev)
1648 } 1648 }
1649} 1649}
1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);
1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_msi);
1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_msi);
1651 1653
1652/* Go through the list of Hypertransport capabilities and 1654/* Go through the list of Hypertransport capabilities and
1653 * return 1 if a HT MSI capability is found and enabled */ 1655 * return 1 if a HT MSI capability is found and enabled */
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 2dd8681d6b31..b137a27472c7 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -15,8 +15,7 @@
15 15
16DECLARE_RWSEM(pci_bus_sem); 16DECLARE_RWSEM(pci_bus_sem);
17 17
18static struct pci_bus * 18static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
19pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
20{ 19{
21 struct pci_bus* child; 20 struct pci_bus* child;
22 struct list_head *tmp; 21 struct list_head *tmp;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 3554f3948814..5ec297d7a5b4 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -36,8 +36,7 @@
36 36
37#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) 37#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
38 38
39static void __devinit 39static void pbus_assign_resources_sorted(struct pci_bus *bus)
40pbus_assign_resources_sorted(struct pci_bus *bus)
41{ 40{
42 struct pci_dev *dev; 41 struct pci_dev *dev;
43 struct resource *res; 42 struct resource *res;
@@ -220,8 +219,7 @@ pci_setup_bridge(struct pci_bus *bus)
220/* Check whether the bridge supports optional I/O and 219/* Check whether the bridge supports optional I/O and
221 prefetchable memory ranges. If not, the respective 220 prefetchable memory ranges. If not, the respective
222 base/limit registers must be read-only and read as 0. */ 221 base/limit registers must be read-only and read as 0. */
223static void __devinit 222static void pci_bridge_check_ranges(struct pci_bus *bus)
224pci_bridge_check_ranges(struct pci_bus *bus)
225{ 223{
226 u16 io; 224 u16 io;
227 u32 pmem; 225 u32 pmem;
@@ -259,8 +257,7 @@ pci_bridge_check_ranges(struct pci_bus *bus)
259 bus resource of a given type. Note: we intentionally skip 257 bus resource of a given type. Note: we intentionally skip
260 the bus resources which have already been assigned (that is, 258 the bus resources which have already been assigned (that is,
261 have non-NULL parent resource). */ 259 have non-NULL parent resource). */
262static struct resource * __devinit 260static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned long type)
263find_free_bus_resource(struct pci_bus *bus, unsigned long type)
264{ 261{
265 int i; 262 int i;
266 struct resource *r; 263 struct resource *r;
@@ -281,8 +278,7 @@ find_free_bus_resource(struct pci_bus *bus, unsigned long type)
281 since these windows have 4K granularity and the IO ranges 278 since these windows have 4K granularity and the IO ranges
282 of non-bridge PCI devices are limited to 256 bytes. 279 of non-bridge PCI devices are limited to 256 bytes.
283 We must be careful with the ISA aliasing though. */ 280 We must be careful with the ISA aliasing though. */
284static void __devinit 281static void pbus_size_io(struct pci_bus *bus)
285pbus_size_io(struct pci_bus *bus)
286{ 282{
287 struct pci_dev *dev; 283 struct pci_dev *dev;
288 struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); 284 struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO);
@@ -326,8 +322,7 @@ pbus_size_io(struct pci_bus *bus)
326 322
327/* Calculate the size of the bus and minimal alignment which 323/* Calculate the size of the bus and minimal alignment which
328 guarantees that all child resources fit in this size. */ 324 guarantees that all child resources fit in this size. */
329static int __devinit 325static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
330pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
331{ 326{
332 struct pci_dev *dev; 327 struct pci_dev *dev;
333 unsigned long min_align, align, size; 328 unsigned long min_align, align, size;
@@ -447,8 +442,7 @@ pci_bus_size_cardbus(struct pci_bus *bus)
447 } 442 }
448} 443}
449 444
450void __devinit 445void pci_bus_size_bridges(struct pci_bus *bus)
451pci_bus_size_bridges(struct pci_bus *bus)
452{ 446{
453 struct pci_dev *dev; 447 struct pci_dev *dev;
454 unsigned long mask, prefmask; 448 unsigned long mask, prefmask;
@@ -498,8 +492,7 @@ pci_bus_size_bridges(struct pci_bus *bus)
498} 492}
499EXPORT_SYMBOL(pci_bus_size_bridges); 493EXPORT_SYMBOL(pci_bus_size_bridges);
500 494
501void __devinit 495void pci_bus_assign_resources(struct pci_bus *bus)
502pci_bus_assign_resources(struct pci_bus *bus)
503{ 496{
504 struct pci_bus *b; 497 struct pci_bus *b;
505 struct pci_dev *dev; 498 struct pci_dev *dev;
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index cb4ced3560e9..6dfd86167e39 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -101,8 +101,7 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
101 new & ~PCI_REGION_FLAG_MASK); 101 new & ~PCI_REGION_FLAG_MASK);
102} 102}
103 103
104int __devinit 104int pci_claim_resource(struct pci_dev *dev, int resource)
105pci_claim_resource(struct pci_dev *dev, int resource)
106{ 105{
107 struct resource *res = &dev->resource[resource]; 106 struct resource *res = &dev->resource[resource];
108 struct resource *root = NULL; 107 struct resource *root = NULL;
@@ -212,8 +211,7 @@ EXPORT_SYMBOL_GPL(pci_assign_resource_fixed);
212#endif 211#endif
213 212
214/* Sort resources by alignment */ 213/* Sort resources by alignment */
215void __devinit 214void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
216pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
217{ 215{
218 int i; 216 int i;
219 217
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 99baabc23599..948efc775a78 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -360,7 +360,6 @@ static struct platform_driver at91_cf_driver = {
360 .name = (char *) driver_name, 360 .name = (char *) driver_name,
361 .owner = THIS_MODULE, 361 .owner = THIS_MODULE,
362 }, 362 },
363 .probe = at91_cf_probe,
364 .remove = __exit_p(at91_cf_remove), 363 .remove = __exit_p(at91_cf_remove),
365 .suspend = at91_cf_suspend, 364 .suspend = at91_cf_suspend,
366 .resume = at91_cf_resume, 365 .resume = at91_cf_resume,
@@ -370,7 +369,7 @@ static struct platform_driver at91_cf_driver = {
370 369
371static int __init at91_cf_init(void) 370static int __init at91_cf_init(void)
372{ 371{
373 return platform_driver_register(&at91_cf_driver); 372 return platform_driver_probe(&at91_cf_driver, at91_cf_probe);
374} 373}
375module_init(at91_cf_init); 374module_init(at91_cf_init);
376 375
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index ac004248324a..50cad3a59a6c 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -26,7 +26,6 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/pm.h> 28#include <linux/pm.h>
29#include <linux/pci.h>
30#include <linux/device.h> 29#include <linux/device.h>
31#include <linux/kthread.h> 30#include <linux/kthread.h>
32#include <linux/freezer.h> 31#include <linux/freezer.h>
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 18e111e12339..143c6efc478a 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -234,6 +234,89 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
234/*======================================================================*/ 234/*======================================================================*/
235 235
236 236
237struct pcmcia_dynid {
238 struct list_head node;
239 struct pcmcia_device_id id;
240};
241
242/**
243 * pcmcia_store_new_id - add a new PCMCIA device ID to this driver and re-probe devices
244 * @driver: target device driver
245 * @buf: buffer for scanning device ID data
246 * @count: input size
247 *
248 * Adds a new dynamic PCMCIA device ID to this driver,
249 * and causes the driver to probe for all devices again.
250 */
251static ssize_t
252pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
253{
254 struct pcmcia_dynid *dynid;
255 struct pcmcia_driver *pdrv = to_pcmcia_drv(driver);
256 __u16 match_flags, manf_id, card_id;
257 __u8 func_id, function, device_no;
258 __u32 prod_id_hash[4] = {0, 0, 0, 0};
259 int fields=0;
260 int retval = 0;
261
262 fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x",
263 &match_flags, &manf_id, &card_id, &func_id, &function, &device_no,
264 &prod_id_hash[0], &prod_id_hash[1], &prod_id_hash[2], &prod_id_hash[3]);
265 if (fields < 6)
266 return -EINVAL;
267
268 dynid = kzalloc(sizeof(struct pcmcia_dynid), GFP_KERNEL);
269 if (!dynid)
270 return -ENOMEM;
271
272 INIT_LIST_HEAD(&dynid->node);
273 dynid->id.match_flags = match_flags;
274 dynid->id.manf_id = manf_id;
275 dynid->id.card_id = card_id;
276 dynid->id.func_id = func_id;
277 dynid->id.function = function;
278 dynid->id.device_no = device_no;
279 memcpy(dynid->id.prod_id_hash, prod_id_hash, sizeof(__u32) * 4);
280
281 spin_lock(&pdrv->dynids.lock);
282 list_add_tail(&pdrv->dynids.list, &dynid->node);
283 spin_unlock(&pdrv->dynids.lock);
284
285 if (get_driver(&pdrv->drv)) {
286 retval = driver_attach(&pdrv->drv);
287 put_driver(&pdrv->drv);
288 }
289
290 if (retval)
291 return retval;
292 return count;
293}
294static DRIVER_ATTR(new_id, S_IWUSR, NULL, pcmcia_store_new_id);
295
296static void
297pcmcia_free_dynids(struct pcmcia_driver *drv)
298{
299 struct pcmcia_dynid *dynid, *n;
300
301 spin_lock(&drv->dynids.lock);
302 list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) {
303 list_del(&dynid->node);
304 kfree(dynid);
305 }
306 spin_unlock(&drv->dynids.lock);
307}
308
309static int
310pcmcia_create_newid_file(struct pcmcia_driver *drv)
311{
312 int error = 0;
313 if (drv->probe != NULL)
314 error = sysfs_create_file(&drv->drv.kobj,
315 &driver_attr_new_id.attr);
316 return error;
317}
318
319
237/** 320/**
238 * pcmcia_register_driver - register a PCMCIA driver with the bus core 321 * pcmcia_register_driver - register a PCMCIA driver with the bus core
239 * 322 *
@@ -241,6 +324,8 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
241 */ 324 */
242int pcmcia_register_driver(struct pcmcia_driver *driver) 325int pcmcia_register_driver(struct pcmcia_driver *driver)
243{ 326{
327 int error;
328
244 if (!driver) 329 if (!driver)
245 return -EINVAL; 330 return -EINVAL;
246 331
@@ -249,10 +334,20 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
249 /* initialize common fields */ 334 /* initialize common fields */
250 driver->drv.bus = &pcmcia_bus_type; 335 driver->drv.bus = &pcmcia_bus_type;
251 driver->drv.owner = driver->owner; 336 driver->drv.owner = driver->owner;
337 spin_lock_init(&driver->dynids.lock);
338 INIT_LIST_HEAD(&driver->dynids.list);
252 339
253 ds_dbg(3, "registering driver %s\n", driver->drv.name); 340 ds_dbg(3, "registering driver %s\n", driver->drv.name);
254 341
255 return driver_register(&driver->drv); 342 error = driver_register(&driver->drv);
343 if (error < 0)
344 return error;
345
346 error = pcmcia_create_newid_file(driver);
347 if (error)
348 driver_unregister(&driver->drv);
349
350 return error;
256} 351}
257EXPORT_SYMBOL(pcmcia_register_driver); 352EXPORT_SYMBOL(pcmcia_register_driver);
258 353
@@ -263,6 +358,7 @@ void pcmcia_unregister_driver(struct pcmcia_driver *driver)
263{ 358{
264 ds_dbg(3, "unregistering driver %s\n", driver->drv.name); 359 ds_dbg(3, "unregistering driver %s\n", driver->drv.name);
265 driver_unregister(&driver->drv); 360 driver_unregister(&driver->drv);
361 pcmcia_free_dynids(driver);
266} 362}
267EXPORT_SYMBOL(pcmcia_unregister_driver); 363EXPORT_SYMBOL(pcmcia_unregister_driver);
268 364
@@ -927,6 +1023,21 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
927 struct pcmcia_device * p_dev = to_pcmcia_dev(dev); 1023 struct pcmcia_device * p_dev = to_pcmcia_dev(dev);
928 struct pcmcia_driver * p_drv = to_pcmcia_drv(drv); 1024 struct pcmcia_driver * p_drv = to_pcmcia_drv(drv);
929 struct pcmcia_device_id *did = p_drv->id_table; 1025 struct pcmcia_device_id *did = p_drv->id_table;
1026 struct pcmcia_dynid *dynid;
1027
1028 /* match dynamic devices first */
1029 spin_lock(&p_drv->dynids.lock);
1030 list_for_each_entry(dynid, &p_drv->dynids.list, node) {
1031 ds_dbg(3, "trying to match %s to %s\n", dev->bus_id,
1032 drv->name);
1033 if (pcmcia_devmatch(p_dev, &dynid->id)) {
1034 ds_dbg(0, "matched %s to %s\n", dev->bus_id,
1035 drv->name);
1036 spin_unlock(&p_drv->dynids.lock);
1037 return 1;
1038 }
1039 }
1040 spin_unlock(&p_drv->dynids.lock);
930 1041
931#ifdef CONFIG_PCMCIA_IOCTL 1042#ifdef CONFIG_PCMCIA_IOCTL
932 /* matching by cardmgr */ 1043 /* matching by cardmgr */
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index ea5765c3bdc0..a2bb46526b56 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -22,7 +22,6 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/pci.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/mutex.h> 26#include <linux/mutex.h>
28#include <asm/system.h> 27#include <asm/system.h>
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index d21e04ccb021..1393e64335f9 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -38,7 +38,24 @@
38static int timeout = 5000; /* in msec ( 5 sec ) */ 38static int timeout = 5000; /* in msec ( 5 sec ) */
39module_param(timeout, int, 0644); 39module_param(timeout, int, 0644);
40 40
41static struct ps3av ps3av; 41static struct ps3av {
42 int available;
43 struct mutex mutex;
44 struct work_struct work;
45 struct completion done;
46 struct workqueue_struct *wq;
47 int open_count;
48 struct ps3_vuart_port_device *dev;
49
50 int region;
51 struct ps3av_pkt_av_get_hw_conf av_hw_conf;
52 u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX];
53 u32 opt_port[PS3AV_OPT_PORT_MAX];
54 u32 head[PS3AV_HEAD_MAX];
55 u32 audio_port;
56 int ps3av_mode;
57 int ps3av_mode_old;
58} ps3av;
42 59
43static struct ps3_vuart_port_device ps3av_dev = { 60static struct ps3_vuart_port_device ps3av_dev = {
44 .match_id = PS3_MATCH_ID_AV_SETTINGS 61 .match_id = PS3_MATCH_ID_AV_SETTINGS
@@ -159,7 +176,7 @@ static int ps3av_parse_event_packet(const struct ps3av_reply_hdr *hdr)
159 else 176 else
160 printk(KERN_ERR 177 printk(KERN_ERR
161 "%s: failed event packet, cid:%08x size:%d\n", 178 "%s: failed event packet, cid:%08x size:%d\n",
162 __FUNCTION__, hdr->cid, hdr->size); 179 __func__, hdr->cid, hdr->size);
163 return 1; /* receive event packet */ 180 return 1; /* receive event packet */
164 } 181 }
165 return 0; 182 return 0;
@@ -181,7 +198,7 @@ static int ps3av_send_cmd_pkt(const struct ps3av_send_hdr *send_buf,
181 if (res < 0) { 198 if (res < 0) {
182 dev_dbg(&ps3av_dev.core, 199 dev_dbg(&ps3av_dev.core,
183 "%s: ps3av_vuart_write() failed (result=%d)\n", 200 "%s: ps3av_vuart_write() failed (result=%d)\n",
184 __FUNCTION__, res); 201 __func__, res);
185 return res; 202 return res;
186 } 203 }
187 204
@@ -194,7 +211,7 @@ static int ps3av_send_cmd_pkt(const struct ps3av_send_hdr *send_buf,
194 if (res != PS3AV_HDR_SIZE) { 211 if (res != PS3AV_HDR_SIZE) {
195 dev_dbg(&ps3av_dev.core, 212 dev_dbg(&ps3av_dev.core,
196 "%s: ps3av_vuart_read() failed (result=%d)\n", 213 "%s: ps3av_vuart_read() failed (result=%d)\n",
197 __FUNCTION__, res); 214 __func__, res);
198 return res; 215 return res;
199 } 216 }
200 217
@@ -204,7 +221,7 @@ static int ps3av_send_cmd_pkt(const struct ps3av_send_hdr *send_buf,
204 if (res < 0) { 221 if (res < 0) {
205 dev_dbg(&ps3av_dev.core, 222 dev_dbg(&ps3av_dev.core,
206 "%s: ps3av_vuart_read() failed (result=%d)\n", 223 "%s: ps3av_vuart_read() failed (result=%d)\n",
207 __FUNCTION__, res); 224 __func__, res);
208 return res; 225 return res;
209 } 226 }
210 res += PS3AV_HDR_SIZE; /* total len */ 227 res += PS3AV_HDR_SIZE; /* total len */
@@ -214,7 +231,7 @@ static int ps3av_send_cmd_pkt(const struct ps3av_send_hdr *send_buf,
214 231
215 if ((cmd | PS3AV_REPLY_BIT) != recv_buf->cid) { 232 if ((cmd | PS3AV_REPLY_BIT) != recv_buf->cid) {
216 dev_dbg(&ps3av_dev.core, "%s: reply err (result=%x)\n", 233 dev_dbg(&ps3av_dev.core, "%s: reply err (result=%x)\n",
217 __FUNCTION__, recv_buf->cid); 234 __func__, recv_buf->cid);
218 return -EINVAL; 235 return -EINVAL;
219 } 236 }
220 237
@@ -250,7 +267,7 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
250 struct ps3av_send_hdr *buf) 267 struct ps3av_send_hdr *buf)
251{ 268{
252 int res = 0; 269 int res = 0;
253 union { 270 static union {
254 struct ps3av_reply_hdr reply_hdr; 271 struct ps3av_reply_hdr reply_hdr;
255 u8 raw[PS3AV_BUF_SIZE]; 272 u8 raw[PS3AV_BUF_SIZE];
256 } recv_buf; 273 } recv_buf;
@@ -259,8 +276,7 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
259 276
260 BUG_ON(!ps3av.available); 277 BUG_ON(!ps3av.available);
261 278
262 if (down_interruptible(&ps3av.sem)) 279 mutex_lock(&ps3av.mutex);
263 return -ERESTARTSYS;
264 280
265 table = ps3av_search_cmd_table(cid, PS3AV_CID_MASK); 281 table = ps3av_search_cmd_table(cid, PS3AV_CID_MASK);
266 BUG_ON(!table); 282 BUG_ON(!table);
@@ -277,7 +293,7 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
277 if (res < 0) { 293 if (res < 0) {
278 printk(KERN_ERR 294 printk(KERN_ERR
279 "%s: ps3av_send_cmd_pkt() failed (result=%d)\n", 295 "%s: ps3av_send_cmd_pkt() failed (result=%d)\n",
280 __FUNCTION__, res); 296 __func__, res);
281 goto err; 297 goto err;
282 } 298 }
283 299
@@ -286,16 +302,16 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
286 usr_buf_size); 302 usr_buf_size);
287 if (res < 0) { 303 if (res < 0) {
288 printk(KERN_ERR "%s: put_return_status() failed (result=%d)\n", 304 printk(KERN_ERR "%s: put_return_status() failed (result=%d)\n",
289 __FUNCTION__, res); 305 __func__, res);
290 goto err; 306 goto err;
291 } 307 }
292 308
293 up(&ps3av.sem); 309 mutex_unlock(&ps3av.mutex);
294 return 0; 310 return 0;
295 311
296 err: 312 err:
297 up(&ps3av.sem); 313 mutex_unlock(&ps3av.mutex);
298 printk(KERN_ERR "%s: failed cid:%x res:%d\n", __FUNCTION__, cid, res); 314 printk(KERN_ERR "%s: failed cid:%x res:%d\n", __func__, cid, res);
299 return res; 315 return res;
300} 316}
301 317
@@ -440,7 +456,7 @@ static int ps3av_set_videomode(void)
440 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_ON); 456 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_ON);
441 457
442 /* wake up ps3avd to do the actual video mode setting */ 458 /* wake up ps3avd to do the actual video mode setting */
443 up(&ps3av.ping); 459 queue_work(ps3av.wq, &ps3av.work);
444 460
445 return 0; 461 return 0;
446} 462}
@@ -506,7 +522,7 @@ static void ps3av_set_videomode_cont(u32 id, u32 old_id)
506 if (res == PS3AV_STATUS_NO_SYNC_HEAD) 522 if (res == PS3AV_STATUS_NO_SYNC_HEAD)
507 printk(KERN_WARNING 523 printk(KERN_WARNING
508 "%s: Command failed. Please try your request again. \n", 524 "%s: Command failed. Please try your request again. \n",
509 __FUNCTION__); 525 __func__);
510 else if (res) 526 else if (res)
511 dev_dbg(&ps3av_dev.core, "ps3av_cmd_avb_param failed\n"); 527 dev_dbg(&ps3av_dev.core, "ps3av_cmd_avb_param failed\n");
512 528
@@ -515,18 +531,10 @@ static void ps3av_set_videomode_cont(u32 id, u32 old_id)
515 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF); 531 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF);
516} 532}
517 533
518static int ps3avd(void *p) 534static void ps3avd(struct work_struct *work)
519{ 535{
520 struct ps3av *info = p; 536 ps3av_set_videomode_cont(ps3av.ps3av_mode, ps3av.ps3av_mode_old);
521 537 complete(&ps3av.done);
522 daemonize("ps3avd");
523 while (1) {
524 down(&info->ping);
525 ps3av_set_videomode_cont(info->ps3av_mode,
526 info->ps3av_mode_old);
527 up(&info->pong);
528 }
529 return 0;
530} 538}
531 539
532static int ps3av_vid2table_id(int vid) 540static int ps3av_vid2table_id(int vid)
@@ -707,8 +715,7 @@ int ps3av_set_video_mode(u32 id, int boot)
707 715
708 size = ARRAY_SIZE(video_mode_table); 716 size = ARRAY_SIZE(video_mode_table);
709 if ((id & PS3AV_MODE_MASK) > size - 1 || id < 0) { 717 if ((id & PS3AV_MODE_MASK) > size - 1 || id < 0) {
710 dev_dbg(&ps3av_dev.core, "%s: error id :%d\n", __FUNCTION__, 718 dev_dbg(&ps3av_dev.core, "%s: error id :%d\n", __func__, id);
711 id);
712 return -EINVAL; 719 return -EINVAL;
713 } 720 }
714 721
@@ -717,15 +724,14 @@ int ps3av_set_video_mode(u32 id, int boot)
717 if ((id & PS3AV_MODE_MASK) == 0) { 724 if ((id & PS3AV_MODE_MASK) == 0) {
718 id = ps3av_auto_videomode(&ps3av.av_hw_conf, boot); 725 id = ps3av_auto_videomode(&ps3av.av_hw_conf, boot);
719 if (id < 1) { 726 if (id < 1) {
720 printk(KERN_ERR "%s: invalid id :%d\n", __FUNCTION__, 727 printk(KERN_ERR "%s: invalid id :%d\n", __func__, id);
721 id);
722 return -EINVAL; 728 return -EINVAL;
723 } 729 }
724 id |= option; 730 id |= option;
725 } 731 }
726 732
727 /* set videomode */ 733 /* set videomode */
728 down(&ps3av.pong); 734 wait_for_completion(&ps3av.done);
729 ps3av.ps3av_mode_old = ps3av.ps3av_mode; 735 ps3av.ps3av_mode_old = ps3av.ps3av_mode;
730 ps3av.ps3av_mode = id; 736 ps3av.ps3av_mode = id;
731 if (ps3av_set_videomode()) 737 if (ps3av_set_videomode())
@@ -736,6 +742,13 @@ int ps3av_set_video_mode(u32 id, int boot)
736 742
737EXPORT_SYMBOL_GPL(ps3av_set_video_mode); 743EXPORT_SYMBOL_GPL(ps3av_set_video_mode);
738 744
745int ps3av_get_auto_mode(int boot)
746{
747 return ps3av_auto_videomode(&ps3av.av_hw_conf, boot);
748}
749
750EXPORT_SYMBOL_GPL(ps3av_get_auto_mode);
751
739int ps3av_set_mode(u32 id, int boot) 752int ps3av_set_mode(u32 id, int boot)
740{ 753{
741 int res; 754 int res;
@@ -771,7 +784,7 @@ int ps3av_get_scanmode(int id)
771 id = id & PS3AV_MODE_MASK; 784 id = id & PS3AV_MODE_MASK;
772 size = ARRAY_SIZE(video_mode_table); 785 size = ARRAY_SIZE(video_mode_table);
773 if (id > size - 1 || id < 0) { 786 if (id > size - 1 || id < 0) {
774 printk(KERN_ERR "%s: invalid mode %d\n", __FUNCTION__, id); 787 printk(KERN_ERR "%s: invalid mode %d\n", __func__, id);
775 return -EINVAL; 788 return -EINVAL;
776 } 789 }
777 return video_mode_table[id].interlace; 790 return video_mode_table[id].interlace;
@@ -786,7 +799,7 @@ int ps3av_get_refresh_rate(int id)
786 id = id & PS3AV_MODE_MASK; 799 id = id & PS3AV_MODE_MASK;
787 size = ARRAY_SIZE(video_mode_table); 800 size = ARRAY_SIZE(video_mode_table);
788 if (id > size - 1 || id < 0) { 801 if (id > size - 1 || id < 0) {
789 printk(KERN_ERR "%s: invalid mode %d\n", __FUNCTION__, id); 802 printk(KERN_ERR "%s: invalid mode %d\n", __func__, id);
790 return -EINVAL; 803 return -EINVAL;
791 } 804 }
792 return video_mode_table[id].freq; 805 return video_mode_table[id].freq;
@@ -802,7 +815,7 @@ int ps3av_video_mode2res(u32 id, u32 *xres, u32 *yres)
802 id = id & PS3AV_MODE_MASK; 815 id = id & PS3AV_MODE_MASK;
803 size = ARRAY_SIZE(video_mode_table); 816 size = ARRAY_SIZE(video_mode_table);
804 if (id > size - 1 || id < 0) { 817 if (id > size - 1 || id < 0) {
805 printk(KERN_ERR "%s: invalid mode %d\n", __FUNCTION__, id); 818 printk(KERN_ERR "%s: invalid mode %d\n", __func__, id);
806 return -EINVAL; 819 return -EINVAL;
807 } 820 }
808 *xres = video_mode_table[id].x; 821 *xres = video_mode_table[id].x;
@@ -838,7 +851,7 @@ int ps3av_dev_open(void)
838 status = lv1_gpu_open(0); 851 status = lv1_gpu_open(0);
839 if (status) { 852 if (status) {
840 printk(KERN_ERR "%s: lv1_gpu_open failed %d\n", 853 printk(KERN_ERR "%s: lv1_gpu_open failed %d\n",
841 __FUNCTION__, status); 854 __func__, status);
842 ps3av.open_count--; 855 ps3av.open_count--;
843 } 856 }
844 } 857 }
@@ -855,13 +868,13 @@ int ps3av_dev_close(void)
855 868
856 mutex_lock(&ps3av.mutex); 869 mutex_lock(&ps3av.mutex);
857 if (ps3av.open_count <= 0) { 870 if (ps3av.open_count <= 0) {
858 printk(KERN_ERR "%s: GPU already closed\n", __FUNCTION__); 871 printk(KERN_ERR "%s: GPU already closed\n", __func__);
859 status = -1; 872 status = -1;
860 } else if (!--ps3av.open_count) { 873 } else if (!--ps3av.open_count) {
861 status = lv1_gpu_close(); 874 status = lv1_gpu_close();
862 if (status) 875 if (status)
863 printk(KERN_WARNING "%s: lv1_gpu_close failed %d\n", 876 printk(KERN_WARNING "%s: lv1_gpu_close failed %d\n",
864 __FUNCTION__, status); 877 __func__, status);
865 } 878 }
866 mutex_unlock(&ps3av.mutex); 879 mutex_unlock(&ps3av.mutex);
867 880
@@ -880,13 +893,16 @@ static int ps3av_probe(struct ps3_vuart_port_device *dev)
880 893
881 memset(&ps3av, 0, sizeof(ps3av)); 894 memset(&ps3av, 0, sizeof(ps3av));
882 895
883 init_MUTEX(&ps3av.sem);
884 init_MUTEX_LOCKED(&ps3av.ping);
885 init_MUTEX(&ps3av.pong);
886 mutex_init(&ps3av.mutex); 896 mutex_init(&ps3av.mutex);
887 ps3av.ps3av_mode = 0; 897 ps3av.ps3av_mode = 0;
888 ps3av.dev = dev; 898 ps3av.dev = dev;
889 kernel_thread(ps3avd, &ps3av, CLONE_KERNEL); 899
900 INIT_WORK(&ps3av.work, ps3avd);
901 init_completion(&ps3av.done);
902 complete(&ps3av.done);
903 ps3av.wq = create_singlethread_workqueue("ps3avd");
904 if (!ps3av.wq)
905 return -ENOMEM;
890 906
891 ps3av.available = 1; 907 ps3av.available = 1;
892 switch (ps3_os_area_get_av_multi_out()) { 908 switch (ps3_os_area_get_av_multi_out()) {
@@ -908,7 +924,7 @@ static int ps3av_probe(struct ps3_vuart_port_device *dev)
908 /* init avsetting modules */ 924 /* init avsetting modules */
909 res = ps3av_cmd_init(); 925 res = ps3av_cmd_init();
910 if (res < 0) 926 if (res < 0)
911 printk(KERN_ERR "%s: ps3av_cmd_init failed %d\n", __FUNCTION__, 927 printk(KERN_ERR "%s: ps3av_cmd_init failed %d\n", __func__,
912 res); 928 res);
913 929
914 ps3av_get_hw_conf(&ps3av); 930 ps3av_get_hw_conf(&ps3av);
@@ -926,6 +942,8 @@ static int ps3av_remove(struct ps3_vuart_port_device *dev)
926{ 942{
927 if (ps3av.available) { 943 if (ps3av.available) {
928 ps3av_cmd_fin(); 944 ps3av_cmd_fin();
945 if (ps3av.wq)
946 destroy_workqueue(ps3av.wq);
929 ps3av.available = 0; 947 ps3av.available = 0;
930 } 948 }
931 949
@@ -958,7 +976,7 @@ static int ps3av_module_init(void)
958 if (error) { 976 if (error) {
959 printk(KERN_ERR 977 printk(KERN_ERR
960 "%s: ps3_vuart_port_driver_register failed %d\n", 978 "%s: ps3_vuart_port_driver_register failed %d\n",
961 __FUNCTION__, error); 979 __func__, error);
962 return error; 980 return error;
963 } 981 }
964 982
@@ -966,7 +984,7 @@ static int ps3av_module_init(void)
966 if (error) 984 if (error)
967 printk(KERN_ERR 985 printk(KERN_ERR
968 "%s: ps3_vuart_port_device_register failed %d\n", 986 "%s: ps3_vuart_port_device_register failed %d\n",
969 __FUNCTION__, error); 987 __func__, error);
970 988
971 return error; 989 return error;
972} 990}
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c
index bc70e81f8cb0..0145ea173c42 100644
--- a/drivers/ps3/ps3av_cmd.c
+++ b/drivers/ps3/ps3av_cmd.c
@@ -395,7 +395,7 @@ u32 ps3av_cmd_set_video_mode(void *p, u32 head, int video_vid, int video_fmt,
395 video_mode->video_order = ps3av_video_fmt_table[video_fmt].order; 395 video_mode->video_order = ps3av_video_fmt_table[video_fmt].order;
396 396
397 pr_debug("%s: video_mode:vid:%x width:%d height:%d pitch:%d out_format:%d format:%x order:%x\n", 397 pr_debug("%s: video_mode:vid:%x width:%d height:%d pitch:%d out_format:%d format:%x order:%x\n",
398 __FUNCTION__, video_vid, video_mode->width, video_mode->height, 398 __func__, video_vid, video_mode->width, video_mode->height,
399 video_mode->pitch, video_mode->video_out_format, 399 video_mode->pitch, video_mode->video_out_format,
400 video_mode->video_format, video_mode->video_order); 400 video_mode->video_format, video_mode->video_order);
401 return sizeof(*video_mode); 401 return sizeof(*video_mode);
@@ -477,7 +477,7 @@ static u8 ps3av_cnv_mclk(u32 fs)
477 if (ps3av_cnv_mclk_table[i].fs == fs) 477 if (ps3av_cnv_mclk_table[i].fs == fs)
478 return ps3av_cnv_mclk_table[i].mclk; 478 return ps3av_cnv_mclk_table[i].mclk;
479 479
480 printk(KERN_ERR "%s failed, fs:%x\n", __FUNCTION__, fs); 480 printk(KERN_ERR "%s failed, fs:%x\n", __func__, fs);
481 return 0; 481 return 0;
482} 482}
483 483
@@ -526,13 +526,12 @@ static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid)
526 d = 4; 526 d = 4;
527 break; 527 break;
528 default: 528 default:
529 printk(KERN_ERR "%s failed, vid:%x\n", __FUNCTION__, 529 printk(KERN_ERR "%s failed, vid:%x\n", __func__, video_vid);
530 video_vid);
531 break; 530 break;
532 } 531 }
533 532
534 if (fs < PS3AV_CMD_AUDIO_FS_44K || fs > PS3AV_CMD_AUDIO_FS_192K) 533 if (fs < PS3AV_CMD_AUDIO_FS_44K || fs > PS3AV_CMD_AUDIO_FS_192K)
535 printk(KERN_ERR "%s failed, fs:%x\n", __FUNCTION__, fs); 534 printk(KERN_ERR "%s failed, fs:%x\n", __func__, fs);
536 else 535 else
537 ns_val = ps3av_ns_table[PS3AV_CMD_AUDIO_FS_44K-BASE][d]; 536 ns_val = ps3av_ns_table[PS3AV_CMD_AUDIO_FS_44K-BASE][d];
538 537
@@ -555,8 +554,7 @@ static u8 ps3av_cnv_enable(u32 source, const u8 *enable)
555 ret = ((p[0] << 4) + (p[1] << 5) + (p[2] << 6) + (p[3] << 7)) | 554 ret = ((p[0] << 4) + (p[1] << 5) + (p[2] << 6) + (p[3] << 7)) |
556 0x01; 555 0x01;
557 } else 556 } else
558 printk(KERN_ERR "%s failed, source:%x\n", __FUNCTION__, 557 printk(KERN_ERR "%s failed, source:%x\n", __func__, source);
559 source);
560 return ret; 558 return ret;
561} 559}
562 560
@@ -585,7 +583,7 @@ static u8 ps3av_cnv_inputlen(u32 word_bits)
585 ret = PS3AV_CMD_AV_INPUTLEN_24; 583 ret = PS3AV_CMD_AV_INPUTLEN_24;
586 break; 584 break;
587 default: 585 default:
588 printk(KERN_ERR "%s failed, word_bits:%x\n", __FUNCTION__, 586 printk(KERN_ERR "%s failed, word_bits:%x\n", __func__,
589 word_bits); 587 word_bits);
590 break; 588 break;
591 } 589 }
@@ -595,7 +593,7 @@ static u8 ps3av_cnv_inputlen(u32 word_bits)
595static u8 ps3av_cnv_layout(u32 num_of_ch) 593static u8 ps3av_cnv_layout(u32 num_of_ch)
596{ 594{
597 if (num_of_ch > PS3AV_CMD_AUDIO_NUM_OF_CH_8) { 595 if (num_of_ch > PS3AV_CMD_AUDIO_NUM_OF_CH_8) {
598 printk(KERN_ERR "%s failed, num_of_ch:%x\n", __FUNCTION__, 596 printk(KERN_ERR "%s failed, num_of_ch:%x\n", __func__,
599 num_of_ch); 597 num_of_ch);
600 return 0; 598 return 0;
601 } 599 }
@@ -864,7 +862,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
864 862
865 res = get_status(avb); 863 res = get_status(avb);
866 if (res) 864 if (res)
867 pr_debug("%s: PS3AV_CID_AVB_PARAM: failed %x\n", __FUNCTION__, 865 pr_debug("%s: PS3AV_CID_AVB_PARAM: failed %x\n", __func__,
868 res); 866 res);
869 867
870 out: 868 out:
@@ -1013,7 +1011,7 @@ int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
1013 return size; 1011 return size;
1014 if (error != -EAGAIN) { 1012 if (error != -EAGAIN) {
1015 printk(KERN_ERR "%s: ps3_vuart_read failed %d\n", 1013 printk(KERN_ERR "%s: ps3_vuart_read failed %d\n",
1016 __FUNCTION__, error); 1014 __func__, error);
1017 return error; 1015 return error;
1018 } 1016 }
1019 msleep(POLLING_INTERVAL); 1017 msleep(POLLING_INTERVAL);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 95826b92ca4b..ef1eae98ba44 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -354,4 +354,14 @@ config RTC_DRV_V3020
354 This driver can also be built as a module. If so, the module 354 This driver can also be built as a module. If so, the module
355 will be called rtc-v3020. 355 will be called rtc-v3020.
356 356
357config RTC_DRV_BFIN
358 tristate "Blackfin On-Chip RTC"
359 depends on RTC_CLASS && BFIN
360 help
361 If you say yes here you will get support for the
362 Blackfin On-Chip Real Time Clock.
363
364 This driver can also be built as a module. If so, the module
365 will be called rtc-bfin.
366
357endmenu 367endmenu
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 92bfe1b3a5fa..9218cf28d6ed 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -38,3 +38,4 @@ obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o
38obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o 38obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
39obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o 39obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
40obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o 40obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
41obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
new file mode 100644
index 000000000000..260ead959918
--- /dev/null
+++ b/drivers/rtc/rtc-bfin.c
@@ -0,0 +1,445 @@
1/*
2 * Blackfin On-Chip Real Time Clock Driver
3 * Supports BF531/BF532/BF533/BF534/BF536/BF537
4 *
5 * Copyright 2004-2007 Analog Devices Inc.
6 *
7 * Enter bugs at http://blackfin.uclinux.org/
8 *
9 * Licensed under the GPL-2 or later.
10 */
11
12/* The biggest issue we deal with in this driver is that register writes are
13 * synced to the RTC frequency of 1Hz. So if you write to a register and
14 * attempt to write again before the first write has completed, the new write
15 * is simply discarded. This can easily be troublesome if userspace disables
16 * one event (say periodic) and then right after enables an event (say alarm).
17 * Since all events are maintained in the same interrupt mask register, if
18 * we wrote to it to disable the first event and then wrote to it again to
19 * enable the second event, that second event would not be enabled as the
20 * write would be discarded and things quickly fall apart.
21 *
22 * To keep this delay from significantly degrading performance (we, in theory,
23 * would have to sleep for up to 1 second everytime we wanted to write a
24 * register), we only check the write pending status before we start to issue
25 * a new write. We bank on the idea that it doesnt matter when the sync
26 * happens so long as we don't attempt another write before it does. The only
27 * time userspace would take this penalty is when they try and do multiple
28 * operations right after another ... but in this case, they need to take the
29 * sync penalty, so we should be OK.
30 *
31 * Also note that the RTC_ISTAT register does not suffer this penalty; its
32 * writes to clear status registers complete immediately.
33 */
34
35#include <linux/module.h>
36#include <linux/kernel.h>
37#include <linux/bcd.h>
38#include <linux/rtc.h>
39#include <linux/init.h>
40#include <linux/platform_device.h>
41#include <linux/seq_file.h>
42#include <linux/interrupt.h>
43#include <linux/spinlock.h>
44#include <linux/delay.h>
45
46#include <asm/blackfin.h>
47
48#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __FUNCTION__, __LINE__, ## args)
49#define stampit() stamp("here i am")
50
51struct bfin_rtc {
52 struct rtc_device *rtc_dev;
53 struct rtc_time rtc_alarm;
54 spinlock_t lock;
55};
56
57/* Bit values for the ISTAT / ICTL registers */
58#define RTC_ISTAT_WRITE_COMPLETE 0x8000
59#define RTC_ISTAT_WRITE_PENDING 0x4000
60#define RTC_ISTAT_ALARM_DAY 0x0040
61#define RTC_ISTAT_24HR 0x0020
62#define RTC_ISTAT_HOUR 0x0010
63#define RTC_ISTAT_MIN 0x0008
64#define RTC_ISTAT_SEC 0x0004
65#define RTC_ISTAT_ALARM 0x0002
66#define RTC_ISTAT_STOPWATCH 0x0001
67
68/* Shift values for RTC_STAT register */
69#define DAY_BITS_OFF 17
70#define HOUR_BITS_OFF 12
71#define MIN_BITS_OFF 6
72#define SEC_BITS_OFF 0
73
74/* Some helper functions to convert between the common RTC notion of time
75 * and the internal Blackfin notion that is stored in 32bits.
76 */
77static inline u32 rtc_time_to_bfin(unsigned long now)
78{
79 u32 sec = (now % 60);
80 u32 min = (now % (60 * 60)) / 60;
81 u32 hour = (now % (60 * 60 * 24)) / (60 * 60);
82 u32 days = (now / (60 * 60 * 24));
83 return (sec << SEC_BITS_OFF) +
84 (min << MIN_BITS_OFF) +
85 (hour << HOUR_BITS_OFF) +
86 (days << DAY_BITS_OFF);
87}
88static inline unsigned long rtc_bfin_to_time(u32 rtc_bfin)
89{
90 return (((rtc_bfin >> SEC_BITS_OFF) & 0x003F)) +
91 (((rtc_bfin >> MIN_BITS_OFF) & 0x003F) * 60) +
92 (((rtc_bfin >> HOUR_BITS_OFF) & 0x001F) * 60 * 60) +
93 (((rtc_bfin >> DAY_BITS_OFF) & 0x7FFF) * 60 * 60 * 24);
94}
95static inline void rtc_bfin_to_tm(u32 rtc_bfin, struct rtc_time *tm)
96{
97 rtc_time_to_tm(rtc_bfin_to_time(rtc_bfin), tm);
98}
99
100/* Wait for the previous write to a RTC register to complete.
101 * Unfortunately, we can't sleep here as that introduces a race condition when
102 * turning on interrupt events. Consider this:
103 * - process sets alarm
104 * - process enables alarm
105 * - process sleeps while waiting for rtc write to sync
106 * - interrupt fires while process is sleeping
107 * - interrupt acks the event by writing to ISTAT
108 * - interrupt sets the WRITE PENDING bit
109 * - interrupt handler finishes
110 * - process wakes up, sees WRITE PENDING bit set, goes to sleep
111 * - interrupt fires while process is sleeping
112 * If anyone can point out the obvious solution here, i'm listening :). This
113 * shouldn't be an issue on an SMP or preempt system as this function should
114 * only be called with the rtc lock held.
115 */
116static void rtc_bfin_sync_pending(void)
117{
118 stampit();
119 while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_COMPLETE)) {
120 if (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING))
121 break;
122 }
123 bfin_write_RTC_ISTAT(RTC_ISTAT_WRITE_COMPLETE);
124}
125
126static void rtc_bfin_reset(struct bfin_rtc *rtc)
127{
128 /* Initialize the RTC. Enable pre-scaler to scale RTC clock
129 * to 1Hz and clear interrupt/status registers. */
130 spin_lock_irq(&rtc->lock);
131 rtc_bfin_sync_pending();
132 bfin_write_RTC_PREN(0x1);
133 bfin_write_RTC_ICTL(0);
134 bfin_write_RTC_SWCNT(0);
135 bfin_write_RTC_ALARM(0);
136 bfin_write_RTC_ISTAT(0xFFFF);
137 spin_unlock_irq(&rtc->lock);
138}
139
140static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
141{
142 struct platform_device *pdev = to_platform_device(dev_id);
143 struct bfin_rtc *rtc = platform_get_drvdata(pdev);
144 unsigned long events = 0;
145 u16 rtc_istat;
146
147 stampit();
148
149 spin_lock_irq(&rtc->lock);
150
151 rtc_istat = bfin_read_RTC_ISTAT();
152
153 if (rtc_istat & (RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)) {
154 bfin_write_RTC_ISTAT(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY);
155 events |= RTC_AF | RTC_IRQF;
156 }
157
158 if (rtc_istat & RTC_ISTAT_STOPWATCH) {
159 bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
160 events |= RTC_PF | RTC_IRQF;
161 bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
162 }
163
164 if (rtc_istat & RTC_ISTAT_SEC) {
165 bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
166 events |= RTC_UF | RTC_IRQF;
167 }
168
169 rtc_update_irq(rtc->rtc_dev, 1, events);
170
171 spin_unlock_irq(&rtc->lock);
172
173 return IRQ_HANDLED;
174}
175
176static int bfin_rtc_open(struct device *dev)
177{
178 struct bfin_rtc *rtc = dev_get_drvdata(dev);
179 int ret;
180
181 stampit();
182
183 ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_DISABLED, "rtc-bfin", dev);
184 if (unlikely(ret)) {
185 dev_err(dev, "request RTC IRQ failed with %d\n", ret);
186 return ret;
187 }
188
189 rtc_bfin_reset(rtc);
190
191 return ret;
192}
193
194static void bfin_rtc_release(struct device *dev)
195{
196 struct bfin_rtc *rtc = dev_get_drvdata(dev);
197 stampit();
198 rtc_bfin_reset(rtc);
199 free_irq(IRQ_RTC, dev);
200}
201
202static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
203{
204 struct bfin_rtc *rtc = dev_get_drvdata(dev);
205
206 stampit();
207
208 switch (cmd) {
209 case RTC_PIE_ON:
210 stampit();
211 spin_lock_irq(&rtc->lock);
212 rtc_bfin_sync_pending();
213 bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
214 bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
215 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() | RTC_ISTAT_STOPWATCH);
216 spin_unlock_irq(&rtc->lock);
217 return 0;
218 case RTC_PIE_OFF:
219 stampit();
220 spin_lock_irq(&rtc->lock);
221 rtc_bfin_sync_pending();
222 bfin_write_RTC_SWCNT(0);
223 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~RTC_ISTAT_STOPWATCH);
224 spin_unlock_irq(&rtc->lock);
225 return 0;
226
227 case RTC_UIE_ON:
228 stampit();
229 spin_lock_irq(&rtc->lock);
230 rtc_bfin_sync_pending();
231 bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
232 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() | RTC_ISTAT_SEC);
233 spin_unlock_irq(&rtc->lock);
234 return 0;
235 case RTC_UIE_OFF:
236 stampit();
237 spin_lock_irq(&rtc->lock);
238 rtc_bfin_sync_pending();
239 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~RTC_ISTAT_SEC);
240 spin_unlock_irq(&rtc->lock);
241 return 0;
242
243 case RTC_AIE_ON: {
244 unsigned long rtc_alarm;
245 u16 which_alarm;
246 int ret = 0;
247
248 stampit();
249
250 spin_lock_irq(&rtc->lock);
251
252 rtc_bfin_sync_pending();
253 if (rtc->rtc_alarm.tm_yday == -1) {
254 struct rtc_time now;
255 rtc_bfin_to_tm(bfin_read_RTC_STAT(), &now);
256 now.tm_sec = rtc->rtc_alarm.tm_sec;
257 now.tm_min = rtc->rtc_alarm.tm_min;
258 now.tm_hour = rtc->rtc_alarm.tm_hour;
259 ret = rtc_tm_to_time(&now, &rtc_alarm);
260 which_alarm = RTC_ISTAT_ALARM;
261 } else {
262 ret = rtc_tm_to_time(&rtc->rtc_alarm, &rtc_alarm);
263 which_alarm = RTC_ISTAT_ALARM_DAY;
264 }
265 if (ret == 0) {
266 bfin_write_RTC_ISTAT(which_alarm);
267 bfin_write_RTC_ALARM(rtc_time_to_bfin(rtc_alarm));
268 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() | which_alarm);
269 }
270
271 spin_unlock_irq(&rtc->lock);
272
273 return ret;
274 }
275 case RTC_AIE_OFF:
276 stampit();
277 spin_lock_irq(&rtc->lock);
278 rtc_bfin_sync_pending();
279 bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
280 spin_unlock_irq(&rtc->lock);
281 return 0;
282 }
283
284 return -ENOIOCTLCMD;
285}
286
287static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm)
288{
289 struct bfin_rtc *rtc = dev_get_drvdata(dev);
290
291 stampit();
292
293 spin_lock_irq(&rtc->lock);
294 rtc_bfin_sync_pending();
295 rtc_bfin_to_tm(bfin_read_RTC_STAT(), tm);
296 spin_unlock_irq(&rtc->lock);
297
298 return 0;
299}
300
301static int bfin_rtc_set_time(struct device *dev, struct rtc_time *tm)
302{
303 struct bfin_rtc *rtc = dev_get_drvdata(dev);
304 int ret;
305 unsigned long now;
306
307 stampit();
308
309 spin_lock_irq(&rtc->lock);
310
311 ret = rtc_tm_to_time(tm, &now);
312 if (ret == 0) {
313 rtc_bfin_sync_pending();
314 bfin_write_RTC_STAT(rtc_time_to_bfin(now));
315 }
316
317 spin_unlock_irq(&rtc->lock);
318
319 return ret;
320}
321
322static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
323{
324 struct bfin_rtc *rtc = dev_get_drvdata(dev);
325 stampit();
326 memcpy(&alrm->time, &rtc->rtc_alarm, sizeof(struct rtc_time));
327 alrm->pending = !!(bfin_read_RTC_ICTL() & (RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
328 return 0;
329}
330
331static int bfin_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
332{
333 struct bfin_rtc *rtc = dev_get_drvdata(dev);
334 stampit();
335 memcpy(&rtc->rtc_alarm, &alrm->time, sizeof(struct rtc_time));
336 return 0;
337}
338
339static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
340{
341#define yesno(x) (x ? "yes" : "no")
342 u16 ictl = bfin_read_RTC_ICTL();
343 stampit();
344 seq_printf(seq, "alarm_IRQ\t: %s\n", yesno(ictl & RTC_ISTAT_ALARM));
345 seq_printf(seq, "wkalarm_IRQ\t: %s\n", yesno(ictl & RTC_ISTAT_ALARM_DAY));
346 seq_printf(seq, "seconds_IRQ\t: %s\n", yesno(ictl & RTC_ISTAT_SEC));
347 seq_printf(seq, "periodic_IRQ\t: %s\n", yesno(ictl & RTC_ISTAT_STOPWATCH));
348#ifdef DEBUG
349 seq_printf(seq, "RTC_STAT\t: 0x%08X\n", bfin_read_RTC_STAT());
350 seq_printf(seq, "RTC_ICTL\t: 0x%04X\n", bfin_read_RTC_ICTL());
351 seq_printf(seq, "RTC_ISTAT\t: 0x%04X\n", bfin_read_RTC_ISTAT());
352 seq_printf(seq, "RTC_SWCNT\t: 0x%04X\n", bfin_read_RTC_SWCNT());
353 seq_printf(seq, "RTC_ALARM\t: 0x%08X\n", bfin_read_RTC_ALARM());
354 seq_printf(seq, "RTC_PREN\t: 0x%04X\n", bfin_read_RTC_PREN());
355#endif
356 return 0;
357}
358
359static int bfin_irq_set_freq(struct device *dev, int freq)
360{
361 struct bfin_rtc *rtc = dev_get_drvdata(dev);
362 stampit();
363 rtc->rtc_dev->irq_freq = freq;
364 return 0;
365}
366
367static struct rtc_class_ops bfin_rtc_ops = {
368 .open = bfin_rtc_open,
369 .release = bfin_rtc_release,
370 .ioctl = bfin_rtc_ioctl,
371 .read_time = bfin_rtc_read_time,
372 .set_time = bfin_rtc_set_time,
373 .read_alarm = bfin_rtc_read_alarm,
374 .set_alarm = bfin_rtc_set_alarm,
375 .proc = bfin_rtc_proc,
376 .irq_set_freq = bfin_irq_set_freq,
377};
378
379static int __devinit bfin_rtc_probe(struct platform_device *pdev)
380{
381 struct bfin_rtc *rtc;
382 int ret = 0;
383
384 stampit();
385
386 rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
387 if (unlikely(!rtc))
388 return -ENOMEM;
389
390 spin_lock_init(&rtc->lock);
391
392 rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE);
393 if (unlikely(IS_ERR(rtc))) {
394 ret = PTR_ERR(rtc->rtc_dev);
395 goto err;
396 }
397 rtc->rtc_dev->irq_freq = 0;
398 rtc->rtc_dev->max_user_freq = (2 << 16); /* stopwatch is an unsigned 16 bit reg */
399
400 platform_set_drvdata(pdev, rtc);
401
402 return 0;
403
404err:
405 kfree(rtc);
406 return ret;
407}
408
409static int __devexit bfin_rtc_remove(struct platform_device *pdev)
410{
411 struct bfin_rtc *rtc = platform_get_drvdata(pdev);
412
413 rtc_device_unregister(rtc->rtc_dev);
414 platform_set_drvdata(pdev, NULL);
415 kfree(rtc);
416
417 return 0;
418}
419
420static struct platform_driver bfin_rtc_driver = {
421 .driver = {
422 .name = "rtc-bfin",
423 .owner = THIS_MODULE,
424 },
425 .probe = bfin_rtc_probe,
426 .remove = __devexit_p(bfin_rtc_remove),
427};
428
429static int __init bfin_rtc_init(void)
430{
431 stampit();
432 return platform_driver_register(&bfin_rtc_driver);
433}
434
435static void __exit bfin_rtc_exit(void)
436{
437 platform_driver_unregister(&bfin_rtc_driver);
438}
439
440module_init(bfin_rtc_init);
441module_exit(bfin_rtc_exit);
442
443MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver");
444MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>");
445MODULE_LICENSE("GPL");
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index e71929db8b06..977521013fe8 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2174,6 +2174,51 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
2174 return ret; 2174 return ret;
2175} 2175}
2176 2176
2177struct dasd_ccw_req * dasd_generic_build_rdc(struct dasd_device *device,
2178 void *rdc_buffer,
2179 int rdc_buffer_size, char *magic)
2180{
2181 struct dasd_ccw_req *cqr;
2182 struct ccw1 *ccw;
2183
2184 cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device);
2185
2186 if (IS_ERR(cqr)) {
2187 DEV_MESSAGE(KERN_WARNING, device, "%s",
2188 "Could not allocate RDC request");
2189 return cqr;
2190 }
2191
2192 ccw = cqr->cpaddr;
2193 ccw->cmd_code = CCW_CMD_RDC;
2194 ccw->cda = (__u32)(addr_t)rdc_buffer;
2195 ccw->count = rdc_buffer_size;
2196
2197 cqr->device = device;
2198 cqr->expires = 10*HZ;
2199 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
2200 cqr->retries = 2;
2201 cqr->buildclk = get_clock();
2202 cqr->status = DASD_CQR_FILLED;
2203 return cqr;
2204}
2205
2206
2207int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic,
2208 void **rdc_buffer, int rdc_buffer_size)
2209{
2210 int ret;
2211 struct dasd_ccw_req *cqr;
2212
2213 cqr = dasd_generic_build_rdc(device, *rdc_buffer, rdc_buffer_size,
2214 magic);
2215 if (IS_ERR(cqr))
2216 return PTR_ERR(cqr);
2217
2218 ret = dasd_sleep_on(cqr);
2219 dasd_sfree_request(cqr, cqr->device);
2220 return ret;
2221}
2177 2222
2178static int __init 2223static int __init
2179dasd_init(void) 2224dasd_init(void)
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index cecab2274a6e..c9583fbc2a7d 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -450,6 +450,81 @@ dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid)
450 return 0; 450 return 0;
451} 451}
452 452
453struct dasd_ccw_req * dasd_eckd_build_rcd_lpm(struct dasd_device *device,
454 void *rcd_buffer,
455 struct ciw *ciw, __u8 lpm)
456{
457 struct dasd_ccw_req *cqr;
458 struct ccw1 *ccw;
459
460 cqr = dasd_smalloc_request("ECKD", 1 /* RCD */, ciw->count, device);
461
462 if (IS_ERR(cqr)) {
463 DEV_MESSAGE(KERN_WARNING, device, "%s",
464 "Could not allocate RCD request");
465 return cqr;
466 }
467
468 ccw = cqr->cpaddr;
469 ccw->cmd_code = ciw->cmd;
470 ccw->cda = (__u32)(addr_t)rcd_buffer;
471 ccw->count = ciw->count;
472
473 cqr->device = device;
474 cqr->expires = 10*HZ;
475 cqr->lpm = lpm;
476 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
477 cqr->retries = 2;
478 cqr->buildclk = get_clock();
479 cqr->status = DASD_CQR_FILLED;
480 return cqr;
481}
482
483static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
484 void **rcd_buffer,
485 int *rcd_buffer_size, __u8 lpm)
486{
487 struct ciw *ciw;
488 char *rcd_buf = NULL;
489 int ret;
490 struct dasd_ccw_req *cqr;
491
492 /*
493 * scan for RCD command in extended SenseID data
494 */
495 ciw = ccw_device_get_ciw(device->cdev, CIW_TYPE_RCD);
496 if (!ciw || ciw->cmd == 0) {
497 ret = -EOPNOTSUPP;
498 goto out_error;
499 }
500 rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
501 if (!rcd_buf) {
502 ret = -ENOMEM;
503 goto out_error;
504 }
505 cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm);
506 if (IS_ERR(cqr)) {
507 ret = PTR_ERR(cqr);
508 goto out_error;
509 }
510 ret = dasd_sleep_on(cqr);
511 /*
512 * on success we update the user input parms
513 */
514 dasd_sfree_request(cqr, cqr->device);
515 if (ret)
516 goto out_error;
517
518 *rcd_buffer_size = ciw->count;
519 *rcd_buffer = rcd_buf;
520 return 0;
521out_error:
522 kfree(rcd_buf);
523 *rcd_buffer = NULL;
524 *rcd_buffer_size = 0;
525 return ret;
526}
527
453static int 528static int
454dasd_eckd_read_conf(struct dasd_device *device) 529dasd_eckd_read_conf(struct dasd_device *device)
455{ 530{
@@ -469,8 +544,8 @@ dasd_eckd_read_conf(struct dasd_device *device)
469 /* get configuration data per operational path */ 544 /* get configuration data per operational path */
470 for (lpm = 0x80; lpm; lpm>>= 1) { 545 for (lpm = 0x80; lpm; lpm>>= 1) {
471 if (lpm & path_data->opm){ 546 if (lpm & path_data->opm){
472 rc = read_conf_data_lpm(device->cdev, &conf_data, 547 rc = dasd_eckd_read_conf_lpm(device, &conf_data,
473 &conf_len, lpm); 548 &conf_len, lpm);
474 if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */ 549 if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */
475 MESSAGE(KERN_WARNING, 550 MESSAGE(KERN_WARNING,
476 "Read configuration data returned " 551 "Read configuration data returned "
@@ -639,7 +714,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
639 /* Read Device Characteristics */ 714 /* Read Device Characteristics */
640 rdc_data = (void *) &(private->rdc_data); 715 rdc_data = (void *) &(private->rdc_data);
641 memset(rdc_data, 0, sizeof(rdc_data)); 716 memset(rdc_data, 0, sizeof(rdc_data));
642 rc = read_dev_chars(device->cdev, &rdc_data, 64); 717 rc = dasd_generic_read_dev_chars(device, "ECKD", &rdc_data, 64);
643 if (rc) 718 if (rc)
644 DEV_MESSAGE(KERN_WARNING, device, 719 DEV_MESSAGE(KERN_WARNING, device,
645 "Read device characteristics returned " 720 "Read device characteristics returned "
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index be0909e39226..da16ead8aff2 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -135,7 +135,7 @@ dasd_fba_check_characteristics(struct dasd_device *device)
135 } 135 }
136 /* Read Device Characteristics */ 136 /* Read Device Characteristics */
137 rdc_data = (void *) &(private->rdc_data); 137 rdc_data = (void *) &(private->rdc_data);
138 rc = read_dev_chars(device->cdev, &rdc_data, 32); 138 rc = dasd_generic_read_dev_chars(device, "FBA ", &rdc_data, 32);
139 if (rc) { 139 if (rc) {
140 DEV_MESSAGE(KERN_WARNING, device, 140 DEV_MESSAGE(KERN_WARNING, device,
141 "Read device characteristics returned error %d", 141 "Read device characteristics returned error %d",
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index a2cc69e11410..241294cba415 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -509,6 +509,8 @@ int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);
509int dasd_generic_set_offline (struct ccw_device *cdev); 509int dasd_generic_set_offline (struct ccw_device *cdev);
510int dasd_generic_notify(struct ccw_device *, int); 510int dasd_generic_notify(struct ccw_device *, int);
511 511
512int dasd_generic_read_dev_chars(struct dasd_device *, char *, void **, int);
513
512/* externals in dasd_devmap.c */ 514/* externals in dasd_devmap.c */
513extern int dasd_max_devindex; 515extern int dasd_max_devindex;
514extern int dasd_probeonly; 516extern int dasd_probeonly;
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index bb4ff537729d..3b52f5c1dbef 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -103,6 +103,7 @@ enum tape_op {
103 TO_CRYPT_OFF, /* Disable encrpytion */ 103 TO_CRYPT_OFF, /* Disable encrpytion */
104 TO_KEKL_SET, /* Set KEK label */ 104 TO_KEKL_SET, /* Set KEK label */
105 TO_KEKL_QUERY, /* Query KEK label */ 105 TO_KEKL_QUERY, /* Query KEK label */
106 TO_RDC, /* Read device characteristics */
106 TO_SIZE, /* #entries in tape_op_t */ 107 TO_SIZE, /* #entries in tape_op_t */
107}; 108};
108 109
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 50f5edab83d7..7e2b2ab49264 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -788,6 +788,7 @@ tape_3590_done(struct tape_device *device, struct tape_request *request)
788 case TO_SIZE: 788 case TO_SIZE:
789 case TO_KEKL_SET: 789 case TO_KEKL_SET:
790 case TO_KEKL_QUERY: 790 case TO_KEKL_QUERY:
791 case TO_RDC:
791 break; 792 break;
792 } 793 }
793 return TAPE_IO_SUCCESS; 794 return TAPE_IO_SUCCESS;
@@ -1549,6 +1550,26 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request,
1549 return TAPE_IO_STOP; 1550 return TAPE_IO_STOP;
1550} 1551}
1551 1552
1553
1554static int tape_3590_read_dev_chars(struct tape_device *device,
1555 struct tape_3590_rdc_data *rdc_data)
1556{
1557 int rc;
1558 struct tape_request *request;
1559
1560 request = tape_alloc_request(1, sizeof(*rdc_data));
1561 if (IS_ERR(request))
1562 return PTR_ERR(request);
1563 request->op = TO_RDC;
1564 tape_ccw_end(request->cpaddr, CCW_CMD_RDC, sizeof(*rdc_data),
1565 request->cpdata);
1566 rc = tape_do_io(device, request);
1567 if (rc == 0)
1568 memcpy(rdc_data, request->cpdata, sizeof(*rdc_data));
1569 tape_free_request(request);
1570 return rc;
1571}
1572
1552/* 1573/*
1553 * Setup device function 1574 * Setup device function
1554 */ 1575 */
@@ -1557,7 +1578,7 @@ tape_3590_setup_device(struct tape_device *device)
1557{ 1578{
1558 int rc; 1579 int rc;
1559 struct tape_3590_disc_data *data; 1580 struct tape_3590_disc_data *data;
1560 char *rdc_data; 1581 struct tape_3590_rdc_data *rdc_data;
1561 1582
1562 DBF_EVENT(6, "3590 device setup\n"); 1583 DBF_EVENT(6, "3590 device setup\n");
1563 data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA); 1584 data = kzalloc(sizeof(struct tape_3590_disc_data), GFP_KERNEL | GFP_DMA);
@@ -1566,12 +1587,12 @@ tape_3590_setup_device(struct tape_device *device)
1566 data->read_back_op = READ_PREVIOUS; 1587 data->read_back_op = READ_PREVIOUS;
1567 device->discdata = data; 1588 device->discdata = data;
1568 1589
1569 rdc_data = kmalloc(64, GFP_KERNEL | GFP_DMA); 1590 rdc_data = kmalloc(sizeof(*rdc_data), GFP_KERNEL | GFP_DMA);
1570 if (!rdc_data) { 1591 if (!rdc_data) {
1571 rc = -ENOMEM; 1592 rc = -ENOMEM;
1572 goto fail_kmalloc; 1593 goto fail_kmalloc;
1573 } 1594 }
1574 rc = read_dev_chars(device->cdev, (void**)&rdc_data, 64); 1595 rc = tape_3590_read_dev_chars(device, rdc_data);
1575 if (rc) { 1596 if (rc) {
1576 DBF_LH(3, "Read device characteristics failed!\n"); 1597 DBF_LH(3, "Read device characteristics failed!\n");
1577 goto fail_kmalloc; 1598 goto fail_kmalloc;
@@ -1579,7 +1600,7 @@ tape_3590_setup_device(struct tape_device *device)
1579 rc = tape_std_assign(device); 1600 rc = tape_std_assign(device);
1580 if (rc) 1601 if (rc)
1581 goto fail_rdc_data; 1602 goto fail_rdc_data;
1582 if (rdc_data[31] == 0x13) { 1603 if (rdc_data->data[31] == 0x13) {
1583 PRINT_INFO("Device has crypto support\n"); 1604 PRINT_INFO("Device has crypto support\n");
1584 data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK; 1605 data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK;
1585 tape_3592_disable_crypt(device); 1606 tape_3592_disable_crypt(device);
diff --git a/drivers/s390/char/tape_3590.h b/drivers/s390/char/tape_3590.h
index aa5138807af1..4534055f1376 100644
--- a/drivers/s390/char/tape_3590.h
+++ b/drivers/s390/char/tape_3590.h
@@ -129,6 +129,10 @@ struct tape_3590_med_sense {
129 char pad2[116]; 129 char pad2[116];
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
131 131
132struct tape_3590_rdc_data {
133 char data[64];
134} __attribute__ ((packed));
135
132/* Datastructures for 3592 encryption support */ 136/* Datastructures for 3592 encryption support */
133 137
134struct tape3592_kekl { 138struct tape3592_kekl {
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index e2a8a1a04bab..2fae6338ee1c 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -73,7 +73,7 @@ const char *tape_op_verbose[TO_SIZE] =
73 [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS", 73 [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS",
74 [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON", 74 [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON",
75 [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS", 75 [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS",
76 [TO_KEKL_QUERY] = "KLQ", 76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
77}; 77};
78 78
79static int 79static int
@@ -911,6 +911,7 @@ __tape_start_request(struct tape_device *device, struct tape_request *request)
911 case TO_ASSIGN: 911 case TO_ASSIGN:
912 case TO_UNASSIGN: 912 case TO_UNASSIGN:
913 case TO_READ_ATTMSG: 913 case TO_READ_ATTMSG:
914 case TO_RDC:
914 if (device->tape_state == TS_INIT) 915 if (device->tape_state == TS_INIT)
915 break; 916 break;
916 if (device->tape_state == TS_UNUSED) 917 if (device->tape_state == TS_UNUSED)
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 05fac0733f3d..cba64e4cfcd4 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -69,7 +69,6 @@ static const char version[] = "QDIO base support version 2";
69 69
70static int qdio_performance_stats = 0; 70static int qdio_performance_stats = 0;
71static int proc_perf_file_registration; 71static int proc_perf_file_registration;
72static unsigned long i_p_c, i_p_nc, o_p_c, o_p_nc, ii_p_c, ii_p_nc;
73static struct qdio_perf_stats perf_stats; 72static struct qdio_perf_stats perf_stats;
74 73
75static int hydra_thinints; 74static int hydra_thinints;
@@ -111,6 +110,31 @@ qdio_min(int a,int b)
111} 110}
112 111
113/***************** SCRUBBER HELPER ROUTINES **********************/ 112/***************** SCRUBBER HELPER ROUTINES **********************/
113#ifdef CONFIG_64BIT
114static inline void qdio_perf_stat_inc(atomic64_t *count)
115{
116 if (qdio_performance_stats)
117 atomic64_inc(count);
118}
119
120static inline void qdio_perf_stat_dec(atomic64_t *count)
121{
122 if (qdio_performance_stats)
123 atomic64_dec(count);
124}
125#else /* CONFIG_64BIT */
126static inline void qdio_perf_stat_inc(atomic_t *count)
127{
128 if (qdio_performance_stats)
129 atomic_inc(count);
130}
131
132static inline void qdio_perf_stat_dec(atomic_t *count)
133{
134 if (qdio_performance_stats)
135 atomic_dec(count);
136}
137#endif /* CONFIG_64BIT */
114 138
115static inline __u64 139static inline __u64
116qdio_get_micros(void) 140qdio_get_micros(void)
@@ -277,8 +301,7 @@ qdio_siga_sync(struct qdio_q *q, unsigned int gpr2,
277 QDIO_DBF_TEXT4(0,trace,"sigasync"); 301 QDIO_DBF_TEXT4(0,trace,"sigasync");
278 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); 302 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
279 303
280 if (qdio_performance_stats) 304 qdio_perf_stat_inc(&perf_stats.siga_syncs);
281 perf_stats.siga_syncs++;
282 305
283 cc = do_siga_sync(q->schid, gpr2, gpr3); 306 cc = do_siga_sync(q->schid, gpr2, gpr3);
284 if (cc) 307 if (cc)
@@ -323,8 +346,7 @@ qdio_siga_output(struct qdio_q *q)
323 __u32 busy_bit; 346 __u32 busy_bit;
324 __u64 start_time=0; 347 __u64 start_time=0;
325 348
326 if (qdio_performance_stats) 349 qdio_perf_stat_inc(&perf_stats.siga_outs);
327 perf_stats.siga_outs++;
328 350
329 QDIO_DBF_TEXT4(0,trace,"sigaout"); 351 QDIO_DBF_TEXT4(0,trace,"sigaout");
330 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); 352 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
@@ -358,8 +380,7 @@ qdio_siga_input(struct qdio_q *q)
358 QDIO_DBF_TEXT4(0,trace,"sigain"); 380 QDIO_DBF_TEXT4(0,trace,"sigain");
359 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); 381 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
360 382
361 if (qdio_performance_stats) 383 qdio_perf_stat_inc(&perf_stats.siga_ins);
362 perf_stats.siga_ins++;
363 384
364 cc = do_siga_input(q->schid, q->mask); 385 cc = do_siga_input(q->schid, q->mask);
365 386
@@ -953,8 +974,7 @@ __qdio_outbound_processing(struct qdio_q *q)
953 974
954 if (unlikely(qdio_reserve_q(q))) { 975 if (unlikely(qdio_reserve_q(q))) {
955 qdio_release_q(q); 976 qdio_release_q(q);
956 if (qdio_performance_stats) 977 qdio_perf_stat_inc(&perf_stats.outbound_tl_runs_resched);
957 o_p_c++;
958 /* as we're sissies, we'll check next time */ 978 /* as we're sissies, we'll check next time */
959 if (likely(!atomic_read(&q->is_in_shutdown))) { 979 if (likely(!atomic_read(&q->is_in_shutdown))) {
960 qdio_mark_q(q); 980 qdio_mark_q(q);
@@ -962,10 +982,8 @@ __qdio_outbound_processing(struct qdio_q *q)
962 } 982 }
963 return; 983 return;
964 } 984 }
965 if (qdio_performance_stats) { 985 qdio_perf_stat_inc(&perf_stats.outbound_tl_runs);
966 o_p_nc++; 986 qdio_perf_stat_inc(&perf_stats.tl_runs);
967 perf_stats.tl_runs++;
968 }
969 987
970 /* see comment in qdio_kick_outbound_q */ 988 /* see comment in qdio_kick_outbound_q */
971 siga_attempts=atomic_read(&q->busy_siga_counter); 989 siga_attempts=atomic_read(&q->busy_siga_counter);
@@ -1139,17 +1157,6 @@ qdio_has_inbound_q_moved(struct qdio_q *q)
1139{ 1157{
1140 int i; 1158 int i;
1141 1159
1142 static int old_pcis=0;
1143 static int old_thinints=0;
1144
1145 if (qdio_performance_stats) {
1146 if ((old_pcis==perf_stats.pcis)&&
1147 (old_thinints==perf_stats.thinints))
1148 perf_stats.start_time_inbound=NOW;
1149 else
1150 old_pcis=perf_stats.pcis;
1151 }
1152
1153 i=qdio_get_inbound_buffer_frontier(q); 1160 i=qdio_get_inbound_buffer_frontier(q);
1154 if ( (i!=GET_SAVED_FRONTIER(q)) || 1161 if ( (i!=GET_SAVED_FRONTIER(q)) ||
1155 (q->error_status_flags&QDIO_STATUS_LOOK_FOR_ERROR) ) { 1162 (q->error_status_flags&QDIO_STATUS_LOOK_FOR_ERROR) ) {
@@ -1337,10 +1344,7 @@ qdio_kick_inbound_handler(struct qdio_q *q)
1337 q->siga_error=0; 1344 q->siga_error=0;
1338 q->error_status_flags=0; 1345 q->error_status_flags=0;
1339 1346
1340 if (qdio_performance_stats) { 1347 qdio_perf_stat_inc(&perf_stats.inbound_cnt);
1341 perf_stats.inbound_time+=NOW-perf_stats.start_time_inbound;
1342 perf_stats.inbound_cnt++;
1343 }
1344} 1348}
1345 1349
1346static void 1350static void
@@ -1360,8 +1364,7 @@ __tiqdio_inbound_processing(struct qdio_q *q, int spare_ind_was_set)
1360 */ 1364 */
1361 if (unlikely(qdio_reserve_q(q))) { 1365 if (unlikely(qdio_reserve_q(q))) {
1362 qdio_release_q(q); 1366 qdio_release_q(q);
1363 if (qdio_performance_stats) 1367 qdio_perf_stat_inc(&perf_stats.inbound_thin_tl_runs_resched);
1364 ii_p_c++;
1365 /* 1368 /*
1366 * as we might just be about to stop polling, we make 1369 * as we might just be about to stop polling, we make
1367 * sure that we check again at least once more 1370 * sure that we check again at least once more
@@ -1369,8 +1372,7 @@ __tiqdio_inbound_processing(struct qdio_q *q, int spare_ind_was_set)
1369 tiqdio_sched_tl(); 1372 tiqdio_sched_tl();
1370 return; 1373 return;
1371 } 1374 }
1372 if (qdio_performance_stats) 1375 qdio_perf_stat_inc(&perf_stats.inbound_thin_tl_runs);
1373 ii_p_nc++;
1374 if (unlikely(atomic_read(&q->is_in_shutdown))) { 1376 if (unlikely(atomic_read(&q->is_in_shutdown))) {
1375 qdio_unmark_q(q); 1377 qdio_unmark_q(q);
1376 goto out; 1378 goto out;
@@ -1412,8 +1414,7 @@ __tiqdio_inbound_processing(struct qdio_q *q, int spare_ind_was_set)
1412 for (i=0;i<irq_ptr->no_output_qs;i++) { 1414 for (i=0;i<irq_ptr->no_output_qs;i++) {
1413 oq = irq_ptr->output_qs[i]; 1415 oq = irq_ptr->output_qs[i];
1414 if (!qdio_is_outbound_q_done(oq)) { 1416 if (!qdio_is_outbound_q_done(oq)) {
1415 if (qdio_performance_stats) 1417 qdio_perf_stat_dec(&perf_stats.tl_runs);
1416 perf_stats.tl_runs--;
1417 __qdio_outbound_processing(oq); 1418 __qdio_outbound_processing(oq);
1418 } 1419 }
1419 } 1420 }
@@ -1452,8 +1453,7 @@ __qdio_inbound_processing(struct qdio_q *q)
1452 1453
1453 if (unlikely(qdio_reserve_q(q))) { 1454 if (unlikely(qdio_reserve_q(q))) {
1454 qdio_release_q(q); 1455 qdio_release_q(q);
1455 if (qdio_performance_stats) 1456 qdio_perf_stat_inc(&perf_stats.inbound_tl_runs_resched);
1456 i_p_c++;
1457 /* as we're sissies, we'll check next time */ 1457 /* as we're sissies, we'll check next time */
1458 if (likely(!atomic_read(&q->is_in_shutdown))) { 1458 if (likely(!atomic_read(&q->is_in_shutdown))) {
1459 qdio_mark_q(q); 1459 qdio_mark_q(q);
@@ -1461,10 +1461,8 @@ __qdio_inbound_processing(struct qdio_q *q)
1461 } 1461 }
1462 return; 1462 return;
1463 } 1463 }
1464 if (qdio_performance_stats) { 1464 qdio_perf_stat_inc(&perf_stats.inbound_tl_runs);
1465 i_p_nc++; 1465 qdio_perf_stat_inc(&perf_stats.tl_runs);
1466 perf_stats.tl_runs++;
1467 }
1468 1466
1469again: 1467again:
1470 if (qdio_has_inbound_q_moved(q)) { 1468 if (qdio_has_inbound_q_moved(q)) {
@@ -1510,8 +1508,7 @@ tiqdio_reset_processing_state(struct qdio_q *q, int q_laps)
1510 1508
1511 if (unlikely(qdio_reserve_q(q))) { 1509 if (unlikely(qdio_reserve_q(q))) {
1512 qdio_release_q(q); 1510 qdio_release_q(q);
1513 if (qdio_performance_stats) 1511 qdio_perf_stat_inc(&perf_stats.inbound_thin_tl_runs_resched);
1514 ii_p_c++;
1515 /* 1512 /*
1516 * as we might just be about to stop polling, we make 1513 * as we might just be about to stop polling, we make
1517 * sure that we check again at least once more 1514 * sure that we check again at least once more
@@ -1602,8 +1599,7 @@ tiqdio_tl(unsigned long data)
1602{ 1599{
1603 QDIO_DBF_TEXT4(0,trace,"iqdio_tl"); 1600 QDIO_DBF_TEXT4(0,trace,"iqdio_tl");
1604 1601
1605 if (qdio_performance_stats) 1602 qdio_perf_stat_inc(&perf_stats.tl_runs);
1606 perf_stats.tl_runs++;
1607 1603
1608 tiqdio_inbound_checks(); 1604 tiqdio_inbound_checks();
1609} 1605}
@@ -1914,10 +1910,7 @@ tiqdio_thinint_handler(void)
1914{ 1910{
1915 QDIO_DBF_TEXT4(0,trace,"thin_int"); 1911 QDIO_DBF_TEXT4(0,trace,"thin_int");
1916 1912
1917 if (qdio_performance_stats) { 1913 qdio_perf_stat_inc(&perf_stats.thinints);
1918 perf_stats.thinints++;
1919 perf_stats.start_time_inbound=NOW;
1920 }
1921 1914
1922 /* SVS only when needed: 1915 /* SVS only when needed:
1923 * issue SVS to benefit from iqdio interrupt avoidance 1916 * issue SVS to benefit from iqdio interrupt avoidance
@@ -1972,17 +1965,12 @@ qdio_handle_pci(struct qdio_irq *irq_ptr)
1972 int i; 1965 int i;
1973 struct qdio_q *q; 1966 struct qdio_q *q;
1974 1967
1975 if (qdio_performance_stats) { 1968 qdio_perf_stat_inc(&perf_stats.pcis);
1976 perf_stats.pcis++;
1977 perf_stats.start_time_inbound=NOW;
1978 }
1979 for (i=0;i<irq_ptr->no_input_qs;i++) { 1969 for (i=0;i<irq_ptr->no_input_qs;i++) {
1980 q=irq_ptr->input_qs[i]; 1970 q=irq_ptr->input_qs[i];
1981 if (q->is_input_q&QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT) 1971 if (q->is_input_q&QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT)
1982 qdio_mark_q(q); 1972 qdio_mark_q(q);
1983 else { 1973 else {
1984 if (qdio_performance_stats)
1985 perf_stats.tl_runs--;
1986 __qdio_inbound_processing(q); 1974 __qdio_inbound_processing(q);
1987 } 1975 }
1988 } 1976 }
@@ -1992,8 +1980,7 @@ qdio_handle_pci(struct qdio_irq *irq_ptr)
1992 q=irq_ptr->output_qs[i]; 1980 q=irq_ptr->output_qs[i];
1993 if (qdio_is_outbound_q_done(q)) 1981 if (qdio_is_outbound_q_done(q))
1994 continue; 1982 continue;
1995 if (qdio_performance_stats) 1983 qdio_perf_stat_dec(&perf_stats.tl_runs);
1996 perf_stats.tl_runs--;
1997 if (!irq_ptr->sync_done_on_outb_pcis) 1984 if (!irq_ptr->sync_done_on_outb_pcis)
1998 SYNC_MEMORY; 1985 SYNC_MEMORY;
1999 __qdio_outbound_processing(q); 1986 __qdio_outbound_processing(q);
@@ -3463,18 +3450,12 @@ do_qdio_handle_outbound(struct qdio_q *q, unsigned int callflags,
3463 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; 3450 struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
3464 3451
3465 /* This is the outbound handling of queues */ 3452 /* This is the outbound handling of queues */
3466 if (qdio_performance_stats)
3467 perf_stats.start_time_outbound=NOW;
3468
3469 qdio_do_qdio_fill_output(q,qidx,count,buffers); 3453 qdio_do_qdio_fill_output(q,qidx,count,buffers);
3470 3454
3471 used_elements=atomic_add_return(count, &q->number_of_buffers_used) - count; 3455 used_elements=atomic_add_return(count, &q->number_of_buffers_used) - count;
3472 3456
3473 if (callflags&QDIO_FLAG_DONT_SIGA) { 3457 if (callflags&QDIO_FLAG_DONT_SIGA) {
3474 if (qdio_performance_stats) { 3458 qdio_perf_stat_inc(&perf_stats.outbound_cnt);
3475 perf_stats.outbound_time+=NOW-perf_stats.start_time_outbound;
3476 perf_stats.outbound_cnt++;
3477 }
3478 return; 3459 return;
3479 } 3460 }
3480 if (q->is_iqdio_q) { 3461 if (q->is_iqdio_q) {
@@ -3504,8 +3485,7 @@ do_qdio_handle_outbound(struct qdio_q *q, unsigned int callflags,
3504 qdio_kick_outbound_q(q); 3485 qdio_kick_outbound_q(q);
3505 } else { 3486 } else {
3506 QDIO_DBF_TEXT3(0,trace, "fast-req"); 3487 QDIO_DBF_TEXT3(0,trace, "fast-req");
3507 if (qdio_performance_stats) 3488 qdio_perf_stat_inc(&perf_stats.fast_reqs);
3508 perf_stats.fast_reqs++;
3509 } 3489 }
3510 } 3490 }
3511 /* 3491 /*
@@ -3516,10 +3496,7 @@ do_qdio_handle_outbound(struct qdio_q *q, unsigned int callflags,
3516 __qdio_outbound_processing(q); 3496 __qdio_outbound_processing(q);
3517 } 3497 }
3518 3498
3519 if (qdio_performance_stats) { 3499 qdio_perf_stat_inc(&perf_stats.outbound_cnt);
3520 perf_stats.outbound_time+=NOW-perf_stats.start_time_outbound;
3521 perf_stats.outbound_cnt++;
3522 }
3523} 3500}
3524 3501
3525/* count must be 1 in iqdio */ 3502/* count must be 1 in iqdio */
@@ -3589,33 +3566,67 @@ qdio_perf_procfile_read(char *buffer, char **buffer_location, off_t offset,
3589 return 0; 3566 return 0;
3590 3567
3591#define _OUTP_IT(x...) c+=sprintf(buffer+c,x) 3568#define _OUTP_IT(x...) c+=sprintf(buffer+c,x)
3592 _OUTP_IT("i_p_nc/c=%lu/%lu\n",i_p_nc,i_p_c); 3569#ifdef CONFIG_64BIT
3593 _OUTP_IT("ii_p_nc/c=%lu/%lu\n",ii_p_nc,ii_p_c); 3570 _OUTP_IT("Number of tasklet runs (total) : %li\n",
3594 _OUTP_IT("o_p_nc/c=%lu/%lu\n",o_p_nc,o_p_c); 3571 (long)atomic64_read(&perf_stats.tl_runs));
3595 _OUTP_IT("Number of tasklet runs (total) : %lu\n", 3572 _OUTP_IT("Inbound tasklet runs tried/retried : %li/%li\n",
3596 perf_stats.tl_runs); 3573 (long)atomic64_read(&perf_stats.inbound_tl_runs),
3574 (long)atomic64_read(&perf_stats.inbound_tl_runs_resched));
3575 _OUTP_IT("Inbound-thin tasklet runs tried/retried : %li/%li\n",
3576 (long)atomic64_read(&perf_stats.inbound_thin_tl_runs),
3577 (long)atomic64_read(&perf_stats.inbound_thin_tl_runs_resched));
3578 _OUTP_IT("Outbound tasklet runs tried/retried : %li/%li\n",
3579 (long)atomic64_read(&perf_stats.outbound_tl_runs),
3580 (long)atomic64_read(&perf_stats.outbound_tl_runs_resched));
3597 _OUTP_IT("\n"); 3581 _OUTP_IT("\n");
3598 _OUTP_IT("Number of SIGA sync's issued : %lu\n", 3582 _OUTP_IT("Number of SIGA sync's issued : %li\n",
3599 perf_stats.siga_syncs); 3583 (long)atomic64_read(&perf_stats.siga_syncs));
3600 _OUTP_IT("Number of SIGA in's issued : %lu\n", 3584 _OUTP_IT("Number of SIGA in's issued : %li\n",
3601 perf_stats.siga_ins); 3585 (long)atomic64_read(&perf_stats.siga_ins));
3602 _OUTP_IT("Number of SIGA out's issued : %lu\n", 3586 _OUTP_IT("Number of SIGA out's issued : %li\n",
3603 perf_stats.siga_outs); 3587 (long)atomic64_read(&perf_stats.siga_outs));
3604 _OUTP_IT("Number of PCIs caught : %lu\n", 3588 _OUTP_IT("Number of PCIs caught : %li\n",
3605 perf_stats.pcis); 3589 (long)atomic64_read(&perf_stats.pcis));
3606 _OUTP_IT("Number of adapter interrupts caught : %lu\n", 3590 _OUTP_IT("Number of adapter interrupts caught : %li\n",
3607 perf_stats.thinints); 3591 (long)atomic64_read(&perf_stats.thinints));
3608 _OUTP_IT("Number of fast requeues (outg. SBALs w/o SIGA) : %lu\n", 3592 _OUTP_IT("Number of fast requeues (outg. SBALs w/o SIGA) : %li\n",
3609 perf_stats.fast_reqs); 3593 (long)atomic64_read(&perf_stats.fast_reqs));
3610 _OUTP_IT("\n"); 3594 _OUTP_IT("\n");
3611 _OUTP_IT("Total time of all inbound actions (us) incl. UL : %lu\n", 3595 _OUTP_IT("Number of inbound transfers : %li\n",
3612 perf_stats.inbound_time); 3596 (long)atomic64_read(&perf_stats.inbound_cnt));
3613 _OUTP_IT("Number of inbound transfers : %lu\n", 3597 _OUTP_IT("Number of do_QDIOs outbound : %li\n",
3614 perf_stats.inbound_cnt); 3598 (long)atomic64_read(&perf_stats.outbound_cnt));
3615 _OUTP_IT("Total time of all outbound do_QDIOs (us) : %lu\n", 3599#else /* CONFIG_64BIT */
3616 perf_stats.outbound_time); 3600 _OUTP_IT("Number of tasklet runs (total) : %i\n",
3617 _OUTP_IT("Number of do_QDIOs outbound : %lu\n", 3601 atomic_read(&perf_stats.tl_runs));
3618 perf_stats.outbound_cnt); 3602 _OUTP_IT("Inbound tasklet runs tried/retried : %i/%i\n",
3603 atomic_read(&perf_stats.inbound_tl_runs),
3604 atomic_read(&perf_stats.inbound_tl_runs_resched));
3605 _OUTP_IT("Inbound-thin tasklet runs tried/retried : %i/%i\n",
3606 atomic_read(&perf_stats.inbound_thin_tl_runs),
3607 atomic_read(&perf_stats.inbound_thin_tl_runs_resched));
3608 _OUTP_IT("Outbound tasklet runs tried/retried : %i/%i\n",
3609 atomic_read(&perf_stats.outbound_tl_runs),
3610 atomic_read(&perf_stats.outbound_tl_runs_resched));
3611 _OUTP_IT("\n");
3612 _OUTP_IT("Number of SIGA sync's issued : %i\n",
3613 atomic_read(&perf_stats.siga_syncs));
3614 _OUTP_IT("Number of SIGA in's issued : %i\n",
3615 atomic_read(&perf_stats.siga_ins));
3616 _OUTP_IT("Number of SIGA out's issued : %i\n",
3617 atomic_read(&perf_stats.siga_outs));
3618 _OUTP_IT("Number of PCIs caught : %i\n",
3619 atomic_read(&perf_stats.pcis));
3620 _OUTP_IT("Number of adapter interrupts caught : %i\n",
3621 atomic_read(&perf_stats.thinints));
3622 _OUTP_IT("Number of fast requeues (outg. SBALs w/o SIGA) : %i\n",
3623 atomic_read(&perf_stats.fast_reqs));
3624 _OUTP_IT("\n");
3625 _OUTP_IT("Number of inbound transfers : %i\n",
3626 atomic_read(&perf_stats.inbound_cnt));
3627 _OUTP_IT("Number of do_QDIOs outbound : %i\n",
3628 atomic_read(&perf_stats.outbound_cnt));
3629#endif /* CONFIG_64BIT */
3619 _OUTP_IT("\n"); 3630 _OUTP_IT("\n");
3620 3631
3621 return c; 3632 return c;
@@ -3642,8 +3653,6 @@ qdio_add_procfs_entry(void)
3642static void 3653static void
3643qdio_remove_procfs_entry(void) 3654qdio_remove_procfs_entry(void)
3644{ 3655{
3645 perf_stats.tl_runs=0;
3646
3647 if (!proc_perf_file_registration) /* means if it went ok earlier */ 3656 if (!proc_perf_file_registration) /* means if it went ok earlier */
3648 remove_proc_entry(QDIO_PERF,&proc_root); 3657 remove_proc_entry(QDIO_PERF,&proc_root);
3649} 3658}
@@ -3671,13 +3680,38 @@ qdio_performance_stats_store(struct bus_type *bus, const char *buf, size_t count
3671 qdio_performance_stats = i; 3680 qdio_performance_stats = i;
3672 if (i==0) { 3681 if (i==0) {
3673 /* reset perf. stat. info */ 3682 /* reset perf. stat. info */
3674 i_p_nc = 0; 3683#ifdef CONFIG_64BIT
3675 i_p_c = 0; 3684 atomic64_set(&perf_stats.tl_runs, 0);
3676 ii_p_nc = 0; 3685 atomic64_set(&perf_stats.outbound_tl_runs, 0);
3677 ii_p_c = 0; 3686 atomic64_set(&perf_stats.inbound_tl_runs, 0);
3678 o_p_nc = 0; 3687 atomic64_set(&perf_stats.inbound_tl_runs_resched, 0);
3679 o_p_c = 0; 3688 atomic64_set(&perf_stats.inbound_thin_tl_runs, 0);
3680 memset(&perf_stats, 0, sizeof(struct qdio_perf_stats)); 3689 atomic64_set(&perf_stats.inbound_thin_tl_runs_resched,
3690 0);
3691 atomic64_set(&perf_stats.siga_outs, 0);
3692 atomic64_set(&perf_stats.siga_ins, 0);
3693 atomic64_set(&perf_stats.siga_syncs, 0);
3694 atomic64_set(&perf_stats.pcis, 0);
3695 atomic64_set(&perf_stats.thinints, 0);
3696 atomic64_set(&perf_stats.fast_reqs, 0);
3697 atomic64_set(&perf_stats.outbound_cnt, 0);
3698 atomic64_set(&perf_stats.inbound_cnt, 0);
3699#else /* CONFIG_64BIT */
3700 atomic_set(&perf_stats.tl_runs, 0);
3701 atomic_set(&perf_stats.outbound_tl_runs, 0);
3702 atomic_set(&perf_stats.inbound_tl_runs, 0);
3703 atomic_set(&perf_stats.inbound_tl_runs_resched, 0);
3704 atomic_set(&perf_stats.inbound_thin_tl_runs, 0);
3705 atomic_set(&perf_stats.inbound_thin_tl_runs_resched, 0);
3706 atomic_set(&perf_stats.siga_outs, 0);
3707 atomic_set(&perf_stats.siga_ins, 0);
3708 atomic_set(&perf_stats.siga_syncs, 0);
3709 atomic_set(&perf_stats.pcis, 0);
3710 atomic_set(&perf_stats.thinints, 0);
3711 atomic_set(&perf_stats.fast_reqs, 0);
3712 atomic_set(&perf_stats.outbound_cnt, 0);
3713 atomic_set(&perf_stats.inbound_cnt, 0);
3714#endif /* CONFIG_64BIT */
3681 } 3715 }
3682 } else { 3716 } else {
3683 QDIO_PRINT_WARN("QDIO performance_stats: write 0 or 1 to this file!\n"); 3717 QDIO_PRINT_WARN("QDIO performance_stats: write 0 or 1 to this file!\n");
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index ec9af72b2afc..2895392eaae4 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -406,21 +406,43 @@ do_clear_global_summary(void)
406#define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04 406#define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
407 407
408struct qdio_perf_stats { 408struct qdio_perf_stats {
409 unsigned long tl_runs; 409#ifdef CONFIG_64BIT
410 410 atomic64_t tl_runs;
411 unsigned long siga_outs; 411 atomic64_t outbound_tl_runs;
412 unsigned long siga_ins; 412 atomic64_t outbound_tl_runs_resched;
413 unsigned long siga_syncs; 413 atomic64_t inbound_tl_runs;
414 unsigned long pcis; 414 atomic64_t inbound_tl_runs_resched;
415 unsigned long thinints; 415 atomic64_t inbound_thin_tl_runs;
416 unsigned long fast_reqs; 416 atomic64_t inbound_thin_tl_runs_resched;
417 417
418 __u64 start_time_outbound; 418 atomic64_t siga_outs;
419 unsigned long outbound_cnt; 419 atomic64_t siga_ins;
420 unsigned long outbound_time; 420 atomic64_t siga_syncs;
421 __u64 start_time_inbound; 421 atomic64_t pcis;
422 unsigned long inbound_cnt; 422 atomic64_t thinints;
423 unsigned long inbound_time; 423 atomic64_t fast_reqs;
424
425 atomic64_t outbound_cnt;
426 atomic64_t inbound_cnt;
427#else /* CONFIG_64BIT */
428 atomic_t tl_runs;
429 atomic_t outbound_tl_runs;
430 atomic_t outbound_tl_runs_resched;
431 atomic_t inbound_tl_runs;
432 atomic_t inbound_tl_runs_resched;
433 atomic_t inbound_thin_tl_runs;
434 atomic_t inbound_thin_tl_runs_resched;
435
436 atomic_t siga_outs;
437 atomic_t siga_ins;
438 atomic_t siga_syncs;
439 atomic_t pcis;
440 atomic_t thinints;
441 atomic_t fast_reqs;
442
443 atomic_t outbound_cnt;
444 atomic_t inbound_cnt;
445#endif /* CONFIG_64BIT */
424}; 446};
425 447
426/* unlikely as the later the better */ 448/* unlikely as the later the better */
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 84b108d7c7fd..b34eb82edd98 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -288,6 +288,7 @@ qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, enum qeth_ipa_funcs func)
288 */ 288 */
289#define IF_NAME_LEN 16 289#define IF_NAME_LEN 16
290#define QETH_TX_TIMEOUT 100 * HZ 290#define QETH_TX_TIMEOUT 100 * HZ
291#define QETH_RCD_TIMEOUT 60 * HZ
291#define QETH_HEADER_SIZE 32 292#define QETH_HEADER_SIZE 32
292#define MAX_PORTNO 15 293#define MAX_PORTNO 15
293#define QETH_FAKE_LL_LEN_ETH ETH_HLEN 294#define QETH_FAKE_LL_LEN_ETH ETH_HLEN
@@ -582,6 +583,8 @@ enum qeth_channel_states {
582 CH_STATE_ACTIVATING, 583 CH_STATE_ACTIVATING,
583 CH_STATE_HALTED, 584 CH_STATE_HALTED,
584 CH_STATE_STOPPED, 585 CH_STATE_STOPPED,
586 CH_STATE_RCD,
587 CH_STATE_RCD_DONE,
585}; 588};
586/** 589/**
587 * card state machine 590 * card state machine
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index ad7792dc1a04..6fd8870551d3 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -315,7 +315,8 @@ qeth_alloc_card(void)
315} 315}
316 316
317static long 317static long
318__qeth_check_irb_error(struct ccw_device *cdev, struct irb *irb) 318__qeth_check_irb_error(struct ccw_device *cdev, unsigned long intparm,
319 struct irb *irb)
319{ 320{
320 if (!IS_ERR(irb)) 321 if (!IS_ERR(irb))
321 return 0; 322 return 0;
@@ -330,6 +331,14 @@ __qeth_check_irb_error(struct ccw_device *cdev, struct irb *irb)
330 PRINT_WARN("timeout on device %s\n", cdev->dev.bus_id); 331 PRINT_WARN("timeout on device %s\n", cdev->dev.bus_id);
331 QETH_DBF_TEXT(trace, 2, "ckirberr"); 332 QETH_DBF_TEXT(trace, 2, "ckirberr");
332 QETH_DBF_TEXT_(trace, 2, " rc%d", -ETIMEDOUT); 333 QETH_DBF_TEXT_(trace, 2, " rc%d", -ETIMEDOUT);
334 if (intparm == QETH_RCD_PARM) {
335 struct qeth_card *card = CARD_FROM_CDEV(cdev);
336
337 if (card && (card->data.ccwdev == cdev)) {
338 card->data.state = CH_STATE_DOWN;
339 wake_up(&card->wait_q);
340 }
341 }
333 break; 342 break;
334 default: 343 default:
335 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb), 344 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb),
@@ -401,7 +410,7 @@ qeth_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
401 410
402 QETH_DBF_TEXT(trace,5,"irq"); 411 QETH_DBF_TEXT(trace,5,"irq");
403 412
404 if (__qeth_check_irb_error(cdev, irb)) 413 if (__qeth_check_irb_error(cdev, intparm, irb))
405 return; 414 return;
406 cstat = irb->scsw.cstat; 415 cstat = irb->scsw.cstat;
407 dstat = irb->scsw.dstat; 416 dstat = irb->scsw.dstat;
@@ -429,7 +438,8 @@ qeth_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
429 channel->state = CH_STATE_HALTED; 438 channel->state = CH_STATE_HALTED;
430 439
431 /*let's wake up immediately on data channel*/ 440 /*let's wake up immediately on data channel*/
432 if ((channel == &card->data) && (intparm != 0)) 441 if ((channel == &card->data) && (intparm != 0) &&
442 (intparm != QETH_RCD_PARM))
433 goto out; 443 goto out;
434 444
435 if (intparm == QETH_CLEAR_CHANNEL_PARM) { 445 if (intparm == QETH_CLEAR_CHANNEL_PARM) {
@@ -453,6 +463,10 @@ qeth_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
453 HEXDUMP16(WARN,"irb: ",irb); 463 HEXDUMP16(WARN,"irb: ",irb);
454 HEXDUMP16(WARN,"sense data: ",irb->ecw); 464 HEXDUMP16(WARN,"sense data: ",irb->ecw);
455 } 465 }
466 if (intparm == QETH_RCD_PARM) {
467 channel->state = CH_STATE_DOWN;
468 goto out;
469 }
456 rc = qeth_get_problem(cdev,irb); 470 rc = qeth_get_problem(cdev,irb);
457 if (rc) { 471 if (rc) {
458 qeth_schedule_recovery(card); 472 qeth_schedule_recovery(card);
@@ -460,6 +474,10 @@ qeth_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
460 } 474 }
461 } 475 }
462 476
477 if (intparm == QETH_RCD_PARM) {
478 channel->state = CH_STATE_RCD_DONE;
479 goto out;
480 }
463 if (intparm) { 481 if (intparm) {
464 buffer = (struct qeth_cmd_buffer *) __va((addr_t)intparm); 482 buffer = (struct qeth_cmd_buffer *) __va((addr_t)intparm);
465 buffer->state = BUF_STATE_PROCESSED; 483 buffer->state = BUF_STATE_PROCESSED;
@@ -1204,6 +1222,54 @@ qeth_probe_device(struct ccwgroup_device *gdev)
1204} 1222}
1205 1223
1206 1224
1225static int qeth_read_conf_data(struct qeth_card *card, void **buffer,
1226 int *length)
1227{
1228 struct ciw *ciw;
1229 char *rcd_buf;
1230 int ret;
1231 struct qeth_channel *channel = &card->data;
1232 unsigned long flags;
1233
1234 /*
1235 * scan for RCD command in extended SenseID data
1236 */
1237 ciw = ccw_device_get_ciw(channel->ccwdev, CIW_TYPE_RCD);
1238 if (!ciw || ciw->cmd == 0)
1239 return -EOPNOTSUPP;
1240 rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
1241 if (!rcd_buf)
1242 return -ENOMEM;
1243
1244 channel->ccw.cmd_code = ciw->cmd;
1245 channel->ccw.cda = (__u32) __pa (rcd_buf);
1246 channel->ccw.count = ciw->count;
1247 channel->ccw.flags = CCW_FLAG_SLI;
1248 channel->state = CH_STATE_RCD;
1249 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
1250 ret = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
1251 QETH_RCD_PARM, LPM_ANYPATH, 0,
1252 QETH_RCD_TIMEOUT);
1253 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
1254 if (!ret)
1255 wait_event(card->wait_q,
1256 (channel->state == CH_STATE_RCD_DONE ||
1257 channel->state == CH_STATE_DOWN));
1258 if (channel->state == CH_STATE_DOWN)
1259 ret = -EIO;
1260 else
1261 channel->state = CH_STATE_DOWN;
1262 if (ret) {
1263 kfree(rcd_buf);
1264 *buffer = NULL;
1265 *length = 0;
1266 } else {
1267 *length = ciw->count;
1268 *buffer = rcd_buf;
1269 }
1270 return ret;
1271}
1272
1207static int 1273static int
1208qeth_get_unitaddr(struct qeth_card *card) 1274qeth_get_unitaddr(struct qeth_card *card)
1209{ 1275{
@@ -1212,9 +1278,9 @@ qeth_get_unitaddr(struct qeth_card *card)
1212 int rc; 1278 int rc;
1213 1279
1214 QETH_DBF_TEXT(setup, 2, "getunit"); 1280 QETH_DBF_TEXT(setup, 2, "getunit");
1215 rc = read_conf_data(CARD_DDEV(card), (void **) &prcd, &length); 1281 rc = qeth_read_conf_data(card, (void **) &prcd, &length);
1216 if (rc) { 1282 if (rc) {
1217 PRINT_ERR("read_conf_data for device %s returned %i\n", 1283 PRINT_ERR("qeth_read_conf_data for device %s returned %i\n",
1218 CARD_DDEV_ID(card), rc); 1284 CARD_DDEV_ID(card), rc);
1219 return rc; 1285 return rc;
1220 } 1286 }
@@ -1223,6 +1289,7 @@ qeth_get_unitaddr(struct qeth_card *card)
1223 card->info.cula = prcd[63]; 1289 card->info.cula = prcd[63];
1224 card->info.guestlan = ((prcd[0x10] == _ascebc['V']) && 1290 card->info.guestlan = ((prcd[0x10] == _ascebc['V']) &&
1225 (prcd[0x11] == _ascebc['M'])); 1291 (prcd[0x11] == _ascebc['M']));
1292 kfree(prcd);
1226 return 0; 1293 return 0;
1227} 1294}
1228 1295
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h
index 0477c47471c5..d74bc43da72a 100644
--- a/drivers/s390/net/qeth_mpc.h
+++ b/drivers/s390/net/qeth_mpc.h
@@ -37,6 +37,7 @@ extern unsigned char IPA_PDU_HEADER[];
37 37
38#define QETH_CLEAR_CHANNEL_PARM -10 38#define QETH_CLEAR_CHANNEL_PARM -10
39#define QETH_HALT_CHANNEL_PARM -11 39#define QETH_HALT_CHANNEL_PARM -11
40#define QETH_RCD_PARM -12
40 41
41/*****************************************************************************/ 42/*****************************************************************************/
42/* IP Assist related definitions */ 43/* IP Assist related definitions */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 421da1e7c0ea..c1f2d4b14c2b 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -186,7 +186,7 @@ void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
186{ 186{
187 fsf_req->timer.function = zfcp_fsf_request_timeout_handler; 187 fsf_req->timer.function = zfcp_fsf_request_timeout_handler;
188 fsf_req->timer.data = (unsigned long) fsf_req->adapter; 188 fsf_req->timer.data = (unsigned long) fsf_req->adapter;
189 fsf_req->timer.expires = timeout; 189 fsf_req->timer.expires = jiffies + timeout;
190 add_timer(&fsf_req->timer); 190 add_timer(&fsf_req->timer);
191} 191}
192 192
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index ef16f7ca4bb1..4c0a59afd5c8 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -299,9 +299,10 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
299 } 299 }
300 300
301 /* log additional information provided by FSF (if any) */ 301 /* log additional information provided by FSF (if any) */
302 if (unlikely(qtcb->header.log_length)) { 302 if (likely(qtcb->header.log_length)) {
303 /* do not trust them ;-) */ 303 /* do not trust them ;-) */
304 if (qtcb->header.log_start > sizeof(struct fsf_qtcb)) { 304 if (unlikely(qtcb->header.log_start >
305 sizeof(struct fsf_qtcb))) {
305 ZFCP_LOG_NORMAL 306 ZFCP_LOG_NORMAL
306 ("bug: ULP (FSF logging) log data starts " 307 ("bug: ULP (FSF logging) log data starts "
307 "beyond end of packet header. Ignored. " 308 "beyond end of packet header. Ignored. "
@@ -310,8 +311,9 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
310 sizeof(struct fsf_qtcb)); 311 sizeof(struct fsf_qtcb));
311 goto forget_log; 312 goto forget_log;
312 } 313 }
313 if ((size_t) (qtcb->header.log_start + qtcb->header.log_length) 314 if (unlikely((size_t) (qtcb->header.log_start +
314 > sizeof(struct fsf_qtcb)) { 315 qtcb->header.log_length) >
316 sizeof(struct fsf_qtcb))) {
315 ZFCP_LOG_NORMAL("bug: ULP (FSF logging) log data ends " 317 ZFCP_LOG_NORMAL("bug: ULP (FSF logging) log data ends "
316 "beyond end of packet header. Ignored. " 318 "beyond end of packet header. Ignored. "
317 "(start=%i, length=%i, size=%li)\n", 319 "(start=%i, length=%i, size=%li)\n",
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
index eee590a51d8a..002643392d42 100644
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -6,7 +6,6 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/pci.h>
10#include <linux/device.h> 9#include <linux/device.h>
11 10
12#include <asm/system.h> 11#include <asm/system.h>
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index e874b8944875..96f4cab07614 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -579,17 +579,17 @@ static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapt
579 /* 579 /*
580 Append the list of standard BusLogic MultiMaster ISA I/O Addresses. 580 Append the list of standard BusLogic MultiMaster ISA I/O Addresses.
581 */ 581 */
582 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe330 : check_region(0x330, BusLogic_MultiMasterAddressCount) == 0) 582 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe330)
583 BusLogic_AppendProbeAddressISA(0x330); 583 BusLogic_AppendProbeAddressISA(0x330);
584 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe334 : check_region(0x334, BusLogic_MultiMasterAddressCount) == 0) 584 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe334)
585 BusLogic_AppendProbeAddressISA(0x334); 585 BusLogic_AppendProbeAddressISA(0x334);
586 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe230 : check_region(0x230, BusLogic_MultiMasterAddressCount) == 0) 586 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe230)
587 BusLogic_AppendProbeAddressISA(0x230); 587 BusLogic_AppendProbeAddressISA(0x230);
588 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe234 : check_region(0x234, BusLogic_MultiMasterAddressCount) == 0) 588 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe234)
589 BusLogic_AppendProbeAddressISA(0x234); 589 BusLogic_AppendProbeAddressISA(0x234);
590 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe130 : check_region(0x130, BusLogic_MultiMasterAddressCount) == 0) 590 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe130)
591 BusLogic_AppendProbeAddressISA(0x130); 591 BusLogic_AppendProbeAddressISA(0x130);
592 if (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe134 : check_region(0x134, BusLogic_MultiMasterAddressCount) == 0) 592 if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe134)
593 BusLogic_AppendProbeAddressISA(0x134); 593 BusLogic_AppendProbeAddressISA(0x134);
594} 594}
595 595
@@ -795,7 +795,9 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
795 host adapters are probed. 795 host adapters are probed.
796 */ 796 */
797 if (!BusLogic_ProbeOptions.NoProbeISA) 797 if (!BusLogic_ProbeOptions.NoProbeISA)
798 if (PrimaryProbeInfo->IO_Address == 0 && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe330 : check_region(0x330, BusLogic_MultiMasterAddressCount) == 0)) { 798 if (PrimaryProbeInfo->IO_Address == 0 &&
799 (!BusLogic_ProbeOptions.LimitedProbeISA ||
800 BusLogic_ProbeOptions.Probe330)) {
799 PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; 801 PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster;
800 PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; 802 PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus;
801 PrimaryProbeInfo->IO_Address = 0x330; 803 PrimaryProbeInfo->IO_Address = 0x330;
@@ -805,15 +807,25 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
805 omitting the Primary I/O Address which has already been handled. 807 omitting the Primary I/O Address which has already been handled.
806 */ 808 */
807 if (!BusLogic_ProbeOptions.NoProbeISA) { 809 if (!BusLogic_ProbeOptions.NoProbeISA) {
808 if (!StandardAddressSeen[1] && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe334 : check_region(0x334, BusLogic_MultiMasterAddressCount) == 0)) 810 if (!StandardAddressSeen[1] &&
811 (!BusLogic_ProbeOptions.LimitedProbeISA ||
812 BusLogic_ProbeOptions.Probe334))
809 BusLogic_AppendProbeAddressISA(0x334); 813 BusLogic_AppendProbeAddressISA(0x334);
810 if (!StandardAddressSeen[2] && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe230 : check_region(0x230, BusLogic_MultiMasterAddressCount) == 0)) 814 if (!StandardAddressSeen[2] &&
815 (!BusLogic_ProbeOptions.LimitedProbeISA ||
816 BusLogic_ProbeOptions.Probe230))
811 BusLogic_AppendProbeAddressISA(0x230); 817 BusLogic_AppendProbeAddressISA(0x230);
812 if (!StandardAddressSeen[3] && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe234 : check_region(0x234, BusLogic_MultiMasterAddressCount) == 0)) 818 if (!StandardAddressSeen[3] &&
819 (!BusLogic_ProbeOptions.LimitedProbeISA ||
820 BusLogic_ProbeOptions.Probe234))
813 BusLogic_AppendProbeAddressISA(0x234); 821 BusLogic_AppendProbeAddressISA(0x234);
814 if (!StandardAddressSeen[4] && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe130 : check_region(0x130, BusLogic_MultiMasterAddressCount) == 0)) 822 if (!StandardAddressSeen[4] &&
823 (!BusLogic_ProbeOptions.LimitedProbeISA ||
824 BusLogic_ProbeOptions.Probe130))
815 BusLogic_AppendProbeAddressISA(0x130); 825 BusLogic_AppendProbeAddressISA(0x130);
816 if (!StandardAddressSeen[5] && (BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe134 : check_region(0x134, BusLogic_MultiMasterAddressCount) == 0)) 826 if (!StandardAddressSeen[5] &&
827 (!BusLogic_ProbeOptions.LimitedProbeISA ||
828 BusLogic_ProbeOptions.Probe134))
817 BusLogic_AppendProbeAddressISA(0x134); 829 BusLogic_AppendProbeAddressISA(0x134);
818 } 830 }
819 /* 831 /*
@@ -2220,22 +2232,35 @@ static int __init BusLogic_init(void)
2220 HostAdapter->PCI_Device = ProbeInfo->PCI_Device; 2232 HostAdapter->PCI_Device = ProbeInfo->PCI_Device;
2221 HostAdapter->IRQ_Channel = ProbeInfo->IRQ_Channel; 2233 HostAdapter->IRQ_Channel = ProbeInfo->IRQ_Channel;
2222 HostAdapter->AddressCount = BusLogic_HostAdapterAddressCount[HostAdapter->HostAdapterType]; 2234 HostAdapter->AddressCount = BusLogic_HostAdapterAddressCount[HostAdapter->HostAdapterType];
2235
2236 /*
2237 Make sure region is free prior to probing.
2238 */
2239 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount,
2240 "BusLogic"))
2241 continue;
2223 /* 2242 /*
2224 Probe the Host Adapter. If unsuccessful, abort further initialization. 2243 Probe the Host Adapter. If unsuccessful, abort further initialization.
2225 */ 2244 */
2226 if (!BusLogic_ProbeHostAdapter(HostAdapter)) 2245 if (!BusLogic_ProbeHostAdapter(HostAdapter)) {
2246 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2227 continue; 2247 continue;
2248 }
2228 /* 2249 /*
2229 Hard Reset the Host Adapter. If unsuccessful, abort further 2250 Hard Reset the Host Adapter. If unsuccessful, abort further
2230 initialization. 2251 initialization.
2231 */ 2252 */
2232 if (!BusLogic_HardwareResetHostAdapter(HostAdapter, true)) 2253 if (!BusLogic_HardwareResetHostAdapter(HostAdapter, true)) {
2254 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2233 continue; 2255 continue;
2256 }
2234 /* 2257 /*
2235 Check the Host Adapter. If unsuccessful, abort further initialization. 2258 Check the Host Adapter. If unsuccessful, abort further initialization.
2236 */ 2259 */
2237 if (!BusLogic_CheckHostAdapter(HostAdapter)) 2260 if (!BusLogic_CheckHostAdapter(HostAdapter)) {
2261 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2238 continue; 2262 continue;
2263 }
2239 /* 2264 /*
2240 Initialize the Driver Options field if provided. 2265 Initialize the Driver Options field if provided.
2241 */ 2266 */
@@ -2247,16 +2272,6 @@ static int __init BusLogic_init(void)
2247 */ 2272 */
2248 BusLogic_AnnounceDriver(HostAdapter); 2273 BusLogic_AnnounceDriver(HostAdapter);
2249 /* 2274 /*
2250 Register usage of the I/O Address range. From this point onward, any
2251 failure will be assumed to be due to a problem with the Host Adapter,
2252 rather than due to having mistakenly identified this port as belonging
2253 to a BusLogic Host Adapter. The I/O Address range will not be
2254 released, thereby preventing it from being incorrectly identified as
2255 any other type of Host Adapter.
2256 */
2257 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, "BusLogic"))
2258 continue;
2259 /*
2260 Register the SCSI Host structure. 2275 Register the SCSI Host structure.
2261 */ 2276 */
2262 2277
@@ -2280,6 +2295,12 @@ static int __init BusLogic_init(void)
2280 Acquire the System Resources necessary to use the Host Adapter, then 2295 Acquire the System Resources necessary to use the Host Adapter, then
2281 Create the Initial CCBs, Initialize the Host Adapter, and finally 2296 Create the Initial CCBs, Initialize the Host Adapter, and finally
2282 perform Target Device Inquiry. 2297 perform Target Device Inquiry.
2298
2299 From this point onward, any failure will be assumed to be due to a
2300 problem with the Host Adapter, rather than due to having mistakenly
2301 identified this port as belonging to a BusLogic Host Adapter. The
2302 I/O Address range will not be released, thereby preventing it from
2303 being incorrectly identified as any other type of Host Adapter.
2283 */ 2304 */
2284 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) && 2305 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2285 BusLogic_ReportHostAdapterConfiguration(HostAdapter) && 2306 BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
@@ -3598,6 +3619,7 @@ static void __exit BusLogic_exit(void)
3598 3619
3599__setup("BusLogic=", BusLogic_Setup); 3620__setup("BusLogic=", BusLogic_Setup);
3600 3621
3622#ifdef MODULE
3601static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = { 3623static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = {
3602 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, 3624 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
3603 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 3625 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -3607,6 +3629,7 @@ static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = {
3607 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 3629 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3608 { } 3630 { }
3609}; 3631};
3632#endif
3610MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl); 3633MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl);
3611 3634
3612module_init(BusLogic_init); 3635module_init(BusLogic_init);
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index fcc4cb6c7f46..e62d23f65180 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -170,7 +170,7 @@ config CHR_DEV_SCH
170 170
171 If you want to compile this as a module ( = code which can be 171 If you want to compile this as a module ( = code which can be
172 inserted in and removed from the running kernel whenever you want), 172 inserted in and removed from the running kernel whenever you want),
173 say M here and read <file:Documentation/modules.txt> and 173 say M here and read <file:Documentation/kbuild/modules.txt> and
174 <file:Documentation/scsi.txt>. The module will be called ch.o. 174 <file:Documentation/scsi.txt>. The module will be called ch.o.
175 If unsure, say N. 175 If unsure, say N.
176 176
@@ -241,6 +241,12 @@ config SCSI_SCAN_ASYNC
241 You can override this choice by specifying "scsi_mod.scan=sync" 241 You can override this choice by specifying "scsi_mod.scan=sync"
242 or async on the kernel's command line. 242 or async on the kernel's command line.
243 243
244config SCSI_WAIT_SCAN
245 tristate
246 default m
247 depends on SCSI
248 depends on MODULES
249
244menu "SCSI Transports" 250menu "SCSI Transports"
245 depends on SCSI 251 depends on SCSI
246 252
@@ -1194,17 +1200,6 @@ config SCSI_NCR53C8XX_SYNC
1194 There is no safe option other than using good cabling, right 1200 There is no safe option other than using good cabling, right
1195 terminations and SCSI conformant devices. 1201 terminations and SCSI conformant devices.
1196 1202
1197config SCSI_NCR53C8XX_PROFILE
1198 bool "enable profiling"
1199 depends on SCSI_ZALON || SCSI_NCR_Q720
1200 help
1201 This option allows you to enable profiling information gathering.
1202 These statistics are not very accurate due to the low frequency
1203 of the kernel clock (100 Hz on i386) and have performance impact
1204 on systems that use very fast devices.
1205
1206 The normal answer therefore is N.
1207
1208config SCSI_NCR53C8XX_NO_DISCONNECT 1203config SCSI_NCR53C8XX_NO_DISCONNECT
1209 bool "not allow targets to disconnect" 1204 bool "not allow targets to disconnect"
1210 depends on (SCSI_ZALON || SCSI_NCR_Q720) && SCSI_NCR53C8XX_DEFAULT_TAGS=0 1205 depends on (SCSI_ZALON || SCSI_NCR_Q720) && SCSI_NCR53C8XX_DEFAULT_TAGS=0
@@ -1334,11 +1329,6 @@ config SCSI_SIM710
1334 1329
1335 It currently supports Compaq EISA cards and NCR MCA cards 1330 It currently supports Compaq EISA cards and NCR MCA cards
1336 1331
1337config 53C700_IO_MAPPED
1338 bool
1339 depends on SCSI_SIM710
1340 default y
1341
1342config SCSI_SYM53C416 1332config SCSI_SYM53C416
1343 tristate "Symbios 53c416 SCSI support" 1333 tristate "Symbios 53c416 SCSI support"
1344 depends on ISA && SCSI 1334 depends on ISA && SCSI
@@ -1649,7 +1639,7 @@ config OKTAGON_SCSI
1649 1639
1650config ATARI_SCSI 1640config ATARI_SCSI
1651 tristate "Atari native SCSI support" 1641 tristate "Atari native SCSI support"
1652 depends on ATARI && SCSI && BROKEN 1642 depends on ATARI && SCSI
1653 select SCSI_SPI_ATTRS 1643 select SCSI_SPI_ATTRS
1654 ---help--- 1644 ---help---
1655 If you have an Atari with built-in NCR5380 SCSI controller (TT, 1645 If you have an Atari with built-in NCR5380 SCSI controller (TT,
@@ -1793,7 +1783,7 @@ config ZFCP
1793 1783
1794 This driver is also available as a module. This module will be 1784 This driver is also available as a module. This module will be
1795 called zfcp. If you want to compile it as a module, say M here 1785 called zfcp. If you want to compile it as a module, say M here
1796 and read <file:Documentation/modules.txt>. 1786 and read <file:Documentation/kbuild/modules.txt>.
1797 1787
1798config SCSI_SRP 1788config SCSI_SRP
1799 tristate "SCSI RDMA Protocol helper library" 1789 tristate "SCSI RDMA Protocol helper library"
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 70cff4c599d7..51e884fa10b0 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -146,7 +146,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o
146# This goes last, so that "real" scsi devices probe earlier 146# This goes last, so that "real" scsi devices probe earlier
147obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o 147obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
148 148
149obj-$(CONFIG_SCSI) += scsi_wait_scan.o 149obj-$(CONFIG_SCSI_WAIT_SCAN) += scsi_wait_scan.o
150 150
151scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \ 151scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \
152 scsicam.o scsi_error.o scsi_lib.o \ 152 scsicam.o scsi_error.o scsi_lib.o \
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index d789e61bdc49..1e82c69b36b0 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -172,6 +172,30 @@ MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size.
172int expose_physicals = -1; 172int expose_physicals = -1;
173module_param(expose_physicals, int, S_IRUGO|S_IWUSR); 173module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); 174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on");
175
176
177static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
178 struct fib *fibptr) {
179 struct scsi_device *device;
180
181 if (unlikely(!scsicmd || !scsicmd->scsi_done )) {
182 dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"))
183;
184 aac_fib_complete(fibptr);
185 aac_fib_free(fibptr);
186 return 0;
187 }
188 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
189 device = scsicmd->device;
190 if (unlikely(!device || !scsi_device_online(device))) {
191 dprintk((KERN_WARNING "aac_valid_context: scsi device corrupt\n"));
192 aac_fib_complete(fibptr);
193 aac_fib_free(fibptr);
194 return 0;
195 }
196 return 1;
197}
198
175/** 199/**
176 * aac_get_config_status - check the adapter configuration 200 * aac_get_config_status - check the adapter configuration
177 * @common: adapter to query 201 * @common: adapter to query
@@ -258,13 +282,10 @@ int aac_get_containers(struct aac_dev *dev)
258 u32 index; 282 u32 index;
259 int status = 0; 283 int status = 0;
260 struct fib * fibptr; 284 struct fib * fibptr;
261 unsigned instance;
262 struct aac_get_container_count *dinfo; 285 struct aac_get_container_count *dinfo;
263 struct aac_get_container_count_resp *dresp; 286 struct aac_get_container_count_resp *dresp;
264 int maximum_num_containers = MAXIMUM_NUM_CONTAINERS; 287 int maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
265 288
266 instance = dev->scsi_host_ptr->unique_id;
267
268 if (!(fibptr = aac_fib_alloc(dev))) 289 if (!(fibptr = aac_fib_alloc(dev)))
269 return -ENOMEM; 290 return -ENOMEM;
270 291
@@ -284,88 +305,35 @@ int aac_get_containers(struct aac_dev *dev)
284 maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); 305 maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries);
285 aac_fib_complete(fibptr); 306 aac_fib_complete(fibptr);
286 } 307 }
308 aac_fib_free(fibptr);
287 309
288 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) 310 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
289 maximum_num_containers = MAXIMUM_NUM_CONTAINERS; 311 maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
290 fsa_dev_ptr = kmalloc( 312 fsa_dev_ptr = kmalloc(sizeof(*fsa_dev_ptr) * maximum_num_containers,
291 sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); 313 GFP_KERNEL);
292 if (!fsa_dev_ptr) { 314 if (!fsa_dev_ptr)
293 aac_fib_free(fibptr);
294 return -ENOMEM; 315 return -ENOMEM;
295 }
296 memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); 316 memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers);
297 317
298 dev->fsa_dev = fsa_dev_ptr; 318 dev->fsa_dev = fsa_dev_ptr;
299 dev->maximum_num_containers = maximum_num_containers; 319 dev->maximum_num_containers = maximum_num_containers;
300 320
301 for (index = 0; index < dev->maximum_num_containers; index++) { 321 for (index = 0; index < dev->maximum_num_containers; ) {
302 struct aac_query_mount *dinfo;
303 struct aac_mount *dresp;
304
305 fsa_dev_ptr[index].devname[0] = '\0'; 322 fsa_dev_ptr[index].devname[0] = '\0';
306 323
307 aac_fib_init(fibptr); 324 status = aac_probe_container(dev, index);
308 dinfo = (struct aac_query_mount *) fib_data(fibptr);
309
310 dinfo->command = cpu_to_le32(VM_NameServe);
311 dinfo->count = cpu_to_le32(index);
312 dinfo->type = cpu_to_le32(FT_FILESYS);
313 325
314 status = aac_fib_send(ContainerCommand, 326 if (status < 0) {
315 fibptr,
316 sizeof (struct aac_query_mount),
317 FsaNormal,
318 1, 1,
319 NULL, NULL);
320 if (status < 0 ) {
321 printk(KERN_WARNING "aac_get_containers: SendFIB failed.\n"); 327 printk(KERN_WARNING "aac_get_containers: SendFIB failed.\n");
322 break; 328 break;
323 } 329 }
324 dresp = (struct aac_mount *)fib_data(fibptr);
325 330
326 if ((le32_to_cpu(dresp->status) == ST_OK) &&
327 (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) {
328 dinfo->command = cpu_to_le32(VM_NameServe64);
329 dinfo->count = cpu_to_le32(index);
330 dinfo->type = cpu_to_le32(FT_FILESYS);
331
332 if (aac_fib_send(ContainerCommand,
333 fibptr,
334 sizeof(struct aac_query_mount),
335 FsaNormal,
336 1, 1,
337 NULL, NULL) < 0)
338 continue;
339 } else
340 dresp->mnt[0].capacityhigh = 0;
341
342 dprintk ((KERN_DEBUG
343 "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n",
344 (int)index, (int)le32_to_cpu(dresp->status),
345 (int)le32_to_cpu(dresp->mnt[0].vol),
346 (int)le32_to_cpu(dresp->mnt[0].state),
347 ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
348 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32)));
349 if ((le32_to_cpu(dresp->status) == ST_OK) &&
350 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) &&
351 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) {
352 fsa_dev_ptr[index].valid = 1;
353 fsa_dev_ptr[index].type = le32_to_cpu(dresp->mnt[0].vol);
354 fsa_dev_ptr[index].size
355 = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
356 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32);
357 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY)
358 fsa_dev_ptr[index].ro = 1;
359 }
360 aac_fib_complete(fibptr);
361 /* 331 /*
362 * If there are no more containers, then stop asking. 332 * If there are no more containers, then stop asking.
363 */ 333 */
364 if ((index + 1) >= le32_to_cpu(dresp->count)){ 334 if (++index >= status)
365 break; 335 break;
366 }
367 } 336 }
368 aac_fib_free(fibptr);
369 return status; 337 return status;
370} 338}
371 339
@@ -382,8 +350,9 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne
382 buf = scsicmd->request_buffer; 350 buf = scsicmd->request_buffer;
383 transfer_len = min(scsicmd->request_bufflen, len + offset); 351 transfer_len = min(scsicmd->request_bufflen, len + offset);
384 } 352 }
385 353 transfer_len -= offset;
386 memcpy(buf + offset, data, transfer_len - offset); 354 if (buf && transfer_len)
355 memcpy(buf + offset, data, transfer_len);
387 356
388 if (scsicmd->use_sg) 357 if (scsicmd->use_sg)
389 kunmap_atomic(buf - sg->offset, KM_IRQ0); 358 kunmap_atomic(buf - sg->offset, KM_IRQ0);
@@ -396,7 +365,9 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
396 struct scsi_cmnd * scsicmd; 365 struct scsi_cmnd * scsicmd;
397 366
398 scsicmd = (struct scsi_cmnd *) context; 367 scsicmd = (struct scsi_cmnd *) context;
399 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 368
369 if (!aac_valid_context(scsicmd, fibptr))
370 return;
400 371
401 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); 372 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
402 BUG_ON(fibptr == NULL); 373 BUG_ON(fibptr == NULL);
@@ -431,7 +402,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
431/** 402/**
432 * aac_get_container_name - get container name, none blocking. 403 * aac_get_container_name - get container name, none blocking.
433 */ 404 */
434static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) 405static int aac_get_container_name(struct scsi_cmnd * scsicmd)
435{ 406{
436 int status; 407 int status;
437 struct aac_get_name *dinfo; 408 struct aac_get_name *dinfo;
@@ -448,7 +419,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
448 419
449 dinfo->command = cpu_to_le32(VM_ContainerConfig); 420 dinfo->command = cpu_to_le32(VM_ContainerConfig);
450 dinfo->type = cpu_to_le32(CT_READ_NAME); 421 dinfo->type = cpu_to_le32(CT_READ_NAME);
451 dinfo->cid = cpu_to_le32(cid); 422 dinfo->cid = cpu_to_le32(scmd_id(scsicmd));
452 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); 423 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
453 424
454 status = aac_fib_send(ContainerCommand, 425 status = aac_fib_send(ContainerCommand,
@@ -473,85 +444,192 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
473 return -1; 444 return -1;
474} 445}
475 446
476/** 447static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd)
477 * aac_probe_container - query a logical volume 448{
478 * @dev: device to query 449 struct fsa_dev_info *fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev;
479 * @cid: container identifier 450
480 * 451 if (fsa_dev_ptr[scmd_id(scsicmd)].valid)
481 * Queries the controller about the given volume. The volume information 452 return aac_scsi_cmd(scsicmd);
482 * is updated in the struct fsa_dev_info structure rather than returned. 453
483 */ 454 scsicmd->result = DID_NO_CONNECT << 16;
484 455 scsicmd->scsi_done(scsicmd);
485int aac_probe_container(struct aac_dev *dev, int cid) 456 return 0;
457}
458
459static int _aac_probe_container2(void * context, struct fib * fibptr)
486{ 460{
487 struct fsa_dev_info *fsa_dev_ptr; 461 struct fsa_dev_info *fsa_dev_ptr;
488 int status; 462 int (*callback)(struct scsi_cmnd *);
463 struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context;
464
465 if (!aac_valid_context(scsicmd, fibptr))
466 return 0;
467
468 fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev;
469
470 scsicmd->SCp.Status = 0;
471 if (fsa_dev_ptr) {
472 struct aac_mount * dresp = (struct aac_mount *) fib_data(fibptr);
473 fsa_dev_ptr += scmd_id(scsicmd);
474
475 if ((le32_to_cpu(dresp->status) == ST_OK) &&
476 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) &&
477 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) {
478 fsa_dev_ptr->valid = 1;
479 fsa_dev_ptr->type = le32_to_cpu(dresp->mnt[0].vol);
480 fsa_dev_ptr->size
481 = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) +
482 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32);
483 fsa_dev_ptr->ro = ((le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) != 0);
484 }
485 if ((fsa_dev_ptr->valid & 1) == 0)
486 fsa_dev_ptr->valid = 0;
487 scsicmd->SCp.Status = le32_to_cpu(dresp->count);
488 }
489 aac_fib_complete(fibptr);
490 aac_fib_free(fibptr);
491 callback = (int (*)(struct scsi_cmnd *))(scsicmd->SCp.ptr);
492 scsicmd->SCp.ptr = NULL;
493 return (*callback)(scsicmd);
494}
495
496static int _aac_probe_container1(void * context, struct fib * fibptr)
497{
498 struct scsi_cmnd * scsicmd;
499 struct aac_mount * dresp;
489 struct aac_query_mount *dinfo; 500 struct aac_query_mount *dinfo;
490 struct aac_mount *dresp; 501 int status;
491 struct fib * fibptr;
492 unsigned instance;
493 502
494 fsa_dev_ptr = dev->fsa_dev; 503 dresp = (struct aac_mount *) fib_data(fibptr);
495 if (!fsa_dev_ptr) 504 dresp->mnt[0].capacityhigh = 0;
496 return -ENOMEM; 505 if ((le32_to_cpu(dresp->status) != ST_OK) ||
497 instance = dev->scsi_host_ptr->unique_id; 506 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE))
507 return _aac_probe_container2(context, fibptr);
508 scsicmd = (struct scsi_cmnd *) context;
509 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
498 510
499 if (!(fibptr = aac_fib_alloc(dev))) 511 if (!aac_valid_context(scsicmd, fibptr))
500 return -ENOMEM; 512 return 0;
501 513
502 aac_fib_init(fibptr); 514 aac_fib_init(fibptr);
503 515
504 dinfo = (struct aac_query_mount *)fib_data(fibptr); 516 dinfo = (struct aac_query_mount *)fib_data(fibptr);
505 517
506 dinfo->command = cpu_to_le32(VM_NameServe); 518 dinfo->command = cpu_to_le32(VM_NameServe64);
507 dinfo->count = cpu_to_le32(cid); 519 dinfo->count = cpu_to_le32(scmd_id(scsicmd));
508 dinfo->type = cpu_to_le32(FT_FILESYS); 520 dinfo->type = cpu_to_le32(FT_FILESYS);
509 521
510 status = aac_fib_send(ContainerCommand, 522 status = aac_fib_send(ContainerCommand,
511 fibptr, 523 fibptr,
512 sizeof(struct aac_query_mount), 524 sizeof(struct aac_query_mount),
513 FsaNormal, 525 FsaNormal,
514 1, 1, 526 0, 1,
515 NULL, NULL); 527 (fib_callback) _aac_probe_container2,
528 (void *) scsicmd);
529 /*
530 * Check that the command queued to the controller
531 */
532 if (status == -EINPROGRESS) {
533 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
534 return 0;
535 }
516 if (status < 0) { 536 if (status < 0) {
517 printk(KERN_WARNING "aacraid: aac_probe_container query failed.\n"); 537 /* Inherit results from VM_NameServe, if any */
518 goto error; 538 dresp->status = cpu_to_le32(ST_OK);
539 return _aac_probe_container2(context, fibptr);
519 } 540 }
541 return 0;
542}
520 543
521 dresp = (struct aac_mount *) fib_data(fibptr); 544static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(struct scsi_cmnd *))
545{
546 struct fib * fibptr;
547 int status = -ENOMEM;
522 548
523 if ((le32_to_cpu(dresp->status) == ST_OK) && 549 if ((fibptr = aac_fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) {
524 (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { 550 struct aac_query_mount *dinfo;
525 dinfo->command = cpu_to_le32(VM_NameServe64);
526 dinfo->count = cpu_to_le32(cid);
527 dinfo->type = cpu_to_le32(FT_FILESYS);
528 551
529 if (aac_fib_send(ContainerCommand, 552 aac_fib_init(fibptr);
530 fibptr, 553
531 sizeof(struct aac_query_mount), 554 dinfo = (struct aac_query_mount *)fib_data(fibptr);
532 FsaNormal, 555
533 1, 1, 556 dinfo->command = cpu_to_le32(VM_NameServe);
534 NULL, NULL) < 0) 557 dinfo->count = cpu_to_le32(scmd_id(scsicmd));
535 goto error; 558 dinfo->type = cpu_to_le32(FT_FILESYS);
536 } else 559 scsicmd->SCp.ptr = (char *)callback;
537 dresp->mnt[0].capacityhigh = 0;
538 560
539 if ((le32_to_cpu(dresp->status) == ST_OK) && 561 status = aac_fib_send(ContainerCommand,
540 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && 562 fibptr,
541 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { 563 sizeof(struct aac_query_mount),
542 fsa_dev_ptr[cid].valid = 1; 564 FsaNormal,
543 fsa_dev_ptr[cid].type = le32_to_cpu(dresp->mnt[0].vol); 565 0, 1,
544 fsa_dev_ptr[cid].size 566 (fib_callback) _aac_probe_container1,
545 = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + 567 (void *) scsicmd);
546 (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32); 568 /*
547 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) 569 * Check that the command queued to the controller
548 fsa_dev_ptr[cid].ro = 1; 570 */
571 if (status == -EINPROGRESS) {
572 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
573 return 0;
574 }
575 if (status < 0) {
576 scsicmd->SCp.ptr = NULL;
577 aac_fib_complete(fibptr);
578 aac_fib_free(fibptr);
579 }
549 } 580 }
581 if (status < 0) {
582 struct fsa_dev_info *fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev;
583 if (fsa_dev_ptr) {
584 fsa_dev_ptr += scmd_id(scsicmd);
585 if ((fsa_dev_ptr->valid & 1) == 0) {
586 fsa_dev_ptr->valid = 0;
587 return (*callback)(scsicmd);
588 }
589 }
590 }
591 return status;
592}
550 593
551error: 594/**
552 aac_fib_complete(fibptr); 595 * aac_probe_container - query a logical volume
553 aac_fib_free(fibptr); 596 * @dev: device to query
597 * @cid: container identifier
598 *
599 * Queries the controller about the given volume. The volume information
600 * is updated in the struct fsa_dev_info structure rather than returned.
601 */
602static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
603{
604 scsicmd->device = NULL;
605 return 0;
606}
607
608int aac_probe_container(struct aac_dev *dev, int cid)
609{
610 struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
611 struct scsi_device *scsidev = kmalloc(sizeof(*scsidev), GFP_KERNEL);
612 int status;
554 613
614 if (!scsicmd || !scsidev) {
615 kfree(scsicmd);
616 kfree(scsidev);
617 return -ENOMEM;
618 }
619 scsicmd->list.next = NULL;
620 scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))_aac_probe_container1;
621
622 scsicmd->device = scsidev;
623 scsidev->sdev_state = 0;
624 scsidev->id = cid;
625 scsidev->host = dev->scsi_host_ptr;
626
627 if (_aac_probe_container(scsicmd, aac_probe_container_callback1) == 0)
628 while (scsicmd->device == scsidev)
629 schedule();
630 kfree(scsidev);
631 status = scsicmd->SCp.Status;
632 kfree(scsicmd);
555 return status; 633 return status;
556} 634}
557 635
@@ -1115,6 +1193,12 @@ int aac_get_adapter_info(struct aac_dev* dev)
1115 printk(KERN_INFO "%s%d: serial %x\n", 1193 printk(KERN_INFO "%s%d: serial %x\n",
1116 dev->name, dev->id, 1194 dev->name, dev->id,
1117 le32_to_cpu(dev->adapter_info.serial[0])); 1195 le32_to_cpu(dev->adapter_info.serial[0]));
1196 if (dev->supplement_adapter_info.VpdInfo.Tsid[0]) {
1197 printk(KERN_INFO "%s%d: TSID %.*s\n",
1198 dev->name, dev->id,
1199 (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid),
1200 dev->supplement_adapter_info.VpdInfo.Tsid);
1201 }
1118 } 1202 }
1119 1203
1120 dev->nondasd_support = 0; 1204 dev->nondasd_support = 0;
@@ -1241,7 +1325,9 @@ static void io_callback(void *context, struct fib * fibptr)
1241 u32 cid; 1325 u32 cid;
1242 1326
1243 scsicmd = (struct scsi_cmnd *) context; 1327 scsicmd = (struct scsi_cmnd *) context;
1244 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 1328
1329 if (!aac_valid_context(scsicmd, fibptr))
1330 return;
1245 1331
1246 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 1332 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
1247 cid = scmd_id(scsicmd); 1333 cid = scmd_id(scsicmd);
@@ -1317,7 +1403,7 @@ static void io_callback(void *context, struct fib * fibptr)
1317 scsicmd->scsi_done(scsicmd); 1403 scsicmd->scsi_done(scsicmd);
1318} 1404}
1319 1405
1320static int aac_read(struct scsi_cmnd * scsicmd, int cid) 1406static int aac_read(struct scsi_cmnd * scsicmd)
1321{ 1407{
1322 u64 lba; 1408 u64 lba;
1323 u32 count; 1409 u32 count;
@@ -1331,7 +1417,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1331 */ 1417 */
1332 switch (scsicmd->cmnd[0]) { 1418 switch (scsicmd->cmnd[0]) {
1333 case READ_6: 1419 case READ_6:
1334 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", cid)); 1420 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd)));
1335 1421
1336 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | 1422 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
1337 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; 1423 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
@@ -1341,7 +1427,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1341 count = 256; 1427 count = 256;
1342 break; 1428 break;
1343 case READ_16: 1429 case READ_16:
1344 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", cid)); 1430 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd)));
1345 1431
1346 lba = ((u64)scsicmd->cmnd[2] << 56) | 1432 lba = ((u64)scsicmd->cmnd[2] << 56) |
1347 ((u64)scsicmd->cmnd[3] << 48) | 1433 ((u64)scsicmd->cmnd[3] << 48) |
@@ -1355,7 +1441,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1355 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; 1441 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
1356 break; 1442 break;
1357 case READ_12: 1443 case READ_12:
1358 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", cid)); 1444 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd)));
1359 1445
1360 lba = ((u64)scsicmd->cmnd[2] << 24) | 1446 lba = ((u64)scsicmd->cmnd[2] << 24) |
1361 (scsicmd->cmnd[3] << 16) | 1447 (scsicmd->cmnd[3] << 16) |
@@ -1365,7 +1451,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1365 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; 1451 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1366 break; 1452 break;
1367 default: 1453 default:
1368 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid)); 1454 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd)));
1369 1455
1370 lba = ((u64)scsicmd->cmnd[2] << 24) | 1456 lba = ((u64)scsicmd->cmnd[2] << 24) |
1371 (scsicmd->cmnd[3] << 16) | 1457 (scsicmd->cmnd[3] << 16) |
@@ -1405,7 +1491,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1405 return 0; 1491 return 0;
1406} 1492}
1407 1493
1408static int aac_write(struct scsi_cmnd * scsicmd, int cid) 1494static int aac_write(struct scsi_cmnd * scsicmd)
1409{ 1495{
1410 u64 lba; 1496 u64 lba;
1411 u32 count; 1497 u32 count;
@@ -1424,7 +1510,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1424 if (count == 0) 1510 if (count == 0)
1425 count = 256; 1511 count = 256;
1426 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ 1512 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */
1427 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", cid)); 1513 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd)));
1428 1514
1429 lba = ((u64)scsicmd->cmnd[2] << 56) | 1515 lba = ((u64)scsicmd->cmnd[2] << 56) |
1430 ((u64)scsicmd->cmnd[3] << 48) | 1516 ((u64)scsicmd->cmnd[3] << 48) |
@@ -1436,14 +1522,14 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1436 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | 1522 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) |
1437 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; 1523 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
1438 } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */ 1524 } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */
1439 dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", cid)); 1525 dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", scmd_id(scsicmd)));
1440 1526
1441 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) 1527 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16)
1442 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1528 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1443 count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) 1529 count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16)
1444 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; 1530 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1445 } else { 1531 } else {
1446 dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", cid)); 1532 dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", scmd_id(scsicmd)));
1447 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1533 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1448 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; 1534 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
1449 } 1535 }
@@ -1488,7 +1574,9 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1488 struct scsi_cmnd *cmd; 1574 struct scsi_cmnd *cmd;
1489 1575
1490 cmd = context; 1576 cmd = context;
1491 cmd->SCp.phase = AAC_OWNER_MIDLEVEL; 1577
1578 if (!aac_valid_context(cmd, fibptr))
1579 return;
1492 1580
1493 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", 1581 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n",
1494 smp_processor_id(), jiffies)); 1582 smp_processor_id(), jiffies));
@@ -1523,7 +1611,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1523 cmd->scsi_done(cmd); 1611 cmd->scsi_done(cmd);
1524} 1612}
1525 1613
1526static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) 1614static int aac_synchronize(struct scsi_cmnd *scsicmd)
1527{ 1615{
1528 int status; 1616 int status;
1529 struct fib *cmd_fibcontext; 1617 struct fib *cmd_fibcontext;
@@ -1568,7 +1656,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1568 synchronizecmd = fib_data(cmd_fibcontext); 1656 synchronizecmd = fib_data(cmd_fibcontext);
1569 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); 1657 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig);
1570 synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE); 1658 synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE);
1571 synchronizecmd->cid = cpu_to_le32(cid); 1659 synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd));
1572 synchronizecmd->count = 1660 synchronizecmd->count =
1573 cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data)); 1661 cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));
1574 1662
@@ -1646,29 +1734,12 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1646 case TEST_UNIT_READY: 1734 case TEST_UNIT_READY:
1647 if (dev->in_reset) 1735 if (dev->in_reset)
1648 return -1; 1736 return -1;
1649 spin_unlock_irq(host->host_lock); 1737 return _aac_probe_container(scsicmd,
1650 aac_probe_container(dev, cid); 1738 aac_probe_container_callback2);
1651 if ((fsa_dev_ptr[cid].valid & 1) == 0)
1652 fsa_dev_ptr[cid].valid = 0;
1653 spin_lock_irq(host->host_lock);
1654 if (fsa_dev_ptr[cid].valid == 0) {
1655 scsicmd->result = DID_NO_CONNECT << 16;
1656 scsicmd->scsi_done(scsicmd);
1657 return 0;
1658 }
1659 default: 1739 default:
1660 break; 1740 break;
1661 } 1741 }
1662 } 1742 }
1663 /*
1664 * If the target container still doesn't exist,
1665 * return failure
1666 */
1667 if (fsa_dev_ptr[cid].valid == 0) {
1668 scsicmd->result = DID_BAD_TARGET << 16;
1669 scsicmd->scsi_done(scsicmd);
1670 return 0;
1671 }
1672 } else { /* check for physical non-dasd devices */ 1743 } else { /* check for physical non-dasd devices */
1673 if ((dev->nondasd_support == 1) || expose_physicals) { 1744 if ((dev->nondasd_support == 1) || expose_physicals) {
1674 if (dev->in_reset) 1745 if (dev->in_reset)
@@ -1733,7 +1804,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1733 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); 1804 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type);
1734 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ 1805 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
1735 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1806 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1736 return aac_get_container_name(scsicmd, cid); 1807 return aac_get_container_name(scsicmd);
1737 } 1808 }
1738 case SERVICE_ACTION_IN: 1809 case SERVICE_ACTION_IN:
1739 if (!(dev->raw_io_interface) || 1810 if (!(dev->raw_io_interface) ||
@@ -1899,7 +1970,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1899 min(sizeof(fsa_dev_ptr[cid].devname), 1970 min(sizeof(fsa_dev_ptr[cid].devname),
1900 sizeof(scsicmd->request->rq_disk->disk_name) + 1)); 1971 sizeof(scsicmd->request->rq_disk->disk_name) + 1));
1901 1972
1902 return aac_read(scsicmd, cid); 1973 return aac_read(scsicmd);
1903 1974
1904 case WRITE_6: 1975 case WRITE_6:
1905 case WRITE_10: 1976 case WRITE_10:
@@ -1907,11 +1978,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1907 case WRITE_16: 1978 case WRITE_16:
1908 if (dev->in_reset) 1979 if (dev->in_reset)
1909 return -1; 1980 return -1;
1910 return aac_write(scsicmd, cid); 1981 return aac_write(scsicmd);
1911 1982
1912 case SYNCHRONIZE_CACHE: 1983 case SYNCHRONIZE_CACHE:
1913 /* Issue FIB to tell Firmware to flush it's cache */ 1984 /* Issue FIB to tell Firmware to flush it's cache */
1914 return aac_synchronize(scsicmd, cid); 1985 return aac_synchronize(scsicmd);
1915 1986
1916 default: 1987 default:
1917 /* 1988 /*
@@ -2058,7 +2129,10 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2058 struct scsi_cmnd *scsicmd; 2129 struct scsi_cmnd *scsicmd;
2059 2130
2060 scsicmd = (struct scsi_cmnd *) context; 2131 scsicmd = (struct scsi_cmnd *) context;
2061 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 2132
2133 if (!aac_valid_context(scsicmd, fibptr))
2134 return;
2135
2062 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 2136 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
2063 2137
2064 BUG_ON(fibptr == NULL); 2138 BUG_ON(fibptr == NULL);
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 39ecd0d22eb0..45ca3e801619 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,8 +12,8 @@
12 *----------------------------------------------------------------------------*/ 12 *----------------------------------------------------------------------------*/
13 13
14#ifndef AAC_DRIVER_BUILD 14#ifndef AAC_DRIVER_BUILD
15# define AAC_DRIVER_BUILD 2423 15# define AAC_DRIVER_BUILD 2437
16# define AAC_DRIVER_BRANCH "-mh3" 16# define AAC_DRIVER_BRANCH "-mh4"
17#endif 17#endif
18#define MAXIMUM_NUM_CONTAINERS 32 18#define MAXIMUM_NUM_CONTAINERS 32
19 19
@@ -48,49 +48,13 @@ struct diskparm
48 48
49 49
50/* 50/*
51 * DON'T CHANGE THE ORDER, this is set by the firmware 51 * Firmware constants
52 */ 52 */
53 53
54#define CT_NONE 0 54#define CT_NONE 0
55#define CT_VOLUME 1
56#define CT_MIRROR 2
57#define CT_STRIPE 3
58#define CT_RAID5 4
59#define CT_SSRW 5
60#define CT_SSRO 6
61#define CT_MORPH 7
62#define CT_PASSTHRU 8
63#define CT_RAID4 9
64#define CT_RAID10 10 /* stripe of mirror */
65#define CT_RAID00 11 /* stripe of stripe */
66#define CT_VOLUME_OF_MIRRORS 12 /* volume of mirror */
67#define CT_PSEUDO_RAID 13 /* really raid4 */
68#define CT_LAST_VOLUME_TYPE 14
69#define CT_OK 218 55#define CT_OK 218
70
71/*
72 * Types of objects addressable in some fashion by the client.
73 * This is a superset of those objects handled just by the filesystem
74 * and includes "raw" objects that an administrator would use to
75 * configure containers and filesystems.
76 */
77
78#define FT_REG 1 /* regular file */
79#define FT_DIR 2 /* directory */
80#define FT_BLK 3 /* "block" device - reserved */
81#define FT_CHR 4 /* "character special" device - reserved */
82#define FT_LNK 5 /* symbolic link */
83#define FT_SOCK 6 /* socket */
84#define FT_FIFO 7 /* fifo */
85#define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */ 56#define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */
86#define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */ 57#define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */
87#define FT_SLICE 10 /* virtual disk - raw volume - slice */
88#define FT_PARTITION 11 /* FSA partition - carved out of a slice - building block for containers */
89#define FT_VOLUME 12 /* Container - Volume Set */
90#define FT_STRIPE 13 /* Container - Stripe Set */
91#define FT_MIRROR 14 /* Container - Mirror Set */
92#define FT_RAID5 15 /* Container - Raid 5 Set */
93#define FT_DATABASE 16 /* Storage object with "foreign" content manager */
94 58
95/* 59/*
96 * Host side memory scatter gather list 60 * Host side memory scatter gather list
@@ -497,6 +461,7 @@ struct adapter_ops
497 void (*adapter_enable_int)(struct aac_dev *dev); 461 void (*adapter_enable_int)(struct aac_dev *dev);
498 int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4); 462 int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4);
499 int (*adapter_check_health)(struct aac_dev *dev); 463 int (*adapter_check_health)(struct aac_dev *dev);
464 int (*adapter_restart)(struct aac_dev *dev, int bled);
500 /* Transport operations */ 465 /* Transport operations */
501 int (*adapter_ioremap)(struct aac_dev * dev, u32 size); 466 int (*adapter_ioremap)(struct aac_dev * dev, u32 size);
502 irqreturn_t (*adapter_intr)(int irq, void *dev_id); 467 irqreturn_t (*adapter_intr)(int irq, void *dev_id);
@@ -833,7 +798,7 @@ struct fib {
833 */ 798 */
834 struct list_head fiblink; 799 struct list_head fiblink;
835 void *data; 800 void *data;
836 struct hw_fib *hw_fib; /* Actual shared object */ 801 struct hw_fib *hw_fib_va; /* Actual shared object */
837 dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ 802 dma_addr_t hw_fib_pa; /* physical address of hw_fib*/
838}; 803};
839 804
@@ -878,10 +843,25 @@ struct aac_supplement_adapter_info
878 __le32 Version; 843 __le32 Version;
879 __le32 FeatureBits; 844 __le32 FeatureBits;
880 u8 SlotNumber; 845 u8 SlotNumber;
881 u8 ReservedPad0[0]; 846 u8 ReservedPad0[3];
882 u8 BuildDate[12]; 847 u8 BuildDate[12];
883 __le32 CurrentNumberPorts; 848 __le32 CurrentNumberPorts;
884 __le32 ReservedGrowth[24]; 849 struct {
850 u8 AssemblyPn[8];
851 u8 FruPn[8];
852 u8 BatteryFruPn[8];
853 u8 EcVersionString[8];
854 u8 Tsid[12];
855 } VpdInfo;
856 __le32 FlashFirmwareRevision;
857 __le32 FlashFirmwareBuild;
858 __le32 RaidTypeMorphOptions;
859 __le32 FlashFirmwareBootRevision;
860 __le32 FlashFirmwareBootBuild;
861 u8 MfgPcbaSerialNo[12];
862 u8 MfgWWNName[8];
863 __le32 MoreFeatureBits;
864 __le32 ReservedGrowth[1];
885}; 865};
886#define AAC_FEATURE_FALCON 0x00000010 866#define AAC_FEATURE_FALCON 0x00000010
887#define AAC_SIS_VERSION_V3 3 867#define AAC_SIS_VERSION_V3 3
@@ -970,7 +950,6 @@ struct aac_dev
970 struct fib *fibs; 950 struct fib *fibs;
971 951
972 struct fib *free_fib; 952 struct fib *free_fib;
973 struct fib *timeout_fib;
974 spinlock_t fib_lock; 953 spinlock_t fib_lock;
975 954
976 struct aac_queue_block *queues; 955 struct aac_queue_block *queues;
@@ -1060,6 +1039,9 @@ struct aac_dev
1060#define aac_adapter_check_health(dev) \ 1039#define aac_adapter_check_health(dev) \
1061 (dev)->a_ops.adapter_check_health(dev) 1040 (dev)->a_ops.adapter_check_health(dev)
1062 1041
1042#define aac_adapter_restart(dev,bled) \
1043 (dev)->a_ops.adapter_restart(dev,bled)
1044
1063#define aac_adapter_ioremap(dev, size) \ 1045#define aac_adapter_ioremap(dev, size) \
1064 (dev)->a_ops.adapter_ioremap(dev, size) 1046 (dev)->a_ops.adapter_ioremap(dev, size)
1065 1047
@@ -1516,8 +1498,7 @@ struct aac_mntent {
1516 struct creation_info create_info; /* if applicable */ 1498 struct creation_info create_info; /* if applicable */
1517 __le32 capacity; 1499 __le32 capacity;
1518 __le32 vol; /* substrate structure */ 1500 __le32 vol; /* substrate structure */
1519 __le32 obj; /* FT_FILESYS, 1501 __le32 obj; /* FT_FILESYS, etc. */
1520 FT_DATABASE, etc. */
1521 __le32 state; /* unready for mounting, 1502 __le32 state; /* unready for mounting,
1522 readonly, etc. */ 1503 readonly, etc. */
1523 union aac_contentinfo fileinfo; /* Info specific to content 1504 union aac_contentinfo fileinfo; /* Info specific to content
@@ -1817,7 +1798,7 @@ int aac_fib_send(u16 command, struct fib * context, unsigned long size, int prio
1817int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry); 1798int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry);
1818void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); 1799void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
1819int aac_fib_complete(struct fib * context); 1800int aac_fib_complete(struct fib * context);
1820#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) 1801#define fib_data(fibctx) ((void *)(fibctx)->hw_fib_va->data)
1821struct aac_dev *aac_init_adapter(struct aac_dev *dev); 1802struct aac_dev *aac_init_adapter(struct aac_dev *dev);
1822int aac_get_config_status(struct aac_dev *dev, int commit_flag); 1803int aac_get_config_status(struct aac_dev *dev, int commit_flag);
1823int aac_get_containers(struct aac_dev *dev); 1804int aac_get_containers(struct aac_dev *dev);
@@ -1840,8 +1821,11 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype);
1840int aac_get_adapter_info(struct aac_dev* dev); 1821int aac_get_adapter_info(struct aac_dev* dev);
1841int aac_send_shutdown(struct aac_dev *dev); 1822int aac_send_shutdown(struct aac_dev *dev);
1842int aac_probe_container(struct aac_dev *dev, int cid); 1823int aac_probe_container(struct aac_dev *dev, int cid);
1824int _aac_rx_init(struct aac_dev *dev);
1825int aac_rx_select_comm(struct aac_dev *dev, int comm);
1843extern int numacb; 1826extern int numacb;
1844extern int acbsize; 1827extern int acbsize;
1845extern char aac_driver_version[]; 1828extern char aac_driver_version[];
1846extern int startup_timeout; 1829extern int startup_timeout;
1847extern int aif_timeout; 1830extern int aif_timeout;
1831extern int expose_physicals;
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index e21070f4eac1..72b0393b4596 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -64,12 +64,15 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
64 unsigned size; 64 unsigned size;
65 int retval; 65 int retval;
66 66
67 if (dev->in_reset) {
68 return -EBUSY;
69 }
67 fibptr = aac_fib_alloc(dev); 70 fibptr = aac_fib_alloc(dev);
68 if(fibptr == NULL) { 71 if(fibptr == NULL) {
69 return -ENOMEM; 72 return -ENOMEM;
70 } 73 }
71 74
72 kfib = fibptr->hw_fib; 75 kfib = fibptr->hw_fib_va;
73 /* 76 /*
74 * First copy in the header so that we can check the size field. 77 * First copy in the header so that we can check the size field.
75 */ 78 */
@@ -91,9 +94,9 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
91 goto cleanup; 94 goto cleanup;
92 } 95 }
93 /* Highjack the hw_fib */ 96 /* Highjack the hw_fib */
94 hw_fib = fibptr->hw_fib; 97 hw_fib = fibptr->hw_fib_va;
95 hw_fib_pa = fibptr->hw_fib_pa; 98 hw_fib_pa = fibptr->hw_fib_pa;
96 fibptr->hw_fib = kfib = pci_alloc_consistent(dev->pdev, size, &fibptr->hw_fib_pa); 99 fibptr->hw_fib_va = kfib = pci_alloc_consistent(dev->pdev, size, &fibptr->hw_fib_pa);
97 memset(((char *)kfib) + dev->max_fib_size, 0, size - dev->max_fib_size); 100 memset(((char *)kfib) + dev->max_fib_size, 0, size - dev->max_fib_size);
98 memcpy(kfib, hw_fib, dev->max_fib_size); 101 memcpy(kfib, hw_fib, dev->max_fib_size);
99 } 102 }
@@ -137,7 +140,7 @@ cleanup:
137 if (hw_fib) { 140 if (hw_fib) {
138 pci_free_consistent(dev->pdev, size, kfib, fibptr->hw_fib_pa); 141 pci_free_consistent(dev->pdev, size, kfib, fibptr->hw_fib_pa);
139 fibptr->hw_fib_pa = hw_fib_pa; 142 fibptr->hw_fib_pa = hw_fib_pa;
140 fibptr->hw_fib = hw_fib; 143 fibptr->hw_fib_va = hw_fib;
141 } 144 }
142 if (retval != -EINTR) 145 if (retval != -EINTR)
143 aac_fib_free(fibptr); 146 aac_fib_free(fibptr);
@@ -282,15 +285,15 @@ return_fib:
282 fib = list_entry(entry, struct fib, fiblink); 285 fib = list_entry(entry, struct fib, fiblink);
283 fibctx->count--; 286 fibctx->count--;
284 spin_unlock_irqrestore(&dev->fib_lock, flags); 287 spin_unlock_irqrestore(&dev->fib_lock, flags);
285 if (copy_to_user(f.fib, fib->hw_fib, sizeof(struct hw_fib))) { 288 if (copy_to_user(f.fib, fib->hw_fib_va, sizeof(struct hw_fib))) {
286 kfree(fib->hw_fib); 289 kfree(fib->hw_fib_va);
287 kfree(fib); 290 kfree(fib);
288 return -EFAULT; 291 return -EFAULT;
289 } 292 }
290 /* 293 /*
291 * Free the space occupied by this copy of the fib. 294 * Free the space occupied by this copy of the fib.
292 */ 295 */
293 kfree(fib->hw_fib); 296 kfree(fib->hw_fib_va);
294 kfree(fib); 297 kfree(fib);
295 status = 0; 298 status = 0;
296 } else { 299 } else {
@@ -340,7 +343,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
340 /* 343 /*
341 * Free the space occupied by this copy of the fib. 344 * Free the space occupied by this copy of the fib.
342 */ 345 */
343 kfree(fib->hw_fib); 346 kfree(fib->hw_fib_va);
344 kfree(fib); 347 kfree(fib);
345 } 348 }
346 /* 349 /*
@@ -388,10 +391,8 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
388 /* 391 /*
389 * Extract the fibctx from the input parameters 392 * Extract the fibctx from the input parameters
390 */ 393 */
391 if (fibctx->unique == (u32)(unsigned long)arg) { 394 if (fibctx->unique == (u32)(ptrdiff_t)arg) /* We found a winner */
392 /* We found a winner */
393 break; 395 break;
394 }
395 entry = entry->next; 396 entry = entry->next;
396 fibctx = NULL; 397 fibctx = NULL;
397 } 398 }
@@ -465,16 +466,20 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
465 void *sg_list[32]; 466 void *sg_list[32];
466 u32 sg_indx = 0; 467 u32 sg_indx = 0;
467 u32 byte_count = 0; 468 u32 byte_count = 0;
468 u32 actual_fibsize = 0; 469 u32 actual_fibsize64, actual_fibsize = 0;
469 int i; 470 int i;
470 471
471 472
473 if (dev->in_reset) {
474 dprintk((KERN_DEBUG"aacraid: send raw srb -EBUSY\n"));
475 return -EBUSY;
476 }
472 if (!capable(CAP_SYS_ADMIN)){ 477 if (!capable(CAP_SYS_ADMIN)){
473 dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); 478 dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n"));
474 return -EPERM; 479 return -EPERM;
475 } 480 }
476 /* 481 /*
477 * Allocate and initialize a Fib then setup a BlockWrite command 482 * Allocate and initialize a Fib then setup a SRB command
478 */ 483 */
479 if (!(srbfib = aac_fib_alloc(dev))) { 484 if (!(srbfib = aac_fib_alloc(dev))) {
480 return -ENOMEM; 485 return -ENOMEM;
@@ -541,129 +546,183 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
541 rcode = -EINVAL; 546 rcode = -EINVAL;
542 goto cleanup; 547 goto cleanup;
543 } 548 }
544 if (dev->dac_support == 1) { 549 actual_fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) +
550 ((user_srbcmd->sg.count & 0xff) * sizeof(struct sgentry));
551 actual_fibsize64 = actual_fibsize + (user_srbcmd->sg.count & 0xff) *
552 (sizeof(struct sgentry64) - sizeof(struct sgentry));
553 /* User made a mistake - should not continue */
554 if ((actual_fibsize != fibsize) && (actual_fibsize64 != fibsize)) {
555 dprintk((KERN_DEBUG"aacraid: Bad Size specified in "
556 "Raw SRB command calculated fibsize=%lu;%lu "
557 "user_srbcmd->sg.count=%d aac_srb=%lu sgentry=%lu;%lu "
558 "issued fibsize=%d\n",
559 actual_fibsize, actual_fibsize64, user_srbcmd->sg.count,
560 sizeof(struct aac_srb), sizeof(struct sgentry),
561 sizeof(struct sgentry64), fibsize));
562 rcode = -EINVAL;
563 goto cleanup;
564 }
565 if ((data_dir == DMA_NONE) && user_srbcmd->sg.count) {
566 dprintk((KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"));
567 rcode = -EINVAL;
568 goto cleanup;
569 }
570 byte_count = 0;
571 if (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) {
545 struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg; 572 struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg;
546 struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; 573 struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg;
547 struct user_sgmap* usg;
548 byte_count = 0;
549 574
550 /* 575 /*
551 * This should also catch if user used the 32 bit sgmap 576 * This should also catch if user used the 32 bit sgmap
552 */ 577 */
553 actual_fibsize = sizeof(struct aac_srb) - 578 if (actual_fibsize64 == fibsize) {
554 sizeof(struct sgentry) + 579 actual_fibsize = actual_fibsize64;
555 ((upsg->count & 0xff) * 580 for (i = 0; i < upsg->count; i++) {
556 sizeof(struct sgentry)); 581 u64 addr;
557 if(actual_fibsize != fibsize){ // User made a mistake - should not continue 582 void* p;
558 dprintk((KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n")); 583 /* Does this really need to be GFP_DMA? */
559 rcode = -EINVAL; 584 p = kmalloc(upsg->sg[i].count,GFP_KERNEL|__GFP_DMA);
560 goto cleanup; 585 if(p == 0) {
561 } 586 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
562 usg = kmalloc(actual_fibsize - sizeof(struct aac_srb) 587 upsg->sg[i].count,i,upsg->count));
563 + sizeof(struct sgmap), GFP_KERNEL); 588 rcode = -ENOMEM;
564 if (!usg) { 589 goto cleanup;
565 dprintk((KERN_DEBUG"aacraid: Allocation error in Raw SRB command\n")); 590 }
566 rcode = -ENOMEM; 591 addr = (u64)upsg->sg[i].addr[0];
567 goto cleanup; 592 addr += ((u64)upsg->sg[i].addr[1]) << 32;
568 } 593 sg_user[i] = (void __user *)(ptrdiff_t)addr;
569 memcpy (usg, upsg, actual_fibsize - sizeof(struct aac_srb) 594 sg_list[i] = p; // save so we can clean up later
570 + sizeof(struct sgmap)); 595 sg_indx = i;
571 actual_fibsize = sizeof(struct aac_srb) - 596
572 sizeof(struct sgentry) + ((usg->count & 0xff) * 597 if( flags & SRB_DataOut ){
573 sizeof(struct sgentry64)); 598 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
574 if ((data_dir == DMA_NONE) && upsg->count) { 599 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
575 kfree (usg); 600 rcode = -EFAULT;
576 dprintk((KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n")); 601 goto cleanup;
577 rcode = -EINVAL; 602 }
578 goto cleanup; 603 }
579 } 604 addr = pci_map_single(dev->pdev, p, upsg->sg[i].count, data_dir);
580 605
581 for (i = 0; i < usg->count; i++) { 606 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff);
582 u64 addr; 607 psg->sg[i].addr[1] = cpu_to_le32(addr>>32);
583 void* p; 608 byte_count += upsg->sg[i].count;
584 /* Does this really need to be GFP_DMA? */ 609 psg->sg[i].count = cpu_to_le32(upsg->sg[i].count);
585 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); 610 }
586 if(p == 0) { 611 } else {
587 kfree (usg); 612 struct user_sgmap* usg;
588 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", 613 usg = kmalloc(actual_fibsize - sizeof(struct aac_srb)
589 usg->sg[i].count,i,usg->count)); 614 + sizeof(struct sgmap), GFP_KERNEL);
615 if (!usg) {
616 dprintk((KERN_DEBUG"aacraid: Allocation error in Raw SRB command\n"));
590 rcode = -ENOMEM; 617 rcode = -ENOMEM;
591 goto cleanup; 618 goto cleanup;
592 } 619 }
593 sg_user[i] = (void __user *)(long)usg->sg[i].addr; 620 memcpy (usg, upsg, actual_fibsize - sizeof(struct aac_srb)
594 sg_list[i] = p; // save so we can clean up later 621 + sizeof(struct sgmap));
595 sg_indx = i; 622 actual_fibsize = actual_fibsize64;
596 623
597 if( flags & SRB_DataOut ){ 624 for (i = 0; i < usg->count; i++) {
598 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ 625 u64 addr;
626 void* p;
627 /* Does this really need to be GFP_DMA? */
628 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA);
629 if(p == 0) {
599 kfree (usg); 630 kfree (usg);
600 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 631 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
601 rcode = -EFAULT; 632 usg->sg[i].count,i,usg->count));
633 rcode = -ENOMEM;
602 goto cleanup; 634 goto cleanup;
603 } 635 }
604 } 636 sg_user[i] = (void __user *)(ptrdiff_t)usg->sg[i].addr;
605 addr = pci_map_single(dev->pdev, p, usg->sg[i].count, data_dir); 637 sg_list[i] = p; // save so we can clean up later
638 sg_indx = i;
639
640 if( flags & SRB_DataOut ){
641 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
642 kfree (usg);
643 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
644 rcode = -EFAULT;
645 goto cleanup;
646 }
647 }
648 addr = pci_map_single(dev->pdev, p, usg->sg[i].count, data_dir);
606 649
607 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); 650 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff);
608 psg->sg[i].addr[1] = cpu_to_le32(addr>>32); 651 psg->sg[i].addr[1] = cpu_to_le32(addr>>32);
609 psg->sg[i].count = cpu_to_le32(usg->sg[i].count); 652 byte_count += usg->sg[i].count;
610 byte_count += usg->sg[i].count; 653 psg->sg[i].count = cpu_to_le32(usg->sg[i].count);
654 }
655 kfree (usg);
611 } 656 }
612 kfree (usg);
613
614 srbcmd->count = cpu_to_le32(byte_count); 657 srbcmd->count = cpu_to_le32(byte_count);
615 psg->count = cpu_to_le32(sg_indx+1); 658 psg->count = cpu_to_le32(sg_indx+1);
616 status = aac_fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); 659 status = aac_fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL);
617 } else { 660 } else {
618 struct user_sgmap* upsg = &user_srbcmd->sg; 661 struct user_sgmap* upsg = &user_srbcmd->sg;
619 struct sgmap* psg = &srbcmd->sg; 662 struct sgmap* psg = &srbcmd->sg;
620 byte_count = 0; 663
621 664 if (actual_fibsize64 == fibsize) {
622 actual_fibsize = sizeof (struct aac_srb) + (((user_srbcmd->sg.count & 0xff) - 1) * sizeof (struct sgentry)); 665 struct user_sgmap64* usg = (struct user_sgmap64 *)upsg;
623 if(actual_fibsize != fibsize){ // User made a mistake - should not continue 666 for (i = 0; i < upsg->count; i++) {
624 dprintk((KERN_DEBUG"aacraid: Bad Size specified in " 667 u64 addr;
625 "Raw SRB command calculated fibsize=%d " 668 void* p;
626 "user_srbcmd->sg.count=%d aac_srb=%d sgentry=%d " 669 /* Does this really need to be GFP_DMA? */
627 "issued fibsize=%d\n", 670 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA);
628 actual_fibsize, user_srbcmd->sg.count, 671 if(p == 0) {
629 sizeof(struct aac_srb), sizeof(struct sgentry), 672 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
630 fibsize)); 673 usg->sg[i].count,i,usg->count));
631 rcode = -EINVAL; 674 rcode = -ENOMEM;
632 goto cleanup;
633 }
634 if ((data_dir == DMA_NONE) && upsg->count) {
635 dprintk((KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n"));
636 rcode = -EINVAL;
637 goto cleanup;
638 }
639 for (i = 0; i < upsg->count; i++) {
640 dma_addr_t addr;
641 void* p;
642 p = kmalloc(upsg->sg[i].count, GFP_KERNEL);
643 if(p == 0) {
644 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
645 upsg->sg[i].count, i, upsg->count));
646 rcode = -ENOMEM;
647 goto cleanup;
648 }
649 sg_user[i] = (void __user *)(long)upsg->sg[i].addr;
650 sg_list[i] = p; // save so we can clean up later
651 sg_indx = i;
652
653 if( flags & SRB_DataOut ){
654 if(copy_from_user(p, sg_user[i],
655 upsg->sg[i].count)) {
656 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
657 rcode = -EFAULT;
658 goto cleanup; 675 goto cleanup;
659 } 676 }
677 addr = (u64)usg->sg[i].addr[0];
678 addr += ((u64)usg->sg[i].addr[1]) << 32;
679 sg_user[i] = (void __user *)(ptrdiff_t)addr;
680 sg_list[i] = p; // save so we can clean up later
681 sg_indx = i;
682
683 if( flags & SRB_DataOut ){
684 if(copy_from_user(p,sg_user[i],usg->sg[i].count)){
685 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
686 rcode = -EFAULT;
687 goto cleanup;
688 }
689 }
690 addr = pci_map_single(dev->pdev, p, usg->sg[i].count, data_dir);
691
692 psg->sg[i].addr = cpu_to_le32(addr & 0xffffffff);
693 byte_count += usg->sg[i].count;
694 psg->sg[i].count = cpu_to_le32(usg->sg[i].count);
660 } 695 }
661 addr = pci_map_single(dev->pdev, p, 696 } else {
662 upsg->sg[i].count, data_dir); 697 for (i = 0; i < upsg->count; i++) {
698 dma_addr_t addr;
699 void* p;
700 p = kmalloc(upsg->sg[i].count, GFP_KERNEL);
701 if(p == 0) {
702 dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
703 upsg->sg[i].count, i, upsg->count));
704 rcode = -ENOMEM;
705 goto cleanup;
706 }
707 sg_user[i] = (void __user *)(ptrdiff_t)upsg->sg[i].addr;
708 sg_list[i] = p; // save so we can clean up later
709 sg_indx = i;
710
711 if( flags & SRB_DataOut ){
712 if(copy_from_user(p, sg_user[i],
713 upsg->sg[i].count)) {
714 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
715 rcode = -EFAULT;
716 goto cleanup;
717 }
718 }
719 addr = pci_map_single(dev->pdev, p,
720 upsg->sg[i].count, data_dir);
663 721
664 psg->sg[i].addr = cpu_to_le32(addr); 722 psg->sg[i].addr = cpu_to_le32(addr);
665 psg->sg[i].count = cpu_to_le32(upsg->sg[i].count); 723 byte_count += upsg->sg[i].count;
666 byte_count += upsg->sg[i].count; 724 psg->sg[i].count = cpu_to_le32(upsg->sg[i].count);
725 }
667 } 726 }
668 srbcmd->count = cpu_to_le32(byte_count); 727 srbcmd->count = cpu_to_le32(byte_count);
669 psg->count = cpu_to_le32(sg_indx+1); 728 psg->count = cpu_to_le32(sg_indx+1);
@@ -682,7 +741,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
682 741
683 if( flags & SRB_DataIn ) { 742 if( flags & SRB_DataIn ) {
684 for(i = 0 ; i <= sg_indx; i++){ 743 for(i = 0 ; i <= sg_indx; i++){
685 byte_count = le32_to_cpu((dev->dac_support == 1) 744 byte_count = le32_to_cpu(
745 (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)
686 ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count 746 ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count
687 : srbcmd->sg.sg[i].count); 747 : srbcmd->sg.sg[i].count);
688 if(copy_to_user(sg_user[i], sg_list[i], byte_count)){ 748 if(copy_to_user(sg_user[i], sg_list[i], byte_count)){
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index ae34768987a4..33682ce96a5d 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -110,7 +110,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
110 /* 110 /*
111 * Align the beginning of Headers to commalign 111 * Align the beginning of Headers to commalign
112 */ 112 */
113 align = (commalign - ((unsigned long)(base) & (commalign - 1))); 113 align = (commalign - ((ptrdiff_t)(base) & (commalign - 1)));
114 base = base + align; 114 base = base + align;
115 phys = phys + align; 115 phys = phys + align;
116 /* 116 /*
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1b97f60652ba..5824a757a753 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@ void aac_fib_map_free(struct aac_dev *dev)
94int aac_fib_setup(struct aac_dev * dev) 94int aac_fib_setup(struct aac_dev * dev)
95{ 95{
96 struct fib *fibptr; 96 struct fib *fibptr;
97 struct hw_fib *hw_fib_va; 97 struct hw_fib *hw_fib;
98 dma_addr_t hw_fib_pa; 98 dma_addr_t hw_fib_pa;
99 int i; 99 int i;
100 100
@@ -106,24 +106,24 @@ int aac_fib_setup(struct aac_dev * dev)
106 if (i<0) 106 if (i<0)
107 return -ENOMEM; 107 return -ENOMEM;
108 108
109 hw_fib_va = dev->hw_fib_va; 109 hw_fib = dev->hw_fib_va;
110 hw_fib_pa = dev->hw_fib_pa; 110 hw_fib_pa = dev->hw_fib_pa;
111 memset(hw_fib_va, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); 111 memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB));
112 /* 112 /*
113 * Initialise the fibs 113 * Initialise the fibs
114 */ 114 */
115 for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++) 115 for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++)
116 { 116 {
117 fibptr->dev = dev; 117 fibptr->dev = dev;
118 fibptr->hw_fib = hw_fib_va; 118 fibptr->hw_fib_va = hw_fib;
119 fibptr->data = (void *) fibptr->hw_fib->data; 119 fibptr->data = (void *) fibptr->hw_fib_va->data;
120 fibptr->next = fibptr+1; /* Forward chain the fibs */ 120 fibptr->next = fibptr+1; /* Forward chain the fibs */
121 init_MUTEX_LOCKED(&fibptr->event_wait); 121 init_MUTEX_LOCKED(&fibptr->event_wait);
122 spin_lock_init(&fibptr->event_lock); 122 spin_lock_init(&fibptr->event_lock);
123 hw_fib_va->header.XferState = cpu_to_le32(0xffffffff); 123 hw_fib->header.XferState = cpu_to_le32(0xffffffff);
124 hw_fib_va->header.SenderSize = cpu_to_le16(dev->max_fib_size); 124 hw_fib->header.SenderSize = cpu_to_le16(dev->max_fib_size);
125 fibptr->hw_fib_pa = hw_fib_pa; 125 fibptr->hw_fib_pa = hw_fib_pa;
126 hw_fib_va = (struct hw_fib *)((unsigned char *)hw_fib_va + dev->max_fib_size); 126 hw_fib = (struct hw_fib *)((unsigned char *)hw_fib + dev->max_fib_size);
127 hw_fib_pa = hw_fib_pa + dev->max_fib_size; 127 hw_fib_pa = hw_fib_pa + dev->max_fib_size;
128 } 128 }
129 /* 129 /*
@@ -166,7 +166,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
166 * Null out fields that depend on being zero at the start of 166 * Null out fields that depend on being zero at the start of
167 * each I/O 167 * each I/O
168 */ 168 */
169 fibptr->hw_fib->header.XferState = 0; 169 fibptr->hw_fib_va->header.XferState = 0;
170 fibptr->callback = NULL; 170 fibptr->callback = NULL;
171 fibptr->callback_data = NULL; 171 fibptr->callback_data = NULL;
172 172
@@ -178,7 +178,6 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
178 * @fibptr: fib to free up 178 * @fibptr: fib to free up
179 * 179 *
180 * Frees up a fib and places it on the appropriate queue 180 * Frees up a fib and places it on the appropriate queue
181 * (either free or timed out)
182 */ 181 */
183 182
184void aac_fib_free(struct fib *fibptr) 183void aac_fib_free(struct fib *fibptr)
@@ -186,19 +185,15 @@ void aac_fib_free(struct fib *fibptr)
186 unsigned long flags; 185 unsigned long flags;
187 186
188 spin_lock_irqsave(&fibptr->dev->fib_lock, flags); 187 spin_lock_irqsave(&fibptr->dev->fib_lock, flags);
189 if (fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT) { 188 if (unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT))
190 aac_config.fib_timeouts++; 189 aac_config.fib_timeouts++;
191 fibptr->next = fibptr->dev->timeout_fib; 190 if (fibptr->hw_fib_va->header.XferState != 0) {
192 fibptr->dev->timeout_fib = fibptr; 191 printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n",
193 } else { 192 (void*)fibptr,
194 if (fibptr->hw_fib->header.XferState != 0) { 193 le32_to_cpu(fibptr->hw_fib_va->header.XferState));
195 printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n", 194 }
196 (void*)fibptr, 195 fibptr->next = fibptr->dev->free_fib;
197 le32_to_cpu(fibptr->hw_fib->header.XferState)); 196 fibptr->dev->free_fib = fibptr;
198 }
199 fibptr->next = fibptr->dev->free_fib;
200 fibptr->dev->free_fib = fibptr;
201 }
202 spin_unlock_irqrestore(&fibptr->dev->fib_lock, flags); 197 spin_unlock_irqrestore(&fibptr->dev->fib_lock, flags);
203} 198}
204 199
@@ -211,7 +206,7 @@ void aac_fib_free(struct fib *fibptr)
211 206
212void aac_fib_init(struct fib *fibptr) 207void aac_fib_init(struct fib *fibptr)
213{ 208{
214 struct hw_fib *hw_fib = fibptr->hw_fib; 209 struct hw_fib *hw_fib = fibptr->hw_fib_va;
215 210
216 hw_fib->header.StructType = FIB_MAGIC; 211 hw_fib->header.StructType = FIB_MAGIC;
217 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); 212 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size);
@@ -231,7 +226,7 @@ void aac_fib_init(struct fib *fibptr)
231 226
232static void fib_dealloc(struct fib * fibptr) 227static void fib_dealloc(struct fib * fibptr)
233{ 228{
234 struct hw_fib *hw_fib = fibptr->hw_fib; 229 struct hw_fib *hw_fib = fibptr->hw_fib_va;
235 BUG_ON(hw_fib->header.StructType != FIB_MAGIC); 230 BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
236 hw_fib->header.XferState = 0; 231 hw_fib->header.XferState = 0;
237} 232}
@@ -386,7 +381,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
386 void *callback_data) 381 void *callback_data)
387{ 382{
388 struct aac_dev * dev = fibptr->dev; 383 struct aac_dev * dev = fibptr->dev;
389 struct hw_fib * hw_fib = fibptr->hw_fib; 384 struct hw_fib * hw_fib = fibptr->hw_fib_va;
390 unsigned long flags = 0; 385 unsigned long flags = 0;
391 unsigned long qflags; 386 unsigned long qflags;
392 387
@@ -430,7 +425,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
430 */ 425 */
431 hw_fib->header.Command = cpu_to_le16(command); 426 hw_fib->header.Command = cpu_to_le16(command);
432 hw_fib->header.XferState |= cpu_to_le32(SentFromHost); 427 hw_fib->header.XferState |= cpu_to_le32(SentFromHost);
433 fibptr->hw_fib->header.Flags = 0; /* 0 the flags field - internal only*/ 428 fibptr->hw_fib_va->header.Flags = 0; /* 0 the flags field - internal only*/
434 /* 429 /*
435 * Set the size of the Fib we want to send to the adapter 430 * Set the size of the Fib we want to send to the adapter
436 */ 431 */
@@ -462,7 +457,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
462 dprintk((KERN_DEBUG " Command = %d.\n", le32_to_cpu(hw_fib->header.Command))); 457 dprintk((KERN_DEBUG " Command = %d.\n", le32_to_cpu(hw_fib->header.Command)));
463 dprintk((KERN_DEBUG " SubCommand = %d.\n", le32_to_cpu(((struct aac_query_mount *)fib_data(fibptr))->command))); 458 dprintk((KERN_DEBUG " SubCommand = %d.\n", le32_to_cpu(((struct aac_query_mount *)fib_data(fibptr))->command)));
464 dprintk((KERN_DEBUG " XferState = %x.\n", le32_to_cpu(hw_fib->header.XferState))); 459 dprintk((KERN_DEBUG " XferState = %x.\n", le32_to_cpu(hw_fib->header.XferState)));
465 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib)); 460 dprintk((KERN_DEBUG " hw_fib va being sent=%p\n",fibptr->hw_fib_va));
466 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa)); 461 dprintk((KERN_DEBUG " hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa));
467 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr)); 462 dprintk((KERN_DEBUG " fib being sent=%p\n",fibptr));
468 463
@@ -513,22 +508,20 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
513 } 508 }
514 udelay(5); 509 udelay(5);
515 } 510 }
516 } else if (down_interruptible(&fibptr->event_wait)) { 511 } else
517 spin_lock_irqsave(&fibptr->event_lock, flags); 512 (void)down_interruptible(&fibptr->event_wait);
518 if (fibptr->done == 0) { 513 spin_lock_irqsave(&fibptr->event_lock, flags);
519 fibptr->done = 2; /* Tell interrupt we aborted */ 514 if (fibptr->done == 0) {
520 spin_unlock_irqrestore(&fibptr->event_lock, flags); 515 fibptr->done = 2; /* Tell interrupt we aborted */
521 return -EINTR;
522 }
523 spin_unlock_irqrestore(&fibptr->event_lock, flags); 516 spin_unlock_irqrestore(&fibptr->event_lock, flags);
517 return -EINTR;
524 } 518 }
519 spin_unlock_irqrestore(&fibptr->event_lock, flags);
525 BUG_ON(fibptr->done == 0); 520 BUG_ON(fibptr->done == 0);
526 521
527 if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){ 522 if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT))
528 return -ETIMEDOUT; 523 return -ETIMEDOUT;
529 } else { 524 return 0;
530 return 0;
531 }
532 } 525 }
533 /* 526 /*
534 * If the user does not want a response than return success otherwise 527 * If the user does not want a response than return success otherwise
@@ -624,7 +617,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
624 617
625int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) 618int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
626{ 619{
627 struct hw_fib * hw_fib = fibptr->hw_fib; 620 struct hw_fib * hw_fib = fibptr->hw_fib_va;
628 struct aac_dev * dev = fibptr->dev; 621 struct aac_dev * dev = fibptr->dev;
629 struct aac_queue * q; 622 struct aac_queue * q;
630 unsigned long nointr = 0; 623 unsigned long nointr = 0;
@@ -688,7 +681,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
688 681
689int aac_fib_complete(struct fib *fibptr) 682int aac_fib_complete(struct fib *fibptr)
690{ 683{
691 struct hw_fib * hw_fib = fibptr->hw_fib; 684 struct hw_fib * hw_fib = fibptr->hw_fib_va;
692 685
693 /* 686 /*
694 * Check for a fib which has already been completed 687 * Check for a fib which has already been completed
@@ -774,9 +767,8 @@ void aac_printf(struct aac_dev *dev, u32 val)
774#define AIF_SNIFF_TIMEOUT (30*HZ) 767#define AIF_SNIFF_TIMEOUT (30*HZ)
775static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) 768static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
776{ 769{
777 struct hw_fib * hw_fib = fibptr->hw_fib; 770 struct hw_fib * hw_fib = fibptr->hw_fib_va;
778 struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; 771 struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data;
779 int busy;
780 u32 container; 772 u32 container;
781 struct scsi_device *device; 773 struct scsi_device *device;
782 enum { 774 enum {
@@ -988,9 +980,6 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
988 * behind you. 980 * behind you.
989 */ 981 */
990 982
991 busy = 0;
992
993
994 /* 983 /*
995 * Find the scsi_device associated with the SCSI address, 984 * Find the scsi_device associated with the SCSI address,
996 * and mark it as changed, invalidating the cache. This deals 985 * and mark it as changed, invalidating the cache. This deals
@@ -1035,7 +1024,6 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
1035static int _aac_reset_adapter(struct aac_dev *aac) 1024static int _aac_reset_adapter(struct aac_dev *aac)
1036{ 1025{
1037 int index, quirks; 1026 int index, quirks;
1038 u32 ret;
1039 int retval; 1027 int retval;
1040 struct Scsi_Host *host; 1028 struct Scsi_Host *host;
1041 struct scsi_device *dev; 1029 struct scsi_device *dev;
@@ -1059,35 +1047,29 @@ static int _aac_reset_adapter(struct aac_dev *aac)
1059 * If a positive health, means in a known DEAD PANIC 1047 * If a positive health, means in a known DEAD PANIC
1060 * state and the adapter could be reset to `try again'. 1048 * state and the adapter could be reset to `try again'.
1061 */ 1049 */
1062 retval = aac_adapter_check_health(aac); 1050 retval = aac_adapter_restart(aac, aac_adapter_check_health(aac));
1063 if (retval == 0)
1064 retval = aac_adapter_sync_cmd(aac, IOP_RESET_ALWAYS,
1065 0, 0, 0, 0, 0, 0, &ret, NULL, NULL, NULL, NULL);
1066 if (retval)
1067 retval = aac_adapter_sync_cmd(aac, IOP_RESET,
1068 0, 0, 0, 0, 0, 0, &ret, NULL, NULL, NULL, NULL);
1069 1051
1070 if (retval) 1052 if (retval)
1071 goto out; 1053 goto out;
1072 if (ret != 0x00000001) {
1073 retval = -ENODEV;
1074 goto out;
1075 }
1076 1054
1077 /* 1055 /*
1078 * Loop through the fibs, close the synchronous FIBS 1056 * Loop through the fibs, close the synchronous FIBS
1079 */ 1057 */
1080 for (index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) { 1058 for (retval = 1, index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) {
1081 struct fib *fib = &aac->fibs[index]; 1059 struct fib *fib = &aac->fibs[index];
1082 if (!(fib->hw_fib->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && 1060 if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) &&
1083 (fib->hw_fib->header.XferState & cpu_to_le32(ResponseExpected))) { 1061 (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) {
1084 unsigned long flagv; 1062 unsigned long flagv;
1085 spin_lock_irqsave(&fib->event_lock, flagv); 1063 spin_lock_irqsave(&fib->event_lock, flagv);
1086 up(&fib->event_wait); 1064 up(&fib->event_wait);
1087 spin_unlock_irqrestore(&fib->event_lock, flagv); 1065 spin_unlock_irqrestore(&fib->event_lock, flagv);
1088 schedule(); 1066 schedule();
1067 retval = 0;
1089 } 1068 }
1090 } 1069 }
1070 /* Give some extra time for ioctls to complete. */
1071 if (retval == 0)
1072 ssleep(2);
1091 index = aac->cardtype; 1073 index = aac->cardtype;
1092 1074
1093 /* 1075 /*
@@ -1248,7 +1230,7 @@ int aac_check_health(struct aac_dev * aac)
1248 1230
1249 memset(hw_fib, 0, sizeof(struct hw_fib)); 1231 memset(hw_fib, 0, sizeof(struct hw_fib));
1250 memset(fib, 0, sizeof(struct fib)); 1232 memset(fib, 0, sizeof(struct fib));
1251 fib->hw_fib = hw_fib; 1233 fib->hw_fib_va = hw_fib;
1252 fib->dev = aac; 1234 fib->dev = aac;
1253 aac_fib_init(fib); 1235 aac_fib_init(fib);
1254 fib->type = FSAFS_NTC_FIB_CONTEXT; 1236 fib->type = FSAFS_NTC_FIB_CONTEXT;
@@ -1354,11 +1336,11 @@ int aac_command_thread(void *data)
1354 * do anything at this point since we don't have 1336 * do anything at this point since we don't have
1355 * anything defined for this thread to do. 1337 * anything defined for this thread to do.
1356 */ 1338 */
1357 hw_fib = fib->hw_fib; 1339 hw_fib = fib->hw_fib_va;
1358 memset(fib, 0, sizeof(struct fib)); 1340 memset(fib, 0, sizeof(struct fib));
1359 fib->type = FSAFS_NTC_FIB_CONTEXT; 1341 fib->type = FSAFS_NTC_FIB_CONTEXT;
1360 fib->size = sizeof( struct fib ); 1342 fib->size = sizeof( struct fib );
1361 fib->hw_fib = hw_fib; 1343 fib->hw_fib_va = hw_fib;
1362 fib->data = hw_fib->data; 1344 fib->data = hw_fib->data;
1363 fib->dev = dev; 1345 fib->dev = dev;
1364 /* 1346 /*
@@ -1485,7 +1467,7 @@ int aac_command_thread(void *data)
1485 */ 1467 */
1486 memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib)); 1468 memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib));
1487 memcpy(newfib, fib, sizeof(struct fib)); 1469 memcpy(newfib, fib, sizeof(struct fib));
1488 newfib->hw_fib = hw_newfib; 1470 newfib->hw_fib_va = hw_newfib;
1489 /* 1471 /*
1490 * Put the FIB onto the 1472 * Put the FIB onto the
1491 * fibctx's fibs 1473 * fibctx's fibs
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index d38b628be1ad..42c7dcda6d9b 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/pci.h>
36#include <linux/spinlock.h> 35#include <linux/spinlock.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
38#include <linux/completion.h> 37#include <linux/completion.h>
@@ -73,7 +72,7 @@ unsigned int aac_response_normal(struct aac_queue * q)
73 u32 index = le32_to_cpu(entry->addr); 72 u32 index = le32_to_cpu(entry->addr);
74 fast = index & 0x01; 73 fast = index & 0x01;
75 fib = &dev->fibs[index >> 2]; 74 fib = &dev->fibs[index >> 2];
76 hwfib = fib->hw_fib; 75 hwfib = fib->hw_fib_va;
77 76
78 aac_consumer_free(dev, q, HostNormRespQueue); 77 aac_consumer_free(dev, q, HostNormRespQueue);
79 /* 78 /*
@@ -84,11 +83,13 @@ unsigned int aac_response_normal(struct aac_queue * q)
84 * continue. The caller has already been notified that 83 * continue. The caller has already been notified that
85 * the fib timed out. 84 * the fib timed out.
86 */ 85 */
87 if (!(fib->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) 86 dev->queues->queue[AdapNormCmdQueue].numpending--;
88 dev->queues->queue[AdapNormCmdQueue].numpending--; 87
89 else { 88 if (unlikely(fib->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) {
90 printk(KERN_WARNING "aacraid: FIB timeout (%x).\n", fib->flags); 89 spin_unlock_irqrestore(q->lock, flags);
91 printk(KERN_DEBUG"aacraid: hwfib=%p fib index=%i fib=%p\n",hwfib, hwfib->header.SenderData,fib); 90 aac_fib_complete(fib);
91 aac_fib_free(fib);
92 spin_lock_irqsave(q->lock, flags);
92 continue; 93 continue;
93 } 94 }
94 spin_unlock_irqrestore(q->lock, flags); 95 spin_unlock_irqrestore(q->lock, flags);
@@ -193,7 +194,7 @@ unsigned int aac_command_normal(struct aac_queue *q)
193 INIT_LIST_HEAD(&fib->fiblink); 194 INIT_LIST_HEAD(&fib->fiblink);
194 fib->type = FSAFS_NTC_FIB_CONTEXT; 195 fib->type = FSAFS_NTC_FIB_CONTEXT;
195 fib->size = sizeof(struct fib); 196 fib->size = sizeof(struct fib);
196 fib->hw_fib = hw_fib; 197 fib->hw_fib_va = hw_fib;
197 fib->data = hw_fib->data; 198 fib->data = hw_fib->data;
198 fib->dev = dev; 199 fib->dev = dev;
199 200
@@ -254,12 +255,13 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
254 return 1; 255 return 1;
255 } 256 }
256 memset(hw_fib, 0, sizeof(struct hw_fib)); 257 memset(hw_fib, 0, sizeof(struct hw_fib));
257 memcpy(hw_fib, (struct hw_fib *)(((unsigned long)(dev->regs.sa)) + (index & ~0x00000002L)), sizeof(struct hw_fib)); 258 memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) +
259 (index & ~0x00000002L)), sizeof(struct hw_fib));
258 memset(fib, 0, sizeof(struct fib)); 260 memset(fib, 0, sizeof(struct fib));
259 INIT_LIST_HEAD(&fib->fiblink); 261 INIT_LIST_HEAD(&fib->fiblink);
260 fib->type = FSAFS_NTC_FIB_CONTEXT; 262 fib->type = FSAFS_NTC_FIB_CONTEXT;
261 fib->size = sizeof(struct fib); 263 fib->size = sizeof(struct fib);
262 fib->hw_fib = hw_fib; 264 fib->hw_fib_va = hw_fib;
263 fib->data = hw_fib->data; 265 fib->data = hw_fib->data;
264 fib->dev = dev; 266 fib->dev = dev;
265 267
@@ -271,7 +273,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
271 } else { 273 } else {
272 int fast = index & 0x01; 274 int fast = index & 0x01;
273 struct fib * fib = &dev->fibs[index >> 2]; 275 struct fib * fib = &dev->fibs[index >> 2];
274 struct hw_fib * hwfib = fib->hw_fib; 276 struct hw_fib * hwfib = fib->hw_fib_va;
275 277
276 /* 278 /*
277 * Remove this fib from the Outstanding I/O queue. 279 * Remove this fib from the Outstanding I/O queue.
@@ -281,14 +283,14 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
281 * continue. The caller has already been notified that 283 * continue. The caller has already been notified that
282 * the fib timed out. 284 * the fib timed out.
283 */ 285 */
284 if ((fib->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) { 286 dev->queues->queue[AdapNormCmdQueue].numpending--;
285 printk(KERN_WARNING "aacraid: FIB timeout (%x).\n", fib->flags); 287
286 printk(KERN_DEBUG"aacraid: hwfib=%p index=%i fib=%p\n",hwfib, hwfib->header.SenderData,fib); 288 if (unlikely(fib->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) {
289 aac_fib_complete(fib);
290 aac_fib_free(fib);
287 return 0; 291 return 0;
288 } 292 }
289 293
290 dev->queues->queue[AdapNormCmdQueue].numpending--;
291
292 if (fast) { 294 if (fast) {
293 /* 295 /*
294 * Doctor the fib 296 * Doctor the fib
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 0f948c2fb609..350ea7feb61d 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -82,8 +82,6 @@ static LIST_HEAD(aac_devices);
82static int aac_cfg_major = -1; 82static int aac_cfg_major = -1;
83char aac_driver_version[] = AAC_DRIVER_FULL_VERSION; 83char aac_driver_version[] = AAC_DRIVER_FULL_VERSION;
84 84
85extern int expose_physicals;
86
87/* 85/*
88 * Because of the way Linux names scsi devices, the order in this table has 86 * Because of the way Linux names scsi devices, the order in this table has
89 * become important. Check for on-board Raid first, add-in cards second. 87 * become important. Check for on-board Raid first, add-in cards second.
@@ -247,7 +245,19 @@ static struct aac_driver_ident aac_drivers[] = {
247 245
248static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 246static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
249{ 247{
248 struct Scsi_Host *host = cmd->device->host;
249 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
250 u32 count = 0;
250 cmd->scsi_done = done; 251 cmd->scsi_done = done;
252 for (; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
253 struct fib * fib = &dev->fibs[count];
254 struct scsi_cmnd * command;
255 if (fib->hw_fib_va->header.XferState &&
256 ((command = fib->callback_data)) &&
257 (command == cmd) &&
258 (cmd->SCp.phase == AAC_OWNER_FIRMWARE))
259 return 0; /* Already owned by Adapter */
260 }
251 cmd->SCp.phase = AAC_OWNER_LOWLEVEL; 261 cmd->SCp.phase = AAC_OWNER_LOWLEVEL;
252 return (aac_scsi_cmd(cmd) ? FAILED : 0); 262 return (aac_scsi_cmd(cmd) ? FAILED : 0);
253} 263}
@@ -446,6 +456,40 @@ static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg)
446 return aac_do_ioctl(dev, cmd, arg); 456 return aac_do_ioctl(dev, cmd, arg);
447} 457}
448 458
459static int aac_eh_abort(struct scsi_cmnd* cmd)
460{
461 struct scsi_device * dev = cmd->device;
462 struct Scsi_Host * host = dev->host;
463 struct aac_dev * aac = (struct aac_dev *)host->hostdata;
464 int count;
465 int ret = FAILED;
466
467 printk(KERN_ERR "%s: Host adapter abort request (%d,%d,%d,%d)\n",
468 AAC_DRIVERNAME,
469 host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun);
470 switch (cmd->cmnd[0]) {
471 case SERVICE_ACTION_IN:
472 if (!(aac->raw_io_interface) ||
473 !(aac->raw_io_64) ||
474 ((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
475 break;
476 case INQUIRY:
477 case READ_CAPACITY:
478 case TEST_UNIT_READY:
479 /* Mark associated FIB to not complete, eh handler does this */
480 for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
481 struct fib * fib = &aac->fibs[count];
482 if (fib->hw_fib_va->header.XferState &&
483 (fib->callback_data == cmd)) {
484 fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
485 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
486 ret = SUCCESS;
487 }
488 }
489 }
490 return ret;
491}
492
449/* 493/*
450 * aac_eh_reset - Reset command handling 494 * aac_eh_reset - Reset command handling
451 * @scsi_cmd: SCSI command block causing the reset 495 * @scsi_cmd: SCSI command block causing the reset
@@ -457,12 +501,20 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
457 struct Scsi_Host * host = dev->host; 501 struct Scsi_Host * host = dev->host;
458 struct scsi_cmnd * command; 502 struct scsi_cmnd * command;
459 int count; 503 int count;
460 struct aac_dev * aac; 504 struct aac_dev * aac = (struct aac_dev *)host->hostdata;
461 unsigned long flags; 505 unsigned long flags;
462 506
507 /* Mark the associated FIB to not complete, eh handler does this */
508 for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
509 struct fib * fib = &aac->fibs[count];
510 if (fib->hw_fib_va->header.XferState &&
511 (fib->callback_data == cmd)) {
512 fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
513 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
514 }
515 }
463 printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", 516 printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n",
464 AAC_DRIVERNAME); 517 AAC_DRIVERNAME);
465 aac = (struct aac_dev *)host->hostdata;
466 518
467 if ((count = aac_check_health(aac))) 519 if ((count = aac_check_health(aac)))
468 return count; 520 return count;
@@ -496,7 +548,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
496 ssleep(1); 548 ssleep(1);
497 } 549 }
498 printk(KERN_ERR "%s: SCSI bus appears hung\n", AAC_DRIVERNAME); 550 printk(KERN_ERR "%s: SCSI bus appears hung\n", AAC_DRIVERNAME);
499 return -ETIMEDOUT; 551 return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */
500} 552}
501 553
502/** 554/**
@@ -796,6 +848,7 @@ static struct scsi_host_template aac_driver_template = {
796 .bios_param = aac_biosparm, 848 .bios_param = aac_biosparm,
797 .shost_attrs = aac_attrs, 849 .shost_attrs = aac_attrs,
798 .slave_configure = aac_slave_configure, 850 .slave_configure = aac_slave_configure,
851 .eh_abort_handler = aac_eh_abort,
799 .eh_host_reset_handler = aac_eh_reset, 852 .eh_host_reset_handler = aac_eh_reset,
800 .can_queue = AAC_NUM_IO_FIB, 853 .can_queue = AAC_NUM_IO_FIB,
801 .this_id = MAXIMUM_NUM_CONTAINERS, 854 .this_id = MAXIMUM_NUM_CONTAINERS,
diff --git a/drivers/scsi/aacraid/nark.c b/drivers/scsi/aacraid/nark.c
index c76b611b6afb..a8ace5677813 100644
--- a/drivers/scsi/aacraid/nark.c
+++ b/drivers/scsi/aacraid/nark.c
@@ -74,9 +74,6 @@ static int aac_nark_ioremap(struct aac_dev * dev, u32 size)
74 74
75int aac_nark_init(struct aac_dev * dev) 75int aac_nark_init(struct aac_dev * dev)
76{ 76{
77 extern int _aac_rx_init(struct aac_dev *dev);
78 extern int aac_rx_select_comm(struct aac_dev *dev, int comm);
79
80 /* 77 /*
81 * Fill in the function dispatch table. 78 * Fill in the function dispatch table.
82 */ 79 */
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index d953c3fe998a..9c5fcfb398c2 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -45,7 +45,6 @@
45static int aac_rkt_select_comm(struct aac_dev *dev, int comm) 45static int aac_rkt_select_comm(struct aac_dev *dev, int comm)
46{ 46{
47 int retval; 47 int retval;
48 extern int aac_rx_select_comm(struct aac_dev *dev, int comm);
49 retval = aac_rx_select_comm(dev, comm); 48 retval = aac_rx_select_comm(dev, comm);
50 if (comm == AAC_COMM_MESSAGE) { 49 if (comm == AAC_COMM_MESSAGE) {
51 /* 50 /*
@@ -97,8 +96,6 @@ static int aac_rkt_ioremap(struct aac_dev * dev, u32 size)
97 96
98int aac_rkt_init(struct aac_dev *dev) 97int aac_rkt_init(struct aac_dev *dev)
99{ 98{
100 extern int _aac_rx_init(struct aac_dev *dev);
101
102 /* 99 /*
103 * Fill in the function dispatch table. 100 * Fill in the function dispatch table.
104 */ 101 */
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index d242e2611d67..0c71315cbf1a 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -57,25 +57,25 @@ static irqreturn_t aac_rx_intr_producer(int irq, void *dev_id)
57 * been enabled. 57 * been enabled.
58 * Check to see if this is our interrupt. If it isn't just return 58 * Check to see if this is our interrupt. If it isn't just return
59 */ 59 */
60 if (intstat & ~(dev->OIMR)) { 60 if (likely(intstat & ~(dev->OIMR))) {
61 bellbits = rx_readl(dev, OutboundDoorbellReg); 61 bellbits = rx_readl(dev, OutboundDoorbellReg);
62 if (bellbits & DoorBellPrintfReady) { 62 if (unlikely(bellbits & DoorBellPrintfReady)) {
63 aac_printf(dev, readl (&dev->IndexRegs->Mailbox[5])); 63 aac_printf(dev, readl (&dev->IndexRegs->Mailbox[5]));
64 rx_writel(dev, MUnit.ODR,DoorBellPrintfReady); 64 rx_writel(dev, MUnit.ODR,DoorBellPrintfReady);
65 rx_writel(dev, InboundDoorbellReg,DoorBellPrintfDone); 65 rx_writel(dev, InboundDoorbellReg,DoorBellPrintfDone);
66 } 66 }
67 else if (bellbits & DoorBellAdapterNormCmdReady) { 67 else if (unlikely(bellbits & DoorBellAdapterNormCmdReady)) {
68 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdReady); 68 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdReady);
69 aac_command_normal(&dev->queues->queue[HostNormCmdQueue]); 69 aac_command_normal(&dev->queues->queue[HostNormCmdQueue]);
70 } 70 }
71 else if (bellbits & DoorBellAdapterNormRespReady) { 71 else if (likely(bellbits & DoorBellAdapterNormRespReady)) {
72 rx_writel(dev, MUnit.ODR,DoorBellAdapterNormRespReady); 72 rx_writel(dev, MUnit.ODR,DoorBellAdapterNormRespReady);
73 aac_response_normal(&dev->queues->queue[HostNormRespQueue]); 73 aac_response_normal(&dev->queues->queue[HostNormRespQueue]);
74 } 74 }
75 else if (bellbits & DoorBellAdapterNormCmdNotFull) { 75 else if (unlikely(bellbits & DoorBellAdapterNormCmdNotFull)) {
76 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull); 76 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull);
77 } 77 }
78 else if (bellbits & DoorBellAdapterNormRespNotFull) { 78 else if (unlikely(bellbits & DoorBellAdapterNormRespNotFull)) {
79 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull); 79 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull);
80 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormRespNotFull); 80 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormRespNotFull);
81 } 81 }
@@ -88,11 +88,11 @@ static irqreturn_t aac_rx_intr_message(int irq, void *dev_id)
88{ 88{
89 struct aac_dev *dev = dev_id; 89 struct aac_dev *dev = dev_id;
90 u32 Index = rx_readl(dev, MUnit.OutboundQueue); 90 u32 Index = rx_readl(dev, MUnit.OutboundQueue);
91 if (Index == 0xFFFFFFFFL) 91 if (unlikely(Index == 0xFFFFFFFFL))
92 Index = rx_readl(dev, MUnit.OutboundQueue); 92 Index = rx_readl(dev, MUnit.OutboundQueue);
93 if (Index != 0xFFFFFFFFL) { 93 if (likely(Index != 0xFFFFFFFFL)) {
94 do { 94 do {
95 if (aac_intr_normal(dev, Index)) { 95 if (unlikely(aac_intr_normal(dev, Index))) {
96 rx_writel(dev, MUnit.OutboundQueue, Index); 96 rx_writel(dev, MUnit.OutboundQueue, Index);
97 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormRespReady); 97 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormRespReady);
98 } 98 }
@@ -204,7 +204,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command,
204 */ 204 */
205 msleep(1); 205 msleep(1);
206 } 206 }
207 if (ok != 1) { 207 if (unlikely(ok != 1)) {
208 /* 208 /*
209 * Restore interrupt mask even though we timed out 209 * Restore interrupt mask even though we timed out
210 */ 210 */
@@ -294,7 +294,7 @@ static void aac_rx_notify_adapter(struct aac_dev *dev, u32 event)
294 * Start up processing on an i960 based AAC adapter 294 * Start up processing on an i960 based AAC adapter
295 */ 295 */
296 296
297void aac_rx_start_adapter(struct aac_dev *dev) 297static void aac_rx_start_adapter(struct aac_dev *dev)
298{ 298{
299 struct aac_init *init; 299 struct aac_init *init;
300 300
@@ -319,12 +319,12 @@ static int aac_rx_check_health(struct aac_dev *dev)
319 /* 319 /*
320 * Check to see if the board failed any self tests. 320 * Check to see if the board failed any self tests.
321 */ 321 */
322 if (status & SELF_TEST_FAILED) 322 if (unlikely(status & SELF_TEST_FAILED))
323 return -1; 323 return -1;
324 /* 324 /*
325 * Check to see if the board panic'd. 325 * Check to see if the board panic'd.
326 */ 326 */
327 if (status & KERNEL_PANIC) { 327 if (unlikely(status & KERNEL_PANIC)) {
328 char * buffer; 328 char * buffer;
329 struct POSTSTATUS { 329 struct POSTSTATUS {
330 __le32 Post_Command; 330 __le32 Post_Command;
@@ -333,15 +333,15 @@ static int aac_rx_check_health(struct aac_dev *dev)
333 dma_addr_t paddr, baddr; 333 dma_addr_t paddr, baddr;
334 int ret; 334 int ret;
335 335
336 if ((status & 0xFF000000L) == 0xBC000000L) 336 if (likely((status & 0xFF000000L) == 0xBC000000L))
337 return (status >> 16) & 0xFF; 337 return (status >> 16) & 0xFF;
338 buffer = pci_alloc_consistent(dev->pdev, 512, &baddr); 338 buffer = pci_alloc_consistent(dev->pdev, 512, &baddr);
339 ret = -2; 339 ret = -2;
340 if (buffer == NULL) 340 if (unlikely(buffer == NULL))
341 return ret; 341 return ret;
342 post = pci_alloc_consistent(dev->pdev, 342 post = pci_alloc_consistent(dev->pdev,
343 sizeof(struct POSTSTATUS), &paddr); 343 sizeof(struct POSTSTATUS), &paddr);
344 if (post == NULL) { 344 if (unlikely(post == NULL)) {
345 pci_free_consistent(dev->pdev, 512, buffer, baddr); 345 pci_free_consistent(dev->pdev, 512, buffer, baddr);
346 return ret; 346 return ret;
347 } 347 }
@@ -353,7 +353,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
353 NULL, NULL, NULL, NULL, NULL); 353 NULL, NULL, NULL, NULL, NULL);
354 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), 354 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
355 post, paddr); 355 post, paddr);
356 if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) { 356 if (likely((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X')))) {
357 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); 357 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
358 ret <<= 4; 358 ret <<= 4;
359 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); 359 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
@@ -364,7 +364,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
364 /* 364 /*
365 * Wait for the adapter to be up and running. 365 * Wait for the adapter to be up and running.
366 */ 366 */
367 if (!(status & KERNEL_UP_AND_RUNNING)) 367 if (unlikely(!(status & KERNEL_UP_AND_RUNNING)))
368 return -3; 368 return -3;
369 /* 369 /*
370 * Everything is OK 370 * Everything is OK
@@ -387,7 +387,7 @@ static int aac_rx_deliver_producer(struct fib * fib)
387 unsigned long nointr = 0; 387 unsigned long nointr = 0;
388 388
389 spin_lock_irqsave(q->lock, qflags); 389 spin_lock_irqsave(q->lock, qflags);
390 aac_queue_get( dev, &Index, AdapNormCmdQueue, fib->hw_fib, 1, fib, &nointr); 390 aac_queue_get( dev, &Index, AdapNormCmdQueue, fib->hw_fib_va, 1, fib, &nointr);
391 391
392 q->numpending++; 392 q->numpending++;
393 *(q->headers.producer) = cpu_to_le32(Index + 1); 393 *(q->headers.producer) = cpu_to_le32(Index + 1);
@@ -419,9 +419,9 @@ static int aac_rx_deliver_message(struct fib * fib)
419 spin_unlock_irqrestore(q->lock, qflags); 419 spin_unlock_irqrestore(q->lock, qflags);
420 for(;;) { 420 for(;;) {
421 Index = rx_readl(dev, MUnit.InboundQueue); 421 Index = rx_readl(dev, MUnit.InboundQueue);
422 if (Index == 0xFFFFFFFFL) 422 if (unlikely(Index == 0xFFFFFFFFL))
423 Index = rx_readl(dev, MUnit.InboundQueue); 423 Index = rx_readl(dev, MUnit.InboundQueue);
424 if (Index != 0xFFFFFFFFL) 424 if (likely(Index != 0xFFFFFFFFL))
425 break; 425 break;
426 if (--count == 0) { 426 if (--count == 0) {
427 spin_lock_irqsave(q->lock, qflags); 427 spin_lock_irqsave(q->lock, qflags);
@@ -437,7 +437,7 @@ static int aac_rx_deliver_message(struct fib * fib)
437 device += sizeof(u32); 437 device += sizeof(u32);
438 writel((u32)(addr >> 32), device); 438 writel((u32)(addr >> 32), device);
439 device += sizeof(u32); 439 device += sizeof(u32);
440 writel(le16_to_cpu(fib->hw_fib->header.Size), device); 440 writel(le16_to_cpu(fib->hw_fib_va->header.Size), device);
441 rx_writel(dev, MUnit.InboundQueue, Index); 441 rx_writel(dev, MUnit.InboundQueue, Index);
442 return 0; 442 return 0;
443} 443}
@@ -460,22 +460,34 @@ static int aac_rx_ioremap(struct aac_dev * dev, u32 size)
460 return 0; 460 return 0;
461} 461}
462 462
463static int aac_rx_restart_adapter(struct aac_dev *dev) 463static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
464{ 464{
465 u32 var; 465 u32 var;
466 466
467 printk(KERN_ERR "%s%d: adapter kernel panic'd.\n", 467 if (bled)
468 dev->name, dev->id); 468 printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n",
469 469 dev->name, dev->id, bled);
470 if (aac_rx_check_health(dev) <= 0) 470 else {
471 return 1; 471 bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS,
472 if (rx_sync_cmd(dev, IOP_RESET, 0, 0, 0, 0, 0, 0, 472 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL);
473 &var, NULL, NULL, NULL, NULL)) 473 if (!bled && (var != 0x00000001))
474 return 1; 474 bled = -EINVAL;
475 }
476 if (bled && (bled != -ETIMEDOUT))
477 bled = aac_adapter_sync_cmd(dev, IOP_RESET,
478 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL);
479
480 if (bled && (bled != -ETIMEDOUT))
481 return -EINVAL;
482 if (bled || (var == 0x3803000F)) { /* USE_OTHER_METHOD */
483 rx_writel(dev, MUnit.reserved2, 3);
484 msleep(5000); /* Delay 5 seconds */
485 var = 0x00000001;
486 }
475 if (var != 0x00000001) 487 if (var != 0x00000001)
476 return 1; 488 return -EINVAL;
477 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) 489 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC)
478 return 1; 490 return -ENODEV;
479 return 0; 491 return 0;
480} 492}
481 493
@@ -517,24 +529,29 @@ int _aac_rx_init(struct aac_dev *dev)
517{ 529{
518 unsigned long start; 530 unsigned long start;
519 unsigned long status; 531 unsigned long status;
520 int instance; 532 int restart = 0;
521 const char * name; 533 int instance = dev->id;
522 534 const char * name = dev->name;
523 instance = dev->id;
524 name = dev->name;
525 535
526 if (aac_adapter_ioremap(dev, dev->base_size)) { 536 if (aac_adapter_ioremap(dev, dev->base_size)) {
527 printk(KERN_WARNING "%s: unable to map adapter.\n", name); 537 printk(KERN_WARNING "%s: unable to map adapter.\n", name);
528 goto error_iounmap; 538 goto error_iounmap;
529 } 539 }
530 540
541 /* Failure to reset here is an option ... */
542 dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
543 if ((((status & 0xff) != 0xff) || reset_devices) &&
544 !aac_rx_restart_adapter(dev, 0))
545 ++restart;
531 /* 546 /*
532 * Check to see if the board panic'd while booting. 547 * Check to see if the board panic'd while booting.
533 */ 548 */
534 status = rx_readl(dev, MUnit.OMRx[0]); 549 status = rx_readl(dev, MUnit.OMRx[0]);
535 if (status & KERNEL_PANIC) 550 if (status & KERNEL_PANIC) {
536 if (aac_rx_restart_adapter(dev)) 551 if (aac_rx_restart_adapter(dev, aac_rx_check_health(dev)))
537 goto error_iounmap; 552 goto error_iounmap;
553 ++restart;
554 }
538 /* 555 /*
539 * Check to see if the board failed any self tests. 556 * Check to see if the board failed any self tests.
540 */ 557 */
@@ -556,12 +573,23 @@ int _aac_rx_init(struct aac_dev *dev)
556 */ 573 */
557 while (!((status = rx_readl(dev, MUnit.OMRx[0])) & KERNEL_UP_AND_RUNNING)) 574 while (!((status = rx_readl(dev, MUnit.OMRx[0])) & KERNEL_UP_AND_RUNNING))
558 { 575 {
559 if(time_after(jiffies, start+startup_timeout*HZ)) 576 if ((restart &&
560 { 577 (status & (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC))) ||
578 time_after(jiffies, start+HZ*startup_timeout)) {
561 printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %lx.\n", 579 printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %lx.\n",
562 dev->name, instance, status); 580 dev->name, instance, status);
563 goto error_iounmap; 581 goto error_iounmap;
564 } 582 }
583 if (!restart &&
584 ((status & (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC)) ||
585 time_after(jiffies, start + HZ *
586 ((startup_timeout > 60)
587 ? (startup_timeout - 60)
588 : (startup_timeout / 2))))) {
589 if (likely(!aac_rx_restart_adapter(dev, aac_rx_check_health(dev))))
590 start = jiffies;
591 ++restart;
592 }
565 msleep(1); 593 msleep(1);
566 } 594 }
567 /* 595 /*
@@ -572,6 +600,7 @@ int _aac_rx_init(struct aac_dev *dev)
572 dev->a_ops.adapter_notify = aac_rx_notify_adapter; 600 dev->a_ops.adapter_notify = aac_rx_notify_adapter;
573 dev->a_ops.adapter_sync_cmd = rx_sync_cmd; 601 dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
574 dev->a_ops.adapter_check_health = aac_rx_check_health; 602 dev->a_ops.adapter_check_health = aac_rx_check_health;
603 dev->a_ops.adapter_restart = aac_rx_restart_adapter;
575 604
576 /* 605 /*
577 * First clear out all interrupts. Then enable the one's that we 606 * First clear out all interrupts. Then enable the one's that we
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 6f1a1780efce..f4b5e9742ab0 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/pci.h>
35#include <linux/spinlock.h> 34#include <linux/spinlock.h>
36#include <linux/slab.h> 35#include <linux/slab.h>
37#include <linux/blkdev.h> 36#include <linux/blkdev.h>
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 1d239f6c0103..cbbfbc9f3e0f 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -35,7 +35,6 @@
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/pci.h>
39#include <linux/isapnp.h> 38#include <linux/isapnp.h>
40#include <linux/blkdev.h> 39#include <linux/blkdev.h>
41#include <linux/mca.h> 40#include <linux/mca.h>
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index 911ea1756e55..5e6620f8dabc 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -57,18 +57,6 @@ config AIC79XX_BUILD_FIRMWARE
57 or modify the assembler Makefile or the files it includes if your 57 or modify the assembler Makefile or the files it includes if your
58 build environment is different than that of the author. 58 build environment is different than that of the author.
59 59
60config AIC79XX_ENABLE_RD_STRM
61 bool "Enable Read Streaming for All Targets"
62 depends on SCSI_AIC79XX
63 default n
64 help
65 Read Streaming is a U320 protocol option that should enhance
66 performance. Early U320 drive firmware actually performs slower
67 with read streaming enabled so it is disabled by default. Read
68 Streaming can be configured in much the same way as tagged queueing
69 using the "rd_strm" command line option. See
70 drivers/scsi/aic7xxx/README.aic79xx for details.
71
72config AIC79XX_DEBUG_ENABLE 60config AIC79XX_DEBUG_ENABLE
73 bool "Compile in Debugging Code" 61 bool "Compile in Debugging Code"
74 depends on SCSI_AIC79XX 62 depends on SCSI_AIC79XX
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
index cd93f9a8611f..88da670a7915 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
@@ -50,16 +50,6 @@ config AIC7XXX_RESET_DELAY_MS
50 50
51 Default: 5000 (5 seconds) 51 Default: 5000 (5 seconds)
52 52
53config AIC7XXX_PROBE_EISA_VL
54 bool "Probe for EISA and VL AIC7XXX Adapters"
55 depends on SCSI_AIC7XXX && EISA
56 help
57 Probe for EISA and VLB Aic7xxx controllers. In many newer systems,
58 the invasive probes necessary to detect these controllers can cause
59 other devices to fail. For this reason, the non-PCI probe code is
60 disabled by default. The current value of this option can be "toggled"
61 via the no_probe kernel command line option.
62
63config AIC7XXX_BUILD_FIRMWARE 53config AIC7XXX_BUILD_FIRMWARE
64 bool "Build Adapter Firmware with Kernel Build" 54 bool "Build Adapter Firmware with Kernel Build"
65 depends on SCSI_AIC7XXX && !PREVENT_FIRMWARE_BUILD 55 depends on SCSI_AIC7XXX && !PREVENT_FIRMWARE_BUILD
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 2be03e975d97..6054881f21f1 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -363,6 +363,8 @@ static int ahd_linux_run_command(struct ahd_softc*,
363 struct scsi_cmnd *); 363 struct scsi_cmnd *);
364static void ahd_linux_setup_tag_info_global(char *p); 364static void ahd_linux_setup_tag_info_global(char *p);
365static int aic79xx_setup(char *c); 365static int aic79xx_setup(char *c);
366static void ahd_freeze_simq(struct ahd_softc *ahd);
367static void ahd_release_simq(struct ahd_softc *ahd);
366 368
367static int ahd_linux_unit; 369static int ahd_linux_unit;
368 370
@@ -2016,13 +2018,13 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
2016 cmd->scsi_done(cmd); 2018 cmd->scsi_done(cmd);
2017} 2019}
2018 2020
2019void 2021static void
2020ahd_freeze_simq(struct ahd_softc *ahd) 2022ahd_freeze_simq(struct ahd_softc *ahd)
2021{ 2023{
2022 scsi_block_requests(ahd->platform_data->host); 2024 scsi_block_requests(ahd->platform_data->host);
2023} 2025}
2024 2026
2025void 2027static void
2026ahd_release_simq(struct ahd_softc *ahd) 2028ahd_release_simq(struct ahd_softc *ahd)
2027{ 2029{
2028 scsi_unblock_requests(ahd->platform_data->host); 2030 scsi_unblock_requests(ahd->platform_data->host);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index 147c83c456a5..9218f29314fa 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -837,8 +837,6 @@ int ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg);
837void ahd_platform_free(struct ahd_softc *ahd); 837void ahd_platform_free(struct ahd_softc *ahd);
838void ahd_platform_init(struct ahd_softc *ahd); 838void ahd_platform_init(struct ahd_softc *ahd);
839void ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb); 839void ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb);
840void ahd_freeze_simq(struct ahd_softc *ahd);
841void ahd_release_simq(struct ahd_softc *ahd);
842 840
843static __inline void 841static __inline void
844ahd_freeze_scb(struct scb *scb) 842ahd_freeze_scb(struct scb *scb)
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 954c7c24501d..e1bd57b9f23d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -1278,11 +1278,6 @@ typedef enum {
1278 AHC_QUEUE_TAGGED 1278 AHC_QUEUE_TAGGED
1279} ahc_queue_alg; 1279} ahc_queue_alg;
1280 1280
1281void ahc_set_tags(struct ahc_softc *ahc,
1282 struct scsi_cmnd *cmd,
1283 struct ahc_devinfo *devinfo,
1284 ahc_queue_alg alg);
1285
1286/**************************** Target Mode *************************************/ 1281/**************************** Target Mode *************************************/
1287#ifdef AHC_TARGET_MODE 1282#ifdef AHC_TARGET_MODE
1288void ahc_send_lstate_events(struct ahc_softc *, 1283void ahc_send_lstate_events(struct ahc_softc *,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 50ef785224de..75733b09f27a 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -2073,7 +2073,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
2073/* 2073/*
2074 * Update the current state of tagged queuing for a given target. 2074 * Update the current state of tagged queuing for a given target.
2075 */ 2075 */
2076void 2076static void
2077ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd, 2077ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
2078 struct ahc_devinfo *devinfo, ahc_queue_alg alg) 2078 struct ahc_devinfo *devinfo, ahc_queue_alg alg)
2079{ 2079{
diff --git a/drivers/scsi/aic94xx/aic94xx_scb.c b/drivers/scsi/aic94xx/aic94xx_scb.c
index 8f43ff772f23..db6ab1a3b81e 100644
--- a/drivers/scsi/aic94xx/aic94xx_scb.c
+++ b/drivers/scsi/aic94xx/aic94xx_scb.c
@@ -24,7 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27#include <linux/pci.h>
28#include <scsi/scsi_host.h> 27#include <scsi/scsi_host.h>
29 28
30#include "aic94xx.h" 29#include "aic94xx.h"
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index 12497da5529d..03bfed61bffc 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -49,7 +49,6 @@
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/pci.h>
53 52
54#include <scsi/scsi_cmnd.h> 53#include <scsi/scsi_cmnd.h>
55#include <scsi/scsi_device.h> 54#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 0f920c84ac0f..eff846ae0aff 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -1,19 +1,19 @@
1/* 1/*
2 * NCR 5380 generic driver routines. These should make it *trivial* 2 * NCR 5380 generic driver routines. These should make it *trivial*
3 * to implement 5380 SCSI drivers under Linux with a non-trantor 3 * to implement 5380 SCSI drivers under Linux with a non-trantor
4 * architecture. 4 * architecture.
5 * 5 *
6 * Note that these routines also work with NR53c400 family chips. 6 * Note that these routines also work with NR53c400 family chips.
7 * 7 *
8 * Copyright 1993, Drew Eckhardt 8 * Copyright 1993, Drew Eckhardt
9 * Visionary Computing 9 * Visionary Computing
10 * (Unix and Linux consulting and custom programming) 10 * (Unix and Linux consulting and custom programming)
11 * drew@colorado.edu 11 * drew@colorado.edu
12 * +1 (303) 666-5836 12 * +1 (303) 666-5836
13 * 13 *
14 * DISTRIBUTION RELEASE 6. 14 * DISTRIBUTION RELEASE 6.
15 * 15 *
16 * For more information, please consult 16 * For more information, please consult
17 * 17 *
18 * NCR 5380 Family 18 * NCR 5380 Family
19 * SCSI Protocol Controller 19 * SCSI Protocol Controller
@@ -57,7 +57,7 @@
57 * - I've deleted all the stuff for AUTOPROBE_IRQ, REAL_DMA_POLL, PSEUDO_DMA 57 * - I've deleted all the stuff for AUTOPROBE_IRQ, REAL_DMA_POLL, PSEUDO_DMA
58 * and USLEEP, because these were messing up readability and will never be 58 * and USLEEP, because these were messing up readability and will never be
59 * needed for Atari SCSI. 59 * needed for Atari SCSI.
60 * 60 *
61 * - I've revised the NCR5380_main() calling scheme (relax the 'main_running' 61 * - I've revised the NCR5380_main() calling scheme (relax the 'main_running'
62 * stuff), and 'main' is executed in a bottom half if awoken by an 62 * stuff), and 'main' is executed in a bottom half if awoken by an
63 * interrupt. 63 * interrupt.
@@ -69,21 +69,29 @@
69 */ 69 */
70 70
71/* 71/*
72 * Further development / testing that should be done : 72 * Further development / testing that should be done :
73 * 1. Test linked command handling code after Eric is ready with 73 * 1. Test linked command handling code after Eric is ready with
74 * the high level code. 74 * the high level code.
75 */ 75 */
76#include <scsi/scsi_dbg.h> 76#include <scsi/scsi_dbg.h>
77#include <scsi/scsi_transport_spi.h> 77#include <scsi/scsi_transport_spi.h>
78 78
79#if (NDEBUG & NDEBUG_LISTS) 79#if (NDEBUG & NDEBUG_LISTS)
80#define LIST(x,y) \ 80#define LIST(x, y) \
81 { printk("LINE:%d Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); \ 81 do { \
82 if ((x)==(y)) udelay(5); } 82 printk("LINE:%d Adding %p to %p\n", \
83#define REMOVE(w,x,y,z) \ 83 __LINE__, (void*)(x), (void*)(y)); \
84 { printk("LINE:%d Removing: %p->%p %p->%p \n", __LINE__, \ 84 if ((x) == (y)) \
85 (void*)(w), (void*)(x), (void*)(y), (void*)(z)); \ 85 udelay(5); \
86 if ((x)==(y)) udelay(5); } 86 } while (0)
87#define REMOVE(w, x, y, z) \
88 do { \
89 printk("LINE:%d Removing: %p->%p %p->%p \n", \
90 __LINE__, (void*)(w), (void*)(x), \
91 (void*)(y), (void*)(z)); \
92 if ((x) == (y)) \
93 udelay(5); \
94 } while (0)
87#else 95#else
88#define LIST(x,y) 96#define LIST(x,y)
89#define REMOVE(w,x,y,z) 97#define REMOVE(w,x,y,z)
@@ -103,62 +111,62 @@
103 * more difficult than it has to be. 111 * more difficult than it has to be.
104 * 112 *
105 * Also, many of the SCSI drivers were written before the command queuing 113 * Also, many of the SCSI drivers were written before the command queuing
106 * routines were implemented, meaning their implementations of queued 114 * routines were implemented, meaning their implementations of queued
107 * commands were hacked on rather than designed in from the start. 115 * commands were hacked on rather than designed in from the start.
108 * 116 *
109 * When I designed the Linux SCSI drivers I figured that 117 * When I designed the Linux SCSI drivers I figured that
110 * while having two different SCSI boards in a system might be useful 118 * while having two different SCSI boards in a system might be useful
111 * for debugging things, two of the same type wouldn't be used. 119 * for debugging things, two of the same type wouldn't be used.
112 * Well, I was wrong and a number of users have mailed me about running 120 * Well, I was wrong and a number of users have mailed me about running
113 * multiple high-performance SCSI boards in a server. 121 * multiple high-performance SCSI boards in a server.
114 * 122 *
115 * Finally, when I get questions from users, I have no idea what 123 * Finally, when I get questions from users, I have no idea what
116 * revision of my driver they are running. 124 * revision of my driver they are running.
117 * 125 *
118 * This driver attempts to address these problems : 126 * This driver attempts to address these problems :
119 * This is a generic 5380 driver. To use it on a different platform, 127 * This is a generic 5380 driver. To use it on a different platform,
120 * one simply writes appropriate system specific macros (ie, data 128 * one simply writes appropriate system specific macros (ie, data
121 * transfer - some PC's will use the I/O bus, 68K's must use 129 * transfer - some PC's will use the I/O bus, 68K's must use
122 * memory mapped) and drops this file in their 'C' wrapper. 130 * memory mapped) and drops this file in their 'C' wrapper.
123 * 131 *
124 * As far as command queueing, two queues are maintained for 132 * As far as command queueing, two queues are maintained for
125 * each 5380 in the system - commands that haven't been issued yet, 133 * each 5380 in the system - commands that haven't been issued yet,
126 * and commands that are currently executing. This means that an 134 * and commands that are currently executing. This means that an
127 * unlimited number of commands may be queued, letting 135 * unlimited number of commands may be queued, letting
128 * more commands propagate from the higher driver levels giving higher 136 * more commands propagate from the higher driver levels giving higher
129 * throughput. Note that both I_T_L and I_T_L_Q nexuses are supported, 137 * throughput. Note that both I_T_L and I_T_L_Q nexuses are supported,
130 * allowing multiple commands to propagate all the way to a SCSI-II device 138 * allowing multiple commands to propagate all the way to a SCSI-II device
131 * while a command is already executing. 139 * while a command is already executing.
132 * 140 *
133 * To solve the multiple-boards-in-the-same-system problem, 141 * To solve the multiple-boards-in-the-same-system problem,
134 * there is a separate instance structure for each instance 142 * there is a separate instance structure for each instance
135 * of a 5380 in the system. So, multiple NCR5380 drivers will 143 * of a 5380 in the system. So, multiple NCR5380 drivers will
136 * be able to coexist with appropriate changes to the high level 144 * be able to coexist with appropriate changes to the high level
137 * SCSI code. 145 * SCSI code.
138 * 146 *
139 * A NCR5380_PUBLIC_REVISION macro is provided, with the release 147 * A NCR5380_PUBLIC_REVISION macro is provided, with the release
140 * number (updated for each public release) printed by the 148 * number (updated for each public release) printed by the
141 * NCR5380_print_options command, which should be called from the 149 * NCR5380_print_options command, which should be called from the
142 * wrapper detect function, so that I know what release of the driver 150 * wrapper detect function, so that I know what release of the driver
143 * users are using. 151 * users are using.
144 * 152 *
145 * Issues specific to the NCR5380 : 153 * Issues specific to the NCR5380 :
146 * 154 *
147 * When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead 155 * When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead
148 * piece of hardware that requires you to sit in a loop polling for 156 * piece of hardware that requires you to sit in a loop polling for
149 * the REQ signal as long as you are connected. Some devices are 157 * the REQ signal as long as you are connected. Some devices are
150 * brain dead (ie, many TEXEL CD ROM drives) and won't disconnect 158 * brain dead (ie, many TEXEL CD ROM drives) and won't disconnect
151 * while doing long seek operations. 159 * while doing long seek operations.
152 * 160 *
153 * The workaround for this is to keep track of devices that have 161 * The workaround for this is to keep track of devices that have
154 * disconnected. If the device hasn't disconnected, for commands that 162 * disconnected. If the device hasn't disconnected, for commands that
155 * should disconnect, we do something like 163 * should disconnect, we do something like
156 * 164 *
157 * while (!REQ is asserted) { sleep for N usecs; poll for M usecs } 165 * while (!REQ is asserted) { sleep for N usecs; poll for M usecs }
158 * 166 *
159 * Some tweaking of N and M needs to be done. An algorithm based 167 * Some tweaking of N and M needs to be done. An algorithm based
160 * on "time to data" would give the best results as long as short time 168 * on "time to data" would give the best results as long as short time
161 * to datas (ie, on the same track) were considered, however these 169 * to datas (ie, on the same track) were considered, however these
162 * broken devices are the exception rather than the rule and I'd rather 170 * broken devices are the exception rather than the rule and I'd rather
163 * spend my time optimizing for the normal case. 171 * spend my time optimizing for the normal case.
164 * 172 *
@@ -167,9 +175,9 @@
167 * At the heart of the design is a coroutine, NCR5380_main, 175 * At the heart of the design is a coroutine, NCR5380_main,
168 * which is started when not running by the interrupt handler, 176 * which is started when not running by the interrupt handler,
169 * timer, and queue command function. It attempts to establish 177 * timer, and queue command function. It attempts to establish
170 * I_T_L or I_T_L_Q nexuses by removing the commands from the 178 * I_T_L or I_T_L_Q nexuses by removing the commands from the
171 * issue queue and calling NCR5380_select() if a nexus 179 * issue queue and calling NCR5380_select() if a nexus
172 * is not established. 180 * is not established.
173 * 181 *
174 * Once a nexus is established, the NCR5380_information_transfer() 182 * Once a nexus is established, the NCR5380_information_transfer()
175 * phase goes through the various phases as instructed by the target. 183 * phase goes through the various phases as instructed by the target.
@@ -183,10 +191,10 @@
183 * calling NCR5380_intr() which will in turn call NCR5380_reselect 191 * calling NCR5380_intr() which will in turn call NCR5380_reselect
184 * to reestablish a nexus. This will run main if necessary. 192 * to reestablish a nexus. This will run main if necessary.
185 * 193 *
186 * On command termination, the done function will be called as 194 * On command termination, the done function will be called as
187 * appropriate. 195 * appropriate.
188 * 196 *
189 * SCSI pointers are maintained in the SCp field of SCSI command 197 * SCSI pointers are maintained in the SCp field of SCSI command
190 * structures, being initialized after the command is connected 198 * structures, being initialized after the command is connected
191 * in NCR5380_select, and set as appropriate in NCR5380_information_transfer. 199 * in NCR5380_select, and set as appropriate in NCR5380_information_transfer.
192 * Note that in violation of the standard, an implicit SAVE POINTERS operation 200 * Note that in violation of the standard, an implicit SAVE POINTERS operation
@@ -196,12 +204,12 @@
196/* 204/*
197 * Using this file : 205 * Using this file :
198 * This file a skeleton Linux SCSI driver for the NCR 5380 series 206 * This file a skeleton Linux SCSI driver for the NCR 5380 series
199 * of chips. To use it, you write an architecture specific functions 207 * of chips. To use it, you write an architecture specific functions
200 * and macros and include this file in your driver. 208 * and macros and include this file in your driver.
201 * 209 *
202 * These macros control options : 210 * These macros control options :
203 * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically 211 * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
204 * for commands that return with a CHECK CONDITION status. 212 * for commands that return with a CHECK CONDITION status.
205 * 213 *
206 * LINKED - if defined, linked commands are supported. 214 * LINKED - if defined, linked commands are supported.
207 * 215 *
@@ -210,18 +218,18 @@
210 * SUPPORT_TAGS - if defined, SCSI-2 tagged queuing is used where possible 218 * SUPPORT_TAGS - if defined, SCSI-2 tagged queuing is used where possible
211 * 219 *
212 * These macros MUST be defined : 220 * These macros MUST be defined :
213 * 221 *
214 * NCR5380_read(register) - read from the specified register 222 * NCR5380_read(register) - read from the specified register
215 * 223 *
216 * NCR5380_write(register, value) - write to the specific register 224 * NCR5380_write(register, value) - write to the specific register
217 * 225 *
218 * Either real DMA *or* pseudo DMA may be implemented 226 * Either real DMA *or* pseudo DMA may be implemented
219 * REAL functions : 227 * REAL functions :
220 * NCR5380_REAL_DMA should be defined if real DMA is to be used. 228 * NCR5380_REAL_DMA should be defined if real DMA is to be used.
221 * Note that the DMA setup functions should return the number of bytes 229 * Note that the DMA setup functions should return the number of bytes
222 * that they were able to program the controller for. 230 * that they were able to program the controller for.
223 * 231 *
224 * Also note that generic i386/PC versions of these macros are 232 * Also note that generic i386/PC versions of these macros are
225 * available as NCR5380_i386_dma_write_setup, 233 * available as NCR5380_i386_dma_write_setup,
226 * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual. 234 * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual.
227 * 235 *
@@ -234,14 +242,14 @@
234 * NCR5380_pread(instance, dst, count); 242 * NCR5380_pread(instance, dst, count);
235 * 243 *
236 * If nothing specific to this implementation needs doing (ie, with external 244 * If nothing specific to this implementation needs doing (ie, with external
237 * hardware), you must also define 245 * hardware), you must also define
238 * 246 *
239 * NCR5380_queue_command 247 * NCR5380_queue_command
240 * NCR5380_reset 248 * NCR5380_reset
241 * NCR5380_abort 249 * NCR5380_abort
242 * NCR5380_proc_info 250 * NCR5380_proc_info
243 * 251 *
244 * to be the global entry points into the specific driver, ie 252 * to be the global entry points into the specific driver, ie
245 * #define NCR5380_queue_command t128_queue_command. 253 * #define NCR5380_queue_command t128_queue_command.
246 * 254 *
247 * If this is not done, the routines will be defined as static functions 255 * If this is not done, the routines will be defined as static functions
@@ -249,7 +257,7 @@
249 * accessible wrapper function. 257 * accessible wrapper function.
250 * 258 *
251 * The generic driver is initialized by calling NCR5380_init(instance), 259 * The generic driver is initialized by calling NCR5380_init(instance),
252 * after setting the appropriate host specific fields and ID. If the 260 * after setting the appropriate host specific fields and ID. If the
253 * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance, 261 * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
254 * possible) function may be used. Before the specific driver initialization 262 * possible) function may be used. Before the specific driver initialization
255 * code finishes, NCR5380_print_options should be called. 263 * code finishes, NCR5380_print_options should be called.
@@ -264,8 +272,9 @@ static struct scsi_host_template *the_template = NULL;
264 (struct NCR5380_hostdata *)(in)->hostdata 272 (struct NCR5380_hostdata *)(in)->hostdata
265#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) 273#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata)
266 274
267#define NEXT(cmd) ((Scsi_Cmnd *)((cmd)->host_scribble)) 275#define NEXT(cmd) ((Scsi_Cmnd *)(cmd)->host_scribble)
268#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) 276#define SET_NEXT(cmd,next) ((cmd)->host_scribble = (void *)(next))
277#define NEXTADDR(cmd) ((Scsi_Cmnd **)&(cmd)->host_scribble)
269 278
270#define HOSTNO instance->host_no 279#define HOSTNO instance->host_no
271#define H_NO(cmd) (cmd)->device->host->host_no 280#define H_NO(cmd) (cmd)->device->host->host_no
@@ -312,34 +321,34 @@ static struct scsi_host_template *the_template = NULL;
312#define TAG_NONE 0xff 321#define TAG_NONE 0xff
313 322
314typedef struct { 323typedef struct {
315 DECLARE_BITMAP(allocated, MAX_TAGS); 324 DECLARE_BITMAP(allocated, MAX_TAGS);
316 int nr_allocated; 325 int nr_allocated;
317 int queue_size; 326 int queue_size;
318} TAG_ALLOC; 327} TAG_ALLOC;
319 328
320static TAG_ALLOC TagAlloc[8][8]; /* 8 targets and 8 LUNs */ 329static TAG_ALLOC TagAlloc[8][8]; /* 8 targets and 8 LUNs */
321 330
322 331
323static void __init init_tags( void ) 332static void __init init_tags(void)
324{ 333{
325 int target, lun; 334 int target, lun;
326 TAG_ALLOC *ta; 335 TAG_ALLOC *ta;
327 336
328 if (!setup_use_tagged_queuing) 337 if (!setup_use_tagged_queuing)
329 return; 338 return;
330 339
331 for( target = 0; target < 8; ++target ) { 340 for (target = 0; target < 8; ++target) {
332 for( lun = 0; lun < 8; ++lun ) { 341 for (lun = 0; lun < 8; ++lun) {
333 ta = &TagAlloc[target][lun]; 342 ta = &TagAlloc[target][lun];
334 bitmap_zero(ta->allocated, MAX_TAGS); 343 bitmap_zero(ta->allocated, MAX_TAGS);
335 ta->nr_allocated = 0; 344 ta->nr_allocated = 0;
336 /* At the beginning, assume the maximum queue size we could 345 /* At the beginning, assume the maximum queue size we could
337 * support (MAX_TAGS). This value will be decreased if the target 346 * support (MAX_TAGS). This value will be decreased if the target
338 * returns QUEUE_FULL status. 347 * returns QUEUE_FULL status.
339 */ 348 */
340 ta->queue_size = MAX_TAGS; 349 ta->queue_size = MAX_TAGS;
350 }
341 } 351 }
342 }
343} 352}
344 353
345 354
@@ -348,24 +357,24 @@ static void __init init_tags( void )
348 * check that there is a free tag and the target's queue won't overflow. This 357 * check that there is a free tag and the target's queue won't overflow. This
349 * function should be called with interrupts disabled to avoid race 358 * function should be called with interrupts disabled to avoid race
350 * conditions. 359 * conditions.
351 */ 360 */
352 361
353static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) 362static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged)
354{ 363{
355 SETUP_HOSTDATA(cmd->device->host); 364 SETUP_HOSTDATA(cmd->device->host);
356 365
357 if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)) 366 if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))
358 return( 1 ); 367 return 1;
359 if (!should_be_tagged || 368 if (!should_be_tagged ||
360 !setup_use_tagged_queuing || !cmd->device->tagged_supported) 369 !setup_use_tagged_queuing || !cmd->device->tagged_supported)
361 return( 0 ); 370 return 0;
362 if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >= 371 if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
363 TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) { 372 TagAlloc[cmd->device->id][cmd->device->lun].queue_size) {
364 TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n", 373 TAG_PRINTK("scsi%d: target %d lun %d: no free tags\n",
365 H_NO(cmd), cmd->device->id, cmd->device->lun ); 374 H_NO(cmd), cmd->device->id, cmd->device->lun);
366 return( 1 ); 375 return 1;
367 } 376 }
368 return( 0 ); 377 return 0;
369} 378}
370 379
371 380
@@ -374,31 +383,30 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
374 * untagged. 383 * untagged.
375 */ 384 */
376 385
377static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) 386static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
378{ 387{
379 SETUP_HOSTDATA(cmd->device->host); 388 SETUP_HOSTDATA(cmd->device->host);
380 389
381 /* If we or the target don't support tagged queuing, allocate the LUN for 390 /* If we or the target don't support tagged queuing, allocate the LUN for
382 * an untagged command. 391 * an untagged command.
383 */ 392 */
384 if (!should_be_tagged || 393 if (!should_be_tagged ||
385 !setup_use_tagged_queuing || !cmd->device->tagged_supported) { 394 !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
386 cmd->tag = TAG_NONE; 395 cmd->tag = TAG_NONE;
387 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 396 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
388 TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged " 397 TAG_PRINTK("scsi%d: target %d lun %d now allocated by untagged "
389 "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun ); 398 "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun);
390 } 399 } else {
391 else { 400 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
392 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 401
393 402 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
394 cmd->tag = find_first_zero_bit( ta->allocated, MAX_TAGS ); 403 set_bit(cmd->tag, ta->allocated);
395 set_bit( cmd->tag, ta->allocated ); 404 ta->nr_allocated++;
396 ta->nr_allocated++; 405 TAG_PRINTK("scsi%d: using tag %d for target %d lun %d "
397 TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d " 406 "(now %d tags in use)\n",
398 "(now %d tags in use)\n", 407 H_NO(cmd), cmd->tag, cmd->device->id,
399 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun, 408 cmd->device->lun, ta->nr_allocated);
400 ta->nr_allocated ); 409 }
401 }
402} 410}
403 411
404 412
@@ -406,44 +414,42 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
406 * unlock the LUN. 414 * unlock the LUN.
407 */ 415 */
408 416
409static void cmd_free_tag( Scsi_Cmnd *cmd ) 417static void cmd_free_tag(Scsi_Cmnd *cmd)
410{ 418{
411 SETUP_HOSTDATA(cmd->device->host); 419 SETUP_HOSTDATA(cmd->device->host);
412 420
413 if (cmd->tag == TAG_NONE) { 421 if (cmd->tag == TAG_NONE) {
414 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 422 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
415 TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n", 423 TAG_PRINTK("scsi%d: target %d lun %d untagged cmd finished\n",
416 H_NO(cmd), cmd->device->id, cmd->device->lun ); 424 H_NO(cmd), cmd->device->id, cmd->device->lun);
417 } 425 } else if (cmd->tag >= MAX_TAGS) {
418 else if (cmd->tag >= MAX_TAGS) { 426 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
419 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", 427 H_NO(cmd), cmd->tag);
420 H_NO(cmd), cmd->tag ); 428 } else {
421 } 429 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
422 else { 430 clear_bit(cmd->tag, ta->allocated);
423 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 431 ta->nr_allocated--;
424 clear_bit( cmd->tag, ta->allocated ); 432 TAG_PRINTK("scsi%d: freed tag %d for target %d lun %d\n",
425 ta->nr_allocated--; 433 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun);
426 TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n", 434 }
427 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun );
428 }
429} 435}
430 436
431 437
432static void free_all_tags( void ) 438static void free_all_tags(void)
433{ 439{
434 int target, lun; 440 int target, lun;
435 TAG_ALLOC *ta; 441 TAG_ALLOC *ta;
436 442
437 if (!setup_use_tagged_queuing) 443 if (!setup_use_tagged_queuing)
438 return; 444 return;
439 445
440 for( target = 0; target < 8; ++target ) { 446 for (target = 0; target < 8; ++target) {
441 for( lun = 0; lun < 8; ++lun ) { 447 for (lun = 0; lun < 8; ++lun) {
442 ta = &TagAlloc[target][lun]; 448 ta = &TagAlloc[target][lun];
443 bitmap_zero(ta->allocated, MAX_TAGS); 449 bitmap_zero(ta->allocated, MAX_TAGS);
444 ta->nr_allocated = 0; 450 ta->nr_allocated = 0;
451 }
445 } 452 }
446 }
447} 453}
448 454
449#endif /* SUPPORT_TAGS */ 455#endif /* SUPPORT_TAGS */
@@ -461,89 +467,94 @@ static void free_all_tags( void )
461 * assumed to be already transfered into ptr/this_residual. 467 * assumed to be already transfered into ptr/this_residual.
462 */ 468 */
463 469
464static void merge_contiguous_buffers( Scsi_Cmnd *cmd ) 470static void merge_contiguous_buffers(Scsi_Cmnd *cmd)
465{ 471{
466 unsigned long endaddr; 472 unsigned long endaddr;
467#if (NDEBUG & NDEBUG_MERGING) 473#if (NDEBUG & NDEBUG_MERGING)
468 unsigned long oldlen = cmd->SCp.this_residual; 474 unsigned long oldlen = cmd->SCp.this_residual;
469 int cnt = 1; 475 int cnt = 1;
470#endif 476#endif
471 477
472 for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1; 478 for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
473 cmd->SCp.buffers_residual && 479 cmd->SCp.buffers_residual &&
474 virt_to_phys(page_address(cmd->SCp.buffer[1].page)+ 480 virt_to_phys(page_address(cmd->SCp.buffer[1].page) +
475 cmd->SCp.buffer[1].offset) == endaddr; ) { 481 cmd->SCp.buffer[1].offset) == endaddr;) {
476 MER_PRINTK("VTOP(%p) == %08lx -> merging\n", 482 MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
477 cmd->SCp.buffer[1].address, endaddr); 483 page_address(cmd->SCp.buffer[1].page), endaddr);
478#if (NDEBUG & NDEBUG_MERGING) 484#if (NDEBUG & NDEBUG_MERGING)
479 ++cnt; 485 ++cnt;
480#endif 486#endif
481 ++cmd->SCp.buffer; 487 ++cmd->SCp.buffer;
482 --cmd->SCp.buffers_residual; 488 --cmd->SCp.buffers_residual;
483 cmd->SCp.this_residual += cmd->SCp.buffer->length; 489 cmd->SCp.this_residual += cmd->SCp.buffer->length;
484 endaddr += cmd->SCp.buffer->length; 490 endaddr += cmd->SCp.buffer->length;
485 } 491 }
486#if (NDEBUG & NDEBUG_MERGING) 492#if (NDEBUG & NDEBUG_MERGING)
487 if (oldlen != cmd->SCp.this_residual) 493 if (oldlen != cmd->SCp.this_residual)
488 MER_PRINTK("merged %d buffers from %p, new length %08x\n", 494 MER_PRINTK("merged %d buffers from %p, new length %08x\n",
489 cnt, cmd->SCp.ptr, cmd->SCp.this_residual); 495 cnt, cmd->SCp.ptr, cmd->SCp.this_residual);
490#endif 496#endif
491} 497}
492 498
493/* 499/*
494 * Function : void initialize_SCp(Scsi_Cmnd *cmd) 500 * Function : void initialize_SCp(Scsi_Cmnd *cmd)
495 * 501 *
496 * Purpose : initialize the saved data pointers for cmd to point to the 502 * Purpose : initialize the saved data pointers for cmd to point to the
497 * start of the buffer. 503 * start of the buffer.
498 * 504 *
499 * Inputs : cmd - Scsi_Cmnd structure to have pointers reset. 505 * Inputs : cmd - Scsi_Cmnd structure to have pointers reset.
500 */ 506 */
501 507
502static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) 508static inline void initialize_SCp(Scsi_Cmnd *cmd)
503{ 509{
504 /* 510 /*
505 * Initialize the Scsi Pointer field so that all of the commands in the 511 * Initialize the Scsi Pointer field so that all of the commands in the
506 * various queues are valid. 512 * various queues are valid.
507 */
508
509 if (cmd->use_sg) {
510 cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
511 cmd->SCp.buffers_residual = cmd->use_sg - 1;
512 cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page)+
513 cmd->SCp.buffer->offset;
514 cmd->SCp.this_residual = cmd->SCp.buffer->length;
515 /* ++roman: Try to merge some scatter-buffers if they are at
516 * contiguous physical addresses.
517 */ 513 */
518 merge_contiguous_buffers( cmd ); 514
519 } else { 515 if (cmd->use_sg) {
520 cmd->SCp.buffer = NULL; 516 cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer;
521 cmd->SCp.buffers_residual = 0; 517 cmd->SCp.buffers_residual = cmd->use_sg - 1;
522 cmd->SCp.ptr = (char *) cmd->request_buffer; 518 cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page) +
523 cmd->SCp.this_residual = cmd->request_bufflen; 519 cmd->SCp.buffer->offset;
524 } 520 cmd->SCp.this_residual = cmd->SCp.buffer->length;
521 /* ++roman: Try to merge some scatter-buffers if they are at
522 * contiguous physical addresses.
523 */
524 merge_contiguous_buffers(cmd);
525 } else {
526 cmd->SCp.buffer = NULL;
527 cmd->SCp.buffers_residual = 0;
528 cmd->SCp.ptr = (char *)cmd->request_buffer;
529 cmd->SCp.this_residual = cmd->request_bufflen;
530 }
525} 531}
526 532
527#include <linux/delay.h> 533#include <linux/delay.h>
528 534
529#if NDEBUG 535#if NDEBUG
530static struct { 536static struct {
531 unsigned char mask; 537 unsigned char mask;
532 const char * name;} 538 const char *name;
533signals[] = {{ SR_DBP, "PARITY"}, { SR_RST, "RST" }, { SR_BSY, "BSY" }, 539} signals[] = {
534 { SR_REQ, "REQ" }, { SR_MSG, "MSG" }, { SR_CD, "CD" }, { SR_IO, "IO" }, 540 { SR_DBP, "PARITY"}, { SR_RST, "RST" }, { SR_BSY, "BSY" },
535 { SR_SEL, "SEL" }, {0, NULL}}, 541 { SR_REQ, "REQ" }, { SR_MSG, "MSG" }, { SR_CD, "CD" }, { SR_IO, "IO" },
536basrs[] = {{BASR_ATN, "ATN"}, {BASR_ACK, "ACK"}, {0, NULL}}, 542 { SR_SEL, "SEL" }, {0, NULL}
537icrs[] = {{ICR_ASSERT_RST, "ASSERT RST"},{ICR_ASSERT_ACK, "ASSERT ACK"}, 543}, basrs[] = {
538 {ICR_ASSERT_BSY, "ASSERT BSY"}, {ICR_ASSERT_SEL, "ASSERT SEL"}, 544 {BASR_ATN, "ATN"}, {BASR_ACK, "ACK"}, {0, NULL}
539 {ICR_ASSERT_ATN, "ASSERT ATN"}, {ICR_ASSERT_DATA, "ASSERT DATA"}, 545}, icrs[] = {
540 {0, NULL}}, 546 {ICR_ASSERT_RST, "ASSERT RST"},{ICR_ASSERT_ACK, "ASSERT ACK"},
541mrs[] = {{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"}, 547 {ICR_ASSERT_BSY, "ASSERT BSY"}, {ICR_ASSERT_SEL, "ASSERT SEL"},
542 {MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, {MR_ENABLE_PAR_INTR, 548 {ICR_ASSERT_ATN, "ASSERT ATN"}, {ICR_ASSERT_DATA, "ASSERT DATA"},
543 "MODE PARITY INTR"}, {MR_ENABLE_EOP_INTR,"MODE EOP INTR"}, 549 {0, NULL}
544 {MR_MONITOR_BSY, "MODE MONITOR BSY"}, 550}, mrs[] = {
545 {MR_DMA_MODE, "MODE DMA"}, {MR_ARBITRATE, "MODE ARBITRATION"}, 551 {MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"},
546 {0, NULL}}; 552 {MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, {MR_ENABLE_PAR_INTR,
553 "MODE PARITY INTR"}, {MR_ENABLE_EOP_INTR,"MODE EOP INTR"},
554 {MR_MONITOR_BSY, "MODE MONITOR BSY"},
555 {MR_DMA_MODE, "MODE DMA"}, {MR_ARBITRATE, "MODE ARBITRATION"},
556 {0, NULL}
557};
547 558
548/* 559/*
549 * Function : void NCR5380_print(struct Scsi_Host *instance) 560 * Function : void NCR5380_print(struct Scsi_Host *instance)
@@ -553,45 +564,47 @@ mrs[] = {{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"},
553 * Input : instance - which NCR5380 564 * Input : instance - which NCR5380
554 */ 565 */
555 566
556static void NCR5380_print(struct Scsi_Host *instance) { 567static void NCR5380_print(struct Scsi_Host *instance)
557 unsigned char status, data, basr, mr, icr, i; 568{
558 unsigned long flags; 569 unsigned char status, data, basr, mr, icr, i;
559 570 unsigned long flags;
560 local_irq_save(flags); 571
561 data = NCR5380_read(CURRENT_SCSI_DATA_REG); 572 local_irq_save(flags);
562 status = NCR5380_read(STATUS_REG); 573 data = NCR5380_read(CURRENT_SCSI_DATA_REG);
563 mr = NCR5380_read(MODE_REG); 574 status = NCR5380_read(STATUS_REG);
564 icr = NCR5380_read(INITIATOR_COMMAND_REG); 575 mr = NCR5380_read(MODE_REG);
565 basr = NCR5380_read(BUS_AND_STATUS_REG); 576 icr = NCR5380_read(INITIATOR_COMMAND_REG);
566 local_irq_restore(flags); 577 basr = NCR5380_read(BUS_AND_STATUS_REG);
567 printk("STATUS_REG: %02x ", status); 578 local_irq_restore(flags);
568 for (i = 0; signals[i].mask ; ++i) 579 printk("STATUS_REG: %02x ", status);
569 if (status & signals[i].mask) 580 for (i = 0; signals[i].mask; ++i)
570 printk(",%s", signals[i].name); 581 if (status & signals[i].mask)
571 printk("\nBASR: %02x ", basr); 582 printk(",%s", signals[i].name);
572 for (i = 0; basrs[i].mask ; ++i) 583 printk("\nBASR: %02x ", basr);
573 if (basr & basrs[i].mask) 584 for (i = 0; basrs[i].mask; ++i)
574 printk(",%s", basrs[i].name); 585 if (basr & basrs[i].mask)
575 printk("\nICR: %02x ", icr); 586 printk(",%s", basrs[i].name);
576 for (i = 0; icrs[i].mask; ++i) 587 printk("\nICR: %02x ", icr);
577 if (icr & icrs[i].mask) 588 for (i = 0; icrs[i].mask; ++i)
578 printk(",%s", icrs[i].name); 589 if (icr & icrs[i].mask)
579 printk("\nMODE: %02x ", mr); 590 printk(",%s", icrs[i].name);
580 for (i = 0; mrs[i].mask; ++i) 591 printk("\nMODE: %02x ", mr);
581 if (mr & mrs[i].mask) 592 for (i = 0; mrs[i].mask; ++i)
582 printk(",%s", mrs[i].name); 593 if (mr & mrs[i].mask)
583 printk("\n"); 594 printk(",%s", mrs[i].name);
595 printk("\n");
584} 596}
585 597
586static struct { 598static struct {
587 unsigned char value; 599 unsigned char value;
588 const char *name; 600 const char *name;
589} phases[] = { 601} phases[] = {
590 {PHASE_DATAOUT, "DATAOUT"}, {PHASE_DATAIN, "DATAIN"}, {PHASE_CMDOUT, "CMDOUT"}, 602 {PHASE_DATAOUT, "DATAOUT"}, {PHASE_DATAIN, "DATAIN"}, {PHASE_CMDOUT, "CMDOUT"},
591 {PHASE_STATIN, "STATIN"}, {PHASE_MSGOUT, "MSGOUT"}, {PHASE_MSGIN, "MSGIN"}, 603 {PHASE_STATIN, "STATIN"}, {PHASE_MSGOUT, "MSGOUT"}, {PHASE_MSGIN, "MSGIN"},
592 {PHASE_UNKNOWN, "UNKNOWN"}}; 604 {PHASE_UNKNOWN, "UNKNOWN"}
605};
593 606
594/* 607/*
595 * Function : void NCR5380_print_phase(struct Scsi_Host *instance) 608 * Function : void NCR5380_print_phase(struct Scsi_Host *instance)
596 * 609 *
597 * Purpose : print the current SCSI phase for debugging purposes 610 * Purpose : print the current SCSI phase for debugging purposes
@@ -601,30 +614,35 @@ static struct {
601 614
602static void NCR5380_print_phase(struct Scsi_Host *instance) 615static void NCR5380_print_phase(struct Scsi_Host *instance)
603{ 616{
604 unsigned char status; 617 unsigned char status;
605 int i; 618 int i;
606 619
607 status = NCR5380_read(STATUS_REG); 620 status = NCR5380_read(STATUS_REG);
608 if (!(status & SR_REQ)) 621 if (!(status & SR_REQ))
609 printk(KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n", HOSTNO); 622 printk(KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n", HOSTNO);
610 else { 623 else {
611 for (i = 0; (phases[i].value != PHASE_UNKNOWN) && 624 for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
612 (phases[i].value != (status & PHASE_MASK)); ++i); 625 (phases[i].value != (status & PHASE_MASK)); ++i)
613 printk(KERN_DEBUG "scsi%d: phase %s\n", HOSTNO, phases[i].name); 626 ;
614 } 627 printk(KERN_DEBUG "scsi%d: phase %s\n", HOSTNO, phases[i].name);
628 }
615} 629}
616 630
617#else /* !NDEBUG */ 631#else /* !NDEBUG */
618 632
619/* dummies... */ 633/* dummies... */
620__inline__ void NCR5380_print(struct Scsi_Host *instance) { }; 634static inline void NCR5380_print(struct Scsi_Host *instance)
621__inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { }; 635{
636};
637static inline void NCR5380_print_phase(struct Scsi_Host *instance)
638{
639};
622 640
623#endif 641#endif
624 642
625/* 643/*
626 * ++roman: New scheme of calling NCR5380_main() 644 * ++roman: New scheme of calling NCR5380_main()
627 * 645 *
628 * If we're not in an interrupt, we can call our main directly, it cannot be 646 * If we're not in an interrupt, we can call our main directly, it cannot be
629 * already running. Else, we queue it on a task queue, if not 'main_running' 647 * already running. Else, we queue it on a task queue, if not 'main_running'
630 * tells us that a lower level is already executing it. This way, 648 * tells us that a lower level is already executing it. This way,
@@ -638,33 +656,33 @@ __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
638#include <linux/workqueue.h> 656#include <linux/workqueue.h>
639#include <linux/interrupt.h> 657#include <linux/interrupt.h>
640 658
641static volatile int main_running = 0; 659static volatile int main_running;
642static DECLARE_WORK(NCR5380_tqueue, (void (*)(void*))NCR5380_main, NULL); 660static DECLARE_WORK(NCR5380_tqueue, NCR5380_main);
643 661
644static __inline__ void queue_main(void) 662static inline void queue_main(void)
645{ 663{
646 if (!main_running) { 664 if (!main_running) {
647 /* If in interrupt and NCR5380_main() not already running, 665 /* If in interrupt and NCR5380_main() not already running,
648 queue it on the 'immediate' task queue, to be processed 666 queue it on the 'immediate' task queue, to be processed
649 immediately after the current interrupt processing has 667 immediately after the current interrupt processing has
650 finished. */ 668 finished. */
651 schedule_work(&NCR5380_tqueue); 669 schedule_work(&NCR5380_tqueue);
652 } 670 }
653 /* else: nothing to do: the running NCR5380_main() will pick up 671 /* else: nothing to do: the running NCR5380_main() will pick up
654 any newly queued command. */ 672 any newly queued command. */
655} 673}
656 674
657 675
658static inline void NCR5380_all_init (void) 676static inline void NCR5380_all_init(void)
659{ 677{
660 static int done = 0; 678 static int done = 0;
661 if (!done) { 679 if (!done) {
662 INI_PRINTK("scsi : NCR5380_all_init()\n"); 680 INI_PRINTK("scsi : NCR5380_all_init()\n");
663 done = 1; 681 done = 1;
664 } 682 }
665} 683}
666 684
667 685
668/* 686/*
669 * Function : void NCR58380_print_options (struct Scsi_Host *instance) 687 * Function : void NCR58380_print_options (struct Scsi_Host *instance)
670 * 688 *
@@ -674,23 +692,23 @@ static inline void NCR5380_all_init (void)
674 * Inputs : instance, pointer to this instance. Unused. 692 * Inputs : instance, pointer to this instance. Unused.
675 */ 693 */
676 694
677static void __init NCR5380_print_options (struct Scsi_Host *instance) 695static void __init NCR5380_print_options(struct Scsi_Host *instance)
678{ 696{
679 printk(" generic options" 697 printk(" generic options"
680#ifdef AUTOSENSE 698#ifdef AUTOSENSE
681 " AUTOSENSE" 699 " AUTOSENSE"
682#endif 700#endif
683#ifdef REAL_DMA 701#ifdef REAL_DMA
684 " REAL DMA" 702 " REAL DMA"
685#endif 703#endif
686#ifdef PARITY 704#ifdef PARITY
687 " PARITY" 705 " PARITY"
688#endif 706#endif
689#ifdef SUPPORT_TAGS 707#ifdef SUPPORT_TAGS
690 " SCSI-2 TAGGED QUEUING" 708 " SCSI-2 TAGGED QUEUING"
691#endif 709#endif
692 ); 710 );
693 printk(" generic release=%d", NCR5380_PUBLIC_RELEASE); 711 printk(" generic release=%d", NCR5380_PUBLIC_RELEASE);
694} 712}
695 713
696/* 714/*
@@ -699,27 +717,27 @@ static void __init NCR5380_print_options (struct Scsi_Host *instance)
699 * Purpose : print commands in the various queues, called from 717 * Purpose : print commands in the various queues, called from
700 * NCR5380_abort and NCR5380_debug to aid debugging. 718 * NCR5380_abort and NCR5380_debug to aid debugging.
701 * 719 *
702 * Inputs : instance, pointer to this instance. 720 * Inputs : instance, pointer to this instance.
703 */ 721 */
704 722
705static void NCR5380_print_status (struct Scsi_Host *instance) 723static void NCR5380_print_status(struct Scsi_Host *instance)
706{ 724{
707 char *pr_bfr; 725 char *pr_bfr;
708 char *start; 726 char *start;
709 int len; 727 int len;
710 728
711 NCR_PRINT(NDEBUG_ANY); 729 NCR_PRINT(NDEBUG_ANY);
712 NCR_PRINT_PHASE(NDEBUG_ANY); 730 NCR_PRINT_PHASE(NDEBUG_ANY);
713 731
714 pr_bfr = (char *) __get_free_page(GFP_ATOMIC); 732 pr_bfr = (char *)__get_free_page(GFP_ATOMIC);
715 if (!pr_bfr) { 733 if (!pr_bfr) {
716 printk("NCR5380_print_status: no memory for print buffer\n"); 734 printk("NCR5380_print_status: no memory for print buffer\n");
717 return; 735 return;
718 } 736 }
719 len = NCR5380_proc_info(pr_bfr, &start, 0, PAGE_SIZE, HOSTNO, 0); 737 len = NCR5380_proc_info(instance, pr_bfr, &start, 0, PAGE_SIZE, 0);
720 pr_bfr[len] = 0; 738 pr_bfr[len] = 0;
721 printk("\n%s\n", pr_bfr); 739 printk("\n%s\n", pr_bfr);
722 free_page((unsigned long) pr_bfr); 740 free_page((unsigned long)pr_bfr);
723} 741}
724 742
725 743
@@ -738,443 +756,478 @@ static void NCR5380_print_status (struct Scsi_Host *instance)
738*/ 756*/
739 757
740#undef SPRINTF 758#undef SPRINTF
741#define SPRINTF(fmt,args...) \ 759#define SPRINTF(fmt,args...) \
742 do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ 760 do { \
743 pos += sprintf(pos, fmt , ## args); } while(0) 761 if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \
744static 762 pos += sprintf(pos, fmt , ## args); \
745char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length); 763 } while(0)
746 764static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length);
747static 765
748int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, off_t offset, 766static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer,
749 int length, int inout) 767 char **start, off_t offset, int length, int inout)
750{ 768{
751 char *pos = buffer; 769 char *pos = buffer;
752 struct NCR5380_hostdata *hostdata; 770 struct NCR5380_hostdata *hostdata;
753 Scsi_Cmnd *ptr; 771 Scsi_Cmnd *ptr;
754 unsigned long flags; 772 unsigned long flags;
755 off_t begin = 0; 773 off_t begin = 0;
756#define check_offset() \ 774#define check_offset() \
757 do { \ 775 do { \
758 if (pos - buffer < offset - begin) { \ 776 if (pos - buffer < offset - begin) { \
759 begin += pos - buffer; \ 777 begin += pos - buffer; \
760 pos = buffer; \ 778 pos = buffer; \
761 } \ 779 } \
762 } while (0) 780 } while (0)
763 781
764 hostdata = (struct NCR5380_hostdata *)instance->hostdata; 782 hostdata = (struct NCR5380_hostdata *)instance->hostdata;
765 783
766 if (inout) { /* Has data been written to the file ? */ 784 if (inout) /* Has data been written to the file ? */
767 return(-ENOSYS); /* Currently this is a no-op */ 785 return -ENOSYS; /* Currently this is a no-op */
768 } 786 SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
769 SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
770 check_offset();
771 local_irq_save(flags);
772 SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't");
773 check_offset();
774 if (!hostdata->connected)
775 SPRINTF("scsi%d: no currently connected command\n", HOSTNO);
776 else
777 pos = lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected,
778 pos, buffer, length);
779 SPRINTF("scsi%d: issue_queue\n", HOSTNO);
780 check_offset();
781 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) {
782 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length);
783 check_offset(); 787 check_offset();
784 } 788 local_irq_save(flags);
789 SPRINTF("NCR5380: coroutine is%s running.\n",
790 main_running ? "" : "n't");
791 check_offset();
792 if (!hostdata->connected)
793 SPRINTF("scsi%d: no currently connected command\n", HOSTNO);
794 else
795 pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected,
796 pos, buffer, length);
797 SPRINTF("scsi%d: issue_queue\n", HOSTNO);
798 check_offset();
799 for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) {
800 pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length);
801 check_offset();
802 }
785 803
786 SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); 804 SPRINTF("scsi%d: disconnected_queue\n", HOSTNO);
787 check_offset();
788 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr;
789 ptr = NEXT(ptr)) {
790 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length);
791 check_offset(); 805 check_offset();
792 } 806 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr;
807 ptr = NEXT(ptr)) {
808 pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length);
809 check_offset();
810 }
793 811
794 local_irq_restore(flags); 812 local_irq_restore(flags);
795 *start = buffer + (offset - begin); 813 *start = buffer + (offset - begin);
796 if (pos - buffer < offset - begin) 814 if (pos - buffer < offset - begin)
797 return 0; 815 return 0;
798 else if (pos - buffer - (offset - begin) < length) 816 else if (pos - buffer - (offset - begin) < length)
799 return pos - buffer - (offset - begin); 817 return pos - buffer - (offset - begin);
800 return length; 818 return length;
801} 819}
802 820
803static char * 821static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
804lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
805{ 822{
806 int i, s; 823 int i, s;
807 unsigned char *command; 824 unsigned char *command;
808 SPRINTF("scsi%d: destination target %d, lun %d\n", 825 SPRINTF("scsi%d: destination target %d, lun %d\n",
809 H_NO(cmd), cmd->device->id, cmd->device->lun); 826 H_NO(cmd), cmd->device->id, cmd->device->lun);
810 SPRINTF(" command = "); 827 SPRINTF(" command = ");
811 command = cmd->cmnd; 828 command = cmd->cmnd;
812 SPRINTF("%2d (0x%02x)", command[0], command[0]); 829 SPRINTF("%2d (0x%02x)", command[0], command[0]);
813 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 830 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
814 SPRINTF(" %02x", command[i]); 831 SPRINTF(" %02x", command[i]);
815 SPRINTF("\n"); 832 SPRINTF("\n");
816 return pos; 833 return pos;
817} 834}
818 835
819 836
820/* 837/*
821 * Function : void NCR5380_init (struct Scsi_Host *instance) 838 * Function : void NCR5380_init (struct Scsi_Host *instance)
822 * 839 *
823 * Purpose : initializes *instance and corresponding 5380 chip. 840 * Purpose : initializes *instance and corresponding 5380 chip.
824 * 841 *
825 * Inputs : instance - instantiation of the 5380 driver. 842 * Inputs : instance - instantiation of the 5380 driver.
826 * 843 *
827 * Notes : I assume that the host, hostno, and id bits have been 844 * Notes : I assume that the host, hostno, and id bits have been
828 * set correctly. I don't care about the irq and other fields. 845 * set correctly. I don't care about the irq and other fields.
829 * 846 *
830 */ 847 */
831 848
832static int NCR5380_init (struct Scsi_Host *instance, int flags) 849static int NCR5380_init(struct Scsi_Host *instance, int flags)
833{ 850{
834 int i; 851 int i;
835 SETUP_HOSTDATA(instance); 852 SETUP_HOSTDATA(instance);
836 853
837 NCR5380_all_init(); 854 NCR5380_all_init();
838 855
839 hostdata->aborted = 0; 856 hostdata->aborted = 0;
840 hostdata->id_mask = 1 << instance->this_id; 857 hostdata->id_mask = 1 << instance->this_id;
841 hostdata->id_higher_mask = 0; 858 hostdata->id_higher_mask = 0;
842 for (i = hostdata->id_mask; i <= 0x80; i <<= 1) 859 for (i = hostdata->id_mask; i <= 0x80; i <<= 1)
843 if (i > hostdata->id_mask) 860 if (i > hostdata->id_mask)
844 hostdata->id_higher_mask |= i; 861 hostdata->id_higher_mask |= i;
845 for (i = 0; i < 8; ++i) 862 for (i = 0; i < 8; ++i)
846 hostdata->busy[i] = 0; 863 hostdata->busy[i] = 0;
847#ifdef SUPPORT_TAGS 864#ifdef SUPPORT_TAGS
848 init_tags(); 865 init_tags();
849#endif 866#endif
850#if defined (REAL_DMA) 867#if defined (REAL_DMA)
851 hostdata->dma_len = 0; 868 hostdata->dma_len = 0;
852#endif 869#endif
853 hostdata->targets_present = 0; 870 hostdata->targets_present = 0;
854 hostdata->connected = NULL; 871 hostdata->connected = NULL;
855 hostdata->issue_queue = NULL; 872 hostdata->issue_queue = NULL;
856 hostdata->disconnected_queue = NULL; 873 hostdata->disconnected_queue = NULL;
857 hostdata->flags = FLAG_CHECK_LAST_BYTE_SENT; 874 hostdata->flags = FLAG_CHECK_LAST_BYTE_SENT;
858 875
859 if (!the_template) { 876 if (!the_template) {
860 the_template = instance->hostt; 877 the_template = instance->hostt;
861 first_instance = instance; 878 first_instance = instance;
862 } 879 }
863
864 880
865#ifndef AUTOSENSE 881#ifndef AUTOSENSE
866 if ((instance->cmd_per_lun > 1) || (instance->can_queue > 1)) 882 if ((instance->cmd_per_lun > 1) || (instance->can_queue > 1))
867 printk("scsi%d: WARNING : support for multiple outstanding commands enabled\n" 883 printk("scsi%d: WARNING : support for multiple outstanding commands enabled\n"
868 " without AUTOSENSE option, contingent allegiance conditions may\n" 884 " without AUTOSENSE option, contingent allegiance conditions may\n"
869 " be incorrectly cleared.\n", HOSTNO); 885 " be incorrectly cleared.\n", HOSTNO);
870#endif /* def AUTOSENSE */ 886#endif /* def AUTOSENSE */
871 887
872 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 888 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
873 NCR5380_write(MODE_REG, MR_BASE); 889 NCR5380_write(MODE_REG, MR_BASE);
874 NCR5380_write(TARGET_COMMAND_REG, 0); 890 NCR5380_write(TARGET_COMMAND_REG, 0);
875 NCR5380_write(SELECT_ENABLE_REG, 0); 891 NCR5380_write(SELECT_ENABLE_REG, 0);
876 892
877 return 0; 893 return 0;
878} 894}
879 895
880/* 896/*
881 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, 897 * our own old-style timeout update
882 * void (*done)(Scsi_Cmnd *)) 898 */
899/*
900 * The strategy is to cause the timer code to call scsi_times_out()
901 * when the soonest timeout is pending.
902 * The arguments are used when we are queueing a new command, because
903 * we do not want to subtract the time used from this time, but when we
904 * set the timer, we want to take this value into account.
905 */
906
907int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout)
908{
909 int rtn;
910
911 /*
912 * We are using the new error handling code to actually register/deregister
913 * timers for timeout.
914 */
915
916 if (!timer_pending(&SCset->eh_timeout))
917 rtn = 0;
918 else
919 rtn = SCset->eh_timeout.expires - jiffies;
920
921 if (timeout == 0) {
922 del_timer(&SCset->eh_timeout);
923 SCset->eh_timeout.data = (unsigned long)NULL;
924 SCset->eh_timeout.expires = 0;
925 } else {
926 if (SCset->eh_timeout.data != (unsigned long)NULL)
927 del_timer(&SCset->eh_timeout);
928 SCset->eh_timeout.data = (unsigned long)SCset;
929 SCset->eh_timeout.expires = jiffies + timeout;
930 add_timer(&SCset->eh_timeout);
931 }
932 return rtn;
933}
934
935/*
936 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd,
937 * void (*done)(Scsi_Cmnd *))
883 * 938 *
884 * Purpose : enqueues a SCSI command 939 * Purpose : enqueues a SCSI command
885 * 940 *
886 * Inputs : cmd - SCSI command, done - function called on completion, with 941 * Inputs : cmd - SCSI command, done - function called on completion, with
887 * a pointer to the command descriptor. 942 * a pointer to the command descriptor.
888 * 943 *
889 * Returns : 0 944 * Returns : 0
890 * 945 *
891 * Side effects : 946 * Side effects :
892 * cmd is added to the per instance issue_queue, with minor 947 * cmd is added to the per instance issue_queue, with minor
893 * twiddling done to the host specific fields of cmd. If the 948 * twiddling done to the host specific fields of cmd. If the
894 * main coroutine is not running, it is restarted. 949 * main coroutine is not running, it is restarted.
895 * 950 *
896 */ 951 */
897 952
898static 953static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
899int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
900{ 954{
901 SETUP_HOSTDATA(cmd->device->host); 955 SETUP_HOSTDATA(cmd->device->host);
902 Scsi_Cmnd *tmp; 956 Scsi_Cmnd *tmp;
903 int oldto; 957 int oldto;
904 unsigned long flags; 958 unsigned long flags;
905 extern int update_timeout(Scsi_Cmnd * SCset, int timeout); 959 // extern int update_timeout(Scsi_Cmnd * SCset, int timeout);
906 960
907#if (NDEBUG & NDEBUG_NO_WRITE) 961#if (NDEBUG & NDEBUG_NO_WRITE)
908 switch (cmd->cmnd[0]) { 962 switch (cmd->cmnd[0]) {
909 case WRITE_6: 963 case WRITE_6:
910 case WRITE_10: 964 case WRITE_10:
911 printk(KERN_NOTICE "scsi%d: WRITE attempted with NO_WRITE debugging flag set\n", 965 printk(KERN_NOTICE "scsi%d: WRITE attempted with NO_WRITE debugging flag set\n",
912 H_NO(cmd)); 966 H_NO(cmd));
913 cmd->result = (DID_ERROR << 16); 967 cmd->result = (DID_ERROR << 16);
914 done(cmd); 968 done(cmd);
915 return 0; 969 return 0;
916 } 970 }
917#endif /* (NDEBUG & NDEBUG_NO_WRITE) */ 971#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
918 972
919
920#ifdef NCR5380_STATS 973#ifdef NCR5380_STATS
921# if 0 974# if 0
922 if (!hostdata->connected && !hostdata->issue_queue && 975 if (!hostdata->connected && !hostdata->issue_queue &&
923 !hostdata->disconnected_queue) { 976 !hostdata->disconnected_queue) {
924 hostdata->timebase = jiffies; 977 hostdata->timebase = jiffies;
925 } 978 }
926# endif 979# endif
927# ifdef NCR5380_STAT_LIMIT 980# ifdef NCR5380_STAT_LIMIT
928 if (cmd->request_bufflen > NCR5380_STAT_LIMIT) 981 if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
929# endif 982# endif
930 switch (cmd->cmnd[0]) 983 switch (cmd->cmnd[0]) {
931 { 984 case WRITE:
932 case WRITE: 985 case WRITE_6:
933 case WRITE_6: 986 case WRITE_10:
934 case WRITE_10: 987 hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
935 hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); 988 hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
936 hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; 989 hostdata->pendingw++;
937 hostdata->pendingw++; 990 break;
938 break; 991 case READ:
939 case READ: 992 case READ_6:
940 case READ_6: 993 case READ_10:
941 case READ_10: 994 hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
942 hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); 995 hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
943 hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; 996 hostdata->pendingr++;
944 hostdata->pendingr++; 997 break;
945 break; 998 }
946 }
947#endif 999#endif
948 1000
949 /* 1001 /*
950 * We use the host_scribble field as a pointer to the next command 1002 * We use the host_scribble field as a pointer to the next command
951 * in a queue 1003 * in a queue
952 */ 1004 */
953 1005
954 NEXT(cmd) = NULL; 1006 SET_NEXT(cmd, NULL);
955 cmd->scsi_done = done; 1007 cmd->scsi_done = done;
956 1008
957 cmd->result = 0; 1009 cmd->result = 0;
958 1010
959 1011 /*
960 /* 1012 * Insert the cmd into the issue queue. Note that REQUEST SENSE
961 * Insert the cmd into the issue queue. Note that REQUEST SENSE 1013 * commands are added to the head of the queue since any command will
962 * commands are added to the head of the queue since any command will 1014 * clear the contingent allegiance condition that exists and the
963 * clear the contingent allegiance condition that exists and the 1015 * sense data is only guaranteed to be valid while the condition exists.
964 * sense data is only guaranteed to be valid while the condition exists. 1016 */
965 */ 1017
966 1018 local_irq_save(flags);
967 local_irq_save(flags); 1019 /* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.
968 /* ++guenther: now that the issue queue is being set up, we can lock ST-DMA. 1020 * Otherwise a running NCR5380_main may steal the lock.
969 * Otherwise a running NCR5380_main may steal the lock. 1021 * Lock before actually inserting due to fairness reasons explained in
970 * Lock before actually inserting due to fairness reasons explained in 1022 * atari_scsi.c. If we insert first, then it's impossible for this driver
971 * atari_scsi.c. If we insert first, then it's impossible for this driver 1023 * to release the lock.
972 * to release the lock. 1024 * Stop timer for this command while waiting for the lock, or timeouts
973 * Stop timer for this command while waiting for the lock, or timeouts 1025 * may happen (and they really do), and it's no good if the command doesn't
974 * may happen (and they really do), and it's no good if the command doesn't 1026 * appear in any of the queues.
975 * appear in any of the queues. 1027 * ++roman: Just disabling the NCR interrupt isn't sufficient here,
976 * ++roman: Just disabling the NCR interrupt isn't sufficient here, 1028 * because also a timer int can trigger an abort or reset, which would
977 * because also a timer int can trigger an abort or reset, which would 1029 * alter queues and touch the lock.
978 * alter queues and touch the lock. 1030 */
979 */ 1031 if (!IS_A_TT()) {
980 if (!IS_A_TT()) { 1032 oldto = atari_scsi_update_timeout(cmd, 0);
981 oldto = update_timeout(cmd, 0); 1033 falcon_get_lock();
982 falcon_get_lock(); 1034 atari_scsi_update_timeout(cmd, oldto);
983 update_timeout(cmd, oldto); 1035 }
984 } 1036 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
985 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { 1037 LIST(cmd, hostdata->issue_queue);
986 LIST(cmd, hostdata->issue_queue); 1038 SET_NEXT(cmd, hostdata->issue_queue);
987 NEXT(cmd) = hostdata->issue_queue; 1039 hostdata->issue_queue = cmd;
988 hostdata->issue_queue = cmd; 1040 } else {
989 } else { 1041 for (tmp = (Scsi_Cmnd *)hostdata->issue_queue;
990 for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; 1042 NEXT(tmp); tmp = NEXT(tmp))
991 NEXT(tmp); tmp = NEXT(tmp)) 1043 ;
992 ; 1044 LIST(cmd, tmp);
993 LIST(cmd, tmp); 1045 SET_NEXT(tmp, cmd);
994 NEXT(tmp) = cmd; 1046 }
995 } 1047 local_irq_restore(flags);
996 local_irq_restore(flags); 1048
997 1049 QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
998 QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd), 1050 (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
999 (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); 1051
1000 1052 /* If queue_command() is called from an interrupt (real one or bottom
1001 /* If queue_command() is called from an interrupt (real one or bottom 1053 * half), we let queue_main() do the job of taking care about main. If it
1002 * half), we let queue_main() do the job of taking care about main. If it 1054 * is already running, this is a no-op, else main will be queued.
1003 * is already running, this is a no-op, else main will be queued. 1055 *
1004 * 1056 * If we're not in an interrupt, we can call NCR5380_main()
1005 * If we're not in an interrupt, we can call NCR5380_main() 1057 * unconditionally, because it cannot be already running.
1006 * unconditionally, because it cannot be already running. 1058 */
1007 */ 1059 if (in_interrupt() || ((flags >> 8) & 7) >= 6)
1008 if (in_interrupt() || ((flags >> 8) & 7) >= 6) 1060 queue_main();
1009 queue_main(); 1061 else
1010 else 1062 NCR5380_main(NULL);
1011 NCR5380_main(NULL); 1063 return 0;
1012 return 0;
1013} 1064}
1014 1065
1015/* 1066/*
1016 * Function : NCR5380_main (void) 1067 * Function : NCR5380_main (void)
1017 * 1068 *
1018 * Purpose : NCR5380_main is a coroutine that runs as long as more work can 1069 * Purpose : NCR5380_main is a coroutine that runs as long as more work can
1019 * be done on the NCR5380 host adapters in a system. Both 1070 * be done on the NCR5380 host adapters in a system. Both
1020 * NCR5380_queue_command() and NCR5380_intr() will try to start it 1071 * NCR5380_queue_command() and NCR5380_intr() will try to start it
1021 * in case it is not running. 1072 * in case it is not running.
1022 * 1073 *
1023 * NOTE : NCR5380_main exits with interrupts *disabled*, the caller should 1074 * NOTE : NCR5380_main exits with interrupts *disabled*, the caller should
1024 * reenable them. This prevents reentrancy and kernel stack overflow. 1075 * reenable them. This prevents reentrancy and kernel stack overflow.
1025 */ 1076 */
1026 1077
1027static void NCR5380_main (void *bl) 1078static void NCR5380_main(struct work_struct *work)
1028{ 1079{
1029 Scsi_Cmnd *tmp, *prev; 1080 Scsi_Cmnd *tmp, *prev;
1030 struct Scsi_Host *instance = first_instance; 1081 struct Scsi_Host *instance = first_instance;
1031 struct NCR5380_hostdata *hostdata = HOSTDATA(instance); 1082 struct NCR5380_hostdata *hostdata = HOSTDATA(instance);
1032 int done; 1083 int done;
1033 unsigned long flags; 1084 unsigned long flags;
1034 1085
1035 /* 1086 /*
1036 * We run (with interrupts disabled) until we're sure that none of 1087 * We run (with interrupts disabled) until we're sure that none of
1037 * the host adapters have anything that can be done, at which point 1088 * the host adapters have anything that can be done, at which point
1038 * we set main_running to 0 and exit. 1089 * we set main_running to 0 and exit.
1039 * 1090 *
1040 * Interrupts are enabled before doing various other internal 1091 * Interrupts are enabled before doing various other internal
1041 * instructions, after we've decided that we need to run through 1092 * instructions, after we've decided that we need to run through
1042 * the loop again. 1093 * the loop again.
1043 * 1094 *
1044 * this should prevent any race conditions. 1095 * this should prevent any race conditions.
1045 * 1096 *
1046 * ++roman: Just disabling the NCR interrupt isn't sufficient here, 1097 * ++roman: Just disabling the NCR interrupt isn't sufficient here,
1047 * because also a timer int can trigger an abort or reset, which can 1098 * because also a timer int can trigger an abort or reset, which can
1048 * alter queues and touch the Falcon lock. 1099 * alter queues and touch the Falcon lock.
1049 */ 1100 */
1050 1101
1051 /* Tell int handlers main() is now already executing. Note that 1102 /* Tell int handlers main() is now already executing. Note that
1052 no races are possible here. If an int comes in before 1103 no races are possible here. If an int comes in before
1053 'main_running' is set here, and queues/executes main via the 1104 'main_running' is set here, and queues/executes main via the
1054 task queue, it doesn't do any harm, just this instance of main 1105 task queue, it doesn't do any harm, just this instance of main
1055 won't find any work left to do. */ 1106 won't find any work left to do. */
1056 if (main_running) 1107 if (main_running)
1057 return; 1108 return;
1058 main_running = 1; 1109 main_running = 1;
1059 1110
1060 local_save_flags(flags); 1111 local_save_flags(flags);
1061 do { 1112 do {
1062 local_irq_disable(); /* Freeze request queues */ 1113 local_irq_disable(); /* Freeze request queues */
1063 done = 1; 1114 done = 1;
1064 1115
1065 if (!hostdata->connected) { 1116 if (!hostdata->connected) {
1066 MAIN_PRINTK( "scsi%d: not connected\n", HOSTNO ); 1117 MAIN_PRINTK("scsi%d: not connected\n", HOSTNO);
1067 /* 1118 /*
1068 * Search through the issue_queue for a command destined 1119 * Search through the issue_queue for a command destined
1069 * for a target that's not busy. 1120 * for a target that's not busy.
1070 */ 1121 */
1071#if (NDEBUG & NDEBUG_LISTS) 1122#if (NDEBUG & NDEBUG_LISTS)
1072 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; 1123 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL;
1073 tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp)) 1124 tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp))
1074 ; 1125 ;
1075 /*printk("%p ", tmp);*/ 1126 /*printk("%p ", tmp);*/
1076 if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/ 1127 if ((tmp == prev) && tmp)
1128 printk(" LOOP\n");
1129 /* else printk("\n"); */
1077#endif 1130#endif
1078 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, 1131 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue,
1079 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { 1132 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) {
1080 1133
1081#if (NDEBUG & NDEBUG_LISTS) 1134#if (NDEBUG & NDEBUG_LISTS)
1082 if (prev != tmp) 1135 if (prev != tmp)
1083 printk("MAIN tmp=%p target=%d busy=%d lun=%d\n", 1136 printk("MAIN tmp=%p target=%d busy=%d lun=%d\n",
1084 tmp, tmp->device->id, hostdata->busy[tmp->device->id], 1137 tmp, tmp->device->id, hostdata->busy[tmp->device->id],
1085 tmp->device->lun); 1138 tmp->device->lun);
1086#endif 1139#endif
1087 /* When we find one, remove it from the issue queue. */ 1140 /* When we find one, remove it from the issue queue. */
1088 /* ++guenther: possible race with Falcon locking */ 1141 /* ++guenther: possible race with Falcon locking */
1089 if ( 1142 if (
1090#ifdef SUPPORT_TAGS 1143#ifdef SUPPORT_TAGS
1091 !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE) 1144 !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE)
1092#else 1145#else
1093 !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun)) 1146 !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))
1094#endif 1147#endif
1095 ) { 1148 ) {
1096 /* ++guenther: just to be sure, this must be atomic */ 1149 /* ++guenther: just to be sure, this must be atomic */
1097 local_irq_disable(); 1150 local_irq_disable();
1098 if (prev) { 1151 if (prev) {
1099 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); 1152 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
1100 NEXT(prev) = NEXT(tmp); 1153 SET_NEXT(prev, NEXT(tmp));
1101 } else { 1154 } else {
1102 REMOVE(-1, hostdata->issue_queue, tmp, NEXT(tmp)); 1155 REMOVE(-1, hostdata->issue_queue, tmp, NEXT(tmp));
1103 hostdata->issue_queue = NEXT(tmp); 1156 hostdata->issue_queue = NEXT(tmp);
1104 } 1157 }
1105 NEXT(tmp) = NULL; 1158 SET_NEXT(tmp, NULL);
1106 falcon_dont_release++; 1159 falcon_dont_release++;
1107 1160
1108 /* reenable interrupts after finding one */ 1161 /* reenable interrupts after finding one */
1109 local_irq_restore(flags); 1162 local_irq_restore(flags);
1110 1163
1111 /* 1164 /*
1112 * Attempt to establish an I_T_L nexus here. 1165 * Attempt to establish an I_T_L nexus here.
1113 * On success, instance->hostdata->connected is set. 1166 * On success, instance->hostdata->connected is set.
1114 * On failure, we must add the command back to the 1167 * On failure, we must add the command back to the
1115 * issue queue so we can keep trying. 1168 * issue queue so we can keep trying.
1116 */ 1169 */
1117 MAIN_PRINTK("scsi%d: main(): command for target %d " 1170 MAIN_PRINTK("scsi%d: main(): command for target %d "
1118 "lun %d removed from issue_queue\n", 1171 "lun %d removed from issue_queue\n",
1119 HOSTNO, tmp->device->id, tmp->device->lun); 1172 HOSTNO, tmp->device->id, tmp->device->lun);
1120 /* 1173 /*
1121 * REQUEST SENSE commands are issued without tagged 1174 * REQUEST SENSE commands are issued without tagged
1122 * queueing, even on SCSI-II devices because the 1175 * queueing, even on SCSI-II devices because the
1123 * contingent allegiance condition exists for the 1176 * contingent allegiance condition exists for the
1124 * entire unit. 1177 * entire unit.
1125 */ 1178 */
1126 /* ++roman: ...and the standard also requires that 1179 /* ++roman: ...and the standard also requires that
1127 * REQUEST SENSE command are untagged. 1180 * REQUEST SENSE command are untagged.
1128 */ 1181 */
1129 1182
1130#ifdef SUPPORT_TAGS 1183#ifdef SUPPORT_TAGS
1131 cmd_get_tag( tmp, tmp->cmnd[0] != REQUEST_SENSE ); 1184 cmd_get_tag(tmp, tmp->cmnd[0] != REQUEST_SENSE);
1132#endif 1185#endif
1133 if (!NCR5380_select(instance, tmp, 1186 if (!NCR5380_select(instance, tmp,
1134 (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : 1187 (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE :
1135 TAG_NEXT)) { 1188 TAG_NEXT)) {
1136 falcon_dont_release--; 1189 falcon_dont_release--;
1137 /* release if target did not response! */ 1190 /* release if target did not response! */
1138 falcon_release_lock_if_possible( hostdata ); 1191 falcon_release_lock_if_possible(hostdata);
1139 break; 1192 break;
1140 } else { 1193 } else {
1141 local_irq_disable(); 1194 local_irq_disable();
1142 LIST(tmp, hostdata->issue_queue); 1195 LIST(tmp, hostdata->issue_queue);
1143 NEXT(tmp) = hostdata->issue_queue; 1196 SET_NEXT(tmp, hostdata->issue_queue);
1144 hostdata->issue_queue = tmp; 1197 hostdata->issue_queue = tmp;
1145#ifdef SUPPORT_TAGS 1198#ifdef SUPPORT_TAGS
1146 cmd_free_tag( tmp ); 1199 cmd_free_tag(tmp);
1147#endif 1200#endif
1148 falcon_dont_release--; 1201 falcon_dont_release--;
1149 local_irq_restore(flags); 1202 local_irq_restore(flags);
1150 MAIN_PRINTK("scsi%d: main(): select() failed, " 1203 MAIN_PRINTK("scsi%d: main(): select() failed, "
1151 "returned to issue_queue\n", HOSTNO); 1204 "returned to issue_queue\n", HOSTNO);
1152 if (hostdata->connected) 1205 if (hostdata->connected)
1153 break; 1206 break;
1154 } 1207 }
1155 } /* if target/lun/target queue is not busy */ 1208 } /* if target/lun/target queue is not busy */
1156 } /* for issue_queue */ 1209 } /* for issue_queue */
1157 } /* if (!hostdata->connected) */ 1210 } /* if (!hostdata->connected) */
1158 1211
1159 if (hostdata->connected 1212 if (hostdata->connected
1160#ifdef REAL_DMA 1213#ifdef REAL_DMA
1161 && !hostdata->dma_len 1214 && !hostdata->dma_len
1162#endif 1215#endif
1163 ) { 1216 ) {
1164 local_irq_restore(flags); 1217 local_irq_restore(flags);
1165 MAIN_PRINTK("scsi%d: main: performing information transfer\n", 1218 MAIN_PRINTK("scsi%d: main: performing information transfer\n",
1166 HOSTNO); 1219 HOSTNO);
1167 NCR5380_information_transfer(instance); 1220 NCR5380_information_transfer(instance);
1168 MAIN_PRINTK("scsi%d: main: done set false\n", HOSTNO); 1221 MAIN_PRINTK("scsi%d: main: done set false\n", HOSTNO);
1169 done = 0; 1222 done = 0;
1170 } 1223 }
1171 } while (!done); 1224 } while (!done);
1172 1225
1173 /* Better allow ints _after_ 'main_running' has been cleared, else 1226 /* Better allow ints _after_ 'main_running' has been cleared, else
1174 an interrupt could believe we'll pick up the work it left for 1227 an interrupt could believe we'll pick up the work it left for
1175 us, but we won't see it anymore here... */ 1228 us, but we won't see it anymore here... */
1176 main_running = 0; 1229 main_running = 0;
1177 local_irq_restore(flags); 1230 local_irq_restore(flags);
1178} 1231}
1179 1232
1180 1233
@@ -1183,1441 +1236,1439 @@ static void NCR5380_main (void *bl)
1183 * Function : void NCR5380_dma_complete (struct Scsi_Host *instance) 1236 * Function : void NCR5380_dma_complete (struct Scsi_Host *instance)
1184 * 1237 *
1185 * Purpose : Called by interrupt handler when DMA finishes or a phase 1238 * Purpose : Called by interrupt handler when DMA finishes or a phase
1186 * mismatch occurs (which would finish the DMA transfer). 1239 * mismatch occurs (which would finish the DMA transfer).
1187 * 1240 *
1188 * Inputs : instance - this instance of the NCR5380. 1241 * Inputs : instance - this instance of the NCR5380.
1189 * 1242 *
1190 */ 1243 */
1191 1244
1192static void NCR5380_dma_complete( struct Scsi_Host *instance ) 1245static void NCR5380_dma_complete(struct Scsi_Host *instance)
1193{ 1246{
1194 SETUP_HOSTDATA(instance); 1247 SETUP_HOSTDATA(instance);
1195 int transfered, saved_data = 0, overrun = 0, cnt, toPIO; 1248 int transfered, saved_data = 0, overrun = 0, cnt, toPIO;
1196 unsigned char **data, p; 1249 unsigned char **data, p;
1197 volatile int *count; 1250 volatile int *count;
1198 1251
1199 if (!hostdata->connected) { 1252 if (!hostdata->connected) {
1200 printk(KERN_WARNING "scsi%d: received end of DMA interrupt with " 1253 printk(KERN_WARNING "scsi%d: received end of DMA interrupt with "
1201 "no connected cmd\n", HOSTNO); 1254 "no connected cmd\n", HOSTNO);
1202 return; 1255 return;
1203 }
1204
1205 if (atari_read_overruns) {
1206 p = hostdata->connected->SCp.phase;
1207 if (p & SR_IO) {
1208 udelay(10);
1209 if ((((NCR5380_read(BUS_AND_STATUS_REG)) &
1210 (BASR_PHASE_MATCH|BASR_ACK)) ==
1211 (BASR_PHASE_MATCH|BASR_ACK))) {
1212 saved_data = NCR5380_read(INPUT_DATA_REG);
1213 overrun = 1;
1214 DMA_PRINTK("scsi%d: read overrun handled\n", HOSTNO);
1215 }
1216 } 1256 }
1217 } 1257
1218 1258 if (atari_read_overruns) {
1219 DMA_PRINTK("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n", 1259 p = hostdata->connected->SCp.phase;
1220 HOSTNO, NCR5380_read(BUS_AND_STATUS_REG), 1260 if (p & SR_IO) {
1221 NCR5380_read(STATUS_REG)); 1261 udelay(10);
1222 1262 if ((NCR5380_read(BUS_AND_STATUS_REG) &
1223 (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1263 (BASR_PHASE_MATCH|BASR_ACK)) ==
1224 NCR5380_write(MODE_REG, MR_BASE); 1264 (BASR_PHASE_MATCH|BASR_ACK)) {
1225 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1265 saved_data = NCR5380_read(INPUT_DATA_REG);
1226 1266 overrun = 1;
1227 transfered = hostdata->dma_len - NCR5380_dma_residual(instance); 1267 DMA_PRINTK("scsi%d: read overrun handled\n", HOSTNO);
1228 hostdata->dma_len = 0; 1268 }
1229 1269 }
1230 data = (unsigned char **) &(hostdata->connected->SCp.ptr); 1270 }
1231 count = &(hostdata->connected->SCp.this_residual); 1271
1232 *data += transfered; 1272 DMA_PRINTK("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n",
1233 *count -= transfered; 1273 HOSTNO, NCR5380_read(BUS_AND_STATUS_REG),
1234 1274 NCR5380_read(STATUS_REG));
1235 if (atari_read_overruns) { 1275
1236 if ((NCR5380_read(STATUS_REG) & PHASE_MASK) == p && (p & SR_IO)) { 1276 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1237 cnt = toPIO = atari_read_overruns; 1277 NCR5380_write(MODE_REG, MR_BASE);
1238 if (overrun) { 1278 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1239 DMA_PRINTK("Got an input overrun, using saved byte\n"); 1279
1240 *(*data)++ = saved_data; 1280 transfered = hostdata->dma_len - NCR5380_dma_residual(instance);
1241 (*count)--; 1281 hostdata->dma_len = 0;
1242 cnt--; 1282
1243 toPIO--; 1283 data = (unsigned char **)&hostdata->connected->SCp.ptr;
1244 } 1284 count = &hostdata->connected->SCp.this_residual;
1245 DMA_PRINTK("Doing %d-byte PIO to 0x%08lx\n", cnt, (long)*data); 1285 *data += transfered;
1246 NCR5380_transfer_pio(instance, &p, &cnt, data); 1286 *count -= transfered;
1247 *count -= toPIO - cnt; 1287
1288 if (atari_read_overruns) {
1289 if ((NCR5380_read(STATUS_REG) & PHASE_MASK) == p && (p & SR_IO)) {
1290 cnt = toPIO = atari_read_overruns;
1291 if (overrun) {
1292 DMA_PRINTK("Got an input overrun, using saved byte\n");
1293 *(*data)++ = saved_data;
1294 (*count)--;
1295 cnt--;
1296 toPIO--;
1297 }
1298 DMA_PRINTK("Doing %d-byte PIO to 0x%08lx\n", cnt, (long)*data);
1299 NCR5380_transfer_pio(instance, &p, &cnt, data);
1300 *count -= toPIO - cnt;
1301 }
1248 } 1302 }
1249 }
1250} 1303}
1251#endif /* REAL_DMA */ 1304#endif /* REAL_DMA */
1252 1305
1253 1306
1254/* 1307/*
1255 * Function : void NCR5380_intr (int irq) 1308 * Function : void NCR5380_intr (int irq)
1256 * 1309 *
1257 * Purpose : handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses 1310 * Purpose : handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
1258 * from the disconnected queue, and restarting NCR5380_main() 1311 * from the disconnected queue, and restarting NCR5380_main()
1259 * as required. 1312 * as required.
1260 * 1313 *
1261 * Inputs : int irq, irq that caused this interrupt. 1314 * Inputs : int irq, irq that caused this interrupt.
1262 * 1315 *
1263 */ 1316 */
1264 1317
1265static irqreturn_t NCR5380_intr (int irq, void *dev_id) 1318static irqreturn_t NCR5380_intr(int irq, void *dev_id)
1266{ 1319{
1267 struct Scsi_Host *instance = first_instance; 1320 struct Scsi_Host *instance = first_instance;
1268 int done = 1, handled = 0; 1321 int done = 1, handled = 0;
1269 unsigned char basr; 1322 unsigned char basr;
1270 1323
1271 INT_PRINTK("scsi%d: NCR5380 irq triggered\n", HOSTNO); 1324 INT_PRINTK("scsi%d: NCR5380 irq triggered\n", HOSTNO);
1272 1325
1273 /* Look for pending interrupts */ 1326 /* Look for pending interrupts */
1274 basr = NCR5380_read(BUS_AND_STATUS_REG); 1327 basr = NCR5380_read(BUS_AND_STATUS_REG);
1275 INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr); 1328 INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr);
1276 /* dispatch to appropriate routine if found and done=0 */ 1329 /* dispatch to appropriate routine if found and done=0 */
1277 if (basr & BASR_IRQ) { 1330 if (basr & BASR_IRQ) {
1278 NCR_PRINT(NDEBUG_INTR); 1331 NCR_PRINT(NDEBUG_INTR);
1279 if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) { 1332 if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
1280 done = 0; 1333 done = 0;
1281 ENABLE_IRQ(); 1334 ENABLE_IRQ();
1282 INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO); 1335 INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
1283 NCR5380_reselect(instance); 1336 NCR5380_reselect(instance);
1284 (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1337 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1285 } 1338 } else if (basr & BASR_PARITY_ERROR) {
1286 else if (basr & BASR_PARITY_ERROR) { 1339 INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO);
1287 INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO); 1340 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1288 (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1341 } else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
1289 } 1342 INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO);
1290 else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) { 1343 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1291 INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO); 1344 } else {
1292 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1345 /*
1293 } 1346 * The rest of the interrupt conditions can occur only during a
1294 else { 1347 * DMA transfer
1295 /* 1348 */
1296 * The rest of the interrupt conditions can occur only during a
1297 * DMA transfer
1298 */
1299 1349
1300#if defined(REAL_DMA) 1350#if defined(REAL_DMA)
1301 /* 1351 /*
1302 * We should only get PHASE MISMATCH and EOP interrupts if we have 1352 * We should only get PHASE MISMATCH and EOP interrupts if we have
1303 * DMA enabled, so do a sanity check based on the current setting 1353 * DMA enabled, so do a sanity check based on the current setting
1304 * of the MODE register. 1354 * of the MODE register.
1305 */ 1355 */
1306 1356
1307 if ((NCR5380_read(MODE_REG) & MR_DMA_MODE) && 1357 if ((NCR5380_read(MODE_REG) & MR_DMA_MODE) &&
1308 ((basr & BASR_END_DMA_TRANSFER) || 1358 ((basr & BASR_END_DMA_TRANSFER) ||
1309 !(basr & BASR_PHASE_MATCH))) { 1359 !(basr & BASR_PHASE_MATCH))) {
1310 1360
1311 INT_PRINTK("scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO); 1361 INT_PRINTK("scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
1312 NCR5380_dma_complete( instance ); 1362 NCR5380_dma_complete( instance );
1313 done = 0; 1363 done = 0;
1314 ENABLE_IRQ(); 1364 ENABLE_IRQ();
1315 } else 1365 } else
1316#endif /* REAL_DMA */ 1366#endif /* REAL_DMA */
1317 { 1367 {
1318/* MS: Ignore unknown phase mismatch interrupts (caused by EOP interrupt) */ 1368/* MS: Ignore unknown phase mismatch interrupts (caused by EOP interrupt) */
1319 if (basr & BASR_PHASE_MATCH) 1369 if (basr & BASR_PHASE_MATCH)
1320 printk(KERN_NOTICE "scsi%d: unknown interrupt, " 1370 printk(KERN_NOTICE "scsi%d: unknown interrupt, "
1321 "BASR 0x%x, MR 0x%x, SR 0x%x\n", 1371 "BASR 0x%x, MR 0x%x, SR 0x%x\n",
1322 HOSTNO, basr, NCR5380_read(MODE_REG), 1372 HOSTNO, basr, NCR5380_read(MODE_REG),
1323 NCR5380_read(STATUS_REG)); 1373 NCR5380_read(STATUS_REG));
1324 (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1374 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1325 } 1375 }
1326 } /* if !(SELECTION || PARITY) */ 1376 } /* if !(SELECTION || PARITY) */
1327 handled = 1; 1377 handled = 1;
1328 } /* BASR & IRQ */ 1378 } /* BASR & IRQ */ else {
1329 else { 1379 printk(KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, "
1330 printk(KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, " 1380 "BASR 0x%X, MR 0x%X, SR 0x%x\n", HOSTNO, basr,
1331 "BASR 0x%X, MR 0x%X, SR 0x%x\n", HOSTNO, basr, 1381 NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
1332 NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG)); 1382 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1333 (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1383 }
1334 } 1384
1335 1385 if (!done) {
1336 if (!done) { 1386 INT_PRINTK("scsi%d: in int routine, calling main\n", HOSTNO);
1337 INT_PRINTK("scsi%d: in int routine, calling main\n", HOSTNO); 1387 /* Put a call to NCR5380_main() on the queue... */
1338 /* Put a call to NCR5380_main() on the queue... */ 1388 queue_main();
1339 queue_main(); 1389 }
1340 } 1390 return IRQ_RETVAL(handled);
1341 return IRQ_RETVAL(handled);
1342} 1391}
1343 1392
1344#ifdef NCR5380_STATS 1393#ifdef NCR5380_STATS
1345static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) 1394static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd)
1346{ 1395{
1347# ifdef NCR5380_STAT_LIMIT 1396# ifdef NCR5380_STAT_LIMIT
1348 if (cmd->request_bufflen > NCR5380_STAT_LIMIT) 1397 if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
1349# endif 1398# endif
1350 switch (cmd->cmnd[0]) 1399 switch (cmd->cmnd[0]) {
1351 { 1400 case WRITE:
1352 case WRITE: 1401 case WRITE_6:
1353 case WRITE_6: 1402 case WRITE_10:
1354 case WRITE_10: 1403 hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
1355 hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); 1404 /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/
1356 /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ 1405 hostdata->pendingw--;
1357 hostdata->pendingw--; 1406 break;
1358 break; 1407 case READ:
1359 case READ: 1408 case READ_6:
1360 case READ_6: 1409 case READ_10:
1361 case READ_10: 1410 hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
1362 hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); 1411 /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/
1363 /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ 1412 hostdata->pendingr--;
1364 hostdata->pendingr--; 1413 break;
1365 break; 1414 }
1366 }
1367} 1415}
1368#endif 1416#endif
1369 1417
1370/* 1418/*
1371 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 1419 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
1372 * int tag); 1420 * int tag);
1373 * 1421 *
1374 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, 1422 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
1375 * including ARBITRATION, SELECTION, and initial message out for 1423 * including ARBITRATION, SELECTION, and initial message out for
1376 * IDENTIFY and queue messages. 1424 * IDENTIFY and queue messages.
1377 * 1425 *
1378 * Inputs : instance - instantiation of the 5380 driver on which this 1426 * Inputs : instance - instantiation of the 5380 driver on which this
1379 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 1427 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for
1380 * new tag, TAG_NONE for untagged queueing, otherwise set to the tag for 1428 * new tag, TAG_NONE for untagged queueing, otherwise set to the tag for
1381 * the command that is presently connected. 1429 * the command that is presently connected.
1382 * 1430 *
1383 * Returns : -1 if selection could not execute for some reason, 1431 * Returns : -1 if selection could not execute for some reason,
1384 * 0 if selection succeeded or failed because the target 1432 * 0 if selection succeeded or failed because the target
1385 * did not respond. 1433 * did not respond.
1386 * 1434 *
1387 * Side effects : 1435 * Side effects :
1388 * If bus busy, arbitration failed, etc, NCR5380_select() will exit 1436 * If bus busy, arbitration failed, etc, NCR5380_select() will exit
1389 * with registers as they should have been on entry - ie 1437 * with registers as they should have been on entry - ie
1390 * SELECT_ENABLE will be set appropriately, the NCR5380 1438 * SELECT_ENABLE will be set appropriately, the NCR5380
1391 * will cease to drive any SCSI bus signals. 1439 * will cease to drive any SCSI bus signals.
1392 * 1440 *
1393 * If successful : I_T_L or I_T_L_Q nexus will be established, 1441 * If successful : I_T_L or I_T_L_Q nexus will be established,
1394 * instance->connected will be set to cmd. 1442 * instance->connected will be set to cmd.
1395 * SELECT interrupt will be disabled. 1443 * SELECT interrupt will be disabled.
1396 * 1444 *
1397 * If failed (no target) : cmd->scsi_done() will be called, and the 1445 * If failed (no target) : cmd->scsi_done() will be called, and the
1398 * cmd->result host byte set to DID_BAD_TARGET. 1446 * cmd->result host byte set to DID_BAD_TARGET.
1399 */ 1447 */
1400 1448
1401static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) 1449static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
1402{ 1450{
1403 SETUP_HOSTDATA(instance); 1451 SETUP_HOSTDATA(instance);
1404 unsigned char tmp[3], phase; 1452 unsigned char tmp[3], phase;
1405 unsigned char *data; 1453 unsigned char *data;
1406 int len; 1454 int len;
1407 unsigned long timeout; 1455 unsigned long timeout;
1408 unsigned long flags; 1456 unsigned long flags;
1409 1457
1410 hostdata->restart_select = 0; 1458 hostdata->restart_select = 0;
1411 NCR_PRINT(NDEBUG_ARBITRATION); 1459 NCR_PRINT(NDEBUG_ARBITRATION);
1412 ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO, 1460 ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO,
1413 instance->this_id); 1461 instance->this_id);
1414 1462
1415 /* 1463 /*
1416 * Set the phase bits to 0, otherwise the NCR5380 won't drive the 1464 * Set the phase bits to 0, otherwise the NCR5380 won't drive the
1417 * data bus during SELECTION. 1465 * data bus during SELECTION.
1418 */ 1466 */
1419 1467
1420 local_irq_save(flags); 1468 local_irq_save(flags);
1421 if (hostdata->connected) { 1469 if (hostdata->connected) {
1470 local_irq_restore(flags);
1471 return -1;
1472 }
1473 NCR5380_write(TARGET_COMMAND_REG, 0);
1474
1475 /*
1476 * Start arbitration.
1477 */
1478
1479 NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
1480 NCR5380_write(MODE_REG, MR_ARBITRATE);
1481
1422 local_irq_restore(flags); 1482 local_irq_restore(flags);
1423 return -1; 1483
1424 } 1484 /* Wait for arbitration logic to complete */
1425 NCR5380_write(TARGET_COMMAND_REG, 0); 1485#if defined(NCR_TIMEOUT)
1426 1486 {
1427 1487 unsigned long timeout = jiffies + 2*NCR_TIMEOUT;
1428 /* 1488
1429 * Start arbitration. 1489 while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS) &&
1430 */ 1490 time_before(jiffies, timeout) && !hostdata->connected)
1431 1491 ;
1432 NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask); 1492 if (time_after_eq(jiffies, timeout)) {
1433 NCR5380_write(MODE_REG, MR_ARBITRATE); 1493 printk("scsi : arbitration timeout at %d\n", __LINE__);
1434 1494 NCR5380_write(MODE_REG, MR_BASE);
1435 local_irq_restore(flags); 1495 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1436 1496 return -1;
1437 /* Wait for arbitration logic to complete */ 1497 }
1438#if NCR_TIMEOUT 1498 }
1439 {
1440 unsigned long timeout = jiffies + 2*NCR_TIMEOUT;
1441
1442 while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS)
1443 && time_before(jiffies, timeout) && !hostdata->connected)
1444 ;
1445 if (time_after_eq(jiffies, timeout))
1446 {
1447 printk("scsi : arbitration timeout at %d\n", __LINE__);
1448 NCR5380_write(MODE_REG, MR_BASE);
1449 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1450 return -1;
1451 }
1452 }
1453#else /* NCR_TIMEOUT */ 1499#else /* NCR_TIMEOUT */
1454 while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS) 1500 while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS) &&
1455 && !hostdata->connected); 1501 !hostdata->connected)
1502 ;
1456#endif 1503#endif
1457 1504
1458 ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO); 1505 ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO);
1459
1460 if (hostdata->connected) {
1461 NCR5380_write(MODE_REG, MR_BASE);
1462 return -1;
1463 }
1464 /*
1465 * The arbitration delay is 2.2us, but this is a minimum and there is
1466 * no maximum so we can safely sleep for ceil(2.2) usecs to accommodate
1467 * the integral nature of udelay().
1468 *
1469 */
1470
1471 udelay(3);
1472
1473 /* Check for lost arbitration */
1474 if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1475 (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) ||
1476 (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1477 hostdata->connected) {
1478 NCR5380_write(MODE_REG, MR_BASE);
1479 ARB_PRINTK("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
1480 HOSTNO);
1481 return -1;
1482 }
1483
1484 /* after/during arbitration, BSY should be asserted.
1485 IBM DPES-31080 Version S31Q works now */
1486 /* Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman) */
1487 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_SEL |
1488 ICR_ASSERT_BSY ) ;
1489
1490 if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1491 hostdata->connected) {
1492 NCR5380_write(MODE_REG, MR_BASE);
1493 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1494 ARB_PRINTK("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
1495 HOSTNO);
1496 return -1;
1497 }
1498 1506
1499 /* 1507 if (hostdata->connected) {
1500 * Again, bus clear + bus settle time is 1.2us, however, this is 1508 NCR5380_write(MODE_REG, MR_BASE);
1501 * a minimum so we'll udelay ceil(1.2) 1509 return -1;
1502 */ 1510 }
1511 /*
1512 * The arbitration delay is 2.2us, but this is a minimum and there is
1513 * no maximum so we can safely sleep for ceil(2.2) usecs to accommodate
1514 * the integral nature of udelay().
1515 *
1516 */
1517
1518 udelay(3);
1519
1520 /* Check for lost arbitration */
1521 if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1522 (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) ||
1523 (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1524 hostdata->connected) {
1525 NCR5380_write(MODE_REG, MR_BASE);
1526 ARB_PRINTK("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
1527 HOSTNO);
1528 return -1;
1529 }
1530
1531 /* after/during arbitration, BSY should be asserted.
1532 IBM DPES-31080 Version S31Q works now */
1533 /* Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman) */
1534 NCR5380_write(INITIATOR_COMMAND_REG,
1535 ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
1536
1537 if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
1538 hostdata->connected) {
1539 NCR5380_write(MODE_REG, MR_BASE);
1540 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1541 ARB_PRINTK("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
1542 HOSTNO);
1543 return -1;
1544 }
1545
1546 /*
1547 * Again, bus clear + bus settle time is 1.2us, however, this is
1548 * a minimum so we'll udelay ceil(1.2)
1549 */
1503 1550
1504#ifdef CONFIG_ATARI_SCSI_TOSHIBA_DELAY 1551#ifdef CONFIG_ATARI_SCSI_TOSHIBA_DELAY
1505 /* ++roman: But some targets (see above :-) seem to need a bit more... */ 1552 /* ++roman: But some targets (see above :-) seem to need a bit more... */
1506 udelay(15); 1553 udelay(15);
1507#else 1554#else
1508 udelay(2); 1555 udelay(2);
1509#endif 1556#endif
1510 1557
1511 if (hostdata->connected) { 1558 if (hostdata->connected) {
1559 NCR5380_write(MODE_REG, MR_BASE);
1560 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1561 return -1;
1562 }
1563
1564 ARB_PRINTK("scsi%d: won arbitration\n", HOSTNO);
1565
1566 /*
1567 * Now that we have won arbitration, start Selection process, asserting
1568 * the host and target ID's on the SCSI bus.
1569 */
1570
1571 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
1572
1573 /*
1574 * Raise ATN while SEL is true before BSY goes false from arbitration,
1575 * since this is the only way to guarantee that we'll get a MESSAGE OUT
1576 * phase immediately after selection.
1577 */
1578
1579 NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY |
1580 ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL ));
1512 NCR5380_write(MODE_REG, MR_BASE); 1581 NCR5380_write(MODE_REG, MR_BASE);
1513 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1514 return -1;
1515 }
1516 1582
1517 ARB_PRINTK("scsi%d: won arbitration\n", HOSTNO); 1583 /*
1584 * Reselect interrupts must be turned off prior to the dropping of BSY,
1585 * otherwise we will trigger an interrupt.
1586 */
1587
1588 if (hostdata->connected) {
1589 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1590 return -1;
1591 }
1518 1592
1519 /* 1593 NCR5380_write(SELECT_ENABLE_REG, 0);
1520 * Now that we have won arbitration, start Selection process, asserting 1594
1521 * the host and target ID's on the SCSI bus. 1595 /*
1522 */ 1596 * The initiator shall then wait at least two deskew delays and release
1597 * the BSY signal.
1598 */
1599 udelay(1); /* wingel -- wait two bus deskew delay >2*45ns */
1600
1601 /* Reset BSY */
1602 NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA |
1603 ICR_ASSERT_ATN | ICR_ASSERT_SEL));
1604
1605 /*
1606 * Something weird happens when we cease to drive BSY - looks
1607 * like the board/chip is letting us do another read before the
1608 * appropriate propagation delay has expired, and we're confusing
1609 * a BSY signal from ourselves as the target's response to SELECTION.
1610 *
1611 * A small delay (the 'C++' frontend breaks the pipeline with an
1612 * unnecessary jump, making it work on my 386-33/Trantor T128, the
1613 * tighter 'C' code breaks and requires this) solves the problem -
1614 * the 1 us delay is arbitrary, and only used because this delay will
1615 * be the same on other platforms and since it works here, it should
1616 * work there.
1617 *
1618 * wingel suggests that this could be due to failing to wait
1619 * one deskew delay.
1620 */
1523 1621
1524 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id))); 1622 udelay(1);
1525 1623
1526 /* 1624 SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
1527 * Raise ATN while SEL is true before BSY goes false from arbitration,
1528 * since this is the only way to guarantee that we'll get a MESSAGE OUT
1529 * phase immediately after selection.
1530 */
1531 1625
1532 NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY | 1626 /*
1533 ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL )); 1627 * The SCSI specification calls for a 250 ms timeout for the actual
1534 NCR5380_write(MODE_REG, MR_BASE); 1628 * selection.
1629 */
1535 1630
1536 /* 1631 timeout = jiffies + 25;
1537 * Reselect interrupts must be turned off prior to the dropping of BSY,
1538 * otherwise we will trigger an interrupt.
1539 */
1540 1632
1541 if (hostdata->connected) { 1633 /*
1542 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1634 * XXX very interesting - we're seeing a bounce where the BSY we
1543 return -1; 1635 * asserted is being reflected / still asserted (propagation delay?)
1544 } 1636 * and it's detecting as true. Sigh.
1545 1637 */
1546 NCR5380_write(SELECT_ENABLE_REG, 0);
1547
1548 /*
1549 * The initiator shall then wait at least two deskew delays and release
1550 * the BSY signal.
1551 */
1552 udelay(1); /* wingel -- wait two bus deskew delay >2*45ns */
1553
1554 /* Reset BSY */
1555 NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA |
1556 ICR_ASSERT_ATN | ICR_ASSERT_SEL));
1557
1558 /*
1559 * Something weird happens when we cease to drive BSY - looks
1560 * like the board/chip is letting us do another read before the
1561 * appropriate propagation delay has expired, and we're confusing
1562 * a BSY signal from ourselves as the target's response to SELECTION.
1563 *
1564 * A small delay (the 'C++' frontend breaks the pipeline with an
1565 * unnecessary jump, making it work on my 386-33/Trantor T128, the
1566 * tighter 'C' code breaks and requires this) solves the problem -
1567 * the 1 us delay is arbitrary, and only used because this delay will
1568 * be the same on other platforms and since it works here, it should
1569 * work there.
1570 *
1571 * wingel suggests that this could be due to failing to wait
1572 * one deskew delay.
1573 */
1574
1575 udelay(1);
1576
1577 SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
1578
1579 /*
1580 * The SCSI specification calls for a 250 ms timeout for the actual
1581 * selection.
1582 */
1583
1584 timeout = jiffies + 25;
1585
1586 /*
1587 * XXX very interesting - we're seeing a bounce where the BSY we
1588 * asserted is being reflected / still asserted (propagation delay?)
1589 * and it's detecting as true. Sigh.
1590 */
1591 1638
1592#if 0 1639#if 0
1593 /* ++roman: If a target conformed to the SCSI standard, it wouldn't assert 1640 /* ++roman: If a target conformed to the SCSI standard, it wouldn't assert
1594 * IO while SEL is true. But again, there are some disks out the in the 1641 * IO while SEL is true. But again, there are some disks out the in the
1595 * world that do that nevertheless. (Somebody claimed that this announces 1642 * world that do that nevertheless. (Somebody claimed that this announces
1596 * reselection capability of the target.) So we better skip that test and 1643 * reselection capability of the target.) So we better skip that test and
1597 * only wait for BSY... (Famous german words: Der Klügere gibt nach :-) 1644 * only wait for BSY... (Famous german words: Der Klügere gibt nach :-)
1598 */ 1645 */
1599 1646
1600 while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & 1647 while (time_before(jiffies, timeout) &&
1601 (SR_BSY | SR_IO))); 1648 !(NCR5380_read(STATUS_REG) & (SR_BSY | SR_IO)))
1602 1649 ;
1603 if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == 1650
1604 (SR_SEL | SR_IO)) { 1651 if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == (SR_SEL | SR_IO)) {
1605 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1652 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1606 NCR5380_reselect(instance); 1653 NCR5380_reselect(instance);
1607 printk (KERN_ERR "scsi%d: reselection after won arbitration?\n", 1654 printk(KERN_ERR "scsi%d: reselection after won arbitration?\n",
1608 HOSTNO); 1655 HOSTNO);
1609 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 1656 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1610 return -1; 1657 return -1;
1611 } 1658 }
1612#else 1659#else
1613 while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & SR_BSY)); 1660 while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & SR_BSY))
1661 ;
1614#endif 1662#endif
1615 1663
1616 /* 1664 /*
1617 * No less than two deskew delays after the initiator detects the 1665 * No less than two deskew delays after the initiator detects the
1618 * BSY signal is true, it shall release the SEL signal and may 1666 * BSY signal is true, it shall release the SEL signal and may
1619 * change the DATA BUS. -wingel 1667 * change the DATA BUS. -wingel
1620 */ 1668 */
1621 1669
1622 udelay(1); 1670 udelay(1);
1623 1671
1624 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); 1672 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
1625 1673
1626 if (!(NCR5380_read(STATUS_REG) & SR_BSY)) { 1674 if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
1627 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1675 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1628 if (hostdata->targets_present & (1 << cmd->device->id)) { 1676 if (hostdata->targets_present & (1 << cmd->device->id)) {
1629 printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO); 1677 printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
1630 if (hostdata->restart_select) 1678 if (hostdata->restart_select)
1631 printk(KERN_NOTICE "\trestart select\n"); 1679 printk(KERN_NOTICE "\trestart select\n");
1632 NCR_PRINT(NDEBUG_ANY); 1680 NCR_PRINT(NDEBUG_ANY);
1633 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 1681 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1634 return -1; 1682 return -1;
1635 } 1683 }
1636 cmd->result = DID_BAD_TARGET << 16; 1684 cmd->result = DID_BAD_TARGET << 16;
1637#ifdef NCR5380_STATS 1685#ifdef NCR5380_STATS
1638 collect_stats(hostdata, cmd); 1686 collect_stats(hostdata, cmd);
1639#endif 1687#endif
1640#ifdef SUPPORT_TAGS 1688#ifdef SUPPORT_TAGS
1641 cmd_free_tag( cmd ); 1689 cmd_free_tag(cmd);
1642#endif 1690#endif
1643 cmd->scsi_done(cmd); 1691 cmd->scsi_done(cmd);
1644 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 1692 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1645 SEL_PRINTK("scsi%d: target did not respond within 250ms\n", HOSTNO); 1693 SEL_PRINTK("scsi%d: target did not respond within 250ms\n", HOSTNO);
1646 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 1694 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1647 return 0; 1695 return 0;
1648 } 1696 }
1649 1697
1650 hostdata->targets_present |= (1 << cmd->device->id); 1698 hostdata->targets_present |= (1 << cmd->device->id);
1651 1699
1652 /* 1700 /*
1653 * Since we followed the SCSI spec, and raised ATN while SEL 1701 * Since we followed the SCSI spec, and raised ATN while SEL
1654 * was true but before BSY was false during selection, the information 1702 * was true but before BSY was false during selection, the information
1655 * transfer phase should be a MESSAGE OUT phase so that we can send the 1703 * transfer phase should be a MESSAGE OUT phase so that we can send the
1656 * IDENTIFY message. 1704 * IDENTIFY message.
1657 * 1705 *
1658 * If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG 1706 * If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG
1659 * message (2 bytes) with a tag ID that we increment with every command 1707 * message (2 bytes) with a tag ID that we increment with every command
1660 * until it wraps back to 0. 1708 * until it wraps back to 0.
1661 * 1709 *
1662 * XXX - it turns out that there are some broken SCSI-II devices, 1710 * XXX - it turns out that there are some broken SCSI-II devices,
1663 * which claim to support tagged queuing but fail when more than 1711 * which claim to support tagged queuing but fail when more than
1664 * some number of commands are issued at once. 1712 * some number of commands are issued at once.
1665 */ 1713 */
1666 1714
1667 /* Wait for start of REQ/ACK handshake */ 1715 /* Wait for start of REQ/ACK handshake */
1668 while (!(NCR5380_read(STATUS_REG) & SR_REQ)); 1716 while (!(NCR5380_read(STATUS_REG) & SR_REQ))
1669 1717 ;
1670 SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n", 1718
1671 HOSTNO, cmd->device->id); 1719 SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
1672 tmp[0] = IDENTIFY(1, cmd->device->lun); 1720 HOSTNO, cmd->device->id);
1721 tmp[0] = IDENTIFY(1, cmd->device->lun);
1673 1722
1674#ifdef SUPPORT_TAGS 1723#ifdef SUPPORT_TAGS
1675 if (cmd->tag != TAG_NONE) { 1724 if (cmd->tag != TAG_NONE) {
1676 tmp[1] = hostdata->last_message = SIMPLE_QUEUE_TAG; 1725 tmp[1] = hostdata->last_message = SIMPLE_QUEUE_TAG;
1677 tmp[2] = cmd->tag; 1726 tmp[2] = cmd->tag;
1678 len = 3; 1727 len = 3;
1679 } else 1728 } else
1680 len = 1; 1729 len = 1;
1681#else 1730#else
1682 len = 1; 1731 len = 1;
1683 cmd->tag=0; 1732 cmd->tag = 0;
1684#endif /* SUPPORT_TAGS */ 1733#endif /* SUPPORT_TAGS */
1685 1734
1686 /* Send message(s) */ 1735 /* Send message(s) */
1687 data = tmp; 1736 data = tmp;
1688 phase = PHASE_MSGOUT; 1737 phase = PHASE_MSGOUT;
1689 NCR5380_transfer_pio(instance, &phase, &len, &data); 1738 NCR5380_transfer_pio(instance, &phase, &len, &data);
1690 SEL_PRINTK("scsi%d: nexus established.\n", HOSTNO); 1739 SEL_PRINTK("scsi%d: nexus established.\n", HOSTNO);
1691 /* XXX need to handle errors here */ 1740 /* XXX need to handle errors here */
1692 hostdata->connected = cmd; 1741 hostdata->connected = cmd;
1693#ifndef SUPPORT_TAGS 1742#ifndef SUPPORT_TAGS
1694 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 1743 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
1695#endif 1744#endif
1696
1697 initialize_SCp(cmd);
1698 1745
1746 initialize_SCp(cmd);
1699 1747
1700 return 0; 1748 return 0;
1701} 1749}
1702 1750
1703/* 1751/*
1704 * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, 1752 * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance,
1705 * unsigned char *phase, int *count, unsigned char **data) 1753 * unsigned char *phase, int *count, unsigned char **data)
1706 * 1754 *
1707 * Purpose : transfers data in given phase using polled I/O 1755 * Purpose : transfers data in given phase using polled I/O
1708 * 1756 *
1709 * Inputs : instance - instance of driver, *phase - pointer to 1757 * Inputs : instance - instance of driver, *phase - pointer to
1710 * what phase is expected, *count - pointer to number of 1758 * what phase is expected, *count - pointer to number of
1711 * bytes to transfer, **data - pointer to data pointer. 1759 * bytes to transfer, **data - pointer to data pointer.
1712 * 1760 *
1713 * Returns : -1 when different phase is entered without transferring 1761 * Returns : -1 when different phase is entered without transferring
1714 * maximum number of bytes, 0 if all bytes are transfered or exit 1762 * maximum number of bytes, 0 if all bytes are transfered or exit
1715 * is in same phase. 1763 * is in same phase.
1716 * 1764 *
1717 * Also, *phase, *count, *data are modified in place. 1765 * Also, *phase, *count, *data are modified in place.
1718 * 1766 *
1719 * XXX Note : handling for bus free may be useful. 1767 * XXX Note : handling for bus free may be useful.
1720 */ 1768 */
1721 1769
1722/* 1770/*
1723 * Note : this code is not as quick as it could be, however it 1771 * Note : this code is not as quick as it could be, however it
1724 * IS 100% reliable, and for the actual data transfer where speed 1772 * IS 100% reliable, and for the actual data transfer where speed
1725 * counts, we will always do a pseudo DMA or DMA transfer. 1773 * counts, we will always do a pseudo DMA or DMA transfer.
1726 */ 1774 */
1727 1775
1728static int NCR5380_transfer_pio( struct Scsi_Host *instance, 1776static int NCR5380_transfer_pio(struct Scsi_Host *instance,
1729 unsigned char *phase, int *count, 1777 unsigned char *phase, int *count,
1730 unsigned char **data) 1778 unsigned char **data)
1731{ 1779{
1732 register unsigned char p = *phase, tmp; 1780 register unsigned char p = *phase, tmp;
1733 register int c = *count; 1781 register int c = *count;
1734 register unsigned char *d = *data; 1782 register unsigned char *d = *data;
1735 1783
1736 /* 1784 /*
1737 * The NCR5380 chip will only drive the SCSI bus when the 1785 * The NCR5380 chip will only drive the SCSI bus when the
1738 * phase specified in the appropriate bits of the TARGET COMMAND 1786 * phase specified in the appropriate bits of the TARGET COMMAND
1739 * REGISTER match the STATUS REGISTER 1787 * REGISTER match the STATUS REGISTER
1740 */
1741
1742 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
1743
1744 do {
1745 /*
1746 * Wait for assertion of REQ, after which the phase bits will be
1747 * valid
1748 */ 1788 */
1749 while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ));
1750 1789
1751 HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO); 1790 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
1752 1791
1753 /* Check for phase mismatch */ 1792 do {
1754 if ((tmp & PHASE_MASK) != p) { 1793 /*
1755 PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO); 1794 * Wait for assertion of REQ, after which the phase bits will be
1756 NCR_PRINT_PHASE(NDEBUG_PIO); 1795 * valid
1757 break; 1796 */
1758 } 1797 while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ))
1798 ;
1759 1799
1760 /* Do actual transfer from SCSI bus to / from memory */ 1800 HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO);
1761 if (!(p & SR_IO))
1762 NCR5380_write(OUTPUT_DATA_REG, *d);
1763 else
1764 *d = NCR5380_read(CURRENT_SCSI_DATA_REG);
1765 1801
1766 ++d; 1802 /* Check for phase mismatch */
1803 if ((tmp & PHASE_MASK) != p) {
1804 PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO);
1805 NCR_PRINT_PHASE(NDEBUG_PIO);
1806 break;
1807 }
1767 1808
1768 /* 1809 /* Do actual transfer from SCSI bus to / from memory */
1769 * The SCSI standard suggests that in MSGOUT phase, the initiator 1810 if (!(p & SR_IO))
1770 * should drop ATN on the last byte of the message phase 1811 NCR5380_write(OUTPUT_DATA_REG, *d);
1771 * after REQ has been asserted for the handshake but before 1812 else
1772 * the initiator raises ACK. 1813 *d = NCR5380_read(CURRENT_SCSI_DATA_REG);
1773 */
1774 1814
1775 if (!(p & SR_IO)) { 1815 ++d;
1776 if (!((p & SR_MSG) && c > 1)) {
1777 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1778 ICR_ASSERT_DATA);
1779 NCR_PRINT(NDEBUG_PIO);
1780 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1781 ICR_ASSERT_DATA | ICR_ASSERT_ACK);
1782 } else {
1783 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1784 ICR_ASSERT_DATA | ICR_ASSERT_ATN);
1785 NCR_PRINT(NDEBUG_PIO);
1786 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1787 ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
1788 }
1789 } else {
1790 NCR_PRINT(NDEBUG_PIO);
1791 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
1792 }
1793 1816
1794 while (NCR5380_read(STATUS_REG) & SR_REQ); 1817 /*
1818 * The SCSI standard suggests that in MSGOUT phase, the initiator
1819 * should drop ATN on the last byte of the message phase
1820 * after REQ has been asserted for the handshake but before
1821 * the initiator raises ACK.
1822 */
1795 1823
1796 HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO); 1824 if (!(p & SR_IO)) {
1825 if (!((p & SR_MSG) && c > 1)) {
1826 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
1827 NCR_PRINT(NDEBUG_PIO);
1828 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1829 ICR_ASSERT_DATA | ICR_ASSERT_ACK);
1830 } else {
1831 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1832 ICR_ASSERT_DATA | ICR_ASSERT_ATN);
1833 NCR_PRINT(NDEBUG_PIO);
1834 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
1835 ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
1836 }
1837 } else {
1838 NCR_PRINT(NDEBUG_PIO);
1839 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
1840 }
1797 1841
1798/* 1842 while (NCR5380_read(STATUS_REG) & SR_REQ)
1799 * We have several special cases to consider during REQ/ACK handshaking : 1843 ;
1800 * 1. We were in MSGOUT phase, and we are on the last byte of the 1844
1801 * message. ATN must be dropped as ACK is dropped. 1845 HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO);
1802 * 1846
1803 * 2. We are in a MSGIN phase, and we are on the last byte of the 1847 /*
1804 * message. We must exit with ACK asserted, so that the calling 1848 * We have several special cases to consider during REQ/ACK handshaking :
1805 * code may raise ATN before dropping ACK to reject the message. 1849 * 1. We were in MSGOUT phase, and we are on the last byte of the
1806 * 1850 * message. ATN must be dropped as ACK is dropped.
1807 * 3. ACK and ATN are clear and the target may proceed as normal. 1851 *
1808 */ 1852 * 2. We are in a MSGIN phase, and we are on the last byte of the
1809 if (!(p == PHASE_MSGIN && c == 1)) { 1853 * message. We must exit with ACK asserted, so that the calling
1810 if (p == PHASE_MSGOUT && c > 1) 1854 * code may raise ATN before dropping ACK to reject the message.
1811 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); 1855 *
1812 else 1856 * 3. ACK and ATN are clear and the target may proceed as normal.
1813 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1857 */
1814 } 1858 if (!(p == PHASE_MSGIN && c == 1)) {
1815 } while (--c); 1859 if (p == PHASE_MSGOUT && c > 1)
1816 1860 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
1817 PIO_PRINTK("scsi%d: residual %d\n", HOSTNO, c); 1861 else
1818 1862 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1819 *count = c; 1863 }
1820 *data = d; 1864 } while (--c);
1821 tmp = NCR5380_read(STATUS_REG); 1865
1822 /* The phase read from the bus is valid if either REQ is (already) 1866 PIO_PRINTK("scsi%d: residual %d\n", HOSTNO, c);
1823 * asserted or if ACK hasn't been released yet. The latter is the case if 1867
1824 * we're in MSGIN and all wanted bytes have been received. */ 1868 *count = c;
1825 if ((tmp & SR_REQ) || (p == PHASE_MSGIN && c == 0)) 1869 *data = d;
1826 *phase = tmp & PHASE_MASK; 1870 tmp = NCR5380_read(STATUS_REG);
1827 else 1871 /* The phase read from the bus is valid if either REQ is (already)
1828 *phase = PHASE_UNKNOWN; 1872 * asserted or if ACK hasn't been released yet. The latter is the case if
1829 1873 * we're in MSGIN and all wanted bytes have been received.
1830 if (!c || (*phase == p)) 1874 */
1831 return 0; 1875 if ((tmp & SR_REQ) || (p == PHASE_MSGIN && c == 0))
1832 else 1876 *phase = tmp & PHASE_MASK;
1833 return -1; 1877 else
1878 *phase = PHASE_UNKNOWN;
1879
1880 if (!c || (*phase == p))
1881 return 0;
1882 else
1883 return -1;
1834} 1884}
1835 1885
1836/* 1886/*
1837 * Function : do_abort (Scsi_Host *host) 1887 * Function : do_abort (Scsi_Host *host)
1838 * 1888 *
1839 * Purpose : abort the currently established nexus. Should only be 1889 * Purpose : abort the currently established nexus. Should only be
1840 * called from a routine which can drop into a 1890 * called from a routine which can drop into a
1841 * 1891 *
1842 * Returns : 0 on success, -1 on failure. 1892 * Returns : 0 on success, -1 on failure.
1843 */ 1893 */
1844 1894
1845static int do_abort (struct Scsi_Host *host) 1895static int do_abort(struct Scsi_Host *host)
1846{ 1896{
1847 unsigned char tmp, *msgptr, phase; 1897 unsigned char tmp, *msgptr, phase;
1848 int len; 1898 int len;
1849 1899
1850 /* Request message out phase */ 1900 /* Request message out phase */
1851 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
1852
1853 /*
1854 * Wait for the target to indicate a valid phase by asserting
1855 * REQ. Once this happens, we'll have either a MSGOUT phase
1856 * and can immediately send the ABORT message, or we'll have some
1857 * other phase and will have to source/sink data.
1858 *
1859 * We really don't care what value was on the bus or what value
1860 * the target sees, so we just handshake.
1861 */
1862
1863 while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);
1864
1865 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
1866
1867 if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
1868 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
1869 ICR_ASSERT_ACK);
1870 while (NCR5380_read(STATUS_REG) & SR_REQ);
1871 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); 1901 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
1872 } 1902
1873 1903 /*
1874 tmp = ABORT; 1904 * Wait for the target to indicate a valid phase by asserting
1875 msgptr = &tmp; 1905 * REQ. Once this happens, we'll have either a MSGOUT phase
1876 len = 1; 1906 * and can immediately send the ABORT message, or we'll have some
1877 phase = PHASE_MSGOUT; 1907 * other phase and will have to source/sink data.
1878 NCR5380_transfer_pio (host, &phase, &len, &msgptr); 1908 *
1879 1909 * We really don't care what value was on the bus or what value
1880 /* 1910 * the target sees, so we just handshake.
1881 * If we got here, and the command completed successfully, 1911 */
1882 * we're about to go into bus free state. 1912
1883 */ 1913 while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ)
1884 1914 ;
1885 return len ? -1 : 0; 1915
1916 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
1917
1918 if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
1919 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
1920 ICR_ASSERT_ACK);
1921 while (NCR5380_read(STATUS_REG) & SR_REQ)
1922 ;
1923 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
1924 }
1925
1926 tmp = ABORT;
1927 msgptr = &tmp;
1928 len = 1;
1929 phase = PHASE_MSGOUT;
1930 NCR5380_transfer_pio(host, &phase, &len, &msgptr);
1931
1932 /*
1933 * If we got here, and the command completed successfully,
1934 * we're about to go into bus free state.
1935 */
1936
1937 return len ? -1 : 0;
1886} 1938}
1887 1939
1888#if defined(REAL_DMA) 1940#if defined(REAL_DMA)
1889/* 1941/*
1890 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, 1942 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1891 * unsigned char *phase, int *count, unsigned char **data) 1943 * unsigned char *phase, int *count, unsigned char **data)
1892 * 1944 *
1893 * Purpose : transfers data in given phase using either real 1945 * Purpose : transfers data in given phase using either real
1894 * or pseudo DMA. 1946 * or pseudo DMA.
1895 * 1947 *
1896 * Inputs : instance - instance of driver, *phase - pointer to 1948 * Inputs : instance - instance of driver, *phase - pointer to
1897 * what phase is expected, *count - pointer to number of 1949 * what phase is expected, *count - pointer to number of
1898 * bytes to transfer, **data - pointer to data pointer. 1950 * bytes to transfer, **data - pointer to data pointer.
1899 * 1951 *
1900 * Returns : -1 when different phase is entered without transferring 1952 * Returns : -1 when different phase is entered without transferring
1901 * maximum number of bytes, 0 if all bytes or transfered or exit 1953 * maximum number of bytes, 0 if all bytes or transfered or exit
1902 * is in same phase. 1954 * is in same phase.
1903 * 1955 *
1904 * Also, *phase, *count, *data are modified in place. 1956 * Also, *phase, *count, *data are modified in place.
1905 * 1957 *
1906 */ 1958 */
1907 1959
1908 1960
1909static int NCR5380_transfer_dma( struct Scsi_Host *instance, 1961static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1910 unsigned char *phase, int *count, 1962 unsigned char *phase, int *count,
1911 unsigned char **data) 1963 unsigned char **data)
1912{ 1964{
1913 SETUP_HOSTDATA(instance); 1965 SETUP_HOSTDATA(instance);
1914 register int c = *count; 1966 register int c = *count;
1915 register unsigned char p = *phase; 1967 register unsigned char p = *phase;
1916 register unsigned char *d = *data; 1968 register unsigned char *d = *data;
1917 unsigned char tmp; 1969 unsigned char tmp;
1918 unsigned long flags; 1970 unsigned long flags;
1919 1971
1920 if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) { 1972 if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) {
1921 *phase = tmp; 1973 *phase = tmp;
1922 return -1; 1974 return -1;
1923 } 1975 }
1924 1976
1925 if (atari_read_overruns && (p & SR_IO)) { 1977 if (atari_read_overruns && (p & SR_IO))
1926 c -= atari_read_overruns; 1978 c -= atari_read_overruns;
1927 }
1928 1979
1929 DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n", 1980 DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
1930 HOSTNO, (p & SR_IO) ? "reading" : "writing", 1981 HOSTNO, (p & SR_IO) ? "reading" : "writing",
1931 c, (p & SR_IO) ? "to" : "from", d); 1982 c, (p & SR_IO) ? "to" : "from", d);
1932 1983
1933 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p)); 1984 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
1934 1985
1935#ifdef REAL_DMA 1986#ifdef REAL_DMA
1936 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY); 1987 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY);
1937#endif /* def REAL_DMA */ 1988#endif /* def REAL_DMA */
1938 1989
1939 if (IS_A_TT()) { 1990 if (IS_A_TT()) {
1940 /* On the Medusa, it is a must to initialize the DMA before 1991 /* On the Medusa, it is a must to initialize the DMA before
1941 * starting the NCR. This is also the cleaner way for the TT. 1992 * starting the NCR. This is also the cleaner way for the TT.
1942 */ 1993 */
1943 local_irq_save(flags); 1994 local_irq_save(flags);
1944 hostdata->dma_len = (p & SR_IO) ? 1995 hostdata->dma_len = (p & SR_IO) ?
1945 NCR5380_dma_read_setup(instance, d, c) : 1996 NCR5380_dma_read_setup(instance, d, c) :
1946 NCR5380_dma_write_setup(instance, d, c); 1997 NCR5380_dma_write_setup(instance, d, c);
1947 local_irq_restore(flags); 1998 local_irq_restore(flags);
1948 } 1999 }
1949 2000
1950 if (p & SR_IO) 2001 if (p & SR_IO)
1951 NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0); 2002 NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0);
1952 else { 2003 else {
1953 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA); 2004 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
1954 NCR5380_write(START_DMA_SEND_REG, 0); 2005 NCR5380_write(START_DMA_SEND_REG, 0);
1955 } 2006 }
1956 2007
1957 if (!IS_A_TT()) { 2008 if (!IS_A_TT()) {
1958 /* On the Falcon, the DMA setup must be done after the last */ 2009 /* On the Falcon, the DMA setup must be done after the last */
1959 /* NCR access, else the DMA setup gets trashed! 2010 /* NCR access, else the DMA setup gets trashed!
1960 */ 2011 */
1961 local_irq_save(flags); 2012 local_irq_save(flags);
1962 hostdata->dma_len = (p & SR_IO) ? 2013 hostdata->dma_len = (p & SR_IO) ?
1963 NCR5380_dma_read_setup(instance, d, c) : 2014 NCR5380_dma_read_setup(instance, d, c) :
1964 NCR5380_dma_write_setup(instance, d, c); 2015 NCR5380_dma_write_setup(instance, d, c);
1965 local_irq_restore(flags); 2016 local_irq_restore(flags);
1966 } 2017 }
1967 return 0; 2018 return 0;
1968} 2019}
1969#endif /* defined(REAL_DMA) */ 2020#endif /* defined(REAL_DMA) */
1970 2021
1971/* 2022/*
1972 * Function : NCR5380_information_transfer (struct Scsi_Host *instance) 2023 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
1973 * 2024 *
1974 * Purpose : run through the various SCSI phases and do as the target 2025 * Purpose : run through the various SCSI phases and do as the target
1975 * directs us to. Operates on the currently connected command, 2026 * directs us to. Operates on the currently connected command,
1976 * instance->connected. 2027 * instance->connected.
1977 * 2028 *
1978 * Inputs : instance, instance for which we are doing commands 2029 * Inputs : instance, instance for which we are doing commands
1979 * 2030 *
1980 * Side effects : SCSI things happen, the disconnected queue will be 2031 * Side effects : SCSI things happen, the disconnected queue will be
1981 * modified if a command disconnects, *instance->connected will 2032 * modified if a command disconnects, *instance->connected will
1982 * change. 2033 * change.
1983 * 2034 *
1984 * XXX Note : we need to watch for bus free or a reset condition here 2035 * XXX Note : we need to watch for bus free or a reset condition here
1985 * to recover from an unexpected bus free condition. 2036 * to recover from an unexpected bus free condition.
1986 */ 2037 */
1987 2038
1988static void NCR5380_information_transfer (struct Scsi_Host *instance) 2039static void NCR5380_information_transfer(struct Scsi_Host *instance)
1989{ 2040{
1990 SETUP_HOSTDATA(instance); 2041 SETUP_HOSTDATA(instance);
1991 unsigned long flags; 2042 unsigned long flags;
1992 unsigned char msgout = NOP; 2043 unsigned char msgout = NOP;
1993 int sink = 0; 2044 int sink = 0;
1994 int len; 2045 int len;
1995#if defined(REAL_DMA) 2046#if defined(REAL_DMA)
1996 int transfersize; 2047 int transfersize;
1997#endif 2048#endif
1998 unsigned char *data; 2049 unsigned char *data;
1999 unsigned char phase, tmp, extended_msg[10], old_phase=0xff; 2050 unsigned char phase, tmp, extended_msg[10], old_phase = 0xff;
2000 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; 2051 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected;
2052
2053 while (1) {
2054 tmp = NCR5380_read(STATUS_REG);
2055 /* We only have a valid SCSI phase when REQ is asserted */
2056 if (tmp & SR_REQ) {
2057 phase = (tmp & PHASE_MASK);
2058 if (phase != old_phase) {
2059 old_phase = phase;
2060 NCR_PRINT_PHASE(NDEBUG_INFORMATION);
2061 }
2001 2062
2002 while (1) { 2063 if (sink && (phase != PHASE_MSGOUT)) {
2003 tmp = NCR5380_read(STATUS_REG); 2064 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
2004 /* We only have a valid SCSI phase when REQ is asserted */ 2065
2005 if (tmp & SR_REQ) { 2066 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
2006 phase = (tmp & PHASE_MASK); 2067 ICR_ASSERT_ACK);
2007 if (phase != old_phase) { 2068 while (NCR5380_read(STATUS_REG) & SR_REQ)
2008 old_phase = phase; 2069 ;
2009 NCR_PRINT_PHASE(NDEBUG_INFORMATION); 2070 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
2010 } 2071 ICR_ASSERT_ATN);
2011 2072 sink = 0;
2012 if (sink && (phase != PHASE_MSGOUT)) { 2073 continue;
2013 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp)); 2074 }
2014 2075
2015 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | 2076 switch (phase) {
2016 ICR_ASSERT_ACK); 2077 case PHASE_DATAOUT:
2017 while (NCR5380_read(STATUS_REG) & SR_REQ);
2018 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
2019 ICR_ASSERT_ATN);
2020 sink = 0;
2021 continue;
2022 }
2023
2024 switch (phase) {
2025 case PHASE_DATAOUT:
2026#if (NDEBUG & NDEBUG_NO_DATAOUT) 2078#if (NDEBUG & NDEBUG_NO_DATAOUT)
2027 printk("scsi%d: NDEBUG_NO_DATAOUT set, attempted DATAOUT " 2079 printk("scsi%d: NDEBUG_NO_DATAOUT set, attempted DATAOUT "
2028 "aborted\n", HOSTNO); 2080 "aborted\n", HOSTNO);
2029 sink = 1; 2081 sink = 1;
2030 do_abort(instance); 2082 do_abort(instance);
2031 cmd->result = DID_ERROR << 16; 2083 cmd->result = DID_ERROR << 16;
2032 cmd->done(cmd); 2084 cmd->done(cmd);
2033 return; 2085 return;
2034#endif 2086#endif
2035 case PHASE_DATAIN: 2087 case PHASE_DATAIN:
2036 /* 2088 /*
2037 * If there is no room left in the current buffer in the 2089 * If there is no room left in the current buffer in the
2038 * scatter-gather list, move onto the next one. 2090 * scatter-gather list, move onto the next one.
2039 */ 2091 */
2040 2092
2041 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { 2093 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
2042 ++cmd->SCp.buffer; 2094 ++cmd->SCp.buffer;
2043 --cmd->SCp.buffers_residual; 2095 --cmd->SCp.buffers_residual;
2044 cmd->SCp.this_residual = cmd->SCp.buffer->length; 2096 cmd->SCp.this_residual = cmd->SCp.buffer->length;
2045 cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+ 2097 cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) +
2046 cmd->SCp.buffer->offset; 2098 cmd->SCp.buffer->offset;
2047 /* ++roman: Try to merge some scatter-buffers if 2099 /* ++roman: Try to merge some scatter-buffers if
2048 * they are at contiguous physical addresses. 2100 * they are at contiguous physical addresses.
2049 */ 2101 */
2050 merge_contiguous_buffers( cmd ); 2102 merge_contiguous_buffers(cmd);
2051 INF_PRINTK("scsi%d: %d bytes and %d buffers left\n", 2103 INF_PRINTK("scsi%d: %d bytes and %d buffers left\n",
2052 HOSTNO, cmd->SCp.this_residual, 2104 HOSTNO, cmd->SCp.this_residual,
2053 cmd->SCp.buffers_residual); 2105 cmd->SCp.buffers_residual);
2054 } 2106 }
2055 2107
2056 /* 2108 /*
2057 * The preferred transfer method is going to be 2109 * The preferred transfer method is going to be
2058 * PSEUDO-DMA for systems that are strictly PIO, 2110 * PSEUDO-DMA for systems that are strictly PIO,
2059 * since we can let the hardware do the handshaking. 2111 * since we can let the hardware do the handshaking.
2060 * 2112 *
2061 * For this to work, we need to know the transfersize 2113 * For this to work, we need to know the transfersize
2062 * ahead of time, since the pseudo-DMA code will sit 2114 * ahead of time, since the pseudo-DMA code will sit
2063 * in an unconditional loop. 2115 * in an unconditional loop.
2064 */ 2116 */
2065 2117
2066/* ++roman: I suggest, this should be 2118 /* ++roman: I suggest, this should be
2067 * #if def(REAL_DMA) 2119 * #if def(REAL_DMA)
2068 * instead of leaving REAL_DMA out. 2120 * instead of leaving REAL_DMA out.
2069 */ 2121 */
2070 2122
2071#if defined(REAL_DMA) 2123#if defined(REAL_DMA)
2072 if (!cmd->device->borken && 2124 if (!cmd->device->borken &&
2073 (transfersize = NCR5380_dma_xfer_len(instance,cmd,phase)) > 31) { 2125 (transfersize = NCR5380_dma_xfer_len(instance,cmd,phase)) > 31) {
2074 len = transfersize; 2126 len = transfersize;
2075 cmd->SCp.phase = phase; 2127 cmd->SCp.phase = phase;
2076 if (NCR5380_transfer_dma(instance, &phase, 2128 if (NCR5380_transfer_dma(instance, &phase,
2077 &len, (unsigned char **) &cmd->SCp.ptr)) { 2129 &len, (unsigned char **)&cmd->SCp.ptr)) {
2078 /* 2130 /*
2079 * If the watchdog timer fires, all future 2131 * If the watchdog timer fires, all future
2080 * accesses to this device will use the 2132 * accesses to this device will use the
2081 * polled-IO. */ 2133 * polled-IO. */
2082 printk(KERN_NOTICE "scsi%d: switching target %d " 2134 printk(KERN_NOTICE "scsi%d: switching target %d "
2083 "lun %d to slow handshake\n", HOSTNO, 2135 "lun %d to slow handshake\n", HOSTNO,
2084 cmd->device->id, cmd->device->lun); 2136 cmd->device->id, cmd->device->lun);
2085 cmd->device->borken = 1; 2137 cmd->device->borken = 1;
2086 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 2138 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
2087 ICR_ASSERT_ATN); 2139 ICR_ASSERT_ATN);
2088 sink = 1; 2140 sink = 1;
2089 do_abort(instance); 2141 do_abort(instance);
2090 cmd->result = DID_ERROR << 16; 2142 cmd->result = DID_ERROR << 16;
2091 cmd->done(cmd); 2143 cmd->done(cmd);
2092 /* XXX - need to source or sink data here, as appropriate */ 2144 /* XXX - need to source or sink data here, as appropriate */
2093 } else { 2145 } else {
2094#ifdef REAL_DMA 2146#ifdef REAL_DMA
2095 /* ++roman: When using real DMA, 2147 /* ++roman: When using real DMA,
2096 * information_transfer() should return after 2148 * information_transfer() should return after
2097 * starting DMA since it has nothing more to 2149 * starting DMA since it has nothing more to
2098 * do. 2150 * do.
2099 */ 2151 */
2100 return; 2152 return;
2101#else 2153#else
2102 cmd->SCp.this_residual -= transfersize - len; 2154 cmd->SCp.this_residual -= transfersize - len;
2103#endif 2155#endif
2104 } 2156 }
2105 } else 2157 } else
2106#endif /* defined(REAL_DMA) */ 2158#endif /* defined(REAL_DMA) */
2107 NCR5380_transfer_pio(instance, &phase, 2159 NCR5380_transfer_pio(instance, &phase,
2108 (int *) &cmd->SCp.this_residual, (unsigned char **) 2160 (int *)&cmd->SCp.this_residual,
2109 &cmd->SCp.ptr); 2161 (unsigned char **)&cmd->SCp.ptr);
2110 break; 2162 break;
2111 case PHASE_MSGIN: 2163 case PHASE_MSGIN:
2112 len = 1; 2164 len = 1;
2113 data = &tmp; 2165 data = &tmp;
2114 NCR5380_write(SELECT_ENABLE_REG, 0); /* disable reselects */ 2166 NCR5380_write(SELECT_ENABLE_REG, 0); /* disable reselects */
2115 NCR5380_transfer_pio(instance, &phase, &len, &data); 2167 NCR5380_transfer_pio(instance, &phase, &len, &data);
2116 cmd->SCp.Message = tmp; 2168 cmd->SCp.Message = tmp;
2117 2169
2118 switch (tmp) { 2170 switch (tmp) {
2119 /* 2171 /*
2120 * Linking lets us reduce the time required to get the 2172 * Linking lets us reduce the time required to get the
2121 * next command out to the device, hopefully this will 2173 * next command out to the device, hopefully this will
2122 * mean we don't waste another revolution due to the delays 2174 * mean we don't waste another revolution due to the delays
2123 * required by ARBITRATION and another SELECTION. 2175 * required by ARBITRATION and another SELECTION.
2124 * 2176 *
2125 * In the current implementation proposal, low level drivers 2177 * In the current implementation proposal, low level drivers
2126 * merely have to start the next command, pointed to by 2178 * merely have to start the next command, pointed to by
2127 * next_link, done() is called as with unlinked commands. 2179 * next_link, done() is called as with unlinked commands.
2128 */ 2180 */
2129#ifdef LINKED 2181#ifdef LINKED
2130 case LINKED_CMD_COMPLETE: 2182 case LINKED_CMD_COMPLETE:
2131 case LINKED_FLG_CMD_COMPLETE: 2183 case LINKED_FLG_CMD_COMPLETE:
2132 /* Accept message by clearing ACK */ 2184 /* Accept message by clearing ACK */
2133 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2185 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2134 2186
2135 LNK_PRINTK("scsi%d: target %d lun %d linked command " 2187 LNK_PRINTK("scsi%d: target %d lun %d linked command "
2136 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun); 2188 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
2137 2189
2138 /* Enable reselect interrupts */ 2190 /* Enable reselect interrupts */
2139 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2191 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2140 /* 2192 /*
2141 * Sanity check : A linked command should only terminate 2193 * Sanity check : A linked command should only terminate
2142 * with one of these messages if there are more linked 2194 * with one of these messages if there are more linked
2143 * commands available. 2195 * commands available.
2144 */ 2196 */
2145 2197
2146 if (!cmd->next_link) { 2198 if (!cmd->next_link) {
2147 printk(KERN_NOTICE "scsi%d: target %d lun %d " 2199 printk(KERN_NOTICE "scsi%d: target %d lun %d "
2148 "linked command complete, no next_link\n", 2200 "linked command complete, no next_link\n",
2149 HOSTNO, cmd->device->id, cmd->device->lun); 2201 HOSTNO, cmd->device->id, cmd->device->lun);
2150 sink = 1; 2202 sink = 1;
2151 do_abort (instance); 2203 do_abort(instance);
2152 return; 2204 return;
2153 } 2205 }
2154 2206
2155 initialize_SCp(cmd->next_link); 2207 initialize_SCp(cmd->next_link);
2156 /* The next command is still part of this process; copy it 2208 /* The next command is still part of this process; copy it
2157 * and don't free it! */ 2209 * and don't free it! */
2158 cmd->next_link->tag = cmd->tag; 2210 cmd->next_link->tag = cmd->tag;
2159 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 2211 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2160 LNK_PRINTK("scsi%d: target %d lun %d linked request " 2212 LNK_PRINTK("scsi%d: target %d lun %d linked request "
2161 "done, calling scsi_done().\n", 2213 "done, calling scsi_done().\n",
2162 HOSTNO, cmd->device->id, cmd->device->lun); 2214 HOSTNO, cmd->device->id, cmd->device->lun);
2163#ifdef NCR5380_STATS 2215#ifdef NCR5380_STATS
2164 collect_stats(hostdata, cmd); 2216 collect_stats(hostdata, cmd);
2165#endif 2217#endif
2166 cmd->scsi_done(cmd); 2218 cmd->scsi_done(cmd);
2167 cmd = hostdata->connected; 2219 cmd = hostdata->connected;
2168 break; 2220 break;
2169#endif /* def LINKED */ 2221#endif /* def LINKED */
2170 case ABORT: 2222 case ABORT:
2171 case COMMAND_COMPLETE: 2223 case COMMAND_COMPLETE:
2172 /* Accept message by clearing ACK */ 2224 /* Accept message by clearing ACK */
2173 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2225 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2174 /* ++guenther: possible race with Falcon locking */ 2226 /* ++guenther: possible race with Falcon locking */
2175 falcon_dont_release++; 2227 falcon_dont_release++;
2176 hostdata->connected = NULL; 2228 hostdata->connected = NULL;
2177 QU_PRINTK("scsi%d: command for target %d, lun %d " 2229 QU_PRINTK("scsi%d: command for target %d, lun %d "
2178 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun); 2230 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
2179#ifdef SUPPORT_TAGS 2231#ifdef SUPPORT_TAGS
2180 cmd_free_tag( cmd ); 2232 cmd_free_tag(cmd);
2181 if (status_byte(cmd->SCp.Status) == QUEUE_FULL) { 2233 if (status_byte(cmd->SCp.Status) == QUEUE_FULL) {
2182 /* Turn a QUEUE FULL status into BUSY, I think the 2234 /* Turn a QUEUE FULL status into BUSY, I think the
2183 * mid level cannot handle QUEUE FULL :-( (The 2235 * mid level cannot handle QUEUE FULL :-( (The
2184 * command is retried after BUSY). Also update our 2236 * command is retried after BUSY). Also update our
2185 * queue size to the number of currently issued 2237 * queue size to the number of currently issued
2186 * commands now. 2238 * commands now.
2187 */ 2239 */
2188 /* ++Andreas: the mid level code knows about 2240 /* ++Andreas: the mid level code knows about
2189 QUEUE_FULL now. */ 2241 QUEUE_FULL now. */
2190 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 2242 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
2191 TAG_PRINTK("scsi%d: target %d lun %d returned " 2243 TAG_PRINTK("scsi%d: target %d lun %d returned "
2192 "QUEUE_FULL after %d commands\n", 2244 "QUEUE_FULL after %d commands\n",
2193 HOSTNO, cmd->device->id, cmd->device->lun, 2245 HOSTNO, cmd->device->id, cmd->device->lun,
2194 ta->nr_allocated); 2246 ta->nr_allocated);
2195 if (ta->queue_size > ta->nr_allocated) 2247 if (ta->queue_size > ta->nr_allocated)
2196 ta->nr_allocated = ta->queue_size; 2248 ta->nr_allocated = ta->queue_size;
2197 } 2249 }
2198#else 2250#else
2199 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2251 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
2200#endif 2252#endif
2201 /* Enable reselect interrupts */ 2253 /* Enable reselect interrupts */
2202 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2254 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2203 2255
2204 /* 2256 /*
2205 * I'm not sure what the correct thing to do here is : 2257 * I'm not sure what the correct thing to do here is :
2206 * 2258 *
2207 * If the command that just executed is NOT a request 2259 * If the command that just executed is NOT a request
2208 * sense, the obvious thing to do is to set the result 2260 * sense, the obvious thing to do is to set the result
2209 * code to the values of the stored parameters. 2261 * code to the values of the stored parameters.
2210 * 2262 *
2211 * If it was a REQUEST SENSE command, we need some way to 2263 * If it was a REQUEST SENSE command, we need some way to
2212 * differentiate between the failure code of the original 2264 * differentiate between the failure code of the original
2213 * and the failure code of the REQUEST sense - the obvious 2265 * and the failure code of the REQUEST sense - the obvious
2214 * case is success, where we fall through and leave the 2266 * case is success, where we fall through and leave the
2215 * result code unchanged. 2267 * result code unchanged.
2216 * 2268 *
2217 * The non-obvious place is where the REQUEST SENSE failed 2269 * The non-obvious place is where the REQUEST SENSE failed
2218 */ 2270 */
2219 2271
2220 if (cmd->cmnd[0] != REQUEST_SENSE) 2272 if (cmd->cmnd[0] != REQUEST_SENSE)
2221 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 2273 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2222 else if (status_byte(cmd->SCp.Status) != GOOD) 2274 else if (status_byte(cmd->SCp.Status) != GOOD)
2223 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); 2275 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
2224
2225#ifdef AUTOSENSE
2226 if ((cmd->cmnd[0] != REQUEST_SENSE) &&
2227 (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
2228 ASEN_PRINTK("scsi%d: performing request sense\n",
2229 HOSTNO);
2230 cmd->cmnd[0] = REQUEST_SENSE;
2231 cmd->cmnd[1] &= 0xe0;
2232 cmd->cmnd[2] = 0;
2233 cmd->cmnd[3] = 0;
2234 cmd->cmnd[4] = sizeof(cmd->sense_buffer);
2235 cmd->cmnd[5] = 0;
2236 cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
2237
2238 cmd->use_sg = 0;
2239 /* this is initialized from initialize_SCp
2240 cmd->SCp.buffer = NULL;
2241 cmd->SCp.buffers_residual = 0;
2242 */
2243 cmd->request_buffer = (char *) cmd->sense_buffer;
2244 cmd->request_bufflen = sizeof(cmd->sense_buffer);
2245 2276
2246 local_irq_save(flags); 2277#ifdef AUTOSENSE
2247 LIST(cmd,hostdata->issue_queue); 2278 if ((cmd->cmnd[0] != REQUEST_SENSE) &&
2248 NEXT(cmd) = hostdata->issue_queue; 2279 (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
2249 hostdata->issue_queue = (Scsi_Cmnd *) cmd; 2280 ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
2250 local_irq_restore(flags); 2281 cmd->cmnd[0] = REQUEST_SENSE;
2251 QU_PRINTK("scsi%d: REQUEST SENSE added to head of " 2282 cmd->cmnd[1] &= 0xe0;
2252 "issue queue\n", H_NO(cmd)); 2283 cmd->cmnd[2] = 0;
2253 } else 2284 cmd->cmnd[3] = 0;
2285 cmd->cmnd[4] = sizeof(cmd->sense_buffer);
2286 cmd->cmnd[5] = 0;
2287 cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
2288
2289 cmd->use_sg = 0;
2290 /* this is initialized from initialize_SCp
2291 cmd->SCp.buffer = NULL;
2292 cmd->SCp.buffers_residual = 0;
2293 */
2294 cmd->request_buffer = (char *) cmd->sense_buffer;
2295 cmd->request_bufflen = sizeof(cmd->sense_buffer);
2296
2297 local_irq_save(flags);
2298 LIST(cmd,hostdata->issue_queue);
2299 SET_NEXT(cmd, hostdata->issue_queue);
2300 hostdata->issue_queue = (Scsi_Cmnd *) cmd;
2301 local_irq_restore(flags);
2302 QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
2303 "issue queue\n", H_NO(cmd));
2304 } else
2254#endif /* def AUTOSENSE */ 2305#endif /* def AUTOSENSE */
2255 { 2306 {
2256#ifdef NCR5380_STATS 2307#ifdef NCR5380_STATS
2257 collect_stats(hostdata, cmd); 2308 collect_stats(hostdata, cmd);
2258#endif 2309#endif
2259 cmd->scsi_done(cmd); 2310 cmd->scsi_done(cmd);
2260 } 2311 }
2261 2312
2262 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2313 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2263 /* 2314 /*
2264 * Restore phase bits to 0 so an interrupted selection, 2315 * Restore phase bits to 0 so an interrupted selection,
2265 * arbitration can resume. 2316 * arbitration can resume.
2266 */ 2317 */
2267 NCR5380_write(TARGET_COMMAND_REG, 0); 2318 NCR5380_write(TARGET_COMMAND_REG, 0);
2268 2319
2269 while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected) 2320 while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
2270 barrier(); 2321 barrier();
2271 2322
2272 falcon_dont_release--; 2323 falcon_dont_release--;
2273 /* ++roman: For Falcon SCSI, release the lock on the 2324 /* ++roman: For Falcon SCSI, release the lock on the
2274 * ST-DMA here if no other commands are waiting on the 2325 * ST-DMA here if no other commands are waiting on the
2275 * disconnected queue. 2326 * disconnected queue.
2276 */ 2327 */
2277 falcon_release_lock_if_possible( hostdata ); 2328 falcon_release_lock_if_possible(hostdata);
2278 return; 2329 return;
2279 case MESSAGE_REJECT: 2330 case MESSAGE_REJECT:
2280 /* Accept message by clearing ACK */ 2331 /* Accept message by clearing ACK */
2281 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2332 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2282 /* Enable reselect interrupts */ 2333 /* Enable reselect interrupts */
2283 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2334 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2284 switch (hostdata->last_message) { 2335 switch (hostdata->last_message) {
2285 case HEAD_OF_QUEUE_TAG: 2336 case HEAD_OF_QUEUE_TAG:
2286 case ORDERED_QUEUE_TAG: 2337 case ORDERED_QUEUE_TAG:
2287 case SIMPLE_QUEUE_TAG: 2338 case SIMPLE_QUEUE_TAG:
2288 /* The target obviously doesn't support tagged 2339 /* The target obviously doesn't support tagged
2289 * queuing, even though it announced this ability in 2340 * queuing, even though it announced this ability in
2290 * its INQUIRY data ?!? (maybe only this LUN?) Ok, 2341 * its INQUIRY data ?!? (maybe only this LUN?) Ok,
2291 * clear 'tagged_supported' and lock the LUN, since 2342 * clear 'tagged_supported' and lock the LUN, since
2292 * the command is treated as untagged further on. 2343 * the command is treated as untagged further on.
2293 */ 2344 */
2294 cmd->device->tagged_supported = 0; 2345 cmd->device->tagged_supported = 0;
2295 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 2346 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
2296 cmd->tag = TAG_NONE; 2347 cmd->tag = TAG_NONE;
2297 TAG_PRINTK("scsi%d: target %d lun %d rejected " 2348 TAG_PRINTK("scsi%d: target %d lun %d rejected "
2298 "QUEUE_TAG message; tagged queuing " 2349 "QUEUE_TAG message; tagged queuing "
2299 "disabled\n", 2350 "disabled\n",
2300 HOSTNO, cmd->device->id, cmd->device->lun); 2351 HOSTNO, cmd->device->id, cmd->device->lun);
2301 break; 2352 break;
2302 } 2353 }
2303 break; 2354 break;
2304 case DISCONNECT: 2355 case DISCONNECT:
2305 /* Accept message by clearing ACK */ 2356 /* Accept message by clearing ACK */
2306 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2357 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2307 local_irq_save(flags); 2358 local_irq_save(flags);
2308 cmd->device->disconnect = 1; 2359 cmd->device->disconnect = 1;
2309 LIST(cmd,hostdata->disconnected_queue); 2360 LIST(cmd,hostdata->disconnected_queue);
2310 NEXT(cmd) = hostdata->disconnected_queue; 2361 SET_NEXT(cmd, hostdata->disconnected_queue);
2311 hostdata->connected = NULL; 2362 hostdata->connected = NULL;
2312 hostdata->disconnected_queue = cmd; 2363 hostdata->disconnected_queue = cmd;
2313 local_irq_restore(flags); 2364 local_irq_restore(flags);
2314 QU_PRINTK("scsi%d: command for target %d lun %d was " 2365 QU_PRINTK("scsi%d: command for target %d lun %d was "
2315 "moved from connected to the " 2366 "moved from connected to the "
2316 "disconnected_queue\n", HOSTNO, 2367 "disconnected_queue\n", HOSTNO,
2317 cmd->device->id, cmd->device->lun); 2368 cmd->device->id, cmd->device->lun);
2318 /* 2369 /*
2319 * Restore phase bits to 0 so an interrupted selection, 2370 * Restore phase bits to 0 so an interrupted selection,
2320 * arbitration can resume. 2371 * arbitration can resume.
2321 */ 2372 */
2322 NCR5380_write(TARGET_COMMAND_REG, 0); 2373 NCR5380_write(TARGET_COMMAND_REG, 0);
2323 2374
2324 /* Enable reselect interrupts */ 2375 /* Enable reselect interrupts */
2325 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2376 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2326 /* Wait for bus free to avoid nasty timeouts */ 2377 /* Wait for bus free to avoid nasty timeouts */
2327 while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected) 2378 while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
2328 barrier(); 2379 barrier();
2329 return; 2380 return;
2330 /* 2381 /*
2331 * The SCSI data pointer is *IMPLICITLY* saved on a disconnect 2382 * The SCSI data pointer is *IMPLICITLY* saved on a disconnect
2332 * operation, in violation of the SCSI spec so we can safely 2383 * operation, in violation of the SCSI spec so we can safely
2333 * ignore SAVE/RESTORE pointers calls. 2384 * ignore SAVE/RESTORE pointers calls.
2334 * 2385 *
2335 * Unfortunately, some disks violate the SCSI spec and 2386 * Unfortunately, some disks violate the SCSI spec and
2336 * don't issue the required SAVE_POINTERS message before 2387 * don't issue the required SAVE_POINTERS message before
2337 * disconnecting, and we have to break spec to remain 2388 * disconnecting, and we have to break spec to remain
2338 * compatible. 2389 * compatible.
2339 */ 2390 */
2340 case SAVE_POINTERS: 2391 case SAVE_POINTERS:
2341 case RESTORE_POINTERS: 2392 case RESTORE_POINTERS:
2342 /* Accept message by clearing ACK */ 2393 /* Accept message by clearing ACK */
2343 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2394 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2344 /* Enable reselect interrupts */ 2395 /* Enable reselect interrupts */
2345 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2396 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2346 break; 2397 break;
2347 case EXTENDED_MESSAGE: 2398 case EXTENDED_MESSAGE:
2348/* 2399 /*
2349 * Extended messages are sent in the following format : 2400 * Extended messages are sent in the following format :
2350 * Byte 2401 * Byte
2351 * 0 EXTENDED_MESSAGE == 1 2402 * 0 EXTENDED_MESSAGE == 1
2352 * 1 length (includes one byte for code, doesn't 2403 * 1 length (includes one byte for code, doesn't
2353 * include first two bytes) 2404 * include first two bytes)
2354 * 2 code 2405 * 2 code
2355 * 3..length+1 arguments 2406 * 3..length+1 arguments
2356 * 2407 *
2357 * Start the extended message buffer with the EXTENDED_MESSAGE 2408 * Start the extended message buffer with the EXTENDED_MESSAGE
2358 * byte, since spi_print_msg() wants the whole thing. 2409 * byte, since spi_print_msg() wants the whole thing.
2359 */ 2410 */
2360 extended_msg[0] = EXTENDED_MESSAGE; 2411 extended_msg[0] = EXTENDED_MESSAGE;
2361 /* Accept first byte by clearing ACK */ 2412 /* Accept first byte by clearing ACK */
2362 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2413 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2363 2414
2364 EXT_PRINTK("scsi%d: receiving extended message\n", HOSTNO); 2415 EXT_PRINTK("scsi%d: receiving extended message\n", HOSTNO);
2365 2416
2366 len = 2; 2417 len = 2;
2367 data = extended_msg + 1; 2418 data = extended_msg + 1;
2368 phase = PHASE_MSGIN; 2419 phase = PHASE_MSGIN;
2369 NCR5380_transfer_pio(instance, &phase, &len, &data); 2420 NCR5380_transfer_pio(instance, &phase, &len, &data);
2370 EXT_PRINTK("scsi%d: length=%d, code=0x%02x\n", HOSTNO, 2421 EXT_PRINTK("scsi%d: length=%d, code=0x%02x\n", HOSTNO,
2371 (int)extended_msg[1], (int)extended_msg[2]); 2422 (int)extended_msg[1], (int)extended_msg[2]);
2372 2423
2373 if (!len && extended_msg[1] <= 2424 if (!len && extended_msg[1] <=
2374 (sizeof (extended_msg) - 1)) { 2425 (sizeof(extended_msg) - 1)) {
2375 /* Accept third byte by clearing ACK */ 2426 /* Accept third byte by clearing ACK */
2376 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2427 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2377 len = extended_msg[1] - 1; 2428 len = extended_msg[1] - 1;
2378 data = extended_msg + 3; 2429 data = extended_msg + 3;
2379 phase = PHASE_MSGIN; 2430 phase = PHASE_MSGIN;
2380 2431
2381 NCR5380_transfer_pio(instance, &phase, &len, &data); 2432 NCR5380_transfer_pio(instance, &phase, &len, &data);
2382 EXT_PRINTK("scsi%d: message received, residual %d\n", 2433 EXT_PRINTK("scsi%d: message received, residual %d\n",
2383 HOSTNO, len); 2434 HOSTNO, len);
2384 2435
2385 switch (extended_msg[2]) { 2436 switch (extended_msg[2]) {
2386 case EXTENDED_SDTR: 2437 case EXTENDED_SDTR:
2387 case EXTENDED_WDTR: 2438 case EXTENDED_WDTR:
2388 case EXTENDED_MODIFY_DATA_POINTER: 2439 case EXTENDED_MODIFY_DATA_POINTER:
2389 case EXTENDED_EXTENDED_IDENTIFY: 2440 case EXTENDED_EXTENDED_IDENTIFY:
2390 tmp = 0; 2441 tmp = 0;
2391 } 2442 }
2392 } else if (len) { 2443 } else if (len) {
2393 printk(KERN_NOTICE "scsi%d: error receiving " 2444 printk(KERN_NOTICE "scsi%d: error receiving "
2394 "extended message\n", HOSTNO); 2445 "extended message\n", HOSTNO);
2395 tmp = 0; 2446 tmp = 0;
2396 } else { 2447 } else {
2397 printk(KERN_NOTICE "scsi%d: extended message " 2448 printk(KERN_NOTICE "scsi%d: extended message "
2398 "code %02x length %d is too long\n", 2449 "code %02x length %d is too long\n",
2399 HOSTNO, extended_msg[2], extended_msg[1]); 2450 HOSTNO, extended_msg[2], extended_msg[1]);
2400 tmp = 0; 2451 tmp = 0;
2401 } 2452 }
2402 /* Fall through to reject message */ 2453 /* Fall through to reject message */
2403 2454
2404 /* 2455 /*
2405 * If we get something weird that we aren't expecting, 2456 * If we get something weird that we aren't expecting,
2406 * reject it. 2457 * reject it.
2407 */ 2458 */
2408 default: 2459 default:
2409 if (!tmp) { 2460 if (!tmp) {
2410 printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO); 2461 printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO);
2411 spi_print_msg(extended_msg); 2462 spi_print_msg(extended_msg);
2412 printk("\n"); 2463 printk("\n");
2413 } else if (tmp != EXTENDED_MESSAGE) 2464 } else if (tmp != EXTENDED_MESSAGE)
2414 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2465 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2415 "message %02x from target %d, lun %d\n", 2466 "message %02x from target %d, lun %d\n",
2416 HOSTNO, tmp, cmd->device->id, cmd->device->lun); 2467 HOSTNO, tmp, cmd->device->id, cmd->device->lun);
2417 else 2468 else
2418 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2469 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2419 "extended message " 2470 "extended message "
2420 "code %02x, length %d from target %d, lun %d\n", 2471 "code %02x, length %d from target %d, lun %d\n",
2421 HOSTNO, extended_msg[1], extended_msg[0], 2472 HOSTNO, extended_msg[1], extended_msg[0],
2422 cmd->device->id, cmd->device->lun); 2473 cmd->device->id, cmd->device->lun);
2423 2474
2424 2475
2425 msgout = MESSAGE_REJECT; 2476 msgout = MESSAGE_REJECT;
2426 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 2477 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
2427 ICR_ASSERT_ATN); 2478 break;
2428 break; 2479 } /* switch (tmp) */
2429 } /* switch (tmp) */ 2480 break;
2430 break; 2481 case PHASE_MSGOUT:
2431 case PHASE_MSGOUT: 2482 len = 1;
2432 len = 1; 2483 data = &msgout;
2433 data = &msgout; 2484 hostdata->last_message = msgout;
2434 hostdata->last_message = msgout; 2485 NCR5380_transfer_pio(instance, &phase, &len, &data);
2435 NCR5380_transfer_pio(instance, &phase, &len, &data); 2486 if (msgout == ABORT) {
2436 if (msgout == ABORT) {
2437#ifdef SUPPORT_TAGS 2487#ifdef SUPPORT_TAGS
2438 cmd_free_tag( cmd ); 2488 cmd_free_tag(cmd);
2439#else 2489#else
2440 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2490 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
2441#endif 2491#endif
2442 hostdata->connected = NULL; 2492 hostdata->connected = NULL;
2443 cmd->result = DID_ERROR << 16; 2493 cmd->result = DID_ERROR << 16;
2444#ifdef NCR5380_STATS 2494#ifdef NCR5380_STATS
2445 collect_stats(hostdata, cmd); 2495 collect_stats(hostdata, cmd);
2446#endif 2496#endif
2447 cmd->scsi_done(cmd); 2497 cmd->scsi_done(cmd);
2448 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 2498 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
2449 falcon_release_lock_if_possible( hostdata ); 2499 falcon_release_lock_if_possible(hostdata);
2450 return; 2500 return;
2451 } 2501 }
2452 msgout = NOP; 2502 msgout = NOP;
2453 break; 2503 break;
2454 case PHASE_CMDOUT: 2504 case PHASE_CMDOUT:
2455 len = cmd->cmd_len; 2505 len = cmd->cmd_len;
2456 data = cmd->cmnd; 2506 data = cmd->cmnd;
2457 /* 2507 /*
2458 * XXX for performance reasons, on machines with a 2508 * XXX for performance reasons, on machines with a
2459 * PSEUDO-DMA architecture we should probably 2509 * PSEUDO-DMA architecture we should probably
2460 * use the dma transfer function. 2510 * use the dma transfer function.
2461 */ 2511 */
2462 NCR5380_transfer_pio(instance, &phase, &len, 2512 NCR5380_transfer_pio(instance, &phase, &len, &data);
2463 &data); 2513 break;
2464 break; 2514 case PHASE_STATIN:
2465 case PHASE_STATIN: 2515 len = 1;
2466 len = 1; 2516 data = &tmp;
2467 data = &tmp; 2517 NCR5380_transfer_pio(instance, &phase, &len, &data);
2468 NCR5380_transfer_pio(instance, &phase, &len, &data); 2518 cmd->SCp.Status = tmp;
2469 cmd->SCp.Status = tmp; 2519 break;
2470 break; 2520 default:
2471 default: 2521 printk("scsi%d: unknown phase\n", HOSTNO);
2472 printk("scsi%d: unknown phase\n", HOSTNO); 2522 NCR_PRINT(NDEBUG_ANY);
2473 NCR_PRINT(NDEBUG_ANY); 2523 } /* switch(phase) */
2474 } /* switch(phase) */ 2524 } /* if (tmp * SR_REQ) */
2475 } /* if (tmp * SR_REQ) */ 2525 } /* while (1) */
2476 } /* while (1) */
2477} 2526}
2478 2527
2479/* 2528/*
2480 * Function : void NCR5380_reselect (struct Scsi_Host *instance) 2529 * Function : void NCR5380_reselect (struct Scsi_Host *instance)
2481 * 2530 *
2482 * Purpose : does reselection, initializing the instance->connected 2531 * Purpose : does reselection, initializing the instance->connected
2483 * field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q 2532 * field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q
2484 * nexus has been reestablished, 2533 * nexus has been reestablished,
2485 * 2534 *
2486 * Inputs : instance - this instance of the NCR5380. 2535 * Inputs : instance - this instance of the NCR5380.
2487 * 2536 *
2488 */ 2537 */
2489 2538
2490 2539
2491static void NCR5380_reselect (struct Scsi_Host *instance) 2540static void NCR5380_reselect(struct Scsi_Host *instance)
2492{ 2541{
2493 SETUP_HOSTDATA(instance); 2542 SETUP_HOSTDATA(instance);
2494 unsigned char target_mask; 2543 unsigned char target_mask;
2495 unsigned char lun, phase; 2544 unsigned char lun, phase;
2496 int len; 2545 int len;
2497#ifdef SUPPORT_TAGS 2546#ifdef SUPPORT_TAGS
2498 unsigned char tag; 2547 unsigned char tag;
2499#endif 2548#endif
2500 unsigned char msg[3]; 2549 unsigned char msg[3];
2501 unsigned char *data; 2550 unsigned char *data;
2502 Scsi_Cmnd *tmp = NULL, *prev; 2551 Scsi_Cmnd *tmp = NULL, *prev;
2503/* unsigned long flags; */ 2552/* unsigned long flags; */
2504 2553
2505 /* 2554 /*
2506 * Disable arbitration, etc. since the host adapter obviously 2555 * Disable arbitration, etc. since the host adapter obviously
2507 * lost, and tell an interrupted NCR5380_select() to restart. 2556 * lost, and tell an interrupted NCR5380_select() to restart.
2508 */ 2557 */
2509 2558
2510 NCR5380_write(MODE_REG, MR_BASE); 2559 NCR5380_write(MODE_REG, MR_BASE);
2511 hostdata->restart_select = 1; 2560 hostdata->restart_select = 1;
2512 2561
2513 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask); 2562 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
2514 2563
2515 RSL_PRINTK("scsi%d: reselect\n", HOSTNO); 2564 RSL_PRINTK("scsi%d: reselect\n", HOSTNO);
2516 2565
2517 /* 2566 /*
2518 * At this point, we have detected that our SCSI ID is on the bus, 2567 * At this point, we have detected that our SCSI ID is on the bus,
2519 * SEL is true and BSY was false for at least one bus settle delay 2568 * SEL is true and BSY was false for at least one bus settle delay
2520 * (400 ns). 2569 * (400 ns).
2521 * 2570 *
2522 * We must assert BSY ourselves, until the target drops the SEL 2571 * We must assert BSY ourselves, until the target drops the SEL
2523 * signal. 2572 * signal.
2524 */ 2573 */
2525 2574
2526 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY); 2575 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
2527 2576
2528 while (NCR5380_read(STATUS_REG) & SR_SEL); 2577 while (NCR5380_read(STATUS_REG) & SR_SEL)
2529 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2578 ;
2530 2579 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2531 /* 2580
2532 * Wait for target to go into MSGIN. 2581 /*
2533 */ 2582 * Wait for target to go into MSGIN.
2534 2583 */
2535 while (!(NCR5380_read(STATUS_REG) & SR_REQ)); 2584
2536 2585 while (!(NCR5380_read(STATUS_REG) & SR_REQ))
2537 len = 1; 2586 ;
2538 data = msg; 2587
2539 phase = PHASE_MSGIN; 2588 len = 1;
2540 NCR5380_transfer_pio(instance, &phase, &len, &data); 2589 data = msg;
2541 2590 phase = PHASE_MSGIN;
2542 if (!(msg[0] & 0x80)) { 2591 NCR5380_transfer_pio(instance, &phase, &len, &data);
2543 printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO); 2592
2544 spi_print_msg(msg); 2593 if (!(msg[0] & 0x80)) {
2545 do_abort(instance); 2594 printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
2546 return; 2595 spi_print_msg(msg);
2547 } 2596 do_abort(instance);
2548 lun = (msg[0] & 0x07); 2597 return;
2598 }
2599 lun = (msg[0] & 0x07);
2549 2600
2550#ifdef SUPPORT_TAGS 2601#ifdef SUPPORT_TAGS
2551 /* If the phase is still MSGIN, the target wants to send some more 2602 /* If the phase is still MSGIN, the target wants to send some more
2552 * messages. In case it supports tagged queuing, this is probably a 2603 * messages. In case it supports tagged queuing, this is probably a
2553 * SIMPLE_QUEUE_TAG for the I_T_L_Q nexus. 2604 * SIMPLE_QUEUE_TAG for the I_T_L_Q nexus.
2554 */ 2605 */
2555 tag = TAG_NONE; 2606 tag = TAG_NONE;
2556 if (phase == PHASE_MSGIN && setup_use_tagged_queuing) { 2607 if (phase == PHASE_MSGIN && setup_use_tagged_queuing) {
2557 /* Accept previous IDENTIFY message by clearing ACK */ 2608 /* Accept previous IDENTIFY message by clearing ACK */
2558 NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE ); 2609 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2559 len = 2; 2610 len = 2;
2560 data = msg+1; 2611 data = msg + 1;
2561 if (!NCR5380_transfer_pio(instance, &phase, &len, &data) && 2612 if (!NCR5380_transfer_pio(instance, &phase, &len, &data) &&
2562 msg[1] == SIMPLE_QUEUE_TAG) 2613 msg[1] == SIMPLE_QUEUE_TAG)
2563 tag = msg[2]; 2614 tag = msg[2];
2564 TAG_PRINTK("scsi%d: target mask %02x, lun %d sent tag %d at " 2615 TAG_PRINTK("scsi%d: target mask %02x, lun %d sent tag %d at "
2565 "reselection\n", HOSTNO, target_mask, lun, tag); 2616 "reselection\n", HOSTNO, target_mask, lun, tag);
2566 } 2617 }
2567#endif 2618#endif
2568 2619
2569 /* 2620 /*
2570 * Find the command corresponding to the I_T_L or I_T_L_Q nexus we 2621 * Find the command corresponding to the I_T_L or I_T_L_Q nexus we
2571 * just reestablished, and remove it from the disconnected queue. 2622 * just reestablished, and remove it from the disconnected queue.
2572 */ 2623 */
2573 2624
2574 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; 2625 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL;
2575 tmp; prev = tmp, tmp = NEXT(tmp) ) { 2626 tmp; prev = tmp, tmp = NEXT(tmp)) {
2576 if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) 2627 if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
2577#ifdef SUPPORT_TAGS 2628#ifdef SUPPORT_TAGS
2578 && (tag == tmp->tag) 2629 && (tag == tmp->tag)
2579#endif 2630#endif
2580 ) { 2631 ) {
2581 /* ++guenther: prevent race with falcon_release_lock */ 2632 /* ++guenther: prevent race with falcon_release_lock */
2582 falcon_dont_release++; 2633 falcon_dont_release++;
2583 if (prev) { 2634 if (prev) {
2584 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); 2635 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
2585 NEXT(prev) = NEXT(tmp); 2636 SET_NEXT(prev, NEXT(tmp));
2586 } else { 2637 } else {
2587 REMOVE(-1, hostdata->disconnected_queue, tmp, NEXT(tmp)); 2638 REMOVE(-1, hostdata->disconnected_queue, tmp, NEXT(tmp));
2588 hostdata->disconnected_queue = NEXT(tmp); 2639 hostdata->disconnected_queue = NEXT(tmp);
2589 } 2640 }
2590 NEXT(tmp) = NULL; 2641 SET_NEXT(tmp, NULL);
2591 break; 2642 break;
2643 }
2592 } 2644 }
2593 } 2645
2594 2646 if (!tmp) {
2595 if (!tmp) { 2647 printk(KERN_WARNING "scsi%d: warning: target bitmask %02x lun %d "
2596 printk(KERN_WARNING "scsi%d: warning: target bitmask %02x lun %d "
2597#ifdef SUPPORT_TAGS 2648#ifdef SUPPORT_TAGS
2598 "tag %d " 2649 "tag %d "
2599#endif 2650#endif
2600 "not in disconnected_queue.\n", 2651 "not in disconnected_queue.\n",
2601 HOSTNO, target_mask, lun 2652 HOSTNO, target_mask, lun
2602#ifdef SUPPORT_TAGS 2653#ifdef SUPPORT_TAGS
2603 , tag 2654 , tag
2604#endif 2655#endif
2605 ); 2656 );
2606 /* 2657 /*
2607 * Since we have an established nexus that we can't do anything 2658 * Since we have an established nexus that we can't do anything
2608 * with, we must abort it. 2659 * with, we must abort it.
2609 */ 2660 */
2610 do_abort(instance); 2661 do_abort(instance);
2611 return; 2662 return;
2612 } 2663 }
2613 2664
2614 /* Accept message by clearing ACK */ 2665 /* Accept message by clearing ACK */
2615 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2666 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2616 2667
2617 hostdata->connected = tmp; 2668 hostdata->connected = tmp;
2618 RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n", 2669 RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
2619 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag); 2670 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
2620 falcon_dont_release--; 2671 falcon_dont_release--;
2621} 2672}
2622 2673
2623 2674
@@ -2626,362 +2677,361 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2626 * 2677 *
2627 * Purpose : abort a command 2678 * Purpose : abort a command
2628 * 2679 *
2629 * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the 2680 * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
2630 * host byte of the result field to, if zero DID_ABORTED is 2681 * host byte of the result field to, if zero DID_ABORTED is
2631 * used. 2682 * used.
2632 * 2683 *
2633 * Returns : 0 - success, -1 on failure. 2684 * Returns : 0 - success, -1 on failure.
2634 * 2685 *
2635 * XXX - there is no way to abort the command that is currently 2686 * XXX - there is no way to abort the command that is currently
2636 * connected, you have to wait for it to complete. If this is 2687 * connected, you have to wait for it to complete. If this is
2637 * a problem, we could implement longjmp() / setjmp(), setjmp() 2688 * a problem, we could implement longjmp() / setjmp(), setjmp()
2638 * called where the loop started in NCR5380_main(). 2689 * called where the loop started in NCR5380_main().
2639 */ 2690 */
2640 2691
2641static 2692static
2642int NCR5380_abort (Scsi_Cmnd *cmd) 2693int NCR5380_abort(Scsi_Cmnd *cmd)
2643{ 2694{
2644 struct Scsi_Host *instance = cmd->device->host; 2695 struct Scsi_Host *instance = cmd->device->host;
2645 SETUP_HOSTDATA(instance); 2696 SETUP_HOSTDATA(instance);
2646 Scsi_Cmnd *tmp, **prev; 2697 Scsi_Cmnd *tmp, **prev;
2647 unsigned long flags; 2698 unsigned long flags;
2699
2700 printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
2701 scsi_print_command(cmd);
2648 2702
2649 printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); 2703 NCR5380_print_status(instance);
2650 scsi_print_command(cmd);
2651 2704
2652 NCR5380_print_status (instance); 2705 local_irq_save(flags);
2653 2706
2654 local_irq_save(flags); 2707 if (!IS_A_TT() && !falcon_got_lock)
2655 2708 printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n",
2656 if (!IS_A_TT() && !falcon_got_lock) 2709 HOSTNO);
2657 printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n",
2658 HOSTNO);
2659 2710
2660 ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO, 2711 ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
2661 NCR5380_read(BUS_AND_STATUS_REG), 2712 NCR5380_read(BUS_AND_STATUS_REG),
2662 NCR5380_read(STATUS_REG)); 2713 NCR5380_read(STATUS_REG));
2663 2714
2664#if 1 2715#if 1
2665/* 2716 /*
2666 * Case 1 : If the command is the currently executing command, 2717 * Case 1 : If the command is the currently executing command,
2667 * we'll set the aborted flag and return control so that 2718 * we'll set the aborted flag and return control so that
2668 * information transfer routine can exit cleanly. 2719 * information transfer routine can exit cleanly.
2669 */ 2720 */
2670 2721
2671 if (hostdata->connected == cmd) { 2722 if (hostdata->connected == cmd) {
2672 2723
2673 ABRT_PRINTK("scsi%d: aborting connected command\n", HOSTNO); 2724 ABRT_PRINTK("scsi%d: aborting connected command\n", HOSTNO);
2674/* 2725 /*
2675 * We should perform BSY checking, and make sure we haven't slipped 2726 * We should perform BSY checking, and make sure we haven't slipped
2676 * into BUS FREE. 2727 * into BUS FREE.
2677 */ 2728 */
2678 2729
2679/* NCR5380_write(INITIATOR_COMMAND_REG, ICR_ASSERT_ATN); */ 2730 /* NCR5380_write(INITIATOR_COMMAND_REG, ICR_ASSERT_ATN); */
2680/* 2731 /*
2681 * Since we can't change phases until we've completed the current 2732 * Since we can't change phases until we've completed the current
2682 * handshake, we have to source or sink a byte of data if the current 2733 * handshake, we have to source or sink a byte of data if the current
2683 * phase is not MSGOUT. 2734 * phase is not MSGOUT.
2684 */ 2735 */
2685 2736
2686/* 2737 /*
2687 * Return control to the executing NCR drive so we can clear the 2738 * Return control to the executing NCR drive so we can clear the
2688 * aborted flag and get back into our main loop. 2739 * aborted flag and get back into our main loop.
2689 */ 2740 */
2690 2741
2691 if (do_abort(instance) == 0) { 2742 if (do_abort(instance) == 0) {
2692 hostdata->aborted = 1; 2743 hostdata->aborted = 1;
2693 hostdata->connected = NULL; 2744 hostdata->connected = NULL;
2694 cmd->result = DID_ABORT << 16; 2745 cmd->result = DID_ABORT << 16;
2695#ifdef SUPPORT_TAGS 2746#ifdef SUPPORT_TAGS
2696 cmd_free_tag( cmd ); 2747 cmd_free_tag(cmd);
2697#else 2748#else
2698 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2749 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
2699#endif 2750#endif
2700 local_irq_restore(flags); 2751 local_irq_restore(flags);
2701 cmd->scsi_done(cmd); 2752 cmd->scsi_done(cmd);
2702 falcon_release_lock_if_possible( hostdata ); 2753 falcon_release_lock_if_possible(hostdata);
2703 return SCSI_ABORT_SUCCESS; 2754 return SCSI_ABORT_SUCCESS;
2704 } else { 2755 } else {
2705/* local_irq_restore(flags); */ 2756/* local_irq_restore(flags); */
2706 printk("scsi%d: abort of connected command failed!\n", HOSTNO); 2757 printk("scsi%d: abort of connected command failed!\n", HOSTNO);
2707 return SCSI_ABORT_ERROR; 2758 return SCSI_ABORT_ERROR;
2708 } 2759 }
2709 } 2760 }
2710#endif 2761#endif
2711 2762
2712/* 2763 /*
2713 * Case 2 : If the command hasn't been issued yet, we simply remove it 2764 * Case 2 : If the command hasn't been issued yet, we simply remove it
2714 * from the issue queue. 2765 * from the issue queue.
2715 */ 2766 */
2716 for (prev = (Scsi_Cmnd **) &(hostdata->issue_queue), 2767 for (prev = (Scsi_Cmnd **)&(hostdata->issue_queue),
2717 tmp = (Scsi_Cmnd *) hostdata->issue_queue; 2768 tmp = (Scsi_Cmnd *)hostdata->issue_queue;
2718 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) 2769 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp)) {
2719 if (cmd == tmp) { 2770 if (cmd == tmp) {
2720 REMOVE(5, *prev, tmp, NEXT(tmp)); 2771 REMOVE(5, *prev, tmp, NEXT(tmp));
2721 (*prev) = NEXT(tmp); 2772 (*prev) = NEXT(tmp);
2722 NEXT(tmp) = NULL; 2773 SET_NEXT(tmp, NULL);
2723 tmp->result = DID_ABORT << 16; 2774 tmp->result = DID_ABORT << 16;
2724 local_irq_restore(flags); 2775 local_irq_restore(flags);
2725 ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n", 2776 ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
2726 HOSTNO); 2777 HOSTNO);
2727 /* Tagged queuing note: no tag to free here, hasn't been assigned 2778 /* Tagged queuing note: no tag to free here, hasn't been assigned
2728 * yet... */ 2779 * yet... */
2729 tmp->scsi_done(tmp); 2780 tmp->scsi_done(tmp);
2730 falcon_release_lock_if_possible( hostdata ); 2781 falcon_release_lock_if_possible(hostdata);
2731 return SCSI_ABORT_SUCCESS; 2782 return SCSI_ABORT_SUCCESS;
2783 }
2732 } 2784 }
2733 2785
2734/* 2786 /*
2735 * Case 3 : If any commands are connected, we're going to fail the abort 2787 * Case 3 : If any commands are connected, we're going to fail the abort
2736 * and let the high level SCSI driver retry at a later time or 2788 * and let the high level SCSI driver retry at a later time or
2737 * issue a reset. 2789 * issue a reset.
2738 * 2790 *
2739 * Timeouts, and therefore aborted commands, will be highly unlikely 2791 * Timeouts, and therefore aborted commands, will be highly unlikely
2740 * and handling them cleanly in this situation would make the common 2792 * and handling them cleanly in this situation would make the common
2741 * case of noresets less efficient, and would pollute our code. So, 2793 * case of noresets less efficient, and would pollute our code. So,
2742 * we fail. 2794 * we fail.
2743 */ 2795 */
2744 2796
2745 if (hostdata->connected) { 2797 if (hostdata->connected) {
2746 local_irq_restore(flags); 2798 local_irq_restore(flags);
2747 ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO); 2799 ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
2748 return SCSI_ABORT_SNOOZE; 2800 return SCSI_ABORT_SNOOZE;
2749 } 2801 }
2750 2802
2751/* 2803 /*
2752 * Case 4: If the command is currently disconnected from the bus, and 2804 * Case 4: If the command is currently disconnected from the bus, and
2753 * there are no connected commands, we reconnect the I_T_L or 2805 * there are no connected commands, we reconnect the I_T_L or
2754 * I_T_L_Q nexus associated with it, go into message out, and send 2806 * I_T_L_Q nexus associated with it, go into message out, and send
2755 * an abort message. 2807 * an abort message.
2756 * 2808 *
2757 * This case is especially ugly. In order to reestablish the nexus, we 2809 * This case is especially ugly. In order to reestablish the nexus, we
2758 * need to call NCR5380_select(). The easiest way to implement this 2810 * need to call NCR5380_select(). The easiest way to implement this
2759 * function was to abort if the bus was busy, and let the interrupt 2811 * function was to abort if the bus was busy, and let the interrupt
2760 * handler triggered on the SEL for reselect take care of lost arbitrations 2812 * handler triggered on the SEL for reselect take care of lost arbitrations
2761 * where necessary, meaning interrupts need to be enabled. 2813 * where necessary, meaning interrupts need to be enabled.
2762 * 2814 *
2763 * When interrupts are enabled, the queues may change - so we 2815 * When interrupts are enabled, the queues may change - so we
2764 * can't remove it from the disconnected queue before selecting it 2816 * can't remove it from the disconnected queue before selecting it
2765 * because that could cause a failure in hashing the nexus if that 2817 * because that could cause a failure in hashing the nexus if that
2766 * device reselected. 2818 * device reselected.
2767 * 2819 *
2768 * Since the queues may change, we can't use the pointers from when we 2820 * Since the queues may change, we can't use the pointers from when we
2769 * first locate it. 2821 * first locate it.
2770 * 2822 *
2771 * So, we must first locate the command, and if NCR5380_select() 2823 * So, we must first locate the command, and if NCR5380_select()
2772 * succeeds, then issue the abort, relocate the command and remove 2824 * succeeds, then issue the abort, relocate the command and remove
2773 * it from the disconnected queue. 2825 * it from the disconnected queue.
2774 */ 2826 */
2827
2828 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;
2829 tmp = NEXT(tmp)) {
2830 if (cmd == tmp) {
2831 local_irq_restore(flags);
2832 ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
2775 2833
2776 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; 2834 if (NCR5380_select(instance, cmd, (int)cmd->tag))
2777 tmp = NEXT(tmp)) 2835 return SCSI_ABORT_BUSY;
2778 if (cmd == tmp) { 2836
2779 local_irq_restore(flags); 2837 ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
2780 ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO); 2838
2781 2839 do_abort(instance);
2782 if (NCR5380_select (instance, cmd, (int) cmd->tag)) 2840
2783 return SCSI_ABORT_BUSY; 2841 local_irq_save(flags);
2784 2842 for (prev = (Scsi_Cmnd **)&(hostdata->disconnected_queue),
2785 ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO); 2843 tmp = (Scsi_Cmnd *)hostdata->disconnected_queue;
2786 2844 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp)) {
2787 do_abort (instance); 2845 if (cmd == tmp) {
2788 2846 REMOVE(5, *prev, tmp, NEXT(tmp));
2789 local_irq_save(flags); 2847 *prev = NEXT(tmp);
2790 for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), 2848 SET_NEXT(tmp, NULL);
2791 tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; 2849 tmp->result = DID_ABORT << 16;
2792 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) 2850 /* We must unlock the tag/LUN immediately here, since the
2793 if (cmd == tmp) { 2851 * target goes to BUS FREE and doesn't send us another
2794 REMOVE(5, *prev, tmp, NEXT(tmp)); 2852 * message (COMMAND_COMPLETE or the like)
2795 *prev = NEXT(tmp); 2853 */
2796 NEXT(tmp) = NULL;
2797 tmp->result = DID_ABORT << 16;
2798 /* We must unlock the tag/LUN immediately here, since the
2799 * target goes to BUS FREE and doesn't send us another
2800 * message (COMMAND_COMPLETE or the like)
2801 */
2802#ifdef SUPPORT_TAGS 2854#ifdef SUPPORT_TAGS
2803 cmd_free_tag( tmp ); 2855 cmd_free_tag(tmp);
2804#else 2856#else
2805 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2857 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
2806#endif 2858#endif
2807 local_irq_restore(flags); 2859 local_irq_restore(flags);
2808 tmp->scsi_done(tmp); 2860 tmp->scsi_done(tmp);
2809 falcon_release_lock_if_possible( hostdata ); 2861 falcon_release_lock_if_possible(hostdata);
2810 return SCSI_ABORT_SUCCESS; 2862 return SCSI_ABORT_SUCCESS;
2863 }
2864 }
2811 } 2865 }
2812 } 2866 }
2813 2867
2814/* 2868 /*
2815 * Case 5 : If we reached this point, the command was not found in any of 2869 * Case 5 : If we reached this point, the command was not found in any of
2816 * the queues. 2870 * the queues.
2817 * 2871 *
2818 * We probably reached this point because of an unlikely race condition 2872 * We probably reached this point because of an unlikely race condition
2819 * between the command completing successfully and the abortion code, 2873 * between the command completing successfully and the abortion code,
2820 * so we won't panic, but we will notify the user in case something really 2874 * so we won't panic, but we will notify the user in case something really
2821 * broke. 2875 * broke.
2822 */ 2876 */
2823 2877
2824 local_irq_restore(flags); 2878 local_irq_restore(flags);
2825 printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" 2879 printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n"
2826 KERN_INFO " before abortion\n", HOSTNO); 2880 KERN_INFO " before abortion\n", HOSTNO);
2827 2881
2828/* Maybe it is sufficient just to release the ST-DMA lock... (if 2882 /* Maybe it is sufficient just to release the ST-DMA lock... (if
2829 * possible at all) At least, we should check if the lock could be 2883 * possible at all) At least, we should check if the lock could be
2830 * released after the abort, in case it is kept due to some bug. 2884 * released after the abort, in case it is kept due to some bug.
2831 */ 2885 */
2832 falcon_release_lock_if_possible( hostdata ); 2886 falcon_release_lock_if_possible(hostdata);
2833 2887
2834 return SCSI_ABORT_NOT_RUNNING; 2888 return SCSI_ABORT_NOT_RUNNING;
2835} 2889}
2836 2890
2837 2891
2838/* 2892/*
2839 * Function : int NCR5380_reset (Scsi_Cmnd *cmd) 2893 * Function : int NCR5380_reset (Scsi_Cmnd *cmd)
2840 * 2894 *
2841 * Purpose : reset the SCSI bus. 2895 * Purpose : reset the SCSI bus.
2842 * 2896 *
2843 * Returns : SCSI_RESET_WAKEUP 2897 * Returns : SCSI_RESET_WAKEUP
2844 * 2898 *
2845 */ 2899 */
2846 2900
2847static int NCR5380_bus_reset( Scsi_Cmnd *cmd) 2901static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
2848{ 2902{
2849 SETUP_HOSTDATA(cmd->device->host); 2903 SETUP_HOSTDATA(cmd->device->host);
2850 int i; 2904 int i;
2851 unsigned long flags; 2905 unsigned long flags;
2852#if 1 2906#if 1
2853 Scsi_Cmnd *connected, *disconnected_queue; 2907 Scsi_Cmnd *connected, *disconnected_queue;
2854#endif 2908#endif
2855 2909
2856 if (!IS_A_TT() && !falcon_got_lock) 2910 if (!IS_A_TT() && !falcon_got_lock)
2857 printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_reset\n", 2911 printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_reset\n",
2858 H_NO(cmd) ); 2912 H_NO(cmd));
2859 2913
2860 NCR5380_print_status (cmd->device->host); 2914 NCR5380_print_status(cmd->device->host);
2861 2915
2862 /* get in phase */ 2916 /* get in phase */
2863 NCR5380_write( TARGET_COMMAND_REG, 2917 NCR5380_write(TARGET_COMMAND_REG,
2864 PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) )); 2918 PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
2865 /* assert RST */ 2919 /* assert RST */
2866 NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST ); 2920 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
2867 udelay (40); 2921 udelay(40);
2868 /* reset NCR registers */ 2922 /* reset NCR registers */
2869 NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE ); 2923 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2870 NCR5380_write( MODE_REG, MR_BASE ); 2924 NCR5380_write(MODE_REG, MR_BASE);
2871 NCR5380_write( TARGET_COMMAND_REG, 0 ); 2925 NCR5380_write(TARGET_COMMAND_REG, 0);
2872 NCR5380_write( SELECT_ENABLE_REG, 0 ); 2926 NCR5380_write(SELECT_ENABLE_REG, 0);
2873 /* ++roman: reset interrupt condition! otherwise no interrupts don't get 2927 /* ++roman: reset interrupt condition! otherwise no interrupts don't get
2874 * through anymore ... */ 2928 * through anymore ... */
2875 (void)NCR5380_read( RESET_PARITY_INTERRUPT_REG ); 2929 (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
2876 2930
2877#if 1 /* XXX Should now be done by midlevel code, but it's broken XXX */ 2931#if 1 /* XXX Should now be done by midlevel code, but it's broken XXX */
2878 /* XXX see below XXX */ 2932 /* XXX see below XXX */
2879 2933
2880 /* MSch: old-style reset: actually abort all command processing here */ 2934 /* MSch: old-style reset: actually abort all command processing here */
2881 2935
2882 /* After the reset, there are no more connected or disconnected commands 2936 /* After the reset, there are no more connected or disconnected commands
2883 * and no busy units; to avoid problems with re-inserting the commands 2937 * and no busy units; to avoid problems with re-inserting the commands
2884 * into the issue_queue (via scsi_done()), the aborted commands are 2938 * into the issue_queue (via scsi_done()), the aborted commands are
2885 * remembered in local variables first. 2939 * remembered in local variables first.
2886 */ 2940 */
2887 local_irq_save(flags); 2941 local_irq_save(flags);
2888 connected = (Scsi_Cmnd *)hostdata->connected; 2942 connected = (Scsi_Cmnd *)hostdata->connected;
2889 hostdata->connected = NULL; 2943 hostdata->connected = NULL;
2890 disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; 2944 disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue;
2891 hostdata->disconnected_queue = NULL; 2945 hostdata->disconnected_queue = NULL;
2892#ifdef SUPPORT_TAGS 2946#ifdef SUPPORT_TAGS
2893 free_all_tags(); 2947 free_all_tags();
2894#endif 2948#endif
2895 for( i = 0; i < 8; ++i ) 2949 for (i = 0; i < 8; ++i)
2896 hostdata->busy[i] = 0; 2950 hostdata->busy[i] = 0;
2897#ifdef REAL_DMA 2951#ifdef REAL_DMA
2898 hostdata->dma_len = 0; 2952 hostdata->dma_len = 0;
2899#endif 2953#endif
2900 local_irq_restore(flags); 2954 local_irq_restore(flags);
2901 2955
2902 /* In order to tell the mid-level code which commands were aborted, 2956 /* In order to tell the mid-level code which commands were aborted,
2903 * set the command status to DID_RESET and call scsi_done() !!! 2957 * set the command status to DID_RESET and call scsi_done() !!!
2904 * This ultimately aborts processing of these commands in the mid-level. 2958 * This ultimately aborts processing of these commands in the mid-level.
2905 */ 2959 */
2906 2960
2907 if ((cmd = connected)) { 2961 if ((cmd = connected)) {
2908 ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd)); 2962 ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
2909 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16); 2963 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
2910 cmd->scsi_done( cmd ); 2964 cmd->scsi_done(cmd);
2911 } 2965 }
2912
2913 for (i = 0; (cmd = disconnected_queue); ++i) {
2914 disconnected_queue = NEXT(cmd);
2915 NEXT(cmd) = NULL;
2916 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
2917 cmd->scsi_done( cmd );
2918 }
2919 if (i > 0)
2920 ABRT_PRINTK("scsi: reset aborted %d disconnected command(s)\n", i);
2921
2922/* The Falcon lock should be released after a reset...
2923 */
2924/* ++guenther: moved to atari_scsi_reset(), to prevent a race between
2925 * unlocking and enabling dma interrupt.
2926 */
2927/* falcon_release_lock_if_possible( hostdata );*/
2928 2966
2929 /* since all commands have been explicitly terminated, we need to tell 2967 for (i = 0; (cmd = disconnected_queue); ++i) {
2930 * the midlevel code that the reset was SUCCESSFUL, and there is no 2968 disconnected_queue = NEXT(cmd);
2931 * need to 'wake up' the commands by a request_sense 2969 SET_NEXT(cmd, NULL);
2932 */ 2970 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
2933 return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET; 2971 cmd->scsi_done(cmd);
2972 }
2973 if (i > 0)
2974 ABRT_PRINTK("scsi: reset aborted %d disconnected command(s)\n", i);
2975
2976 /* The Falcon lock should be released after a reset...
2977 */
2978 /* ++guenther: moved to atari_scsi_reset(), to prevent a race between
2979 * unlocking and enabling dma interrupt.
2980 */
2981/* falcon_release_lock_if_possible( hostdata );*/
2982
2983 /* since all commands have been explicitly terminated, we need to tell
2984 * the midlevel code that the reset was SUCCESSFUL, and there is no
2985 * need to 'wake up' the commands by a request_sense
2986 */
2987 return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
2934#else /* 1 */ 2988#else /* 1 */
2935 2989
2936 /* MSch: new-style reset handling: let the mid-level do what it can */ 2990 /* MSch: new-style reset handling: let the mid-level do what it can */
2937 2991
2938 /* ++guenther: MID-LEVEL IS STILL BROKEN. 2992 /* ++guenther: MID-LEVEL IS STILL BROKEN.
2939 * Mid-level is supposed to requeue all commands that were active on the 2993 * Mid-level is supposed to requeue all commands that were active on the
2940 * various low-level queues. In fact it does this, but that's not enough 2994 * various low-level queues. In fact it does this, but that's not enough
2941 * because all these commands are subject to timeout. And if a timeout 2995 * because all these commands are subject to timeout. And if a timeout
2942 * happens for any removed command, *_abort() is called but all queues 2996 * happens for any removed command, *_abort() is called but all queues
2943 * are now empty. Abort then gives up the falcon lock, which is fatal, 2997 * are now empty. Abort then gives up the falcon lock, which is fatal,
2944 * since the mid-level will queue more commands and must have the lock 2998 * since the mid-level will queue more commands and must have the lock
2945 * (it's all happening inside timer interrupt handler!!). 2999 * (it's all happening inside timer interrupt handler!!).
2946 * Even worse, abort will return NOT_RUNNING for all those commands not 3000 * Even worse, abort will return NOT_RUNNING for all those commands not
2947 * on any queue, so they won't be retried ... 3001 * on any queue, so they won't be retried ...
2948 * 3002 *
2949 * Conclusion: either scsi.c disables timeout for all resetted commands 3003 * Conclusion: either scsi.c disables timeout for all resetted commands
2950 * immediately, or we lose! As of linux-2.0.20 it doesn't. 3004 * immediately, or we lose! As of linux-2.0.20 it doesn't.
2951 */ 3005 */
2952 3006
2953 /* After the reset, there are no more connected or disconnected commands 3007 /* After the reset, there are no more connected or disconnected commands
2954 * and no busy units; so clear the low-level status here to avoid 3008 * and no busy units; so clear the low-level status here to avoid
2955 * conflicts when the mid-level code tries to wake up the affected 3009 * conflicts when the mid-level code tries to wake up the affected
2956 * commands! 3010 * commands!
2957 */ 3011 */
2958 3012
2959 if (hostdata->issue_queue) 3013 if (hostdata->issue_queue)
2960 ABRT_PRINTK("scsi%d: reset aborted issued command(s)\n", H_NO(cmd)); 3014 ABRT_PRINTK("scsi%d: reset aborted issued command(s)\n", H_NO(cmd));
2961 if (hostdata->connected) 3015 if (hostdata->connected)
2962 ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd)); 3016 ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
2963 if (hostdata->disconnected_queue) 3017 if (hostdata->disconnected_queue)
2964 ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); 3018 ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
2965 3019
2966 local_irq_save(flags); 3020 local_irq_save(flags);
2967 hostdata->issue_queue = NULL; 3021 hostdata->issue_queue = NULL;
2968 hostdata->connected = NULL; 3022 hostdata->connected = NULL;
2969 hostdata->disconnected_queue = NULL; 3023 hostdata->disconnected_queue = NULL;
2970#ifdef SUPPORT_TAGS 3024#ifdef SUPPORT_TAGS
2971 free_all_tags(); 3025 free_all_tags();
2972#endif 3026#endif
2973 for( i = 0; i < 8; ++i ) 3027 for (i = 0; i < 8; ++i)
2974 hostdata->busy[i] = 0; 3028 hostdata->busy[i] = 0;
2975#ifdef REAL_DMA 3029#ifdef REAL_DMA
2976 hostdata->dma_len = 0; 3030 hostdata->dma_len = 0;
2977#endif 3031#endif
2978 local_irq_restore(flags); 3032 local_irq_restore(flags);
2979 3033
2980 /* we did no complete reset of all commands, so a wakeup is required */ 3034 /* we did no complete reset of all commands, so a wakeup is required */
2981 return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET; 3035 return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
2982#endif /* 1 */ 3036#endif /* 1 */
2983} 3037}
2984
2985/* Local Variables: */
2986/* tab-width: 8 */
2987/* End: */
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 642de7b2b7a2..6f8403b82ba1 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -69,9 +69,9 @@
69 69
70#define NDEBUG (0) 70#define NDEBUG (0)
71 71
72#define NDEBUG_ABORT 0x800000 72#define NDEBUG_ABORT 0x00100000
73#define NDEBUG_TAGS 0x1000000 73#define NDEBUG_TAGS 0x00200000
74#define NDEBUG_MERGING 0x2000000 74#define NDEBUG_MERGING 0x00400000
75 75
76#define AUTOSENSE 76#define AUTOSENSE
77/* For the Atari version, use only polled IO or REAL_DMA */ 77/* For the Atari version, use only polled IO or REAL_DMA */
@@ -186,38 +186,37 @@ static inline void DISABLE_IRQ(void)
186/***************************** Prototypes *****************************/ 186/***************************** Prototypes *****************************/
187 187
188#ifdef REAL_DMA 188#ifdef REAL_DMA
189static int scsi_dma_is_ignored_buserr( unsigned char dma_stat ); 189static int scsi_dma_is_ignored_buserr(unsigned char dma_stat);
190static void atari_scsi_fetch_restbytes( void ); 190static void atari_scsi_fetch_restbytes(void);
191static long atari_scsi_dma_residual( struct Scsi_Host *instance ); 191static long atari_scsi_dma_residual(struct Scsi_Host *instance);
192static int falcon_classify_cmd( Scsi_Cmnd *cmd ); 192static int falcon_classify_cmd(Scsi_Cmnd *cmd);
193static unsigned long atari_dma_xfer_len( unsigned long wanted_len, 193static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
194 Scsi_Cmnd *cmd, int write_flag ); 194 Scsi_Cmnd *cmd, int write_flag);
195#endif 195#endif
196static irqreturn_t scsi_tt_intr( int irq, void *dummy); 196static irqreturn_t scsi_tt_intr(int irq, void *dummy);
197static irqreturn_t scsi_falcon_intr( int irq, void *dummy); 197static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
198static void falcon_release_lock_if_possible( struct NCR5380_hostdata * 198static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata);
199 hostdata ); 199static void falcon_get_lock(void);
200static void falcon_get_lock( void );
201#ifdef CONFIG_ATARI_SCSI_RESET_BOOT 200#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
202static void atari_scsi_reset_boot( void ); 201static void atari_scsi_reset_boot(void);
203#endif 202#endif
204static unsigned char atari_scsi_tt_reg_read( unsigned char reg ); 203static unsigned char atari_scsi_tt_reg_read(unsigned char reg);
205static void atari_scsi_tt_reg_write( unsigned char reg, unsigned char value); 204static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value);
206static unsigned char atari_scsi_falcon_reg_read( unsigned char reg ); 205static unsigned char atari_scsi_falcon_reg_read(unsigned char reg);
207static void atari_scsi_falcon_reg_write( unsigned char reg, unsigned char value ); 206static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value);
208 207
209/************************* End of Prototypes **************************/ 208/************************* End of Prototypes **************************/
210 209
211 210
212static struct Scsi_Host *atari_scsi_host = NULL; 211static struct Scsi_Host *atari_scsi_host;
213static unsigned char (*atari_scsi_reg_read)( unsigned char reg ); 212static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
214static void (*atari_scsi_reg_write)( unsigned char reg, unsigned char value ); 213static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
215 214
216#ifdef REAL_DMA 215#ifdef REAL_DMA
217static unsigned long atari_dma_residual, atari_dma_startaddr; 216static unsigned long atari_dma_residual, atari_dma_startaddr;
218static short atari_dma_active; 217static short atari_dma_active;
219/* pointer to the dribble buffer */ 218/* pointer to the dribble buffer */
220static char *atari_dma_buffer = NULL; 219static char *atari_dma_buffer;
221/* precalculated physical address of the dribble buffer */ 220/* precalculated physical address of the dribble buffer */
222static unsigned long atari_dma_phys_buffer; 221static unsigned long atari_dma_phys_buffer;
223/* != 0 tells the Falcon int handler to copy data from the dribble buffer */ 222/* != 0 tells the Falcon int handler to copy data from the dribble buffer */
@@ -233,7 +232,7 @@ static char *atari_dma_orig_addr;
233static unsigned long atari_dma_stram_mask; 232static unsigned long atari_dma_stram_mask;
234#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0) 233#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
235/* number of bytes to cut from a transfer to handle NCR overruns */ 234/* number of bytes to cut from a transfer to handle NCR overruns */
236static int atari_read_overruns = 0; 235static int atari_read_overruns;
237#endif 236#endif
238 237
239static int setup_can_queue = -1; 238static int setup_can_queue = -1;
@@ -256,10 +255,10 @@ module_param(setup_hostid, int, 0);
256 255
257#if defined(REAL_DMA) 256#if defined(REAL_DMA)
258 257
259static int scsi_dma_is_ignored_buserr( unsigned char dma_stat ) 258static int scsi_dma_is_ignored_buserr(unsigned char dma_stat)
260{ 259{
261 int i; 260 int i;
262 unsigned long addr = SCSI_DMA_READ_P( dma_addr ), end_addr; 261 unsigned long addr = SCSI_DMA_READ_P(dma_addr), end_addr;
263 262
264 if (dma_stat & 0x01) { 263 if (dma_stat & 0x01) {
265 264
@@ -267,15 +266,14 @@ static int scsi_dma_is_ignored_buserr( unsigned char dma_stat )
267 * physical memory chunk (DMA prefetch!), but that doesn't hurt. 266 * physical memory chunk (DMA prefetch!), but that doesn't hurt.
268 * Check for this case: 267 * Check for this case:
269 */ 268 */
270 269
271 for( i = 0; i < m68k_num_memory; ++i ) { 270 for (i = 0; i < m68k_num_memory; ++i) {
272 end_addr = m68k_memory[i].addr + 271 end_addr = m68k_memory[i].addr + m68k_memory[i].size;
273 m68k_memory[i].size;
274 if (end_addr <= addr && addr <= end_addr + 4) 272 if (end_addr <= addr && addr <= end_addr + 4)
275 return( 1 ); 273 return 1;
276 } 274 }
277 } 275 }
278 return( 0 ); 276 return 0;
279} 277}
280 278
281 279
@@ -284,28 +282,27 @@ static int scsi_dma_is_ignored_buserr( unsigned char dma_stat )
284 * end-of-DMA, both SCSI ints are triggered simultaneously, so the NCR int has 282 * end-of-DMA, both SCSI ints are triggered simultaneously, so the NCR int has
285 * to clear the DMA int pending bit before it allows other level 6 interrupts. 283 * to clear the DMA int pending bit before it allows other level 6 interrupts.
286 */ 284 */
287static void scsi_dma_buserr (int irq, void *dummy) 285static void scsi_dma_buserr(int irq, void *dummy)
288{ 286{
289 unsigned char dma_stat = tt_scsi_dma.dma_ctrl; 287 unsigned char dma_stat = tt_scsi_dma.dma_ctrl;
290 288
291 /* Don't do anything if a NCR interrupt is pending. Probably it's just 289 /* Don't do anything if a NCR interrupt is pending. Probably it's just
292 * masked... */ 290 * masked... */
293 if (atari_irq_pending( IRQ_TT_MFP_SCSI )) 291 if (atari_irq_pending(IRQ_TT_MFP_SCSI))
294 return; 292 return;
295 293
296 printk("Bad SCSI DMA interrupt! dma_addr=0x%08lx dma_stat=%02x dma_cnt=%08lx\n", 294 printk("Bad SCSI DMA interrupt! dma_addr=0x%08lx dma_stat=%02x dma_cnt=%08lx\n",
297 SCSI_DMA_READ_P(dma_addr), dma_stat, SCSI_DMA_READ_P(dma_cnt)); 295 SCSI_DMA_READ_P(dma_addr), dma_stat, SCSI_DMA_READ_P(dma_cnt));
298 if (dma_stat & 0x80) { 296 if (dma_stat & 0x80) {
299 if (!scsi_dma_is_ignored_buserr( dma_stat )) 297 if (!scsi_dma_is_ignored_buserr(dma_stat))
300 printk( "SCSI DMA bus error -- bad DMA programming!\n" ); 298 printk("SCSI DMA bus error -- bad DMA programming!\n");
301 } 299 } else {
302 else {
303 /* Under normal circumstances we never should get to this point, 300 /* Under normal circumstances we never should get to this point,
304 * since both interrupts are triggered simultaneously and the 5380 301 * since both interrupts are triggered simultaneously and the 5380
305 * int has higher priority. When this irq is handled, that DMA 302 * int has higher priority. When this irq is handled, that DMA
306 * interrupt is cleared. So a warning message is printed here. 303 * interrupt is cleared. So a warning message is printed here.
307 */ 304 */
308 printk( "SCSI DMA intr ?? -- this shouldn't happen!\n" ); 305 printk("SCSI DMA intr ?? -- this shouldn't happen!\n");
309 } 306 }
310} 307}
311#endif 308#endif
@@ -313,7 +310,7 @@ static void scsi_dma_buserr (int irq, void *dummy)
313#endif 310#endif
314 311
315 312
316static irqreturn_t scsi_tt_intr (int irq, void *dummy) 313static irqreturn_t scsi_tt_intr(int irq, void *dummy)
317{ 314{
318#ifdef REAL_DMA 315#ifdef REAL_DMA
319 int dma_stat; 316 int dma_stat;
@@ -327,7 +324,7 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
327 * is that a bus error occurred... 324 * is that a bus error occurred...
328 */ 325 */
329 if (dma_stat & 0x80) { 326 if (dma_stat & 0x80) {
330 if (!scsi_dma_is_ignored_buserr( dma_stat )) { 327 if (!scsi_dma_is_ignored_buserr(dma_stat)) {
331 printk(KERN_ERR "SCSI DMA caused bus error near 0x%08lx\n", 328 printk(KERN_ERR "SCSI DMA caused bus error near 0x%08lx\n",
332 SCSI_DMA_READ_P(dma_addr)); 329 SCSI_DMA_READ_P(dma_addr));
333 printk(KERN_CRIT "SCSI DMA bus error -- bad DMA programming!"); 330 printk(KERN_CRIT "SCSI DMA bus error -- bad DMA programming!");
@@ -344,8 +341,7 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
344 * data reg! 341 * data reg!
345 */ 342 */
346 if ((dma_stat & 0x02) && !(dma_stat & 0x40)) { 343 if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
347 atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P( dma_addr ) - 344 atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P(dma_addr) - atari_dma_startaddr);
348 atari_dma_startaddr);
349 345
350 DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n", 346 DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
351 atari_dma_residual); 347 atari_dma_residual);
@@ -353,28 +349,30 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
353 if ((signed int)atari_dma_residual < 0) 349 if ((signed int)atari_dma_residual < 0)
354 atari_dma_residual = 0; 350 atari_dma_residual = 0;
355 if ((dma_stat & 1) == 0) { 351 if ((dma_stat & 1) == 0) {
356 /* After read operations, we maybe have to 352 /*
357 transport some rest bytes */ 353 * After read operations, we maybe have to
354 * transport some rest bytes
355 */
358 atari_scsi_fetch_restbytes(); 356 atari_scsi_fetch_restbytes();
359 } 357 } else {
360 else { 358 /*
361 /* There seems to be a nasty bug in some SCSI-DMA/NCR 359 * There seems to be a nasty bug in some SCSI-DMA/NCR
362 combinations: If a target disconnects while a write 360 * combinations: If a target disconnects while a write
363 operation is going on, the address register of the 361 * operation is going on, the address register of the
364 DMA may be a few bytes farer than it actually read. 362 * DMA may be a few bytes farer than it actually read.
365 This is probably due to DMA prefetching and a delay 363 * This is probably due to DMA prefetching and a delay
366 between DMA and NCR. Experiments showed that the 364 * between DMA and NCR. Experiments showed that the
367 dma_addr is 9 bytes to high, but this could vary. 365 * dma_addr is 9 bytes to high, but this could vary.
368 The problem is, that the residual is thus calculated 366 * The problem is, that the residual is thus calculated
369 wrong and the next transfer will start behind where 367 * wrong and the next transfer will start behind where
370 it should. So we round up the residual to the next 368 * it should. So we round up the residual to the next
371 multiple of a sector size, if it isn't already a 369 * multiple of a sector size, if it isn't already a
372 multiple and the originally expected transfer size 370 * multiple and the originally expected transfer size
373 was. The latter condition is there to ensure that 371 * was. The latter condition is there to ensure that
374 the correction is taken only for "real" data 372 * the correction is taken only for "real" data
375 transfers and not for, e.g., the parameters of some 373 * transfers and not for, e.g., the parameters of some
376 other command. These shouldn't disconnect anyway. 374 * other command. These shouldn't disconnect anyway.
377 */ 375 */
378 if (atari_dma_residual & 0x1ff) { 376 if (atari_dma_residual & 0x1ff) {
379 DMA_PRINTK("SCSI DMA: DMA bug corrected, " 377 DMA_PRINTK("SCSI DMA: DMA bug corrected, "
380 "difference %ld bytes\n", 378 "difference %ld bytes\n",
@@ -394,18 +392,18 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
394 } 392 }
395 393
396#endif /* REAL_DMA */ 394#endif /* REAL_DMA */
397 395
398 NCR5380_intr (0, 0, 0); 396 NCR5380_intr(0, 0);
399 397
400#if 0 398#if 0
401 /* To be sure the int is not masked */ 399 /* To be sure the int is not masked */
402 atari_enable_irq( IRQ_TT_MFP_SCSI ); 400 atari_enable_irq(IRQ_TT_MFP_SCSI);
403#endif 401#endif
404 return IRQ_HANDLED; 402 return IRQ_HANDLED;
405} 403}
406 404
407 405
408static irqreturn_t scsi_falcon_intr (int irq, void *dummy) 406static irqreturn_t scsi_falcon_intr(int irq, void *dummy)
409{ 407{
410#ifdef REAL_DMA 408#ifdef REAL_DMA
411 int dma_stat; 409 int dma_stat;
@@ -430,7 +428,7 @@ static irqreturn_t scsi_falcon_intr (int irq, void *dummy)
430 * bytes are stuck in the ST-DMA fifo (there's no way to reach them!) 428 * bytes are stuck in the ST-DMA fifo (there's no way to reach them!)
431 */ 429 */
432 if (atari_dma_active && (dma_stat & 0x02)) { 430 if (atari_dma_active && (dma_stat & 0x02)) {
433 unsigned long transferred; 431 unsigned long transferred;
434 432
435 transferred = SCSI_DMA_GETADR() - atari_dma_startaddr; 433 transferred = SCSI_DMA_GETADR() - atari_dma_startaddr;
436 /* The ST-DMA address is incremented in 2-byte steps, but the 434 /* The ST-DMA address is incremented in 2-byte steps, but the
@@ -445,8 +443,7 @@ static irqreturn_t scsi_falcon_intr (int irq, void *dummy)
445 atari_dma_residual = HOSTDATA_DMALEN - transferred; 443 atari_dma_residual = HOSTDATA_DMALEN - transferred;
446 DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n", 444 DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
447 atari_dma_residual); 445 atari_dma_residual);
448 } 446 } else
449 else
450 atari_dma_residual = 0; 447 atari_dma_residual = 0;
451 atari_dma_active = 0; 448 atari_dma_active = 0;
452 449
@@ -461,13 +458,13 @@ static irqreturn_t scsi_falcon_intr (int irq, void *dummy)
461 458
462#endif /* REAL_DMA */ 459#endif /* REAL_DMA */
463 460
464 NCR5380_intr (0, 0, 0); 461 NCR5380_intr(0, 0);
465 return IRQ_HANDLED; 462 return IRQ_HANDLED;
466} 463}
467 464
468 465
469#ifdef REAL_DMA 466#ifdef REAL_DMA
470static void atari_scsi_fetch_restbytes( void ) 467static void atari_scsi_fetch_restbytes(void)
471{ 468{
472 int nr; 469 int nr;
473 char *src, *dst; 470 char *src, *dst;
@@ -505,19 +502,17 @@ static int falcon_dont_release = 0;
505 * again (but others waiting longer more probably will win). 502 * again (but others waiting longer more probably will win).
506 */ 503 */
507 504
508static void 505static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata)
509falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
510{ 506{
511 unsigned long flags; 507 unsigned long flags;
512 508
513 if (IS_A_TT()) return; 509 if (IS_A_TT())
514 510 return;
511
515 local_irq_save(flags); 512 local_irq_save(flags);
516 513
517 if (falcon_got_lock && 514 if (falcon_got_lock && !hostdata->disconnected_queue &&
518 !hostdata->disconnected_queue && 515 !hostdata->issue_queue && !hostdata->connected) {
519 !hostdata->issue_queue &&
520 !hostdata->connected) {
521 516
522 if (falcon_dont_release) { 517 if (falcon_dont_release) {
523#if 0 518#if 0
@@ -528,7 +523,7 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
528 } 523 }
529 falcon_got_lock = 0; 524 falcon_got_lock = 0;
530 stdma_release(); 525 stdma_release();
531 wake_up( &falcon_fairness_wait ); 526 wake_up(&falcon_fairness_wait);
532 } 527 }
533 528
534 local_irq_restore(flags); 529 local_irq_restore(flags);
@@ -549,31 +544,31 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
549 * Complicated, complicated.... Sigh... 544 * Complicated, complicated.... Sigh...
550 */ 545 */
551 546
552static void falcon_get_lock( void ) 547static void falcon_get_lock(void)
553{ 548{
554 unsigned long flags; 549 unsigned long flags;
555 550
556 if (IS_A_TT()) return; 551 if (IS_A_TT())
552 return;
557 553
558 local_irq_save(flags); 554 local_irq_save(flags);
559 555
560 while( !in_interrupt() && falcon_got_lock && stdma_others_waiting() ) 556 while (!in_irq() && falcon_got_lock && stdma_others_waiting())
561 sleep_on( &falcon_fairness_wait ); 557 sleep_on(&falcon_fairness_wait);
562 558
563 while (!falcon_got_lock) { 559 while (!falcon_got_lock) {
564 if (in_interrupt()) 560 if (in_irq())
565 panic( "Falcon SCSI hasn't ST-DMA lock in interrupt" ); 561 panic("Falcon SCSI hasn't ST-DMA lock in interrupt");
566 if (!falcon_trying_lock) { 562 if (!falcon_trying_lock) {
567 falcon_trying_lock = 1; 563 falcon_trying_lock = 1;
568 stdma_lock(scsi_falcon_intr, NULL); 564 stdma_lock(scsi_falcon_intr, NULL);
569 falcon_got_lock = 1; 565 falcon_got_lock = 1;
570 falcon_trying_lock = 0; 566 falcon_trying_lock = 0;
571 wake_up( &falcon_try_wait ); 567 wake_up(&falcon_try_wait);
572 } 568 } else {
573 else { 569 sleep_on(&falcon_try_wait);
574 sleep_on( &falcon_try_wait );
575 } 570 }
576 } 571 }
577 572
578 local_irq_restore(flags); 573 local_irq_restore(flags);
579 if (!falcon_got_lock) 574 if (!falcon_got_lock)
@@ -587,18 +582,18 @@ static void falcon_get_lock( void )
587 */ 582 */
588 583
589#if 0 584#if 0
590int atari_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) 585int atari_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
591{ 586{
592 /* falcon_get_lock(); 587 /* falcon_get_lock();
593 * ++guenther: moved to NCR5380_queue_command() to prevent 588 * ++guenther: moved to NCR5380_queue_command() to prevent
594 * race condition, see there for an explanation. 589 * race condition, see there for an explanation.
595 */ 590 */
596 return( NCR5380_queue_command( cmd, done ) ); 591 return NCR5380_queue_command(cmd, done);
597} 592}
598#endif 593#endif
599 594
600 595
601int atari_scsi_detect (struct scsi_host_template *host) 596int atari_scsi_detect(struct scsi_host_template *host)
602{ 597{
603 static int called = 0; 598 static int called = 0;
604 struct Scsi_Host *instance; 599 struct Scsi_Host *instance;
@@ -606,7 +601,7 @@ int atari_scsi_detect (struct scsi_host_template *host)
606 if (!MACH_IS_ATARI || 601 if (!MACH_IS_ATARI ||
607 (!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) || 602 (!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) ||
608 called) 603 called)
609 return( 0 ); 604 return 0;
610 605
611 host->proc_name = "Atari"; 606 host->proc_name = "Atari";
612 607
@@ -655,32 +650,33 @@ int atari_scsi_detect (struct scsi_host_template *host)
655 !ATARIHW_PRESENT(EXTD_DMA) && m68k_num_memory > 1) { 650 !ATARIHW_PRESENT(EXTD_DMA) && m68k_num_memory > 1) {
656 atari_dma_buffer = atari_stram_alloc(STRAM_BUFFER_SIZE, "SCSI"); 651 atari_dma_buffer = atari_stram_alloc(STRAM_BUFFER_SIZE, "SCSI");
657 if (!atari_dma_buffer) { 652 if (!atari_dma_buffer) {
658 printk( KERN_ERR "atari_scsi_detect: can't allocate ST-RAM " 653 printk(KERN_ERR "atari_scsi_detect: can't allocate ST-RAM "
659 "double buffer\n" ); 654 "double buffer\n");
660 return( 0 ); 655 return 0;
661 } 656 }
662 atari_dma_phys_buffer = virt_to_phys( atari_dma_buffer ); 657 atari_dma_phys_buffer = virt_to_phys(atari_dma_buffer);
663 atari_dma_orig_addr = 0; 658 atari_dma_orig_addr = 0;
664 } 659 }
665#endif 660#endif
666 instance = scsi_register (host, sizeof (struct NCR5380_hostdata)); 661 instance = scsi_register(host, sizeof(struct NCR5380_hostdata));
667 if(instance == NULL) 662 if (instance == NULL) {
668 {
669 atari_stram_free(atari_dma_buffer); 663 atari_stram_free(atari_dma_buffer);
670 atari_dma_buffer = 0; 664 atari_dma_buffer = 0;
671 return 0; 665 return 0;
672 } 666 }
673 atari_scsi_host = instance; 667 atari_scsi_host = instance;
674 /* Set irq to 0, to avoid that the mid-level code disables our interrupt 668 /*
675 * during queue_command calls. This is completely unnecessary, and even 669 * Set irq to 0, to avoid that the mid-level code disables our interrupt
676 * worse causes bad problems on the Falcon, where the int is shared with 670 * during queue_command calls. This is completely unnecessary, and even
677 * IDE and floppy! */ 671 * worse causes bad problems on the Falcon, where the int is shared with
672 * IDE and floppy!
673 */
678 instance->irq = 0; 674 instance->irq = 0;
679 675
680#ifdef CONFIG_ATARI_SCSI_RESET_BOOT 676#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
681 atari_scsi_reset_boot(); 677 atari_scsi_reset_boot();
682#endif 678#endif
683 NCR5380_init (instance, 0); 679 NCR5380_init(instance, 0);
684 680
685 if (IS_A_TT()) { 681 if (IS_A_TT()) {
686 682
@@ -727,11 +723,10 @@ int atari_scsi_detect (struct scsi_host_template *host)
727 * the rest data bug is fixed, this can be lowered to 1. 723 * the rest data bug is fixed, this can be lowered to 1.
728 */ 724 */
729 atari_read_overruns = 4; 725 atari_read_overruns = 4;
730 } 726 }
731#endif /*REAL_DMA*/ 727#endif /*REAL_DMA*/
732 } 728 } else { /* ! IS_A_TT */
733 else { /* ! IS_A_TT */ 729
734
735 /* Nothing to do for the interrupt: the ST-DMA is initialized 730 /* Nothing to do for the interrupt: the ST-DMA is initialized
736 * already by atari_init_INTS() 731 * already by atari_init_INTS()
737 */ 732 */
@@ -756,23 +751,21 @@ int atari_scsi_detect (struct scsi_host_template *host)
756 setup_use_tagged_queuing ? "yes" : "no", 751 setup_use_tagged_queuing ? "yes" : "no",
757#endif 752#endif
758 instance->hostt->this_id ); 753 instance->hostt->this_id );
759 NCR5380_print_options (instance); 754 NCR5380_print_options(instance);
760 printk ("\n"); 755 printk("\n");
761 756
762 called = 1; 757 called = 1;
763 return( 1 ); 758 return 1;
764} 759}
765 760
766#ifdef MODULE 761int atari_scsi_release(struct Scsi_Host *sh)
767int atari_scsi_release (struct Scsi_Host *sh)
768{ 762{
769 if (IS_A_TT()) 763 if (IS_A_TT())
770 free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); 764 free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr);
771 if (atari_dma_buffer) 765 if (atari_dma_buffer)
772 atari_stram_free (atari_dma_buffer); 766 atari_stram_free(atari_dma_buffer);
773 return 1; 767 return 1;
774} 768}
775#endif
776 769
777void __init atari_scsi_setup(char *str, int *ints) 770void __init atari_scsi_setup(char *str, int *ints)
778{ 771{
@@ -781,9 +774,9 @@ void __init atari_scsi_setup(char *str, int *ints)
781 * Defaults depend on TT or Falcon, hostid determined at run time. 774 * Defaults depend on TT or Falcon, hostid determined at run time.
782 * Negative values mean don't change. 775 * Negative values mean don't change.
783 */ 776 */
784 777
785 if (ints[0] < 1) { 778 if (ints[0] < 1) {
786 printk( "atari_scsi_setup: no arguments!\n" ); 779 printk("atari_scsi_setup: no arguments!\n");
787 return; 780 return;
788 } 781 }
789 782
@@ -809,7 +802,7 @@ void __init atari_scsi_setup(char *str, int *ints)
809 if (ints[4] >= 0 && ints[4] <= 7) 802 if (ints[4] >= 0 && ints[4] <= 7)
810 setup_hostid = ints[4]; 803 setup_hostid = ints[4];
811 else if (ints[4] > 7) 804 else if (ints[4] > 7)
812 printk( "atari_scsi_setup: invalid host ID %d !\n", ints[4] ); 805 printk("atari_scsi_setup: invalid host ID %d !\n", ints[4]);
813 } 806 }
814#ifdef SUPPORT_TAGS 807#ifdef SUPPORT_TAGS
815 if (ints[0] >= 5) { 808 if (ints[0] >= 5) {
@@ -821,7 +814,7 @@ void __init atari_scsi_setup(char *str, int *ints)
821 814
822int atari_scsi_bus_reset(Scsi_Cmnd *cmd) 815int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
823{ 816{
824 int rv; 817 int rv;
825 struct NCR5380_hostdata *hostdata = 818 struct NCR5380_hostdata *hostdata =
826 (struct NCR5380_hostdata *)cmd->device->host->hostdata; 819 (struct NCR5380_hostdata *)cmd->device->host->hostdata;
827 820
@@ -831,13 +824,12 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
831 */ 824 */
832 /* And abort a maybe active DMA transfer */ 825 /* And abort a maybe active DMA transfer */
833 if (IS_A_TT()) { 826 if (IS_A_TT()) {
834 atari_turnoff_irq( IRQ_TT_MFP_SCSI ); 827 atari_turnoff_irq(IRQ_TT_MFP_SCSI);
835#ifdef REAL_DMA 828#ifdef REAL_DMA
836 tt_scsi_dma.dma_ctrl = 0; 829 tt_scsi_dma.dma_ctrl = 0;
837#endif /* REAL_DMA */ 830#endif /* REAL_DMA */
838 } 831 } else {
839 else { 832 atari_turnoff_irq(IRQ_MFP_FSCSI);
840 atari_turnoff_irq( IRQ_MFP_FSCSI );
841#ifdef REAL_DMA 833#ifdef REAL_DMA
842 st_dma.dma_mode_status = 0x90; 834 st_dma.dma_mode_status = 0x90;
843 atari_dma_active = 0; 835 atari_dma_active = 0;
@@ -849,52 +841,51 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
849 841
850 /* Re-enable ints */ 842 /* Re-enable ints */
851 if (IS_A_TT()) { 843 if (IS_A_TT()) {
852 atari_turnon_irq( IRQ_TT_MFP_SCSI ); 844 atari_turnon_irq(IRQ_TT_MFP_SCSI);
853 } 845 } else {
854 else { 846 atari_turnon_irq(IRQ_MFP_FSCSI);
855 atari_turnon_irq( IRQ_MFP_FSCSI );
856 } 847 }
857 if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS) 848 if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
858 falcon_release_lock_if_possible(hostdata); 849 falcon_release_lock_if_possible(hostdata);
859 850
860 return( rv ); 851 return rv;
861} 852}
862 853
863 854
864#ifdef CONFIG_ATARI_SCSI_RESET_BOOT 855#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
865static void __init atari_scsi_reset_boot(void) 856static void __init atari_scsi_reset_boot(void)
866{ 857{
867 unsigned long end; 858 unsigned long end;
868 859
869 /* 860 /*
870 * Do a SCSI reset to clean up the bus during initialization. No messing 861 * Do a SCSI reset to clean up the bus during initialization. No messing
871 * with the queues, interrupts, or locks necessary here. 862 * with the queues, interrupts, or locks necessary here.
872 */ 863 */
873 864
874 printk( "Atari SCSI: resetting the SCSI bus..." ); 865 printk("Atari SCSI: resetting the SCSI bus...");
875 866
876 /* get in phase */ 867 /* get in phase */
877 NCR5380_write( TARGET_COMMAND_REG, 868 NCR5380_write(TARGET_COMMAND_REG,
878 PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) )); 869 PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
879 870
880 /* assert RST */ 871 /* assert RST */
881 NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST ); 872 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
882 /* The min. reset hold time is 25us, so 40us should be enough */ 873 /* The min. reset hold time is 25us, so 40us should be enough */
883 udelay( 50 ); 874 udelay(50);
884 /* reset RST and interrupt */ 875 /* reset RST and interrupt */
885 NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE ); 876 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
886 NCR5380_read( RESET_PARITY_INTERRUPT_REG ); 877 NCR5380_read(RESET_PARITY_INTERRUPT_REG);
887 878
888 end = jiffies + AFTER_RESET_DELAY; 879 end = jiffies + AFTER_RESET_DELAY;
889 while (time_before(jiffies, end)) 880 while (time_before(jiffies, end))
890 barrier(); 881 barrier();
891 882
892 printk( " done\n" ); 883 printk(" done\n");
893} 884}
894#endif 885#endif
895 886
896 887
897const char * atari_scsi_info (struct Scsi_Host *host) 888const char *atari_scsi_info(struct Scsi_Host *host)
898{ 889{
899 /* atari_scsi_detect() is verbose enough... */ 890 /* atari_scsi_detect() is verbose enough... */
900 static const char string[] = "Atari native SCSI"; 891 static const char string[] = "Atari native SCSI";
@@ -904,10 +895,10 @@ const char * atari_scsi_info (struct Scsi_Host *host)
904 895
905#if defined(REAL_DMA) 896#if defined(REAL_DMA)
906 897
907unsigned long atari_scsi_dma_setup( struct Scsi_Host *instance, void *data, 898unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance, void *data,
908 unsigned long count, int dir ) 899 unsigned long count, int dir)
909{ 900{
910 unsigned long addr = virt_to_phys( data ); 901 unsigned long addr = virt_to_phys(data);
911 902
912 DMA_PRINTK("scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, " 903 DMA_PRINTK("scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, "
913 "dir = %d\n", instance->host_no, data, addr, count, dir); 904 "dir = %d\n", instance->host_no, data, addr, count, dir);
@@ -919,38 +910,37 @@ unsigned long atari_scsi_dma_setup( struct Scsi_Host *instance, void *data,
919 * wanted address. 910 * wanted address.
920 */ 911 */
921 if (dir) 912 if (dir)
922 memcpy( atari_dma_buffer, data, count ); 913 memcpy(atari_dma_buffer, data, count);
923 else 914 else
924 atari_dma_orig_addr = data; 915 atari_dma_orig_addr = data;
925 addr = atari_dma_phys_buffer; 916 addr = atari_dma_phys_buffer;
926 } 917 }
927 918
928 atari_dma_startaddr = addr; /* Needed for calculating residual later. */ 919 atari_dma_startaddr = addr; /* Needed for calculating residual later. */
929 920
930 /* Cache cleanup stuff: On writes, push any dirty cache out before sending 921 /* Cache cleanup stuff: On writes, push any dirty cache out before sending
931 * it to the peripheral. (Must be done before DMA setup, since at least 922 * it to the peripheral. (Must be done before DMA setup, since at least
932 * the ST-DMA begins to fill internal buffers right after setup. For 923 * the ST-DMA begins to fill internal buffers right after setup. For
933 * reads, invalidate any cache, may be altered after DMA without CPU 924 * reads, invalidate any cache, may be altered after DMA without CPU
934 * knowledge. 925 * knowledge.
935 * 926 *
936 * ++roman: For the Medusa, there's no need at all for that cache stuff, 927 * ++roman: For the Medusa, there's no need at all for that cache stuff,
937 * because the hardware does bus snooping (fine!). 928 * because the hardware does bus snooping (fine!).
938 */ 929 */
939 dma_cache_maintenance( addr, count, dir ); 930 dma_cache_maintenance(addr, count, dir);
940 931
941 if (count == 0) 932 if (count == 0)
942 printk(KERN_NOTICE "SCSI warning: DMA programmed for 0 bytes !\n"); 933 printk(KERN_NOTICE "SCSI warning: DMA programmed for 0 bytes !\n");
943 934
944 if (IS_A_TT()) { 935 if (IS_A_TT()) {
945 tt_scsi_dma.dma_ctrl = dir; 936 tt_scsi_dma.dma_ctrl = dir;
946 SCSI_DMA_WRITE_P( dma_addr, addr ); 937 SCSI_DMA_WRITE_P(dma_addr, addr);
947 SCSI_DMA_WRITE_P( dma_cnt, count ); 938 SCSI_DMA_WRITE_P(dma_cnt, count);
948 tt_scsi_dma.dma_ctrl = dir | 2; 939 tt_scsi_dma.dma_ctrl = dir | 2;
949 } 940 } else { /* ! IS_A_TT */
950 else { /* ! IS_A_TT */ 941
951
952 /* set address */ 942 /* set address */
953 SCSI_DMA_SETADR( addr ); 943 SCSI_DMA_SETADR(addr);
954 944
955 /* toggle direction bit to clear FIFO and set DMA direction */ 945 /* toggle direction bit to clear FIFO and set DMA direction */
956 dir <<= 8; 946 dir <<= 8;
@@ -968,13 +958,13 @@ unsigned long atari_scsi_dma_setup( struct Scsi_Host *instance, void *data,
968 atari_dma_active = 1; 958 atari_dma_active = 1;
969 } 959 }
970 960
971 return( count ); 961 return count;
972} 962}
973 963
974 964
975static long atari_scsi_dma_residual( struct Scsi_Host *instance ) 965static long atari_scsi_dma_residual(struct Scsi_Host *instance)
976{ 966{
977 return( atari_dma_residual ); 967 return atari_dma_residual;
978} 968}
979 969
980 970
@@ -982,13 +972,13 @@ static long atari_scsi_dma_residual( struct Scsi_Host *instance )
982#define CMD_SURELY_BYTE_MODE 1 972#define CMD_SURELY_BYTE_MODE 1
983#define CMD_MODE_UNKNOWN 2 973#define CMD_MODE_UNKNOWN 2
984 974
985static int falcon_classify_cmd( Scsi_Cmnd *cmd ) 975static int falcon_classify_cmd(Scsi_Cmnd *cmd)
986{ 976{
987 unsigned char opcode = cmd->cmnd[0]; 977 unsigned char opcode = cmd->cmnd[0];
988 978
989 if (opcode == READ_DEFECT_DATA || opcode == READ_LONG || 979 if (opcode == READ_DEFECT_DATA || opcode == READ_LONG ||
990 opcode == READ_BUFFER) 980 opcode == READ_BUFFER)
991 return( CMD_SURELY_BYTE_MODE ); 981 return CMD_SURELY_BYTE_MODE;
992 else if (opcode == READ_6 || opcode == READ_10 || 982 else if (opcode == READ_6 || opcode == READ_10 ||
993 opcode == 0xa8 /* READ_12 */ || opcode == READ_REVERSE || 983 opcode == 0xa8 /* READ_12 */ || opcode == READ_REVERSE ||
994 opcode == RECOVER_BUFFERED_DATA) { 984 opcode == RECOVER_BUFFERED_DATA) {
@@ -996,12 +986,11 @@ static int falcon_classify_cmd( Scsi_Cmnd *cmd )
996 * needed here: The transfer is block-mode only if the 'fixed' bit is 986 * needed here: The transfer is block-mode only if the 'fixed' bit is
997 * set! */ 987 * set! */
998 if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1)) 988 if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
999 return( CMD_SURELY_BYTE_MODE ); 989 return CMD_SURELY_BYTE_MODE;
1000 else 990 else
1001 return( CMD_SURELY_BLOCK_MODE ); 991 return CMD_SURELY_BLOCK_MODE;
1002 } 992 } else
1003 else 993 return CMD_MODE_UNKNOWN;
1004 return( CMD_MODE_UNKNOWN );
1005} 994}
1006 995
1007 996
@@ -1014,19 +1003,18 @@ static int falcon_classify_cmd( Scsi_Cmnd *cmd )
1014 * the overrun problem, so this question is academic :-) 1003 * the overrun problem, so this question is academic :-)
1015 */ 1004 */
1016 1005
1017static unsigned long atari_dma_xfer_len( unsigned long wanted_len, 1006static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
1018 Scsi_Cmnd *cmd, 1007 Scsi_Cmnd *cmd, int write_flag)
1019 int write_flag )
1020{ 1008{
1021 unsigned long possible_len, limit; 1009 unsigned long possible_len, limit;
1022#ifndef CONFIG_TT_DMA_EMUL 1010#ifndef CONFIG_TT_DMA_EMUL
1023 if (MACH_IS_HADES) 1011 if (MACH_IS_HADES)
1024 /* Hades has no SCSI DMA at all :-( Always force use of PIO */ 1012 /* Hades has no SCSI DMA at all :-( Always force use of PIO */
1025 return( 0 ); 1013 return 0;
1026#endif 1014#endif
1027 if (IS_A_TT()) 1015 if (IS_A_TT())
1028 /* TT SCSI DMA can transfer arbitrary #bytes */ 1016 /* TT SCSI DMA can transfer arbitrary #bytes */
1029 return( wanted_len ); 1017 return wanted_len;
1030 1018
1031 /* ST DMA chip is stupid -- only multiples of 512 bytes! (and max. 1019 /* ST DMA chip is stupid -- only multiples of 512 bytes! (and max.
1032 * 255*512 bytes, but this should be enough) 1020 * 255*512 bytes, but this should be enough)
@@ -1062,8 +1050,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
1062 * this). 1050 * this).
1063 */ 1051 */
1064 possible_len = wanted_len; 1052 possible_len = wanted_len;
1065 } 1053 } else {
1066 else {
1067 /* Read operations: if the wanted transfer length is not a multiple of 1054 /* Read operations: if the wanted transfer length is not a multiple of
1068 * 512, we cannot use DMA, since the ST-DMA cannot split transfers 1055 * 512, we cannot use DMA, since the ST-DMA cannot split transfers
1069 * (no interrupt on DMA finished!) 1056 * (no interrupt on DMA finished!)
@@ -1073,15 +1060,15 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
1073 else { 1060 else {
1074 /* Now classify the command (see above) and decide whether it is 1061 /* Now classify the command (see above) and decide whether it is
1075 * allowed to do DMA at all */ 1062 * allowed to do DMA at all */
1076 switch( falcon_classify_cmd( cmd )) { 1063 switch (falcon_classify_cmd(cmd)) {
1077 case CMD_SURELY_BLOCK_MODE: 1064 case CMD_SURELY_BLOCK_MODE:
1078 possible_len = wanted_len; 1065 possible_len = wanted_len;
1079 break; 1066 break;
1080 case CMD_SURELY_BYTE_MODE: 1067 case CMD_SURELY_BYTE_MODE:
1081 possible_len = 0; /* DMA prohibited */ 1068 possible_len = 0; /* DMA prohibited */
1082 break; 1069 break;
1083 case CMD_MODE_UNKNOWN: 1070 case CMD_MODE_UNKNOWN:
1084 default: 1071 default:
1085 /* For unknown commands assume block transfers if the transfer 1072 /* For unknown commands assume block transfers if the transfer
1086 * size/allocation length is >= 1024 */ 1073 * size/allocation length is >= 1024 */
1087 possible_len = (wanted_len < 1024) ? 0 : wanted_len; 1074 possible_len = (wanted_len < 1024) ? 0 : wanted_len;
@@ -1089,9 +1076,9 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
1089 } 1076 }
1090 } 1077 }
1091 } 1078 }
1092 1079
1093 /* Last step: apply the hard limit on DMA transfers */ 1080 /* Last step: apply the hard limit on DMA transfers */
1094 limit = (atari_dma_buffer && !STRAM_ADDR( virt_to_phys(cmd->SCp.ptr) )) ? 1081 limit = (atari_dma_buffer && !STRAM_ADDR(virt_to_phys(cmd->SCp.ptr))) ?
1095 STRAM_BUFFER_SIZE : 255*512; 1082 STRAM_BUFFER_SIZE : 255*512;
1096 if (possible_len > limit) 1083 if (possible_len > limit)
1097 possible_len = limit; 1084 possible_len = limit;
@@ -1100,7 +1087,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
1100 DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes " 1087 DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes "
1101 "instead of %ld\n", possible_len, wanted_len); 1088 "instead of %ld\n", possible_len, wanted_len);
1102 1089
1103 return( possible_len ); 1090 return possible_len;
1104} 1091}
1105 1092
1106 1093
@@ -1114,23 +1101,23 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
1114 * NCR5380_write call these functions via function pointers. 1101 * NCR5380_write call these functions via function pointers.
1115 */ 1102 */
1116 1103
1117static unsigned char atari_scsi_tt_reg_read( unsigned char reg ) 1104static unsigned char atari_scsi_tt_reg_read(unsigned char reg)
1118{ 1105{
1119 return( tt_scsi_regp[reg * 2] ); 1106 return tt_scsi_regp[reg * 2];
1120} 1107}
1121 1108
1122static void atari_scsi_tt_reg_write( unsigned char reg, unsigned char value ) 1109static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
1123{ 1110{
1124 tt_scsi_regp[reg * 2] = value; 1111 tt_scsi_regp[reg * 2] = value;
1125} 1112}
1126 1113
1127static unsigned char atari_scsi_falcon_reg_read( unsigned char reg ) 1114static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
1128{ 1115{
1129 dma_wd.dma_mode_status= (u_short)(0x88 + reg); 1116 dma_wd.dma_mode_status= (u_short)(0x88 + reg);
1130 return( (u_char)dma_wd.fdc_acces_seccount ); 1117 return (u_char)dma_wd.fdc_acces_seccount;
1131} 1118}
1132 1119
1133static void atari_scsi_falcon_reg_write( unsigned char reg, unsigned char value ) 1120static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
1134{ 1121{
1135 dma_wd.dma_mode_status = (u_short)(0x88 + reg); 1122 dma_wd.dma_mode_status = (u_short)(0x88 + reg);
1136 dma_wd.fdc_acces_seccount = (u_short)value; 1123 dma_wd.fdc_acces_seccount = (u_short)value;
diff --git a/drivers/scsi/atari_scsi.h b/drivers/scsi/atari_scsi.h
index f917bdd09b41..efadb8d567c2 100644
--- a/drivers/scsi/atari_scsi.h
+++ b/drivers/scsi/atari_scsi.h
@@ -21,11 +21,7 @@
21int atari_scsi_detect (struct scsi_host_template *); 21int atari_scsi_detect (struct scsi_host_template *);
22const char *atari_scsi_info (struct Scsi_Host *); 22const char *atari_scsi_info (struct Scsi_Host *);
23int atari_scsi_reset (Scsi_Cmnd *, unsigned int); 23int atari_scsi_reset (Scsi_Cmnd *, unsigned int);
24#ifdef MODULE
25int atari_scsi_release (struct Scsi_Host *); 24int atari_scsi_release (struct Scsi_Host *);
26#else
27#define atari_scsi_release NULL
28#endif
29 25
30/* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher 26/* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher
31 * values should work, too; try it! (but cmd_per_lun costs memory!) */ 27 * values should work, too; try it! (but cmd_per_lun costs memory!) */
@@ -63,6 +59,32 @@ int atari_scsi_release (struct Scsi_Host *);
63#define NCR5380_dma_xfer_len(i,cmd,phase) \ 59#define NCR5380_dma_xfer_len(i,cmd,phase) \
64 atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1) 60 atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
65 61
62/* former generic SCSI error handling stuff */
63
64#define SCSI_ABORT_SNOOZE 0
65#define SCSI_ABORT_SUCCESS 1
66#define SCSI_ABORT_PENDING 2
67#define SCSI_ABORT_BUSY 3
68#define SCSI_ABORT_NOT_RUNNING 4
69#define SCSI_ABORT_ERROR 5
70
71#define SCSI_RESET_SNOOZE 0
72#define SCSI_RESET_PUNT 1
73#define SCSI_RESET_SUCCESS 2
74#define SCSI_RESET_PENDING 3
75#define SCSI_RESET_WAKEUP 4
76#define SCSI_RESET_NOT_RUNNING 5
77#define SCSI_RESET_ERROR 6
78
79#define SCSI_RESET_SYNCHRONOUS 0x01
80#define SCSI_RESET_ASYNCHRONOUS 0x02
81#define SCSI_RESET_SUGGEST_BUS_RESET 0x04
82#define SCSI_RESET_SUGGEST_HOST_RESET 0x08
83
84#define SCSI_RESET_BUS_RESET 0x100
85#define SCSI_RESET_HOST_RESET 0x200
86#define SCSI_RESET_ACTION 0xff
87
66/* Debugging printk definitions: 88/* Debugging printk definitions:
67 * 89 *
68 * ARB -> arbitration 90 * ARB -> arbitration
@@ -91,144 +113,58 @@ int atari_scsi_release (struct Scsi_Host *);
91 * 113 *
92 */ 114 */
93 115
94#if NDEBUG & NDEBUG_ARBITRATION 116#define dprint(flg, format...) \
117({ \
118 if (NDEBUG & (flg)) \
119 printk(KERN_DEBUG format); \
120})
121
95#define ARB_PRINTK(format, args...) \ 122#define ARB_PRINTK(format, args...) \
96 printk(KERN_DEBUG format , ## args) 123 dprint(NDEBUG_ARBITRATION, format , ## args)
97#else
98#define ARB_PRINTK(format, args...)
99#endif
100#if NDEBUG & NDEBUG_AUTOSENSE
101#define ASEN_PRINTK(format, args...) \ 124#define ASEN_PRINTK(format, args...) \
102 printk(KERN_DEBUG format , ## args) 125 dprint(NDEBUG_AUTOSENSE, format , ## args)
103#else
104#define ASEN_PRINTK(format, args...)
105#endif
106#if NDEBUG & NDEBUG_DMA
107#define DMA_PRINTK(format, args...) \ 126#define DMA_PRINTK(format, args...) \
108 printk(KERN_DEBUG format , ## args) 127 dprint(NDEBUG_DMA, format , ## args)
109#else
110#define DMA_PRINTK(format, args...)
111#endif
112#if NDEBUG & NDEBUG_HANDSHAKE
113#define HSH_PRINTK(format, args...) \ 128#define HSH_PRINTK(format, args...) \
114 printk(KERN_DEBUG format , ## args) 129 dprint(NDEBUG_HANDSHAKE, format , ## args)
115#else
116#define HSH_PRINTK(format, args...)
117#endif
118#if NDEBUG & NDEBUG_INFORMATION
119#define INF_PRINTK(format, args...) \ 130#define INF_PRINTK(format, args...) \
120 printk(KERN_DEBUG format , ## args) 131 dprint(NDEBUG_INFORMATION, format , ## args)
121#else
122#define INF_PRINTK(format, args...)
123#endif
124#if NDEBUG & NDEBUG_INIT
125#define INI_PRINTK(format, args...) \ 132#define INI_PRINTK(format, args...) \
126 printk(KERN_DEBUG format , ## args) 133 dprint(NDEBUG_INIT, format , ## args)
127#else
128#define INI_PRINTK(format, args...)
129#endif
130#if NDEBUG & NDEBUG_INTR
131#define INT_PRINTK(format, args...) \ 134#define INT_PRINTK(format, args...) \
132 printk(KERN_DEBUG format , ## args) 135 dprint(NDEBUG_INTR, format , ## args)
133#else
134#define INT_PRINTK(format, args...)
135#endif
136#if NDEBUG & NDEBUG_LINKED
137#define LNK_PRINTK(format, args...) \ 136#define LNK_PRINTK(format, args...) \
138 printk(KERN_DEBUG format , ## args) 137 dprint(NDEBUG_LINKED, format , ## args)
139#else
140#define LNK_PRINTK(format, args...)
141#endif
142#if NDEBUG & NDEBUG_MAIN
143#define MAIN_PRINTK(format, args...) \ 138#define MAIN_PRINTK(format, args...) \
144 printk(KERN_DEBUG format , ## args) 139 dprint(NDEBUG_MAIN, format , ## args)
145#else
146#define MAIN_PRINTK(format, args...)
147#endif
148#if NDEBUG & NDEBUG_NO_DATAOUT
149#define NDAT_PRINTK(format, args...) \ 140#define NDAT_PRINTK(format, args...) \
150 printk(KERN_DEBUG format , ## args) 141 dprint(NDEBUG_NO_DATAOUT, format , ## args)
151#else
152#define NDAT_PRINTK(format, args...)
153#endif
154#if NDEBUG & NDEBUG_NO_WRITE
155#define NWR_PRINTK(format, args...) \ 142#define NWR_PRINTK(format, args...) \
156 printk(KERN_DEBUG format , ## args) 143 dprint(NDEBUG_NO_WRITE, format , ## args)
157#else
158#define NWR_PRINTK(format, args...)
159#endif
160#if NDEBUG & NDEBUG_PIO
161#define PIO_PRINTK(format, args...) \ 144#define PIO_PRINTK(format, args...) \
162 printk(KERN_DEBUG format , ## args) 145 dprint(NDEBUG_PIO, format , ## args)
163#else
164#define PIO_PRINTK(format, args...)
165#endif
166#if NDEBUG & NDEBUG_PSEUDO_DMA
167#define PDMA_PRINTK(format, args...) \ 146#define PDMA_PRINTK(format, args...) \
168 printk(KERN_DEBUG format , ## args) 147 dprint(NDEBUG_PSEUDO_DMA, format , ## args)
169#else
170#define PDMA_PRINTK(format, args...)
171#endif
172#if NDEBUG & NDEBUG_QUEUES
173#define QU_PRINTK(format, args...) \ 148#define QU_PRINTK(format, args...) \
174 printk(KERN_DEBUG format , ## args) 149 dprint(NDEBUG_QUEUES, format , ## args)
175#else
176#define QU_PRINTK(format, args...)
177#endif
178#if NDEBUG & NDEBUG_RESELECTION
179#define RSL_PRINTK(format, args...) \ 150#define RSL_PRINTK(format, args...) \
180 printk(KERN_DEBUG format , ## args) 151 dprint(NDEBUG_RESELECTION, format , ## args)
181#else
182#define RSL_PRINTK(format, args...)
183#endif
184#if NDEBUG & NDEBUG_SELECTION
185#define SEL_PRINTK(format, args...) \ 152#define SEL_PRINTK(format, args...) \
186 printk(KERN_DEBUG format , ## args) 153 dprint(NDEBUG_SELECTION, format , ## args)
187#else
188#define SEL_PRINTK(format, args...)
189#endif
190#if NDEBUG & NDEBUG_USLEEP
191#define USL_PRINTK(format, args...) \ 154#define USL_PRINTK(format, args...) \
192 printk(KERN_DEBUG format , ## args) 155 dprint(NDEBUG_USLEEP, format , ## args)
193#else
194#define USL_PRINTK(format, args...)
195#endif
196#if NDEBUG & NDEBUG_LAST_BYTE_SENT
197#define LBS_PRINTK(format, args...) \ 156#define LBS_PRINTK(format, args...) \
198 printk(KERN_DEBUG format , ## args) 157 dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
199#else
200#define LBS_PRINTK(format, args...)
201#endif
202#if NDEBUG & NDEBUG_RESTART_SELECT
203#define RSS_PRINTK(format, args...) \ 158#define RSS_PRINTK(format, args...) \
204 printk(KERN_DEBUG format , ## args) 159 dprint(NDEBUG_RESTART_SELECT, format , ## args)
205#else
206#define RSS_PRINTK(format, args...)
207#endif
208#if NDEBUG & NDEBUG_EXTENDED
209#define EXT_PRINTK(format, args...) \ 160#define EXT_PRINTK(format, args...) \
210 printk(KERN_DEBUG format , ## args) 161 dprint(NDEBUG_EXTENDED, format , ## args)
211#else
212#define EXT_PRINTK(format, args...)
213#endif
214#if NDEBUG & NDEBUG_ABORT
215#define ABRT_PRINTK(format, args...) \ 162#define ABRT_PRINTK(format, args...) \
216 printk(KERN_DEBUG format , ## args) 163 dprint(NDEBUG_ABORT, format , ## args)
217#else
218#define ABRT_PRINTK(format, args...)
219#endif
220#if NDEBUG & NDEBUG_TAGS
221#define TAG_PRINTK(format, args...) \ 164#define TAG_PRINTK(format, args...) \
222 printk(KERN_DEBUG format , ## args) 165 dprint(NDEBUG_TAGS, format , ## args)
223#else
224#define TAG_PRINTK(format, args...)
225#endif
226#if NDEBUG & NDEBUG_MERGING
227#define MER_PRINTK(format, args...) \ 166#define MER_PRINTK(format, args...) \
228 printk(KERN_DEBUG format , ## args) 167 dprint(NDEBUG_MERGING, format , ## args)
229#else
230#define MER_PRINTK(format, args...)
231#endif
232 168
233/* conditional macros for NCR5380_print_{,phase,status} */ 169/* conditional macros for NCR5380_print_{,phase,status} */
234 170
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 61f6024b61ba..2a458d66b6ff 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -202,31 +202,29 @@ static const char * get_sa_name(const struct value_name_pair * arr,
202} 202}
203 203
204/* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */ 204/* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */
205static void print_opcode_name(unsigned char * cdbp, int cdb_len, 205static void print_opcode_name(unsigned char * cdbp, int cdb_len)
206 int start_of_line)
207{ 206{
208 int sa, len, cdb0; 207 int sa, len, cdb0;
209 const char * name; 208 const char * name;
210 const char * leadin = start_of_line ? KERN_INFO : "";
211 209
212 cdb0 = cdbp[0]; 210 cdb0 = cdbp[0];
213 switch(cdb0) { 211 switch(cdb0) {
214 case VARIABLE_LENGTH_CMD: 212 case VARIABLE_LENGTH_CMD:
215 len = cdbp[7] + 8; 213 len = cdbp[7] + 8;
216 if (len < 10) { 214 if (len < 10) {
217 printk("%sshort variable length command, " 215 printk("short variable length command, "
218 "len=%d ext_len=%d", leadin, len, cdb_len); 216 "len=%d ext_len=%d", len, cdb_len);
219 break; 217 break;
220 } 218 }
221 sa = (cdbp[8] << 8) + cdbp[9]; 219 sa = (cdbp[8] << 8) + cdbp[9];
222 name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); 220 name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa);
223 if (name) { 221 if (name) {
224 printk("%s%s", leadin, name); 222 printk("%s", name);
225 if ((cdb_len > 0) && (len != cdb_len)) 223 if ((cdb_len > 0) && (len != cdb_len))
226 printk(", in_cdb_len=%d, ext_len=%d", 224 printk(", in_cdb_len=%d, ext_len=%d",
227 len, cdb_len); 225 len, cdb_len);
228 } else { 226 } else {
229 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 227 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
230 if ((cdb_len > 0) && (len != cdb_len)) 228 if ((cdb_len > 0) && (len != cdb_len))
231 printk(", in_cdb_len=%d, ext_len=%d", 229 printk(", in_cdb_len=%d, ext_len=%d",
232 len, cdb_len); 230 len, cdb_len);
@@ -236,83 +234,80 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len,
236 sa = cdbp[1] & 0x1f; 234 sa = cdbp[1] & 0x1f;
237 name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); 235 name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa);
238 if (name) 236 if (name)
239 printk("%s%s", leadin, name); 237 printk("%s", name);
240 else 238 else
241 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 239 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
242 break; 240 break;
243 case MAINTENANCE_OUT: 241 case MAINTENANCE_OUT:
244 sa = cdbp[1] & 0x1f; 242 sa = cdbp[1] & 0x1f;
245 name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa); 243 name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa);
246 if (name) 244 if (name)
247 printk("%s%s", leadin, name); 245 printk("%s", name);
248 else 246 else
249 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 247 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
250 break; 248 break;
251 case SERVICE_ACTION_IN_12: 249 case SERVICE_ACTION_IN_12:
252 sa = cdbp[1] & 0x1f; 250 sa = cdbp[1] & 0x1f;
253 name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa); 251 name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa);
254 if (name) 252 if (name)
255 printk("%s%s", leadin, name); 253 printk("%s", name);
256 else 254 else
257 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 255 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
258 break; 256 break;
259 case SERVICE_ACTION_OUT_12: 257 case SERVICE_ACTION_OUT_12:
260 sa = cdbp[1] & 0x1f; 258 sa = cdbp[1] & 0x1f;
261 name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa); 259 name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa);
262 if (name) 260 if (name)
263 printk("%s%s", leadin, name); 261 printk("%s", name);
264 else 262 else
265 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 263 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
266 break; 264 break;
267 case SERVICE_ACTION_IN_16: 265 case SERVICE_ACTION_IN_16:
268 sa = cdbp[1] & 0x1f; 266 sa = cdbp[1] & 0x1f;
269 name = get_sa_name(serv_in16_arr, SERV_IN16_SZ, sa); 267 name = get_sa_name(serv_in16_arr, SERV_IN16_SZ, sa);
270 if (name) 268 if (name)
271 printk("%s%s", leadin, name); 269 printk("%s", name);
272 else 270 else
273 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 271 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
274 break; 272 break;
275 case SERVICE_ACTION_OUT_16: 273 case SERVICE_ACTION_OUT_16:
276 sa = cdbp[1] & 0x1f; 274 sa = cdbp[1] & 0x1f;
277 name = get_sa_name(serv_out16_arr, SERV_OUT16_SZ, sa); 275 name = get_sa_name(serv_out16_arr, SERV_OUT16_SZ, sa);
278 if (name) 276 if (name)
279 printk("%s%s", leadin, name); 277 printk("%s", name);
280 else 278 else
281 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 279 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
282 break; 280 break;
283 default: 281 default:
284 if (cdb0 < 0xc0) { 282 if (cdb0 < 0xc0) {
285 name = cdb_byte0_names[cdb0]; 283 name = cdb_byte0_names[cdb0];
286 if (name) 284 if (name)
287 printk("%s%s", leadin, name); 285 printk("%s", name);
288 else 286 else
289 printk("%scdb[0]=0x%x (reserved)", 287 printk("cdb[0]=0x%x (reserved)", cdb0);
290 leadin, cdb0);
291 } else 288 } else
292 printk("%scdb[0]=0x%x (vendor)", leadin, cdb0); 289 printk("cdb[0]=0x%x (vendor)", cdb0);
293 break; 290 break;
294 } 291 }
295} 292}
296 293
297#else /* ifndef CONFIG_SCSI_CONSTANTS */ 294#else /* ifndef CONFIG_SCSI_CONSTANTS */
298 295
299static void print_opcode_name(unsigned char * cdbp, int cdb_len, 296static void print_opcode_name(unsigned char * cdbp, int cdb_len)
300 int start_of_line)
301{ 297{
302 int sa, len, cdb0; 298 int sa, len, cdb0;
303 const char * leadin = start_of_line ? KERN_INFO : "";
304 299
305 cdb0 = cdbp[0]; 300 cdb0 = cdbp[0];
306 switch(cdb0) { 301 switch(cdb0) {
307 case VARIABLE_LENGTH_CMD: 302 case VARIABLE_LENGTH_CMD:
308 len = cdbp[7] + 8; 303 len = cdbp[7] + 8;
309 if (len < 10) { 304 if (len < 10) {
310 printk("%sshort opcode=0x%x command, len=%d " 305 printk("short opcode=0x%x command, len=%d "
311 "ext_len=%d", leadin, cdb0, len, cdb_len); 306 "ext_len=%d", cdb0, len, cdb_len);
312 break; 307 break;
313 } 308 }
314 sa = (cdbp[8] << 8) + cdbp[9]; 309 sa = (cdbp[8] << 8) + cdbp[9];
315 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 310 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
316 if (len != cdb_len) 311 if (len != cdb_len)
317 printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len); 312 printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len);
318 break; 313 break;
@@ -323,49 +318,48 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len,
323 case SERVICE_ACTION_IN_16: 318 case SERVICE_ACTION_IN_16:
324 case SERVICE_ACTION_OUT_16: 319 case SERVICE_ACTION_OUT_16:
325 sa = cdbp[1] & 0x1f; 320 sa = cdbp[1] & 0x1f;
326 printk("%scdb[0]=0x%x, sa=0x%x", leadin, cdb0, sa); 321 printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
327 break; 322 break;
328 default: 323 default:
329 if (cdb0 < 0xc0) 324 if (cdb0 < 0xc0)
330 printk("%scdb[0]=0x%x", leadin, cdb0); 325 printk("cdb[0]=0x%x", cdb0);
331 else 326 else
332 printk("%scdb[0]=0x%x (vendor)", leadin, cdb0); 327 printk("cdb[0]=0x%x (vendor)", cdb0);
333 break; 328 break;
334 } 329 }
335} 330}
336#endif 331#endif
337 332
338void __scsi_print_command(unsigned char *command) 333void __scsi_print_command(unsigned char *cdb)
339{ 334{
340 int k, len; 335 int k, len;
341 336
342 print_opcode_name(command, 0, 1); 337 print_opcode_name(cdb, 0);
343 if (VARIABLE_LENGTH_CMD == command[0]) 338 if (VARIABLE_LENGTH_CMD == cdb[0])
344 len = command[7] + 8; 339 len = cdb[7] + 8;
345 else 340 else
346 len = COMMAND_SIZE(command[0]); 341 len = COMMAND_SIZE(cdb[0]);
347 /* print out all bytes in cdb */ 342 /* print out all bytes in cdb */
348 for (k = 0; k < len; ++k) 343 for (k = 0; k < len; ++k)
349 printk(" %02x", command[k]); 344 printk(" %02x", cdb[k]);
350 printk("\n"); 345 printk("\n");
351} 346}
352EXPORT_SYMBOL(__scsi_print_command); 347EXPORT_SYMBOL(__scsi_print_command);
353 348
354/* This function (perhaps with the addition of peripheral device type) 349void scsi_print_command(struct scsi_cmnd *cmd)
355 * is more approriate than __scsi_print_command(). Perhaps that static
356 * can be dropped later if it replaces the __scsi_print_command version.
357 */
358static void scsi_print_cdb(unsigned char *cdb, int cdb_len, int start_of_line)
359{ 350{
360 int k; 351 int k;
361 352
362 print_opcode_name(cdb, cdb_len, start_of_line); 353 scmd_printk(KERN_INFO, cmd, "CDB: ");
354 print_opcode_name(cmd->cmnd, cmd->cmd_len);
355
363 /* print out all bytes in cdb */ 356 /* print out all bytes in cdb */
364 printk(":"); 357 printk(":");
365 for (k = 0; k < cdb_len; ++k) 358 for (k = 0; k < cmd->cmd_len; ++k)
366 printk(" %02x", cdb[k]); 359 printk(" %02x", cmd->cmnd[k]);
367 printk("\n"); 360 printk("\n");
368} 361}
362EXPORT_SYMBOL(scsi_print_command);
369 363
370/** 364/**
371 * 365 *
@@ -410,7 +404,11 @@ struct error_info {
410 const char * text; 404 const char * text;
411}; 405};
412 406
413static struct error_info additional[] = 407/*
408 * The canonical list of T10 Additional Sense Codes is available at:
409 * http://www.t10.org/lists/asc-num.txt
410 */
411static const struct error_info additional[] =
414{ 412{
415 {0x0000, "No additional sense information"}, 413 {0x0000, "No additional sense information"},
416 {0x0001, "Filemark detected"}, 414 {0x0001, "Filemark detected"},
@@ -714,6 +712,7 @@ static struct error_info additional[] =
714 712
715 {0x2F00, "Commands cleared by another initiator"}, 713 {0x2F00, "Commands cleared by another initiator"},
716 {0x2F01, "Commands cleared by power loss notification"}, 714 {0x2F01, "Commands cleared by power loss notification"},
715 {0x2F02, "Commands cleared by device server"},
717 716
718 {0x3000, "Incompatible medium installed"}, 717 {0x3000, "Incompatible medium installed"},
719 {0x3001, "Cannot read medium - unknown format"}, 718 {0x3001, "Cannot read medium - unknown format"},
@@ -1176,67 +1175,77 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
1176} 1175}
1177EXPORT_SYMBOL(scsi_extd_sense_format); 1176EXPORT_SYMBOL(scsi_extd_sense_format);
1178 1177
1179/* Print extended sense information; no leadin, no linefeed */ 1178void
1180static void
1181scsi_show_extd_sense(unsigned char asc, unsigned char ascq) 1179scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
1182{ 1180{
1183 const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq); 1181 const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq);
1184 1182
1185 if (extd_sense_fmt) { 1183 if (extd_sense_fmt) {
1186 if (strstr(extd_sense_fmt, "%x")) { 1184 if (strstr(extd_sense_fmt, "%x")) {
1187 printk("Additional sense: "); 1185 printk("Add. Sense: ");
1188 printk(extd_sense_fmt, ascq); 1186 printk(extd_sense_fmt, ascq);
1189 } else 1187 } else
1190 printk("Additional sense: %s", extd_sense_fmt); 1188 printk("Add. Sense: %s", extd_sense_fmt);
1191 } else { 1189 } else {
1192 if (asc >= 0x80) 1190 if (asc >= 0x80)
1193 printk("<<vendor>> ASC=0x%x ASCQ=0x%x", asc, ascq); 1191 printk("<<vendor>> ASC=0x%x ASCQ=0x%x", asc,
1192 ascq);
1194 if (ascq >= 0x80) 1193 if (ascq >= 0x80)
1195 printk("ASC=0x%x <<vendor>> ASCQ=0x%x", asc, ascq); 1194 printk("ASC=0x%x <<vendor>> ASCQ=0x%x", asc,
1195 ascq);
1196 else 1196 else
1197 printk("ASC=0x%x ASCQ=0x%x", asc, ascq); 1197 printk("ASC=0x%x ASCQ=0x%x", asc, ascq);
1198 } 1198 }
1199
1200 printk("\n");
1199} 1201}
1202EXPORT_SYMBOL(scsi_show_extd_sense);
1200 1203
1201void 1204void
1202scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr) 1205scsi_show_sense_hdr(struct scsi_sense_hdr *sshdr)
1203{ 1206{
1204 const char *sense_txt; 1207 const char *sense_txt;
1205 /* An example of deferred is when an earlier write to disk cache
1206 * succeeded, but now the disk discovers that it cannot write the
1207 * data to the magnetic media.
1208 */
1209 const char *error = scsi_sense_is_deferred(sshdr) ?
1210 "<<DEFERRED>>" : "Current";
1211 printk(KERN_INFO "%s: %s", name, error);
1212 if (sshdr->response_code >= 0x72)
1213 printk(" [descriptor]");
1214 1208
1215 sense_txt = scsi_sense_key_string(sshdr->sense_key); 1209 sense_txt = scsi_sense_key_string(sshdr->sense_key);
1216 if (sense_txt) 1210 if (sense_txt)
1217 printk(": sense key: %s\n", sense_txt); 1211 printk("Sense Key : %s ", sense_txt);
1218 else 1212 else
1219 printk(": sense key=0x%x\n", sshdr->sense_key); 1213 printk("Sense Key : 0x%x ", sshdr->sense_key);
1220 printk(KERN_INFO " "); 1214
1221 scsi_show_extd_sense(sshdr->asc, sshdr->ascq); 1215 printk("%s", scsi_sense_is_deferred(sshdr) ? "[deferred] " :
1216 "[current] ");
1217
1218 if (sshdr->response_code >= 0x72)
1219 printk("[descriptor]");
1220
1222 printk("\n"); 1221 printk("\n");
1223} 1222}
1223EXPORT_SYMBOL(scsi_show_sense_hdr);
1224
1225/*
1226 * Print normalized SCSI sense header with a prefix.
1227 */
1228void
1229scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
1230{
1231 printk(KERN_INFO "%s: ", name);
1232 scsi_show_sense_hdr(sshdr);
1233 printk(KERN_INFO "%s: ", name);
1234 scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
1235}
1224EXPORT_SYMBOL(scsi_print_sense_hdr); 1236EXPORT_SYMBOL(scsi_print_sense_hdr);
1225 1237
1226/* Print sense information */
1227void 1238void
1228__scsi_print_sense(const char *name, const unsigned char *sense_buffer, 1239scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len,
1229 int sense_len) 1240 struct scsi_sense_hdr *sshdr)
1230{ 1241{
1231 int k, num, res; 1242 int k, num, res;
1232 unsigned int info;
1233 struct scsi_sense_hdr ssh;
1234 1243
1235 res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); 1244 res = scsi_normalize_sense(sense_buffer, sense_len, sshdr);
1236 if (0 == res) { 1245 if (0 == res) {
1237 /* this may be SCSI-1 sense data */ 1246 /* this may be SCSI-1 sense data */
1238 num = (sense_len < 32) ? sense_len : 32; 1247 num = (sense_len < 32) ? sense_len : 32;
1239 printk(KERN_INFO "Unrecognized sense data (in hex):"); 1248 printk("Unrecognized sense data (in hex):");
1240 for (k = 0; k < num; ++k) { 1249 for (k = 0; k < num; ++k) {
1241 if (0 == (k % 16)) { 1250 if (0 == (k % 16)) {
1242 printk("\n"); 1251 printk("\n");
@@ -1247,11 +1256,20 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1247 printk("\n"); 1256 printk("\n");
1248 return; 1257 return;
1249 } 1258 }
1250 scsi_print_sense_hdr(name, &ssh); 1259}
1251 if (ssh.response_code < 0x72) { 1260
1261void
1262scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len,
1263 struct scsi_sense_hdr *sshdr)
1264{
1265 int k, num, res;
1266
1267 if (sshdr->response_code < 0x72)
1268 {
1252 /* only decode extras for "fixed" format now */ 1269 /* only decode extras for "fixed" format now */
1253 char buff[80]; 1270 char buff[80];
1254 int blen, fixed_valid; 1271 int blen, fixed_valid;
1272 unsigned int info;
1255 1273
1256 fixed_valid = sense_buffer[0] & 0x80; 1274 fixed_valid = sense_buffer[0] & 0x80;
1257 info = ((sense_buffer[3] << 24) | (sense_buffer[4] << 16) | 1275 info = ((sense_buffer[3] << 24) | (sense_buffer[4] << 16) |
@@ -1281,13 +1299,13 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1281 res += snprintf(buff + res, blen - res, "ILI"); 1299 res += snprintf(buff + res, blen - res, "ILI");
1282 } 1300 }
1283 if (res > 0) 1301 if (res > 0)
1284 printk(KERN_INFO "%s\n", buff); 1302 printk("%s\n", buff);
1285 } else if (ssh.additional_length > 0) { 1303 } else if (sshdr->additional_length > 0) {
1286 /* descriptor format with sense descriptors */ 1304 /* descriptor format with sense descriptors */
1287 num = 8 + ssh.additional_length; 1305 num = 8 + sshdr->additional_length;
1288 num = (sense_len < num) ? sense_len : num; 1306 num = (sense_len < num) ? sense_len : num;
1289 printk(KERN_INFO "Descriptor sense data with sense " 1307 printk("Descriptor sense data with sense descriptors "
1290 "descriptors (in hex):"); 1308 "(in hex):");
1291 for (k = 0; k < num; ++k) { 1309 for (k = 0; k < num; ++k) {
1292 if (0 == (k % 16)) { 1310 if (0 == (k % 16)) {
1293 printk("\n"); 1311 printk("\n");
@@ -1295,29 +1313,42 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1295 } 1313 }
1296 printk("%02x ", sense_buffer[k]); 1314 printk("%02x ", sense_buffer[k]);
1297 } 1315 }
1316
1298 printk("\n"); 1317 printk("\n");
1299 } 1318 }
1319
1300} 1320}
1301EXPORT_SYMBOL(__scsi_print_sense);
1302 1321
1303void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) 1322/* Normalize and print sense buffer with name prefix */
1323void __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1324 int sense_len)
1304{ 1325{
1305 const char *name = devclass; 1326 struct scsi_sense_hdr sshdr;
1306 1327
1307 if (cmd->request->rq_disk) 1328 printk(KERN_INFO "%s: ", name);
1308 name = cmd->request->rq_disk->disk_name; 1329 scsi_decode_sense_buffer(sense_buffer, sense_len, &sshdr);
1309 __scsi_print_sense(name, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); 1330 scsi_show_sense_hdr(&sshdr);
1331 scsi_decode_sense_extras(sense_buffer, sense_len, &sshdr);
1332 printk(KERN_INFO "%s: ", name);
1333 scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
1310} 1334}
1311EXPORT_SYMBOL(scsi_print_sense); 1335EXPORT_SYMBOL(__scsi_print_sense);
1312 1336
1313void scsi_print_command(struct scsi_cmnd *cmd) 1337/* Normalize and print sense buffer in SCSI command */
1338void scsi_print_sense(char *name, struct scsi_cmnd *cmd)
1314{ 1339{
1315 /* Assume appended output (i.e. not at start of line) */ 1340 struct scsi_sense_hdr sshdr;
1316 sdev_printk("", cmd->device, "\n"); 1341
1317 printk(KERN_INFO " command: "); 1342 scmd_printk(KERN_INFO, cmd, "");
1318 scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0); 1343 scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
1344 &sshdr);
1345 scsi_show_sense_hdr(&sshdr);
1346 scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
1347 &sshdr);
1348 scmd_printk(KERN_INFO, cmd, "");
1349 scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
1319} 1350}
1320EXPORT_SYMBOL(scsi_print_command); 1351EXPORT_SYMBOL(scsi_print_sense);
1321 1352
1322#ifdef CONFIG_SCSI_CONSTANTS 1353#ifdef CONFIG_SCSI_CONSTANTS
1323 1354
@@ -1327,25 +1358,6 @@ static const char * const hostbyte_table[]={
1327"DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; 1358"DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"};
1328#define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table) 1359#define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table)
1329 1360
1330void scsi_print_hostbyte(int scsiresult)
1331{
1332 int hb = host_byte(scsiresult);
1333
1334 printk("Hostbyte=0x%02x", hb);
1335 if (hb < NUM_HOSTBYTE_STRS)
1336 printk("(%s) ", hostbyte_table[hb]);
1337 else
1338 printk("is invalid ");
1339}
1340#else
1341void scsi_print_hostbyte(int scsiresult)
1342{
1343 printk("Hostbyte=0x%02x ", host_byte(scsiresult));
1344}
1345#endif
1346
1347#ifdef CONFIG_SCSI_CONSTANTS
1348
1349static const char * const driverbyte_table[]={ 1361static const char * const driverbyte_table[]={
1350"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", 1362"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
1351"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; 1363"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"};
@@ -1356,19 +1368,35 @@ static const char * const driversuggest_table[]={"SUGGEST_OK",
1356"SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; 1368"SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"};
1357#define NUM_SUGGEST_STRS ARRAY_SIZE(driversuggest_table) 1369#define NUM_SUGGEST_STRS ARRAY_SIZE(driversuggest_table)
1358 1370
1359void scsi_print_driverbyte(int scsiresult) 1371void scsi_show_result(int result)
1360{ 1372{
1361 int dr = (driver_byte(scsiresult) & DRIVER_MASK); 1373 int hb = host_byte(result);
1362 int su = ((driver_byte(scsiresult) & SUGGEST_MASK) >> 4); 1374 int db = (driver_byte(result) & DRIVER_MASK);
1375 int su = ((driver_byte(result) & SUGGEST_MASK) >> 4);
1363 1376
1364 printk("Driverbyte=0x%02x ", driver_byte(scsiresult)); 1377 printk("Result: hostbyte=%s driverbyte=%s,%s\n",
1365 printk("(%s,%s) ", 1378 (hb < NUM_HOSTBYTE_STRS ? hostbyte_table[hb] : "invalid"),
1366 (dr < NUM_DRIVERBYTE_STRS ? driverbyte_table[dr] : "invalid"), 1379 (db < NUM_DRIVERBYTE_STRS ? driverbyte_table[db] : "invalid"),
1367 (su < NUM_SUGGEST_STRS ? driversuggest_table[su] : "invalid")); 1380 (su < NUM_SUGGEST_STRS ? driversuggest_table[su] : "invalid"));
1368} 1381}
1382
1369#else 1383#else
1370void scsi_print_driverbyte(int scsiresult) 1384
1385void scsi_show_result(int result)
1371{ 1386{
1372 printk("Driverbyte=0x%02x ", driver_byte(scsiresult)); 1387 printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n",
1388 host_byte(result), driver_byte(result));
1373} 1389}
1390
1374#endif 1391#endif
1392EXPORT_SYMBOL(scsi_show_result);
1393
1394
1395void scsi_print_result(struct scsi_cmnd *cmd)
1396{
1397 scmd_printk(KERN_INFO, cmd, "");
1398 scsi_show_result(cmd->result);
1399}
1400EXPORT_SYMBOL(scsi_print_result);
1401
1402
diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h
index 5a49216fe4cf..100b49baca7f 100644
--- a/drivers/scsi/dpt/dpti_i2o.h
+++ b/drivers/scsi/dpt/dpti_i2o.h
@@ -31,7 +31,7 @@
31 * Tunable parameters first 31 * Tunable parameters first
32 */ 32 */
33 33
34/* How many different OSM's are we allowing */ 34/* How many different OSM's are we allowing */
35#define MAX_I2O_MODULES 64 35#define MAX_I2O_MODULES 64
36 36
37#define I2O_EVT_CAPABILITY_OTHER 0x01 37#define I2O_EVT_CAPABILITY_OTHER 0x01
@@ -63,7 +63,7 @@ struct i2o_message
63 u16 size; 63 u16 size;
64 u32 target_tid:12; 64 u32 target_tid:12;
65 u32 init_tid:12; 65 u32 init_tid:12;
66 u32 function:8; 66 u32 function:8;
67 u32 initiator_context; 67 u32 initiator_context;
68 /* List follows */ 68 /* List follows */
69}; 69};
@@ -77,7 +77,7 @@ struct i2o_device
77 77
78 char dev_name[8]; /* linux /dev name if available */ 78 char dev_name[8]; /* linux /dev name if available */
79 i2o_lct_entry lct_data;/* Device LCT information */ 79 i2o_lct_entry lct_data;/* Device LCT information */
80 u32 flags; 80 u32 flags;
81 struct proc_dir_entry* proc_entry; /* /proc dir */ 81 struct proc_dir_entry* proc_entry; /* /proc dir */
82 struct adpt_device *owner; 82 struct adpt_device *owner;
83 struct _adpt_hba *controller; /* Controlling IOP */ 83 struct _adpt_hba *controller; /* Controlling IOP */
@@ -86,7 +86,7 @@ struct i2o_device
86/* 86/*
87 * Each I2O controller has one of these objects 87 * Each I2O controller has one of these objects
88 */ 88 */
89 89
90struct i2o_controller 90struct i2o_controller
91{ 91{
92 char name[16]; 92 char name[16];
@@ -111,9 +111,9 @@ struct i2o_sys_tbl_entry
111 u32 iop_id:12; 111 u32 iop_id:12;
112 u32 reserved2:20; 112 u32 reserved2:20;
113 u16 seg_num:12; 113 u16 seg_num:12;
114 u16 i2o_version:4; 114 u16 i2o_version:4;
115 u8 iop_state; 115 u8 iop_state;
116 u8 msg_type; 116 u8 msg_type;
117 u16 frame_size; 117 u16 frame_size;
118 u16 reserved3; 118 u16 reserved3;
119 u32 last_changed; 119 u32 last_changed;
@@ -124,14 +124,14 @@ struct i2o_sys_tbl_entry
124 124
125struct i2o_sys_tbl 125struct i2o_sys_tbl
126{ 126{
127 u8 num_entries; 127 u8 num_entries;
128 u8 version; 128 u8 version;
129 u16 reserved1; 129 u16 reserved1;
130 u32 change_ind; 130 u32 change_ind;
131 u32 reserved2; 131 u32 reserved2;
132 u32 reserved3; 132 u32 reserved3;
133 struct i2o_sys_tbl_entry iops[0]; 133 struct i2o_sys_tbl_entry iops[0];
134}; 134};
135 135
136/* 136/*
137 * I2O classes / subclasses 137 * I2O classes / subclasses
@@ -146,7 +146,7 @@ struct i2o_sys_tbl
146/* Class code names 146/* Class code names
147 * (from v1.5 Table 6-1 Class Code Assignments.) 147 * (from v1.5 Table 6-1 Class Code Assignments.)
148 */ 148 */
149 149
150#define I2O_CLASS_EXECUTIVE 0x000 150#define I2O_CLASS_EXECUTIVE 0x000
151#define I2O_CLASS_DDM 0x001 151#define I2O_CLASS_DDM 0x001
152#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 152#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010
@@ -166,7 +166,7 @@ struct i2o_sys_tbl
166 166
167/* Rest of 0x092 - 0x09f reserved for peer-to-peer classes 167/* Rest of 0x092 - 0x09f reserved for peer-to-peer classes
168 */ 168 */
169 169
170#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff 170#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff
171 171
172/* Subclasses 172/* Subclasses
@@ -175,7 +175,7 @@ struct i2o_sys_tbl
175#define I2O_SUBCLASS_i960 0x001 175#define I2O_SUBCLASS_i960 0x001
176#define I2O_SUBCLASS_HDM 0x020 176#define I2O_SUBCLASS_HDM 0x020
177#define I2O_SUBCLASS_ISM 0x021 177#define I2O_SUBCLASS_ISM 0x021
178 178
179/* Operation functions */ 179/* Operation functions */
180 180
181#define I2O_PARAMS_FIELD_GET 0x0001 181#define I2O_PARAMS_FIELD_GET 0x0001
@@ -219,7 +219,7 @@ struct i2o_sys_tbl
219/* 219/*
220 * Messaging API values 220 * Messaging API values
221 */ 221 */
222 222
223#define I2O_CMD_ADAPTER_ASSIGN 0xB3 223#define I2O_CMD_ADAPTER_ASSIGN 0xB3
224#define I2O_CMD_ADAPTER_READ 0xB2 224#define I2O_CMD_ADAPTER_READ 0xB2
225#define I2O_CMD_ADAPTER_RELEASE 0xB5 225#define I2O_CMD_ADAPTER_RELEASE 0xB5
@@ -284,16 +284,16 @@ struct i2o_sys_tbl
284#define I2O_PRIVATE_MSG 0xFF 284#define I2O_PRIVATE_MSG 0xFF
285 285
286/* 286/*
287 * Init Outbound Q status 287 * Init Outbound Q status
288 */ 288 */
289 289
290#define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS 0x01 290#define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS 0x01
291#define I2O_CMD_OUTBOUND_INIT_REJECTED 0x02 291#define I2O_CMD_OUTBOUND_INIT_REJECTED 0x02
292#define I2O_CMD_OUTBOUND_INIT_FAILED 0x03 292#define I2O_CMD_OUTBOUND_INIT_FAILED 0x03
293#define I2O_CMD_OUTBOUND_INIT_COMPLETE 0x04 293#define I2O_CMD_OUTBOUND_INIT_COMPLETE 0x04
294 294
295/* 295/*
296 * I2O Get Status State values 296 * I2O Get Status State values
297 */ 297 */
298 298
299#define ADAPTER_STATE_INITIALIZING 0x01 299#define ADAPTER_STATE_INITIALIZING 0x01
@@ -303,7 +303,7 @@ struct i2o_sys_tbl
303#define ADAPTER_STATE_OPERATIONAL 0x08 303#define ADAPTER_STATE_OPERATIONAL 0x08
304#define ADAPTER_STATE_FAILED 0x10 304#define ADAPTER_STATE_FAILED 0x10
305#define ADAPTER_STATE_FAULTED 0x11 305#define ADAPTER_STATE_FAULTED 0x11
306 306
307/* I2O API function return values */ 307/* I2O API function return values */
308 308
309#define I2O_RTN_NO_ERROR 0 309#define I2O_RTN_NO_ERROR 0
@@ -321,9 +321,9 @@ struct i2o_sys_tbl
321 321
322/* Reply message status defines for all messages */ 322/* Reply message status defines for all messages */
323 323
324#define I2O_REPLY_STATUS_SUCCESS 0x00 324#define I2O_REPLY_STATUS_SUCCESS 0x00
325#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01 325#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
326#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02 326#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
327#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03 327#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
328#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04 328#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
329#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05 329#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
@@ -338,7 +338,7 @@ struct i2o_sys_tbl
338 338
339#define I2O_PARAMS_STATUS_SUCCESS 0x00 339#define I2O_PARAMS_STATUS_SUCCESS 0x00
340#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01 340#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
341#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02 341#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
342#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03 342#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
343#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04 343#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
344#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05 344#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
@@ -390,7 +390,7 @@ struct i2o_sys_tbl
390#define I2O_CLAIM_MANAGEMENT 0x02000000 390#define I2O_CLAIM_MANAGEMENT 0x02000000
391#define I2O_CLAIM_AUTHORIZED 0x03000000 391#define I2O_CLAIM_AUTHORIZED 0x03000000
392#define I2O_CLAIM_SECONDARY 0x04000000 392#define I2O_CLAIM_SECONDARY 0x04000000
393 393
394/* Message header defines for VersionOffset */ 394/* Message header defines for VersionOffset */
395#define I2OVER15 0x0001 395#define I2OVER15 0x0001
396#define I2OVER20 0x0002 396#define I2OVER20 0x0002
diff --git a/drivers/scsi/dpt/dpti_ioctl.h b/drivers/scsi/dpt/dpti_ioctl.h
index 82d24864be0c..cc784e8f6e9d 100644
--- a/drivers/scsi/dpt/dpti_ioctl.h
+++ b/drivers/scsi/dpt/dpti_ioctl.h
@@ -99,7 +99,7 @@ typedef struct {
99 uCHAR eataVersion; /* EATA Version */ 99 uCHAR eataVersion; /* EATA Version */
100 uLONG cpLength; /* EATA Command Packet Length */ 100 uLONG cpLength; /* EATA Command Packet Length */
101 uLONG spLength; /* EATA Status Packet Length */ 101 uLONG spLength; /* EATA Status Packet Length */
102 uCHAR drqNum; /* DRQ Index (0,5,6,7) */ 102 uCHAR drqNum; /* DRQ Index (0,5,6,7) */
103 uCHAR flag1; /* EATA Flags 1 (Byte 9) */ 103 uCHAR flag1; /* EATA Flags 1 (Byte 9) */
104 uCHAR flag2; /* EATA Flags 2 (Byte 30) */ 104 uCHAR flag2; /* EATA Flags 2 (Byte 30) */
105} CtrlInfo; 105} CtrlInfo;
diff --git a/drivers/scsi/dpt/dptsig.h b/drivers/scsi/dpt/dptsig.h
index 4bf447792129..94bc894d1200 100644
--- a/drivers/scsi/dpt/dptsig.h
+++ b/drivers/scsi/dpt/dptsig.h
@@ -145,8 +145,8 @@ typedef unsigned long sigLONG;
145#define FT_LOGGER 12 /* Event Logger */ 145#define FT_LOGGER 12 /* Event Logger */
146#define FT_INSTALL 13 /* An Install Program */ 146#define FT_INSTALL 13 /* An Install Program */
147#define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */ 147#define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
148#define FT_RESOURCE 15 /* Storage Manager Resource File */ 148#define FT_RESOURCE 15 /* Storage Manager Resource File */
149#define FT_MODEM_DB 16 /* Storage Manager Modem Database */ 149#define FT_MODEM_DB 16 /* Storage Manager Modem Database */
150 150
151/* Filetype flags - sigBYTE dsFiletypeFlags; FLAG BITS */ 151/* Filetype flags - sigBYTE dsFiletypeFlags; FLAG BITS */
152/* ------------------------------------------------------------------ */ 152/* ------------------------------------------------------------------ */
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index cd36e81b2d93..f7b9dbd64a96 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -195,8 +195,6 @@ static int adpt_detect(struct scsi_host_template* sht)
195 pci_dev_get(pDev); 195 pci_dev_get(pDev);
196 } 196 }
197 } 197 }
198 if (pDev)
199 pci_dev_put(pDev);
200 198
201 /* In INIT state, Activate IOPs */ 199 /* In INIT state, Activate IOPs */
202 for (pHba = hba_chain; pHba; pHba = pHba->next) { 200 for (pHba = hba_chain; pHba; pHba = pHba->next) {
diff --git a/drivers/scsi/eata_generic.h b/drivers/scsi/eata_generic.h
index 635c14861f86..5016af5cf860 100644
--- a/drivers/scsi/eata_generic.h
+++ b/drivers/scsi/eata_generic.h
@@ -18,13 +18,6 @@
18 * Misc. definitions * 18 * Misc. definitions *
19 *********************************************/ 19 *********************************************/
20 20
21#ifndef TRUE
22#define TRUE 1
23#endif
24#ifndef FALSE
25#define FALSE 0
26#endif
27
28#define R_LIMIT 0x20000 21#define R_LIMIT 0x20000
29 22
30#define MAXISA 4 23#define MAXISA 4
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 99ce03331b64..ec71061aef61 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2212,7 +2212,7 @@ static void __devinit esp_init_swstate(struct esp *esp)
2212} 2212}
2213 2213
2214/* This places the ESP into a known state at boot time. */ 2214/* This places the ESP into a known state at boot time. */
2215static void __devinit esp_bootup_reset(struct esp *esp) 2215static void esp_bootup_reset(struct esp *esp)
2216{ 2216{
2217 u8 val; 2217 u8 val;
2218 2218
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index fbc1d5c3b0a7..b10eefe735c5 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -85,7 +85,7 @@
85static int max_id = 64; 85static int max_id = 64;
86static int max_channel = 3; 86static int max_channel = 3;
87static int init_timeout = 5; 87static int init_timeout = 5;
88static int max_requests = 50; 88static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
89 89
90#define IBMVSCSI_VERSION "1.5.8" 90#define IBMVSCSI_VERSION "1.5.8"
91 91
@@ -538,7 +538,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
538 int request_status; 538 int request_status;
539 int rc; 539 int rc;
540 540
541 /* If we have exhausted our request limit, just fail this request. 541 /* If we have exhausted our request limit, just fail this request,
542 * unless it is for a reset or abort.
542 * Note that there are rare cases involving driver generated requests 543 * Note that there are rare cases involving driver generated requests
543 * (such as task management requests) that the mid layer may think we 544 * (such as task management requests) that the mid layer may think we
544 * can handle more requests (can_queue) when we actually can't 545 * can handle more requests (can_queue) when we actually can't
@@ -551,9 +552,30 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
551 */ 552 */
552 if (request_status < -1) 553 if (request_status < -1)
553 goto send_error; 554 goto send_error;
554 /* Otherwise, if we have run out of requests */ 555 /* Otherwise, we may have run out of requests. */
555 else if (request_status < 0) 556 /* Abort and reset calls should make it through.
556 goto send_busy; 557 * Nothing except abort and reset should use the last two
558 * slots unless we had two or less to begin with.
559 */
560 else if (request_status < 2 &&
561 evt_struct->iu.srp.cmd.opcode != SRP_TSK_MGMT) {
562 /* In the case that we have less than two requests
563 * available, check the server limit as a combination
564 * of the request limit and the number of requests
565 * in-flight (the size of the send list). If the
566 * server limit is greater than 2, return busy so
567 * that the last two are reserved for reset and abort.
568 */
569 int server_limit = request_status;
570 struct srp_event_struct *tmp_evt;
571
572 list_for_each_entry(tmp_evt, &hostdata->sent, list) {
573 server_limit++;
574 }
575
576 if (server_limit > 2)
577 goto send_busy;
578 }
557 } 579 }
558 580
559 /* Copy the IU into the transfer area */ 581 /* Copy the IU into the transfer area */
@@ -572,6 +594,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
572 594
573 printk(KERN_ERR "ibmvscsi: send error %d\n", 595 printk(KERN_ERR "ibmvscsi: send error %d\n",
574 rc); 596 rc);
597 atomic_inc(&hostdata->request_limit);
575 goto send_error; 598 goto send_error;
576 } 599 }
577 600
@@ -581,7 +604,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
581 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); 604 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
582 605
583 free_event_struct(&hostdata->pool, evt_struct); 606 free_event_struct(&hostdata->pool, evt_struct);
584 return SCSI_MLQUEUE_HOST_BUSY; 607 atomic_inc(&hostdata->request_limit);
608 return SCSI_MLQUEUE_HOST_BUSY;
585 609
586 send_error: 610 send_error:
587 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); 611 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
@@ -831,23 +855,16 @@ static void login_rsp(struct srp_event_struct *evt_struct)
831 855
832 printk(KERN_INFO "ibmvscsi: SRP_LOGIN succeeded\n"); 856 printk(KERN_INFO "ibmvscsi: SRP_LOGIN succeeded\n");
833 857
834 if (evt_struct->xfer_iu->srp.login_rsp.req_lim_delta > 858 if (evt_struct->xfer_iu->srp.login_rsp.req_lim_delta < 0)
835 (max_requests - 2)) 859 printk(KERN_ERR "ibmvscsi: Invalid request_limit.\n");
836 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta =
837 max_requests - 2;
838 860
839 /* Now we know what the real request-limit is */ 861 /* Now we know what the real request-limit is.
862 * This value is set rather than added to request_limit because
863 * request_limit could have been set to -1 by this client.
864 */
840 atomic_set(&hostdata->request_limit, 865 atomic_set(&hostdata->request_limit,
841 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta); 866 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta);
842 867
843 hostdata->host->can_queue =
844 evt_struct->xfer_iu->srp.login_rsp.req_lim_delta - 2;
845
846 if (hostdata->host->can_queue < 1) {
847 printk(KERN_ERR "ibmvscsi: Invalid request_limit_delta\n");
848 return;
849 }
850
851 /* If we had any pending I/Os, kick them */ 868 /* If we had any pending I/Os, kick them */
852 scsi_unblock_requests(hostdata->host); 869 scsi_unblock_requests(hostdata->host);
853 870
@@ -1337,6 +1354,27 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1337 return rc; 1354 return rc;
1338} 1355}
1339 1356
1357/**
1358 * ibmvscsi_slave_configure: Set the "allow_restart" flag for each disk.
1359 * @sdev: struct scsi_device device to configure
1360 *
1361 * Enable allow_restart for a device if it is a disk. Adjust the
1362 * queue_depth here also as is required by the documentation for
1363 * struct scsi_host_template.
1364 */
1365static int ibmvscsi_slave_configure(struct scsi_device *sdev)
1366{
1367 struct Scsi_Host *shost = sdev->host;
1368 unsigned long lock_flags = 0;
1369
1370 spin_lock_irqsave(shost->host_lock, lock_flags);
1371 if (sdev->type == TYPE_DISK)
1372 sdev->allow_restart = 1;
1373 scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun);
1374 spin_unlock_irqrestore(shost->host_lock, lock_flags);
1375 return 0;
1376}
1377
1340/* ------------------------------------------------------------ 1378/* ------------------------------------------------------------
1341 * sysfs attributes 1379 * sysfs attributes
1342 */ 1380 */
@@ -1482,8 +1520,9 @@ static struct scsi_host_template driver_template = {
1482 .queuecommand = ibmvscsi_queuecommand, 1520 .queuecommand = ibmvscsi_queuecommand,
1483 .eh_abort_handler = ibmvscsi_eh_abort_handler, 1521 .eh_abort_handler = ibmvscsi_eh_abort_handler,
1484 .eh_device_reset_handler = ibmvscsi_eh_device_reset_handler, 1522 .eh_device_reset_handler = ibmvscsi_eh_device_reset_handler,
1523 .slave_configure = ibmvscsi_slave_configure,
1485 .cmd_per_lun = 16, 1524 .cmd_per_lun = 16,
1486 .can_queue = 1, /* Updated after SRP_LOGIN */ 1525 .can_queue = IBMVSCSI_MAX_REQUESTS_DEFAULT,
1487 .this_id = -1, 1526 .this_id = -1,
1488 .sg_tablesize = SG_ALL, 1527 .sg_tablesize = SG_ALL,
1489 .use_clustering = ENABLE_CLUSTERING, 1528 .use_clustering = ENABLE_CLUSTERING,
@@ -1503,6 +1542,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1503 1542
1504 vdev->dev.driver_data = NULL; 1543 vdev->dev.driver_data = NULL;
1505 1544
1545 driver_template.can_queue = max_requests;
1506 host = scsi_host_alloc(&driver_template, sizeof(*hostdata)); 1546 host = scsi_host_alloc(&driver_template, sizeof(*hostdata));
1507 if (!host) { 1547 if (!host) {
1508 printk(KERN_ERR "ibmvscsi: couldn't allocate host data\n"); 1548 printk(KERN_ERR "ibmvscsi: couldn't allocate host data\n");
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 5c6d93582929..77cc1d40f5bb 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -44,6 +44,8 @@ struct Scsi_Host;
44 */ 44 */
45#define MAX_INDIRECT_BUFS 10 45#define MAX_INDIRECT_BUFS 10
46 46
47#define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
48
47/* ------------------------------------------------------------ 49/* ------------------------------------------------------------
48 * Data Structures 50 * Data Structures
49 */ 51 */
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 140dd9700ff6..8ba7dd09d01d 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -35,7 +35,7 @@
35#include "ibmvscsi.h" 35#include "ibmvscsi.h"
36 36
37#define INITIAL_SRP_LIMIT 16 37#define INITIAL_SRP_LIMIT 16
38#define DEFAULT_MAX_SECTORS 512 38#define DEFAULT_MAX_SECTORS 256
39 39
40#define TGT_NAME "ibmvstgt" 40#define TGT_NAME "ibmvstgt"
41 41
@@ -248,8 +248,8 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
248 md[i].va + mdone); 248 md[i].va + mdone);
249 249
250 if (err != H_SUCCESS) { 250 if (err != H_SUCCESS) {
251 eprintk("rdma error %d %d\n", dir, slen); 251 eprintk("rdma error %d %d %ld\n", dir, slen, err);
252 goto out; 252 return -EIO;
253 } 253 }
254 254
255 mlen -= slen; 255 mlen -= slen;
@@ -265,45 +265,35 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
265 if (sidx > nsg) { 265 if (sidx > nsg) {
266 eprintk("out of sg %p %d %d\n", 266 eprintk("out of sg %p %d %d\n",
267 iue, sidx, nsg); 267 iue, sidx, nsg);
268 goto out; 268 return -EIO;
269 } 269 }
270 } 270 }
271 }; 271 };
272 272
273 rest -= mlen; 273 rest -= mlen;
274 } 274 }
275out:
276
277 return 0; 275 return 0;
278} 276}
279 277
280static int ibmvstgt_transfer_data(struct scsi_cmnd *sc,
281 void (*done)(struct scsi_cmnd *))
282{
283 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
284 int err;
285
286 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
287
288 done(sc);
289
290 return err;
291}
292
293static int ibmvstgt_cmd_done(struct scsi_cmnd *sc, 278static int ibmvstgt_cmd_done(struct scsi_cmnd *sc,
294 void (*done)(struct scsi_cmnd *)) 279 void (*done)(struct scsi_cmnd *))
295{ 280{
296 unsigned long flags; 281 unsigned long flags;
297 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr; 282 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
298 struct srp_target *target = iue->target; 283 struct srp_target *target = iue->target;
284 int err = 0;
299 285
300 dprintk("%p %p %x\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0]); 286 dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0],
287 cmd->usg_sg);
288
289 if (sc->use_sg)
290 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
301 291
302 spin_lock_irqsave(&target->lock, flags); 292 spin_lock_irqsave(&target->lock, flags);
303 list_del(&iue->ilist); 293 list_del(&iue->ilist);
304 spin_unlock_irqrestore(&target->lock, flags); 294 spin_unlock_irqrestore(&target->lock, flags);
305 295
306 if (sc->result != SAM_STAT_GOOD) { 296 if (err|| sc->result != SAM_STAT_GOOD) {
307 eprintk("operation failed %p %d %x\n", 297 eprintk("operation failed %p %d %x\n",
308 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]); 298 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]);
309 send_rsp(iue, sc, HARDWARE_ERROR, 0x00); 299 send_rsp(iue, sc, HARDWARE_ERROR, 0x00);
@@ -503,7 +493,8 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
503{ 493{
504 struct vio_port *vport = target_to_port(target); 494 struct vio_port *vport = target_to_port(target);
505 struct iu_entry *iue; 495 struct iu_entry *iue;
506 long err, done; 496 long err;
497 int done = 1;
507 498
508 iue = srp_iu_get(target); 499 iue = srp_iu_get(target);
509 if (!iue) { 500 if (!iue) {
@@ -518,7 +509,6 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
518 509
519 if (err != H_SUCCESS) { 510 if (err != H_SUCCESS) {
520 eprintk("%ld transferring data error %p\n", err, iue); 511 eprintk("%ld transferring data error %p\n", err, iue);
521 done = 1;
522 goto out; 512 goto out;
523 } 513 }
524 514
@@ -794,7 +784,6 @@ static struct scsi_host_template ibmvstgt_sht = {
794 .use_clustering = DISABLE_CLUSTERING, 784 .use_clustering = DISABLE_CLUSTERING,
795 .max_sectors = DEFAULT_MAX_SECTORS, 785 .max_sectors = DEFAULT_MAX_SECTORS,
796 .transfer_response = ibmvstgt_cmd_done, 786 .transfer_response = ibmvstgt_cmd_done,
797 .transfer_data = ibmvstgt_transfer_data,
798 .eh_abort_handler = ibmvstgt_eh_abort_handler, 787 .eh_abort_handler = ibmvstgt_eh_abort_handler,
799 .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response, 788 .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response,
800 .shost_attrs = ibmvstgt_attrs, 789 .shost_attrs = ibmvstgt_attrs,
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e9bd29975db4..2c7b77e833f9 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -89,10 +89,9 @@ static unsigned int ipr_log_level = IPR_DEFAULT_LOG_LEVEL;
89static unsigned int ipr_max_speed = 1; 89static unsigned int ipr_max_speed = 1;
90static int ipr_testmode = 0; 90static int ipr_testmode = 0;
91static unsigned int ipr_fastfail = 0; 91static unsigned int ipr_fastfail = 0;
92static unsigned int ipr_transop_timeout = IPR_OPERATIONAL_TIMEOUT; 92static unsigned int ipr_transop_timeout = 0;
93static unsigned int ipr_enable_cache = 1; 93static unsigned int ipr_enable_cache = 1;
94static unsigned int ipr_debug = 0; 94static unsigned int ipr_debug = 0;
95static int ipr_auto_create = 1;
96static DEFINE_SPINLOCK(ipr_driver_lock); 95static DEFINE_SPINLOCK(ipr_driver_lock);
97 96
98/* This table describes the differences between DMA controller chips */ 97/* This table describes the differences between DMA controller chips */
@@ -159,15 +158,13 @@ module_param_named(enable_cache, ipr_enable_cache, int, 0);
159MODULE_PARM_DESC(enable_cache, "Enable adapter's non-volatile write cache (default: 1)"); 158MODULE_PARM_DESC(enable_cache, "Enable adapter's non-volatile write cache (default: 1)");
160module_param_named(debug, ipr_debug, int, 0); 159module_param_named(debug, ipr_debug, int, 0);
161MODULE_PARM_DESC(debug, "Enable device driver debugging logging. Set to 1 to enable. (default: 0)"); 160MODULE_PARM_DESC(debug, "Enable device driver debugging logging. Set to 1 to enable. (default: 0)");
162module_param_named(auto_create, ipr_auto_create, int, 0);
163MODULE_PARM_DESC(auto_create, "Auto-create single device RAID 0 arrays when initialized (default: 1)");
164MODULE_LICENSE("GPL"); 161MODULE_LICENSE("GPL");
165MODULE_VERSION(IPR_DRIVER_VERSION); 162MODULE_VERSION(IPR_DRIVER_VERSION);
166 163
167/* A constant array of IOASCs/URCs/Error Messages */ 164/* A constant array of IOASCs/URCs/Error Messages */
168static const 165static const
169struct ipr_error_table_t ipr_error_table[] = { 166struct ipr_error_table_t ipr_error_table[] = {
170 {0x00000000, 1, 1, 167 {0x00000000, 1, IPR_DEFAULT_LOG_LEVEL,
171 "8155: An unknown error was received"}, 168 "8155: An unknown error was received"},
172 {0x00330000, 0, 0, 169 {0x00330000, 0, 0,
173 "Soft underlength error"}, 170 "Soft underlength error"},
@@ -175,37 +172,37 @@ struct ipr_error_table_t ipr_error_table[] = {
175 "Command to be cancelled not found"}, 172 "Command to be cancelled not found"},
176 {0x00808000, 0, 0, 173 {0x00808000, 0, 0,
177 "Qualified success"}, 174 "Qualified success"},
178 {0x01080000, 1, 1, 175 {0x01080000, 1, IPR_DEFAULT_LOG_LEVEL,
179 "FFFE: Soft device bus error recovered by the IOA"}, 176 "FFFE: Soft device bus error recovered by the IOA"},
180 {0x01088100, 0, 1, 177 {0x01088100, 0, IPR_DEFAULT_LOG_LEVEL,
181 "4101: Soft device bus fabric error"}, 178 "4101: Soft device bus fabric error"},
182 {0x01170600, 0, 1, 179 {0x01170600, 0, IPR_DEFAULT_LOG_LEVEL,
183 "FFF9: Device sector reassign successful"}, 180 "FFF9: Device sector reassign successful"},
184 {0x01170900, 0, 1, 181 {0x01170900, 0, IPR_DEFAULT_LOG_LEVEL,
185 "FFF7: Media error recovered by device rewrite procedures"}, 182 "FFF7: Media error recovered by device rewrite procedures"},
186 {0x01180200, 0, 1, 183 {0x01180200, 0, IPR_DEFAULT_LOG_LEVEL,
187 "7001: IOA sector reassignment successful"}, 184 "7001: IOA sector reassignment successful"},
188 {0x01180500, 0, 1, 185 {0x01180500, 0, IPR_DEFAULT_LOG_LEVEL,
189 "FFF9: Soft media error. Sector reassignment recommended"}, 186 "FFF9: Soft media error. Sector reassignment recommended"},
190 {0x01180600, 0, 1, 187 {0x01180600, 0, IPR_DEFAULT_LOG_LEVEL,
191 "FFF7: Media error recovered by IOA rewrite procedures"}, 188 "FFF7: Media error recovered by IOA rewrite procedures"},
192 {0x01418000, 0, 1, 189 {0x01418000, 0, IPR_DEFAULT_LOG_LEVEL,
193 "FF3D: Soft PCI bus error recovered by the IOA"}, 190 "FF3D: Soft PCI bus error recovered by the IOA"},
194 {0x01440000, 1, 1, 191 {0x01440000, 1, IPR_DEFAULT_LOG_LEVEL,
195 "FFF6: Device hardware error recovered by the IOA"}, 192 "FFF6: Device hardware error recovered by the IOA"},
196 {0x01448100, 0, 1, 193 {0x01448100, 0, IPR_DEFAULT_LOG_LEVEL,
197 "FFF6: Device hardware error recovered by the device"}, 194 "FFF6: Device hardware error recovered by the device"},
198 {0x01448200, 1, 1, 195 {0x01448200, 1, IPR_DEFAULT_LOG_LEVEL,
199 "FF3D: Soft IOA error recovered by the IOA"}, 196 "FF3D: Soft IOA error recovered by the IOA"},
200 {0x01448300, 0, 1, 197 {0x01448300, 0, IPR_DEFAULT_LOG_LEVEL,
201 "FFFA: Undefined device response recovered by the IOA"}, 198 "FFFA: Undefined device response recovered by the IOA"},
202 {0x014A0000, 1, 1, 199 {0x014A0000, 1, IPR_DEFAULT_LOG_LEVEL,
203 "FFF6: Device bus error, message or command phase"}, 200 "FFF6: Device bus error, message or command phase"},
204 {0x014A8000, 0, 1, 201 {0x014A8000, 0, IPR_DEFAULT_LOG_LEVEL,
205 "FFFE: Task Management Function failed"}, 202 "FFFE: Task Management Function failed"},
206 {0x015D0000, 0, 1, 203 {0x015D0000, 0, IPR_DEFAULT_LOG_LEVEL,
207 "FFF6: Failure prediction threshold exceeded"}, 204 "FFF6: Failure prediction threshold exceeded"},
208 {0x015D9200, 0, 1, 205 {0x015D9200, 0, IPR_DEFAULT_LOG_LEVEL,
209 "8009: Impending cache battery pack failure"}, 206 "8009: Impending cache battery pack failure"},
210 {0x02040400, 0, 0, 207 {0x02040400, 0, 0,
211 "34FF: Disk device format in progress"}, 208 "34FF: Disk device format in progress"},
@@ -215,85 +212,85 @@ struct ipr_error_table_t ipr_error_table[] = {
215 "No ready, IOA shutdown"}, 212 "No ready, IOA shutdown"},
216 {0x025A0000, 0, 0, 213 {0x025A0000, 0, 0,
217 "Not ready, IOA has been shutdown"}, 214 "Not ready, IOA has been shutdown"},
218 {0x02670100, 0, 1, 215 {0x02670100, 0, IPR_DEFAULT_LOG_LEVEL,
219 "3020: Storage subsystem configuration error"}, 216 "3020: Storage subsystem configuration error"},
220 {0x03110B00, 0, 0, 217 {0x03110B00, 0, 0,
221 "FFF5: Medium error, data unreadable, recommend reassign"}, 218 "FFF5: Medium error, data unreadable, recommend reassign"},
222 {0x03110C00, 0, 0, 219 {0x03110C00, 0, 0,
223 "7000: Medium error, data unreadable, do not reassign"}, 220 "7000: Medium error, data unreadable, do not reassign"},
224 {0x03310000, 0, 1, 221 {0x03310000, 0, IPR_DEFAULT_LOG_LEVEL,
225 "FFF3: Disk media format bad"}, 222 "FFF3: Disk media format bad"},
226 {0x04050000, 0, 1, 223 {0x04050000, 0, IPR_DEFAULT_LOG_LEVEL,
227 "3002: Addressed device failed to respond to selection"}, 224 "3002: Addressed device failed to respond to selection"},
228 {0x04080000, 1, 1, 225 {0x04080000, 1, IPR_DEFAULT_LOG_LEVEL,
229 "3100: Device bus error"}, 226 "3100: Device bus error"},
230 {0x04080100, 0, 1, 227 {0x04080100, 0, IPR_DEFAULT_LOG_LEVEL,
231 "3109: IOA timed out a device command"}, 228 "3109: IOA timed out a device command"},
232 {0x04088000, 0, 0, 229 {0x04088000, 0, 0,
233 "3120: SCSI bus is not operational"}, 230 "3120: SCSI bus is not operational"},
234 {0x04088100, 0, 1, 231 {0x04088100, 0, IPR_DEFAULT_LOG_LEVEL,
235 "4100: Hard device bus fabric error"}, 232 "4100: Hard device bus fabric error"},
236 {0x04118000, 0, 1, 233 {0x04118000, 0, IPR_DEFAULT_LOG_LEVEL,
237 "9000: IOA reserved area data check"}, 234 "9000: IOA reserved area data check"},
238 {0x04118100, 0, 1, 235 {0x04118100, 0, IPR_DEFAULT_LOG_LEVEL,
239 "9001: IOA reserved area invalid data pattern"}, 236 "9001: IOA reserved area invalid data pattern"},
240 {0x04118200, 0, 1, 237 {0x04118200, 0, IPR_DEFAULT_LOG_LEVEL,
241 "9002: IOA reserved area LRC error"}, 238 "9002: IOA reserved area LRC error"},
242 {0x04320000, 0, 1, 239 {0x04320000, 0, IPR_DEFAULT_LOG_LEVEL,
243 "102E: Out of alternate sectors for disk storage"}, 240 "102E: Out of alternate sectors for disk storage"},
244 {0x04330000, 1, 1, 241 {0x04330000, 1, IPR_DEFAULT_LOG_LEVEL,
245 "FFF4: Data transfer underlength error"}, 242 "FFF4: Data transfer underlength error"},
246 {0x04338000, 1, 1, 243 {0x04338000, 1, IPR_DEFAULT_LOG_LEVEL,
247 "FFF4: Data transfer overlength error"}, 244 "FFF4: Data transfer overlength error"},
248 {0x043E0100, 0, 1, 245 {0x043E0100, 0, IPR_DEFAULT_LOG_LEVEL,
249 "3400: Logical unit failure"}, 246 "3400: Logical unit failure"},
250 {0x04408500, 0, 1, 247 {0x04408500, 0, IPR_DEFAULT_LOG_LEVEL,
251 "FFF4: Device microcode is corrupt"}, 248 "FFF4: Device microcode is corrupt"},
252 {0x04418000, 1, 1, 249 {0x04418000, 1, IPR_DEFAULT_LOG_LEVEL,
253 "8150: PCI bus error"}, 250 "8150: PCI bus error"},
254 {0x04430000, 1, 0, 251 {0x04430000, 1, 0,
255 "Unsupported device bus message received"}, 252 "Unsupported device bus message received"},
256 {0x04440000, 1, 1, 253 {0x04440000, 1, IPR_DEFAULT_LOG_LEVEL,
257 "FFF4: Disk device problem"}, 254 "FFF4: Disk device problem"},
258 {0x04448200, 1, 1, 255 {0x04448200, 1, IPR_DEFAULT_LOG_LEVEL,
259 "8150: Permanent IOA failure"}, 256 "8150: Permanent IOA failure"},
260 {0x04448300, 0, 1, 257 {0x04448300, 0, IPR_DEFAULT_LOG_LEVEL,
261 "3010: Disk device returned wrong response to IOA"}, 258 "3010: Disk device returned wrong response to IOA"},
262 {0x04448400, 0, 1, 259 {0x04448400, 0, IPR_DEFAULT_LOG_LEVEL,
263 "8151: IOA microcode error"}, 260 "8151: IOA microcode error"},
264 {0x04448500, 0, 0, 261 {0x04448500, 0, 0,
265 "Device bus status error"}, 262 "Device bus status error"},
266 {0x04448600, 0, 1, 263 {0x04448600, 0, IPR_DEFAULT_LOG_LEVEL,
267 "8157: IOA error requiring IOA reset to recover"}, 264 "8157: IOA error requiring IOA reset to recover"},
268 {0x04448700, 0, 0, 265 {0x04448700, 0, 0,
269 "ATA device status error"}, 266 "ATA device status error"},
270 {0x04490000, 0, 0, 267 {0x04490000, 0, 0,
271 "Message reject received from the device"}, 268 "Message reject received from the device"},
272 {0x04449200, 0, 1, 269 {0x04449200, 0, IPR_DEFAULT_LOG_LEVEL,
273 "8008: A permanent cache battery pack failure occurred"}, 270 "8008: A permanent cache battery pack failure occurred"},
274 {0x0444A000, 0, 1, 271 {0x0444A000, 0, IPR_DEFAULT_LOG_LEVEL,
275 "9090: Disk unit has been modified after the last known status"}, 272 "9090: Disk unit has been modified after the last known status"},
276 {0x0444A200, 0, 1, 273 {0x0444A200, 0, IPR_DEFAULT_LOG_LEVEL,
277 "9081: IOA detected device error"}, 274 "9081: IOA detected device error"},
278 {0x0444A300, 0, 1, 275 {0x0444A300, 0, IPR_DEFAULT_LOG_LEVEL,
279 "9082: IOA detected device error"}, 276 "9082: IOA detected device error"},
280 {0x044A0000, 1, 1, 277 {0x044A0000, 1, IPR_DEFAULT_LOG_LEVEL,
281 "3110: Device bus error, message or command phase"}, 278 "3110: Device bus error, message or command phase"},
282 {0x044A8000, 1, 1, 279 {0x044A8000, 1, IPR_DEFAULT_LOG_LEVEL,
283 "3110: SAS Command / Task Management Function failed"}, 280 "3110: SAS Command / Task Management Function failed"},
284 {0x04670400, 0, 1, 281 {0x04670400, 0, IPR_DEFAULT_LOG_LEVEL,
285 "9091: Incorrect hardware configuration change has been detected"}, 282 "9091: Incorrect hardware configuration change has been detected"},
286 {0x04678000, 0, 1, 283 {0x04678000, 0, IPR_DEFAULT_LOG_LEVEL,
287 "9073: Invalid multi-adapter configuration"}, 284 "9073: Invalid multi-adapter configuration"},
288 {0x04678100, 0, 1, 285 {0x04678100, 0, IPR_DEFAULT_LOG_LEVEL,
289 "4010: Incorrect connection between cascaded expanders"}, 286 "4010: Incorrect connection between cascaded expanders"},
290 {0x04678200, 0, 1, 287 {0x04678200, 0, IPR_DEFAULT_LOG_LEVEL,
291 "4020: Connections exceed IOA design limits"}, 288 "4020: Connections exceed IOA design limits"},
292 {0x04678300, 0, 1, 289 {0x04678300, 0, IPR_DEFAULT_LOG_LEVEL,
293 "4030: Incorrect multipath connection"}, 290 "4030: Incorrect multipath connection"},
294 {0x04679000, 0, 1, 291 {0x04679000, 0, IPR_DEFAULT_LOG_LEVEL,
295 "4110: Unsupported enclosure function"}, 292 "4110: Unsupported enclosure function"},
296 {0x046E0000, 0, 1, 293 {0x046E0000, 0, IPR_DEFAULT_LOG_LEVEL,
297 "FFF4: Command to logical unit failed"}, 294 "FFF4: Command to logical unit failed"},
298 {0x05240000, 1, 0, 295 {0x05240000, 1, 0,
299 "Illegal request, invalid request type or request packet"}, 296 "Illegal request, invalid request type or request packet"},
@@ -313,101 +310,103 @@ struct ipr_error_table_t ipr_error_table[] = {
313 "Illegal request, command sequence error"}, 310 "Illegal request, command sequence error"},
314 {0x052C8000, 1, 0, 311 {0x052C8000, 1, 0,
315 "Illegal request, dual adapter support not enabled"}, 312 "Illegal request, dual adapter support not enabled"},
316 {0x06040500, 0, 1, 313 {0x06040500, 0, IPR_DEFAULT_LOG_LEVEL,
317 "9031: Array protection temporarily suspended, protection resuming"}, 314 "9031: Array protection temporarily suspended, protection resuming"},
318 {0x06040600, 0, 1, 315 {0x06040600, 0, IPR_DEFAULT_LOG_LEVEL,
319 "9040: Array protection temporarily suspended, protection resuming"}, 316 "9040: Array protection temporarily suspended, protection resuming"},
320 {0x06288000, 0, 1, 317 {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL,
321 "3140: Device bus not ready to ready transition"}, 318 "3140: Device bus not ready to ready transition"},
322 {0x06290000, 0, 1, 319 {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL,
323 "FFFB: SCSI bus was reset"}, 320 "FFFB: SCSI bus was reset"},
324 {0x06290500, 0, 0, 321 {0x06290500, 0, 0,
325 "FFFE: SCSI bus transition to single ended"}, 322 "FFFE: SCSI bus transition to single ended"},
326 {0x06290600, 0, 0, 323 {0x06290600, 0, 0,
327 "FFFE: SCSI bus transition to LVD"}, 324 "FFFE: SCSI bus transition to LVD"},
328 {0x06298000, 0, 1, 325 {0x06298000, 0, IPR_DEFAULT_LOG_LEVEL,
329 "FFFB: SCSI bus was reset by another initiator"}, 326 "FFFB: SCSI bus was reset by another initiator"},
330 {0x063F0300, 0, 1, 327 {0x063F0300, 0, IPR_DEFAULT_LOG_LEVEL,
331 "3029: A device replacement has occurred"}, 328 "3029: A device replacement has occurred"},
332 {0x064C8000, 0, 1, 329 {0x064C8000, 0, IPR_DEFAULT_LOG_LEVEL,
333 "9051: IOA cache data exists for a missing or failed device"}, 330 "9051: IOA cache data exists for a missing or failed device"},
334 {0x064C8100, 0, 1, 331 {0x064C8100, 0, IPR_DEFAULT_LOG_LEVEL,
335 "9055: Auxiliary cache IOA contains cache data needed by the primary IOA"}, 332 "9055: Auxiliary cache IOA contains cache data needed by the primary IOA"},
336 {0x06670100, 0, 1, 333 {0x06670100, 0, IPR_DEFAULT_LOG_LEVEL,
337 "9025: Disk unit is not supported at its physical location"}, 334 "9025: Disk unit is not supported at its physical location"},
338 {0x06670600, 0, 1, 335 {0x06670600, 0, IPR_DEFAULT_LOG_LEVEL,
339 "3020: IOA detected a SCSI bus configuration error"}, 336 "3020: IOA detected a SCSI bus configuration error"},
340 {0x06678000, 0, 1, 337 {0x06678000, 0, IPR_DEFAULT_LOG_LEVEL,
341 "3150: SCSI bus configuration error"}, 338 "3150: SCSI bus configuration error"},
342 {0x06678100, 0, 1, 339 {0x06678100, 0, IPR_DEFAULT_LOG_LEVEL,
343 "9074: Asymmetric advanced function disk configuration"}, 340 "9074: Asymmetric advanced function disk configuration"},
344 {0x06678300, 0, 1, 341 {0x06678300, 0, IPR_DEFAULT_LOG_LEVEL,
345 "4040: Incomplete multipath connection between IOA and enclosure"}, 342 "4040: Incomplete multipath connection between IOA and enclosure"},
346 {0x06678400, 0, 1, 343 {0x06678400, 0, IPR_DEFAULT_LOG_LEVEL,
347 "4041: Incomplete multipath connection between enclosure and device"}, 344 "4041: Incomplete multipath connection between enclosure and device"},
348 {0x06678500, 0, 1, 345 {0x06678500, 0, IPR_DEFAULT_LOG_LEVEL,
349 "9075: Incomplete multipath connection between IOA and remote IOA"}, 346 "9075: Incomplete multipath connection between IOA and remote IOA"},
350 {0x06678600, 0, 1, 347 {0x06678600, 0, IPR_DEFAULT_LOG_LEVEL,
351 "9076: Configuration error, missing remote IOA"}, 348 "9076: Configuration error, missing remote IOA"},
352 {0x06679100, 0, 1, 349 {0x06679100, 0, IPR_DEFAULT_LOG_LEVEL,
353 "4050: Enclosure does not support a required multipath function"}, 350 "4050: Enclosure does not support a required multipath function"},
354 {0x06690200, 0, 1, 351 {0x06690200, 0, IPR_DEFAULT_LOG_LEVEL,
355 "9041: Array protection temporarily suspended"}, 352 "9041: Array protection temporarily suspended"},
356 {0x06698200, 0, 1, 353 {0x06698200, 0, IPR_DEFAULT_LOG_LEVEL,
357 "9042: Corrupt array parity detected on specified device"}, 354 "9042: Corrupt array parity detected on specified device"},
358 {0x066B0200, 0, 1, 355 {0x066B0200, 0, IPR_DEFAULT_LOG_LEVEL,
359 "9030: Array no longer protected due to missing or failed disk unit"}, 356 "9030: Array no longer protected due to missing or failed disk unit"},
360 {0x066B8000, 0, 1, 357 {0x066B8000, 0, IPR_DEFAULT_LOG_LEVEL,
361 "9071: Link operational transition"}, 358 "9071: Link operational transition"},
362 {0x066B8100, 0, 1, 359 {0x066B8100, 0, IPR_DEFAULT_LOG_LEVEL,
363 "9072: Link not operational transition"}, 360 "9072: Link not operational transition"},
364 {0x066B8200, 0, 1, 361 {0x066B8200, 0, IPR_DEFAULT_LOG_LEVEL,
365 "9032: Array exposed but still protected"}, 362 "9032: Array exposed but still protected"},
366 {0x066B9100, 0, 1, 363 {0x066B8300, 0, IPR_DEFAULT_LOG_LEVEL + 1,
364 "70DD: Device forced failed by disrupt device command"},
365 {0x066B9100, 0, IPR_DEFAULT_LOG_LEVEL,
367 "4061: Multipath redundancy level got better"}, 366 "4061: Multipath redundancy level got better"},
368 {0x066B9200, 0, 1, 367 {0x066B9200, 0, IPR_DEFAULT_LOG_LEVEL,
369 "4060: Multipath redundancy level got worse"}, 368 "4060: Multipath redundancy level got worse"},
370 {0x07270000, 0, 0, 369 {0x07270000, 0, 0,
371 "Failure due to other device"}, 370 "Failure due to other device"},
372 {0x07278000, 0, 1, 371 {0x07278000, 0, IPR_DEFAULT_LOG_LEVEL,
373 "9008: IOA does not support functions expected by devices"}, 372 "9008: IOA does not support functions expected by devices"},
374 {0x07278100, 0, 1, 373 {0x07278100, 0, IPR_DEFAULT_LOG_LEVEL,
375 "9010: Cache data associated with attached devices cannot be found"}, 374 "9010: Cache data associated with attached devices cannot be found"},
376 {0x07278200, 0, 1, 375 {0x07278200, 0, IPR_DEFAULT_LOG_LEVEL,
377 "9011: Cache data belongs to devices other than those attached"}, 376 "9011: Cache data belongs to devices other than those attached"},
378 {0x07278400, 0, 1, 377 {0x07278400, 0, IPR_DEFAULT_LOG_LEVEL,
379 "9020: Array missing 2 or more devices with only 1 device present"}, 378 "9020: Array missing 2 or more devices with only 1 device present"},
380 {0x07278500, 0, 1, 379 {0x07278500, 0, IPR_DEFAULT_LOG_LEVEL,
381 "9021: Array missing 2 or more devices with 2 or more devices present"}, 380 "9021: Array missing 2 or more devices with 2 or more devices present"},
382 {0x07278600, 0, 1, 381 {0x07278600, 0, IPR_DEFAULT_LOG_LEVEL,
383 "9022: Exposed array is missing a required device"}, 382 "9022: Exposed array is missing a required device"},
384 {0x07278700, 0, 1, 383 {0x07278700, 0, IPR_DEFAULT_LOG_LEVEL,
385 "9023: Array member(s) not at required physical locations"}, 384 "9023: Array member(s) not at required physical locations"},
386 {0x07278800, 0, 1, 385 {0x07278800, 0, IPR_DEFAULT_LOG_LEVEL,
387 "9024: Array not functional due to present hardware configuration"}, 386 "9024: Array not functional due to present hardware configuration"},
388 {0x07278900, 0, 1, 387 {0x07278900, 0, IPR_DEFAULT_LOG_LEVEL,
389 "9026: Array not functional due to present hardware configuration"}, 388 "9026: Array not functional due to present hardware configuration"},
390 {0x07278A00, 0, 1, 389 {0x07278A00, 0, IPR_DEFAULT_LOG_LEVEL,
391 "9027: Array is missing a device and parity is out of sync"}, 390 "9027: Array is missing a device and parity is out of sync"},
392 {0x07278B00, 0, 1, 391 {0x07278B00, 0, IPR_DEFAULT_LOG_LEVEL,
393 "9028: Maximum number of arrays already exist"}, 392 "9028: Maximum number of arrays already exist"},
394 {0x07278C00, 0, 1, 393 {0x07278C00, 0, IPR_DEFAULT_LOG_LEVEL,
395 "9050: Required cache data cannot be located for a disk unit"}, 394 "9050: Required cache data cannot be located for a disk unit"},
396 {0x07278D00, 0, 1, 395 {0x07278D00, 0, IPR_DEFAULT_LOG_LEVEL,
397 "9052: Cache data exists for a device that has been modified"}, 396 "9052: Cache data exists for a device that has been modified"},
398 {0x07278F00, 0, 1, 397 {0x07278F00, 0, IPR_DEFAULT_LOG_LEVEL,
399 "9054: IOA resources not available due to previous problems"}, 398 "9054: IOA resources not available due to previous problems"},
400 {0x07279100, 0, 1, 399 {0x07279100, 0, IPR_DEFAULT_LOG_LEVEL,
401 "9092: Disk unit requires initialization before use"}, 400 "9092: Disk unit requires initialization before use"},
402 {0x07279200, 0, 1, 401 {0x07279200, 0, IPR_DEFAULT_LOG_LEVEL,
403 "9029: Incorrect hardware configuration change has been detected"}, 402 "9029: Incorrect hardware configuration change has been detected"},
404 {0x07279600, 0, 1, 403 {0x07279600, 0, IPR_DEFAULT_LOG_LEVEL,
405 "9060: One or more disk pairs are missing from an array"}, 404 "9060: One or more disk pairs are missing from an array"},
406 {0x07279700, 0, 1, 405 {0x07279700, 0, IPR_DEFAULT_LOG_LEVEL,
407 "9061: One or more disks are missing from an array"}, 406 "9061: One or more disks are missing from an array"},
408 {0x07279800, 0, 1, 407 {0x07279800, 0, IPR_DEFAULT_LOG_LEVEL,
409 "9062: One or more disks are missing from an array"}, 408 "9062: One or more disks are missing from an array"},
410 {0x07279900, 0, 1, 409 {0x07279900, 0, IPR_DEFAULT_LOG_LEVEL,
411 "9063: Maximum number of functional arrays has been exceeded"}, 410 "9063: Maximum number of functional arrays has been exceeded"},
412 {0x0B260000, 0, 0, 411 {0x0B260000, 0, 0,
413 "Aborted command, invalid descriptor"}, 412 "Aborted command, invalid descriptor"},
@@ -481,12 +480,16 @@ static void ipr_reinit_ipr_cmnd(struct ipr_cmnd *ipr_cmd)
481{ 480{
482 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 481 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
483 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa; 482 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
483 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
484 484
485 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 485 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
486 ioarcb->write_data_transfer_length = 0; 486 ioarcb->write_data_transfer_length = 0;
487 ioarcb->read_data_transfer_length = 0; 487 ioarcb->read_data_transfer_length = 0;
488 ioarcb->write_ioadl_len = 0; 488 ioarcb->write_ioadl_len = 0;
489 ioarcb->read_ioadl_len = 0; 489 ioarcb->read_ioadl_len = 0;
490 ioarcb->write_ioadl_addr =
491 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
492 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
490 ioasa->ioasc = 0; 493 ioasa->ioasc = 0;
491 ioasa->residual_data_len = 0; 494 ioasa->residual_data_len = 0;
492 ioasa->u.gata.status = 0; 495 ioasa->u.gata.status = 0;
@@ -1610,7 +1613,7 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
1610 /* Set indication we have logged an error */ 1613 /* Set indication we have logged an error */
1611 ioa_cfg->errors_logged++; 1614 ioa_cfg->errors_logged++;
1612 1615
1613 if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL) 1616 if (ioa_cfg->log_level < ipr_error_table[error_index].log_hcam)
1614 return; 1617 return;
1615 if (be32_to_cpu(hostrcb->hcam.length) > sizeof(hostrcb->hcam.u.raw)) 1618 if (be32_to_cpu(hostrcb->hcam.length) > sizeof(hostrcb->hcam.u.raw))
1616 hostrcb->hcam.length = cpu_to_be32(sizeof(hostrcb->hcam.u.raw)); 1619 hostrcb->hcam.length = cpu_to_be32(sizeof(hostrcb->hcam.u.raw));
@@ -3850,6 +3853,8 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
3850 if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) { 3853 if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) {
3851 if (ipr_cmd->scsi_cmd) 3854 if (ipr_cmd->scsi_cmd)
3852 ipr_cmd->done = ipr_scsi_eh_done; 3855 ipr_cmd->done = ipr_scsi_eh_done;
3856 if (ipr_cmd->qc)
3857 ipr_cmd->done = ipr_sata_eh_done;
3853 if (ipr_cmd->qc && !(ipr_cmd->qc->flags & ATA_QCFLAG_FAILED)) { 3858 if (ipr_cmd->qc && !(ipr_cmd->qc->flags & ATA_QCFLAG_FAILED)) {
3854 ipr_cmd->qc->err_mask |= AC_ERR_TIMEOUT; 3859 ipr_cmd->qc->err_mask |= AC_ERR_TIMEOUT;
3855 ipr_cmd->qc->flags |= ATA_QCFLAG_FAILED; 3860 ipr_cmd->qc->flags |= ATA_QCFLAG_FAILED;
@@ -4230,6 +4235,14 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4230 4235
4231 sglist = scsi_cmd->request_buffer; 4236 sglist = scsi_cmd->request_buffer;
4232 4237
4238 if (ipr_cmd->dma_use_sg <= ARRAY_SIZE(ioarcb->add_data.u.ioadl)) {
4239 ioadl = ioarcb->add_data.u.ioadl;
4240 ioarcb->write_ioadl_addr =
4241 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4242 offsetof(struct ipr_ioarcb, add_data));
4243 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4244 }
4245
4233 for (i = 0; i < ipr_cmd->dma_use_sg; i++) { 4246 for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
4234 ioadl[i].flags_and_data_len = 4247 ioadl[i].flags_and_data_len =
4235 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i])); 4248 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i]));
@@ -4260,6 +4273,11 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4260 scsi_cmd->sc_data_direction); 4273 scsi_cmd->sc_data_direction);
4261 4274
4262 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) { 4275 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) {
4276 ioadl = ioarcb->add_data.u.ioadl;
4277 ioarcb->write_ioadl_addr =
4278 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4279 offsetof(struct ipr_ioarcb, add_data));
4280 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4263 ipr_cmd->dma_use_sg = 1; 4281 ipr_cmd->dma_use_sg = 1;
4264 ioadl[0].flags_and_data_len = 4282 ioadl[0].flags_and_data_len =
4265 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST); 4283 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST);
@@ -4346,11 +4364,9 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
4346 **/ 4364 **/
4347static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd) 4365static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4348{ 4366{
4349 struct ipr_ioarcb *ioarcb; 4367 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
4350 struct ipr_ioasa *ioasa; 4368 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
4351 4369 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
4352 ioarcb = &ipr_cmd->ioarcb;
4353 ioasa = &ipr_cmd->ioasa;
4354 4370
4355 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 4371 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
4356 ioarcb->write_data_transfer_length = 0; 4372 ioarcb->write_data_transfer_length = 0;
@@ -4359,6 +4375,9 @@ static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4359 ioarcb->read_ioadl_len = 0; 4375 ioarcb->read_ioadl_len = 0;
4360 ioasa->ioasc = 0; 4376 ioasa->ioasc = 0;
4361 ioasa->residual_data_len = 0; 4377 ioasa->residual_data_len = 0;
4378 ioarcb->write_ioadl_addr =
4379 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
4380 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4362} 4381}
4363 4382
4364/** 4383/**
@@ -4457,12 +4476,13 @@ static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
4457{ 4476{
4458 int i; 4477 int i;
4459 u16 data_len; 4478 u16 data_len;
4460 u32 ioasc; 4479 u32 ioasc, fd_ioasc;
4461 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa; 4480 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
4462 __be32 *ioasa_data = (__be32 *)ioasa; 4481 __be32 *ioasa_data = (__be32 *)ioasa;
4463 int error_index; 4482 int error_index;
4464 4483
4465 ioasc = be32_to_cpu(ioasa->ioasc) & IPR_IOASC_IOASC_MASK; 4484 ioasc = be32_to_cpu(ioasa->ioasc) & IPR_IOASC_IOASC_MASK;
4485 fd_ioasc = be32_to_cpu(ioasa->fd_ioasc) & IPR_IOASC_IOASC_MASK;
4466 4486
4467 if (0 == ioasc) 4487 if (0 == ioasc)
4468 return; 4488 return;
@@ -4470,13 +4490,19 @@ static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
4470 if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL) 4490 if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL)
4471 return; 4491 return;
4472 4492
4473 error_index = ipr_get_error(ioasc); 4493 if (ioasc == IPR_IOASC_BUS_WAS_RESET && fd_ioasc)
4494 error_index = ipr_get_error(fd_ioasc);
4495 else
4496 error_index = ipr_get_error(ioasc);
4474 4497
4475 if (ioa_cfg->log_level < IPR_MAX_LOG_LEVEL) { 4498 if (ioa_cfg->log_level < IPR_MAX_LOG_LEVEL) {
4476 /* Don't log an error if the IOA already logged one */ 4499 /* Don't log an error if the IOA already logged one */
4477 if (ioasa->ilid != 0) 4500 if (ioasa->ilid != 0)
4478 return; 4501 return;
4479 4502
4503 if (!ipr_is_gscsi(res))
4504 return;
4505
4480 if (ipr_error_table[error_index].log_ioasa == 0) 4506 if (ipr_error_table[error_index].log_ioasa == 0)
4481 return; 4507 return;
4482 } 4508 }
@@ -4636,11 +4662,11 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
4636 return; 4662 return;
4637 } 4663 }
4638 4664
4639 if (ipr_is_gscsi(res)) 4665 if (!ipr_is_gscsi(res))
4640 ipr_dump_ioasa(ioa_cfg, ipr_cmd, res);
4641 else
4642 ipr_gen_sense(ipr_cmd); 4666 ipr_gen_sense(ipr_cmd);
4643 4667
4668 ipr_dump_ioasa(ioa_cfg, ipr_cmd, res);
4669
4644 switch (ioasc & IPR_IOASC_IOASC_MASK) { 4670 switch (ioasc & IPR_IOASC_IOASC_MASK) {
4645 case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST: 4671 case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST:
4646 if (ipr_is_naca_model(res)) 4672 if (ipr_is_naca_model(res))
@@ -5121,7 +5147,7 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5121 struct ipr_ioarcb_ata_regs *regs; 5147 struct ipr_ioarcb_ata_regs *regs;
5122 5148
5123 if (unlikely(!ioa_cfg->allow_cmds || ioa_cfg->ioa_is_dead)) 5149 if (unlikely(!ioa_cfg->allow_cmds || ioa_cfg->ioa_is_dead))
5124 return -EIO; 5150 return AC_ERR_SYSTEM;
5125 5151
5126 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); 5152 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
5127 ioarcb = &ipr_cmd->ioarcb; 5153 ioarcb = &ipr_cmd->ioarcb;
@@ -5166,7 +5192,7 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5166 5192
5167 default: 5193 default:
5168 WARN_ON(1); 5194 WARN_ON(1);
5169 return -1; 5195 return AC_ERR_INVALID;
5170 } 5196 }
5171 5197
5172 mb(); 5198 mb();
@@ -6188,7 +6214,7 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd)
6188 dev_info(&ioa_cfg->pdev->dev, "Initializing IOA.\n"); 6214 dev_info(&ioa_cfg->pdev->dev, "Initializing IOA.\n");
6189 6215
6190 ipr_cmd->timer.data = (unsigned long) ipr_cmd; 6216 ipr_cmd->timer.data = (unsigned long) ipr_cmd;
6191 ipr_cmd->timer.expires = jiffies + (ipr_transop_timeout * HZ); 6217 ipr_cmd->timer.expires = jiffies + (ioa_cfg->transop_timeout * HZ);
6192 ipr_cmd->timer.function = (void (*)(unsigned long))ipr_oper_timeout; 6218 ipr_cmd->timer.function = (void (*)(unsigned long))ipr_oper_timeout;
6193 ipr_cmd->done = ipr_reset_ioa_job; 6219 ipr_cmd->done = ipr_reset_ioa_job;
6194 add_timer(&ipr_cmd->timer); 6220 add_timer(&ipr_cmd->timer);
@@ -6385,6 +6411,7 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd)
6385 rc = pci_write_config_byte(ioa_cfg->pdev, PCI_BIST, PCI_BIST_START); 6411 rc = pci_write_config_byte(ioa_cfg->pdev, PCI_BIST, PCI_BIST_START);
6386 6412
6387 if (rc != PCIBIOS_SUCCESSFUL) { 6413 if (rc != PCIBIOS_SUCCESSFUL) {
6414 pci_unblock_user_cfg_access(ipr_cmd->ioa_cfg->pdev);
6388 ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); 6415 ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
6389 rc = IPR_RC_JOB_CONTINUE; 6416 rc = IPR_RC_JOB_CONTINUE;
6390 } else { 6417 } else {
@@ -7117,8 +7144,6 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
7117 ioa_cfg->pdev = pdev; 7144 ioa_cfg->pdev = pdev;
7118 ioa_cfg->log_level = ipr_log_level; 7145 ioa_cfg->log_level = ipr_log_level;
7119 ioa_cfg->doorbell = IPR_DOORBELL; 7146 ioa_cfg->doorbell = IPR_DOORBELL;
7120 if (!ipr_auto_create)
7121 ioa_cfg->doorbell |= IPR_RUNTIME_RESET;
7122 sprintf(ioa_cfg->eye_catcher, IPR_EYECATCHER); 7147 sprintf(ioa_cfg->eye_catcher, IPR_EYECATCHER);
7123 sprintf(ioa_cfg->trace_start, IPR_TRACE_START_LABEL); 7148 sprintf(ioa_cfg->trace_start, IPR_TRACE_START_LABEL);
7124 sprintf(ioa_cfg->ipr_free_label, IPR_FREEQ_LABEL); 7149 sprintf(ioa_cfg->ipr_free_label, IPR_FREEQ_LABEL);
@@ -7233,6 +7258,13 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
7233 goto out_scsi_host_put; 7258 goto out_scsi_host_put;
7234 } 7259 }
7235 7260
7261 if (ipr_transop_timeout)
7262 ioa_cfg->transop_timeout = ipr_transop_timeout;
7263 else if (dev_id->driver_data & IPR_USE_LONG_TRANSOP_TIMEOUT)
7264 ioa_cfg->transop_timeout = IPR_LONG_OPERATIONAL_TIMEOUT;
7265 else
7266 ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT;
7267
7236 ipr_regs_pci = pci_resource_start(pdev, 0); 7268 ipr_regs_pci = pci_resource_start(pdev, 0);
7237 7269
7238 rc = pci_request_regions(pdev, IPR_NAME); 7270 rc = pci_request_regions(pdev, IPR_NAME);
@@ -7540,29 +7572,45 @@ static struct pci_device_id ipr_pci_table[] __devinitdata = {
7540 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, 7572 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
7541 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A, 0, 0, 0 }, 7573 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A, 0, 0, 0 },
7542 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, 7574 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
7543 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575B, 0, 0, 0 }, 7575 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575B, 0, 0,
7576 IPR_USE_LONG_TRANSOP_TIMEOUT },
7544 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, 7577 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
7545 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, 7578 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 },
7546 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, 7579 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
7547 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 }, 7580 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 },
7548 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, 7581 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
7549 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, 0 }, 7582 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0,
7583 IPR_USE_LONG_TRANSOP_TIMEOUT },
7550 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, 7584 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
7551 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, 7585 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 },
7552 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, 7586 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
7553 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 }, 7587 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 },
7554 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, 7588 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
7555 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, 0 }, 7589 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0,
7590 IPR_USE_LONG_TRANSOP_TIMEOUT },
7591 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E,
7592 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_574E, 0, 0, 0 },
7593 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E,
7594 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575D, 0, 0,
7595 IPR_USE_LONG_TRANSOP_TIMEOUT },
7596 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E,
7597 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B3, 0, 0, 0 },
7556 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, 7598 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E,
7557 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7, 0, 0, 0 }, 7599 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7, 0, 0,
7600 IPR_USE_LONG_TRANSOP_TIMEOUT },
7558 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, 7601 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE,
7559 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 0, 0, 0 }, 7602 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 0, 0, 0 },
7560 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, 7603 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
7561 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E, 0, 0, 0 }, 7604 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E, 0, 0, 0 },
7562 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, 7605 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
7563 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571F, 0, 0, 0 }, 7606 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571F, 0, 0,
7607 IPR_USE_LONG_TRANSOP_TIMEOUT },
7564 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, 7608 { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
7565 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572F, 0, 0, 0 }, 7609 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572F, 0, 0,
7610 IPR_USE_LONG_TRANSOP_TIMEOUT },
7611 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SCAMP_E,
7612 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_574D, 0, 0,
7613 IPR_USE_LONG_TRANSOP_TIMEOUT },
7566 { } 7614 { }
7567}; 7615};
7568MODULE_DEVICE_TABLE(pci, ipr_pci_table); 7616MODULE_DEVICE_TABLE(pci, ipr_pci_table);
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 88f285de97bb..bc53d7cebe0a 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -37,8 +37,8 @@
37/* 37/*
38 * Literals 38 * Literals
39 */ 39 */
40#define IPR_DRIVER_VERSION "2.3.1" 40#define IPR_DRIVER_VERSION "2.3.2"
41#define IPR_DRIVER_DATE "(January 23, 2007)" 41#define IPR_DRIVER_DATE "(March 23, 2007)"
42 42
43/* 43/*
44 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding 44 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -55,6 +55,7 @@
55#define IPR_NUM_BASE_CMD_BLKS 100 55#define IPR_NUM_BASE_CMD_BLKS 100
56 56
57#define PCI_DEVICE_ID_IBM_OBSIDIAN_E 0x0339 57#define PCI_DEVICE_ID_IBM_OBSIDIAN_E 0x0339
58#define PCI_DEVICE_ID_IBM_SCAMP_E 0x034A
58 59
59#define IPR_SUBS_DEV_ID_2780 0x0264 60#define IPR_SUBS_DEV_ID_2780 0x0264
60#define IPR_SUBS_DEV_ID_5702 0x0266 61#define IPR_SUBS_DEV_ID_5702 0x0266
@@ -69,8 +70,12 @@
69#define IPR_SUBS_DEV_ID_572A 0x02C1 70#define IPR_SUBS_DEV_ID_572A 0x02C1
70#define IPR_SUBS_DEV_ID_572B 0x02C2 71#define IPR_SUBS_DEV_ID_572B 0x02C2
71#define IPR_SUBS_DEV_ID_572F 0x02C3 72#define IPR_SUBS_DEV_ID_572F 0x02C3
73#define IPR_SUBS_DEV_ID_574D 0x030B
74#define IPR_SUBS_DEV_ID_574E 0x030A
72#define IPR_SUBS_DEV_ID_575B 0x030D 75#define IPR_SUBS_DEV_ID_575B 0x030D
73#define IPR_SUBS_DEV_ID_575C 0x0338 76#define IPR_SUBS_DEV_ID_575C 0x0338
77#define IPR_SUBS_DEV_ID_575D 0x033E
78#define IPR_SUBS_DEV_ID_57B3 0x033A
74#define IPR_SUBS_DEV_ID_57B7 0x0360 79#define IPR_SUBS_DEV_ID_57B7 0x0360
75#define IPR_SUBS_DEV_ID_57B8 0x02C2 80#define IPR_SUBS_DEV_ID_57B8 0x02C2
76 81
@@ -104,6 +109,9 @@
104#define IPR_IOASC_IOA_WAS_RESET 0x10000001 109#define IPR_IOASC_IOA_WAS_RESET 0x10000001
105#define IPR_IOASC_PCI_ACCESS_ERROR 0x10000002 110#define IPR_IOASC_PCI_ACCESS_ERROR 0x10000002
106 111
112/* Driver data flags */
113#define IPR_USE_LONG_TRANSOP_TIMEOUT 0x00000001
114
107#define IPR_DEFAULT_MAX_ERROR_DUMP 984 115#define IPR_DEFAULT_MAX_ERROR_DUMP 984
108#define IPR_NUM_LOG_HCAMS 2 116#define IPR_NUM_LOG_HCAMS 2
109#define IPR_NUM_CFG_CHG_HCAMS 2 117#define IPR_NUM_CFG_CHG_HCAMS 2
@@ -179,6 +187,7 @@
179#define IPR_SET_SUP_DEVICE_TIMEOUT (2 * 60 * HZ) 187#define IPR_SET_SUP_DEVICE_TIMEOUT (2 * 60 * HZ)
180#define IPR_REQUEST_SENSE_TIMEOUT (10 * HZ) 188#define IPR_REQUEST_SENSE_TIMEOUT (10 * HZ)
181#define IPR_OPERATIONAL_TIMEOUT (5 * 60) 189#define IPR_OPERATIONAL_TIMEOUT (5 * 60)
190#define IPR_LONG_OPERATIONAL_TIMEOUT (12 * 60)
182#define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ) 191#define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ)
183#define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10) 192#define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10)
184#define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ) 193#define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ)
@@ -413,9 +422,25 @@ struct ipr_ioarcb_ata_regs {
413 u8 ctl; 422 u8 ctl;
414}__attribute__ ((packed, aligned(4))); 423}__attribute__ ((packed, aligned(4)));
415 424
425struct ipr_ioadl_desc {
426 __be32 flags_and_data_len;
427#define IPR_IOADL_FLAGS_MASK 0xff000000
428#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
429#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff
430#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
431#define IPR_IOADL_FLAGS_READ 0x48000000
432#define IPR_IOADL_FLAGS_READ_LAST 0x49000000
433#define IPR_IOADL_FLAGS_WRITE 0x68000000
434#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000
435#define IPR_IOADL_FLAGS_LAST 0x01000000
436
437 __be32 address;
438}__attribute__((packed, aligned (8)));
439
416struct ipr_ioarcb_add_data { 440struct ipr_ioarcb_add_data {
417 union { 441 union {
418 struct ipr_ioarcb_ata_regs regs; 442 struct ipr_ioarcb_ata_regs regs;
443 struct ipr_ioadl_desc ioadl[5];
419 __be32 add_cmd_parms[10]; 444 __be32 add_cmd_parms[10];
420 }u; 445 }u;
421}__attribute__ ((packed, aligned(4))); 446}__attribute__ ((packed, aligned(4)));
@@ -447,21 +472,6 @@ struct ipr_ioarcb {
447 struct ipr_ioarcb_add_data add_data; 472 struct ipr_ioarcb_add_data add_data;
448}__attribute__((packed, aligned (4))); 473}__attribute__((packed, aligned (4)));
449 474
450struct ipr_ioadl_desc {
451 __be32 flags_and_data_len;
452#define IPR_IOADL_FLAGS_MASK 0xff000000
453#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
454#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff
455#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
456#define IPR_IOADL_FLAGS_READ 0x48000000
457#define IPR_IOADL_FLAGS_READ_LAST 0x49000000
458#define IPR_IOADL_FLAGS_WRITE 0x68000000
459#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000
460#define IPR_IOADL_FLAGS_LAST 0x01000000
461
462 __be32 address;
463}__attribute__((packed, aligned (8)));
464
465struct ipr_ioasa_vset { 475struct ipr_ioasa_vset {
466 __be32 failing_lba_hi; 476 __be32 failing_lba_hi;
467 __be32 failing_lba_lo; 477 __be32 failing_lba_lo;
@@ -1119,6 +1129,7 @@ struct ipr_ioa_cfg {
1119 1129
1120 struct ipr_bus_attributes bus_attr[IPR_MAX_NUM_BUSES]; 1130 struct ipr_bus_attributes bus_attr[IPR_MAX_NUM_BUSES];
1121 1131
1132 unsigned int transop_timeout;
1122 const struct ipr_chip_cfg_t *chip_cfg; 1133 const struct ipr_chip_cfg_t *chip_cfg;
1123 1134
1124 void __iomem *hdw_dma_regs; /* iomapped PCI memory space */ 1135 void __iomem *hdw_dma_regs; /* iomapped PCI memory space */
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 8f55e1431433..c9a3abf9e7b6 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -527,12 +527,12 @@ iscsi_tcp_hdr_recv(struct iscsi_conn *conn)
527 * than 8K, but there are no targets that currently do this. 527 * than 8K, but there are no targets that currently do this.
528 * For now we fail until we find a vendor that needs it 528 * For now we fail until we find a vendor that needs it
529 */ 529 */
530 if (DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH < 530 if (ISCSI_DEF_MAX_RECV_SEG_LEN <
531 tcp_conn->in.datalen) { 531 tcp_conn->in.datalen) {
532 printk(KERN_ERR "iscsi_tcp: received buffer of len %u " 532 printk(KERN_ERR "iscsi_tcp: received buffer of len %u "
533 "but conn buffer is only %u (opcode %0x)\n", 533 "but conn buffer is only %u (opcode %0x)\n",
534 tcp_conn->in.datalen, 534 tcp_conn->in.datalen,
535 DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, opcode); 535 ISCSI_DEF_MAX_RECV_SEG_LEN, opcode);
536 rc = ISCSI_ERR_PROTO; 536 rc = ISCSI_ERR_PROTO;
537 break; 537 break;
538 } 538 }
@@ -1762,7 +1762,7 @@ iscsi_tcp_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
1762 * due to strange issues with iser these are not set 1762 * due to strange issues with iser these are not set
1763 * in iscsi_conn_setup 1763 * in iscsi_conn_setup
1764 */ 1764 */
1765 conn->max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; 1765 conn->max_recv_dlength = ISCSI_DEF_MAX_RECV_SEG_LEN;
1766 1766
1767 tcp_conn = kzalloc(sizeof(*tcp_conn), GFP_KERNEL); 1767 tcp_conn = kzalloc(sizeof(*tcp_conn), GFP_KERNEL);
1768 if (!tcp_conn) 1768 if (!tcp_conn)
@@ -1777,14 +1777,24 @@ iscsi_tcp_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
1777 tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, 1777 tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0,
1778 CRYPTO_ALG_ASYNC); 1778 CRYPTO_ALG_ASYNC);
1779 tcp_conn->tx_hash.flags = 0; 1779 tcp_conn->tx_hash.flags = 0;
1780 if (IS_ERR(tcp_conn->tx_hash.tfm)) 1780 if (IS_ERR(tcp_conn->tx_hash.tfm)) {
1781 printk(KERN_ERR "Could not create connection due to crc32c "
1782 "loading error %ld. Make sure the crc32c module is "
1783 "built as a module or into the kernel\n",
1784 PTR_ERR(tcp_conn->tx_hash.tfm));
1781 goto free_tcp_conn; 1785 goto free_tcp_conn;
1786 }
1782 1787
1783 tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, 1788 tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0,
1784 CRYPTO_ALG_ASYNC); 1789 CRYPTO_ALG_ASYNC);
1785 tcp_conn->rx_hash.flags = 0; 1790 tcp_conn->rx_hash.flags = 0;
1786 if (IS_ERR(tcp_conn->rx_hash.tfm)) 1791 if (IS_ERR(tcp_conn->rx_hash.tfm)) {
1792 printk(KERN_ERR "Could not create connection due to crc32c "
1793 "loading error %ld. Make sure the crc32c module is "
1794 "built as a module or into the kernel\n",
1795 PTR_ERR(tcp_conn->rx_hash.tfm));
1787 goto free_tx_tfm; 1796 goto free_tx_tfm;
1797 }
1788 1798
1789 return cls_conn; 1799 return cls_conn;
1790 1800
@@ -2138,6 +2148,7 @@ static struct scsi_host_template iscsi_sht = {
2138 .change_queue_depth = iscsi_change_queue_depth, 2148 .change_queue_depth = iscsi_change_queue_depth,
2139 .can_queue = ISCSI_XMIT_CMDS_MAX - 1, 2149 .can_queue = ISCSI_XMIT_CMDS_MAX - 1,
2140 .sg_tablesize = ISCSI_SG_TABLESIZE, 2150 .sg_tablesize = ISCSI_SG_TABLESIZE,
2151 .max_sectors = 0xFFFF,
2141 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 2152 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
2142 .eh_abort_handler = iscsi_eh_abort, 2153 .eh_abort_handler = iscsi_eh_abort,
2143 .eh_host_reset_handler = iscsi_eh_host_reset, 2154 .eh_host_reset_handler = iscsi_eh_host_reset,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 7c75771c77ff..3f5b9b445b29 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -25,6 +25,7 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/kfifo.h> 26#include <linux/kfifo.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <asm/unaligned.h>
28#include <net/tcp.h> 29#include <net/tcp.h>
29#include <scsi/scsi_cmnd.h> 30#include <scsi/scsi_cmnd.h>
30#include <scsi/scsi_device.h> 31#include <scsi/scsi_device.h>
@@ -269,14 +270,14 @@ invalid_datalen:
269 goto out; 270 goto out;
270 } 271 }
271 272
272 senselen = be16_to_cpu(*(__be16 *)data); 273 senselen = be16_to_cpu(get_unaligned((__be16 *) data));
273 if (datalen < senselen) 274 if (datalen < senselen)
274 goto invalid_datalen; 275 goto invalid_datalen;
275 276
276 memcpy(sc->sense_buffer, data + 2, 277 memcpy(sc->sense_buffer, data + 2,
277 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); 278 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE));
278 debug_scsi("copied %d bytes of sense\n", 279 debug_scsi("copied %d bytes of sense\n",
279 min(senselen, SCSI_SENSE_BUFFERSIZE)); 280 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE));
280 } 281 }
281 282
282 if (sc->sc_data_direction == DMA_TO_DEVICE) 283 if (sc->sc_data_direction == DMA_TO_DEVICE)
@@ -577,7 +578,7 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err)
577} 578}
578EXPORT_SYMBOL_GPL(iscsi_conn_failure); 579EXPORT_SYMBOL_GPL(iscsi_conn_failure);
579 580
580static int iscsi_xmit_imm_task(struct iscsi_conn *conn) 581static int iscsi_xmit_mtask(struct iscsi_conn *conn)
581{ 582{
582 struct iscsi_hdr *hdr = conn->mtask->hdr; 583 struct iscsi_hdr *hdr = conn->mtask->hdr;
583 int rc, was_logout = 0; 584 int rc, was_logout = 0;
@@ -591,6 +592,9 @@ static int iscsi_xmit_imm_task(struct iscsi_conn *conn)
591 if (rc) 592 if (rc)
592 return rc; 593 return rc;
593 594
595 /* done with this in-progress mtask */
596 conn->mtask = NULL;
597
594 if (was_logout) { 598 if (was_logout) {
595 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); 599 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
596 return -ENODATA; 600 return -ENODATA;
@@ -643,11 +647,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
643 conn->ctask = NULL; 647 conn->ctask = NULL;
644 } 648 }
645 if (conn->mtask) { 649 if (conn->mtask) {
646 rc = iscsi_xmit_imm_task(conn); 650 rc = iscsi_xmit_mtask(conn);
647 if (rc) 651 if (rc)
648 goto again; 652 goto again;
649 /* done with this in-progress mtask */
650 conn->mtask = NULL;
651 } 653 }
652 654
653 /* process immediate first */ 655 /* process immediate first */
@@ -658,12 +660,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
658 list_add_tail(&conn->mtask->running, 660 list_add_tail(&conn->mtask->running,
659 &conn->mgmt_run_list); 661 &conn->mgmt_run_list);
660 spin_unlock_bh(&conn->session->lock); 662 spin_unlock_bh(&conn->session->lock);
661 rc = iscsi_xmit_imm_task(conn); 663 rc = iscsi_xmit_mtask(conn);
662 if (rc) 664 if (rc)
663 goto again; 665 goto again;
664 } 666 }
665 /* done with this mtask */
666 conn->mtask = NULL;
667 } 667 }
668 668
669 /* process command queue */ 669 /* process command queue */
@@ -701,12 +701,10 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
701 list_add_tail(&conn->mtask->running, 701 list_add_tail(&conn->mtask->running,
702 &conn->mgmt_run_list); 702 &conn->mgmt_run_list);
703 spin_unlock_bh(&conn->session->lock); 703 spin_unlock_bh(&conn->session->lock);
704 rc = tt->xmit_mgmt_task(conn, conn->mtask); 704 rc = iscsi_xmit_mtask(conn);
705 if (rc) 705 if (rc)
706 goto again; 706 goto again;
707 } 707 }
708 /* done with this mtask */
709 conn->mtask = NULL;
710 } 708 }
711 709
712 return -ENODATA; 710 return -ENODATA;
@@ -1523,7 +1521,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
1523 } 1521 }
1524 spin_unlock_bh(&session->lock); 1522 spin_unlock_bh(&session->lock);
1525 1523
1526 data = kmalloc(DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH, GFP_KERNEL); 1524 data = kmalloc(ISCSI_DEF_MAX_RECV_SEG_LEN, GFP_KERNEL);
1527 if (!data) 1525 if (!data)
1528 goto login_mtask_data_alloc_fail; 1526 goto login_mtask_data_alloc_fail;
1529 conn->login_mtask->data = conn->data = data; 1527 conn->login_mtask->data = conn->data = data;
@@ -1597,6 +1595,9 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
1597 wake_up(&conn->ehwait); 1595 wake_up(&conn->ehwait);
1598 } 1596 }
1599 1597
1598 /* flush queued up work because we free the connection below */
1599 scsi_flush_work(session->host);
1600
1600 spin_lock_bh(&session->lock); 1601 spin_lock_bh(&session->lock);
1601 kfree(conn->data); 1602 kfree(conn->data);
1602 kfree(conn->persistent_address); 1603 kfree(conn->persistent_address);
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index dc70c180e115..e34442e405e8 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/pci.h>
26#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
27 26
28#include "sas_internal.h" 27#include "sas_internal.h"
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 89403b00e042..5631c199a8eb 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -22,7 +22,6 @@
22#include <linux/kfifo.h> 22#include <linux/kfifo.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/pci.h>
26#include <scsi/scsi.h> 25#include <scsi/scsi.h>
27#include <scsi/scsi_cmnd.h> 26#include <scsi/scsi_cmnd.h>
28#include <scsi/scsi_tcq.h> 27#include <scsi/scsi_tcq.h>
@@ -225,8 +224,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
225 struct srp_direct_buf *md = NULL; 224 struct srp_direct_buf *md = NULL;
226 struct scatterlist dummy, *sg = NULL; 225 struct scatterlist dummy, *sg = NULL;
227 dma_addr_t token = 0; 226 dma_addr_t token = 0;
228 long err; 227 int err = 0;
229 unsigned int done = 0;
230 int nmd, nsg = 0, len; 228 int nmd, nsg = 0, len;
231 229
232 if (dma_map || ext_desc) { 230 if (dma_map || ext_desc) {
@@ -258,8 +256,8 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
258 sg_dma_address(&dummy) = token; 256 sg_dma_address(&dummy) = token;
259 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, 257 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE,
260 id->table_desc.len); 258 id->table_desc.len);
261 if (err < 0) { 259 if (err) {
262 eprintk("Error copying indirect table %ld\n", err); 260 eprintk("Error copying indirect table %d\n", err);
263 goto free_mem; 261 goto free_mem;
264 } 262 }
265 } else { 263 } else {
@@ -272,6 +270,7 @@ rdma:
272 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); 270 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL);
273 if (!nsg) { 271 if (!nsg) {
274 eprintk("fail to map %p %d\n", iue, sc->use_sg); 272 eprintk("fail to map %p %d\n", iue, sc->use_sg);
273 err = -EIO;
275 goto free_mem; 274 goto free_mem;
276 } 275 }
277 len = min(sc->request_bufflen, id->len); 276 len = min(sc->request_bufflen, id->len);
@@ -287,7 +286,7 @@ free_mem:
287 if (token && dma_map) 286 if (token && dma_map)
288 dma_free_coherent(iue->target->dev, id->table_desc.len, md, token); 287 dma_free_coherent(iue->target->dev, id->table_desc.len, md, token);
289 288
290 return done; 289 return err;
291} 290}
292 291
293static int data_out_desc_size(struct srp_cmd *cmd) 292static int data_out_desc_size(struct srp_cmd *cmd)
@@ -352,7 +351,7 @@ int srp_transfer_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
352 break; 351 break;
353 default: 352 default:
354 eprintk("Unknown format %d %x\n", dir, format); 353 eprintk("Unknown format %d %x\n", dir, format);
355 break; 354 err = -EINVAL;
356 } 355 }
357 356
358 return err; 357 return err;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 057fd7e0e379..dcf6106f557a 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -671,7 +671,7 @@ static int
671lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd, int len) 671lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd, int len)
672{ 672{
673 uint8_t lenlo, lenhi; 673 uint8_t lenlo, lenhi;
674 uint32_t Length; 674 int Length;
675 int i, j; 675 int i, j;
676 int finished = 0; 676 int finished = 0;
677 int index = 0; 677 int index = 0;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 0aa3304f6b9b..7fc6e06ea7e1 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2088,7 +2088,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
2088static inline int 2088static inline int
2089make_local_pdev(adapter_t *adapter, struct pci_dev **pdev) 2089make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
2090{ 2090{
2091 *pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 2091 *pdev = alloc_pci_dev();
2092 2092
2093 if( *pdev == NULL ) return -1; 2093 if( *pdev == NULL ) return -1;
2094 2094
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index a967fadb7439..08060fb478b6 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -87,6 +87,7 @@ MODULE_AUTHOR("Willem Riede");
87MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver"); 87MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver");
88MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
89MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR); 89MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR);
90MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);
90 91
91module_param(max_dev, int, 0444); 92module_param(max_dev, int, 0444);
92MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)"); 93MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)");
diff --git a/drivers/scsi/pci2000.h b/drivers/scsi/pci2000.h
deleted file mode 100644
index 0ebd8ce9e1de..000000000000
--- a/drivers/scsi/pci2000.h
+++ /dev/null
@@ -1,197 +0,0 @@
1/****************************************************************************
2 * Perceptive Solutions, Inc. PCI-2000 device driver for Linux.
3 *
4 * pci2000.h - Linux Host Driver for PCI-2000 IntelliCache SCSI Adapters
5 *
6 * Copyright (c) 1997-1999 Perceptive Solutions, Inc.
7 * All Rights Reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that redistributions of source
11 * code retain the above copyright notice and this comment without
12 * modification.
13 *
14 * Technical updates and product information at:
15 * http://www.psidisk.com
16 *
17 * Please send questions, comments, bug reports to:
18 * tech@psidisk.com Technical Support
19 *
20 ****************************************************************************/
21#ifndef _PCI2000_H
22#define _PCI2000_H
23
24#include <linux/types.h>
25
26#ifndef PSI_EIDE_SCSIOP
27#define PSI_EIDE_SCSIOP 1
28
29#define LINUXVERSION(v,p,s) (((v)<<16) + ((p)<<8) + (s))
30
31/************************************************/
32/* definition of standard data types */
33/************************************************/
34#define CHAR char
35#define UCHAR unsigned char
36#define SHORT short
37#define USHORT unsigned short
38#define BOOL long
39#define LONG long
40#define ULONG unsigned long
41#define VOID void
42
43typedef CHAR *PCHAR;
44typedef UCHAR *PUCHAR;
45typedef SHORT *PSHORT;
46typedef USHORT *PUSHORT;
47typedef BOOL *PBOOL;
48typedef LONG *PLONG;
49typedef ULONG *PULONG;
50typedef VOID *PVOID;
51
52
53/************************************************/
54/* Misc. macros */
55/************************************************/
56#define ANY2SCSI(up, p) \
57((UCHAR *)up)[0] = (((ULONG)(p)) >> 8); \
58((UCHAR *)up)[1] = ((ULONG)(p));
59
60#define SCSI2LONG(up) \
61( (((long)*(((UCHAR *)up))) << 16) \
62+ (((long)(((UCHAR *)up)[1])) << 8) \
63+ ((long)(((UCHAR *)up)[2])) )
64
65#define XANY2SCSI(up, p) \
66((UCHAR *)up)[0] = ((long)(p)) >> 24; \
67((UCHAR *)up)[1] = ((long)(p)) >> 16; \
68((UCHAR *)up)[2] = ((long)(p)) >> 8; \
69((UCHAR *)up)[3] = ((long)(p));
70
71#define XSCSI2LONG(up) \
72( (((long)(((UCHAR *)up)[0])) << 24) \
73+ (((long)(((UCHAR *)up)[1])) << 16) \
74+ (((long)(((UCHAR *)up)[2])) << 8) \
75+ ((long)(((UCHAR *)up)[3])) )
76
77/************************************************/
78/* SCSI CDB operation codes */
79/************************************************/
80#define SCSIOP_TEST_UNIT_READY 0x00
81#define SCSIOP_REZERO_UNIT 0x01
82#define SCSIOP_REWIND 0x01
83#define SCSIOP_REQUEST_BLOCK_ADDR 0x02
84#define SCSIOP_REQUEST_SENSE 0x03
85#define SCSIOP_FORMAT_UNIT 0x04
86#define SCSIOP_READ_BLOCK_LIMITS 0x05
87#define SCSIOP_REASSIGN_BLOCKS 0x07
88#define SCSIOP_READ6 0x08
89#define SCSIOP_RECEIVE 0x08
90#define SCSIOP_WRITE6 0x0A
91#define SCSIOP_PRINT 0x0A
92#define SCSIOP_SEND 0x0A
93#define SCSIOP_SEEK6 0x0B
94#define SCSIOP_TRACK_SELECT 0x0B
95#define SCSIOP_SLEW_PRINT 0x0B
96#define SCSIOP_SEEK_BLOCK 0x0C
97#define SCSIOP_PARTITION 0x0D
98#define SCSIOP_READ_REVERSE 0x0F
99#define SCSIOP_WRITE_FILEMARKS 0x10
100#define SCSIOP_FLUSH_BUFFER 0x10
101#define SCSIOP_SPACE 0x11
102#define SCSIOP_INQUIRY 0x12
103#define SCSIOP_VERIFY6 0x13
104#define SCSIOP_RECOVER_BUF_DATA 0x14
105#define SCSIOP_MODE_SELECT 0x15
106#define SCSIOP_RESERVE_UNIT 0x16
107#define SCSIOP_RELEASE_UNIT 0x17
108#define SCSIOP_COPY 0x18
109#define SCSIOP_ERASE 0x19
110#define SCSIOP_MODE_SENSE 0x1A
111#define SCSIOP_START_STOP_UNIT 0x1B
112#define SCSIOP_STOP_PRINT 0x1B
113#define SCSIOP_LOAD_UNLOAD 0x1B
114#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
115#define SCSIOP_SEND_DIAGNOSTIC 0x1D
116#define SCSIOP_MEDIUM_REMOVAL 0x1E
117#define SCSIOP_READ_CAPACITY 0x25
118#define SCSIOP_READ 0x28
119#define SCSIOP_WRITE 0x2A
120#define SCSIOP_SEEK 0x2B
121#define SCSIOP_LOCATE 0x2B
122#define SCSIOP_WRITE_VERIFY 0x2E
123#define SCSIOP_VERIFY 0x2F
124#define SCSIOP_SEARCH_DATA_HIGH 0x30
125#define SCSIOP_SEARCH_DATA_EQUAL 0x31
126#define SCSIOP_SEARCH_DATA_LOW 0x32
127#define SCSIOP_SET_LIMITS 0x33
128#define SCSIOP_READ_POSITION 0x34
129#define SCSIOP_SYNCHRONIZE_CACHE 0x35
130#define SCSIOP_COMPARE 0x39
131#define SCSIOP_COPY_COMPARE 0x3A
132#define SCSIOP_WRITE_DATA_BUFF 0x3B
133#define SCSIOP_READ_DATA_BUFF 0x3C
134#define SCSIOP_CHANGE_DEFINITION 0x40
135#define SCSIOP_READ_SUB_CHANNEL 0x42
136#define SCSIOP_READ_TOC 0x43
137#define SCSIOP_READ_HEADER 0x44
138#define SCSIOP_PLAY_AUDIO 0x45
139#define SCSIOP_PLAY_AUDIO_MSF 0x47
140#define SCSIOP_PLAY_TRACK_INDEX 0x48
141#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
142#define SCSIOP_PAUSE_RESUME 0x4B
143#define SCSIOP_LOG_SELECT 0x4C
144#define SCSIOP_LOG_SENSE 0x4D
145#define SCSIOP_MODE_SELECT10 0x55
146#define SCSIOP_MODE_SENSE10 0x5A
147#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
148#define SCSIOP_MECHANISM_STATUS 0xBD
149#define SCSIOP_READ_CD 0xBE
150
151// SCSI read capacity structure
152typedef struct _READ_CAPACITY_DATA
153 {
154 ULONG blks; /* total blocks (converted to little endian) */
155 ULONG blksiz; /* size of each (converted to little endian) */
156 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
157
158// SCSI inquiry data
159typedef struct _INQUIRYDATA
160 {
161 UCHAR DeviceType :5;
162 UCHAR DeviceTypeQualifier :3;
163 UCHAR DeviceTypeModifier :7;
164 UCHAR RemovableMedia :1;
165 UCHAR Versions;
166 UCHAR ResponseDataFormat;
167 UCHAR AdditionalLength;
168 UCHAR Reserved[2];
169 UCHAR SoftReset :1;
170 UCHAR CommandQueue :1;
171 UCHAR Reserved2 :1;
172 UCHAR LinkedCommands :1;
173 UCHAR Synchronous :1;
174 UCHAR Wide16Bit :1;
175 UCHAR Wide32Bit :1;
176 UCHAR RelativeAddressing :1;
177 UCHAR VendorId[8];
178 UCHAR ProductId[16];
179 UCHAR ProductRevisionLevel[4];
180 UCHAR VendorSpecific[20];
181 UCHAR Reserved3[40];
182 } INQUIRYDATA, *PINQUIRYDATA;
183
184#endif
185
186// function prototypes
187int Pci2000_Detect (struct scsi_host_template *tpnt);
188int Pci2000_Command (Scsi_Cmnd *SCpnt);
189int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
190int Pci2000_Abort (Scsi_Cmnd *SCpnt);
191int Pci2000_Reset (Scsi_Cmnd *SCpnt, unsigned int flags);
192int Pci2000_Release (struct Scsi_Host *pshost);
193int Pci2000_BiosParam (struct scsi_device *sdev,
194 struct block_device *bdev,
195 sector_t capacity, int geom[]);
196
197#endif
diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
index eac8e179cfff..7dd787f6ab27 100644
--- a/drivers/scsi/pcmcia/Kconfig
+++ b/drivers/scsi/pcmcia/Kconfig
@@ -3,11 +3,11 @@
3# 3#
4 4
5menu "PCMCIA SCSI adapter support" 5menu "PCMCIA SCSI adapter support"
6 depends on SCSI!=n && PCMCIA!=n && MODULES 6 depends on SCSI!=n && PCMCIA!=n
7 7
8config PCMCIA_AHA152X 8config PCMCIA_AHA152X
9 tristate "Adaptec AHA152X PCMCIA support" 9 tristate "Adaptec AHA152X PCMCIA support"
10 depends on m && !64BIT 10 depends on !64BIT
11 select SCSI_SPI_ATTRS 11 select SCSI_SPI_ATTRS
12 help 12 help
13 Say Y here if you intend to attach this type of PCMCIA SCSI host 13 Say Y here if you intend to attach this type of PCMCIA SCSI host
@@ -18,7 +18,6 @@ config PCMCIA_AHA152X
18 18
19config PCMCIA_FDOMAIN 19config PCMCIA_FDOMAIN
20 tristate "Future Domain PCMCIA support" 20 tristate "Future Domain PCMCIA support"
21 depends on m
22 help 21 help
23 Say Y here if you intend to attach this type of PCMCIA SCSI host 22 Say Y here if you intend to attach this type of PCMCIA SCSI host
24 adapter to your computer. 23 adapter to your computer.
@@ -28,7 +27,7 @@ config PCMCIA_FDOMAIN
28 27
29config PCMCIA_NINJA_SCSI 28config PCMCIA_NINJA_SCSI
30 tristate "NinjaSCSI-3 / NinjaSCSI-32Bi (16bit) PCMCIA support" 29 tristate "NinjaSCSI-3 / NinjaSCSI-32Bi (16bit) PCMCIA support"
31 depends on m && !64BIT 30 depends on !64BIT
32 help 31 help
33 If you intend to attach this type of PCMCIA SCSI host adapter to 32 If you intend to attach this type of PCMCIA SCSI host adapter to
34 your computer, say Y here and read 33 your computer, say Y here and read
@@ -62,7 +61,6 @@ config PCMCIA_NINJA_SCSI
62 61
63config PCMCIA_QLOGIC 62config PCMCIA_QLOGIC
64 tristate "Qlogic PCMCIA support" 63 tristate "Qlogic PCMCIA support"
65 depends on m
66 help 64 help
67 Say Y here if you intend to attach this type of PCMCIA SCSI host 65 Say Y here if you intend to attach this type of PCMCIA SCSI host
68 adapter to your computer. 66 adapter to your computer.
@@ -72,7 +70,6 @@ config PCMCIA_QLOGIC
72 70
73config PCMCIA_SYM53C500 71config PCMCIA_SYM53C500
74 tristate "Symbios 53c500 PCMCIA support" 72 tristate "Symbios 53c500 PCMCIA support"
75 depends on m
76 help 73 help
77 Say Y here if you have a New Media Bus Toaster or other PCMCIA 74 Say Y here if you have a New Media Bus Toaster or other PCMCIA
78 SCSI adapter based on the Symbios 53c500 controller. 75 SCSI adapter based on the Symbios 53c500 controller.
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 05f4f2a378eb..e8948b679f5b 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1478,14 +1478,17 @@ typedef union {
1478 uint32_t b24 : 24; 1478 uint32_t b24 : 24;
1479 1479
1480 struct { 1480 struct {
1481 uint8_t d_id[3]; 1481#ifdef __BIG_ENDIAN
1482 uint8_t rsvd_1; 1482 uint8_t domain;
1483 } r; 1483 uint8_t area;
1484 1484 uint8_t al_pa;
1485 struct { 1485#elif __LITTLE_ENDIAN
1486 uint8_t al_pa; 1486 uint8_t al_pa;
1487 uint8_t area; 1487 uint8_t area;
1488 uint8_t domain; 1488 uint8_t domain;
1489#else
1490#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!"
1491#endif
1489 uint8_t rsvd_1; 1492 uint8_t rsvd_1;
1490 } b; 1493 } b;
1491} port_id_t; 1494} port_id_t;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 98c01cd5e1a8..3e296ab845b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -11,6 +11,11 @@
11 11
12#include "qla_devtbl.h" 12#include "qla_devtbl.h"
13 13
14#ifdef CONFIG_SPARC
15#include <asm/prom.h>
16#include <asm/pbm.h>
17#endif
18
14/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */ 19/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */
15#ifndef EXT_IS_LUN_BIT_SET 20#ifndef EXT_IS_LUN_BIT_SET
16#define EXT_IS_LUN_BIT_SET(P,L) \ 21#define EXT_IS_LUN_BIT_SET(P,L) \
@@ -88,12 +93,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
88 93
89 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n"); 94 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
90 95
91 rval = ha->isp_ops.nvram_config(ha); 96 ha->isp_ops.nvram_config(ha);
92 if (rval) {
93 DEBUG2(printk("scsi(%ld): Unable to verify NVRAM data.\n",
94 ha->host_no));
95 return rval;
96 }
97 97
98 if (ha->flags.disable_serdes) { 98 if (ha->flags.disable_serdes) {
99 /* Mask HBA via NVRAM settings? */ 99 /* Mask HBA via NVRAM settings? */
@@ -1393,6 +1393,28 @@ qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *de
1393 } 1393 }
1394} 1394}
1395 1395
1396/* On sparc systems, obtain port and node WWN from firmware
1397 * properties.
1398 */
1399static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t *ha, nvram_t *nv)
1400{
1401#ifdef CONFIG_SPARC
1402 struct pci_dev *pdev = ha->pdev;
1403 struct pcidev_cookie *pcp = pdev->sysdata;
1404 struct device_node *dp = pcp->prom_node;
1405 u8 *val;
1406 int len;
1407
1408 val = of_get_property(dp, "port-wwn", &len);
1409 if (val && len >= WWN_SIZE)
1410 memcpy(nv->port_name, val, WWN_SIZE);
1411
1412 val = of_get_property(dp, "node-wwn", &len);
1413 if (val && len >= WWN_SIZE)
1414 memcpy(nv->node_name, val, WWN_SIZE);
1415#endif
1416}
1417
1396/* 1418/*
1397* NVRAM configuration for ISP 2xxx 1419* NVRAM configuration for ISP 2xxx
1398* 1420*
@@ -1409,6 +1431,7 @@ qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *de
1409int 1431int
1410qla2x00_nvram_config(scsi_qla_host_t *ha) 1432qla2x00_nvram_config(scsi_qla_host_t *ha)
1411{ 1433{
1434 int rval;
1412 uint8_t chksum = 0; 1435 uint8_t chksum = 0;
1413 uint16_t cnt; 1436 uint16_t cnt;
1414 uint8_t *dptr1, *dptr2; 1437 uint8_t *dptr1, *dptr2;
@@ -1417,6 +1440,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1417 uint8_t *ptr = (uint8_t *)ha->request_ring; 1440 uint8_t *ptr = (uint8_t *)ha->request_ring;
1418 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 1441 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1419 1442
1443 rval = QLA_SUCCESS;
1444
1420 /* Determine NVRAM starting address. */ 1445 /* Determine NVRAM starting address. */
1421 ha->nvram_size = sizeof(nvram_t); 1446 ha->nvram_size = sizeof(nvram_t);
1422 ha->nvram_base = 0; 1447 ha->nvram_base = 0;
@@ -1440,7 +1465,57 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1440 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " 1465 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
1441 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0], 1466 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
1442 nv->nvram_version); 1467 nv->nvram_version);
1443 return QLA_FUNCTION_FAILED; 1468 qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet "
1469 "invalid -- WWPN) defaults.\n");
1470
1471 /*
1472 * Set default initialization control block.
1473 */
1474 memset(nv, 0, ha->nvram_size);
1475 nv->parameter_block_version = ICB_VERSION;
1476
1477 if (IS_QLA23XX(ha)) {
1478 nv->firmware_options[0] = BIT_2 | BIT_1;
1479 nv->firmware_options[1] = BIT_7 | BIT_5;
1480 nv->add_firmware_options[0] = BIT_5;
1481 nv->add_firmware_options[1] = BIT_5 | BIT_4;
1482 nv->frame_payload_size = __constant_cpu_to_le16(2048);
1483 nv->special_options[1] = BIT_7;
1484 } else if (IS_QLA2200(ha)) {
1485 nv->firmware_options[0] = BIT_2 | BIT_1;
1486 nv->firmware_options[1] = BIT_7 | BIT_5;
1487 nv->add_firmware_options[0] = BIT_5;
1488 nv->add_firmware_options[1] = BIT_5 | BIT_4;
1489 nv->frame_payload_size = __constant_cpu_to_le16(1024);
1490 } else if (IS_QLA2100(ha)) {
1491 nv->firmware_options[0] = BIT_3 | BIT_1;
1492 nv->firmware_options[1] = BIT_5;
1493 nv->frame_payload_size = __constant_cpu_to_le16(1024);
1494 }
1495
1496 nv->max_iocb_allocation = __constant_cpu_to_le16(256);
1497 nv->execution_throttle = __constant_cpu_to_le16(16);
1498 nv->retry_count = 8;
1499 nv->retry_delay = 1;
1500
1501 nv->port_name[0] = 33;
1502 nv->port_name[3] = 224;
1503 nv->port_name[4] = 139;
1504
1505 qla2xxx_nvram_wwn_from_ofw(ha, nv);
1506
1507 nv->login_timeout = 4;
1508
1509 /*
1510 * Set default host adapter parameters
1511 */
1512 nv->host_p[1] = BIT_2;
1513 nv->reset_delay = 5;
1514 nv->port_down_retry_count = 8;
1515 nv->max_luns_per_target = __constant_cpu_to_le16(8);
1516 nv->link_down_timeout = 60;
1517
1518 rval = 1;
1444 } 1519 }
1445 1520
1446#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 1521#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
@@ -1653,7 +1728,11 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1653 } 1728 }
1654 } 1729 }
1655 1730
1656 return QLA_SUCCESS; 1731 if (rval) {
1732 DEBUG2_3(printk(KERN_WARNING
1733 "scsi(%ld): NVRAM configuration failed!\n", ha->host_no));
1734 }
1735 return (rval);
1657} 1736}
1658 1737
1659static void 1738static void
@@ -3071,9 +3150,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3071 3150
3072 ha->isp_ops.get_flash_version(ha, ha->request_ring); 3151 ha->isp_ops.get_flash_version(ha, ha->request_ring);
3073 3152
3074 rval = ha->isp_ops.nvram_config(ha); 3153 ha->isp_ops.nvram_config(ha);
3075 if (rval)
3076 goto isp_abort_retry;
3077 3154
3078 if (!qla2x00_restart_isp(ha)) { 3155 if (!qla2x00_restart_isp(ha)) {
3079 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 3156 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
@@ -3103,7 +3180,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3103 } 3180 }
3104 } 3181 }
3105 } else { /* failed the ISP abort */ 3182 } else { /* failed the ISP abort */
3106isp_abort_retry:
3107 ha->flags.online = 1; 3183 ha->flags.online = 1;
3108 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { 3184 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) {
3109 if (ha->isp_abort_cnt == 0) { 3185 if (ha->isp_abort_cnt == 0) {
@@ -3290,9 +3366,32 @@ qla24xx_reset_adapter(scsi_qla_host_t *ha)
3290 spin_unlock_irqrestore(&ha->hardware_lock, flags); 3366 spin_unlock_irqrestore(&ha->hardware_lock, flags);
3291} 3367}
3292 3368
3369/* On sparc systems, obtain port and node WWN from firmware
3370 * properties.
3371 */
3372static void qla24xx_nvram_wwn_from_ofw(scsi_qla_host_t *ha, struct nvram_24xx *nv)
3373{
3374#ifdef CONFIG_SPARC
3375 struct pci_dev *pdev = ha->pdev;
3376 struct pcidev_cookie *pcp = pdev->sysdata;
3377 struct device_node *dp = pcp->prom_node;
3378 u8 *val;
3379 int len;
3380
3381 val = of_get_property(dp, "port-wwn", &len);
3382 if (val && len >= WWN_SIZE)
3383 memcpy(nv->port_name, val, WWN_SIZE);
3384
3385 val = of_get_property(dp, "node-wwn", &len);
3386 if (val && len >= WWN_SIZE)
3387 memcpy(nv->node_name, val, WWN_SIZE);
3388#endif
3389}
3390
3293int 3391int
3294qla24xx_nvram_config(scsi_qla_host_t *ha) 3392qla24xx_nvram_config(scsi_qla_host_t *ha)
3295{ 3393{
3394 int rval;
3296 struct init_cb_24xx *icb; 3395 struct init_cb_24xx *icb;
3297 struct nvram_24xx *nv; 3396 struct nvram_24xx *nv;
3298 uint32_t *dptr; 3397 uint32_t *dptr;
@@ -3300,6 +3399,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3300 uint32_t chksum; 3399 uint32_t chksum;
3301 uint16_t cnt; 3400 uint16_t cnt;
3302 3401
3402 rval = QLA_SUCCESS;
3303 icb = (struct init_cb_24xx *)ha->init_cb; 3403 icb = (struct init_cb_24xx *)ha->init_cb;
3304 nv = (struct nvram_24xx *)ha->request_ring; 3404 nv = (struct nvram_24xx *)ha->request_ring;
3305 3405
@@ -3332,7 +3432,52 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3332 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " 3432 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
3333 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0], 3433 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
3334 le16_to_cpu(nv->nvram_version)); 3434 le16_to_cpu(nv->nvram_version));
3335 return QLA_FUNCTION_FAILED; 3435 qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet "
3436 "invalid -- WWPN) defaults.\n");
3437
3438 /*
3439 * Set default initialization control block.
3440 */
3441 memset(nv, 0, ha->nvram_size);
3442 nv->nvram_version = __constant_cpu_to_le16(ICB_VERSION);
3443 nv->version = __constant_cpu_to_le16(ICB_VERSION);
3444 nv->frame_payload_size = __constant_cpu_to_le16(2048);
3445 nv->execution_throttle = __constant_cpu_to_le16(0xFFFF);
3446 nv->exchange_count = __constant_cpu_to_le16(0);
3447 nv->hard_address = __constant_cpu_to_le16(124);
3448 nv->port_name[0] = 0x21;
3449 nv->port_name[1] = 0x00 + PCI_FUNC(ha->pdev->devfn);
3450 nv->port_name[2] = 0x00;
3451 nv->port_name[3] = 0xe0;
3452 nv->port_name[4] = 0x8b;
3453 nv->port_name[5] = 0x1c;
3454 nv->port_name[6] = 0x55;
3455 nv->port_name[7] = 0x86;
3456 nv->node_name[0] = 0x20;
3457 nv->node_name[1] = 0x00;
3458 nv->node_name[2] = 0x00;
3459 nv->node_name[3] = 0xe0;
3460 nv->node_name[4] = 0x8b;
3461 nv->node_name[5] = 0x1c;
3462 nv->node_name[6] = 0x55;
3463 nv->node_name[7] = 0x86;
3464 qla24xx_nvram_wwn_from_ofw(ha, nv);
3465 nv->login_retry_count = __constant_cpu_to_le16(8);
3466 nv->interrupt_delay_timer = __constant_cpu_to_le16(0);
3467 nv->login_timeout = __constant_cpu_to_le16(0);
3468 nv->firmware_options_1 =
3469 __constant_cpu_to_le32(BIT_14|BIT_13|BIT_2|BIT_1);
3470 nv->firmware_options_2 = __constant_cpu_to_le32(2 << 4);
3471 nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_12);
3472 nv->firmware_options_3 = __constant_cpu_to_le32(2 << 13);
3473 nv->host_p = __constant_cpu_to_le32(BIT_11|BIT_10);
3474 nv->efi_parameters = __constant_cpu_to_le32(0);
3475 nv->reset_delay = 5;
3476 nv->max_luns_per_target = __constant_cpu_to_le16(128);
3477 nv->port_down_retry_count = __constant_cpu_to_le16(30);
3478 nv->link_down_timeout = __constant_cpu_to_le16(30);
3479
3480 rval = 1;
3336 } 3481 }
3337 3482
3338 /* Reset Initialization control block */ 3483 /* Reset Initialization control block */
@@ -3479,7 +3624,11 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3479 ha->flags.process_response_queue = 1; 3624 ha->flags.process_response_queue = 1;
3480 } 3625 }
3481 3626
3482 return QLA_SUCCESS; 3627 if (rval) {
3628 DEBUG2_3(printk(KERN_WARNING
3629 "scsi(%ld): NVRAM configuration failed!\n", ha->host_no));
3630 }
3631 return (rval);
3483} 3632}
3484 3633
3485static int 3634static int
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 83376f6ac3db..71e32a248528 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -1280,14 +1280,14 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name,
1280 } else { 1280 } else {
1281 if (name != NULL) { 1281 if (name != NULL) {
1282 /* This function returns name in big endian. */ 1282 /* This function returns name in big endian. */
1283 name[0] = LSB(mcp->mb[2]); 1283 name[0] = MSB(mcp->mb[2]);
1284 name[1] = MSB(mcp->mb[2]); 1284 name[1] = LSB(mcp->mb[2]);
1285 name[2] = LSB(mcp->mb[3]); 1285 name[2] = MSB(mcp->mb[3]);
1286 name[3] = MSB(mcp->mb[3]); 1286 name[3] = LSB(mcp->mb[3]);
1287 name[4] = LSB(mcp->mb[6]); 1287 name[4] = MSB(mcp->mb[6]);
1288 name[5] = MSB(mcp->mb[6]); 1288 name[5] = LSB(mcp->mb[6]);
1289 name[6] = LSB(mcp->mb[7]); 1289 name[6] = MSB(mcp->mb[7]);
1290 name[7] = MSB(mcp->mb[7]); 1290 name[7] = LSB(mcp->mb[7]);
1291 } 1291 }
1292 1292
1293 DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n", 1293 DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n",
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 68f5d24b938b..b78919a318e2 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(ql2xallocfwdump,
62 "vary by ISP type. Default is 1 - allocate memory."); 62 "vary by ISP type. Default is 1 - allocate memory.");
63 63
64int ql2xextended_error_logging; 64int ql2xextended_error_logging;
65module_param(ql2xextended_error_logging, int, S_IRUGO|S_IRUSR); 65module_param(ql2xextended_error_logging, int, S_IRUGO|S_IWUSR);
66MODULE_PARM_DESC(ql2xextended_error_logging, 66MODULE_PARM_DESC(ql2xextended_error_logging,
67 "Option to enable extended error logging, " 67 "Option to enable extended error logging, "
68 "Default is 0 - no logging. 1 - log errors."); 68 "Default is 0 - no logging. 1 - log errors.");
@@ -157,6 +157,8 @@ static struct scsi_host_template qla24xx_driver_template = {
157 157
158 .slave_alloc = qla2xxx_slave_alloc, 158 .slave_alloc = qla2xxx_slave_alloc,
159 .slave_destroy = qla2xxx_slave_destroy, 159 .slave_destroy = qla2xxx_slave_destroy,
160 .scan_finished = qla2xxx_scan_finished,
161 .scan_start = qla2xxx_scan_start,
160 .change_queue_depth = qla2x00_change_queue_depth, 162 .change_queue_depth = qla2x00_change_queue_depth,
161 .change_queue_type = qla2x00_change_queue_type, 163 .change_queue_type = qla2x00_change_queue_type,
162 .this_id = -1, 164 .this_id = -1,
@@ -1705,6 +1707,7 @@ qla2x00_remove_one(struct pci_dev *pdev)
1705 1707
1706 scsi_host_put(ha->host); 1708 scsi_host_put(ha->host);
1707 1709
1710 pci_disable_device(pdev);
1708 pci_set_drvdata(pdev, NULL); 1711 pci_set_drvdata(pdev, NULL);
1709} 1712}
1710 1713
@@ -1747,8 +1750,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1747 if (ha->iobase) 1750 if (ha->iobase)
1748 iounmap(ha->iobase); 1751 iounmap(ha->iobase);
1749 pci_release_regions(ha->pdev); 1752 pci_release_regions(ha->pdev);
1750
1751 pci_disable_device(ha->pdev);
1752} 1753}
1753 1754
1754static inline void 1755static inline void
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index ff1dd4175a7f..206bda093da2 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -466,6 +466,7 @@ qla24xx_read_flash_dword(scsi_qla_host_t *ha, uint32_t addr)
466 udelay(10); 466 udelay(10);
467 else 467 else
468 rval = QLA_FUNCTION_TIMEOUT; 468 rval = QLA_FUNCTION_TIMEOUT;
469 cond_resched();
469 } 470 }
470 471
471 /* TODO: What happens if we time out? */ 472 /* TODO: What happens if we time out? */
@@ -508,6 +509,7 @@ qla24xx_write_flash_dword(scsi_qla_host_t *ha, uint32_t addr, uint32_t data)
508 udelay(10); 509 udelay(10);
509 else 510 else
510 rval = QLA_FUNCTION_TIMEOUT; 511 rval = QLA_FUNCTION_TIMEOUT;
512 cond_resched();
511 } 513 }
512 return rval; 514 return rval;
513} 515}
@@ -1255,6 +1257,7 @@ qla2x00_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data,
1255 } 1257 }
1256 udelay(10); 1258 udelay(10);
1257 barrier(); 1259 barrier();
1260 cond_resched();
1258 } 1261 }
1259 return status; 1262 return status;
1260} 1263}
@@ -1403,6 +1406,7 @@ qla2x00_read_flash_data(scsi_qla_host_t *ha, uint8_t *tmp_buf, uint32_t saddr,
1403 if (saddr % 100) 1406 if (saddr % 100)
1404 udelay(10); 1407 udelay(10);
1405 *tmp_buf = data; 1408 *tmp_buf = data;
1409 cond_resched();
1406 } 1410 }
1407} 1411}
1408 1412
@@ -1449,7 +1453,6 @@ uint8_t *
1449qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf, 1453qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1450 uint32_t offset, uint32_t length) 1454 uint32_t offset, uint32_t length)
1451{ 1455{
1452 unsigned long flags;
1453 uint32_t addr, midpoint; 1456 uint32_t addr, midpoint;
1454 uint8_t *data; 1457 uint8_t *data;
1455 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 1458 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
@@ -1458,7 +1461,6 @@ qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1458 qla2x00_suspend_hba(ha); 1461 qla2x00_suspend_hba(ha);
1459 1462
1460 /* Go with read. */ 1463 /* Go with read. */
1461 spin_lock_irqsave(&ha->hardware_lock, flags);
1462 midpoint = ha->optrom_size / 2; 1464 midpoint = ha->optrom_size / 2;
1463 1465
1464 qla2x00_flash_enable(ha); 1466 qla2x00_flash_enable(ha);
@@ -1473,7 +1475,6 @@ qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1473 *data = qla2x00_read_flash_byte(ha, addr); 1475 *data = qla2x00_read_flash_byte(ha, addr);
1474 } 1476 }
1475 qla2x00_flash_disable(ha); 1477 qla2x00_flash_disable(ha);
1476 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1477 1478
1478 /* Resume HBA. */ 1479 /* Resume HBA. */
1479 qla2x00_resume_hba(ha); 1480 qla2x00_resume_hba(ha);
@@ -1487,7 +1488,6 @@ qla2x00_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1487{ 1488{
1488 1489
1489 int rval; 1490 int rval;
1490 unsigned long flags;
1491 uint8_t man_id, flash_id, sec_number, data; 1491 uint8_t man_id, flash_id, sec_number, data;
1492 uint16_t wd; 1492 uint16_t wd;
1493 uint32_t addr, liter, sec_mask, rest_addr; 1493 uint32_t addr, liter, sec_mask, rest_addr;
@@ -1500,7 +1500,6 @@ qla2x00_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1500 sec_number = 0; 1500 sec_number = 0;
1501 1501
1502 /* Reset ISP chip. */ 1502 /* Reset ISP chip. */
1503 spin_lock_irqsave(&ha->hardware_lock, flags);
1504 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET); 1503 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
1505 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd); 1504 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
1506 1505
@@ -1689,10 +1688,10 @@ update_flash:
1689 rval = QLA_FUNCTION_FAILED; 1688 rval = QLA_FUNCTION_FAILED;
1690 break; 1689 break;
1691 } 1690 }
1691 cond_resched();
1692 } 1692 }
1693 } while (0); 1693 } while (0);
1694 qla2x00_flash_disable(ha); 1694 qla2x00_flash_disable(ha);
1695 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1696 1695
1697 /* Resume HBA. */ 1696 /* Resume HBA. */
1698 qla2x00_resume_hba(ha); 1697 qla2x00_resume_hba(ha);
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 61347aee55ce..dc85495c337f 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.01.07-k5" 10#define QLA2XXX_VERSION "8.01.07-k6"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 1 13#define QLA_DRIVER_MINOR_VER 1
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1c89ee3e69ba..4c1e31334765 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -344,7 +344,6 @@ void scsi_destroy_command_freelist(struct Scsi_Host *shost)
344void scsi_log_send(struct scsi_cmnd *cmd) 344void scsi_log_send(struct scsi_cmnd *cmd)
345{ 345{
346 unsigned int level; 346 unsigned int level;
347 struct scsi_device *sdev;
348 347
349 /* 348 /*
350 * If ML QUEUE log level is greater than or equal to: 349 * If ML QUEUE log level is greater than or equal to:
@@ -361,22 +360,17 @@ void scsi_log_send(struct scsi_cmnd *cmd)
361 level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT, 360 level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT,
362 SCSI_LOG_MLQUEUE_BITS); 361 SCSI_LOG_MLQUEUE_BITS);
363 if (level > 1) { 362 if (level > 1) {
364 sdev = cmd->device; 363 scmd_printk(KERN_INFO, cmd, "Send: ");
365 sdev_printk(KERN_INFO, sdev, "send ");
366 if (level > 2) 364 if (level > 2)
367 printk("0x%p ", cmd); 365 printk("0x%p ", cmd);
368 /* 366 printk("\n");
369 * spaces to match disposition and cmd->result
370 * output in scsi_log_completion.
371 */
372 printk(" ");
373 scsi_print_command(cmd); 367 scsi_print_command(cmd);
374 if (level > 3) { 368 if (level > 3) {
375 printk(KERN_INFO "buffer = 0x%p, bufflen = %d," 369 printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
376 " done = 0x%p, queuecommand 0x%p\n", 370 " done = 0x%p, queuecommand 0x%p\n",
377 cmd->request_buffer, cmd->request_bufflen, 371 cmd->request_buffer, cmd->request_bufflen,
378 cmd->done, 372 cmd->done,
379 sdev->host->hostt->queuecommand); 373 cmd->device->host->hostt->queuecommand);
380 374
381 } 375 }
382 } 376 }
@@ -386,7 +380,6 @@ void scsi_log_send(struct scsi_cmnd *cmd)
386void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) 380void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
387{ 381{
388 unsigned int level; 382 unsigned int level;
389 struct scsi_device *sdev;
390 383
391 /* 384 /*
392 * If ML COMPLETE log level is greater than or equal to: 385 * If ML COMPLETE log level is greater than or equal to:
@@ -405,8 +398,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
405 SCSI_LOG_MLCOMPLETE_BITS); 398 SCSI_LOG_MLCOMPLETE_BITS);
406 if (((level > 0) && (cmd->result || disposition != SUCCESS)) || 399 if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
407 (level > 1)) { 400 (level > 1)) {
408 sdev = cmd->device; 401 scmd_printk(KERN_INFO, cmd, "Done: ");
409 sdev_printk(KERN_INFO, sdev, "done ");
410 if (level > 2) 402 if (level > 2)
411 printk("0x%p ", cmd); 403 printk("0x%p ", cmd);
412 /* 404 /*
@@ -415,40 +407,35 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
415 */ 407 */
416 switch (disposition) { 408 switch (disposition) {
417 case SUCCESS: 409 case SUCCESS:
418 printk("SUCCESS"); 410 printk("SUCCESS\n");
419 break; 411 break;
420 case NEEDS_RETRY: 412 case NEEDS_RETRY:
421 printk("RETRY "); 413 printk("RETRY\n");
422 break; 414 break;
423 case ADD_TO_MLQUEUE: 415 case ADD_TO_MLQUEUE:
424 printk("MLQUEUE"); 416 printk("MLQUEUE\n");
425 break; 417 break;
426 case FAILED: 418 case FAILED:
427 printk("FAILED "); 419 printk("FAILED\n");
428 break; 420 break;
429 case TIMEOUT_ERROR: 421 case TIMEOUT_ERROR:
430 /* 422 /*
431 * If called via scsi_times_out. 423 * If called via scsi_times_out.
432 */ 424 */
433 printk("TIMEOUT"); 425 printk("TIMEOUT\n");
434 break; 426 break;
435 default: 427 default:
436 printk("UNKNOWN"); 428 printk("UNKNOWN\n");
437 } 429 }
438 printk(" %8x ", cmd->result); 430 scsi_print_result(cmd);
439 scsi_print_command(cmd); 431 scsi_print_command(cmd);
440 if (status_byte(cmd->result) & CHECK_CONDITION) { 432 if (status_byte(cmd->result) & CHECK_CONDITION)
441 /*
442 * XXX The scsi_print_sense formatting/prefix
443 * doesn't match this function.
444 */
445 scsi_print_sense("", cmd); 433 scsi_print_sense("", cmd);
446 } 434 if (level > 3)
447 if (level > 3) { 435 scmd_printk(KERN_INFO, cmd,
448 printk(KERN_INFO "scsi host busy %d failed %d\n", 436 "scsi host busy %d failed %d\n",
449 sdev->host->host_busy, 437 cmd->device->host->host_busy,
450 sdev->host->host_failed); 438 cmd->device->host->host_failed);
451 }
452 } 439 }
453 } 440 }
454} 441}
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 918bb6019540..3963e7013bd9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -184,10 +184,19 @@ int scsi_delete_timer(struct scsi_cmnd *scmd)
184 **/ 184 **/
185void scsi_times_out(struct scsi_cmnd *scmd) 185void scsi_times_out(struct scsi_cmnd *scmd)
186{ 186{
187 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
188
187 scsi_log_completion(scmd, TIMEOUT_ERROR); 189 scsi_log_completion(scmd, TIMEOUT_ERROR);
188 190
189 if (scmd->device->host->transportt->eh_timed_out) 191 if (scmd->device->host->transportt->eh_timed_out)
190 switch (scmd->device->host->transportt->eh_timed_out(scmd)) { 192 eh_timed_out = scmd->device->host->transportt->eh_timed_out;
193 else if (scmd->device->host->hostt->eh_timed_out)
194 eh_timed_out = scmd->device->host->hostt->eh_timed_out;
195 else
196 eh_timed_out = NULL;
197
198 if (eh_timed_out)
199 switch (eh_timed_out(scmd)) {
191 case EH_HANDLED: 200 case EH_HANDLED:
192 __scsi_done(scmd); 201 __scsi_done(scmd);
193 return; 202 return;
@@ -923,10 +932,12 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
923 static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; 932 static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0};
924 933
925 if (scmd->device->allow_restart) { 934 if (scmd->device->allow_restart) {
926 int rtn; 935 int i, rtn = NEEDS_RETRY;
936
937 for (i = 0; rtn == NEEDS_RETRY && i < 2; i++)
938 rtn = scsi_send_eh_cmnd(scmd, stu_command, 6,
939 START_UNIT_TIMEOUT, 0);
927 940
928 rtn = scsi_send_eh_cmnd(scmd, stu_command, 6,
929 START_UNIT_TIMEOUT, 0);
930 if (rtn == SUCCESS) 941 if (rtn == SUCCESS)
931 return 0; 942 return 0;
932 } 943 }
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 05d79af5ab90..61fbcdcbb009 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -848,8 +848,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
848 memcpy(req->sense, cmd->sense_buffer, len); 848 memcpy(req->sense, cmd->sense_buffer, len);
849 req->sense_len = len; 849 req->sense_len = len;
850 } 850 }
851 } else 851 }
852 req->data_len = cmd->resid; 852 req->data_len = cmd->resid;
853 } 853 }
854 854
855 /* 855 /*
@@ -968,9 +968,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
968 } 968 }
969 if (result) { 969 if (result) {
970 if (!(req->cmd_flags & REQ_QUIET)) { 970 if (!(req->cmd_flags & REQ_QUIET)) {
971 scmd_printk(KERN_INFO, cmd, 971 scsi_print_result(cmd);
972 "SCSI error: return code = 0x%08x\n",
973 result);
974 if (driver_byte(result) & DRIVER_SENSE) 972 if (driver_byte(result) & DRIVER_SENSE)
975 scsi_print_sense("", cmd); 973 scsi_print_sense("", cmd);
976 } 974 }
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0949145304ea..a67f315244d7 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -181,10 +181,8 @@ int scsi_complete_async_scans(void)
181 return 0; 181 return 0;
182} 182}
183 183
184#ifdef MODULE
185/* Only exported for the benefit of scsi_wait_scan */ 184/* Only exported for the benefit of scsi_wait_scan */
186EXPORT_SYMBOL_GPL(scsi_complete_async_scans); 185EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
187#endif
188 186
189/** 187/**
190 * scsi_unlock_floptical - unlock device via a special MODE SENSE command 188 * scsi_unlock_floptical - unlock device via a special MODE SENSE command
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 939de0de18bc..67a38a1409ba 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -276,8 +276,22 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
276 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; 276 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
277} 277}
278 278
279static int scsi_bus_uevent(struct device *dev, char **envp, int num_envp,
280 char *buffer, int buffer_size)
281{
282 struct scsi_device *sdev = to_scsi_device(dev);
283 int i = 0;
284 int length = 0;
285
286 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
287 "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
288 envp[i] = NULL;
289 return 0;
290}
291
279static int scsi_bus_suspend(struct device * dev, pm_message_t state) 292static int scsi_bus_suspend(struct device * dev, pm_message_t state)
280{ 293{
294 struct device_driver *drv = dev->driver;
281 struct scsi_device *sdev = to_scsi_device(dev); 295 struct scsi_device *sdev = to_scsi_device(dev);
282 struct scsi_host_template *sht = sdev->host->hostt; 296 struct scsi_host_template *sht = sdev->host->hostt;
283 int err; 297 int err;
@@ -286,28 +300,51 @@ static int scsi_bus_suspend(struct device * dev, pm_message_t state)
286 if (err) 300 if (err)
287 return err; 301 return err;
288 302
289 if (sht->suspend) 303 /* call HLD suspend first */
304 if (drv && drv->suspend) {
305 err = drv->suspend(dev, state);
306 if (err)
307 return err;
308 }
309
310 /* then, call host suspend */
311 if (sht->suspend) {
290 err = sht->suspend(sdev, state); 312 err = sht->suspend(sdev, state);
313 if (err) {
314 if (drv && drv->resume)
315 drv->resume(dev);
316 return err;
317 }
318 }
291 319
292 return err; 320 return 0;
293} 321}
294 322
295static int scsi_bus_resume(struct device * dev) 323static int scsi_bus_resume(struct device * dev)
296{ 324{
325 struct device_driver *drv = dev->driver;
297 struct scsi_device *sdev = to_scsi_device(dev); 326 struct scsi_device *sdev = to_scsi_device(dev);
298 struct scsi_host_template *sht = sdev->host->hostt; 327 struct scsi_host_template *sht = sdev->host->hostt;
299 int err = 0; 328 int err = 0, err2 = 0;
300 329
330 /* call host resume first */
301 if (sht->resume) 331 if (sht->resume)
302 err = sht->resume(sdev); 332 err = sht->resume(sdev);
303 333
334 /* then, call HLD resume */
335 if (drv && drv->resume)
336 err2 = drv->resume(dev);
337
304 scsi_device_resume(sdev); 338 scsi_device_resume(sdev);
305 return err; 339
340 /* favor LLD failure */
341 return err ? err : err2;;
306} 342}
307 343
308struct bus_type scsi_bus_type = { 344struct bus_type scsi_bus_type = {
309 .name = "scsi", 345 .name = "scsi",
310 .match = scsi_bus_match, 346 .match = scsi_bus_match,
347 .uevent = scsi_bus_uevent,
311 .suspend = scsi_bus_suspend, 348 .suspend = scsi_bus_suspend,
312 .resume = scsi_bus_resume, 349 .resume = scsi_bus_resume,
313}; 350};
@@ -547,6 +584,14 @@ show_sdev_iostat(iorequest_cnt);
547show_sdev_iostat(iodone_cnt); 584show_sdev_iostat(iodone_cnt);
548show_sdev_iostat(ioerr_cnt); 585show_sdev_iostat(ioerr_cnt);
549 586
587static ssize_t
588sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
589{
590 struct scsi_device *sdev;
591 sdev = to_scsi_device(dev);
592 return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type);
593}
594static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);
550 595
551/* Default template for device attributes. May NOT be modified */ 596/* Default template for device attributes. May NOT be modified */
552static struct device_attribute *scsi_sysfs_sdev_attrs[] = { 597static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
@@ -566,6 +611,7 @@ static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
566 &dev_attr_iorequest_cnt, 611 &dev_attr_iorequest_cnt,
567 &dev_attr_iodone_cnt, 612 &dev_attr_iodone_cnt,
568 &dev_attr_ioerr_cnt, 613 &dev_attr_ioerr_cnt,
614 &dev_attr_modalias,
569 NULL 615 NULL
570}; 616};
571 617
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c
index 0e08817fdecf..ca22ddf81746 100644
--- a/drivers/scsi/scsi_tgt_if.c
+++ b/drivers/scsi/scsi_tgt_if.c
@@ -179,10 +179,12 @@ static int event_recv_msg(struct tgt_event *ev)
179 switch (ev->hdr.type) { 179 switch (ev->hdr.type) {
180 case TGT_UEVENT_CMD_RSP: 180 case TGT_UEVENT_CMD_RSP:
181 err = scsi_tgt_kspace_exec(ev->p.cmd_rsp.host_no, 181 err = scsi_tgt_kspace_exec(ev->p.cmd_rsp.host_no,
182 ev->p.cmd_rsp.tag,
183 ev->p.cmd_rsp.result, 182 ev->p.cmd_rsp.result,
184 ev->p.cmd_rsp.len, 183 ev->p.cmd_rsp.tag,
185 ev->p.cmd_rsp.uaddr, 184 ev->p.cmd_rsp.uaddr,
185 ev->p.cmd_rsp.len,
186 ev->p.cmd_rsp.sense_uaddr,
187 ev->p.cmd_rsp.sense_len,
186 ev->p.cmd_rsp.rw); 188 ev->p.cmd_rsp.rw);
187 break; 189 break;
188 case TGT_UEVENT_TSK_MGMT_RSP: 190 case TGT_UEVENT_TSK_MGMT_RSP:
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c
index d402aff5f314..2570f48a69c7 100644
--- a/drivers/scsi/scsi_tgt_lib.c
+++ b/drivers/scsi/scsi_tgt_lib.c
@@ -28,7 +28,6 @@
28#include <scsi/scsi_device.h> 28#include <scsi/scsi_device.h>
29#include <scsi/scsi_host.h> 29#include <scsi/scsi_host.h>
30#include <scsi/scsi_tgt.h> 30#include <scsi/scsi_tgt.h>
31#include <../drivers/md/dm-bio-list.h>
32 31
33#include "scsi_tgt_priv.h" 32#include "scsi_tgt_priv.h"
34 33
@@ -42,16 +41,12 @@ static struct kmem_cache *scsi_tgt_cmd_cache;
42struct scsi_tgt_cmd { 41struct scsi_tgt_cmd {
43 /* TODO replace work with James b's code */ 42 /* TODO replace work with James b's code */
44 struct work_struct work; 43 struct work_struct work;
45 /* TODO replace the lists with a large bio */ 44 /* TODO fix limits of some drivers */
46 struct bio_list xfer_done_list; 45 struct bio *bio;
47 struct bio_list xfer_list;
48 46
49 struct list_head hash_list; 47 struct list_head hash_list;
50 struct request *rq; 48 struct request *rq;
51 u64 tag; 49 u64 tag;
52
53 void *buffer;
54 unsigned bufflen;
55}; 50};
56 51
57#define TGT_HASH_ORDER 4 52#define TGT_HASH_ORDER 4
@@ -93,7 +88,12 @@ struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *shost,
93 if (!tcmd) 88 if (!tcmd)
94 goto put_dev; 89 goto put_dev;
95 90
96 rq = blk_get_request(shost->uspace_req_q, write, gfp_mask); 91 /*
92 * The blk helpers are used to the READ/WRITE requests
93 * transfering data from a initiator point of view. Since
94 * we are in target mode we want the opposite.
95 */
96 rq = blk_get_request(shost->uspace_req_q, !write, gfp_mask);
97 if (!rq) 97 if (!rq)
98 goto free_tcmd; 98 goto free_tcmd;
99 99
@@ -111,8 +111,6 @@ struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *shost,
111 rq->cmd_flags |= REQ_TYPE_BLOCK_PC; 111 rq->cmd_flags |= REQ_TYPE_BLOCK_PC;
112 rq->end_io_data = tcmd; 112 rq->end_io_data = tcmd;
113 113
114 bio_list_init(&tcmd->xfer_list);
115 bio_list_init(&tcmd->xfer_done_list);
116 tcmd->rq = rq; 114 tcmd->rq = rq;
117 115
118 return cmd; 116 return cmd;
@@ -157,22 +155,6 @@ void scsi_host_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
157} 155}
158EXPORT_SYMBOL_GPL(scsi_host_put_command); 156EXPORT_SYMBOL_GPL(scsi_host_put_command);
159 157
160static void scsi_unmap_user_pages(struct scsi_tgt_cmd *tcmd)
161{
162 struct bio *bio;
163
164 /* must call bio_endio in case bio was bounced */
165 while ((bio = bio_list_pop(&tcmd->xfer_done_list))) {
166 bio_endio(bio, bio->bi_size, 0);
167 bio_unmap_user(bio);
168 }
169
170 while ((bio = bio_list_pop(&tcmd->xfer_list))) {
171 bio_endio(bio, bio->bi_size, 0);
172 bio_unmap_user(bio);
173 }
174}
175
176static void cmd_hashlist_del(struct scsi_cmnd *cmd) 158static void cmd_hashlist_del(struct scsi_cmnd *cmd)
177{ 159{
178 struct request_queue *q = cmd->request->q; 160 struct request_queue *q = cmd->request->q;
@@ -185,6 +167,11 @@ static void cmd_hashlist_del(struct scsi_cmnd *cmd)
185 spin_unlock_irqrestore(&qdata->cmd_hash_lock, flags); 167 spin_unlock_irqrestore(&qdata->cmd_hash_lock, flags);
186} 168}
187 169
170static void scsi_unmap_user_pages(struct scsi_tgt_cmd *tcmd)
171{
172 blk_rq_unmap_user(tcmd->bio);
173}
174
188static void scsi_tgt_cmd_destroy(struct work_struct *work) 175static void scsi_tgt_cmd_destroy(struct work_struct *work)
189{ 176{
190 struct scsi_tgt_cmd *tcmd = 177 struct scsi_tgt_cmd *tcmd =
@@ -193,16 +180,6 @@ static void scsi_tgt_cmd_destroy(struct work_struct *work)
193 180
194 dprintk("cmd %p %d %lu\n", cmd, cmd->sc_data_direction, 181 dprintk("cmd %p %d %lu\n", cmd, cmd->sc_data_direction,
195 rq_data_dir(cmd->request)); 182 rq_data_dir(cmd->request));
196 /*
197 * We fix rq->cmd_flags here since when we told bio_map_user
198 * to write vm for WRITE commands, blk_rq_bio_prep set
199 * rq_data_dir the flags to READ.
200 */
201 if (cmd->sc_data_direction == DMA_TO_DEVICE)
202 cmd->request->cmd_flags |= REQ_RW;
203 else
204 cmd->request->cmd_flags &= ~REQ_RW;
205
206 scsi_unmap_user_pages(tcmd); 183 scsi_unmap_user_pages(tcmd);
207 scsi_host_put_command(scsi_tgt_cmd_to_host(cmd), cmd); 184 scsi_host_put_command(scsi_tgt_cmd_to_host(cmd), cmd);
208} 185}
@@ -215,6 +192,7 @@ static void init_scsi_tgt_cmd(struct request *rq, struct scsi_tgt_cmd *tcmd,
215 struct list_head *head; 192 struct list_head *head;
216 193
217 tcmd->tag = tag; 194 tcmd->tag = tag;
195 tcmd->bio = NULL;
218 INIT_WORK(&tcmd->work, scsi_tgt_cmd_destroy); 196 INIT_WORK(&tcmd->work, scsi_tgt_cmd_destroy);
219 spin_lock_irqsave(&qdata->cmd_hash_lock, flags); 197 spin_lock_irqsave(&qdata->cmd_hash_lock, flags);
220 head = &qdata->cmd_hash[cmd_hashfn(tag)]; 198 head = &qdata->cmd_hash[cmd_hashfn(tag)];
@@ -349,10 +327,14 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd)
349 dprintk("cmd %p %lu\n", cmd, rq_data_dir(cmd->request)); 327 dprintk("cmd %p %lu\n", cmd, rq_data_dir(cmd->request));
350 328
351 scsi_tgt_uspace_send_status(cmd, tcmd->tag); 329 scsi_tgt_uspace_send_status(cmd, tcmd->tag);
330
331 if (cmd->request_buffer)
332 scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len);
333
352 queue_work(scsi_tgtd, &tcmd->work); 334 queue_work(scsi_tgtd, &tcmd->work);
353} 335}
354 336
355static int __scsi_tgt_transfer_response(struct scsi_cmnd *cmd) 337static int scsi_tgt_transfer_response(struct scsi_cmnd *cmd)
356{ 338{
357 struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd); 339 struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd);
358 int err; 340 int err;
@@ -365,30 +347,12 @@ static int __scsi_tgt_transfer_response(struct scsi_cmnd *cmd)
365 case SCSI_MLQUEUE_DEVICE_BUSY: 347 case SCSI_MLQUEUE_DEVICE_BUSY:
366 return -EAGAIN; 348 return -EAGAIN;
367 } 349 }
368
369 return 0; 350 return 0;
370} 351}
371 352
372static void scsi_tgt_transfer_response(struct scsi_cmnd *cmd)
373{
374 struct scsi_tgt_cmd *tcmd = cmd->request->end_io_data;
375 int err;
376
377 err = __scsi_tgt_transfer_response(cmd);
378 if (!err)
379 return;
380
381 cmd->result = DID_BUS_BUSY << 16;
382 err = scsi_tgt_uspace_send_status(cmd, tcmd->tag);
383 if (err <= 0)
384 /* the eh will have to pick this up */
385 printk(KERN_ERR "Could not send cmd %p status\n", cmd);
386}
387
388static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask) 353static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask)
389{ 354{
390 struct request *rq = cmd->request; 355 struct request *rq = cmd->request;
391 struct scsi_tgt_cmd *tcmd = rq->end_io_data;
392 int count; 356 int count;
393 357
394 cmd->use_sg = rq->nr_phys_segments; 358 cmd->use_sg = rq->nr_phys_segments;
@@ -398,143 +362,54 @@ static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask)
398 362
399 cmd->request_bufflen = rq->data_len; 363 cmd->request_bufflen = rq->data_len;
400 364
401 dprintk("cmd %p addr %p cnt %d %lu\n", cmd, tcmd->buffer, cmd->use_sg, 365 dprintk("cmd %p cnt %d %lu\n", cmd, cmd->use_sg, rq_data_dir(rq));
402 rq_data_dir(rq));
403 count = blk_rq_map_sg(rq->q, rq, cmd->request_buffer); 366 count = blk_rq_map_sg(rq->q, rq, cmd->request_buffer);
404 if (likely(count <= cmd->use_sg)) { 367 if (likely(count <= cmd->use_sg)) {
405 cmd->use_sg = count; 368 cmd->use_sg = count;
406 return 0; 369 return 0;
407 } 370 }
408 371
409 eprintk("cmd %p addr %p cnt %d\n", cmd, tcmd->buffer, cmd->use_sg); 372 eprintk("cmd %p cnt %d\n", cmd, cmd->use_sg);
410 scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len); 373 scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len);
411 return -EINVAL; 374 return -EINVAL;
412} 375}
413 376
414/* TODO: test this crap and replace bio_map_user with new interface maybe */ 377/* TODO: test this crap and replace bio_map_user with new interface maybe */
415static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd, 378static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd,
416 int rw) 379 unsigned long uaddr, unsigned int len, int rw)
417{ 380{
418 struct request_queue *q = cmd->request->q; 381 struct request_queue *q = cmd->request->q;
419 struct request *rq = cmd->request; 382 struct request *rq = cmd->request;
420 void *uaddr = tcmd->buffer;
421 unsigned int len = tcmd->bufflen;
422 struct bio *bio;
423 int err; 383 int err;
424 384
425 while (len > 0) { 385 dprintk("%lx %u\n", uaddr, len);
426 dprintk("%lx %u\n", (unsigned long) uaddr, len); 386 err = blk_rq_map_user(q, rq, (void *)uaddr, len);
427 bio = bio_map_user(q, NULL, (unsigned long) uaddr, len, rw); 387 if (err) {
428 if (IS_ERR(bio)) {
429 err = PTR_ERR(bio);
430 dprintk("fail to map %lx %u %d %x\n",
431 (unsigned long) uaddr, len, err, cmd->cmnd[0]);
432 goto unmap_bios;
433 }
434
435 uaddr += bio->bi_size;
436 len -= bio->bi_size;
437
438 /* 388 /*
439 * The first bio is added and merged. We could probably 389 * TODO: need to fixup sg_tablesize, max_segment_size,
440 * try to add others using scsi_merge_bio() but for now 390 * max_sectors, etc for modern HW and software drivers
441 * we keep it simple. The first bio should be pretty large 391 * where this value is bogus.
442 * (either hitting the 1 MB bio pages limit or a queue limit) 392 *
443 * already but for really large IO we may want to try and 393 * TODO2: we can alloc a reserve buffer of max size
444 * merge these. 394 * we can handle and do the slow copy path for really large
395 * IO.
445 */ 396 */
446 if (!rq->bio) { 397 eprintk("Could not handle request of size %u.\n", len);
447 blk_rq_bio_prep(q, rq, bio); 398 return err;
448 rq->data_len = bio->bi_size;
449 } else
450 /* put list of bios to transfer in next go around */
451 bio_list_add(&tcmd->xfer_list, bio);
452 } 399 }
453 400
454 cmd->offset = 0; 401 tcmd->bio = rq->bio;
455 err = scsi_tgt_init_cmd(cmd, GFP_KERNEL); 402 err = scsi_tgt_init_cmd(cmd, GFP_KERNEL);
456 if (err) 403 if (err)
457 goto unmap_bios; 404 goto unmap_rq;
458 405
459 return 0; 406 return 0;
460 407
461unmap_bios: 408unmap_rq:
462 if (rq->bio) { 409 scsi_unmap_user_pages(tcmd);
463 bio_unmap_user(rq->bio);
464 while ((bio = bio_list_pop(&tcmd->xfer_list)))
465 bio_unmap_user(bio);
466 }
467
468 return err; 410 return err;
469} 411}
470 412
471static int scsi_tgt_transfer_data(struct scsi_cmnd *);
472
473static void scsi_tgt_data_transfer_done(struct scsi_cmnd *cmd)
474{
475 struct scsi_tgt_cmd *tcmd = cmd->request->end_io_data;
476 struct bio *bio;
477 int err;
478
479 /* should we free resources here on error ? */
480 if (cmd->result) {
481send_uspace_err:
482 err = scsi_tgt_uspace_send_status(cmd, tcmd->tag);
483 if (err <= 0)
484 /* the tgt uspace eh will have to pick this up */
485 printk(KERN_ERR "Could not send cmd %p status\n", cmd);
486 return;
487 }
488
489 dprintk("cmd %p request_bufflen %u bufflen %u\n",
490 cmd, cmd->request_bufflen, tcmd->bufflen);
491
492 scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len);
493 bio_list_add(&tcmd->xfer_done_list, cmd->request->bio);
494
495 tcmd->buffer += cmd->request_bufflen;
496 cmd->offset += cmd->request_bufflen;
497
498 if (!tcmd->xfer_list.head) {
499 scsi_tgt_transfer_response(cmd);
500 return;
501 }
502
503 dprintk("cmd2 %p request_bufflen %u bufflen %u\n",
504 cmd, cmd->request_bufflen, tcmd->bufflen);
505
506 bio = bio_list_pop(&tcmd->xfer_list);
507 BUG_ON(!bio);
508
509 blk_rq_bio_prep(cmd->request->q, cmd->request, bio);
510 cmd->request->data_len = bio->bi_size;
511 err = scsi_tgt_init_cmd(cmd, GFP_ATOMIC);
512 if (err) {
513 cmd->result = DID_ERROR << 16;
514 goto send_uspace_err;
515 }
516
517 if (scsi_tgt_transfer_data(cmd)) {
518 cmd->result = DID_NO_CONNECT << 16;
519 goto send_uspace_err;
520 }
521}
522
523static int scsi_tgt_transfer_data(struct scsi_cmnd *cmd)
524{
525 int err;
526 struct Scsi_Host *host = scsi_tgt_cmd_to_host(cmd);
527
528 err = host->hostt->transfer_data(cmd, scsi_tgt_data_transfer_done);
529 switch (err) {
530 case SCSI_MLQUEUE_HOST_BUSY:
531 case SCSI_MLQUEUE_DEVICE_BUSY:
532 return -EAGAIN;
533 default:
534 return 0;
535 }
536}
537
538static int scsi_tgt_copy_sense(struct scsi_cmnd *cmd, unsigned long uaddr, 413static int scsi_tgt_copy_sense(struct scsi_cmnd *cmd, unsigned long uaddr,
539 unsigned len) 414 unsigned len)
540{ 415{
@@ -584,8 +459,9 @@ static struct request *tgt_cmd_hash_lookup(struct request_queue *q, u64 tag)
584 return rq; 459 return rq;
585} 460}
586 461
587int scsi_tgt_kspace_exec(int host_no, u64 tag, int result, u32 len, 462int scsi_tgt_kspace_exec(int host_no, int result, u64 tag,
588 unsigned long uaddr, u8 rw) 463 unsigned long uaddr, u32 len, unsigned long sense_uaddr,
464 u32 sense_len, u8 rw)
589{ 465{
590 struct Scsi_Host *shost; 466 struct Scsi_Host *shost;
591 struct scsi_cmnd *cmd; 467 struct scsi_cmnd *cmd;
@@ -617,8 +493,9 @@ int scsi_tgt_kspace_exec(int host_no, u64 tag, int result, u32 len,
617 } 493 }
618 cmd = rq->special; 494 cmd = rq->special;
619 495
620 dprintk("cmd %p result %d len %d bufflen %u %lu %x\n", cmd, 496 dprintk("cmd %p scb %x result %d len %d bufflen %u %lu %x\n",
621 result, len, cmd->request_bufflen, rq_data_dir(rq), cmd->cmnd[0]); 497 cmd, cmd->cmnd[0], result, len, cmd->request_bufflen,
498 rq_data_dir(rq), cmd->cmnd[0]);
622 499
623 if (result == TASK_ABORTED) { 500 if (result == TASK_ABORTED) {
624 scsi_tgt_abort_cmd(shost, cmd); 501 scsi_tgt_abort_cmd(shost, cmd);
@@ -629,36 +506,36 @@ int scsi_tgt_kspace_exec(int host_no, u64 tag, int result, u32 len,
629 * in the request_* values 506 * in the request_* values
630 */ 507 */
631 tcmd = cmd->request->end_io_data; 508 tcmd = cmd->request->end_io_data;
632 tcmd->buffer = (void *)uaddr;
633 tcmd->bufflen = len;
634 cmd->result = result; 509 cmd->result = result;
635 510
636 if (!tcmd->bufflen || cmd->request_buffer) { 511 if (cmd->result == SAM_STAT_CHECK_CONDITION)
637 err = __scsi_tgt_transfer_response(cmd); 512 scsi_tgt_copy_sense(cmd, sense_uaddr, sense_len);
638 goto done;
639 }
640 513
641 /* 514 if (len) {
642 * TODO: Do we need to handle case where request does not 515 err = scsi_map_user_pages(rq->end_io_data, cmd, uaddr, len, rw);
643 * align with LLD. 516 if (err) {
644 */ 517 /*
645 err = scsi_map_user_pages(rq->end_io_data, cmd, rw); 518 * user-space daemon bugs or OOM
646 if (err) { 519 * TODO: we can do better for OOM.
647 eprintk("%p %d\n", cmd, err); 520 */
648 err = -EAGAIN; 521 struct scsi_tgt_queuedata *qdata;
649 goto done; 522 struct list_head *head;
650 } 523 unsigned long flags;
651 524
652 /* userspace failure */ 525 eprintk("cmd %p ret %d uaddr %lx len %d rw %d\n",
653 if (cmd->result) { 526 cmd, err, uaddr, len, rw);
654 if (status_byte(cmd->result) == CHECK_CONDITION) 527
655 scsi_tgt_copy_sense(cmd, uaddr, len); 528 qdata = shost->uspace_req_q->queuedata;
656 err = __scsi_tgt_transfer_response(cmd); 529 head = &qdata->cmd_hash[cmd_hashfn(tcmd->tag)];
657 goto done; 530
658 } 531 spin_lock_irqsave(&qdata->cmd_hash_lock, flags);
659 /* ask the target LLD to transfer the data to the buffer */ 532 list_add(&tcmd->hash_list, head);
660 err = scsi_tgt_transfer_data(cmd); 533 spin_unlock_irqrestore(&qdata->cmd_hash_lock, flags);
661 534
535 goto done;
536 }
537 }
538 err = scsi_tgt_transfer_response(cmd);
662done: 539done:
663 scsi_host_put(shost); 540 scsi_host_put(shost);
664 return err; 541 return err;
diff --git a/drivers/scsi/scsi_tgt_priv.h b/drivers/scsi/scsi_tgt_priv.h
index 84488c51ff62..e9e6db1c417f 100644
--- a/drivers/scsi/scsi_tgt_priv.h
+++ b/drivers/scsi/scsi_tgt_priv.h
@@ -18,8 +18,9 @@ extern int scsi_tgt_if_init(void);
18extern int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, 18extern int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun,
19 u64 tag); 19 u64 tag);
20extern int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag); 20extern int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag);
21extern int scsi_tgt_kspace_exec(int host_no, u64 tag, int result, u32 len, 21extern int scsi_tgt_kspace_exec(int host_no, int result, u64 tag,
22 unsigned long uaddr, u8 rw); 22 unsigned long uaddr, u32 len, unsigned long sense_uaddr,
23 u32 sense_len, u8 rw);
23extern int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, 24extern int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag,
24 struct scsi_lun *scsilun, void *data); 25 struct scsi_lun *scsilun, void *data);
25extern int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 mid, int result); 26extern int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 mid, int result);
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 58afdb401703..14c4f065b2b8 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -200,6 +200,8 @@ static const struct {
200 { FC_PORTSPEED_2GBIT, "2 Gbit" }, 200 { FC_PORTSPEED_2GBIT, "2 Gbit" },
201 { FC_PORTSPEED_4GBIT, "4 Gbit" }, 201 { FC_PORTSPEED_4GBIT, "4 Gbit" },
202 { FC_PORTSPEED_10GBIT, "10 Gbit" }, 202 { FC_PORTSPEED_10GBIT, "10 Gbit" },
203 { FC_PORTSPEED_8GBIT, "8 Gbit" },
204 { FC_PORTSPEED_16GBIT, "16 Gbit" },
203 { FC_PORTSPEED_NOT_NEGOTIATED, "Not Negotiated" }, 205 { FC_PORTSPEED_NOT_NEGOTIATED, "Not Negotiated" },
204}; 206};
205fc_bitfield_name_search(port_speed, fc_port_speed_names) 207fc_bitfield_name_search(port_speed, fc_port_speed_names)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index aabaa0576ab4..caf1836bbeca 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -49,7 +49,7 @@ struct iscsi_internal {
49 struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; 49 struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
50}; 50};
51 51
52static int iscsi_session_nr; /* sysfs session id for next new session */ 52static atomic_t iscsi_session_nr; /* sysfs session id for next new session */
53 53
54/* 54/*
55 * list of registered transports and lock that must 55 * list of registered transports and lock that must
@@ -300,7 +300,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
300 int err; 300 int err;
301 301
302 ihost = shost->shost_data; 302 ihost = shost->shost_data;
303 session->sid = iscsi_session_nr++; 303 session->sid = atomic_add_return(1, &iscsi_session_nr);
304 session->target_id = target_id; 304 session->target_id = target_id;
305 305
306 snprintf(session->dev.bus_id, BUS_ID_SIZE, "session%u", 306 snprintf(session->dev.bus_id, BUS_ID_SIZE, "session%u",
@@ -1419,6 +1419,8 @@ static __init int iscsi_transport_init(void)
1419 printk(KERN_INFO "Loading iSCSI transport class v%s.\n", 1419 printk(KERN_INFO "Loading iSCSI transport class v%s.\n",
1420 ISCSI_TRANSPORT_VERSION); 1420 ISCSI_TRANSPORT_VERSION);
1421 1421
1422 atomic_set(&iscsi_session_nr, 0);
1423
1422 err = class_register(&iscsi_transport_class); 1424 err = class_register(&iscsi_transport_class);
1423 if (err) 1425 if (err)
1424 return err; 1426 return err;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 5a8f55fea5ff..00e46662296f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -58,16 +58,10 @@
58#include <scsi/scsi_host.h> 58#include <scsi/scsi_host.h>
59#include <scsi/scsi_ioctl.h> 59#include <scsi/scsi_ioctl.h>
60#include <scsi/scsicam.h> 60#include <scsi/scsicam.h>
61#include <scsi/sd.h>
61 62
62#include "scsi_logging.h" 63#include "scsi_logging.h"
63 64
64/*
65 * More than enough for everybody ;) The huge number of majors
66 * is a leftover from 16bit dev_t days, we don't really need that
67 * much numberspace.
68 */
69#define SD_MAJORS 16
70
71MODULE_AUTHOR("Eric Youngdale"); 65MODULE_AUTHOR("Eric Youngdale");
72MODULE_DESCRIPTION("SCSI disk (sd) driver"); 66MODULE_DESCRIPTION("SCSI disk (sd) driver");
73MODULE_LICENSE("GPL"); 67MODULE_LICENSE("GPL");
@@ -88,45 +82,9 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK12_MAJOR);
88MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR); 82MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR);
89MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR); 83MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR);
90MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR); 84MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR);
91 85MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
92/* 86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
93 * This is limited by the naming scheme enforced in sd_probe, 87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
94 * add another character to it if you really need more disks.
95 */
96#define SD_MAX_DISKS (((26 * 26) + 26 + 1) * 26)
97
98/*
99 * Time out in seconds for disks and Magneto-opticals (which are slower).
100 */
101#define SD_TIMEOUT (30 * HZ)
102#define SD_MOD_TIMEOUT (75 * HZ)
103
104/*
105 * Number of allowed retries
106 */
107#define SD_MAX_RETRIES 5
108#define SD_PASSTHROUGH_RETRIES 1
109
110/*
111 * Size of the initial data buffer for mode and read capacity data
112 */
113#define SD_BUF_SIZE 512
114
115struct scsi_disk {
116 struct scsi_driver *driver; /* always &sd_template */
117 struct scsi_device *device;
118 struct class_device cdev;
119 struct gendisk *disk;
120 unsigned int openers; /* protected by BKL for now, yuck */
121 sector_t capacity; /* size in 512-byte sectors */
122 u32 index;
123 u8 media_present;
124 u8 write_prot;
125 unsigned WCE : 1; /* state of disk WCE bit */
126 unsigned RCD : 1; /* state of disk RCD bit, unused */
127 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
128};
129#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
130 88
131static DEFINE_IDR(sd_index_idr); 89static DEFINE_IDR(sd_index_idr);
132static DEFINE_SPINLOCK(sd_index_lock); 90static DEFINE_SPINLOCK(sd_index_lock);
@@ -136,20 +94,6 @@ static DEFINE_SPINLOCK(sd_index_lock);
136 * object after last put) */ 94 * object after last put) */
137static DEFINE_MUTEX(sd_ref_mutex); 95static DEFINE_MUTEX(sd_ref_mutex);
138 96
139static int sd_revalidate_disk(struct gendisk *disk);
140static void sd_rw_intr(struct scsi_cmnd * SCpnt);
141
142static int sd_probe(struct device *);
143static int sd_remove(struct device *);
144static void sd_shutdown(struct device *dev);
145static void sd_rescan(struct device *);
146static int sd_init_command(struct scsi_cmnd *);
147static int sd_issue_flush(struct device *, sector_t *);
148static void sd_prepare_flush(request_queue_t *, struct request *);
149static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
150 unsigned char *buffer);
151static void scsi_disk_release(struct class_device *cdev);
152
153static const char *sd_cache_types[] = { 97static const char *sd_cache_types[] = {
154 "write through", "none", "write back", 98 "write through", "none", "write back",
155 "write back, no read (daft)" 99 "write back, no read (daft)"
@@ -199,13 +143,27 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf,
199 if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT, 143 if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT,
200 SD_MAX_RETRIES, &data, &sshdr)) { 144 SD_MAX_RETRIES, &data, &sshdr)) {
201 if (scsi_sense_valid(&sshdr)) 145 if (scsi_sense_valid(&sshdr))
202 scsi_print_sense_hdr(sdkp->disk->disk_name, &sshdr); 146 sd_print_sense_hdr(sdkp, &sshdr);
203 return -EINVAL; 147 return -EINVAL;
204 } 148 }
205 sd_revalidate_disk(sdkp->disk); 149 sd_revalidate_disk(sdkp->disk);
206 return count; 150 return count;
207} 151}
208 152
153static ssize_t sd_store_manage_start_stop(struct class_device *cdev,
154 const char *buf, size_t count)
155{
156 struct scsi_disk *sdkp = to_scsi_disk(cdev);
157 struct scsi_device *sdp = sdkp->device;
158
159 if (!capable(CAP_SYS_ADMIN))
160 return -EACCES;
161
162 sdp->manage_start_stop = simple_strtoul(buf, NULL, 10);
163
164 return count;
165}
166
209static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf, 167static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf,
210 size_t count) 168 size_t count)
211{ 169{
@@ -238,6 +196,14 @@ static ssize_t sd_show_fua(struct class_device *cdev, char *buf)
238 return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); 196 return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
239} 197}
240 198
199static ssize_t sd_show_manage_start_stop(struct class_device *cdev, char *buf)
200{
201 struct scsi_disk *sdkp = to_scsi_disk(cdev);
202 struct scsi_device *sdp = sdkp->device;
203
204 return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
205}
206
241static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf) 207static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf)
242{ 208{
243 struct scsi_disk *sdkp = to_scsi_disk(cdev); 209 struct scsi_disk *sdkp = to_scsi_disk(cdev);
@@ -251,6 +217,8 @@ static struct class_device_attribute sd_disk_attrs[] = {
251 __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), 217 __ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
252 __ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart, 218 __ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
253 sd_store_allow_restart), 219 sd_store_allow_restart),
220 __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
221 sd_store_manage_start_stop),
254 __ATTR_NULL, 222 __ATTR_NULL,
255}; 223};
256 224
@@ -267,6 +235,8 @@ static struct scsi_driver sd_template = {
267 .name = "sd", 235 .name = "sd",
268 .probe = sd_probe, 236 .probe = sd_probe,
269 .remove = sd_remove, 237 .remove = sd_remove,
238 .suspend = sd_suspend,
239 .resume = sd_resume,
270 .shutdown = sd_shutdown, 240 .shutdown = sd_shutdown,
271 }, 241 },
272 .rescan = sd_rescan, 242 .rescan = sd_rescan,
@@ -371,15 +341,19 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
371 unsigned int this_count = SCpnt->request_bufflen >> 9; 341 unsigned int this_count = SCpnt->request_bufflen >> 9;
372 unsigned int timeout = sdp->timeout; 342 unsigned int timeout = sdp->timeout;
373 343
374 SCSI_LOG_HLQUEUE(1, printk("sd_init_command: disk=%s, block=%llu, " 344 SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt,
375 "count=%d\n", disk->disk_name, 345 "sd_init_command: block=%llu, "
376 (unsigned long long)block, this_count)); 346 "count=%d\n",
347 (unsigned long long)block,
348 this_count));
377 349
378 if (!sdp || !scsi_device_online(sdp) || 350 if (!sdp || !scsi_device_online(sdp) ||
379 block + rq->nr_sectors > get_capacity(disk)) { 351 block + rq->nr_sectors > get_capacity(disk)) {
380 SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", 352 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
381 rq->nr_sectors)); 353 "Finishing %ld sectors\n",
382 SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); 354 rq->nr_sectors));
355 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
356 "Retry with 0x%p\n", SCpnt));
383 return 0; 357 return 0;
384 } 358 }
385 359
@@ -391,8 +365,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
391 /* printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */ 365 /* printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */
392 return 0; 366 return 0;
393 } 367 }
394 SCSI_LOG_HLQUEUE(2, printk("%s : block=%llu\n", 368 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n",
395 disk->disk_name, (unsigned long long)block)); 369 (unsigned long long)block));
396 370
397 /* 371 /*
398 * If we have a 1K hardware sectorsize, prevent access to single 372 * If we have a 1K hardware sectorsize, prevent access to single
@@ -407,7 +381,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
407 */ 381 */
408 if (sdp->sector_size == 1024) { 382 if (sdp->sector_size == 1024) {
409 if ((block & 1) || (rq->nr_sectors & 1)) { 383 if ((block & 1) || (rq->nr_sectors & 1)) {
410 printk(KERN_ERR "sd: Bad block number requested"); 384 scmd_printk(KERN_ERR, SCpnt,
385 "Bad block number requested\n");
411 return 0; 386 return 0;
412 } else { 387 } else {
413 block = block >> 1; 388 block = block >> 1;
@@ -416,7 +391,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
416 } 391 }
417 if (sdp->sector_size == 2048) { 392 if (sdp->sector_size == 2048) {
418 if ((block & 3) || (rq->nr_sectors & 3)) { 393 if ((block & 3) || (rq->nr_sectors & 3)) {
419 printk(KERN_ERR "sd: Bad block number requested"); 394 scmd_printk(KERN_ERR, SCpnt,
395 "Bad block number requested\n");
420 return 0; 396 return 0;
421 } else { 397 } else {
422 block = block >> 2; 398 block = block >> 2;
@@ -425,7 +401,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
425 } 401 }
426 if (sdp->sector_size == 4096) { 402 if (sdp->sector_size == 4096) {
427 if ((block & 7) || (rq->nr_sectors & 7)) { 403 if ((block & 7) || (rq->nr_sectors & 7)) {
428 printk(KERN_ERR "sd: Bad block number requested"); 404 scmd_printk(KERN_ERR, SCpnt,
405 "Bad block number requested\n");
429 return 0; 406 return 0;
430 } else { 407 } else {
431 block = block >> 3; 408 block = block >> 3;
@@ -442,13 +419,15 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
442 SCpnt->cmnd[0] = READ_6; 419 SCpnt->cmnd[0] = READ_6;
443 SCpnt->sc_data_direction = DMA_FROM_DEVICE; 420 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
444 } else { 421 } else {
445 printk(KERN_ERR "sd: Unknown command %x\n", rq->cmd_flags); 422 scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", rq->cmd_flags);
446 return 0; 423 return 0;
447 } 424 }
448 425
449 SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", 426 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
450 disk->disk_name, (rq_data_dir(rq) == WRITE) ? 427 "%s %d/%ld 512 byte blocks.\n",
451 "writing" : "reading", this_count, rq->nr_sectors)); 428 (rq_data_dir(rq) == WRITE) ?
429 "writing" : "reading", this_count,
430 rq->nr_sectors));
452 431
453 SCpnt->cmnd[1] = 0; 432 SCpnt->cmnd[1] = 0;
454 433
@@ -490,7 +469,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
490 * during operation and thus turned off 469 * during operation and thus turned off
491 * use_10_for_rw. 470 * use_10_for_rw.
492 */ 471 */
493 printk(KERN_ERR "sd: FUA write on READ/WRITE(6) drive\n"); 472 scmd_printk(KERN_ERR, SCpnt,
473 "FUA write on READ/WRITE(6) drive\n");
494 return 0; 474 return 0;
495 } 475 }
496 476
@@ -549,7 +529,7 @@ static int sd_open(struct inode *inode, struct file *filp)
549 return -ENXIO; 529 return -ENXIO;
550 530
551 531
552 SCSI_LOG_HLQUEUE(3, printk("sd_open: disk=%s\n", disk->disk_name)); 532 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n"));
553 533
554 sdev = sdkp->device; 534 sdev = sdkp->device;
555 535
@@ -619,7 +599,7 @@ static int sd_release(struct inode *inode, struct file *filp)
619 struct scsi_disk *sdkp = scsi_disk(disk); 599 struct scsi_disk *sdkp = scsi_disk(disk);
620 struct scsi_device *sdev = sdkp->device; 600 struct scsi_device *sdev = sdkp->device;
621 601
622 SCSI_LOG_HLQUEUE(3, printk("sd_release: disk=%s\n", disk->disk_name)); 602 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n"));
623 603
624 if (!--sdkp->openers && sdev->removable) { 604 if (!--sdkp->openers && sdev->removable) {
625 if (scsi_block_when_processing_errors(sdev)) 605 if (scsi_block_when_processing_errors(sdev))
@@ -732,8 +712,7 @@ static int sd_media_changed(struct gendisk *disk)
732 struct scsi_device *sdp = sdkp->device; 712 struct scsi_device *sdp = sdkp->device;
733 int retval; 713 int retval;
734 714
735 SCSI_LOG_HLQUEUE(3, printk("sd_media_changed: disk=%s\n", 715 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_media_changed\n"));
736 disk->disk_name));
737 716
738 if (!sdp->removable) 717 if (!sdp->removable)
739 return 0; 718 return 0;
@@ -786,9 +765,10 @@ not_present:
786 return 1; 765 return 1;
787} 766}
788 767
789static int sd_sync_cache(struct scsi_device *sdp) 768static int sd_sync_cache(struct scsi_disk *sdkp)
790{ 769{
791 int retries, res; 770 int retries, res;
771 struct scsi_device *sdp = sdkp->device;
792 struct scsi_sense_hdr sshdr; 772 struct scsi_sense_hdr sshdr;
793 773
794 if (!scsi_device_online(sdp)) 774 if (!scsi_device_online(sdp))
@@ -809,28 +789,27 @@ static int sd_sync_cache(struct scsi_device *sdp)
809 break; 789 break;
810 } 790 }
811 791
812 if (res) { printk(KERN_WARNING "FAILED\n status = %x, message = %02x, " 792 if (res) {
813 "host = %d, driver = %02x\n ", 793 sd_print_result(sdkp, res);
814 status_byte(res), msg_byte(res), 794 if (driver_byte(res) & DRIVER_SENSE)
815 host_byte(res), driver_byte(res)); 795 sd_print_sense_hdr(sdkp, &sshdr);
816 if (driver_byte(res) & DRIVER_SENSE)
817 scsi_print_sense_hdr("sd", &sshdr);
818 } 796 }
819 797
820 return res; 798 if (res)
799 return -EIO;
800 return 0;
821} 801}
822 802
823static int sd_issue_flush(struct device *dev, sector_t *error_sector) 803static int sd_issue_flush(struct device *dev, sector_t *error_sector)
824{ 804{
825 int ret = 0; 805 int ret = 0;
826 struct scsi_device *sdp = to_scsi_device(dev);
827 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 806 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
828 807
829 if (!sdkp) 808 if (!sdkp)
830 return -ENODEV; 809 return -ENODEV;
831 810
832 if (sdkp->WCE) 811 if (sdkp->WCE)
833 ret = sd_sync_cache(sdp); 812 ret = sd_sync_cache(sdkp);
834 scsi_disk_put(sdkp); 813 scsi_disk_put(sdkp);
835 return ret; 814 return ret;
836} 815}
@@ -928,12 +907,14 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt)
928 sense_deferred = scsi_sense_is_deferred(&sshdr); 907 sense_deferred = scsi_sense_is_deferred(&sshdr);
929 } 908 }
930#ifdef CONFIG_SCSI_LOGGING 909#ifdef CONFIG_SCSI_LOGGING
931 SCSI_LOG_HLCOMPLETE(1, printk("sd_rw_intr: %s: res=0x%x\n", 910 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
932 SCpnt->request->rq_disk->disk_name, result));
933 if (sense_valid) { 911 if (sense_valid) {
934 SCSI_LOG_HLCOMPLETE(1, printk("sd_rw_intr: sb[respc,sk,asc," 912 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
935 "ascq]=%x,%x,%x,%x\n", sshdr.response_code, 913 "sd_rw_intr: sb[respc,sk,asc,"
936 sshdr.sense_key, sshdr.asc, sshdr.ascq)); 914 "ascq]=%x,%x,%x,%x\n",
915 sshdr.response_code,
916 sshdr.sense_key, sshdr.asc,
917 sshdr.ascq));
937 } 918 }
938#endif 919#endif
939 if (driver_byte(result) != DRIVER_SENSE && 920 if (driver_byte(result) != DRIVER_SENSE &&
@@ -1025,7 +1006,7 @@ static int media_not_present(struct scsi_disk *sdkp,
1025 * spinup disk - called only in sd_revalidate_disk() 1006 * spinup disk - called only in sd_revalidate_disk()
1026 */ 1007 */
1027static void 1008static void
1028sd_spinup_disk(struct scsi_disk *sdkp, char *diskname) 1009sd_spinup_disk(struct scsi_disk *sdkp)
1029{ 1010{
1030 unsigned char cmd[10]; 1011 unsigned char cmd[10];
1031 unsigned long spintime_expire = 0; 1012 unsigned long spintime_expire = 0;
@@ -1069,9 +1050,10 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
1069 if ((driver_byte(the_result) & DRIVER_SENSE) == 0) { 1050 if ((driver_byte(the_result) & DRIVER_SENSE) == 0) {
1070 /* no sense, TUR either succeeded or failed 1051 /* no sense, TUR either succeeded or failed
1071 * with a status error */ 1052 * with a status error */
1072 if(!spintime && !scsi_status_is_good(the_result)) 1053 if(!spintime && !scsi_status_is_good(the_result)) {
1073 printk(KERN_NOTICE "%s: Unit Not Ready, " 1054 sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n");
1074 "error = 0x%x\n", diskname, the_result); 1055 sd_print_result(sdkp, the_result);
1056 }
1075 break; 1057 break;
1076 } 1058 }
1077 1059
@@ -1096,8 +1078,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
1096 */ 1078 */
1097 } else if (sense_valid && sshdr.sense_key == NOT_READY) { 1079 } else if (sense_valid && sshdr.sense_key == NOT_READY) {
1098 if (!spintime) { 1080 if (!spintime) {
1099 printk(KERN_NOTICE "%s: Spinning up disk...", 1081 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
1100 diskname);
1101 cmd[0] = START_STOP; 1082 cmd[0] = START_STOP;
1102 cmd[1] = 1; /* Return immediately */ 1083 cmd[1] = 1; /* Return immediately */
1103 memset((void *) &cmd[2], 0, 8); 1084 memset((void *) &cmd[2], 0, 8);
@@ -1130,9 +1111,8 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
1130 /* we don't understand the sense code, so it's 1111 /* we don't understand the sense code, so it's
1131 * probably pointless to loop */ 1112 * probably pointless to loop */
1132 if(!spintime) { 1113 if(!spintime) {
1133 printk(KERN_NOTICE "%s: Unit Not Ready, " 1114 sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n");
1134 "sense:\n", diskname); 1115 sd_print_sense_hdr(sdkp, &sshdr);
1135 scsi_print_sense_hdr("", &sshdr);
1136 } 1116 }
1137 break; 1117 break;
1138 } 1118 }
@@ -1151,8 +1131,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
1151 * read disk capacity 1131 * read disk capacity
1152 */ 1132 */
1153static void 1133static void
1154sd_read_capacity(struct scsi_disk *sdkp, char *diskname, 1134sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
1155 unsigned char *buffer)
1156{ 1135{
1157 unsigned char cmd[16]; 1136 unsigned char cmd[16];
1158 int the_result, retries; 1137 int the_result, retries;
@@ -1191,18 +1170,12 @@ repeat:
1191 } while (the_result && retries); 1170 } while (the_result && retries);
1192 1171
1193 if (the_result && !longrc) { 1172 if (the_result && !longrc) {
1194 printk(KERN_NOTICE "%s : READ CAPACITY failed.\n" 1173 sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY failed\n");
1195 "%s : status=%x, message=%02x, host=%d, driver=%02x \n", 1174 sd_print_result(sdkp, the_result);
1196 diskname, diskname,
1197 status_byte(the_result),
1198 msg_byte(the_result),
1199 host_byte(the_result),
1200 driver_byte(the_result));
1201
1202 if (driver_byte(the_result) & DRIVER_SENSE) 1175 if (driver_byte(the_result) & DRIVER_SENSE)
1203 scsi_print_sense_hdr("sd", &sshdr); 1176 sd_print_sense_hdr(sdkp, &sshdr);
1204 else 1177 else
1205 printk("%s : sense not available. \n", diskname); 1178 sd_printk(KERN_NOTICE, sdkp, "Sense not available.\n");
1206 1179
1207 /* Set dirty bit for removable devices if not ready - 1180 /* Set dirty bit for removable devices if not ready -
1208 * sometimes drives will not report this properly. */ 1181 * sometimes drives will not report this properly. */
@@ -1218,16 +1191,10 @@ repeat:
1218 return; 1191 return;
1219 } else if (the_result && longrc) { 1192 } else if (the_result && longrc) {
1220 /* READ CAPACITY(16) has been failed */ 1193 /* READ CAPACITY(16) has been failed */
1221 printk(KERN_NOTICE "%s : READ CAPACITY(16) failed.\n" 1194 sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n");
1222 "%s : status=%x, message=%02x, host=%d, driver=%02x \n", 1195 sd_print_result(sdkp, the_result);
1223 diskname, diskname, 1196 sd_printk(KERN_NOTICE, sdkp, "Use 0xffffffff as device size\n");
1224 status_byte(the_result), 1197
1225 msg_byte(the_result),
1226 host_byte(the_result),
1227 driver_byte(the_result));
1228 printk(KERN_NOTICE "%s : use 0xffffffff as device size\n",
1229 diskname);
1230
1231 sdkp->capacity = 1 + (sector_t) 0xffffffff; 1198 sdkp->capacity = 1 + (sector_t) 0xffffffff;
1232 goto got_data; 1199 goto got_data;
1233 } 1200 }
@@ -1238,14 +1205,14 @@ repeat:
1238 if (buffer[0] == 0xff && buffer[1] == 0xff && 1205 if (buffer[0] == 0xff && buffer[1] == 0xff &&
1239 buffer[2] == 0xff && buffer[3] == 0xff) { 1206 buffer[2] == 0xff && buffer[3] == 0xff) {
1240 if(sizeof(sdkp->capacity) > 4) { 1207 if(sizeof(sdkp->capacity) > 4) {
1241 printk(KERN_NOTICE "%s : very big device. try to use" 1208 sd_printk(KERN_NOTICE, sdkp, "Very big device. "
1242 " READ CAPACITY(16).\n", diskname); 1209 "Trying to use READ CAPACITY(16).\n");
1243 longrc = 1; 1210 longrc = 1;
1244 goto repeat; 1211 goto repeat;
1245 } 1212 }
1246 printk(KERN_ERR "%s: too big for this kernel. Use a " 1213 sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use "
1247 "kernel compiled with support for large block " 1214 "a kernel compiled with support for large "
1248 "devices.\n", diskname); 1215 "block devices.\n");
1249 sdkp->capacity = 0; 1216 sdkp->capacity = 0;
1250 goto got_data; 1217 goto got_data;
1251 } 1218 }
@@ -1284,8 +1251,8 @@ repeat:
1284got_data: 1251got_data:
1285 if (sector_size == 0) { 1252 if (sector_size == 0) {
1286 sector_size = 512; 1253 sector_size = 512;
1287 printk(KERN_NOTICE "%s : sector size 0 reported, " 1254 sd_printk(KERN_NOTICE, sdkp, "Sector size 0 reported, "
1288 "assuming 512.\n", diskname); 1255 "assuming 512.\n");
1289 } 1256 }
1290 1257
1291 if (sector_size != 512 && 1258 if (sector_size != 512 &&
@@ -1293,8 +1260,8 @@ got_data:
1293 sector_size != 2048 && 1260 sector_size != 2048 &&
1294 sector_size != 4096 && 1261 sector_size != 4096 &&
1295 sector_size != 256) { 1262 sector_size != 256) {
1296 printk(KERN_NOTICE "%s : unsupported sector size " 1263 sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n",
1297 "%d.\n", diskname, sector_size); 1264 sector_size);
1298 /* 1265 /*
1299 * The user might want to re-format the drive with 1266 * The user might want to re-format the drive with
1300 * a supported sectorsize. Once this happens, it 1267 * a supported sectorsize. Once this happens, it
@@ -1327,10 +1294,10 @@ got_data:
1327 mb -= sz - 974; 1294 mb -= sz - 974;
1328 sector_div(mb, 1950); 1295 sector_div(mb, 1950);
1329 1296
1330 printk(KERN_NOTICE "SCSI device %s: " 1297 sd_printk(KERN_NOTICE, sdkp,
1331 "%llu %d-byte hdwr sectors (%llu MB)\n", 1298 "%llu %d-byte hardware sectors (%llu MB)\n",
1332 diskname, (unsigned long long)sdkp->capacity, 1299 (unsigned long long)sdkp->capacity,
1333 hard_sector, (unsigned long long)mb); 1300 hard_sector, (unsigned long long)mb);
1334 } 1301 }
1335 1302
1336 /* Rescale capacity to 512-byte units */ 1303 /* Rescale capacity to 512-byte units */
@@ -1362,8 +1329,7 @@ sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage,
1362 * called with buffer of length SD_BUF_SIZE 1329 * called with buffer of length SD_BUF_SIZE
1363 */ 1330 */
1364static void 1331static void
1365sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, 1332sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
1366 unsigned char *buffer)
1367{ 1333{
1368 int res; 1334 int res;
1369 struct scsi_device *sdp = sdkp->device; 1335 struct scsi_device *sdp = sdkp->device;
@@ -1371,7 +1337,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
1371 1337
1372 set_disk_ro(sdkp->disk, 0); 1338 set_disk_ro(sdkp->disk, 0);
1373 if (sdp->skip_ms_page_3f) { 1339 if (sdp->skip_ms_page_3f) {
1374 printk(KERN_NOTICE "%s: assuming Write Enabled\n", diskname); 1340 sd_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n");
1375 return; 1341 return;
1376 } 1342 }
1377 1343
@@ -1403,15 +1369,16 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
1403 } 1369 }
1404 1370
1405 if (!scsi_status_is_good(res)) { 1371 if (!scsi_status_is_good(res)) {
1406 printk(KERN_WARNING 1372 sd_printk(KERN_WARNING, sdkp,
1407 "%s: test WP failed, assume Write Enabled\n", diskname); 1373 "Test WP failed, assume Write Enabled\n");
1408 } else { 1374 } else {
1409 sdkp->write_prot = ((data.device_specific & 0x80) != 0); 1375 sdkp->write_prot = ((data.device_specific & 0x80) != 0);
1410 set_disk_ro(sdkp->disk, sdkp->write_prot); 1376 set_disk_ro(sdkp->disk, sdkp->write_prot);
1411 printk(KERN_NOTICE "%s: Write Protect is %s\n", diskname, 1377 sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n",
1412 sdkp->write_prot ? "on" : "off"); 1378 sdkp->write_prot ? "on" : "off");
1413 printk(KERN_DEBUG "%s: Mode Sense: %02x %02x %02x %02x\n", 1379 sd_printk(KERN_DEBUG, sdkp,
1414 diskname, buffer[0], buffer[1], buffer[2], buffer[3]); 1380 "Mode Sense: %02x %02x %02x %02x\n",
1381 buffer[0], buffer[1], buffer[2], buffer[3]);
1415 } 1382 }
1416} 1383}
1417 1384
@@ -1420,8 +1387,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
1420 * called with buffer of length SD_BUF_SIZE 1387 * called with buffer of length SD_BUF_SIZE
1421 */ 1388 */
1422static void 1389static void
1423sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, 1390sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
1424 unsigned char *buffer)
1425{ 1391{
1426 int len = 0, res; 1392 int len = 0, res;
1427 struct scsi_device *sdp = sdkp->device; 1393 struct scsi_device *sdp = sdkp->device;
@@ -1450,8 +1416,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1450 1416
1451 if (!data.header_length) { 1417 if (!data.header_length) {
1452 modepage = 6; 1418 modepage = 6;
1453 printk(KERN_ERR "%s: missing header in MODE_SENSE response\n", 1419 sd_printk(KERN_ERR, sdkp, "Missing header in MODE_SENSE response\n");
1454 diskname);
1455 } 1420 }
1456 1421
1457 /* that went OK, now ask for the proper length */ 1422 /* that went OK, now ask for the proper length */
@@ -1478,13 +1443,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1478 int offset = data.header_length + data.block_descriptor_length; 1443 int offset = data.header_length + data.block_descriptor_length;
1479 1444
1480 if (offset >= SD_BUF_SIZE - 2) { 1445 if (offset >= SD_BUF_SIZE - 2) {
1481 printk(KERN_ERR "%s: malformed MODE SENSE response", 1446 sd_printk(KERN_ERR, sdkp, "Malformed MODE SENSE response\n");
1482 diskname);
1483 goto defaults; 1447 goto defaults;
1484 } 1448 }
1485 1449
1486 if ((buffer[offset] & 0x3f) != modepage) { 1450 if ((buffer[offset] & 0x3f) != modepage) {
1487 printk(KERN_ERR "%s: got wrong page\n", diskname); 1451 sd_printk(KERN_ERR, sdkp, "Got wrong page\n");
1488 goto defaults; 1452 goto defaults;
1489 } 1453 }
1490 1454
@@ -1498,14 +1462,13 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1498 1462
1499 sdkp->DPOFUA = (data.device_specific & 0x10) != 0; 1463 sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
1500 if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { 1464 if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
1501 printk(KERN_NOTICE "SCSI device %s: uses " 1465 sd_printk(KERN_NOTICE, sdkp,
1502 "READ/WRITE(6), disabling FUA\n", diskname); 1466 "Uses READ/WRITE(6), disabling FUA\n");
1503 sdkp->DPOFUA = 0; 1467 sdkp->DPOFUA = 0;
1504 } 1468 }
1505 1469
1506 printk(KERN_NOTICE "SCSI device %s: " 1470 sd_printk(KERN_NOTICE, sdkp,
1507 "write cache: %s, read cache: %s, %s\n", 1471 "Write cache: %s, read cache: %s, %s\n",
1508 diskname,
1509 sdkp->WCE ? "enabled" : "disabled", 1472 sdkp->WCE ? "enabled" : "disabled",
1510 sdkp->RCD ? "disabled" : "enabled", 1473 sdkp->RCD ? "disabled" : "enabled",
1511 sdkp->DPOFUA ? "supports DPO and FUA" 1474 sdkp->DPOFUA ? "supports DPO and FUA"
@@ -1518,15 +1481,13 @@ bad_sense:
1518 if (scsi_sense_valid(&sshdr) && 1481 if (scsi_sense_valid(&sshdr) &&
1519 sshdr.sense_key == ILLEGAL_REQUEST && 1482 sshdr.sense_key == ILLEGAL_REQUEST &&
1520 sshdr.asc == 0x24 && sshdr.ascq == 0x0) 1483 sshdr.asc == 0x24 && sshdr.ascq == 0x0)
1521 printk(KERN_NOTICE "%s: cache data unavailable\n", 1484 /* Invalid field in CDB */
1522 diskname); /* Invalid field in CDB */ 1485 sd_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n");
1523 else 1486 else
1524 printk(KERN_ERR "%s: asking for cache data failed\n", 1487 sd_printk(KERN_ERR, sdkp, "Asking for cache data failed\n");
1525 diskname);
1526 1488
1527defaults: 1489defaults:
1528 printk(KERN_ERR "%s: assuming drive cache: write through\n", 1490 sd_printk(KERN_ERR, sdkp, "Assuming drive cache: write through\n");
1529 diskname);
1530 sdkp->WCE = 0; 1491 sdkp->WCE = 0;
1531 sdkp->RCD = 0; 1492 sdkp->RCD = 0;
1532 sdkp->DPOFUA = 0; 1493 sdkp->DPOFUA = 0;
@@ -1544,7 +1505,8 @@ static int sd_revalidate_disk(struct gendisk *disk)
1544 unsigned char *buffer; 1505 unsigned char *buffer;
1545 unsigned ordered; 1506 unsigned ordered;
1546 1507
1547 SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); 1508 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp,
1509 "sd_revalidate_disk\n"));
1548 1510
1549 /* 1511 /*
1550 * If the device is offline, don't try and read capacity or any 1512 * If the device is offline, don't try and read capacity or any
@@ -1555,8 +1517,8 @@ static int sd_revalidate_disk(struct gendisk *disk)
1555 1517
1556 buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA); 1518 buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA);
1557 if (!buffer) { 1519 if (!buffer) {
1558 printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation " 1520 sd_printk(KERN_WARNING, sdkp, "sd_revalidate_disk: Memory "
1559 "failure.\n"); 1521 "allocation failure.\n");
1560 goto out; 1522 goto out;
1561 } 1523 }
1562 1524
@@ -1568,16 +1530,16 @@ static int sd_revalidate_disk(struct gendisk *disk)
1568 sdkp->WCE = 0; 1530 sdkp->WCE = 0;
1569 sdkp->RCD = 0; 1531 sdkp->RCD = 0;
1570 1532
1571 sd_spinup_disk(sdkp, disk->disk_name); 1533 sd_spinup_disk(sdkp);
1572 1534
1573 /* 1535 /*
1574 * Without media there is no reason to ask; moreover, some devices 1536 * Without media there is no reason to ask; moreover, some devices
1575 * react badly if we do. 1537 * react badly if we do.
1576 */ 1538 */
1577 if (sdkp->media_present) { 1539 if (sdkp->media_present) {
1578 sd_read_capacity(sdkp, disk->disk_name, buffer); 1540 sd_read_capacity(sdkp, buffer);
1579 sd_read_write_protect_flag(sdkp, disk->disk_name, buffer); 1541 sd_read_write_protect_flag(sdkp, buffer);
1580 sd_read_cache_type(sdkp, disk->disk_name, buffer); 1542 sd_read_cache_type(sdkp, buffer);
1581 } 1543 }
1582 1544
1583 /* 1545 /*
@@ -1709,8 +1671,8 @@ static int sd_probe(struct device *dev)
1709 dev_set_drvdata(dev, sdkp); 1671 dev_set_drvdata(dev, sdkp);
1710 add_disk(gd); 1672 add_disk(gd);
1711 1673
1712 sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n", 1674 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
1713 sdp->removable ? "removable " : "", gd->disk_name); 1675 sdp->removable ? "removable " : "");
1714 1676
1715 return 0; 1677 return 0;
1716 1678
@@ -1774,6 +1736,31 @@ static void scsi_disk_release(struct class_device *cdev)
1774 kfree(sdkp); 1736 kfree(sdkp);
1775} 1737}
1776 1738
1739static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
1740{
1741 unsigned char cmd[6] = { START_STOP }; /* START_VALID */
1742 struct scsi_sense_hdr sshdr;
1743 struct scsi_device *sdp = sdkp->device;
1744 int res;
1745
1746 if (start)
1747 cmd[4] |= 1; /* START */
1748
1749 if (!scsi_device_online(sdp))
1750 return -ENODEV;
1751
1752 res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
1753 SD_TIMEOUT, SD_MAX_RETRIES);
1754 if (res) {
1755 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
1756 sd_print_result(sdkp, res);
1757 if (driver_byte(res) & DRIVER_SENSE)
1758 sd_print_sense_hdr(sdkp, &sshdr);
1759 }
1760
1761 return res;
1762}
1763
1777/* 1764/*
1778 * Send a SYNCHRONIZE CACHE instruction down to the device through 1765 * Send a SYNCHRONIZE CACHE instruction down to the device through
1779 * the normal SCSI command structure. Wait for the command to 1766 * the normal SCSI command structure. Wait for the command to
@@ -1781,20 +1768,62 @@ static void scsi_disk_release(struct class_device *cdev)
1781 */ 1768 */
1782static void sd_shutdown(struct device *dev) 1769static void sd_shutdown(struct device *dev)
1783{ 1770{
1784 struct scsi_device *sdp = to_scsi_device(dev);
1785 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1771 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1786 1772
1787 if (!sdkp) 1773 if (!sdkp)
1788 return; /* this can happen */ 1774 return; /* this can happen */
1789 1775
1790 if (sdkp->WCE) { 1776 if (sdkp->WCE) {
1791 printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: \n", 1777 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
1792 sdkp->disk->disk_name); 1778 sd_sync_cache(sdkp);
1793 sd_sync_cache(sdp); 1779 }
1780
1781 if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
1782 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
1783 sd_start_stop_device(sdkp, 0);
1794 } 1784 }
1785
1795 scsi_disk_put(sdkp); 1786 scsi_disk_put(sdkp);
1796} 1787}
1797 1788
1789static int sd_suspend(struct device *dev, pm_message_t mesg)
1790{
1791 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1792 int ret;
1793
1794 if (!sdkp)
1795 return 0; /* this can happen */
1796
1797 if (sdkp->WCE) {
1798 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
1799 ret = sd_sync_cache(sdkp);
1800 if (ret)
1801 return ret;
1802 }
1803
1804 if (mesg.event == PM_EVENT_SUSPEND &&
1805 sdkp->device->manage_start_stop) {
1806 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
1807 ret = sd_start_stop_device(sdkp, 0);
1808 if (ret)
1809 return ret;
1810 }
1811
1812 return 0;
1813}
1814
1815static int sd_resume(struct device *dev)
1816{
1817 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1818
1819 if (!sdkp->device->manage_start_stop)
1820 return 0;
1821
1822 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
1823
1824 return sd_start_stop_device(sdkp, 1);
1825}
1826
1798/** 1827/**
1799 * init_sd - entry point for this driver (both when built in or when 1828 * init_sd - entry point for this driver (both when built in or when
1800 * a module). 1829 * a module).
@@ -1852,3 +1881,19 @@ static void __exit exit_sd(void)
1852 1881
1853module_init(init_sd); 1882module_init(init_sd);
1854module_exit(exit_sd); 1883module_exit(exit_sd);
1884
1885static void sd_print_sense_hdr(struct scsi_disk *sdkp,
1886 struct scsi_sense_hdr *sshdr)
1887{
1888 sd_printk(KERN_INFO, sdkp, "");
1889 scsi_show_sense_hdr(sshdr);
1890 sd_printk(KERN_INFO, sdkp, "");
1891 scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
1892}
1893
1894static void sd_print_result(struct scsi_disk *sdkp, int result)
1895{
1896 sd_printk(KERN_INFO, sdkp, "");
1897 scsi_show_result(result);
1898}
1899
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 81e3bc7b02a1..570977cf9efb 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -917,6 +917,8 @@ sg_ioctl(struct inode *inode, struct file *filp,
917 return result; 917 return result;
918 if (val < 0) 918 if (val < 0)
919 return -EINVAL; 919 return -EINVAL;
920 val = min_t(int, val,
921 sdp->device->request_queue->max_sectors * 512);
920 if (val != sfp->reserve.bufflen) { 922 if (val != sfp->reserve.bufflen) {
921 if (sg_res_in_use(sfp) || sfp->mmap_called) 923 if (sg_res_in_use(sfp) || sfp->mmap_called)
922 return -EBUSY; 924 return -EBUSY;
@@ -925,7 +927,8 @@ sg_ioctl(struct inode *inode, struct file *filp,
925 } 927 }
926 return 0; 928 return 0;
927 case SG_GET_RESERVED_SIZE: 929 case SG_GET_RESERVED_SIZE:
928 val = (int) sfp->reserve.bufflen; 930 val = min_t(int, sfp->reserve.bufflen,
931 sdp->device->request_queue->max_sectors * 512);
929 return put_user(val, ip); 932 return put_user(val, ip);
930 case SG_SET_COMMAND_Q: 933 case SG_SET_COMMAND_Q:
931 result = get_user(val, ip); 934 result = get_user(val, ip);
@@ -1061,6 +1064,9 @@ sg_ioctl(struct inode *inode, struct file *filp,
1061 if (sdp->detached) 1064 if (sdp->detached)
1062 return -ENODEV; 1065 return -ENODEV;
1063 return scsi_ioctl(sdp->device, cmd_in, p); 1066 return scsi_ioctl(sdp->device, cmd_in, p);
1067 case BLKSECTGET:
1068 return put_user(sdp->device->request_queue->max_sectors * 512,
1069 ip);
1064 default: 1070 default:
1065 if (read_only) 1071 if (read_only)
1066 return -EPERM; /* don't know so take safe approach */ 1072 return -EPERM; /* don't know so take safe approach */
@@ -2339,6 +2345,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
2339{ 2345{
2340 Sg_fd *sfp; 2346 Sg_fd *sfp;
2341 unsigned long iflags; 2347 unsigned long iflags;
2348 int bufflen;
2342 2349
2343 sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); 2350 sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN);
2344 if (!sfp) 2351 if (!sfp)
@@ -2369,7 +2376,9 @@ sg_add_sfp(Sg_device * sdp, int dev)
2369 if (unlikely(sg_big_buff != def_reserved_size)) 2376 if (unlikely(sg_big_buff != def_reserved_size))
2370 sg_big_buff = def_reserved_size; 2377 sg_big_buff = def_reserved_size;
2371 2378
2372 sg_build_reserve(sfp, sg_big_buff); 2379 bufflen = min_t(int, sg_big_buff,
2380 sdp->device->request_queue->max_sectors * 512);
2381 sg_build_reserve(sfp, bufflen);
2373 SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n", 2382 SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n",
2374 sfp->reserve.bufflen, sfp->reserve.k_use_sg)); 2383 sfp->reserve.bufflen, sfp->reserve.k_use_sg));
2375 return sfp; 2384 return sfp;
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 1857d68e7195..f9a52af7f5b4 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -62,6 +62,8 @@
62MODULE_DESCRIPTION("SCSI cdrom (sr) driver"); 62MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
63MODULE_LICENSE("GPL"); 63MODULE_LICENSE("GPL");
64MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR); 64MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
65MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);
66MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
65 67
66#define SR_DISKS 256 68#define SR_DISKS 256
67 69
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 98d8411bbccc..55bfeccf68a2 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -89,6 +89,7 @@ MODULE_AUTHOR("Kai Makisara");
89MODULE_DESCRIPTION("SCSI tape (st) driver"); 89MODULE_DESCRIPTION("SCSI tape (st) driver");
90MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR); 91MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR);
92MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);
92 93
93/* Set 'perm' (4th argument) to 0 to disable module_param's definition 94/* Set 'perm' (4th argument) to 0 to disable module_param's definition
94 * of sysfs parameters (which module_param doesn't yet support). 95 * of sysfs parameters (which module_param doesn't yet support).
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 8c766bcd1095..bbeb2451d32f 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/delay.h>
8#include <linux/module.h> 9#include <linux/module.h>
9#include <linux/init.h> 10#include <linux/init.h>
10 11
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index a583e89238fc..3158949ffa62 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2680,7 +2680,7 @@ static int __init dc390_module_init(void)
2680 printk (KERN_INFO "DC390: Using safe settings.\n"); 2680 printk (KERN_INFO "DC390: Using safe settings.\n");
2681 } 2681 }
2682 2682
2683 return pci_module_init(&dc390_driver); 2683 return pci_register_driver(&dc390_driver);
2684} 2684}
2685 2685
2686static void __exit dc390_module_exit(void) 2686static void __exit dc390_module_exit(void)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 90621c3312bc..c9832d963f1e 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -251,9 +251,16 @@ static const struct serial8250_config uart_config[] = {
251 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, 251 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
252 .flags = UART_CAP_FIFO | UART_CAP_UUE, 252 .flags = UART_CAP_FIFO | UART_CAP_UUE,
253 }, 253 },
254 [PORT_RM9000] = {
255 .name = "RM9000",
256 .fifo_size = 16,
257 .tx_loadsz = 16,
258 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
259 .flags = UART_CAP_FIFO,
260 },
254}; 261};
255 262
256#ifdef CONFIG_SERIAL_8250_AU1X00 263#if defined (CONFIG_SERIAL_8250_AU1X00)
257 264
258/* Au1x00 UART hardware has a weird register layout */ 265/* Au1x00 UART hardware has a weird register layout */
259static const u8 au_io_in_map[] = { 266static const u8 au_io_in_map[] = {
@@ -289,6 +296,44 @@ static inline int map_8250_out_reg(struct uart_8250_port *up, int offset)
289 return au_io_out_map[offset]; 296 return au_io_out_map[offset];
290} 297}
291 298
299#elif defined (CONFIG_SERIAL_8250_RM9K)
300
301static const u8
302 regmap_in[8] = {
303 [UART_RX] = 0x00,
304 [UART_IER] = 0x0c,
305 [UART_IIR] = 0x14,
306 [UART_LCR] = 0x1c,
307 [UART_MCR] = 0x20,
308 [UART_LSR] = 0x24,
309 [UART_MSR] = 0x28,
310 [UART_SCR] = 0x2c
311 },
312 regmap_out[8] = {
313 [UART_TX] = 0x04,
314 [UART_IER] = 0x0c,
315 [UART_FCR] = 0x18,
316 [UART_LCR] = 0x1c,
317 [UART_MCR] = 0x20,
318 [UART_LSR] = 0x24,
319 [UART_MSR] = 0x28,
320 [UART_SCR] = 0x2c
321 };
322
323static inline int map_8250_in_reg(struct uart_8250_port *up, int offset)
324{
325 if (up->port.iotype != UPIO_RM9000)
326 return offset;
327 return regmap_in[offset];
328}
329
330static inline int map_8250_out_reg(struct uart_8250_port *up, int offset)
331{
332 if (up->port.iotype != UPIO_RM9000)
333 return offset;
334 return regmap_out[offset];
335}
336
292#else 337#else
293 338
294/* sane hardware needs no mapping */ 339/* sane hardware needs no mapping */
@@ -308,8 +353,10 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
308 return inb(up->port.iobase + 1); 353 return inb(up->port.iobase + 1);
309 354
310 case UPIO_MEM: 355 case UPIO_MEM:
356 case UPIO_DWAPB:
311 return readb(up->port.membase + offset); 357 return readb(up->port.membase + offset);
312 358
359 case UPIO_RM9000:
313 case UPIO_MEM32: 360 case UPIO_MEM32:
314 return readl(up->port.membase + offset); 361 return readl(up->port.membase + offset);
315 362
@@ -333,6 +380,8 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
333static void 380static void
334serial_out(struct uart_8250_port *up, int offset, int value) 381serial_out(struct uart_8250_port *up, int offset, int value)
335{ 382{
383 /* Save the offset before it's remapped */
384 int save_offset = offset;
336 offset = map_8250_out_reg(up, offset) << up->port.regshift; 385 offset = map_8250_out_reg(up, offset) << up->port.regshift;
337 386
338 switch (up->port.iotype) { 387 switch (up->port.iotype) {
@@ -345,6 +394,7 @@ serial_out(struct uart_8250_port *up, int offset, int value)
345 writeb(value, up->port.membase + offset); 394 writeb(value, up->port.membase + offset);
346 break; 395 break;
347 396
397 case UPIO_RM9000:
348 case UPIO_MEM32: 398 case UPIO_MEM32:
349 writel(value, up->port.membase + offset); 399 writel(value, up->port.membase + offset);
350 break; 400 break;
@@ -359,6 +409,18 @@ serial_out(struct uart_8250_port *up, int offset, int value)
359 writeb(value, up->port.membase + offset); 409 writeb(value, up->port.membase + offset);
360 break; 410 break;
361 411
412 case UPIO_DWAPB:
413 /* Save the LCR value so it can be re-written when a
414 * Busy Detect interrupt occurs. */
415 if (save_offset == UART_LCR)
416 up->lcr = value;
417 writeb(value, up->port.membase + offset);
418 /* Read the IER to ensure any interrupt is cleared before
419 * returning from ISR. */
420 if (save_offset == UART_TX || save_offset == UART_IER)
421 value = serial_in(up, UART_IER);
422 break;
423
362 default: 424 default:
363 outb(value, up->port.iobase + offset); 425 outb(value, up->port.iobase + offset);
364 } 426 }
@@ -373,6 +435,7 @@ serial_out_sync(struct uart_8250_port *up, int offset, int value)
373#ifdef CONFIG_SERIAL_8250_AU1X00 435#ifdef CONFIG_SERIAL_8250_AU1X00
374 case UPIO_AU: 436 case UPIO_AU:
375#endif 437#endif
438 case UPIO_DWAPB:
376 serial_out(up, offset, value); 439 serial_out(up, offset, value);
377 serial_in(up, UART_LCR); /* safe, no side-effects */ 440 serial_in(up, UART_LCR); /* safe, no side-effects */
378 break; 441 break;
@@ -403,7 +466,7 @@ static inline void _serial_dl_write(struct uart_8250_port *up, int value)
403 serial_outp(up, UART_DLM, value >> 8 & 0xff); 466 serial_outp(up, UART_DLM, value >> 8 & 0xff);
404} 467}
405 468
406#ifdef CONFIG_SERIAL_8250_AU1X00 469#if defined (CONFIG_SERIAL_8250_AU1X00)
407/* Au1x00 haven't got a standard divisor latch */ 470/* Au1x00 haven't got a standard divisor latch */
408static int serial_dl_read(struct uart_8250_port *up) 471static int serial_dl_read(struct uart_8250_port *up)
409{ 472{
@@ -420,6 +483,24 @@ static void serial_dl_write(struct uart_8250_port *up, int value)
420 else 483 else
421 _serial_dl_write(up, value); 484 _serial_dl_write(up, value);
422} 485}
486#elif defined (CONFIG_SERIAL_8250_RM9K)
487static int serial_dl_read(struct uart_8250_port *up)
488{
489 return (up->port.iotype == UPIO_RM9000) ?
490 (((__raw_readl(up->port.membase + 0x10) << 8) |
491 (__raw_readl(up->port.membase + 0x08) & 0xff)) & 0xffff) :
492 _serial_dl_read(up);
493}
494
495static void serial_dl_write(struct uart_8250_port *up, int value)
496{
497 if (up->port.iotype == UPIO_RM9000) {
498 __raw_writel(value, up->port.membase + 0x08);
499 __raw_writel(value >> 8, up->port.membase + 0x10);
500 } else {
501 _serial_dl_write(up, value);
502 }
503}
423#else 504#else
424#define serial_dl_read(up) _serial_dl_read(up) 505#define serial_dl_read(up) _serial_dl_read(up)
425#define serial_dl_write(up, value) _serial_dl_write(up, value) 506#define serial_dl_write(up, value) _serial_dl_write(up, value)
@@ -621,7 +702,7 @@ static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
621 * its clones. (We treat the broken original StarTech 16650 V1 as a 702 * its clones. (We treat the broken original StarTech 16650 V1 as a
622 * 16550, and why not? Startech doesn't seem to even acknowledge its 703 * 16550, and why not? Startech doesn't seem to even acknowledge its
623 * existence.) 704 * existence.)
624 * 705 *
625 * What evil have men's minds wrought... 706 * What evil have men's minds wrought...
626 */ 707 */
627static void autoconfig_has_efr(struct uart_8250_port *up) 708static void autoconfig_has_efr(struct uart_8250_port *up)
@@ -674,7 +755,7 @@ static void autoconfig_has_efr(struct uart_8250_port *up)
674 up->bugs |= UART_BUG_QUOT; 755 up->bugs |= UART_BUG_QUOT;
675 return; 756 return;
676 } 757 }
677 758
678 /* 759 /*
679 * We check for a XR16C850 by setting DLL and DLM to 0, and then 760 * We check for a XR16C850 by setting DLL and DLM to 0, and then
680 * reading back DLL and DLM. The chip type depends on the DLM 761 * reading back DLL and DLM. The chip type depends on the DLM
@@ -817,7 +898,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
817 status1 &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */ 898 status1 &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */
818 status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */ 899 status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */
819 serial_outp(up, 0x04, status1); 900 serial_outp(up, 0x04, status1);
820 901
821 serial_dl_write(up, quot); 902 serial_dl_write(up, quot);
822 903
823 serial_outp(up, UART_LCR, 0); 904 serial_outp(up, UART_LCR, 0);
@@ -922,7 +1003,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
922 /* 1003 /*
923 * Do a simple existence test first; if we fail this, 1004 * Do a simple existence test first; if we fail this,
924 * there's no point trying anything else. 1005 * there's no point trying anything else.
925 * 1006 *
926 * 0x80 is used as a nonsense port to prevent against 1007 * 0x80 is used as a nonsense port to prevent against
927 * false positives due to ISA bus float. The 1008 * false positives due to ISA bus float. The
928 * assumption is that 0x80 is a non-existent port; 1009 * assumption is that 0x80 is a non-existent port;
@@ -961,7 +1042,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
961 save_mcr = serial_in(up, UART_MCR); 1042 save_mcr = serial_in(up, UART_MCR);
962 save_lcr = serial_in(up, UART_LCR); 1043 save_lcr = serial_in(up, UART_LCR);
963 1044
964 /* 1045 /*
965 * Check to see if a UART is really there. Certain broken 1046 * Check to see if a UART is really there. Certain broken
966 * internal modems based on the Rockwell chipset fail this 1047 * internal modems based on the Rockwell chipset fail this
967 * test, because they apparently don't implement the loopback 1048 * test, because they apparently don't implement the loopback
@@ -1068,7 +1149,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1068 else 1149 else
1069 serial_outp(up, UART_IER, 0); 1150 serial_outp(up, UART_IER, 0);
1070 1151
1071 out: 1152 out:
1072 spin_unlock_irqrestore(&up->port.lock, flags); 1153 spin_unlock_irqrestore(&up->port.lock, flags);
1073// restore_flags(flags); 1154// restore_flags(flags);
1074 DEBUG_AUTOCONF("type=%s\n", uart_config[up->port.type].name); 1155 DEBUG_AUTOCONF("type=%s\n", uart_config[up->port.type].name);
@@ -1094,7 +1175,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
1094 save_mcr = serial_inp(up, UART_MCR); 1175 save_mcr = serial_inp(up, UART_MCR);
1095 save_ier = serial_inp(up, UART_IER); 1176 save_ier = serial_inp(up, UART_IER);
1096 serial_outp(up, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2); 1177 serial_outp(up, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2);
1097 1178
1098 irqs = probe_irq_on(); 1179 irqs = probe_irq_on();
1099 serial_outp(up, UART_MCR, 0); 1180 serial_outp(up, UART_MCR, 0);
1100 udelay (10); 1181 udelay (10);
@@ -1159,8 +1240,11 @@ static void serial8250_start_tx(struct uart_port *port)
1159 if (up->bugs & UART_BUG_TXEN) { 1240 if (up->bugs & UART_BUG_TXEN) {
1160 unsigned char lsr, iir; 1241 unsigned char lsr, iir;
1161 lsr = serial_in(up, UART_LSR); 1242 lsr = serial_in(up, UART_LSR);
1162 iir = serial_in(up, UART_IIR); 1243 iir = serial_in(up, UART_IIR) & 0x0f;
1163 if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) 1244 if ((up->port.type == PORT_RM9000) ?
1245 (lsr & UART_LSR_THRE &&
1246 (iir == UART_IIR_NO_INT || iir == UART_IIR_THRI)) :
1247 (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT))
1164 transmit_chars(up); 1248 transmit_chars(up);
1165 } 1249 }
1166 } 1250 }
@@ -1389,6 +1473,19 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
1389 handled = 1; 1473 handled = 1;
1390 1474
1391 end = NULL; 1475 end = NULL;
1476 } else if (up->port.iotype == UPIO_DWAPB &&
1477 (iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
1478 /* The DesignWare APB UART has an Busy Detect (0x07)
1479 * interrupt meaning an LCR write attempt occured while the
1480 * UART was busy. The interrupt must be cleared by reading
1481 * the UART status register (USR) and the LCR re-written. */
1482 unsigned int status;
1483 status = *(volatile u32 *)up->port.private_data;
1484 serial_out(up, UART_LCR, up->lcr);
1485
1486 handled = 1;
1487
1488 end = NULL;
1392 } else if (end == NULL) 1489 } else if (end == NULL)
1393 end = l; 1490 end = l;
1394 1491
@@ -1928,7 +2025,7 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
1928 /* 2025 /*
1929 * Ask the core to calculate the divisor for us. 2026 * Ask the core to calculate the divisor for us.
1930 */ 2027 */
1931 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 2028 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
1932 quot = serial8250_get_divisor(port, baud); 2029 quot = serial8250_get_divisor(port, baud);
1933 2030
1934 /* 2031 /*
@@ -2090,6 +2187,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
2090 case UPIO_TSI: 2187 case UPIO_TSI:
2091 case UPIO_MEM32: 2188 case UPIO_MEM32:
2092 case UPIO_MEM: 2189 case UPIO_MEM:
2190 case UPIO_DWAPB:
2093 if (!up->port.mapbase) 2191 if (!up->port.mapbase)
2094 break; 2192 break;
2095 2193
@@ -2127,6 +2225,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up)
2127 case UPIO_TSI: 2225 case UPIO_TSI:
2128 case UPIO_MEM32: 2226 case UPIO_MEM32:
2129 case UPIO_MEM: 2227 case UPIO_MEM:
2228 case UPIO_DWAPB:
2130 if (!up->port.mapbase) 2229 if (!up->port.mapbase)
2131 break; 2230 break;
2132 2231
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ad9f321968e1..924e9bd757f0 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -254,6 +254,15 @@ config SERIAL_8250_AU1X00
254 to this option. The driver can handle 1 or 2 serial ports. 254 to this option. The driver can handle 1 or 2 serial ports.
255 If unsure, say N. 255 If unsure, say N.
256 256
257config SERIAL_8250_RM9K
258 bool "Support for MIPS RM9xxx integrated serial port"
259 depends on SERIAL_8250 != n && SERIAL_RM9000
260 select SERIAL_8250_SHARE_IRQ
261 help
262 Selecting this option will add support for the integrated serial
263 port hardware found on MIPS RM9122 and similar processors.
264 If unsure, say N.
265
257comment "Non-8250 serial port support" 266comment "Non-8250 serial port support"
258 267
259config SERIAL_AMBA_PL010 268config SERIAL_AMBA_PL010
@@ -499,6 +508,100 @@ config SERIAL_SA1100_CONSOLE
499 your boot loader (lilo or loadlin) about how to pass options to the 508 your boot loader (lilo or loadlin) about how to pass options to the
500 kernel at boot time.) 509 kernel at boot time.)
501 510
511config SERIAL_BFIN
512 tristate "Blackfin serial port support"
513 depends on BFIN
514 select SERIAL_CORE
515 select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561)
516 help
517 Add support for the built-in UARTs on the Blackfin.
518
519 To compile this driver as a module, choose M here: the
520 module will be called bfin_5xx.
521
522config SERIAL_BFIN_CONSOLE
523 bool "Console on Blackfin serial port"
524 depends on SERIAL_BFIN
525 select SERIAL_CORE_CONSOLE
526
527choice
528 prompt "UART Mode"
529 depends on SERIAL_BFIN
530 default SERIAL_BFIN_DMA
531 help
532 This driver supports the built-in serial ports of the Blackfin family
533 of CPUs
534
535config SERIAL_BFIN_DMA
536 bool "DMA mode"
537 depends on DMA_UNCACHED_1M
538 help
539 This driver works under DMA mode. If this option is selected, the
540 blackfin simple dma driver is also enabled.
541
542config SERIAL_BFIN_PIO
543 bool "PIO mode"
544 help
545 This driver works under PIO mode.
546
547endchoice
548
549config SERIAL_BFIN_UART0
550 bool "Enable UART0"
551 depends on SERIAL_BFIN
552 help
553 Enable UART0
554
555config BFIN_UART0_CTSRTS
556 bool "Enable UART0 hardware flow control"
557 depends on SERIAL_BFIN_UART0
558 help
559 Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS
560 signal.
561
562config UART0_CTS_PIN
563 int "UART0 CTS pin"
564 depends on BFIN_UART0_CTSRTS
565 default 23
566 help
567 The default pin is GPIO_GP7.
568 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
569
570config UART0_RTS_PIN
571 int "UART0 RTS pin"
572 depends on BFIN_UART0_CTSRTS
573 default 22
574 help
575 The default pin is GPIO_GP6.
576 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
577
578config SERIAL_BFIN_UART1
579 bool "Enable UART1"
580 depends on SERIAL_BFIN && (BF534 || BF536 || BF537)
581 help
582 Enable UART1
583
584config BFIN_UART1_CTSRTS
585 bool "Enable UART1 hardware flow control"
586 depends on SERIAL_BFIN_UART1
587 help
588 Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS
589 signal.
590
591config UART1_CTS_PIN
592 int "UART1 CTS pin"
593 depends on BFIN_UART1_CTSRTS
594 default -1
595 help
596 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
597
598config UART1_RTS_PIN
599 int "UART1 RTS pin"
600 depends on BFIN_UART1_CTSRTS
601 default -1
602 help
603 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
604
502config SERIAL_IMX 605config SERIAL_IMX
503 bool "IMX serial port support" 606 bool "IMX serial port support"
504 depends on ARM && ARCH_IMX 607 depends on ARM && ARCH_IMX
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 6b3560c5749a..4959bcb8d1ef 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
27obj-$(CONFIG_SERIAL_PXA) += pxa.o 27obj-$(CONFIG_SERIAL_PXA) += pxa.o
28obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o 28obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o
29obj-$(CONFIG_SERIAL_SA1100) += sa1100.o 29obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
30obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o
30obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 31obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
31obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o 32obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
32obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o 33obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index f69bd097166e..1a9a24b82636 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -48,6 +48,7 @@
48#include <linux/serial.h> 48#include <linux/serial.h>
49#include <linux/amba/bus.h> 49#include <linux/amba/bus.h>
50#include <linux/amba/serial.h> 50#include <linux/amba/serial.h>
51#include <linux/clk.h>
51 52
52#include <asm/io.h> 53#include <asm/io.h>
53 54
@@ -70,6 +71,7 @@
70 */ 71 */
71struct uart_amba_port { 72struct uart_amba_port {
72 struct uart_port port; 73 struct uart_port port;
74 struct clk *clk;
73 struct amba_device *dev; 75 struct amba_device *dev;
74 struct amba_pl010_data *data; 76 struct amba_pl010_data *data;
75 unsigned int old_status; 77 unsigned int old_status;
@@ -77,73 +79,77 @@ struct uart_amba_port {
77 79
78static void pl010_stop_tx(struct uart_port *port) 80static void pl010_stop_tx(struct uart_port *port)
79{ 81{
82 struct uart_amba_port *uap = (struct uart_amba_port *)port;
80 unsigned int cr; 83 unsigned int cr;
81 84
82 cr = readb(port->membase + UART010_CR); 85 cr = readb(uap->port.membase + UART010_CR);
83 cr &= ~UART010_CR_TIE; 86 cr &= ~UART010_CR_TIE;
84 writel(cr, port->membase + UART010_CR); 87 writel(cr, uap->port.membase + UART010_CR);
85} 88}
86 89
87static void pl010_start_tx(struct uart_port *port) 90static void pl010_start_tx(struct uart_port *port)
88{ 91{
92 struct uart_amba_port *uap = (struct uart_amba_port *)port;
89 unsigned int cr; 93 unsigned int cr;
90 94
91 cr = readb(port->membase + UART010_CR); 95 cr = readb(uap->port.membase + UART010_CR);
92 cr |= UART010_CR_TIE; 96 cr |= UART010_CR_TIE;
93 writel(cr, port->membase + UART010_CR); 97 writel(cr, uap->port.membase + UART010_CR);
94} 98}
95 99
96static void pl010_stop_rx(struct uart_port *port) 100static void pl010_stop_rx(struct uart_port *port)
97{ 101{
102 struct uart_amba_port *uap = (struct uart_amba_port *)port;
98 unsigned int cr; 103 unsigned int cr;
99 104
100 cr = readb(port->membase + UART010_CR); 105 cr = readb(uap->port.membase + UART010_CR);
101 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); 106 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
102 writel(cr, port->membase + UART010_CR); 107 writel(cr, uap->port.membase + UART010_CR);
103} 108}
104 109
105static void pl010_enable_ms(struct uart_port *port) 110static void pl010_enable_ms(struct uart_port *port)
106{ 111{
112 struct uart_amba_port *uap = (struct uart_amba_port *)port;
107 unsigned int cr; 113 unsigned int cr;
108 114
109 cr = readb(port->membase + UART010_CR); 115 cr = readb(uap->port.membase + UART010_CR);
110 cr |= UART010_CR_MSIE; 116 cr |= UART010_CR_MSIE;
111 writel(cr, port->membase + UART010_CR); 117 writel(cr, uap->port.membase + UART010_CR);
112} 118}
113 119
114static void pl010_rx_chars(struct uart_port *port) 120static void pl010_rx_chars(struct uart_amba_port *uap)
115{ 121{
116 struct tty_struct *tty = port->info->tty; 122 struct tty_struct *tty = uap->port.info->tty;
117 unsigned int status, ch, flag, rsr, max_count = 256; 123 unsigned int status, ch, flag, rsr, max_count = 256;
118 124
119 status = readb(port->membase + UART01x_FR); 125 status = readb(uap->port.membase + UART01x_FR);
120 while (UART_RX_DATA(status) && max_count--) { 126 while (UART_RX_DATA(status) && max_count--) {
121 ch = readb(port->membase + UART01x_DR); 127 ch = readb(uap->port.membase + UART01x_DR);
122 flag = TTY_NORMAL; 128 flag = TTY_NORMAL;
123 129
124 port->icount.rx++; 130 uap->port.icount.rx++;
125 131
126 /* 132 /*
127 * Note that the error handling code is 133 * Note that the error handling code is
128 * out of the main execution path 134 * out of the main execution path
129 */ 135 */
130 rsr = readb(port->membase + UART01x_RSR) | UART_DUMMY_RSR_RX; 136 rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
131 if (unlikely(rsr & UART01x_RSR_ANY)) { 137 if (unlikely(rsr & UART01x_RSR_ANY)) {
132 writel(0, port->membase + UART01x_ECR); 138 writel(0, uap->port.membase + UART01x_ECR);
133 139
134 if (rsr & UART01x_RSR_BE) { 140 if (rsr & UART01x_RSR_BE) {
135 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); 141 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
136 port->icount.brk++; 142 uap->port.icount.brk++;
137 if (uart_handle_break(port)) 143 if (uart_handle_break(&uap->port))
138 goto ignore_char; 144 goto ignore_char;
139 } else if (rsr & UART01x_RSR_PE) 145 } else if (rsr & UART01x_RSR_PE)
140 port->icount.parity++; 146 uap->port.icount.parity++;
141 else if (rsr & UART01x_RSR_FE) 147 else if (rsr & UART01x_RSR_FE)
142 port->icount.frame++; 148 uap->port.icount.frame++;
143 if (rsr & UART01x_RSR_OE) 149 if (rsr & UART01x_RSR_OE)
144 port->icount.overrun++; 150 uap->port.icount.overrun++;
145 151
146 rsr &= port->read_status_mask; 152 rsr &= uap->port.read_status_mask;
147 153
148 if (rsr & UART01x_RSR_BE) 154 if (rsr & UART01x_RSR_BE)
149 flag = TTY_BREAK; 155 flag = TTY_BREAK;
@@ -153,53 +159,52 @@ static void pl010_rx_chars(struct uart_port *port)
153 flag = TTY_FRAME; 159 flag = TTY_FRAME;
154 } 160 }
155 161
156 if (uart_handle_sysrq_char(port, ch)) 162 if (uart_handle_sysrq_char(&uap->port, ch))
157 goto ignore_char; 163 goto ignore_char;
158 164
159 uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag); 165 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
160 166
161 ignore_char: 167 ignore_char:
162 status = readb(port->membase + UART01x_FR); 168 status = readb(uap->port.membase + UART01x_FR);
163 } 169 }
164 tty_flip_buffer_push(tty); 170 tty_flip_buffer_push(tty);
165 return; 171 return;
166} 172}
167 173
168static void pl010_tx_chars(struct uart_port *port) 174static void pl010_tx_chars(struct uart_amba_port *uap)
169{ 175{
170 struct circ_buf *xmit = &port->info->xmit; 176 struct circ_buf *xmit = &uap->port.info->xmit;
171 int count; 177 int count;
172 178
173 if (port->x_char) { 179 if (uap->port.x_char) {
174 writel(port->x_char, port->membase + UART01x_DR); 180 writel(uap->port.x_char, uap->port.membase + UART01x_DR);
175 port->icount.tx++; 181 uap->port.icount.tx++;
176 port->x_char = 0; 182 uap->port.x_char = 0;
177 return; 183 return;
178 } 184 }
179 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 185 if (uart_circ_empty(xmit) || uart_tx_stopped(&uap->port)) {
180 pl010_stop_tx(port); 186 pl010_stop_tx(&uap->port);
181 return; 187 return;
182 } 188 }
183 189
184 count = port->fifosize >> 1; 190 count = uap->port.fifosize >> 1;
185 do { 191 do {
186 writel(xmit->buf[xmit->tail], port->membase + UART01x_DR); 192 writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
187 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 193 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
188 port->icount.tx++; 194 uap->port.icount.tx++;
189 if (uart_circ_empty(xmit)) 195 if (uart_circ_empty(xmit))
190 break; 196 break;
191 } while (--count > 0); 197 } while (--count > 0);
192 198
193 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 199 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
194 uart_write_wakeup(port); 200 uart_write_wakeup(&uap->port);
195 201
196 if (uart_circ_empty(xmit)) 202 if (uart_circ_empty(xmit))
197 pl010_stop_tx(port); 203 pl010_stop_tx(&uap->port);
198} 204}
199 205
200static void pl010_modem_status(struct uart_port *port) 206static void pl010_modem_status(struct uart_amba_port *uap)
201{ 207{
202 struct uart_amba_port *uap = (struct uart_amba_port *)port;
203 unsigned int status, delta; 208 unsigned int status, delta;
204 209
205 writel(0, uap->port.membase + UART010_ICR); 210 writel(0, uap->port.membase + UART010_ICR);
@@ -226,47 +231,50 @@ static void pl010_modem_status(struct uart_port *port)
226 231
227static irqreturn_t pl010_int(int irq, void *dev_id) 232static irqreturn_t pl010_int(int irq, void *dev_id)
228{ 233{
229 struct uart_port *port = dev_id; 234 struct uart_amba_port *uap = dev_id;
230 unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT; 235 unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
231 int handled = 0; 236 int handled = 0;
232 237
233 spin_lock(&port->lock); 238 spin_lock(&uap->port.lock);
234 239
235 status = readb(port->membase + UART010_IIR); 240 status = readb(uap->port.membase + UART010_IIR);
236 if (status) { 241 if (status) {
237 do { 242 do {
238 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) 243 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
239 pl010_rx_chars(port); 244 pl010_rx_chars(uap);
240 if (status & UART010_IIR_MIS) 245 if (status & UART010_IIR_MIS)
241 pl010_modem_status(port); 246 pl010_modem_status(uap);
242 if (status & UART010_IIR_TIS) 247 if (status & UART010_IIR_TIS)
243 pl010_tx_chars(port); 248 pl010_tx_chars(uap);
244 249
245 if (pass_counter-- == 0) 250 if (pass_counter-- == 0)
246 break; 251 break;
247 252
248 status = readb(port->membase + UART010_IIR); 253 status = readb(uap->port.membase + UART010_IIR);
249 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | 254 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
250 UART010_IIR_TIS)); 255 UART010_IIR_TIS));
251 handled = 1; 256 handled = 1;
252 } 257 }
253 258
254 spin_unlock(&port->lock); 259 spin_unlock(&uap->port.lock);
255 260
256 return IRQ_RETVAL(handled); 261 return IRQ_RETVAL(handled);
257} 262}
258 263
259static unsigned int pl010_tx_empty(struct uart_port *port) 264static unsigned int pl010_tx_empty(struct uart_port *port)
260{ 265{
261 return readb(port->membase + UART01x_FR) & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; 266 struct uart_amba_port *uap = (struct uart_amba_port *)port;
267 unsigned int status = readb(uap->port.membase + UART01x_FR);
268 return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
262} 269}
263 270
264static unsigned int pl010_get_mctrl(struct uart_port *port) 271static unsigned int pl010_get_mctrl(struct uart_port *port)
265{ 272{
273 struct uart_amba_port *uap = (struct uart_amba_port *)port;
266 unsigned int result = 0; 274 unsigned int result = 0;
267 unsigned int status; 275 unsigned int status;
268 276
269 status = readb(port->membase + UART01x_FR); 277 status = readb(uap->port.membase + UART01x_FR);
270 if (status & UART01x_FR_DCD) 278 if (status & UART01x_FR_DCD)
271 result |= TIOCM_CAR; 279 result |= TIOCM_CAR;
272 if (status & UART01x_FR_DSR) 280 if (status & UART01x_FR_DSR)
@@ -287,17 +295,18 @@ static void pl010_set_mctrl(struct uart_port *port, unsigned int mctrl)
287 295
288static void pl010_break_ctl(struct uart_port *port, int break_state) 296static void pl010_break_ctl(struct uart_port *port, int break_state)
289{ 297{
298 struct uart_amba_port *uap = (struct uart_amba_port *)port;
290 unsigned long flags; 299 unsigned long flags;
291 unsigned int lcr_h; 300 unsigned int lcr_h;
292 301
293 spin_lock_irqsave(&port->lock, flags); 302 spin_lock_irqsave(&uap->port.lock, flags);
294 lcr_h = readb(port->membase + UART010_LCRH); 303 lcr_h = readb(uap->port.membase + UART010_LCRH);
295 if (break_state == -1) 304 if (break_state == -1)
296 lcr_h |= UART01x_LCRH_BRK; 305 lcr_h |= UART01x_LCRH_BRK;
297 else 306 else
298 lcr_h &= ~UART01x_LCRH_BRK; 307 lcr_h &= ~UART01x_LCRH_BRK;
299 writel(lcr_h, port->membase + UART010_LCRH); 308 writel(lcr_h, uap->port.membase + UART010_LCRH);
300 spin_unlock_irqrestore(&port->lock, flags); 309 spin_unlock_irqrestore(&uap->port.lock, flags);
301} 310}
302 311
303static int pl010_startup(struct uart_port *port) 312static int pl010_startup(struct uart_port *port)
@@ -306,48 +315,70 @@ static int pl010_startup(struct uart_port *port)
306 int retval; 315 int retval;
307 316
308 /* 317 /*
318 * Try to enable the clock producer.
319 */
320 retval = clk_enable(uap->clk);
321 if (retval)
322 goto out;
323
324 uap->port.uartclk = clk_get_rate(uap->clk);
325
326 /*
309 * Allocate the IRQ 327 * Allocate the IRQ
310 */ 328 */
311 retval = request_irq(port->irq, pl010_int, 0, "uart-pl010", port); 329 retval = request_irq(uap->port.irq, pl010_int, 0, "uart-pl010", uap);
312 if (retval) 330 if (retval)
313 return retval; 331 goto clk_dis;
314 332
315 /* 333 /*
316 * initialise the old status of the modem signals 334 * initialise the old status of the modem signals
317 */ 335 */
318 uap->old_status = readb(port->membase + UART01x_FR) & UART01x_FR_MODEM_ANY; 336 uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
319 337
320 /* 338 /*
321 * Finally, enable interrupts 339 * Finally, enable interrupts
322 */ 340 */
323 writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, 341 writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
324 port->membase + UART010_CR); 342 uap->port.membase + UART010_CR);
325 343
326 return 0; 344 return 0;
345
346 clk_dis:
347 clk_disable(uap->clk);
348 out:
349 return retval;
327} 350}
328 351
329static void pl010_shutdown(struct uart_port *port) 352static void pl010_shutdown(struct uart_port *port)
330{ 353{
354 struct uart_amba_port *uap = (struct uart_amba_port *)port;
355
331 /* 356 /*
332 * Free the interrupt 357 * Free the interrupt
333 */ 358 */
334 free_irq(port->irq, port); 359 free_irq(uap->port.irq, uap);
335 360
336 /* 361 /*
337 * disable all interrupts, disable the port 362 * disable all interrupts, disable the port
338 */ 363 */
339 writel(0, port->membase + UART010_CR); 364 writel(0, uap->port.membase + UART010_CR);
340 365
341 /* disable break condition and fifos */ 366 /* disable break condition and fifos */
342 writel(readb(port->membase + UART010_LCRH) & 367 writel(readb(uap->port.membase + UART010_LCRH) &
343 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), 368 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
344 port->membase + UART010_LCRH); 369 uap->port.membase + UART010_LCRH);
370
371 /*
372 * Shut down the clock producer
373 */
374 clk_disable(uap->clk);
345} 375}
346 376
347static void 377static void
348pl010_set_termios(struct uart_port *port, struct ktermios *termios, 378pl010_set_termios(struct uart_port *port, struct ktermios *termios,
349 struct ktermios *old) 379 struct ktermios *old)
350{ 380{
381 struct uart_amba_port *uap = (struct uart_amba_port *)port;
351 unsigned int lcr_h, old_cr; 382 unsigned int lcr_h, old_cr;
352 unsigned long flags; 383 unsigned long flags;
353 unsigned int baud, quot; 384 unsigned int baud, quot;
@@ -355,7 +386,7 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios,
355 /* 386 /*
356 * Ask the core to calculate the divisor for us. 387 * Ask the core to calculate the divisor for us.
357 */ 388 */
358 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 389 baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
359 quot = uart_get_divisor(port, baud); 390 quot = uart_get_divisor(port, baud);
360 391
361 switch (termios->c_cflag & CSIZE) { 392 switch (termios->c_cflag & CSIZE) {
@@ -379,66 +410,66 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios,
379 if (!(termios->c_cflag & PARODD)) 410 if (!(termios->c_cflag & PARODD))
380 lcr_h |= UART01x_LCRH_EPS; 411 lcr_h |= UART01x_LCRH_EPS;
381 } 412 }
382 if (port->fifosize > 1) 413 if (uap->port.fifosize > 1)
383 lcr_h |= UART01x_LCRH_FEN; 414 lcr_h |= UART01x_LCRH_FEN;
384 415
385 spin_lock_irqsave(&port->lock, flags); 416 spin_lock_irqsave(&uap->port.lock, flags);
386 417
387 /* 418 /*
388 * Update the per-port timeout. 419 * Update the per-port timeout.
389 */ 420 */
390 uart_update_timeout(port, termios->c_cflag, baud); 421 uart_update_timeout(port, termios->c_cflag, baud);
391 422
392 port->read_status_mask = UART01x_RSR_OE; 423 uap->port.read_status_mask = UART01x_RSR_OE;
393 if (termios->c_iflag & INPCK) 424 if (termios->c_iflag & INPCK)
394 port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 425 uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE;
395 if (termios->c_iflag & (BRKINT | PARMRK)) 426 if (termios->c_iflag & (BRKINT | PARMRK))
396 port->read_status_mask |= UART01x_RSR_BE; 427 uap->port.read_status_mask |= UART01x_RSR_BE;
397 428
398 /* 429 /*
399 * Characters to ignore 430 * Characters to ignore
400 */ 431 */
401 port->ignore_status_mask = 0; 432 uap->port.ignore_status_mask = 0;
402 if (termios->c_iflag & IGNPAR) 433 if (termios->c_iflag & IGNPAR)
403 port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 434 uap->port.ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE;
404 if (termios->c_iflag & IGNBRK) { 435 if (termios->c_iflag & IGNBRK) {
405 port->ignore_status_mask |= UART01x_RSR_BE; 436 uap->port.ignore_status_mask |= UART01x_RSR_BE;
406 /* 437 /*
407 * If we're ignoring parity and break indicators, 438 * If we're ignoring parity and break indicators,
408 * ignore overruns too (for real raw support). 439 * ignore overruns too (for real raw support).
409 */ 440 */
410 if (termios->c_iflag & IGNPAR) 441 if (termios->c_iflag & IGNPAR)
411 port->ignore_status_mask |= UART01x_RSR_OE; 442 uap->port.ignore_status_mask |= UART01x_RSR_OE;
412 } 443 }
413 444
414 /* 445 /*
415 * Ignore all characters if CREAD is not set. 446 * Ignore all characters if CREAD is not set.
416 */ 447 */
417 if ((termios->c_cflag & CREAD) == 0) 448 if ((termios->c_cflag & CREAD) == 0)
418 port->ignore_status_mask |= UART_DUMMY_RSR_RX; 449 uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
419 450
420 /* first, disable everything */ 451 /* first, disable everything */
421 old_cr = readb(port->membase + UART010_CR) & ~UART010_CR_MSIE; 452 old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
422 453
423 if (UART_ENABLE_MS(port, termios->c_cflag)) 454 if (UART_ENABLE_MS(port, termios->c_cflag))
424 old_cr |= UART010_CR_MSIE; 455 old_cr |= UART010_CR_MSIE;
425 456
426 writel(0, port->membase + UART010_CR); 457 writel(0, uap->port.membase + UART010_CR);
427 458
428 /* Set baud rate */ 459 /* Set baud rate */
429 quot -= 1; 460 quot -= 1;
430 writel((quot & 0xf00) >> 8, port->membase + UART010_LCRM); 461 writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
431 writel(quot & 0xff, port->membase + UART010_LCRL); 462 writel(quot & 0xff, uap->port.membase + UART010_LCRL);
432 463
433 /* 464 /*
434 * ----------v----------v----------v----------v----- 465 * ----------v----------v----------v----------v-----
435 * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L 466 * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
436 * ----------^----------^----------^----------^----- 467 * ----------^----------^----------^----------^-----
437 */ 468 */
438 writel(lcr_h, port->membase + UART010_LCRH); 469 writel(lcr_h, uap->port.membase + UART010_LCRH);
439 writel(old_cr, port->membase + UART010_CR); 470 writel(old_cr, uap->port.membase + UART010_CR);
440 471
441 spin_unlock_irqrestore(&port->lock, flags); 472 spin_unlock_irqrestore(&uap->port.lock, flags);
442} 473}
443 474
444static const char *pl010_type(struct uart_port *port) 475static const char *pl010_type(struct uart_port *port)
@@ -514,47 +545,52 @@ static struct uart_amba_port *amba_ports[UART_NR];
514 545
515static void pl010_console_putchar(struct uart_port *port, int ch) 546static void pl010_console_putchar(struct uart_port *port, int ch)
516{ 547{
548 struct uart_amba_port *uap = (struct uart_amba_port *)port;
517 unsigned int status; 549 unsigned int status;
518 550
519 do { 551 do {
520 status = readb(port->membase + UART01x_FR); 552 status = readb(uap->port.membase + UART01x_FR);
521 barrier(); 553 barrier();
522 } while (!UART_TX_READY(status)); 554 } while (!UART_TX_READY(status));
523 writel(ch, port->membase + UART01x_DR); 555 writel(ch, uap->port.membase + UART01x_DR);
524} 556}
525 557
526static void 558static void
527pl010_console_write(struct console *co, const char *s, unsigned int count) 559pl010_console_write(struct console *co, const char *s, unsigned int count)
528{ 560{
529 struct uart_port *port = &amba_ports[co->index]->port; 561 struct uart_amba_port *uap = amba_ports[co->index];
530 unsigned int status, old_cr; 562 unsigned int status, old_cr;
531 563
564 clk_enable(uap->clk);
565
532 /* 566 /*
533 * First save the CR then disable the interrupts 567 * First save the CR then disable the interrupts
534 */ 568 */
535 old_cr = readb(port->membase + UART010_CR); 569 old_cr = readb(uap->port.membase + UART010_CR);
536 writel(UART01x_CR_UARTEN, port->membase + UART010_CR); 570 writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
537 571
538 uart_console_write(port, s, count, pl010_console_putchar); 572 uart_console_write(&uap->port, s, count, pl010_console_putchar);
539 573
540 /* 574 /*
541 * Finally, wait for transmitter to become empty 575 * Finally, wait for transmitter to become empty
542 * and restore the TCR 576 * and restore the TCR
543 */ 577 */
544 do { 578 do {
545 status = readb(port->membase + UART01x_FR); 579 status = readb(uap->port.membase + UART01x_FR);
546 barrier(); 580 barrier();
547 } while (status & UART01x_FR_BUSY); 581 } while (status & UART01x_FR_BUSY);
548 writel(old_cr, port->membase + UART010_CR); 582 writel(old_cr, uap->port.membase + UART010_CR);
583
584 clk_disable(uap->clk);
549} 585}
550 586
551static void __init 587static void __init
552pl010_console_get_options(struct uart_port *port, int *baud, 588pl010_console_get_options(struct uart_amba_port *uap, int *baud,
553 int *parity, int *bits) 589 int *parity, int *bits)
554{ 590{
555 if (readb(port->membase + UART010_CR) & UART01x_CR_UARTEN) { 591 if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
556 unsigned int lcr_h, quot; 592 unsigned int lcr_h, quot;
557 lcr_h = readb(port->membase + UART010_LCRH); 593 lcr_h = readb(uap->port.membase + UART010_LCRH);
558 594
559 *parity = 'n'; 595 *parity = 'n';
560 if (lcr_h & UART01x_LCRH_PEN) { 596 if (lcr_h & UART01x_LCRH_PEN) {
@@ -569,14 +605,15 @@ pl010_console_get_options(struct uart_port *port, int *baud,
569 else 605 else
570 *bits = 8; 606 *bits = 8;
571 607
572 quot = readb(port->membase + UART010_LCRL) | readb(port->membase + UART010_LCRM) << 8; 608 quot = readb(uap->port.membase + UART010_LCRL) |
573 *baud = port->uartclk / (16 * (quot + 1)); 609 readb(uap->port.membase + UART010_LCRM) << 8;
610 *baud = uap->port.uartclk / (16 * (quot + 1));
574 } 611 }
575} 612}
576 613
577static int __init pl010_console_setup(struct console *co, char *options) 614static int __init pl010_console_setup(struct console *co, char *options)
578{ 615{
579 struct uart_port *port; 616 struct uart_amba_port *uap;
580 int baud = 38400; 617 int baud = 38400;
581 int bits = 8; 618 int bits = 8;
582 int parity = 'n'; 619 int parity = 'n';
@@ -589,16 +626,18 @@ static int __init pl010_console_setup(struct console *co, char *options)
589 */ 626 */
590 if (co->index >= UART_NR) 627 if (co->index >= UART_NR)
591 co->index = 0; 628 co->index = 0;
592 if (!amba_ports[co->index]) 629 uap = amba_ports[co->index];
630 if (!uap)
593 return -ENODEV; 631 return -ENODEV;
594 port = &amba_ports[co->index]->port; 632
633 uap->port.uartclk = clk_get_rate(uap->clk);
595 634
596 if (options) 635 if (options)
597 uart_parse_options(options, &baud, &parity, &bits, &flow); 636 uart_parse_options(options, &baud, &parity, &bits, &flow);
598 else 637 else
599 pl010_console_get_options(port, &baud, &parity, &bits); 638 pl010_console_get_options(uap, &baud, &parity, &bits);
600 639
601 return uart_set_options(port, co, baud, parity, bits, flow); 640 return uart_set_options(&uap->port, co, baud, parity, bits, flow);
602} 641}
603 642
604static struct uart_driver amba_reg; 643static struct uart_driver amba_reg;
@@ -629,7 +668,7 @@ static struct uart_driver amba_reg = {
629 668
630static int pl010_probe(struct amba_device *dev, void *id) 669static int pl010_probe(struct amba_device *dev, void *id)
631{ 670{
632 struct uart_amba_port *port; 671 struct uart_amba_port *uap;
633 void __iomem *base; 672 void __iomem *base;
634 int i, ret; 673 int i, ret;
635 674
@@ -642,8 +681,8 @@ static int pl010_probe(struct amba_device *dev, void *id)
642 goto out; 681 goto out;
643 } 682 }
644 683
645 port = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL); 684 uap = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL);
646 if (!port) { 685 if (!uap) {
647 ret = -ENOMEM; 686 ret = -ENOMEM;
648 goto out; 687 goto out;
649 } 688 }
@@ -654,51 +693,57 @@ static int pl010_probe(struct amba_device *dev, void *id)
654 goto free; 693 goto free;
655 } 694 }
656 695
657 port->port.dev = &dev->dev; 696 uap->clk = clk_get(&dev->dev, "UARTCLK");
658 port->port.mapbase = dev->res.start; 697 if (IS_ERR(uap->clk)) {
659 port->port.membase = base; 698 ret = PTR_ERR(uap->clk);
660 port->port.iotype = UPIO_MEM; 699 goto unmap;
661 port->port.irq = dev->irq[0]; 700 }
662 port->port.uartclk = 14745600; 701
663 port->port.fifosize = 16; 702 uap->port.dev = &dev->dev;
664 port->port.ops = &amba_pl010_pops; 703 uap->port.mapbase = dev->res.start;
665 port->port.flags = UPF_BOOT_AUTOCONF; 704 uap->port.membase = base;
666 port->port.line = i; 705 uap->port.iotype = UPIO_MEM;
667 port->dev = dev; 706 uap->port.irq = dev->irq[0];
668 port->data = dev->dev.platform_data; 707 uap->port.fifosize = 16;
669 708 uap->port.ops = &amba_pl010_pops;
670 amba_ports[i] = port; 709 uap->port.flags = UPF_BOOT_AUTOCONF;
671 710 uap->port.line = i;
672 amba_set_drvdata(dev, port); 711 uap->dev = dev;
673 ret = uart_add_one_port(&amba_reg, &port->port); 712 uap->data = dev->dev.platform_data;
713
714 amba_ports[i] = uap;
715
716 amba_set_drvdata(dev, uap);
717 ret = uart_add_one_port(&amba_reg, &uap->port);
674 if (ret) { 718 if (ret) {
675 amba_set_drvdata(dev, NULL); 719 amba_set_drvdata(dev, NULL);
676 amba_ports[i] = NULL; 720 amba_ports[i] = NULL;
721 clk_put(uap->clk);
722 unmap:
677 iounmap(base); 723 iounmap(base);
678 free: 724 free:
679 kfree(port); 725 kfree(uap);
680 } 726 }
681
682 out: 727 out:
683 return ret; 728 return ret;
684} 729}
685 730
686static int pl010_remove(struct amba_device *dev) 731static int pl010_remove(struct amba_device *dev)
687{ 732{
688 struct uart_amba_port *port = amba_get_drvdata(dev); 733 struct uart_amba_port *uap = amba_get_drvdata(dev);
689 int i; 734 int i;
690 735
691 amba_set_drvdata(dev, NULL); 736 amba_set_drvdata(dev, NULL);
692 737
693 uart_remove_one_port(&amba_reg, &port->port); 738 uart_remove_one_port(&amba_reg, &uap->port);
694 739
695 for (i = 0; i < ARRAY_SIZE(amba_ports); i++) 740 for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
696 if (amba_ports[i] == port) 741 if (amba_ports[i] == uap)
697 amba_ports[i] = NULL; 742 amba_ports[i] = NULL;
698 743
699 iounmap(port->port.membase); 744 iounmap(uap->port.membase);
700 kfree(port); 745 clk_put(uap->clk);
701 746 kfree(uap);
702 return 0; 747 return 0;
703} 748}
704 749
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 935f48fa501d..3320bcd92c0a 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -484,11 +484,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios,
484 unsigned long flags; 484 unsigned long flags;
485 unsigned int mode, imr, quot, baud; 485 unsigned int mode, imr, quot, baud;
486 486
487 /* Get current mode register */
488 mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR);
489
487 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 490 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
488 quot = uart_get_divisor(port, baud); 491 quot = uart_get_divisor(port, baud);
489 492
490 /* Get current mode register */ 493 if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */
491 mode = UART_GET_MR(port) & ~(ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR); 494 quot /= 8;
495 mode |= ATMEL_US_USCLKS_MCK_DIV8;
496 }
492 497
493 /* byte size */ 498 /* byte size */
494 switch (termios->c_cflag & CSIZE) { 499 switch (termios->c_cflag & CSIZE) {
diff --git a/drivers/serial/atmel_serial.h b/drivers/serial/atmel_serial.h
index 11b44360e108..e0141776517c 100644
--- a/drivers/serial/atmel_serial.h
+++ b/drivers/serial/atmel_serial.h
@@ -46,6 +46,9 @@
46#define ATMEL_US_USMODE_ISO7816_T1 6 46#define ATMEL_US_USMODE_ISO7816_T1 6
47#define ATMEL_US_USMODE_IRDA 8 47#define ATMEL_US_USMODE_IRDA 8
48#define ATMEL_US_USCLKS (3 << 4) /* Clock Selection */ 48#define ATMEL_US_USCLKS (3 << 4) /* Clock Selection */
49#define ATMEL_US_USCLKS_MCK (0 << 4)
50#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4)
51#define ATMEL_US_USCLKS_SCK (3 << 4)
49#define ATMEL_US_CHRL (3 << 6) /* Character Length */ 52#define ATMEL_US_CHRL (3 << 6) /* Character Length */
50#define ATMEL_US_CHRL_5 (0 << 6) 53#define ATMEL_US_CHRL_5 (0 << 6)
51#define ATMEL_US_CHRL_6 (1 << 6) 54#define ATMEL_US_CHRL_6 (1 << 6)
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
new file mode 100644
index 000000000000..408390f93db9
--- /dev/null
+++ b/drivers/serial/bfin_5xx.c
@@ -0,0 +1,1012 @@
1/*
2 * File: drivers/serial/bfin_5xx.c
3 * Based on: Based on drivers/serial/sa1100.c
4 * Author: Aubrey Li <aubrey.li@analog.com>
5 *
6 * Created:
7 * Description: Driver for blackfin 5xx serial ports
8 *
9 * Rev: $Id: bfin_5xx.c,v 1.19 2006/09/24 02:33:53 aubrey Exp $
10 *
11 * Modified:
12 * Copyright 2006 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32#if defined(CONFIG_SERIAL_BFIN_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
33#define SUPPORT_SYSRQ
34#endif
35
36#include <linux/module.h>
37#include <linux/ioport.h>
38#include <linux/init.h>
39#include <linux/console.h>
40#include <linux/sysrq.h>
41#include <linux/platform_device.h>
42#include <linux/tty.h>
43#include <linux/tty_flip.h>
44#include <linux/serial_core.h>
45
46#include <asm/gpio.h>
47#include <asm/mach/bfin_serial_5xx.h>
48
49#ifdef CONFIG_SERIAL_BFIN_DMA
50#include <linux/dma-mapping.h>
51#include <asm/io.h>
52#include <asm/irq.h>
53#include <asm/cacheflush.h>
54#endif
55
56/* UART name and device definitions */
57#define BFIN_SERIAL_NAME "ttyBF"
58#define BFIN_SERIAL_MAJOR 204
59#define BFIN_SERIAL_MINOR 64
60
61/*
62 * Setup for console. Argument comes from the menuconfig
63 */
64#define DMA_RX_XCOUNT 512
65#define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT)
66
67#define DMA_RX_FLUSH_JIFFIES 5
68
69#ifdef CONFIG_SERIAL_BFIN_DMA
70static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart);
71#else
72static void bfin_serial_do_work(struct work_struct *work);
73static void bfin_serial_tx_chars(struct bfin_serial_port *uart);
74static void local_put_char(struct bfin_serial_port *uart, char ch);
75#endif
76
77static void bfin_serial_mctrl_check(struct bfin_serial_port *uart);
78
79/*
80 * interrupts are disabled on entry
81 */
82static void bfin_serial_stop_tx(struct uart_port *port)
83{
84 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
85
86#ifdef CONFIG_SERIAL_BFIN_DMA
87 disable_dma(uart->tx_dma_channel);
88#else
89 unsigned short ier;
90
91 ier = UART_GET_IER(uart);
92 ier &= ~ETBEI;
93 UART_PUT_IER(uart, ier);
94#endif
95}
96
97/*
98 * port is locked and interrupts are disabled
99 */
100static void bfin_serial_start_tx(struct uart_port *port)
101{
102 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
103
104#ifdef CONFIG_SERIAL_BFIN_DMA
105 bfin_serial_dma_tx_chars(uart);
106#else
107 unsigned short ier;
108 ier = UART_GET_IER(uart);
109 ier |= ETBEI;
110 UART_PUT_IER(uart, ier);
111 bfin_serial_tx_chars(uart);
112#endif
113}
114
115/*
116 * Interrupts are enabled
117 */
118static void bfin_serial_stop_rx(struct uart_port *port)
119{
120 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
121 unsigned short ier;
122
123 ier = UART_GET_IER(uart);
124 ier &= ~ERBFI;
125 UART_PUT_IER(uart, ier);
126}
127
128/*
129 * Set the modem control timer to fire immediately.
130 */
131static void bfin_serial_enable_ms(struct uart_port *port)
132{
133}
134
135#ifdef CONFIG_SERIAL_BFIN_PIO
136static void local_put_char(struct bfin_serial_port *uart, char ch)
137{
138 unsigned short status;
139 int flags = 0;
140
141 spin_lock_irqsave(&uart->port.lock, flags);
142
143 do {
144 status = UART_GET_LSR(uart);
145 } while (!(status & THRE));
146
147 UART_PUT_CHAR(uart, ch);
148 SSYNC();
149
150 spin_unlock_irqrestore(&uart->port.lock, flags);
151}
152
153static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
154{
155 struct tty_struct *tty = uart->port.info?uart->port.info->tty:0;
156 unsigned int status, ch, flg;
157#ifdef BF533_FAMILY
158 static int in_break = 0;
159#endif
160
161 status = UART_GET_LSR(uart);
162 ch = UART_GET_CHAR(uart);
163 uart->port.icount.rx++;
164
165#ifdef BF533_FAMILY
166 /* The BF533 family of processors have a nice misbehavior where
167 * they continuously generate characters for a "single" break.
168 * We have to basically ignore this flood until the "next" valid
169 * character comes across. All other Blackfin families operate
170 * properly though.
171 */
172 if (in_break) {
173 if (ch != 0) {
174 in_break = 0;
175 ch = UART_GET_CHAR(uart);
176 }
177 return;
178 }
179#endif
180
181 if (status & BI) {
182#ifdef BF533_FAMILY
183 in_break = 1;
184#endif
185 uart->port.icount.brk++;
186 if (uart_handle_break(&uart->port))
187 goto ignore_char;
188 flg = TTY_BREAK;
189 } else if (status & PE) {
190 flg = TTY_PARITY;
191 uart->port.icount.parity++;
192 } else if (status & OE) {
193 flg = TTY_OVERRUN;
194 uart->port.icount.overrun++;
195 } else if (status & FE) {
196 flg = TTY_FRAME;
197 uart->port.icount.frame++;
198 } else
199 flg = TTY_NORMAL;
200
201 if (uart_handle_sysrq_char(&uart->port, ch))
202 goto ignore_char;
203 if (tty)
204 uart_insert_char(&uart->port, status, 2, ch, flg);
205
206ignore_char:
207 if (tty)
208 tty_flip_buffer_push(tty);
209}
210
211static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
212{
213 struct circ_buf *xmit = &uart->port.info->xmit;
214
215 if (uart->port.x_char) {
216 UART_PUT_CHAR(uart, uart->port.x_char);
217 uart->port.icount.tx++;
218 uart->port.x_char = 0;
219 return;
220 }
221 /*
222 * Check the modem control lines before
223 * transmitting anything.
224 */
225 bfin_serial_mctrl_check(uart);
226
227 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
228 bfin_serial_stop_tx(&uart->port);
229 return;
230 }
231
232 local_put_char(uart, xmit->buf[xmit->tail]);
233 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
234 uart->port.icount.tx++;
235
236 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
237 uart_write_wakeup(&uart->port);
238
239 if (uart_circ_empty(xmit))
240 bfin_serial_stop_tx(&uart->port);
241}
242
243static irqreturn_t bfin_serial_int(int irq, void *dev_id)
244{
245 struct bfin_serial_port *uart = dev_id;
246 unsigned short status;
247
248 spin_lock(&uart->port.lock);
249 status = UART_GET_IIR(uart);
250 do {
251 if ((status & IIR_STATUS) == IIR_TX_READY)
252 bfin_serial_tx_chars(uart);
253 if ((status & IIR_STATUS) == IIR_RX_READY)
254 bfin_serial_rx_chars(uart);
255 status = UART_GET_IIR(uart);
256 } while (status & (IIR_TX_READY | IIR_RX_READY));
257 spin_unlock(&uart->port.lock);
258 return IRQ_HANDLED;
259}
260
261static void bfin_serial_do_work(struct work_struct *work)
262{
263 struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue);
264
265 bfin_serial_mctrl_check(uart);
266}
267
268#endif
269
270#ifdef CONFIG_SERIAL_BFIN_DMA
271static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
272{
273 struct circ_buf *xmit = &uart->port.info->xmit;
274 unsigned short ier;
275 int flags = 0;
276
277 if (!uart->tx_done)
278 return;
279
280 uart->tx_done = 0;
281
282 if (uart->port.x_char) {
283 UART_PUT_CHAR(uart, uart->port.x_char);
284 uart->port.icount.tx++;
285 uart->port.x_char = 0;
286 uart->tx_done = 1;
287 return;
288 }
289 /*
290 * Check the modem control lines before
291 * transmitting anything.
292 */
293 bfin_serial_mctrl_check(uart);
294
295 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
296 bfin_serial_stop_tx(&uart->port);
297 uart->tx_done = 1;
298 return;
299 }
300
301 spin_lock_irqsave(&uart->port.lock, flags);
302 uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE);
303 if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail))
304 uart->tx_count = UART_XMIT_SIZE - xmit->tail;
305 blackfin_dcache_flush_range((unsigned long)(xmit->buf+xmit->tail),
306 (unsigned long)(xmit->buf+xmit->tail+uart->tx_count));
307 set_dma_config(uart->tx_dma_channel,
308 set_bfin_dma_config(DIR_READ, DMA_FLOW_STOP,
309 INTR_ON_BUF,
310 DIMENSION_LINEAR,
311 DATA_SIZE_8));
312 set_dma_start_addr(uart->tx_dma_channel, (unsigned long)(xmit->buf+xmit->tail));
313 set_dma_x_count(uart->tx_dma_channel, uart->tx_count);
314 set_dma_x_modify(uart->tx_dma_channel, 1);
315 enable_dma(uart->tx_dma_channel);
316 ier = UART_GET_IER(uart);
317 ier |= ETBEI;
318 UART_PUT_IER(uart, ier);
319 spin_unlock_irqrestore(&uart->port.lock, flags);
320}
321
322static void bfin_serial_dma_rx_chars(struct bfin_serial_port * uart)
323{
324 struct tty_struct *tty = uart->port.info->tty;
325 int i, flg, status;
326
327 status = UART_GET_LSR(uart);
328 uart->port.icount.rx += CIRC_CNT(uart->rx_dma_buf.head, uart->rx_dma_buf.tail, UART_XMIT_SIZE);;
329
330 if (status & BI) {
331 uart->port.icount.brk++;
332 if (uart_handle_break(&uart->port))
333 goto dma_ignore_char;
334 flg = TTY_BREAK;
335 } else if (status & PE) {
336 flg = TTY_PARITY;
337 uart->port.icount.parity++;
338 } else if (status & OE) {
339 flg = TTY_OVERRUN;
340 uart->port.icount.overrun++;
341 } else if (status & FE) {
342 flg = TTY_FRAME;
343 uart->port.icount.frame++;
344 } else
345 flg = TTY_NORMAL;
346
347 for (i = uart->rx_dma_buf.head; i < uart->rx_dma_buf.tail; i++) {
348 if (uart_handle_sysrq_char(&uart->port, uart->rx_dma_buf.buf[i]))
349 goto dma_ignore_char;
350 uart_insert_char(&uart->port, status, 2, uart->rx_dma_buf.buf[i], flg);
351 }
352dma_ignore_char:
353 tty_flip_buffer_push(tty);
354}
355
356void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
357{
358 int x_pos, pos;
359 int flags = 0;
360
361 bfin_serial_dma_tx_chars(uart);
362
363 spin_lock_irqsave(&uart->port.lock, flags);
364 x_pos = DMA_RX_XCOUNT - get_dma_curr_xcount(uart->rx_dma_channel);
365 if (x_pos == DMA_RX_XCOUNT)
366 x_pos = 0;
367
368 pos = uart->rx_dma_nrows * DMA_RX_XCOUNT + x_pos;
369
370 if (pos>uart->rx_dma_buf.tail) {
371 uart->rx_dma_buf.tail = pos;
372 bfin_serial_dma_rx_chars(uart);
373 uart->rx_dma_buf.head = uart->rx_dma_buf.tail;
374 }
375 spin_unlock_irqrestore(&uart->port.lock, flags);
376 uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES;
377 add_timer(&(uart->rx_dma_timer));
378}
379
380static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
381{
382 struct bfin_serial_port *uart = dev_id;
383 struct circ_buf *xmit = &uart->port.info->xmit;
384 unsigned short ier;
385
386 spin_lock(&uart->port.lock);
387 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
388 clear_dma_irqstat(uart->tx_dma_channel);
389 disable_dma(uart->tx_dma_channel);
390 ier = UART_GET_IER(uart);
391 ier &= ~ETBEI;
392 UART_PUT_IER(uart, ier);
393 xmit->tail = (xmit->tail+uart->tx_count) &(UART_XMIT_SIZE -1);
394 uart->port.icount.tx+=uart->tx_count;
395
396 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
397 uart_write_wakeup(&uart->port);
398
399 if (uart_circ_empty(xmit))
400 bfin_serial_stop_tx(&uart->port);
401 uart->tx_done = 1;
402 }
403
404 spin_unlock(&uart->port.lock);
405 return IRQ_HANDLED;
406}
407
408static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
409{
410 struct bfin_serial_port *uart = dev_id;
411 unsigned short irqstat;
412
413 uart->rx_dma_nrows++;
414 if (uart->rx_dma_nrows == DMA_RX_YCOUNT) {
415 uart->rx_dma_nrows = 0;
416 uart->rx_dma_buf.tail = DMA_RX_XCOUNT*DMA_RX_YCOUNT;
417 bfin_serial_dma_rx_chars(uart);
418 uart->rx_dma_buf.head = uart->rx_dma_buf.tail = 0;
419 }
420 spin_lock(&uart->port.lock);
421 irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
422 clear_dma_irqstat(uart->rx_dma_channel);
423
424 spin_unlock(&uart->port.lock);
425 return IRQ_HANDLED;
426}
427#endif
428
429/*
430 * Return TIOCSER_TEMT when transmitter is not busy.
431 */
432static unsigned int bfin_serial_tx_empty(struct uart_port *port)
433{
434 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
435 unsigned short lsr;
436
437 lsr = UART_GET_LSR(uart);
438 if (lsr & TEMT)
439 return TIOCSER_TEMT;
440 else
441 return 0;
442}
443
444static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
445{
446#ifdef CONFIG_SERIAL_BFIN_CTSRTS
447 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
448 if (uart->cts_pin < 0)
449 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
450
451 if (gpio_get_value(uart->cts_pin))
452 return TIOCM_DSR | TIOCM_CAR;
453 else
454#endif
455 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
456}
457
458static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
459{
460#ifdef CONFIG_SERIAL_BFIN_CTSRTS
461 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
462 if (uart->rts_pin < 0)
463 return;
464
465 if (mctrl & TIOCM_RTS)
466 gpio_set_value(uart->rts_pin, 0);
467 else
468 gpio_set_value(uart->rts_pin, 1);
469#endif
470}
471
472/*
473 * Handle any change of modem status signal since we were last called.
474 */
475static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
476{
477#ifdef CONFIG_SERIAL_BFIN_CTSRTS
478 unsigned int status;
479# ifdef CONFIG_SERIAL_BFIN_DMA
480 struct uart_info *info = uart->port.info;
481 struct tty_struct *tty = info->tty;
482
483 status = bfin_serial_get_mctrl(&uart->port);
484 if (!(status & TIOCM_CTS)) {
485 tty->hw_stopped = 1;
486 } else {
487 tty->hw_stopped = 0;
488 }
489# else
490 status = bfin_serial_get_mctrl(&uart->port);
491 uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
492 if (!(status & TIOCM_CTS))
493 schedule_work(&uart->cts_workqueue);
494# endif
495#endif
496}
497
498/*
499 * Interrupts are always disabled.
500 */
501static void bfin_serial_break_ctl(struct uart_port *port, int break_state)
502{
503}
504
505static int bfin_serial_startup(struct uart_port *port)
506{
507 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
508
509#ifdef CONFIG_SERIAL_BFIN_DMA
510 dma_addr_t dma_handle;
511
512 if (request_dma(uart->rx_dma_channel, "BFIN_UART_RX") < 0) {
513 printk(KERN_NOTICE "Unable to attach Blackfin UART RX DMA channel\n");
514 return -EBUSY;
515 }
516
517 if (request_dma(uart->tx_dma_channel, "BFIN_UART_TX") < 0) {
518 printk(KERN_NOTICE "Unable to attach Blackfin UART TX DMA channel\n");
519 free_dma(uart->rx_dma_channel);
520 return -EBUSY;
521 }
522
523 set_dma_callback(uart->rx_dma_channel, bfin_serial_dma_rx_int, uart);
524 set_dma_callback(uart->tx_dma_channel, bfin_serial_dma_tx_int, uart);
525
526 uart->rx_dma_buf.buf = (unsigned char *)dma_alloc_coherent(NULL, PAGE_SIZE, &dma_handle, GFP_DMA);
527 uart->rx_dma_buf.head = 0;
528 uart->rx_dma_buf.tail = 0;
529 uart->rx_dma_nrows = 0;
530
531 set_dma_config(uart->rx_dma_channel,
532 set_bfin_dma_config(DIR_WRITE, DMA_FLOW_AUTO,
533 INTR_ON_ROW, DIMENSION_2D,
534 DATA_SIZE_8));
535 set_dma_x_count(uart->rx_dma_channel, DMA_RX_XCOUNT);
536 set_dma_x_modify(uart->rx_dma_channel, 1);
537 set_dma_y_count(uart->rx_dma_channel, DMA_RX_YCOUNT);
538 set_dma_y_modify(uart->rx_dma_channel, 1);
539 set_dma_start_addr(uart->rx_dma_channel, (unsigned long)uart->rx_dma_buf.buf);
540 enable_dma(uart->rx_dma_channel);
541
542 uart->rx_dma_timer.data = (unsigned long)(uart);
543 uart->rx_dma_timer.function = (void *)bfin_serial_rx_dma_timeout;
544 uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES;
545 add_timer(&(uart->rx_dma_timer));
546#else
547 if (request_irq
548 (uart->port.irq, bfin_serial_int, IRQF_DISABLED,
549 "BFIN_UART_RX", uart)) {
550 printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n");
551 return -EBUSY;
552 }
553
554 if (request_irq
555 (uart->port.irq+1, bfin_serial_int, IRQF_DISABLED,
556 "BFIN_UART_TX", uart)) {
557 printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n");
558 free_irq(uart->port.irq, uart);
559 return -EBUSY;
560 }
561#endif
562 UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
563 return 0;
564}
565
566static void bfin_serial_shutdown(struct uart_port *port)
567{
568 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
569
570#ifdef CONFIG_SERIAL_BFIN_DMA
571 disable_dma(uart->tx_dma_channel);
572 free_dma(uart->tx_dma_channel);
573 disable_dma(uart->rx_dma_channel);
574 free_dma(uart->rx_dma_channel);
575 del_timer(&(uart->rx_dma_timer));
576#else
577 free_irq(uart->port.irq, uart);
578 free_irq(uart->port.irq+1, uart);
579#endif
580}
581
582static void
583bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
584 struct ktermios *old)
585{
586 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
587 unsigned long flags;
588 unsigned int baud, quot;
589 unsigned short val, ier, lsr, lcr = 0;
590
591 switch (termios->c_cflag & CSIZE) {
592 case CS8:
593 lcr = WLS(8);
594 break;
595 case CS7:
596 lcr = WLS(7);
597 break;
598 case CS6:
599 lcr = WLS(6);
600 break;
601 case CS5:
602 lcr = WLS(5);
603 break;
604 default:
605 printk(KERN_ERR "%s: word lengh not supported\n",
606 __FUNCTION__);
607 }
608
609 if (termios->c_cflag & CSTOPB)
610 lcr |= STB;
611 if (termios->c_cflag & PARENB) {
612 lcr |= PEN;
613 if (!(termios->c_cflag & PARODD))
614 lcr |= EPS;
615 }
616
617 /* These controls are not implemented for this port */
618 termios->c_iflag |= INPCK | BRKINT | PARMRK;
619 termios->c_iflag &= ~(IGNPAR | IGNBRK);
620
621 /* These controls are not implemented for this port */
622 termios->c_iflag |= INPCK | BRKINT | PARMRK;
623 termios->c_iflag &= ~(IGNPAR | IGNBRK);
624
625 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
626 quot = uart_get_divisor(port, baud);
627 spin_lock_irqsave(&uart->port.lock, flags);
628
629 do {
630 lsr = UART_GET_LSR(uart);
631 } while (!(lsr & TEMT));
632
633 /* Disable UART */
634 ier = UART_GET_IER(uart);
635 UART_PUT_IER(uart, 0);
636
637 /* Set DLAB in LCR to Access DLL and DLH */
638 val = UART_GET_LCR(uart);
639 val |= DLAB;
640 UART_PUT_LCR(uart, val);
641 SSYNC();
642
643 UART_PUT_DLL(uart, quot & 0xFF);
644 SSYNC();
645 UART_PUT_DLH(uart, (quot >> 8) & 0xFF);
646 SSYNC();
647
648 /* Clear DLAB in LCR to Access THR RBR IER */
649 val = UART_GET_LCR(uart);
650 val &= ~DLAB;
651 UART_PUT_LCR(uart, val);
652 SSYNC();
653
654 UART_PUT_LCR(uart, lcr);
655
656 /* Enable UART */
657 UART_PUT_IER(uart, ier);
658
659 val = UART_GET_GCTL(uart);
660 val |= UCEN;
661 UART_PUT_GCTL(uart, val);
662
663 spin_unlock_irqrestore(&uart->port.lock, flags);
664}
665
666static const char *bfin_serial_type(struct uart_port *port)
667{
668 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
669
670 return uart->port.type == PORT_BFIN ? "BFIN-UART" : NULL;
671}
672
673/*
674 * Release the memory region(s) being used by 'port'.
675 */
676static void bfin_serial_release_port(struct uart_port *port)
677{
678}
679
680/*
681 * Request the memory region(s) being used by 'port'.
682 */
683static int bfin_serial_request_port(struct uart_port *port)
684{
685 return 0;
686}
687
688/*
689 * Configure/autoconfigure the port.
690 */
691static void bfin_serial_config_port(struct uart_port *port, int flags)
692{
693 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
694
695 if (flags & UART_CONFIG_TYPE &&
696 bfin_serial_request_port(&uart->port) == 0)
697 uart->port.type = PORT_BFIN;
698}
699
700/*
701 * Verify the new serial_struct (for TIOCSSERIAL).
702 * The only change we allow are to the flags and type, and
703 * even then only between PORT_BFIN and PORT_UNKNOWN
704 */
705static int
706bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
707{
708 return 0;
709}
710
711static struct uart_ops bfin_serial_pops = {
712 .tx_empty = bfin_serial_tx_empty,
713 .set_mctrl = bfin_serial_set_mctrl,
714 .get_mctrl = bfin_serial_get_mctrl,
715 .stop_tx = bfin_serial_stop_tx,
716 .start_tx = bfin_serial_start_tx,
717 .stop_rx = bfin_serial_stop_rx,
718 .enable_ms = bfin_serial_enable_ms,
719 .break_ctl = bfin_serial_break_ctl,
720 .startup = bfin_serial_startup,
721 .shutdown = bfin_serial_shutdown,
722 .set_termios = bfin_serial_set_termios,
723 .type = bfin_serial_type,
724 .release_port = bfin_serial_release_port,
725 .request_port = bfin_serial_request_port,
726 .config_port = bfin_serial_config_port,
727 .verify_port = bfin_serial_verify_port,
728};
729
730static void __init bfin_serial_init_ports(void)
731{
732 static int first = 1;
733 int i;
734
735 if (!first)
736 return;
737 first = 0;
738
739 for (i = 0; i < nr_ports; i++) {
740 bfin_serial_ports[i].port.uartclk = get_sclk();
741 bfin_serial_ports[i].port.ops = &bfin_serial_pops;
742 bfin_serial_ports[i].port.line = i;
743 bfin_serial_ports[i].port.iotype = UPIO_MEM;
744 bfin_serial_ports[i].port.membase =
745 (void __iomem *)bfin_serial_resource[i].uart_base_addr;
746 bfin_serial_ports[i].port.mapbase =
747 bfin_serial_resource[i].uart_base_addr;
748 bfin_serial_ports[i].port.irq =
749 bfin_serial_resource[i].uart_irq;
750 bfin_serial_ports[i].port.flags = UPF_BOOT_AUTOCONF;
751#ifdef CONFIG_SERIAL_BFIN_DMA
752 bfin_serial_ports[i].tx_done = 1;
753 bfin_serial_ports[i].tx_count = 0;
754 bfin_serial_ports[i].tx_dma_channel =
755 bfin_serial_resource[i].uart_tx_dma_channel;
756 bfin_serial_ports[i].rx_dma_channel =
757 bfin_serial_resource[i].uart_rx_dma_channel;
758 init_timer(&(bfin_serial_ports[i].rx_dma_timer));
759#else
760 INIT_WORK(&bfin_serial_ports[i].cts_workqueue, bfin_serial_do_work);
761#endif
762#ifdef CONFIG_SERIAL_BFIN_CTSRTS
763 bfin_serial_ports[i].cts_pin =
764 bfin_serial_resource[i].uart_cts_pin;
765 bfin_serial_ports[i].rts_pin =
766 bfin_serial_resource[i].uart_rts_pin;
767#endif
768 bfin_serial_hw_init(&bfin_serial_ports[i]);
769
770 }
771}
772
773#ifdef CONFIG_SERIAL_BFIN_CONSOLE
774static void bfin_serial_console_putchar(struct uart_port *port, int ch)
775{
776 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
777 while (!(UART_GET_LSR(uart)))
778 barrier();
779 UART_PUT_CHAR(uart, ch);
780 SSYNC();
781}
782
783/*
784 * Interrupts are disabled on entering
785 */
786static void
787bfin_serial_console_write(struct console *co, const char *s, unsigned int count)
788{
789 struct bfin_serial_port *uart = &bfin_serial_ports[co->index];
790 int flags = 0;
791
792 spin_lock_irqsave(&uart->port.lock, flags);
793 uart_console_write(&uart->port, s, count, bfin_serial_console_putchar);
794 spin_unlock_irqrestore(&uart->port.lock, flags);
795
796}
797
798/*
799 * If the port was already initialised (eg, by a boot loader),
800 * try to determine the current setup.
801 */
802static void __init
803bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
804 int *parity, int *bits)
805{
806 unsigned short status;
807
808 status = UART_GET_IER(uart) & (ERBFI | ETBEI);
809 if (status == (ERBFI | ETBEI)) {
810 /* ok, the port was enabled */
811 unsigned short lcr, val;
812 unsigned short dlh, dll;
813
814 lcr = UART_GET_LCR(uart);
815
816 *parity = 'n';
817 if (lcr & PEN) {
818 if (lcr & EPS)
819 *parity = 'e';
820 else
821 *parity = 'o';
822 }
823 switch (lcr & 0x03) {
824 case 0: *bits = 5; break;
825 case 1: *bits = 6; break;
826 case 2: *bits = 7; break;
827 case 3: *bits = 8; break;
828 }
829 /* Set DLAB in LCR to Access DLL and DLH */
830 val = UART_GET_LCR(uart);
831 val |= DLAB;
832 UART_PUT_LCR(uart, val);
833
834 dll = UART_GET_DLL(uart);
835 dlh = UART_GET_DLH(uart);
836
837 /* Clear DLAB in LCR to Access THR RBR IER */
838 val = UART_GET_LCR(uart);
839 val &= ~DLAB;
840 UART_PUT_LCR(uart, val);
841
842 *baud = get_sclk() / (16*(dll | dlh << 8));
843 }
844 pr_debug("%s:baud = %d, parity = %c, bits= %d\n", __FUNCTION__, *baud, *parity, *bits);
845}
846
847static int __init
848bfin_serial_console_setup(struct console *co, char *options)
849{
850 struct bfin_serial_port *uart;
851 int baud = 57600;
852 int bits = 8;
853 int parity = 'n';
854#ifdef CONFIG_SERIAL_BFIN_CTSRTS
855 int flow = 'r';
856#else
857 int flow = 'n';
858#endif
859
860 /*
861 * Check whether an invalid uart number has been specified, and
862 * if so, search for the first available port that does have
863 * console support.
864 */
865 if (co->index == -1 || co->index >= nr_ports)
866 co->index = 0;
867 uart = &bfin_serial_ports[co->index];
868
869 if (options)
870 uart_parse_options(options, &baud, &parity, &bits, &flow);
871 else
872 bfin_serial_console_get_options(uart, &baud, &parity, &bits);
873
874 return uart_set_options(&uart->port, co, baud, parity, bits, flow);
875}
876
877static struct uart_driver bfin_serial_reg;
878static struct console bfin_serial_console = {
879 .name = BFIN_SERIAL_NAME,
880 .write = bfin_serial_console_write,
881 .device = uart_console_device,
882 .setup = bfin_serial_console_setup,
883 .flags = CON_PRINTBUFFER,
884 .index = -1,
885 .data = &bfin_serial_reg,
886};
887
888static int __init bfin_serial_rs_console_init(void)
889{
890 bfin_serial_init_ports();
891 register_console(&bfin_serial_console);
892 return 0;
893}
894console_initcall(bfin_serial_rs_console_init);
895
896#define BFIN_SERIAL_CONSOLE &bfin_serial_console
897#else
898#define BFIN_SERIAL_CONSOLE NULL
899#endif
900
901static struct uart_driver bfin_serial_reg = {
902 .owner = THIS_MODULE,
903 .driver_name = "bfin-uart",
904 .dev_name = BFIN_SERIAL_NAME,
905 .major = BFIN_SERIAL_MAJOR,
906 .minor = BFIN_SERIAL_MINOR,
907 .nr = NR_PORTS,
908 .cons = BFIN_SERIAL_CONSOLE,
909};
910
911static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
912{
913 struct bfin_serial_port *uart = platform_get_drvdata(dev);
914
915 if (uart)
916 uart_suspend_port(&bfin_serial_reg, &uart->port);
917
918 return 0;
919}
920
921static int bfin_serial_resume(struct platform_device *dev)
922{
923 struct bfin_serial_port *uart = platform_get_drvdata(dev);
924
925 if (uart)
926 uart_resume_port(&bfin_serial_reg, &uart->port);
927
928 return 0;
929}
930
931static int bfin_serial_probe(struct platform_device *dev)
932{
933 struct resource *res = dev->resource;
934 int i;
935
936 for (i = 0; i < dev->num_resources; i++, res++)
937 if (res->flags & IORESOURCE_MEM)
938 break;
939
940 if (i < dev->num_resources) {
941 for (i = 0; i < nr_ports; i++, res++) {
942 if (bfin_serial_ports[i].port.mapbase != res->start)
943 continue;
944 bfin_serial_ports[i].port.dev = &dev->dev;
945 uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
946 platform_set_drvdata(dev, &bfin_serial_ports[i]);
947 }
948 }
949
950 return 0;
951}
952
953static int bfin_serial_remove(struct platform_device *pdev)
954{
955 struct bfin_serial_port *uart = platform_get_drvdata(pdev);
956
957
958#ifdef CONFIG_SERIAL_BFIN_CTSRTS
959 gpio_free(uart->cts_pin);
960 gpio_free(uart->rts_pin);
961#endif
962
963 platform_set_drvdata(pdev, NULL);
964
965 if (uart)
966 uart_remove_one_port(&bfin_serial_reg, &uart->port);
967
968 return 0;
969}
970
971static struct platform_driver bfin_serial_driver = {
972 .probe = bfin_serial_probe,
973 .remove = bfin_serial_remove,
974 .suspend = bfin_serial_suspend,
975 .resume = bfin_serial_resume,
976 .driver = {
977 .name = "bfin-uart",
978 },
979};
980
981static int __init bfin_serial_init(void)
982{
983 int ret;
984
985 pr_info("Serial: Blackfin serial driver\n");
986
987 bfin_serial_init_ports();
988
989 ret = uart_register_driver(&bfin_serial_reg);
990 if (ret == 0) {
991 ret = platform_driver_register(&bfin_serial_driver);
992 if (ret) {
993 pr_debug("uart register failed\n");
994 uart_unregister_driver(&bfin_serial_reg);
995 }
996 }
997 return ret;
998}
999
1000static void __exit bfin_serial_exit(void)
1001{
1002 platform_driver_unregister(&bfin_serial_driver);
1003 uart_unregister_driver(&bfin_serial_reg);
1004}
1005
1006module_init(bfin_serial_init);
1007module_exit(bfin_serial_exit);
1008
1009MODULE_AUTHOR("Aubrey.Li <aubrey.li@analog.com>");
1010MODULE_DESCRIPTION("Blackfin generic serial port driver");
1011MODULE_LICENSE("GPL");
1012MODULE_ALIAS_CHARDEV_MAJOR(BFIN_SERIAL_MAJOR);
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h
deleted file mode 100644
index 4a23340663aa..000000000000
--- a/drivers/serial/crisv10.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * serial.h: Arch-dep definitions for the Etrax100 serial driver.
3 *
4 * Copyright (C) 1998, 1999, 2000 Axis Communications AB
5 */
6
7#ifndef _ETRAX_SERIAL_H
8#define _ETRAX_SERIAL_H
9
10#include <linux/circ_buf.h>
11#include <asm/termios.h>
12
13/* Software state per channel */
14
15#ifdef __KERNEL__
16/*
17 * This is our internal structure for each serial port's state.
18 *
19 * Many fields are paralleled by the structure used by the serial_struct
20 * structure.
21 *
22 * For definitions of the flags field, see tty.h
23 */
24
25#define SERIAL_RECV_DESCRIPTORS 8
26
27struct etrax_recv_buffer {
28 struct etrax_recv_buffer *next;
29 unsigned short length;
30 unsigned char error;
31 unsigned char pad;
32
33 unsigned char buffer[0];
34};
35
36struct e100_serial {
37 int baud;
38 volatile u8 *port; /* R_SERIALx_CTRL */
39 u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */
40
41 /* Output registers */
42 volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
43 volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */
44 volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */
45 const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */
46
47 /* Input registers */
48 volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
49 volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */
50 volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
51 volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
52
53 int flags; /* defined in tty.h */
54
55 u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
56 u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
57 u8 iseteop; /* bit number for R_SET_EOP for the input dma */
58 int enabled; /* Set to 1 if the port is enabled in HW config */
59
60 u8 dma_out_enabled:1; /* Set to 1 if DMA should be used */
61 u8 dma_in_enabled:1; /* Set to 1 if DMA should be used */
62
63 /* end of fields defined in rs_table[] in .c-file */
64 u8 uses_dma_in; /* Set to 1 if DMA is used */
65 u8 uses_dma_out; /* Set to 1 if DMA is used */
66 u8 forced_eop; /* a fifo eop has been forced */
67 int baud_base; /* For special baudrates */
68 int custom_divisor; /* For special baudrates */
69 struct etrax_dma_descr tr_descr;
70 struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS];
71 int cur_rec_descr;
72
73 volatile int tr_running; /* 1 if output is running */
74
75 struct tty_struct *tty;
76 int read_status_mask;
77 int ignore_status_mask;
78 int x_char; /* xon/xoff character */
79 int close_delay;
80 unsigned short closing_wait;
81 unsigned short closing_wait2;
82 unsigned long event;
83 unsigned long last_active;
84 int line;
85 int type; /* PORT_ETRAX */
86 int count; /* # of fd on device */
87 int blocked_open; /* # of blocked opens */
88 struct circ_buf xmit;
89 struct etrax_recv_buffer *first_recv_buffer;
90 struct etrax_recv_buffer *last_recv_buffer;
91 unsigned int recv_cnt;
92 unsigned int max_recv_cnt;
93
94 struct work_struct work;
95 struct async_icount icount; /* error-statistics etc.*/
96 struct ktermios normal_termios;
97 struct ktermios callout_termios;
98#ifdef DECLARE_WAITQUEUE
99 wait_queue_head_t open_wait;
100 wait_queue_head_t close_wait;
101#else
102 struct wait_queue *open_wait;
103 struct wait_queue *close_wait;
104#endif
105
106 unsigned long char_time_usec; /* The time for 1 char, in usecs */
107 unsigned long flush_time_usec; /* How often we should flush */
108 unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */
109 unsigned long last_tx_active; /* Last tx time in jiffies */
110 unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */
111 unsigned long last_rx_active; /* Last rx time in jiffies */
112
113 int break_detected_cnt;
114 int errorcode;
115
116#ifdef CONFIG_ETRAX_RS485
117 struct rs485_control rs485; /* RS-485 support */
118#endif
119};
120
121/* this PORT is not in the standard serial.h. it's not actually used for
122 * anything since we only have one type of async serial-port anyway in this
123 * system.
124 */
125
126#define PORT_ETRAX 1
127
128/*
129 * Events are used to schedule things to happen at timer-interrupt
130 * time, instead of at rs interrupt time.
131 */
132#define RS_EVENT_WRITE_WAKEUP 0
133
134#endif /* __KERNEL__ */
135
136#endif /* !_ETRAX_SERIAL_H */
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 04cc88cc528c..e42faa4e4282 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -46,6 +46,122 @@
46#include <asm/hardware.h> 46#include <asm/hardware.h>
47#include <asm/arch/imx-uart.h> 47#include <asm/arch/imx-uart.h>
48 48
49/* Register definitions */
50#define URXD0 0x0 /* Receiver Register */
51#define URTX0 0x40 /* Transmitter Register */
52#define UCR1 0x80 /* Control Register 1 */
53#define UCR2 0x84 /* Control Register 2 */
54#define UCR3 0x88 /* Control Register 3 */
55#define UCR4 0x8c /* Control Register 4 */
56#define UFCR 0x90 /* FIFO Control Register */
57#define USR1 0x94 /* Status Register 1 */
58#define USR2 0x98 /* Status Register 2 */
59#define UESC 0x9c /* Escape Character Register */
60#define UTIM 0xa0 /* Escape Timer Register */
61#define UBIR 0xa4 /* BRM Incremental Register */
62#define UBMR 0xa8 /* BRM Modulator Register */
63#define UBRC 0xac /* Baud Rate Count Register */
64#define BIPR1 0xb0 /* Incremental Preset Register 1 */
65#define BIPR2 0xb4 /* Incremental Preset Register 2 */
66#define BIPR3 0xb8 /* Incremental Preset Register 3 */
67#define BIPR4 0xbc /* Incremental Preset Register 4 */
68#define BMPR1 0xc0 /* BRM Modulator Register 1 */
69#define BMPR2 0xc4 /* BRM Modulator Register 2 */
70#define BMPR3 0xc8 /* BRM Modulator Register 3 */
71#define BMPR4 0xcc /* BRM Modulator Register 4 */
72#define UTS 0xd0 /* UART Test Register */
73
74/* UART Control Register Bit Fields.*/
75#define URXD_CHARRDY (1<<15)
76#define URXD_ERR (1<<14)
77#define URXD_OVRRUN (1<<13)
78#define URXD_FRMERR (1<<12)
79#define URXD_BRK (1<<11)
80#define URXD_PRERR (1<<10)
81#define UCR1_ADEN (1<<15) /* Auto dectect interrupt */
82#define UCR1_ADBR (1<<14) /* Auto detect baud rate */
83#define UCR1_TRDYEN (1<<13) /* Transmitter ready interrupt enable */
84#define UCR1_IDEN (1<<12) /* Idle condition interrupt */
85#define UCR1_RRDYEN (1<<9) /* Recv ready interrupt enable */
86#define UCR1_RDMAEN (1<<8) /* Recv ready DMA enable */
87#define UCR1_IREN (1<<7) /* Infrared interface enable */
88#define UCR1_TXMPTYEN (1<<6) /* Transimitter empty interrupt enable */
89#define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */
90#define UCR1_SNDBRK (1<<4) /* Send break */
91#define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */
92#define UCR1_UARTCLKEN (1<<2) /* UART clock enabled */
93#define UCR1_DOZE (1<<1) /* Doze */
94#define UCR1_UARTEN (1<<0) /* UART enabled */
95#define UCR2_ESCI (1<<15) /* Escape seq interrupt enable */
96#define UCR2_IRTS (1<<14) /* Ignore RTS pin */
97#define UCR2_CTSC (1<<13) /* CTS pin control */
98#define UCR2_CTS (1<<12) /* Clear to send */
99#define UCR2_ESCEN (1<<11) /* Escape enable */
100#define UCR2_PREN (1<<8) /* Parity enable */
101#define UCR2_PROE (1<<7) /* Parity odd/even */
102#define UCR2_STPB (1<<6) /* Stop */
103#define UCR2_WS (1<<5) /* Word size */
104#define UCR2_RTSEN (1<<4) /* Request to send interrupt enable */
105#define UCR2_TXEN (1<<2) /* Transmitter enabled */
106#define UCR2_RXEN (1<<1) /* Receiver enabled */
107#define UCR2_SRST (1<<0) /* SW reset */
108#define UCR3_DTREN (1<<13) /* DTR interrupt enable */
109#define UCR3_PARERREN (1<<12) /* Parity enable */
110#define UCR3_FRAERREN (1<<11) /* Frame error interrupt enable */
111#define UCR3_DSR (1<<10) /* Data set ready */
112#define UCR3_DCD (1<<9) /* Data carrier detect */
113#define UCR3_RI (1<<8) /* Ring indicator */
114#define UCR3_TIMEOUTEN (1<<7) /* Timeout interrupt enable */
115#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */
116#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */
117#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */
118#define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */
119#define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */
120#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
121#define UCR3_BPEN (1<<0) /* Preset registers enable */
122#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */
123#define UCR4_INVR (1<<9) /* Inverted infrared reception */
124#define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */
125#define UCR4_WKEN (1<<7) /* Wake interrupt enable */
126#define UCR4_REF16 (1<<6) /* Ref freq 16 MHz */
127#define UCR4_IRSC (1<<5) /* IR special case */
128#define UCR4_TCEN (1<<3) /* Transmit complete interrupt enable */
129#define UCR4_BKEN (1<<2) /* Break condition interrupt enable */
130#define UCR4_OREN (1<<1) /* Receiver overrun interrupt enable */
131#define UCR4_DREN (1<<0) /* Recv data ready interrupt enable */
132#define UFCR_RXTL_SHF 0 /* Receiver trigger level shift */
133#define UFCR_RFDIV (7<<7) /* Reference freq divider mask */
134#define UFCR_TXTL_SHF 10 /* Transmitter trigger level shift */
135#define USR1_PARITYERR (1<<15) /* Parity error interrupt flag */
136#define USR1_RTSS (1<<14) /* RTS pin status */
137#define USR1_TRDY (1<<13) /* Transmitter ready interrupt/dma flag */
138#define USR1_RTSD (1<<12) /* RTS delta */
139#define USR1_ESCF (1<<11) /* Escape seq interrupt flag */
140#define USR1_FRAMERR (1<<10) /* Frame error interrupt flag */
141#define USR1_RRDY (1<<9) /* Receiver ready interrupt/dma flag */
142#define USR1_TIMEOUT (1<<7) /* Receive timeout interrupt status */
143#define USR1_RXDS (1<<6) /* Receiver idle interrupt flag */
144#define USR1_AIRINT (1<<5) /* Async IR wake interrupt flag */
145#define USR1_AWAKE (1<<4) /* Aysnc wake interrupt flag */
146#define USR2_ADET (1<<15) /* Auto baud rate detect complete */
147#define USR2_TXFE (1<<14) /* Transmit buffer FIFO empty */
148#define USR2_DTRF (1<<13) /* DTR edge interrupt flag */
149#define USR2_IDLE (1<<12) /* Idle condition */
150#define USR2_IRINT (1<<8) /* Serial infrared interrupt flag */
151#define USR2_WAKE (1<<7) /* Wake */
152#define USR2_RTSF (1<<4) /* RTS edge interrupt flag */
153#define USR2_TXDC (1<<3) /* Transmitter complete */
154#define USR2_BRCD (1<<2) /* Break condition */
155#define USR2_ORE (1<<1) /* Overrun error */
156#define USR2_RDR (1<<0) /* Recv data ready */
157#define UTS_FRCPERR (1<<13) /* Force parity error */
158#define UTS_LOOP (1<<12) /* Loop tx and rx */
159#define UTS_TXEMPTY (1<<6) /* TxFIFO empty */
160#define UTS_RXEMPTY (1<<5) /* RxFIFO empty */
161#define UTS_TXFULL (1<<4) /* TxFIFO full */
162#define UTS_RXFULL (1<<3) /* RxFIFO full */
163#define UTS_SOFTRST (1<<0) /* Software reset */
164
49/* We've been assigned a range on the "Low-density serial ports" major */ 165/* We've been assigned a range on the "Low-density serial ports" major */
50#define SERIAL_IMX_MAJOR 204 166#define SERIAL_IMX_MAJOR 204
51#define MINOR_START 41 167#define MINOR_START 41
@@ -128,7 +244,10 @@ static void imx_timeout(unsigned long data)
128static void imx_stop_tx(struct uart_port *port) 244static void imx_stop_tx(struct uart_port *port)
129{ 245{
130 struct imx_port *sport = (struct imx_port *)port; 246 struct imx_port *sport = (struct imx_port *)port;
131 UCR1((u32)sport->port.membase) &= ~UCR1_TXMPTYEN; 247 unsigned long temp;
248
249 temp = readl(sport->port.membase + UCR1);
250 writel(temp & ~UCR1_TXMPTYEN, sport->port.membase + UCR1);
132} 251}
133 252
134/* 253/*
@@ -137,7 +256,10 @@ static void imx_stop_tx(struct uart_port *port)
137static void imx_stop_rx(struct uart_port *port) 256static void imx_stop_rx(struct uart_port *port)
138{ 257{
139 struct imx_port *sport = (struct imx_port *)port; 258 struct imx_port *sport = (struct imx_port *)port;
140 UCR2((u32)sport->port.membase) &= ~UCR2_RXEN; 259 unsigned long temp;
260
261 temp = readl(sport->port.membase + UCR2);
262 writel(temp &~ UCR2_RXEN, sport->port.membase + UCR2);
141} 263}
142 264
143/* 265/*
@@ -154,10 +276,10 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
154{ 276{
155 struct circ_buf *xmit = &sport->port.info->xmit; 277 struct circ_buf *xmit = &sport->port.info->xmit;
156 278
157 while (!(UTS((u32)sport->port.membase) & UTS_TXFULL)) { 279 while (!(readl(sport->port.membase + UTS) & UTS_TXFULL)) {
158 /* send xmit->buf[xmit->tail] 280 /* send xmit->buf[xmit->tail]
159 * out the port here */ 281 * out the port here */
160 URTX0((u32)sport->port.membase) = xmit->buf[xmit->tail]; 282 writel(xmit->buf[xmit->tail], sport->port.membase + URTX0);
161 xmit->tail = (xmit->tail + 1) & 283 xmit->tail = (xmit->tail + 1) &
162 (UART_XMIT_SIZE - 1); 284 (UART_XMIT_SIZE - 1);
163 sport->port.icount.tx++; 285 sport->port.icount.tx++;
@@ -175,21 +297,24 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
175static void imx_start_tx(struct uart_port *port) 297static void imx_start_tx(struct uart_port *port)
176{ 298{
177 struct imx_port *sport = (struct imx_port *)port; 299 struct imx_port *sport = (struct imx_port *)port;
300 unsigned long temp;
178 301
179 UCR1((u32)sport->port.membase) |= UCR1_TXMPTYEN; 302 temp = readl(sport->port.membase + UCR1);
303 writel(temp | UCR1_TXMPTYEN, sport->port.membase + UCR1);
180 304
181 imx_transmit_buffer(sport); 305 if (readl(sport->port.membase + UTS) & UTS_TXEMPTY)
306 imx_transmit_buffer(sport);
182} 307}
183 308
184static irqreturn_t imx_rtsint(int irq, void *dev_id) 309static irqreturn_t imx_rtsint(int irq, void *dev_id)
185{ 310{
186 struct imx_port *sport = (struct imx_port *)dev_id; 311 struct imx_port *sport = (struct imx_port *)dev_id;
187 unsigned int val = USR1((u32)sport->port.membase)&USR1_RTSS; 312 unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
188 unsigned long flags; 313 unsigned long flags;
189 314
190 spin_lock_irqsave(&sport->port.lock, flags); 315 spin_lock_irqsave(&sport->port.lock, flags);
191 316
192 USR1((u32)sport->port.membase) = USR1_RTSD; 317 writel(USR1_RTSD, sport->port.membase + USR1);
193 uart_handle_cts_change(&sport->port, !!val); 318 uart_handle_cts_change(&sport->port, !!val);
194 wake_up_interruptible(&sport->port.info->delta_msr_wait); 319 wake_up_interruptible(&sport->port.info->delta_msr_wait);
195 320
@@ -207,7 +332,7 @@ static irqreturn_t imx_txint(int irq, void *dev_id)
207 if (sport->port.x_char) 332 if (sport->port.x_char)
208 { 333 {
209 /* Send next char */ 334 /* Send next char */
210 URTX0((u32)sport->port.membase) = sport->port.x_char; 335 writel(sport->port.x_char, sport->port.membase + URTX0);
211 goto out; 336 goto out;
212 } 337 }
213 338
@@ -231,17 +356,18 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
231 struct imx_port *sport = dev_id; 356 struct imx_port *sport = dev_id;
232 unsigned int rx,flg,ignored = 0; 357 unsigned int rx,flg,ignored = 0;
233 struct tty_struct *tty = sport->port.info->tty; 358 struct tty_struct *tty = sport->port.info->tty;
234 unsigned long flags; 359 unsigned long flags, temp;
235 360
236 rx = URXD0((u32)sport->port.membase); 361 rx = readl(sport->port.membase + URXD0);
237 spin_lock_irqsave(&sport->port.lock,flags); 362 spin_lock_irqsave(&sport->port.lock,flags);
238 363
239 do { 364 do {
240 flg = TTY_NORMAL; 365 flg = TTY_NORMAL;
241 sport->port.icount.rx++; 366 sport->port.icount.rx++;
242 367
243 if( USR2((u32)sport->port.membase) & USR2_BRCD ) { 368 temp = readl(sport->port.membase + USR2);
244 USR2((u32)sport->port.membase) |= USR2_BRCD; 369 if( temp & USR2_BRCD ) {
370 writel(temp | USR2_BRCD, sport->port.membase + USR2);
245 if(uart_handle_break(&sport->port)) 371 if(uart_handle_break(&sport->port))
246 goto ignore_char; 372 goto ignore_char;
247 } 373 }
@@ -257,7 +383,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
257 tty_insert_flip_char(tty, rx, flg); 383 tty_insert_flip_char(tty, rx, flg);
258 384
259 ignore_char: 385 ignore_char:
260 rx = URXD0((u32)sport->port.membase); 386 rx = readl(sport->port.membase + URXD0);
261 } while(rx & URXD_CHARRDY); 387 } while(rx & URXD_CHARRDY);
262 388
263out: 389out:
@@ -301,7 +427,7 @@ static unsigned int imx_tx_empty(struct uart_port *port)
301{ 427{
302 struct imx_port *sport = (struct imx_port *)port; 428 struct imx_port *sport = (struct imx_port *)port;
303 429
304 return USR2((u32)sport->port.membase) & USR2_TXDC ? TIOCSER_TEMT : 0; 430 return (readl(sport->port.membase + USR2) & USR2_TXDC) ? TIOCSER_TEMT : 0;
305} 431}
306 432
307/* 433/*
@@ -312,10 +438,10 @@ static unsigned int imx_get_mctrl(struct uart_port *port)
312 struct imx_port *sport = (struct imx_port *)port; 438 struct imx_port *sport = (struct imx_port *)port;
313 unsigned int tmp = TIOCM_DSR | TIOCM_CAR; 439 unsigned int tmp = TIOCM_DSR | TIOCM_CAR;
314 440
315 if (USR1((u32)sport->port.membase) & USR1_RTSS) 441 if (readl(sport->port.membase + USR1) & USR1_RTSS)
316 tmp |= TIOCM_CTS; 442 tmp |= TIOCM_CTS;
317 443
318 if (UCR2((u32)sport->port.membase) & UCR2_CTS) 444 if (readl(sport->port.membase + UCR2) & UCR2_CTS)
319 tmp |= TIOCM_RTS; 445 tmp |= TIOCM_RTS;
320 446
321 return tmp; 447 return tmp;
@@ -324,11 +450,14 @@ static unsigned int imx_get_mctrl(struct uart_port *port)
324static void imx_set_mctrl(struct uart_port *port, unsigned int mctrl) 450static void imx_set_mctrl(struct uart_port *port, unsigned int mctrl)
325{ 451{
326 struct imx_port *sport = (struct imx_port *)port; 452 struct imx_port *sport = (struct imx_port *)port;
453 unsigned long temp;
454
455 temp = readl(sport->port.membase + UCR2) & ~UCR2_CTS;
327 456
328 if (mctrl & TIOCM_RTS) 457 if (mctrl & TIOCM_RTS)
329 UCR2((u32)sport->port.membase) |= UCR2_CTS; 458 temp |= UCR2_CTS;
330 else 459
331 UCR2((u32)sport->port.membase) &= ~UCR2_CTS; 460 writel(temp, sport->port.membase + UCR2);
332} 461}
333 462
334/* 463/*
@@ -337,14 +466,16 @@ static void imx_set_mctrl(struct uart_port *port, unsigned int mctrl)
337static void imx_break_ctl(struct uart_port *port, int break_state) 466static void imx_break_ctl(struct uart_port *port, int break_state)
338{ 467{
339 struct imx_port *sport = (struct imx_port *)port; 468 struct imx_port *sport = (struct imx_port *)port;
340 unsigned long flags; 469 unsigned long flags, temp;
341 470
342 spin_lock_irqsave(&sport->port.lock, flags); 471 spin_lock_irqsave(&sport->port.lock, flags);
343 472
473 temp = readl(sport->port.membase + UCR1) & ~UCR1_SNDBRK;
474
344 if ( break_state != 0 ) 475 if ( break_state != 0 )
345 UCR1((u32)sport->port.membase) |= UCR1_SNDBRK; 476 temp |= UCR1_SNDBRK;
346 else 477
347 UCR1((u32)sport->port.membase) &= ~UCR1_SNDBRK; 478 writel(temp, sport->port.membase + UCR1);
348 479
349 spin_unlock_irqrestore(&sport->port.lock, flags); 480 spin_unlock_irqrestore(&sport->port.lock, flags);
350} 481}
@@ -360,7 +491,7 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
360 /* set receiver / transmitter trigger level. 491 /* set receiver / transmitter trigger level.
361 * RFDIV is set such way to satisfy requested uartclk value 492 * RFDIV is set such way to satisfy requested uartclk value
362 */ 493 */
363 val = TXTL<<10 | RXTL; 494 val = TXTL << 10 | RXTL;
364 ufcr_rfdiv = (imx_get_perclk1() + sport->port.uartclk / 2) / sport->port.uartclk; 495 ufcr_rfdiv = (imx_get_perclk1() + sport->port.uartclk / 2) / sport->port.uartclk;
365 496
366 if(!ufcr_rfdiv) 497 if(!ufcr_rfdiv)
@@ -373,7 +504,7 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
373 504
374 val |= UFCR_RFDIV & (ufcr_rfdiv << 7); 505 val |= UFCR_RFDIV & (ufcr_rfdiv << 7);
375 506
376 UFCR((u32)sport->port.membase) = val; 507 writel(val, sport->port.membase + UFCR);
377 508
378 return 0; 509 return 0;
379} 510}
@@ -382,14 +513,15 @@ static int imx_startup(struct uart_port *port)
382{ 513{
383 struct imx_port *sport = (struct imx_port *)port; 514 struct imx_port *sport = (struct imx_port *)port;
384 int retval; 515 int retval;
385 unsigned long flags; 516 unsigned long flags, temp;
386 517
387 imx_setup_ufcr(sport, 0); 518 imx_setup_ufcr(sport, 0);
388 519
389 /* disable the DREN bit (Data Ready interrupt enable) before 520 /* disable the DREN bit (Data Ready interrupt enable) before
390 * requesting IRQs 521 * requesting IRQs
391 */ 522 */
392 UCR4((u32)sport->port.membase) &= ~UCR4_DREN; 523 temp = readl(sport->port.membase + UCR4);
524 writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
393 525
394 /* 526 /*
395 * Allocate the IRQ 527 * Allocate the IRQ
@@ -411,12 +543,16 @@ static int imx_startup(struct uart_port *port)
411 /* 543 /*
412 * Finally, clear and enable interrupts 544 * Finally, clear and enable interrupts
413 */ 545 */
546 writel(USR1_RTSD, sport->port.membase + USR1);
547
548 temp = readl(sport->port.membase + UCR1);
549 temp |= (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
550 writel(temp, sport->port.membase + UCR1);
414 551
415 USR1((u32)sport->port.membase) = USR1_RTSD; 552 temp = readl(sport->port.membase + UCR2);
416 UCR1((u32)sport->port.membase) |= 553 temp |= (UCR2_RXEN | UCR2_TXEN);
417 (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); 554 writel(temp, sport->port.membase + UCR2);
418 555
419 UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN);
420 /* 556 /*
421 * Enable modem status interrupts 557 * Enable modem status interrupts
422 */ 558 */
@@ -437,6 +573,7 @@ error_out1:
437static void imx_shutdown(struct uart_port *port) 573static void imx_shutdown(struct uart_port *port)
438{ 574{
439 struct imx_port *sport = (struct imx_port *)port; 575 struct imx_port *sport = (struct imx_port *)port;
576 unsigned long temp;
440 577
441 /* 578 /*
442 * Stop our timer. 579 * Stop our timer.
@@ -454,8 +591,9 @@ static void imx_shutdown(struct uart_port *port)
454 * Disable all interrupts, port and break condition. 591 * Disable all interrupts, port and break condition.
455 */ 592 */
456 593
457 UCR1((u32)sport->port.membase) &= 594 temp = readl(sport->port.membase + UCR1);
458 ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); 595 temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
596 writel(temp, sport->port.membase + UCR1);
459} 597}
460 598
461static void 599static void
@@ -548,18 +686,18 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
548 /* 686 /*
549 * disable interrupts and drain transmitter 687 * disable interrupts and drain transmitter
550 */ 688 */
551 old_ucr1 = UCR1((u32)sport->port.membase); 689 old_ucr1 = readl(sport->port.membase + UCR1);
552 UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); 690 writel(old_ucr1 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN),
691 sport->port.membase + UCR1);
553 692
554 while ( !(USR2((u32)sport->port.membase) & USR2_TXDC)) 693 while ( !(readl(sport->port.membase + USR2) & USR2_TXDC))
555 barrier(); 694 barrier();
556 695
557 /* then, disable everything */ 696 /* then, disable everything */
558 old_txrxen = UCR2((u32)sport->port.membase) & ( UCR2_TXEN | UCR2_RXEN ); 697 old_txrxen = readl(sport->port.membase + UCR2);
559 UCR2((u32)sport->port.membase) &= ~( UCR2_TXEN | UCR2_RXEN); 698 writel(old_txrxen & ~( UCR2_TXEN | UCR2_RXEN),
560 699 sport->port.membase + UCR2);
561 /* set the parity, stop bits and data size */ 700 old_txrxen &= (UCR2_TXEN | UCR2_RXEN);
562 UCR2((u32)sport->port.membase) = ucr2;
563 701
564 /* set the baud rate. We assume uartclk = 16 MHz 702 /* set the baud rate. We assume uartclk = 16 MHz
565 * 703 *
@@ -567,11 +705,13 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
567 * --------- = -------- 705 * --------- = --------
568 * uartclk UBMR - 1 706 * uartclk UBMR - 1
569 */ 707 */
570 UBIR((u32)sport->port.membase) = (baud / 100) - 1; 708 writel((baud / 100) - 1, sport->port.membase + UBIR);
571 UBMR((u32)sport->port.membase) = 10000 - 1; 709 writel(10000 - 1, sport->port.membase + UBMR);
710
711 writel(old_ucr1, sport->port.membase + UCR1);
572 712
573 UCR1((u32)sport->port.membase) = old_ucr1; 713 /* set the parity, stop bits and data size */
574 UCR2((u32)sport->port.membase) |= old_txrxen; 714 writel(ucr2 | old_txrxen, sport->port.membase + UCR2);
575 715
576 if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) 716 if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
577 imx_enable_ms(&sport->port); 717 imx_enable_ms(&sport->port);
@@ -730,9 +870,11 @@ static void __init imx_init_ports(void)
730static void imx_console_putchar(struct uart_port *port, int ch) 870static void imx_console_putchar(struct uart_port *port, int ch)
731{ 871{
732 struct imx_port *sport = (struct imx_port *)port; 872 struct imx_port *sport = (struct imx_port *)port;
733 while ((UTS((u32)sport->port.membase) & UTS_TXFULL)) 873
874 while (readl(sport->port.membase + UTS) & UTS_TXFULL)
734 barrier(); 875 barrier();
735 URTX0((u32)sport->port.membase) = ch; 876
877 writel(ch, sport->port.membase + URTX0);
736} 878}
737 879
738/* 880/*
@@ -747,13 +889,14 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
747 /* 889 /*
748 * First, save UCR1/2 and then disable interrupts 890 * First, save UCR1/2 and then disable interrupts
749 */ 891 */
750 old_ucr1 = UCR1((u32)sport->port.membase); 892 old_ucr1 = readl(sport->port.membase + UCR1);
751 old_ucr2 = UCR2((u32)sport->port.membase); 893 old_ucr2 = readl(sport->port.membase + UCR2);
752 894
753 UCR1((u32)sport->port.membase) = 895 writel((old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) &
754 (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) 896 ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN),
755 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); 897 sport->port.membase + UCR1);
756 UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; 898
899 writel(old_ucr2 | UCR2_TXEN, sport->port.membase + UCR2);
757 900
758 uart_console_write(&sport->port, s, count, imx_console_putchar); 901 uart_console_write(&sport->port, s, count, imx_console_putchar);
759 902
@@ -761,10 +904,10 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
761 * Finally, wait for transmitter to become empty 904 * Finally, wait for transmitter to become empty
762 * and restore UCR1/2 905 * and restore UCR1/2
763 */ 906 */
764 while (!(USR2((u32)sport->port.membase) & USR2_TXDC)); 907 while (!(readl(sport->port.membase + USR2) & USR2_TXDC));
765 908
766 UCR1((u32)sport->port.membase) = old_ucr1; 909 writel(old_ucr1, sport->port.membase + UCR1);
767 UCR2((u32)sport->port.membase) = old_ucr2; 910 writel(old_ucr2, sport->port.membase + UCR2);
768} 911}
769 912
770/* 913/*
@@ -776,13 +919,13 @@ imx_console_get_options(struct imx_port *sport, int *baud,
776 int *parity, int *bits) 919 int *parity, int *bits)
777{ 920{
778 921
779 if ( UCR1((u32)sport->port.membase) | UCR1_UARTEN ) { 922 if ( readl(sport->port.membase + UCR1) | UCR1_UARTEN ) {
780 /* ok, the port was enabled */ 923 /* ok, the port was enabled */
781 unsigned int ucr2, ubir,ubmr, uartclk; 924 unsigned int ucr2, ubir,ubmr, uartclk;
782 unsigned int baud_raw; 925 unsigned int baud_raw;
783 unsigned int ucfr_rfdiv; 926 unsigned int ucfr_rfdiv;
784 927
785 ucr2 = UCR2((u32)sport->port.membase); 928 ucr2 = readl(sport->port.membase + UCR2);
786 929
787 *parity = 'n'; 930 *parity = 'n';
788 if (ucr2 & UCR2_PREN) { 931 if (ucr2 & UCR2_PREN) {
@@ -797,11 +940,10 @@ imx_console_get_options(struct imx_port *sport, int *baud,
797 else 940 else
798 *bits = 7; 941 *bits = 7;
799 942
800 ubir = UBIR((u32)sport->port.membase) & 0xffff; 943 ubir = readl(sport->port.membase + UBIR) & 0xffff;
801 ubmr = UBMR((u32)sport->port.membase) & 0xffff; 944 ubmr = readl(sport->port.membase + UBMR) & 0xffff;
802
803 945
804 ucfr_rfdiv = (UFCR((u32)sport->port.membase) & UFCR_RFDIV) >> 7; 946 ucfr_rfdiv = (readl(sport->port.membase + UFCR) & UFCR_RFDIV) >> 7;
805 if (ucfr_rfdiv == 6) 947 if (ucfr_rfdiv == 6)
806 ucfr_rfdiv = 7; 948 ucfr_rfdiv = 7;
807 else 949 else
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 3d2fcc57b1ce..d09f2097d5b0 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -183,6 +183,7 @@ struct mpsc_port_info {
183 u8 *txb_p; /* Phys addr of txb */ 183 u8 *txb_p; /* Phys addr of txb */
184 int txr_head; /* Where new data goes */ 184 int txr_head; /* Where new data goes */
185 int txr_tail; /* Where sent data comes off */ 185 int txr_tail; /* Where sent data comes off */
186 spinlock_t tx_lock; /* transmit lock */
186 187
187 /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ 188 /* Mirrored values of regs we can't read (if 'mirror_regs' set) */
188 u32 MPSC_MPCR_m; 189 u32 MPSC_MPCR_m;
@@ -1212,6 +1213,9 @@ mpsc_tx_intr(struct mpsc_port_info *pi)
1212{ 1213{
1213 struct mpsc_tx_desc *txre; 1214 struct mpsc_tx_desc *txre;
1214 int rc = 0; 1215 int rc = 0;
1216 unsigned long iflags;
1217
1218 spin_lock_irqsave(&pi->tx_lock, iflags);
1215 1219
1216 if (!mpsc_sdma_tx_active(pi)) { 1220 if (!mpsc_sdma_tx_active(pi)) {
1217 txre = (struct mpsc_tx_desc *)(pi->txr + 1221 txre = (struct mpsc_tx_desc *)(pi->txr +
@@ -1248,6 +1252,7 @@ mpsc_tx_intr(struct mpsc_port_info *pi)
1248 mpsc_sdma_start_tx(pi); /* start next desc if ready */ 1252 mpsc_sdma_start_tx(pi); /* start next desc if ready */
1249 } 1253 }
1250 1254
1255 spin_unlock_irqrestore(&pi->tx_lock, iflags);
1251 return rc; 1256 return rc;
1252} 1257}
1253 1258
@@ -1338,11 +1343,16 @@ static void
1338mpsc_start_tx(struct uart_port *port) 1343mpsc_start_tx(struct uart_port *port)
1339{ 1344{
1340 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1345 struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
1346 unsigned long iflags;
1347
1348 spin_lock_irqsave(&pi->tx_lock, iflags);
1341 1349
1342 mpsc_unfreeze(pi); 1350 mpsc_unfreeze(pi);
1343 mpsc_copy_tx_data(pi); 1351 mpsc_copy_tx_data(pi);
1344 mpsc_sdma_start_tx(pi); 1352 mpsc_sdma_start_tx(pi);
1345 1353
1354 spin_unlock_irqrestore(&pi->tx_lock, iflags);
1355
1346 pr_debug("mpsc_start_tx[%d]\n", port->line); 1356 pr_debug("mpsc_start_tx[%d]\n", port->line);
1347 return; 1357 return;
1348} 1358}
@@ -1625,6 +1635,16 @@ mpsc_console_write(struct console *co, const char *s, uint count)
1625 struct mpsc_port_info *pi = &mpsc_ports[co->index]; 1635 struct mpsc_port_info *pi = &mpsc_ports[co->index];
1626 u8 *bp, *dp, add_cr = 0; 1636 u8 *bp, *dp, add_cr = 0;
1627 int i; 1637 int i;
1638 unsigned long iflags;
1639
1640 spin_lock_irqsave(&pi->tx_lock, iflags);
1641
1642 while (pi->txr_head != pi->txr_tail) {
1643 while (mpsc_sdma_tx_active(pi))
1644 udelay(100);
1645 mpsc_sdma_intr_ack(pi);
1646 mpsc_tx_intr(pi);
1647 }
1628 1648
1629 while (mpsc_sdma_tx_active(pi)) 1649 while (mpsc_sdma_tx_active(pi))
1630 udelay(100); 1650 udelay(100);
@@ -1668,6 +1688,7 @@ mpsc_console_write(struct console *co, const char *s, uint count)
1668 pi->txr_tail = (pi->txr_tail + 1) & (MPSC_TXR_ENTRIES - 1); 1688 pi->txr_tail = (pi->txr_tail + 1) & (MPSC_TXR_ENTRIES - 1);
1669 } 1689 }
1670 1690
1691 spin_unlock_irqrestore(&pi->tx_lock, iflags);
1671 return; 1692 return;
1672} 1693}
1673 1694
@@ -2005,7 +2026,8 @@ mpsc_drv_probe(struct platform_device *dev)
2005 if (!(rc = mpsc_drv_map_regs(pi, dev))) { 2026 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
2006 mpsc_drv_get_platform_data(pi, dev, dev->id); 2027 mpsc_drv_get_platform_data(pi, dev, dev->id);
2007 2028
2008 if (!(rc = mpsc_make_ready(pi))) 2029 if (!(rc = mpsc_make_ready(pi))) {
2030 spin_lock_init(&pi->tx_lock);
2009 if (!(rc = uart_add_one_port(&mpsc_reg, 2031 if (!(rc = uart_add_one_port(&mpsc_reg,
2010 &pi->port))) 2032 &pi->port)))
2011 rc = 0; 2033 rc = 0;
@@ -2014,6 +2036,7 @@ mpsc_drv_probe(struct platform_device *dev)
2014 (struct uart_port *)pi); 2036 (struct uart_port *)pi);
2015 mpsc_drv_unmap_regs(pi); 2037 mpsc_drv_unmap_regs(pi);
2016 } 2038 }
2039 }
2017 else 2040 else
2018 mpsc_drv_unmap_regs(pi); 2041 mpsc_drv_unmap_regs(pi);
2019 } 2042 }
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index e7928fee833a..7ffdaeaf0545 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -48,7 +48,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
48 port->iotype = UPIO_MEM; 48 port->iotype = UPIO_MEM;
49 port->type = type; 49 port->type = type;
50 port->uartclk = *clk; 50 port->uartclk = *clk;
51 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP; 51 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
52 | UPF_FIXED_PORT;
52 port->dev = &ofdev->dev; 53 port->dev = &ofdev->dev;
53 port->custom_divisor = *clk / (16 * (*spd)); 54 port->custom_divisor = *clk / (16 * (*spd));
54 55
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index d403aaa55092..e9c6cb391a23 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -717,7 +717,7 @@ struct uart_ops serial_pxa_pops = {
717static struct uart_pxa_port serial_pxa_ports[] = { 717static struct uart_pxa_port serial_pxa_ports[] = {
718 { /* FFUART */ 718 { /* FFUART */
719 .name = "FFUART", 719 .name = "FFUART",
720 .cken = CKEN6_FFUART, 720 .cken = CKEN_FFUART,
721 .port = { 721 .port = {
722 .type = PORT_PXA, 722 .type = PORT_PXA,
723 .iotype = UPIO_MEM, 723 .iotype = UPIO_MEM,
@@ -731,7 +731,7 @@ static struct uart_pxa_port serial_pxa_ports[] = {
731 }, 731 },
732 }, { /* BTUART */ 732 }, { /* BTUART */
733 .name = "BTUART", 733 .name = "BTUART",
734 .cken = CKEN7_BTUART, 734 .cken = CKEN_BTUART,
735 .port = { 735 .port = {
736 .type = PORT_PXA, 736 .type = PORT_PXA,
737 .iotype = UPIO_MEM, 737 .iotype = UPIO_MEM,
@@ -745,7 +745,7 @@ static struct uart_pxa_port serial_pxa_ports[] = {
745 }, 745 },
746 }, { /* STUART */ 746 }, { /* STUART */
747 .name = "STUART", 747 .name = "STUART",
748 .cken = CKEN5_STUART, 748 .cken = CKEN_STUART,
749 .port = { 749 .port = {
750 .type = PORT_PXA, 750 .type = PORT_PXA,
751 .iotype = UPIO_MEM, 751 .iotype = UPIO_MEM,
@@ -759,7 +759,7 @@ static struct uart_pxa_port serial_pxa_ports[] = {
759 }, 759 },
760 }, { /* HWUART */ 760 }, { /* HWUART */
761 .name = "HWUART", 761 .name = "HWUART",
762 .cken = CKEN4_HWUART, 762 .cken = CKEN_HWUART,
763 .port = { 763 .port = {
764 .type = PORT_PXA, 764 .type = PORT_PXA,
765 .iotype = UPIO_MEM, 765 .iotype = UPIO_MEM,
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 0422c0f1f852..326020f86f75 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -37,13 +37,6 @@
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/uaccess.h> 38#include <asm/uaccess.h>
39 39
40#undef DEBUG
41#ifdef DEBUG
42#define DPRINTK(x...) printk(x)
43#else
44#define DPRINTK(x...) do { } while (0)
45#endif
46
47/* 40/*
48 * This is used to lock changes in serial line configuration. 41 * This is used to lock changes in serial line configuration.
49 */ 42 */
@@ -552,7 +545,7 @@ static void uart_flush_buffer(struct tty_struct *tty)
552 return; 545 return;
553 } 546 }
554 547
555 DPRINTK("uart_flush_buffer(%d) called\n", tty->index); 548 pr_debug("uart_flush_buffer(%d) called\n", tty->index);
556 549
557 spin_lock_irqsave(&port->lock, flags); 550 spin_lock_irqsave(&port->lock, flags);
558 uart_circ_clear(&state->info->xmit); 551 uart_circ_clear(&state->info->xmit);
@@ -672,19 +665,21 @@ static int uart_set_info(struct uart_state *state,
672 */ 665 */
673 mutex_lock(&state->mutex); 666 mutex_lock(&state->mutex);
674 667
675 change_irq = new_serial.irq != port->irq; 668 change_irq = !(port->flags & UPF_FIXED_PORT)
669 && new_serial.irq != port->irq;
676 670
677 /* 671 /*
678 * Since changing the 'type' of the port changes its resource 672 * Since changing the 'type' of the port changes its resource
679 * allocations, we should treat type changes the same as 673 * allocations, we should treat type changes the same as
680 * IO port changes. 674 * IO port changes.
681 */ 675 */
682 change_port = new_port != port->iobase || 676 change_port = !(port->flags & UPF_FIXED_PORT)
683 (unsigned long)new_serial.iomem_base != port->mapbase || 677 && (new_port != port->iobase ||
684 new_serial.hub6 != port->hub6 || 678 (unsigned long)new_serial.iomem_base != port->mapbase ||
685 new_serial.io_type != port->iotype || 679 new_serial.hub6 != port->hub6 ||
686 new_serial.iomem_reg_shift != port->regshift || 680 new_serial.io_type != port->iotype ||
687 new_serial.type != port->type; 681 new_serial.iomem_reg_shift != port->regshift ||
682 new_serial.type != port->type);
688 683
689 old_flags = port->flags; 684 old_flags = port->flags;
690 new_flags = new_serial.flags; 685 new_flags = new_serial.flags;
@@ -796,8 +791,10 @@ static int uart_set_info(struct uart_state *state,
796 } 791 }
797 } 792 }
798 793
799 port->irq = new_serial.irq; 794 if (change_irq)
800 port->uartclk = new_serial.baud_base * 16; 795 port->irq = new_serial.irq;
796 if (!(port->flags & UPF_FIXED_PORT))
797 port->uartclk = new_serial.baud_base * 16;
801 port->flags = (port->flags & ~UPF_CHANGE_MASK) | 798 port->flags = (port->flags & ~UPF_CHANGE_MASK) |
802 (new_flags & UPF_CHANGE_MASK); 799 (new_flags & UPF_CHANGE_MASK);
803 port->custom_divisor = new_serial.custom_divisor; 800 port->custom_divisor = new_serial.custom_divisor;
@@ -1220,7 +1217,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1220 1217
1221 port = state->port; 1218 port = state->port;
1222 1219
1223 DPRINTK("uart_close(%d) called\n", port->line); 1220 pr_debug("uart_close(%d) called\n", port->line);
1224 1221
1225 mutex_lock(&state->mutex); 1222 mutex_lock(&state->mutex);
1226 1223
@@ -1339,7 +1336,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
1339 1336
1340 expire = jiffies + timeout; 1337 expire = jiffies + timeout;
1341 1338
1342 DPRINTK("uart_wait_until_sent(%d), jiffies=%lu, expire=%lu...\n", 1339 pr_debug("uart_wait_until_sent(%d), jiffies=%lu, expire=%lu...\n",
1343 port->line, jiffies, expire); 1340 port->line, jiffies, expire);
1344 1341
1345 /* 1342 /*
@@ -1368,7 +1365,7 @@ static void uart_hangup(struct tty_struct *tty)
1368 struct uart_state *state = tty->driver_data; 1365 struct uart_state *state = tty->driver_data;
1369 1366
1370 BUG_ON(!kernel_locked()); 1367 BUG_ON(!kernel_locked());
1371 DPRINTK("uart_hangup(%d)\n", state->port->line); 1368 pr_debug("uart_hangup(%d)\n", state->port->line);
1372 1369
1373 mutex_lock(&state->mutex); 1370 mutex_lock(&state->mutex);
1374 if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { 1371 if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) {
@@ -1566,7 +1563,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1566 int retval, line = tty->index; 1563 int retval, line = tty->index;
1567 1564
1568 BUG_ON(!kernel_locked()); 1565 BUG_ON(!kernel_locked());
1569 DPRINTK("uart_open(%d) called\n", line); 1566 pr_debug("uart_open(%d) called\n", line);
1570 1567
1571 /* 1568 /*
1572 * tty->driver->num won't change, so we won't fail here with 1569 * tty->driver->num won't change, so we won't fail here with
@@ -2064,6 +2061,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
2064 case UPIO_MEM32: 2061 case UPIO_MEM32:
2065 case UPIO_AU: 2062 case UPIO_AU:
2066 case UPIO_TSI: 2063 case UPIO_TSI:
2064 case UPIO_DWAPB:
2067 snprintf(address, sizeof(address), 2065 snprintf(address, sizeof(address),
2068 "MMIO 0x%lx", port->mapbase); 2066 "MMIO 0x%lx", port->mapbase);
2069 break; 2067 break;
@@ -2409,6 +2407,7 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2)
2409 case UPIO_MEM32: 2407 case UPIO_MEM32:
2410 case UPIO_AU: 2408 case UPIO_AU:
2411 case UPIO_TSI: 2409 case UPIO_TSI:
2410 case UPIO_DWAPB:
2412 return (port1->mapbase == port2->mapbase); 2411 return (port1->mapbase == port2->mapbase);
2413 } 2412 }
2414 return 0; 2413 return 0;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 46c40bbc4bc6..1f89496d530e 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -46,6 +46,7 @@
46#endif 46#endif
47 47
48#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) 48#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
49#include <linux/ctype.h>
49#include <asm/clock.h> 50#include <asm/clock.h>
50#include <asm/sh_bios.h> 51#include <asm/sh_bios.h>
51#include <asm/kgdb.h> 52#include <asm/kgdb.h>
@@ -61,7 +62,7 @@ struct sci_port {
61 unsigned int type; 62 unsigned int type;
62 63
63 /* Port IRQs: ERI, RXI, TXI, BRI (optional) */ 64 /* Port IRQs: ERI, RXI, TXI, BRI (optional) */
64 unsigned int irqs[SCIx_NR_IRQS]; 65 unsigned int irqs[SCIx_NR_IRQS];
65 66
66 /* Port pin configuration */ 67 /* Port pin configuration */
67 void (*init_pins)(struct uart_port *port, 68 void (*init_pins)(struct uart_port *port,
@@ -76,6 +77,11 @@ struct sci_port {
76 /* Break timer */ 77 /* Break timer */
77 struct timer_list break_timer; 78 struct timer_list break_timer;
78 int break_flag; 79 int break_flag;
80
81#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
82 /* Port clock */
83 struct clk *clk;
84#endif
79}; 85};
80 86
81#ifdef CONFIG_SH_KGDB 87#ifdef CONFIG_SH_KGDB
@@ -163,7 +169,7 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count)
163 usegdb |= sh_bios_in_gdb_mode(); 169 usegdb |= sh_bios_in_gdb_mode();
164#endif 170#endif
165#ifdef CONFIG_SH_KGDB 171#ifdef CONFIG_SH_KGDB
166 usegdb |= (kgdb_in_gdb_mode && (port == kgdb_sci_port)); 172 usegdb |= (kgdb_in_gdb_mode && (sci_port == kgdb_sci_port));
167#endif 173#endif
168 174
169 if (usegdb) { 175 if (usegdb) {
@@ -204,7 +210,7 @@ static int kgdb_sci_getchar(void)
204 int c; 210 int c;
205 211
206 /* Keep trying to read a character, this could be neater */ 212 /* Keep trying to read a character, this could be neater */
207 while ((c = get_char(kgdb_sci_port)) < 0) 213 while ((c = get_char(&kgdb_sci_port->port)) < 0)
208 cpu_relax(); 214 cpu_relax();
209 215
210 return c; 216 return c;
@@ -212,7 +218,7 @@ static int kgdb_sci_getchar(void)
212 218
213static inline void kgdb_sci_putchar(int c) 219static inline void kgdb_sci_putchar(int c)
214{ 220{
215 put_char(kgdb_sci_port, c); 221 put_char(&kgdb_sci_port->port, c);
216} 222}
217#endif /* CONFIG_SH_KGDB */ 223#endif /* CONFIG_SH_KGDB */
218 224
@@ -283,12 +289,23 @@ static void sci_init_pins_irda(struct uart_port *port, unsigned int cflag)
283#endif 289#endif
284 290
285#if defined(SCIF_ONLY) || defined(SCI_AND_SCIF) 291#if defined(SCIF_ONLY) || defined(SCI_AND_SCIF)
286#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710) 292#if defined(CONFIG_CPU_SUBTYPE_SH7300)
287/* SH7300 doesn't use RTS/CTS */ 293/* SH7300 doesn't use RTS/CTS */
288static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) 294static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
289{ 295{
290 sci_out(port, SCFCR, 0); 296 sci_out(port, SCFCR, 0);
291} 297}
298#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
299static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag)
300{
301 unsigned int fcr_val = 0;
302
303 set_sh771x_scif_pfc(port);
304 if (cflag & CRTSCTS) {
305 fcr_val |= SCFCR_MCE;
306 }
307 sci_out(port, SCFCR, fcr_val);
308}
292#elif defined(CONFIG_CPU_SH3) 309#elif defined(CONFIG_CPU_SH3)
293/* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */ 310/* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */
294static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) 311static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
@@ -350,7 +367,7 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
350 } else { 367 } else {
351#ifdef CONFIG_CPU_SUBTYPE_SH7343 368#ifdef CONFIG_CPU_SUBTYPE_SH7343
352 /* Nothing */ 369 /* Nothing */
353#elif defined(CONFIG_CPU_SUBTYPE_SH7780) 370#elif defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785)
354 ctrl_outw(0x0080, SCSPTR0); /* Set RTS = 1 */ 371 ctrl_outw(0x0080, SCSPTR0); /* Set RTS = 1 */
355#else 372#else
356 ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */ 373 ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */
@@ -360,7 +377,9 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
360} 377}
361#endif 378#endif
362 379
363#if defined(CONFIG_CPU_SUBTYPE_SH7760) || defined(CONFIG_CPU_SUBTYPE_SH7780) 380#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
381 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
382 defined(CONFIG_CPU_SUBTYPE_SH7785)
364static inline int scif_txroom(struct uart_port *port) 383static inline int scif_txroom(struct uart_port *port)
365{ 384{
366 return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f); 385 return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f);
@@ -735,12 +754,6 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
735 754
736 /* Handle BREAKs */ 755 /* Handle BREAKs */
737 sci_handle_breaks(port); 756 sci_handle_breaks(port);
738
739#ifdef CONFIG_SH_KGDB
740 /* Break into the debugger if a break is detected */
741 BREAKPOINT();
742#endif
743
744 sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); 757 sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port));
745 758
746 return IRQ_HANDLED; 759 return IRQ_HANDLED;
@@ -947,6 +960,10 @@ static int sci_startup(struct uart_port *port)
947 if (s->enable) 960 if (s->enable)
948 s->enable(port); 961 s->enable(port);
949 962
963#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
964 s->clk = clk_get(NULL, "module_clk");
965#endif
966
950 sci_request_irq(s); 967 sci_request_irq(s);
951 sci_start_tx(port); 968 sci_start_tx(port);
952 sci_start_rx(port, 1); 969 sci_start_rx(port, 1);
@@ -964,6 +981,11 @@ static void sci_shutdown(struct uart_port *port)
964 981
965 if (s->disable) 982 if (s->disable)
966 s->disable(port); 983 s->disable(port);
984
985#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
986 clk_put(s->clk);
987 s->clk = NULL;
988#endif
967} 989}
968 990
969static void sci_set_termios(struct uart_port *port, struct ktermios *termios, 991static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
@@ -971,7 +993,6 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
971{ 993{
972 struct sci_port *s = &sci_ports[port->line]; 994 struct sci_port *s = &sci_ports[port->line];
973 unsigned int status, baud, smr_val; 995 unsigned int status, baud, smr_val;
974 unsigned long flags;
975 int t; 996 int t;
976 997
977 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 998 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
@@ -983,18 +1004,14 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
983 default: 1004 default:
984 { 1005 {
985#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) 1006#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
986 struct clk *clk = clk_get(NULL, "module_clk"); 1007 t = SCBRR_VALUE(baud, clk_get_rate(s->clk));
987 t = SCBRR_VALUE(baud, clk_get_rate(clk));
988 clk_put(clk);
989#else 1008#else
990 t = SCBRR_VALUE(baud); 1009 t = SCBRR_VALUE(baud);
991#endif 1010#endif
992 }
993 break; 1011 break;
1012 }
994 } 1013 }
995 1014
996 spin_lock_irqsave(&port->lock, flags);
997
998 do { 1015 do {
999 status = sci_in(port, SCxSR); 1016 status = sci_in(port, SCxSR);
1000 } while (!(status & SCxSR_TEND(port))); 1017 } while (!(status & SCxSR_TEND(port)));
@@ -1038,8 +1055,6 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
1038 1055
1039 if ((termios->c_cflag & CREAD) != 0) 1056 if ((termios->c_cflag & CREAD) != 0)
1040 sci_start_rx(port,0); 1057 sci_start_rx(port,0);
1041
1042 spin_unlock_irqrestore(&port->lock, flags);
1043} 1058}
1044 1059
1045static const char *sci_type(struct uart_port *port) 1060static const char *sci_type(struct uart_port *port)
@@ -1220,10 +1235,13 @@ static int __init serial_console_setup(struct console *co, char *options)
1220 if (!port->membase || !port->mapbase) 1235 if (!port->membase || !port->mapbase)
1221 return -ENODEV; 1236 return -ENODEV;
1222 1237
1223 spin_lock_init(&port->lock);
1224
1225 port->type = serial_console_port->type; 1238 port->type = serial_console_port->type;
1226 1239
1240#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
1241 if (!serial_console_port->clk)
1242 serial_console_port->clk = clk_get(NULL, "module_clk");
1243#endif
1244
1227 if (port->flags & UPF_IOREMAP) 1245 if (port->flags & UPF_IOREMAP)
1228 sci_config_port(port, 0); 1246 sci_config_port(port, 0);
1229 1247
@@ -1247,7 +1265,7 @@ static struct console serial_console = {
1247 .device = uart_console_device, 1265 .device = uart_console_device,
1248 .write = serial_console_write, 1266 .write = serial_console_write,
1249 .setup = serial_console_setup, 1267 .setup = serial_console_setup,
1250 .flags = CON_PRINTBUFFER, 1268 .flags = CON_PRINTBUFFER,
1251 .index = -1, 1269 .index = -1,
1252 .data = &sci_uart_driver, 1270 .data = &sci_uart_driver,
1253}; 1271};
@@ -1292,11 +1310,23 @@ int __init kgdb_console_setup(struct console *co, char *options)
1292 int parity = 'n'; 1310 int parity = 'n';
1293 int flow = 'n'; 1311 int flow = 'n';
1294 1312
1295 spin_lock_init(&port->lock);
1296
1297 if (co->index != kgdb_portnum) 1313 if (co->index != kgdb_portnum)
1298 co->index = kgdb_portnum; 1314 co->index = kgdb_portnum;
1299 1315
1316 kgdb_sci_port = &sci_ports[co->index];
1317 port = &kgdb_sci_port->port;
1318
1319 /*
1320 * Also need to check port->type, we don't actually have any
1321 * UPIO_PORT ports, but uart_report_port() handily misreports
1322 * it anyways if we don't have a port available by the time this is
1323 * called.
1324 */
1325 if (!port->type)
1326 return -ENODEV;
1327 if (!port->membase || !port->mapbase)
1328 return -ENODEV;
1329
1300 if (options) 1330 if (options)
1301 uart_parse_options(options, &baud, &parity, &bits, &flow); 1331 uart_parse_options(options, &baud, &parity, &bits, &flow);
1302 else 1332 else
@@ -1311,11 +1341,12 @@ int __init kgdb_console_setup(struct console *co, char *options)
1311 1341
1312#ifdef CONFIG_SH_KGDB_CONSOLE 1342#ifdef CONFIG_SH_KGDB_CONSOLE
1313static struct console kgdb_console = { 1343static struct console kgdb_console = {
1314 .name = "ttySC", 1344 .name = "ttySC",
1315 .write = kgdb_console_write, 1345 .device = uart_console_device,
1316 .setup = kgdb_console_setup, 1346 .write = kgdb_console_write,
1317 .flags = CON_PRINTBUFFER | CON_ENABLED, 1347 .setup = kgdb_console_setup,
1318 .index = -1, 1348 .flags = CON_PRINTBUFFER,
1349 .index = -1,
1319 .data = &sci_uart_driver, 1350 .data = &sci_uart_driver,
1320}; 1351};
1321 1352
@@ -1361,9 +1392,19 @@ static int __devinit sci_probe(struct platform_device *dev)
1361 struct plat_sci_port *p = dev->dev.platform_data; 1392 struct plat_sci_port *p = dev->dev.platform_data;
1362 int i; 1393 int i;
1363 1394
1364 for (i = 0; p && p->flags != 0 && i < SCI_NPORTS; p++, i++) { 1395 for (i = 0; p && p->flags != 0; p++, i++) {
1365 struct sci_port *sciport = &sci_ports[i]; 1396 struct sci_port *sciport = &sci_ports[i];
1366 1397
1398 /* Sanity check */
1399 if (unlikely(i == SCI_NPORTS)) {
1400 dev_notice(&dev->dev, "Attempting to register port "
1401 "%d when only %d are available.\n",
1402 i+1, SCI_NPORTS);
1403 dev_notice(&dev->dev, "Consider bumping "
1404 "CONFIG_SERIAL_SH_SCI_NR_UARTS!\n");
1405 break;
1406 }
1407
1367 sciport->port.mapbase = p->mapbase; 1408 sciport->port.mapbase = p->mapbase;
1368 1409
1369 /* 1410 /*
@@ -1386,6 +1427,12 @@ static int __devinit sci_probe(struct platform_device *dev)
1386 uart_add_one_port(&sci_uart_driver, &sciport->port); 1427 uart_add_one_port(&sci_uart_driver, &sciport->port);
1387 } 1428 }
1388 1429
1430#if defined(CONFIG_SH_KGDB) && !defined(CONFIG_SH_KGDB_CONSOLE)
1431 kgdb_sci_port = &sci_ports[kgdb_portnum];
1432 kgdb_getchar = kgdb_sci_getchar;
1433 kgdb_putchar = kgdb_sci_putchar;
1434#endif
1435
1389#ifdef CONFIG_CPU_FREQ 1436#ifdef CONFIG_CPU_FREQ
1390 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); 1437 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER);
1391 dev_info(&dev->dev, "sci: CPU frequency notifier registered\n"); 1438 dev_info(&dev->dev, "sci: CPU frequency notifier registered\n");
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 77f7d6351ab1..fb04fb5f9843 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -73,9 +73,13 @@
73# define SCPDR 0xA4050136 /* 16 bit SCIF */ 73# define SCPDR 0xA4050136 /* 16 bit SCIF */
74# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ 74# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
75# define SCIF_ONLY 75# define SCIF_ONLY
76#elif defined(CONFIG_CPU_SUBTYPE_SH7710) 76#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
77# define SCSPTR0 0xA4400000 /* 16 bit SCIF */ 77# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
78# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ 78# define SCI_NPORTS 2
79# define SCIF_ORER 0x0001 /* overrun error bit */
80# define PACR 0xa4050100
81# define PBCR 0xa4050102
82# define SCSCR_INIT(port) 0x3B
79# define SCIF_ONLY 83# define SCIF_ONLY
80#elif defined(CONFIG_CPU_SUBTYPE_SH73180) 84#elif defined(CONFIG_CPU_SUBTYPE_SH73180)
81# define SCPDR 0xA4050138 /* 16 bit SCIF */ 85# define SCPDR 0xA4050138 /* 16 bit SCIF */
@@ -140,6 +144,16 @@
140# define SCIF_ORER 0x0001 /* Overrun error bit */ 144# define SCIF_ORER 0x0001 /* Overrun error bit */
141# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 145# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
142# define SCIF_ONLY 146# define SCIF_ONLY
147#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
148# define SCSPTR0 0xffea0024 /* 16 bit SCIF */
149# define SCSPTR1 0xffeb0024 /* 16 bit SCIF */
150# define SCSPTR2 0xffec0024 /* 16 bit SCIF */
151# define SCSPTR3 0xffed0024 /* 16 bit SCIF */
152# define SCSPTR4 0xffee0024 /* 16 bit SCIF */
153# define SCSPTR5 0xffef0024 /* 16 bit SCIF */
154# define SCIF_OPER 0x0001 /* Overrun error bit */
155# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
156# define SCIF_ONLY
143#elif defined(CONFIG_CPU_SUBTYPE_SH7206) 157#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
144# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */ 158# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
145# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */ 159# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */
@@ -163,7 +177,10 @@
163#define SCI_CTRL_FLAGS_RIE 0x40 /* all */ 177#define SCI_CTRL_FLAGS_RIE 0x40 /* all */
164#define SCI_CTRL_FLAGS_TE 0x20 /* all */ 178#define SCI_CTRL_FLAGS_TE 0x20 /* all */
165#define SCI_CTRL_FLAGS_RE 0x10 /* all */ 179#define SCI_CTRL_FLAGS_RE 0x10 /* all */
166#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || defined(CONFIG_CPU_SUBTYPE_SH7780) 180#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
181 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
182 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
183 defined(CONFIG_CPU_SUBTYPE_SH7785)
167#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */ 184#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
168#else 185#else
169#define SCI_CTRL_FLAGS_REIE 0 186#define SCI_CTRL_FLAGS_REIE 0
@@ -333,9 +350,15 @@
333 } 350 }
334 351
335#ifdef CONFIG_CPU_SH3 352#ifdef CONFIG_CPU_SH3
336#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \ 353#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
337 defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 354#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
338 defined(CONFIG_CPU_SUBTYPE_SH7710) 355 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
356 h8_sci_offset, h8_sci_size) \
357 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
358#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
359 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
360#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
361 defined(CONFIG_CPU_SUBTYPE_SH7705)
339#define SCIF_FNS(name, scif_offset, scif_size) \ 362#define SCIF_FNS(name, scif_offset, scif_size) \
340 CPU_SCIF_FNS(name, scif_offset, scif_size) 363 CPU_SCIF_FNS(name, scif_offset, scif_size)
341#else 364#else
@@ -362,8 +385,8 @@
362#endif 385#endif
363 386
364#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \ 387#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
365 defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 388 defined(CONFIG_CPU_SUBTYPE_SH7705)
366 defined(CONFIG_CPU_SUBTYPE_SH7710) 389
367SCIF_FNS(SCSMR, 0x00, 16) 390SCIF_FNS(SCSMR, 0x00, 16)
368SCIF_FNS(SCBRR, 0x04, 8) 391SCIF_FNS(SCBRR, 0x04, 8)
369SCIF_FNS(SCSCR, 0x08, 16) 392SCIF_FNS(SCSCR, 0x08, 16)
@@ -385,7 +408,9 @@ SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8, 0x03, 8)
385SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8) 408SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
386SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) 409SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
387SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) 410SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
388#if defined(CONFIG_CPU_SUBTYPE_SH7760) || defined(CONFIG_CPU_SUBTYPE_SH7780) 411#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
412 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
413 defined(CONFIG_CPU_SUBTYPE_SH7785)
389SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) 414SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
390SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) 415SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
391SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) 416SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
@@ -471,13 +496,24 @@ static inline int sci_rxd_in(struct uart_port *port)
471 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */ 496 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
472 return 1; 497 return 1;
473} 498}
474#elif defined(CONFIG_CPU_SUBTYPE_SH7710) 499#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
475static inline int sci_rxd_in(struct uart_port *port) 500static inline int sci_rxd_in(struct uart_port *port)
476{ 501{
477 if (port->mapbase == SCSPTR0) 502 return sci_in(port,SCxSR)&0x0010 ? 1 : 0;
478 return ctrl_inw(SCSPTR0 + 0x10) & 0x01 ? 1 : 0; 503}
479 return 1; 504static inline void set_sh771x_scif_pfc(struct uart_port *port)
505{
506 if (port->mapbase == 0xA4400000){
507 ctrl_outw(ctrl_inw(PACR)&0xffc0,PACR);
508 ctrl_outw(ctrl_inw(PBCR)&0x0fff,PBCR);
509 return;
510 }
511 if (port->mapbase == 0xA4410000){
512 ctrl_outw(ctrl_inw(PBCR)&0xf003,PBCR);
513 return;
514 }
480} 515}
516
481#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ 517#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
482 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 518 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
483 defined(CONFIG_CPU_SUBTYPE_SH4_202) 519 defined(CONFIG_CPU_SUBTYPE_SH4_202)
@@ -576,6 +612,23 @@ static inline int sci_rxd_in(struct uart_port *port)
576 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 612 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
577 return 1; 613 return 1;
578} 614}
615#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
616static inline int sci_rxd_in(struct uart_port *port)
617{
618 if (port->mapbase == 0xffea0000)
619 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
620 if (port->mapbase == 0xffeb0000)
621 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
622 if (port->mapbase == 0xffec0000)
623 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
624 if (port->mapbase == 0xffed0000)
625 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
626 if (port->mapbase == 0xffee0000)
627 return ctrl_inw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */
628 if (port->mapbase == 0xffef0000)
629 return ctrl_inw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
630 return 1;
631}
579#elif defined(CONFIG_CPU_SUBTYPE_SH7206) 632#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
580static inline int sci_rxd_in(struct uart_port *port) 633static inline int sci_rxd_in(struct uart_port *port)
581{ 634{
@@ -634,7 +687,9 @@ static inline int sci_rxd_in(struct uart_port *port)
634 * -- Mitch Davis - 15 Jul 2000 687 * -- Mitch Davis - 15 Jul 2000
635 */ 688 */
636 689
637#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7780) 690#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
691 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
692 defined(CONFIG_CPU_SUBTYPE_SH7785)
638#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) 693#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
639#elif defined(CONFIG_CPU_SUBTYPE_SH7705) 694#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
640#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) 695#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index bfd44177a215..2a63cdba3208 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1312,7 +1312,7 @@ static void sunsu_console_write(struct console *co, const char *s,
1312 * - initialize the serial port 1312 * - initialize the serial port
1313 * Return non-zero if we didn't find a serial port. 1313 * Return non-zero if we didn't find a serial port.
1314 */ 1314 */
1315static int sunsu_console_setup(struct console *co, char *options) 1315static int __init sunsu_console_setup(struct console *co, char *options)
1316{ 1316{
1317 struct uart_port *port; 1317 struct uart_port *port;
1318 int baud = 9600; 1318 int baud = 9600;
@@ -1343,7 +1343,7 @@ static int sunsu_console_setup(struct console *co, char *options)
1343 return uart_set_options(port, co, baud, parity, bits, flow); 1343 return uart_set_options(port, co, baud, parity, bits, flow);
1344} 1344}
1345 1345
1346static struct console sunsu_cons = { 1346static struct console sunsu_console = {
1347 .name = "ttyS", 1347 .name = "ttyS",
1348 .write = sunsu_console_write, 1348 .write = sunsu_console_write,
1349 .device = uart_console_device, 1349 .device = uart_console_device,
@@ -1373,9 +1373,9 @@ static inline struct console *SUNSU_CONSOLE(int num_uart)
1373 if (i == num_uart) 1373 if (i == num_uart)
1374 return NULL; 1374 return NULL;
1375 1375
1376 sunsu_cons.index = i; 1376 sunsu_console.index = i;
1377 1377
1378 return &sunsu_cons; 1378 return &sunsu_console;
1379} 1379}
1380#else 1380#else
1381#define SUNSU_CONSOLE(num_uart) (NULL) 1381#define SUNSU_CONSOLE(num_uart) (NULL)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 7e54e48efd5c..4a012d9acbff 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -58,6 +58,12 @@ config SPI_ATMEL
58 This selects a driver for the Atmel SPI Controller, present on 58 This selects a driver for the Atmel SPI Controller, present on
59 many AT32 (AVR32) and AT91 (ARM) chips. 59 many AT32 (AVR32) and AT91 (ARM) chips.
60 60
61config SPI_BFIN
62 tristate "SPI controller driver for ADI Blackfin5xx"
63 depends on SPI_MASTER && BFIN
64 help
65 This is the SPI controller master driver for Blackfin 5xx processor.
66
61config SPI_BITBANG 67config SPI_BITBANG
62 tristate "Bitbanging SPI master" 68 tristate "Bitbanging SPI master"
63 depends on SPI_MASTER && EXPERIMENTAL 69 depends on SPI_MASTER && EXPERIMENTAL
@@ -157,7 +163,6 @@ config SPI_AT25
157# Add new SPI protocol masters in alphabetical order above this line 163# Add new SPI protocol masters in alphabetical order above this line
158# 164#
159 165
160
161# (slave support would go here) 166# (slave support would go here)
162 167
163endmenu # "SPI support" 168endmenu # "SPI support"
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 3c280ad89202..a95ade857a2f 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -11,8 +11,9 @@ endif
11obj-$(CONFIG_SPI_MASTER) += spi.o 11obj-$(CONFIG_SPI_MASTER) += spi.o
12 12
13# SPI master controller drivers (bus) 13# SPI master controller drivers (bus)
14obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o
15obj-$(CONFIG_SPI_ATMEL) += atmel_spi.o 14obj-$(CONFIG_SPI_ATMEL) += atmel_spi.o
15obj-$(CONFIG_SPI_BFIN) += spi_bfin5xx.o
16obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o
16obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o 17obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o
17obj-$(CONFIG_SPI_IMX) += spi_imx.o 18obj-$(CONFIG_SPI_IMX) += spi_imx.o
18obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o 19obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
new file mode 100644
index 000000000000..ce3c0ce2316e
--- /dev/null
+++ b/drivers/spi/spi_bfin5xx.c
@@ -0,0 +1,1313 @@
1/*
2 * File: drivers/spi/bfin5xx_spi.c
3 * Based on: N/A
4 * Author: Luke Yang (Analog Devices Inc.)
5 *
6 * Created: March. 10th 2006
7 * Description: SPI controller driver for Blackfin 5xx
8 * Bugs: Enter bugs at http://blackfin.uclinux.org/
9 *
10 * Modified:
11 * March 10, 2006 bfin5xx_spi.c Created. (Luke Yang)
12 * August 7, 2006 added full duplex mode (Axel Weiss & Luke Yang)
13 *
14 * Copyright 2004-2006 Analog Devices Inc.
15 *
16 * This program is free software ; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation ; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program ; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#include <linux/init.h>
33#include <linux/module.h>
34#include <linux/device.h>
35#include <linux/ioport.h>
36#include <linux/errno.h>
37#include <linux/interrupt.h>
38#include <linux/platform_device.h>
39#include <linux/dma-mapping.h>
40#include <linux/spi/spi.h>
41#include <linux/workqueue.h>
42#include <linux/errno.h>
43#include <linux/delay.h>
44
45#include <asm/io.h>
46#include <asm/irq.h>
47#include <asm/delay.h>
48#include <asm/dma.h>
49
50#include <asm/bfin5xx_spi.h>
51
52MODULE_AUTHOR("Luke Yang");
53MODULE_DESCRIPTION("Blackfin 5xx SPI Contoller");
54MODULE_LICENSE("GPL");
55
56#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)
57
58#define DEFINE_SPI_REG(reg, off) \
59static inline u16 read_##reg(void) \
60 { return *(volatile unsigned short*)(SPI0_REGBASE + off); } \
61static inline void write_##reg(u16 v) \
62 {*(volatile unsigned short*)(SPI0_REGBASE + off) = v;\
63 SSYNC();}
64
65DEFINE_SPI_REG(CTRL, 0x00)
66DEFINE_SPI_REG(FLAG, 0x04)
67DEFINE_SPI_REG(STAT, 0x08)
68DEFINE_SPI_REG(TDBR, 0x0C)
69DEFINE_SPI_REG(RDBR, 0x10)
70DEFINE_SPI_REG(BAUD, 0x14)
71DEFINE_SPI_REG(SHAW, 0x18)
72#define START_STATE ((void*)0)
73#define RUNNING_STATE ((void*)1)
74#define DONE_STATE ((void*)2)
75#define ERROR_STATE ((void*)-1)
76#define QUEUE_RUNNING 0
77#define QUEUE_STOPPED 1
78int dma_requested;
79
80struct driver_data {
81 /* Driver model hookup */
82 struct platform_device *pdev;
83
84 /* SPI framework hookup */
85 struct spi_master *master;
86
87 /* BFIN hookup */
88 struct bfin5xx_spi_master *master_info;
89
90 /* Driver message queue */
91 struct workqueue_struct *workqueue;
92 struct work_struct pump_messages;
93 spinlock_t lock;
94 struct list_head queue;
95 int busy;
96 int run;
97
98 /* Message Transfer pump */
99 struct tasklet_struct pump_transfers;
100
101 /* Current message transfer state info */
102 struct spi_message *cur_msg;
103 struct spi_transfer *cur_transfer;
104 struct chip_data *cur_chip;
105 size_t len_in_bytes;
106 size_t len;
107 void *tx;
108 void *tx_end;
109 void *rx;
110 void *rx_end;
111 int dma_mapped;
112 dma_addr_t rx_dma;
113 dma_addr_t tx_dma;
114 size_t rx_map_len;
115 size_t tx_map_len;
116 u8 n_bytes;
117 void (*write) (struct driver_data *);
118 void (*read) (struct driver_data *);
119 void (*duplex) (struct driver_data *);
120};
121
122struct chip_data {
123 u16 ctl_reg;
124 u16 baud;
125 u16 flag;
126
127 u8 chip_select_num;
128 u8 n_bytes;
129 u32 width; /* 0 or 1 */
130 u8 enable_dma;
131 u8 bits_per_word; /* 8 or 16 */
132 u8 cs_change_per_word;
133 u8 cs_chg_udelay;
134 void (*write) (struct driver_data *);
135 void (*read) (struct driver_data *);
136 void (*duplex) (struct driver_data *);
137};
138
139void bfin_spi_enable(struct driver_data *drv_data)
140{
141 u16 cr;
142
143 cr = read_CTRL();
144 write_CTRL(cr | BIT_CTL_ENABLE);
145 SSYNC();
146}
147
148void bfin_spi_disable(struct driver_data *drv_data)
149{
150 u16 cr;
151
152 cr = read_CTRL();
153 write_CTRL(cr & (~BIT_CTL_ENABLE));
154 SSYNC();
155}
156
157/* Caculate the SPI_BAUD register value based on input HZ */
158static u16 hz_to_spi_baud(u32 speed_hz)
159{
160 u_long sclk = get_sclk();
161 u16 spi_baud = (sclk / (2 * speed_hz));
162
163 if ((sclk % (2 * speed_hz)) > 0)
164 spi_baud++;
165
166 pr_debug("sclk = %ld, speed_hz = %d, spi_baud = %d\n", sclk, speed_hz,
167 spi_baud);
168
169 return spi_baud;
170}
171
172static int flush(struct driver_data *drv_data)
173{
174 unsigned long limit = loops_per_jiffy << 1;
175
176 /* wait for stop and clear stat */
177 while (!(read_STAT() & BIT_STAT_SPIF) && limit--)
178 continue;
179
180 write_STAT(BIT_STAT_CLR);
181
182 return limit;
183}
184
185/* stop controller and re-config current chip*/
186static void restore_state(struct driver_data *drv_data)
187{
188 struct chip_data *chip = drv_data->cur_chip;
189
190 /* Clear status and disable clock */
191 write_STAT(BIT_STAT_CLR);
192 bfin_spi_disable(drv_data);
193 pr_debug("restoring spi ctl state\n");
194
195#if defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537)
196 pr_debug("chip select number is %d\n", chip->chip_select_num);
197
198 switch (chip->chip_select_num) {
199 case 1:
200 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3c00);
201 SSYNC();
202 break;
203
204 case 2:
205 case 3:
206 bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PJSE_SPI);
207 SSYNC();
208 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3800);
209 SSYNC();
210 break;
211
212 case 4:
213 bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS4E_SPI);
214 SSYNC();
215 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3840);
216 SSYNC();
217 break;
218
219 case 5:
220 bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS5E_SPI);
221 SSYNC();
222 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3820);
223 SSYNC();
224 break;
225
226 case 6:
227 bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS6E_SPI);
228 SSYNC();
229 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3810);
230 SSYNC();
231 break;
232
233 case 7:
234 bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PJCE_SPI);
235 SSYNC();
236 bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3800);
237 SSYNC();
238 break;
239 }
240#endif
241
242 /* Load the registers */
243 write_CTRL(chip->ctl_reg);
244 write_BAUD(chip->baud);
245 write_FLAG(chip->flag);
246}
247
248/* used to kick off transfer in rx mode */
249static unsigned short dummy_read(void)
250{
251 unsigned short tmp;
252 tmp = read_RDBR();
253 return tmp;
254}
255
256static void null_writer(struct driver_data *drv_data)
257{
258 u8 n_bytes = drv_data->n_bytes;
259
260 while (drv_data->tx < drv_data->tx_end) {
261 write_TDBR(0);
262 while ((read_STAT() & BIT_STAT_TXS))
263 continue;
264 drv_data->tx += n_bytes;
265 }
266}
267
268static void null_reader(struct driver_data *drv_data)
269{
270 u8 n_bytes = drv_data->n_bytes;
271 dummy_read();
272
273 while (drv_data->rx < drv_data->rx_end) {
274 while (!(read_STAT() & BIT_STAT_RXS))
275 continue;
276 dummy_read();
277 drv_data->rx += n_bytes;
278 }
279}
280
281static void u8_writer(struct driver_data *drv_data)
282{
283 pr_debug("cr8-s is 0x%x\n", read_STAT());
284 while (drv_data->tx < drv_data->tx_end) {
285 write_TDBR(*(u8 *) (drv_data->tx));
286 while (read_STAT() & BIT_STAT_TXS)
287 continue;
288 ++drv_data->tx;
289 }
290
291 /* poll for SPI completion before returning */
292 while (!(read_STAT() & BIT_STAT_SPIF))
293 continue;
294}
295
296static void u8_cs_chg_writer(struct driver_data *drv_data)
297{
298 struct chip_data *chip = drv_data->cur_chip;
299
300 while (drv_data->tx < drv_data->tx_end) {
301 write_FLAG(chip->flag);
302 SSYNC();
303
304 write_TDBR(*(u8 *) (drv_data->tx));
305 while (read_STAT() & BIT_STAT_TXS)
306 continue;
307 while (!(read_STAT() & BIT_STAT_SPIF))
308 continue;
309 write_FLAG(0xFF00 | chip->flag);
310 SSYNC();
311 if (chip->cs_chg_udelay)
312 udelay(chip->cs_chg_udelay);
313 ++drv_data->tx;
314 }
315 write_FLAG(0xFF00);
316 SSYNC();
317}
318
319static void u8_reader(struct driver_data *drv_data)
320{
321 pr_debug("cr-8 is 0x%x\n", read_STAT());
322
323 /* clear TDBR buffer before read(else it will be shifted out) */
324 write_TDBR(0xFFFF);
325
326 dummy_read();
327
328 while (drv_data->rx < drv_data->rx_end - 1) {
329 while (!(read_STAT() & BIT_STAT_RXS))
330 continue;
331 *(u8 *) (drv_data->rx) = read_RDBR();
332 ++drv_data->rx;
333 }
334
335 while (!(read_STAT() & BIT_STAT_RXS))
336 continue;
337 *(u8 *) (drv_data->rx) = read_SHAW();
338 ++drv_data->rx;
339}
340
341static void u8_cs_chg_reader(struct driver_data *drv_data)
342{
343 struct chip_data *chip = drv_data->cur_chip;
344
345 while (drv_data->rx < drv_data->rx_end) {
346 write_FLAG(chip->flag);
347 SSYNC();
348
349 read_RDBR(); /* kick off */
350 while (!(read_STAT() & BIT_STAT_RXS))
351 continue;
352 while (!(read_STAT() & BIT_STAT_SPIF))
353 continue;
354 *(u8 *) (drv_data->rx) = read_SHAW();
355 write_FLAG(0xFF00 | chip->flag);
356 SSYNC();
357 if (chip->cs_chg_udelay)
358 udelay(chip->cs_chg_udelay);
359 ++drv_data->rx;
360 }
361 write_FLAG(0xFF00);
362 SSYNC();
363}
364
365static void u8_duplex(struct driver_data *drv_data)
366{
367 /* in duplex mode, clk is triggered by writing of TDBR */
368 while (drv_data->rx < drv_data->rx_end) {
369 write_TDBR(*(u8 *) (drv_data->tx));
370 while (!(read_STAT() & BIT_STAT_SPIF))
371 continue;
372 while (!(read_STAT() & BIT_STAT_RXS))
373 continue;
374 *(u8 *) (drv_data->rx) = read_RDBR();
375 ++drv_data->rx;
376 ++drv_data->tx;
377 }
378}
379
380static void u8_cs_chg_duplex(struct driver_data *drv_data)
381{
382 struct chip_data *chip = drv_data->cur_chip;
383
384 while (drv_data->rx < drv_data->rx_end) {
385 write_FLAG(chip->flag);
386 SSYNC();
387
388 write_TDBR(*(u8 *) (drv_data->tx));
389 while (!(read_STAT() & BIT_STAT_SPIF))
390 continue;
391 while (!(read_STAT() & BIT_STAT_RXS))
392 continue;
393 *(u8 *) (drv_data->rx) = read_RDBR();
394 write_FLAG(0xFF00 | chip->flag);
395 SSYNC();
396 if (chip->cs_chg_udelay)
397 udelay(chip->cs_chg_udelay);
398 ++drv_data->rx;
399 ++drv_data->tx;
400 }
401 write_FLAG(0xFF00);
402 SSYNC();
403}
404
405static void u16_writer(struct driver_data *drv_data)
406{
407 pr_debug("cr16 is 0x%x\n", read_STAT());
408 while (drv_data->tx < drv_data->tx_end) {
409 write_TDBR(*(u16 *) (drv_data->tx));
410 while ((read_STAT() & BIT_STAT_TXS))
411 continue;
412 drv_data->tx += 2;
413 }
414
415 /* poll for SPI completion before returning */
416 while (!(read_STAT() & BIT_STAT_SPIF))
417 continue;
418}
419
420static void u16_cs_chg_writer(struct driver_data *drv_data)
421{
422 struct chip_data *chip = drv_data->cur_chip;
423
424 while (drv_data->tx < drv_data->tx_end) {
425 write_FLAG(chip->flag);
426 SSYNC();
427
428 write_TDBR(*(u16 *) (drv_data->tx));
429 while ((read_STAT() & BIT_STAT_TXS))
430 continue;
431 while (!(read_STAT() & BIT_STAT_SPIF))
432 continue;
433 write_FLAG(0xFF00 | chip->flag);
434 SSYNC();
435 if (chip->cs_chg_udelay)
436 udelay(chip->cs_chg_udelay);
437 drv_data->tx += 2;
438 }
439 write_FLAG(0xFF00);
440 SSYNC();
441}
442
443static void u16_reader(struct driver_data *drv_data)
444{
445 pr_debug("cr-16 is 0x%x\n", read_STAT());
446 dummy_read();
447
448 while (drv_data->rx < (drv_data->rx_end - 2)) {
449 while (!(read_STAT() & BIT_STAT_RXS))
450 continue;
451 *(u16 *) (drv_data->rx) = read_RDBR();
452 drv_data->rx += 2;
453 }
454
455 while (!(read_STAT() & BIT_STAT_RXS))
456 continue;
457 *(u16 *) (drv_data->rx) = read_SHAW();
458 drv_data->rx += 2;
459}
460
461static void u16_cs_chg_reader(struct driver_data *drv_data)
462{
463 struct chip_data *chip = drv_data->cur_chip;
464
465 while (drv_data->rx < drv_data->rx_end) {
466 write_FLAG(chip->flag);
467 SSYNC();
468
469 read_RDBR(); /* kick off */
470 while (!(read_STAT() & BIT_STAT_RXS))
471 continue;
472 while (!(read_STAT() & BIT_STAT_SPIF))
473 continue;
474 *(u16 *) (drv_data->rx) = read_SHAW();
475 write_FLAG(0xFF00 | chip->flag);
476 SSYNC();
477 if (chip->cs_chg_udelay)
478 udelay(chip->cs_chg_udelay);
479 drv_data->rx += 2;
480 }
481 write_FLAG(0xFF00);
482 SSYNC();
483}
484
485static void u16_duplex(struct driver_data *drv_data)
486{
487 /* in duplex mode, clk is triggered by writing of TDBR */
488 while (drv_data->tx < drv_data->tx_end) {
489 write_TDBR(*(u16 *) (drv_data->tx));
490 while (!(read_STAT() & BIT_STAT_SPIF))
491 continue;
492 while (!(read_STAT() & BIT_STAT_RXS))
493 continue;
494 *(u16 *) (drv_data->rx) = read_RDBR();
495 drv_data->rx += 2;
496 drv_data->tx += 2;
497 }
498}
499
500static void u16_cs_chg_duplex(struct driver_data *drv_data)
501{
502 struct chip_data *chip = drv_data->cur_chip;
503
504 while (drv_data->tx < drv_data->tx_end) {
505 write_FLAG(chip->flag);
506 SSYNC();
507
508 write_TDBR(*(u16 *) (drv_data->tx));
509 while (!(read_STAT() & BIT_STAT_SPIF))
510 continue;
511 while (!(read_STAT() & BIT_STAT_RXS))
512 continue;
513 *(u16 *) (drv_data->rx) = read_RDBR();
514 write_FLAG(0xFF00 | chip->flag);
515 SSYNC();
516 if (chip->cs_chg_udelay)
517 udelay(chip->cs_chg_udelay);
518 drv_data->rx += 2;
519 drv_data->tx += 2;
520 }
521 write_FLAG(0xFF00);
522 SSYNC();
523}
524
525/* test if ther is more transfer to be done */
526static void *next_transfer(struct driver_data *drv_data)
527{
528 struct spi_message *msg = drv_data->cur_msg;
529 struct spi_transfer *trans = drv_data->cur_transfer;
530
531 /* Move to next transfer */
532 if (trans->transfer_list.next != &msg->transfers) {
533 drv_data->cur_transfer =
534 list_entry(trans->transfer_list.next,
535 struct spi_transfer, transfer_list);
536 return RUNNING_STATE;
537 } else
538 return DONE_STATE;
539}
540
541/*
542 * caller already set message->status;
543 * dma and pio irqs are blocked give finished message back
544 */
545static void giveback(struct driver_data *drv_data)
546{
547 struct spi_transfer *last_transfer;
548 unsigned long flags;
549 struct spi_message *msg;
550
551 spin_lock_irqsave(&drv_data->lock, flags);
552 msg = drv_data->cur_msg;
553 drv_data->cur_msg = NULL;
554 drv_data->cur_transfer = NULL;
555 drv_data->cur_chip = NULL;
556 queue_work(drv_data->workqueue, &drv_data->pump_messages);
557 spin_unlock_irqrestore(&drv_data->lock, flags);
558
559 last_transfer = list_entry(msg->transfers.prev,
560 struct spi_transfer, transfer_list);
561
562 msg->state = NULL;
563
564 /* disable chip select signal. And not stop spi in autobuffer mode */
565 if (drv_data->tx_dma != 0xFFFF) {
566 write_FLAG(0xFF00);
567 bfin_spi_disable(drv_data);
568 }
569
570 if (msg->complete)
571 msg->complete(msg->context);
572}
573
574static irqreturn_t dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
575{
576 struct driver_data *drv_data = (struct driver_data *)dev_id;
577 struct spi_message *msg = drv_data->cur_msg;
578
579 pr_debug("in dma_irq_handler\n");
580 clear_dma_irqstat(CH_SPI);
581
582 /*
583 * wait for the last transaction shifted out. yes, these two
584 * while loops are supposed to be the same (see the HRM).
585 */
586 if (drv_data->tx != NULL) {
587 while (bfin_read_SPI_STAT() & TXS)
588 continue;
589 while (bfin_read_SPI_STAT() & TXS)
590 continue;
591 }
592
593 while (!(bfin_read_SPI_STAT() & SPIF))
594 continue;
595
596 bfin_spi_disable(drv_data);
597
598 msg->actual_length += drv_data->len_in_bytes;
599
600 /* Move to next transfer */
601 msg->state = next_transfer(drv_data);
602
603 /* Schedule transfer tasklet */
604 tasklet_schedule(&drv_data->pump_transfers);
605
606 /* free the irq handler before next transfer */
607 pr_debug("disable dma channel irq%d\n", CH_SPI);
608 dma_disable_irq(CH_SPI);
609
610 return IRQ_HANDLED;
611}
612
613static void pump_transfers(unsigned long data)
614{
615 struct driver_data *drv_data = (struct driver_data *)data;
616 struct spi_message *message = NULL;
617 struct spi_transfer *transfer = NULL;
618 struct spi_transfer *previous = NULL;
619 struct chip_data *chip = NULL;
620 u16 cr, width, dma_width, dma_config;
621 u32 tranf_success = 1;
622
623 /* Get current state information */
624 message = drv_data->cur_msg;
625 transfer = drv_data->cur_transfer;
626 chip = drv_data->cur_chip;
627
628 /*
629 * if msg is error or done, report it back using complete() callback
630 */
631
632 /* Handle for abort */
633 if (message->state == ERROR_STATE) {
634 message->status = -EIO;
635 giveback(drv_data);
636 return;
637 }
638
639 /* Handle end of message */
640 if (message->state == DONE_STATE) {
641 message->status = 0;
642 giveback(drv_data);
643 return;
644 }
645
646 /* Delay if requested at end of transfer */
647 if (message->state == RUNNING_STATE) {
648 previous = list_entry(transfer->transfer_list.prev,
649 struct spi_transfer, transfer_list);
650 if (previous->delay_usecs)
651 udelay(previous->delay_usecs);
652 }
653
654 /* Setup the transfer state based on the type of transfer */
655 if (flush(drv_data) == 0) {
656 dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n");
657 message->status = -EIO;
658 giveback(drv_data);
659 return;
660 }
661
662 if (transfer->tx_buf != NULL) {
663 drv_data->tx = (void *)transfer->tx_buf;
664 drv_data->tx_end = drv_data->tx + transfer->len;
665 pr_debug("tx_buf is %p, tx_end is %p\n", transfer->tx_buf,
666 drv_data->tx_end);
667 } else {
668 drv_data->tx = NULL;
669 }
670
671 if (transfer->rx_buf != NULL) {
672 drv_data->rx = transfer->rx_buf;
673 drv_data->rx_end = drv_data->rx + transfer->len;
674 pr_debug("rx_buf is %p, rx_end is %p\n", transfer->rx_buf,
675 drv_data->rx_end);
676 } else {
677 drv_data->rx = NULL;
678 }
679
680 drv_data->rx_dma = transfer->rx_dma;
681 drv_data->tx_dma = transfer->tx_dma;
682 drv_data->len_in_bytes = transfer->len;
683
684 width = chip->width;
685 if (width == CFG_SPI_WORDSIZE16) {
686 drv_data->len = (transfer->len) >> 1;
687 } else {
688 drv_data->len = transfer->len;
689 }
690 drv_data->write = drv_data->tx ? chip->write : null_writer;
691 drv_data->read = drv_data->rx ? chip->read : null_reader;
692 drv_data->duplex = chip->duplex ? chip->duplex : null_writer;
693 pr_debug
694 ("transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n",
695 drv_data->write, chip->write, null_writer);
696
697 /* speed and width has been set on per message */
698 message->state = RUNNING_STATE;
699 dma_config = 0;
700
701 /* restore spi status for each spi transfer */
702 if (transfer->speed_hz) {
703 write_BAUD(hz_to_spi_baud(transfer->speed_hz));
704 } else {
705 write_BAUD(chip->baud);
706 }
707 write_FLAG(chip->flag);
708
709 pr_debug("now pumping a transfer: width is %d, len is %d\n", width,
710 transfer->len);
711
712 /*
713 * Try to map dma buffer and do a dma transfer if
714 * successful use different way to r/w according to
715 * drv_data->cur_chip->enable_dma
716 */
717 if (drv_data->cur_chip->enable_dma && drv_data->len > 6) {
718
719 write_STAT(BIT_STAT_CLR);
720 disable_dma(CH_SPI);
721 clear_dma_irqstat(CH_SPI);
722 bfin_spi_disable(drv_data);
723
724 /* config dma channel */
725 pr_debug("doing dma transfer\n");
726 if (width == CFG_SPI_WORDSIZE16) {
727 set_dma_x_count(CH_SPI, drv_data->len);
728 set_dma_x_modify(CH_SPI, 2);
729 dma_width = WDSIZE_16;
730 } else {
731 set_dma_x_count(CH_SPI, drv_data->len);
732 set_dma_x_modify(CH_SPI, 1);
733 dma_width = WDSIZE_8;
734 }
735
736 /* set transfer width,direction. And enable spi */
737 cr = (read_CTRL() & (~BIT_CTL_TIMOD));
738
739 /* dirty hack for autobuffer DMA mode */
740 if (drv_data->tx_dma == 0xFFFF) {
741 pr_debug("doing autobuffer DMA out.\n");
742
743 /* no irq in autobuffer mode */
744 dma_config =
745 (DMAFLOW_AUTO | RESTART | dma_width | DI_EN);
746 set_dma_config(CH_SPI, dma_config);
747 set_dma_start_addr(CH_SPI, (unsigned long)drv_data->tx);
748 enable_dma(CH_SPI);
749 write_CTRL(cr | CFG_SPI_DMAWRITE | (width << 8) |
750 (CFG_SPI_ENABLE << 14));
751
752 /* just return here, there can only be one transfer in this mode */
753 message->status = 0;
754 giveback(drv_data);
755 return;
756 }
757
758 /* In dma mode, rx or tx must be NULL in one transfer */
759 if (drv_data->rx != NULL) {
760 /* set transfer mode, and enable SPI */
761 pr_debug("doing DMA in.\n");
762
763 /* disable SPI before write to TDBR */
764 write_CTRL(cr & ~BIT_CTL_ENABLE);
765
766 /* clear tx reg soformer data is not shifted out */
767 write_TDBR(0xFF);
768
769 set_dma_x_count(CH_SPI, drv_data->len);
770
771 /* start dma */
772 dma_enable_irq(CH_SPI);
773 dma_config = (WNR | RESTART | dma_width | DI_EN);
774 set_dma_config(CH_SPI, dma_config);
775 set_dma_start_addr(CH_SPI, (unsigned long)drv_data->rx);
776 enable_dma(CH_SPI);
777
778 cr |=
779 CFG_SPI_DMAREAD | (width << 8) | (CFG_SPI_ENABLE <<
780 14);
781 /* set transfer mode, and enable SPI */
782 write_CTRL(cr);
783 } else if (drv_data->tx != NULL) {
784 pr_debug("doing DMA out.\n");
785
786 /* start dma */
787 dma_enable_irq(CH_SPI);
788 dma_config = (RESTART | dma_width | DI_EN);
789 set_dma_config(CH_SPI, dma_config);
790 set_dma_start_addr(CH_SPI, (unsigned long)drv_data->tx);
791 enable_dma(CH_SPI);
792
793 write_CTRL(cr | CFG_SPI_DMAWRITE | (width << 8) |
794 (CFG_SPI_ENABLE << 14));
795
796 }
797 } else {
798 /* IO mode write then read */
799 pr_debug("doing IO transfer\n");
800
801 write_STAT(BIT_STAT_CLR);
802
803 if (drv_data->tx != NULL && drv_data->rx != NULL) {
804 /* full duplex mode */
805 BUG_ON((drv_data->tx_end - drv_data->tx) !=
806 (drv_data->rx_end - drv_data->rx));
807 cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* clear the TIMOD bits */
808 cr |=
809 CFG_SPI_WRITE | (width << 8) | (CFG_SPI_ENABLE <<
810 14);
811 pr_debug("IO duplex: cr is 0x%x\n", cr);
812
813 write_CTRL(cr);
814 SSYNC();
815
816 drv_data->duplex(drv_data);
817
818 if (drv_data->tx != drv_data->tx_end)
819 tranf_success = 0;
820 } else if (drv_data->tx != NULL) {
821 /* write only half duplex */
822 cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* clear the TIMOD bits */
823 cr |=
824 CFG_SPI_WRITE | (width << 8) | (CFG_SPI_ENABLE <<
825 14);
826 pr_debug("IO write: cr is 0x%x\n", cr);
827
828 write_CTRL(cr);
829 SSYNC();
830
831 drv_data->write(drv_data);
832
833 if (drv_data->tx != drv_data->tx_end)
834 tranf_success = 0;
835 } else if (drv_data->rx != NULL) {
836 /* read only half duplex */
837 cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* cleare the TIMOD bits */
838 cr |=
839 CFG_SPI_READ | (width << 8) | (CFG_SPI_ENABLE <<
840 14);
841 pr_debug("IO read: cr is 0x%x\n", cr);
842
843 write_CTRL(cr);
844 SSYNC();
845
846 drv_data->read(drv_data);
847 if (drv_data->rx != drv_data->rx_end)
848 tranf_success = 0;
849 }
850
851 if (!tranf_success) {
852 pr_debug("IO write error!\n");
853 message->state = ERROR_STATE;
854 } else {
855 /* Update total byte transfered */
856 message->actual_length += drv_data->len;
857
858 /* Move to next transfer of this msg */
859 message->state = next_transfer(drv_data);
860 }
861
862 /* Schedule next transfer tasklet */
863 tasklet_schedule(&drv_data->pump_transfers);
864
865 }
866}
867
868/* pop a msg from queue and kick off real transfer */
869static void pump_messages(struct work_struct *work)
870{
871 struct driver_data *drv_data = container_of(work, struct driver_data, pump_messages);
872 unsigned long flags;
873
874 /* Lock queue and check for queue work */
875 spin_lock_irqsave(&drv_data->lock, flags);
876 if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) {
877 /* pumper kicked off but no work to do */
878 drv_data->busy = 0;
879 spin_unlock_irqrestore(&drv_data->lock, flags);
880 return;
881 }
882
883 /* Make sure we are not already running a message */
884 if (drv_data->cur_msg) {
885 spin_unlock_irqrestore(&drv_data->lock, flags);
886 return;
887 }
888
889 /* Extract head of queue */
890 drv_data->cur_msg = list_entry(drv_data->queue.next,
891 struct spi_message, queue);
892 list_del_init(&drv_data->cur_msg->queue);
893
894 /* Initial message state */
895 drv_data->cur_msg->state = START_STATE;
896 drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next,
897 struct spi_transfer, transfer_list);
898
899 /* Setup the SSP using the per chip configuration */
900 drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi);
901 restore_state(drv_data);
902 pr_debug
903 ("got a message to pump, state is set to: baud %d, flag 0x%x, ctl 0x%x\n",
904 drv_data->cur_chip->baud, drv_data->cur_chip->flag,
905 drv_data->cur_chip->ctl_reg);
906 pr_debug("the first transfer len is %d\n", drv_data->cur_transfer->len);
907
908 /* Mark as busy and launch transfers */
909 tasklet_schedule(&drv_data->pump_transfers);
910
911 drv_data->busy = 1;
912 spin_unlock_irqrestore(&drv_data->lock, flags);
913}
914
915/*
916 * got a msg to transfer, queue it in drv_data->queue.
917 * And kick off message pumper
918 */
919static int transfer(struct spi_device *spi, struct spi_message *msg)
920{
921 struct driver_data *drv_data = spi_master_get_devdata(spi->master);
922 unsigned long flags;
923
924 spin_lock_irqsave(&drv_data->lock, flags);
925
926 if (drv_data->run == QUEUE_STOPPED) {
927 spin_unlock_irqrestore(&drv_data->lock, flags);
928 return -ESHUTDOWN;
929 }
930
931 msg->actual_length = 0;
932 msg->status = -EINPROGRESS;
933 msg->state = START_STATE;
934
935 pr_debug("adding an msg in transfer() \n");
936 list_add_tail(&msg->queue, &drv_data->queue);
937
938 if (drv_data->run == QUEUE_RUNNING && !drv_data->busy)
939 queue_work(drv_data->workqueue, &drv_data->pump_messages);
940
941 spin_unlock_irqrestore(&drv_data->lock, flags);
942
943 return 0;
944}
945
946/* first setup for new devices */
947static int setup(struct spi_device *spi)
948{
949 struct bfin5xx_spi_chip *chip_info = NULL;
950 struct chip_data *chip;
951 struct driver_data *drv_data = spi_master_get_devdata(spi->master);
952 u8 spi_flg;
953
954 /* Abort device setup if requested features are not supported */
955 if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) {
956 dev_err(&spi->dev, "requested mode not fully supported\n");
957 return -EINVAL;
958 }
959
960 /* Zero (the default) here means 8 bits */
961 if (!spi->bits_per_word)
962 spi->bits_per_word = 8;
963
964 if (spi->bits_per_word != 8 && spi->bits_per_word != 16)
965 return -EINVAL;
966
967 /* Only alloc (or use chip_info) on first setup */
968 chip = spi_get_ctldata(spi);
969 if (chip == NULL) {
970 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
971 if (!chip)
972 return -ENOMEM;
973
974 chip->enable_dma = 0;
975 chip_info = spi->controller_data;
976 }
977
978 /* chip_info isn't always needed */
979 if (chip_info) {
980 chip->enable_dma = chip_info->enable_dma != 0
981 && drv_data->master_info->enable_dma;
982 chip->ctl_reg = chip_info->ctl_reg;
983 chip->bits_per_word = chip_info->bits_per_word;
984 chip->cs_change_per_word = chip_info->cs_change_per_word;
985 chip->cs_chg_udelay = chip_info->cs_chg_udelay;
986 }
987
988 /* translate common spi framework into our register */
989 if (spi->mode & SPI_CPOL)
990 chip->ctl_reg |= CPOL;
991 if (spi->mode & SPI_CPHA)
992 chip->ctl_reg |= CPHA;
993 if (spi->mode & SPI_LSB_FIRST)
994 chip->ctl_reg |= LSBF;
995 /* we dont support running in slave mode (yet?) */
996 chip->ctl_reg |= MSTR;
997
998 /*
999 * if any one SPI chip is registered and wants DMA, request the
1000 * DMA channel for it
1001 */
1002 if (chip->enable_dma && !dma_requested) {
1003 /* register dma irq handler */
1004 if (request_dma(CH_SPI, "BF53x_SPI_DMA") < 0) {
1005 pr_debug
1006 ("Unable to request BlackFin SPI DMA channel\n");
1007 return -ENODEV;
1008 }
1009 if (set_dma_callback(CH_SPI, (void *)dma_irq_handler, drv_data)
1010 < 0) {
1011 pr_debug("Unable to set dma callback\n");
1012 return -EPERM;
1013 }
1014 dma_disable_irq(CH_SPI);
1015 dma_requested = 1;
1016 }
1017
1018 /*
1019 * Notice: for blackfin, the speed_hz is the value of register
1020 * SPI_BAUD, not the real baudrate
1021 */
1022 chip->baud = hz_to_spi_baud(spi->max_speed_hz);
1023 spi_flg = ~(1 << (spi->chip_select));
1024 chip->flag = ((u16) spi_flg << 8) | (1 << (spi->chip_select));
1025 chip->chip_select_num = spi->chip_select;
1026
1027 switch (chip->bits_per_word) {
1028 case 8:
1029 chip->n_bytes = 1;
1030 chip->width = CFG_SPI_WORDSIZE8;
1031 chip->read = chip->cs_change_per_word ?
1032 u8_cs_chg_reader : u8_reader;
1033 chip->write = chip->cs_change_per_word ?
1034 u8_cs_chg_writer : u8_writer;
1035 chip->duplex = chip->cs_change_per_word ?
1036 u8_cs_chg_duplex : u8_duplex;
1037 break;
1038
1039 case 16:
1040 chip->n_bytes = 2;
1041 chip->width = CFG_SPI_WORDSIZE16;
1042 chip->read = chip->cs_change_per_word ?
1043 u16_cs_chg_reader : u16_reader;
1044 chip->write = chip->cs_change_per_word ?
1045 u16_cs_chg_writer : u16_writer;
1046 chip->duplex = chip->cs_change_per_word ?
1047 u16_cs_chg_duplex : u16_duplex;
1048 break;
1049
1050 default:
1051 dev_err(&spi->dev, "%d bits_per_word is not supported\n",
1052 chip->bits_per_word);
1053 kfree(chip);
1054 return -ENODEV;
1055 }
1056
1057 pr_debug("setup spi chip %s, width is %d, dma is %d,",
1058 spi->modalias, chip->width, chip->enable_dma);
1059 pr_debug("ctl_reg is 0x%x, flag_reg is 0x%x\n",
1060 chip->ctl_reg, chip->flag);
1061
1062 spi_set_ctldata(spi, chip);
1063
1064 return 0;
1065}
1066
1067/*
1068 * callback for spi framework.
1069 * clean driver specific data
1070 */
1071static void cleanup(const struct spi_device *spi)
1072{
1073 struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
1074
1075 kfree(chip);
1076}
1077
1078static inline int init_queue(struct driver_data *drv_data)
1079{
1080 INIT_LIST_HEAD(&drv_data->queue);
1081 spin_lock_init(&drv_data->lock);
1082
1083 drv_data->run = QUEUE_STOPPED;
1084 drv_data->busy = 0;
1085
1086 /* init transfer tasklet */
1087 tasklet_init(&drv_data->pump_transfers,
1088 pump_transfers, (unsigned long)drv_data);
1089
1090 /* init messages workqueue */
1091 INIT_WORK(&drv_data->pump_messages, pump_messages);
1092 drv_data->workqueue =
1093 create_singlethread_workqueue(drv_data->master->cdev.dev->bus_id);
1094 if (drv_data->workqueue == NULL)
1095 return -EBUSY;
1096
1097 return 0;
1098}
1099
1100static inline int start_queue(struct driver_data *drv_data)
1101{
1102 unsigned long flags;
1103
1104 spin_lock_irqsave(&drv_data->lock, flags);
1105
1106 if (drv_data->run == QUEUE_RUNNING || drv_data->busy) {
1107 spin_unlock_irqrestore(&drv_data->lock, flags);
1108 return -EBUSY;
1109 }
1110
1111 drv_data->run = QUEUE_RUNNING;
1112 drv_data->cur_msg = NULL;
1113 drv_data->cur_transfer = NULL;
1114 drv_data->cur_chip = NULL;
1115 spin_unlock_irqrestore(&drv_data->lock, flags);
1116
1117 queue_work(drv_data->workqueue, &drv_data->pump_messages);
1118
1119 return 0;
1120}
1121
1122static inline int stop_queue(struct driver_data *drv_data)
1123{
1124 unsigned long flags;
1125 unsigned limit = 500;
1126 int status = 0;
1127
1128 spin_lock_irqsave(&drv_data->lock, flags);
1129
1130 /*
1131 * This is a bit lame, but is optimized for the common execution path.
1132 * A wait_queue on the drv_data->busy could be used, but then the common
1133 * execution path (pump_messages) would be required to call wake_up or
1134 * friends on every SPI message. Do this instead
1135 */
1136 drv_data->run = QUEUE_STOPPED;
1137 while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) {
1138 spin_unlock_irqrestore(&drv_data->lock, flags);
1139 msleep(10);
1140 spin_lock_irqsave(&drv_data->lock, flags);
1141 }
1142
1143 if (!list_empty(&drv_data->queue) || drv_data->busy)
1144 status = -EBUSY;
1145
1146 spin_unlock_irqrestore(&drv_data->lock, flags);
1147
1148 return status;
1149}
1150
1151static inline int destroy_queue(struct driver_data *drv_data)
1152{
1153 int status;
1154
1155 status = stop_queue(drv_data);
1156 if (status != 0)
1157 return status;
1158
1159 destroy_workqueue(drv_data->workqueue);
1160
1161 return 0;
1162}
1163
1164static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1165{
1166 struct device *dev = &pdev->dev;
1167 struct bfin5xx_spi_master *platform_info;
1168 struct spi_master *master;
1169 struct driver_data *drv_data = 0;
1170 int status = 0;
1171
1172 platform_info = dev->platform_data;
1173
1174 /* Allocate master with space for drv_data */
1175 master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);
1176 if (!master) {
1177 dev_err(&pdev->dev, "can not alloc spi_master\n");
1178 return -ENOMEM;
1179 }
1180 drv_data = spi_master_get_devdata(master);
1181 drv_data->master = master;
1182 drv_data->master_info = platform_info;
1183 drv_data->pdev = pdev;
1184
1185 master->bus_num = pdev->id;
1186 master->num_chipselect = platform_info->num_chipselect;
1187 master->cleanup = cleanup;
1188 master->setup = setup;
1189 master->transfer = transfer;
1190
1191 /* Initial and start queue */
1192 status = init_queue(drv_data);
1193 if (status != 0) {
1194 dev_err(&pdev->dev, "problem initializing queue\n");
1195 goto out_error_queue_alloc;
1196 }
1197 status = start_queue(drv_data);
1198 if (status != 0) {
1199 dev_err(&pdev->dev, "problem starting queue\n");
1200 goto out_error_queue_alloc;
1201 }
1202
1203 /* Register with the SPI framework */
1204 platform_set_drvdata(pdev, drv_data);
1205 status = spi_register_master(master);
1206 if (status != 0) {
1207 dev_err(&pdev->dev, "problem registering spi master\n");
1208 goto out_error_queue_alloc;
1209 }
1210 pr_debug("controller probe successfully\n");
1211 return status;
1212
1213 out_error_queue_alloc:
1214 destroy_queue(drv_data);
1215 spi_master_put(master);
1216 return status;
1217}
1218
1219/* stop hardware and remove the driver */
1220static int __devexit bfin5xx_spi_remove(struct platform_device *pdev)
1221{
1222 struct driver_data *drv_data = platform_get_drvdata(pdev);
1223 int status = 0;
1224
1225 if (!drv_data)
1226 return 0;
1227
1228 /* Remove the queue */
1229 status = destroy_queue(drv_data);
1230 if (status != 0)
1231 return status;
1232
1233 /* Disable the SSP at the peripheral and SOC level */
1234 bfin_spi_disable(drv_data);
1235
1236 /* Release DMA */
1237 if (drv_data->master_info->enable_dma) {
1238 if (dma_channel_active(CH_SPI))
1239 free_dma(CH_SPI);
1240 }
1241
1242 /* Disconnect from the SPI framework */
1243 spi_unregister_master(drv_data->master);
1244
1245 /* Prevent double remove */
1246 platform_set_drvdata(pdev, NULL);
1247
1248 return 0;
1249}
1250
1251#ifdef CONFIG_PM
1252static int bfin5xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
1253{
1254 struct driver_data *drv_data = platform_get_drvdata(pdev);
1255 int status = 0;
1256
1257 status = stop_queue(drv_data);
1258 if (status != 0)
1259 return status;
1260
1261 /* stop hardware */
1262 bfin_spi_disable(drv_data);
1263
1264 return 0;
1265}
1266
1267static int bfin5xx_spi_resume(struct platform_device *pdev)
1268{
1269 struct driver_data *drv_data = platform_get_drvdata(pdev);
1270 int status = 0;
1271
1272 /* Enable the SPI interface */
1273 bfin_spi_enable(drv_data);
1274
1275 /* Start the queue running */
1276 status = start_queue(drv_data);
1277 if (status != 0) {
1278 dev_err(&pdev->dev, "problem starting queue (%d)\n", status);
1279 return status;
1280 }
1281
1282 return 0;
1283}
1284#else
1285#define bfin5xx_spi_suspend NULL
1286#define bfin5xx_spi_resume NULL
1287#endif /* CONFIG_PM */
1288
1289static struct platform_driver bfin5xx_spi_driver = {
1290 .driver = {
1291 .name = "bfin-spi-master",
1292 .bus = &platform_bus_type,
1293 .owner = THIS_MODULE,
1294 },
1295 .probe = bfin5xx_spi_probe,
1296 .remove = __devexit_p(bfin5xx_spi_remove),
1297 .suspend = bfin5xx_spi_suspend,
1298 .resume = bfin5xx_spi_resume,
1299};
1300
1301static int __init bfin5xx_spi_init(void)
1302{
1303 return platform_driver_register(&bfin5xx_spi_driver);
1304}
1305
1306module_init(bfin5xx_spi_init);
1307
1308static void __exit bfin5xx_spi_exit(void)
1309{
1310 platform_driver_unregister(&bfin5xx_spi_driver);
1311}
1312
1313module_exit(bfin5xx_spi_exit);
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index b10211c420ef..d5a710f6e445 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -342,8 +342,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
342 goto err_register; 342 goto err_register;
343 } 343 }
344 344
345 dev_dbg(hw->dev, "shutdown=%d\n", hw->bitbang.shutdown);
346
347 /* register all the devices associated */ 345 /* register all the devices associated */
348 346
349 bi = &hw->pdata->board_info[0]; 347 bi = &hw->pdata->board_info[0];
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 2c043a1ea156..84392e835d5f 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -1483,7 +1483,7 @@ static void udc_disable(struct pxa2xx_udc *dev)
1483 1483
1484#ifdef CONFIG_ARCH_PXA 1484#ifdef CONFIG_ARCH_PXA
1485 /* Disable clock for USB device */ 1485 /* Disable clock for USB device */
1486 pxa_set_cken(CKEN11_USB, 0); 1486 pxa_set_cken(CKEN_USB, 0);
1487#endif 1487#endif
1488 1488
1489 ep0_idle (dev); 1489 ep0_idle (dev);
@@ -1529,7 +1529,7 @@ static void udc_enable (struct pxa2xx_udc *dev)
1529 1529
1530#ifdef CONFIG_ARCH_PXA 1530#ifdef CONFIG_ARCH_PXA
1531 /* Enable clock for USB device */ 1531 /* Enable clock for USB device */
1532 pxa_set_cken(CKEN11_USB, 1); 1532 pxa_set_cken(CKEN_USB, 1);
1533 udelay(5); 1533 udelay(5);
1534#endif 1534#endif
1535 1535
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 29dcd27b55de..37b83ba09969 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -73,13 +73,6 @@ static const struct hc_driver ps3_ehci_hc_driver = {
73#endif 73#endif
74}; 74};
75 75
76#if !defined(DEBUG)
77#undef dev_dbg
78static inline int __attribute__ ((format (printf, 2, 3))) dev_dbg(
79 const struct device *_dev, const char *fmt, ...) {return 0;}
80#endif
81
82
83static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev) 76static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
84{ 77{
85 int result; 78 int result;
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 93a6eb0de2d1..d7cf07288b0b 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -75,14 +75,6 @@ static const struct hc_driver ps3_ohci_hc_driver = {
75#endif 75#endif
76}; 76};
77 77
78/* redefine dev_dbg to do a syntax check */
79
80#if !defined(DEBUG)
81#undef dev_dbg
82static inline int __attribute__ ((format (printf, 2, 3))) dev_dbg(
83 const struct device *_dev, const char *fmt, ...) {return 0;}
84#endif
85
86static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev) 78static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
87{ 79{
88 int result; 80 int result;
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index f1563dc319d3..23d2fe5a62f4 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -80,7 +80,7 @@ static int pxa27x_start_hc(struct device *dev)
80 80
81 inf = dev->platform_data; 81 inf = dev->platform_data;
82 82
83 pxa_set_cken(CKEN10_USBHOST, 1); 83 pxa_set_cken(CKEN_USBHOST, 1);
84 84
85 UHCHR |= UHCHR_FHR; 85 UHCHR |= UHCHR_FHR;
86 udelay(11); 86 udelay(11);
@@ -123,7 +123,7 @@ static void pxa27x_stop_hc(struct device *dev)
123 UHCCOMS |= 1; 123 UHCCOMS |= 1;
124 udelay(10); 124 udelay(10);
125 125
126 pxa_set_cken(CKEN10_USBHOST, 0); 126 pxa_set_cken(CKEN_USBHOST, 0);
127} 127}
128 128
129 129
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
index 9bf420eef77f..284a0734e0cd 100644
--- a/drivers/usb/input/Makefile
+++ b/drivers/usb/input/Makefile
@@ -10,9 +10,6 @@ obj-$(CONFIG_USB_ATI_REMOTE) += ati_remote.o
10obj-$(CONFIG_USB_ATI_REMOTE2) += ati_remote2.o 10obj-$(CONFIG_USB_ATI_REMOTE2) += ati_remote2.o
11obj-$(CONFIG_USB_KBTAB) += kbtab.o 11obj-$(CONFIG_USB_KBTAB) += kbtab.o
12obj-$(CONFIG_USB_KEYSPAN_REMOTE) += keyspan_remote.o 12obj-$(CONFIG_USB_KEYSPAN_REMOTE) += keyspan_remote.o
13obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o
14obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o
15obj-$(CONFIG_USB_EGALAX) += touchkitusb.o
16obj-$(CONFIG_USB_TOUCHSCREEN) += usbtouchscreen.o 13obj-$(CONFIG_USB_TOUCHSCREEN) += usbtouchscreen.o
17obj-$(CONFIG_USB_POWERMATE) += powermate.o 14obj-$(CONFIG_USB_POWERMATE) += powermate.o
18obj-$(CONFIG_USB_WACOM) += wacom.o 15obj-$(CONFIG_USB_WACOM) += wacom.o
@@ -20,7 +17,7 @@ obj-$(CONFIG_USB_ACECAD) += acecad.o
20obj-$(CONFIG_USB_YEALINK) += yealink.o 17obj-$(CONFIG_USB_YEALINK) += yealink.o
21obj-$(CONFIG_USB_XPAD) += xpad.o 18obj-$(CONFIG_USB_XPAD) += xpad.o
22obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o 19obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o
23obj-$(CONFIG_USB_GTCO) += gtco.o 20obj-$(CONFIG_USB_GTCO) += gtco.o
24 21
25ifeq ($(CONFIG_USB_DEBUG),y) 22ifeq ($(CONFIG_USB_DEBUG),y)
26EXTRA_CFLAGS += -DDEBUG 23EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index 909138e5aa04..be8e9243c062 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -111,7 +111,7 @@ resubmit:
111 111
112static int usb_acecad_open(struct input_dev *dev) 112static int usb_acecad_open(struct input_dev *dev)
113{ 113{
114 struct usb_acecad *acecad = dev->private; 114 struct usb_acecad *acecad = input_get_drvdata(dev);
115 115
116 acecad->irq->dev = acecad->usbdev; 116 acecad->irq->dev = acecad->usbdev;
117 if (usb_submit_urb(acecad->irq, GFP_KERNEL)) 117 if (usb_submit_urb(acecad->irq, GFP_KERNEL))
@@ -122,7 +122,7 @@ static int usb_acecad_open(struct input_dev *dev)
122 122
123static void usb_acecad_close(struct input_dev *dev) 123static void usb_acecad_close(struct input_dev *dev)
124{ 124{
125 struct usb_acecad *acecad = dev->private; 125 struct usb_acecad *acecad = input_get_drvdata(dev);
126 126
127 usb_kill_urb(acecad->irq); 127 usb_kill_urb(acecad->irq);
128} 128}
@@ -135,6 +135,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
135 struct usb_acecad *acecad; 135 struct usb_acecad *acecad;
136 struct input_dev *input_dev; 136 struct input_dev *input_dev;
137 int pipe, maxp; 137 int pipe, maxp;
138 int err = -ENOMEM;
138 139
139 if (interface->desc.bNumEndpoints != 1) 140 if (interface->desc.bNumEndpoints != 1)
140 return -ENODEV; 141 return -ENODEV;
@@ -149,16 +150,22 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
149 150
150 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL); 151 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL);
151 input_dev = input_allocate_device(); 152 input_dev = input_allocate_device();
152 if (!acecad || !input_dev) 153 if (!acecad || !input_dev) {
154 err = -ENOMEM;
153 goto fail1; 155 goto fail1;
156 }
154 157
155 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); 158 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma);
156 if (!acecad->data) 159 if (!acecad->data) {
160 err= -ENOMEM;
157 goto fail1; 161 goto fail1;
162 }
158 163
159 acecad->irq = usb_alloc_urb(0, GFP_KERNEL); 164 acecad->irq = usb_alloc_urb(0, GFP_KERNEL);
160 if (!acecad->irq) 165 if (!acecad->irq) {
166 err = -ENOMEM;
161 goto fail2; 167 goto fail2;
168 }
162 169
163 acecad->usbdev = dev; 170 acecad->usbdev = dev;
164 acecad->input = input_dev; 171 acecad->input = input_dev;
@@ -178,8 +185,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
178 input_dev->name = acecad->name; 185 input_dev->name = acecad->name;
179 input_dev->phys = acecad->phys; 186 input_dev->phys = acecad->phys;
180 usb_to_input_id(dev, &input_dev->id); 187 usb_to_input_id(dev, &input_dev->id);
181 input_dev->cdev.dev = &intf->dev; 188 input_dev->dev.parent = &intf->dev;
182 input_dev->private = acecad; 189
190 input_set_drvdata(input_dev, acecad);
183 191
184 input_dev->open = usb_acecad_open; 192 input_dev->open = usb_acecad_open;
185 input_dev->close = usb_acecad_close; 193 input_dev->close = usb_acecad_close;
@@ -221,7 +229,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
221 acecad->irq->transfer_dma = acecad->data_dma; 229 acecad->irq->transfer_dma = acecad->data_dma;
222 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 230 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
223 231
224 input_register_device(acecad->input); 232 err = input_register_device(acecad->input);
233 if (err)
234 goto fail2;
225 235
226 usb_set_intfdata(intf, acecad); 236 usb_set_intfdata(intf, acecad);
227 237
@@ -230,7 +240,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
230 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma); 240 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma);
231 fail1: input_free_device(input_dev); 241 fail1: input_free_device(input_dev);
232 kfree(acecad); 242 kfree(acecad);
233 return -ENOMEM; 243 return err;
234} 244}
235 245
236static void usb_acecad_disconnect(struct usb_interface *intf) 246static void usb_acecad_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index f857935e615c..cc0a498763d8 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -798,7 +798,7 @@ MODULE_DEVICE_TABLE(usb, aiptek_ids);
798 */ 798 */
799static int aiptek_open(struct input_dev *inputdev) 799static int aiptek_open(struct input_dev *inputdev)
800{ 800{
801 struct aiptek *aiptek = inputdev->private; 801 struct aiptek *aiptek = input_get_drvdata(inputdev);
802 802
803 aiptek->urb->dev = aiptek->usbdev; 803 aiptek->urb->dev = aiptek->usbdev;
804 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) 804 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
@@ -812,7 +812,7 @@ static int aiptek_open(struct input_dev *inputdev)
812 */ 812 */
813static void aiptek_close(struct input_dev *inputdev) 813static void aiptek_close(struct input_dev *inputdev)
814{ 814{
815 struct aiptek *aiptek = inputdev->private; 815 struct aiptek *aiptek = input_get_drvdata(inputdev);
816 816
817 usb_kill_urb(aiptek->urb); 817 usb_kill_urb(aiptek->urb);
818} 818}
@@ -1972,6 +1972,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1972 AIPTEK_PROGRAMMABLE_DELAY_200, 1972 AIPTEK_PROGRAMMABLE_DELAY_200,
1973 AIPTEK_PROGRAMMABLE_DELAY_300 1973 AIPTEK_PROGRAMMABLE_DELAY_300
1974 }; 1974 };
1975 int err = -ENOMEM;
1975 1976
1976 /* programmableDelay is where the command-line specified 1977 /* programmableDelay is where the command-line specified
1977 * delay is kept. We make it the first element of speeds[], 1978 * delay is kept. We make it the first element of speeds[],
@@ -2043,8 +2044,10 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2043 inputdev->name = "Aiptek"; 2044 inputdev->name = "Aiptek";
2044 inputdev->phys = aiptek->features.usbPath; 2045 inputdev->phys = aiptek->features.usbPath;
2045 usb_to_input_id(usbdev, &inputdev->id); 2046 usb_to_input_id(usbdev, &inputdev->id);
2046 inputdev->cdev.dev = &intf->dev; 2047 inputdev->dev.parent = &intf->dev;
2047 inputdev->private = aiptek; 2048
2049 input_set_drvdata(inputdev, aiptek);
2050
2048 inputdev->open = aiptek_open; 2051 inputdev->open = aiptek_open;
2049 inputdev->close = aiptek_close; 2052 inputdev->close = aiptek_close;
2050 2053
@@ -2133,7 +2136,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2133 2136
2134 /* Register the tablet as an Input Device 2137 /* Register the tablet as an Input Device
2135 */ 2138 */
2136 input_register_device(aiptek->inputdev); 2139 err = input_register_device(aiptek->inputdev);
2140 if (err)
2141 goto fail2;
2137 2142
2138 /* We now will look for the evdev device which is mapped to 2143 /* We now will look for the evdev device which is mapped to
2139 * the tablet. The partial name is kept in the link list of 2144 * the tablet. The partial name is kept in the link list of
@@ -2165,23 +2170,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2165 2170
2166 return 0; 2171 return 0;
2167 2172
2168fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, 2173 fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data,
2169 aiptek->data_dma); 2174 aiptek->data_dma);
2170fail1: input_free_device(inputdev); 2175 fail1: input_free_device(inputdev);
2171 kfree(aiptek); 2176 kfree(aiptek);
2172 return -ENOMEM; 2177 return err;
2173} 2178}
2174 2179
2175/* Forward declaration */
2176static void aiptek_disconnect(struct usb_interface *intf);
2177
2178static struct usb_driver aiptek_driver = {
2179 .name = "aiptek",
2180 .probe = aiptek_probe,
2181 .disconnect = aiptek_disconnect,
2182 .id_table = aiptek_ids,
2183};
2184
2185/*********************************************************************** 2180/***********************************************************************
2186 * Deal with tablet disconnecting from the system. 2181 * Deal with tablet disconnecting from the system.
2187 */ 2182 */
@@ -2206,6 +2201,13 @@ static void aiptek_disconnect(struct usb_interface *intf)
2206 } 2201 }
2207} 2202}
2208 2203
2204static struct usb_driver aiptek_driver = {
2205 .name = "aiptek",
2206 .probe = aiptek_probe,
2207 .disconnect = aiptek_disconnect,
2208 .id_table = aiptek_ids,
2209};
2210
2209static int __init aiptek_init(void) 2211static int __init aiptek_init(void)
2210{ 2212{
2211 int result = usb_register(&aiptek_driver); 2213 int result = usb_register(&aiptek_driver);
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c
index c77291d3d063..e3215267db11 100644
--- a/drivers/usb/input/appletouch.c
+++ b/drivers/usb/input/appletouch.c
@@ -466,7 +466,7 @@ exit:
466 466
467static int atp_open(struct input_dev *input) 467static int atp_open(struct input_dev *input)
468{ 468{
469 struct atp *dev = input->private; 469 struct atp *dev = input_get_drvdata(input);
470 470
471 if (usb_submit_urb(dev->urb, GFP_ATOMIC)) 471 if (usb_submit_urb(dev->urb, GFP_ATOMIC))
472 return -EIO; 472 return -EIO;
@@ -477,7 +477,7 @@ static int atp_open(struct input_dev *input)
477 477
478static void atp_close(struct input_dev *input) 478static void atp_close(struct input_dev *input)
479{ 479{
480 struct atp *dev = input->private; 480 struct atp *dev = input_get_drvdata(input);
481 481
482 usb_kill_urb(dev->urb); 482 usb_kill_urb(dev->urb);
483 dev->open = 0; 483 dev->open = 0;
@@ -491,8 +491,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
491 struct usb_host_interface *iface_desc; 491 struct usb_host_interface *iface_desc;
492 struct usb_endpoint_descriptor *endpoint; 492 struct usb_endpoint_descriptor *endpoint;
493 int int_in_endpointAddr = 0; 493 int int_in_endpointAddr = 0;
494 int i, retval = -ENOMEM; 494 int i, error = -ENOMEM;
495
496 495
497 /* set up the endpoint information */ 496 /* set up the endpoint information */
498 /* use only the first interrupt-in endpoint */ 497 /* use only the first interrupt-in endpoint */
@@ -567,17 +566,13 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
567 } 566 }
568 567
569 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 568 dev->urb = usb_alloc_urb(0, GFP_KERNEL);
570 if (!dev->urb) { 569 if (!dev->urb)
571 retval = -ENOMEM;
572 goto err_free_devs; 570 goto err_free_devs;
573 }
574 571
575 dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, 572 dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL,
576 &dev->urb->transfer_dma); 573 &dev->urb->transfer_dma);
577 if (!dev->data) { 574 if (!dev->data)
578 retval = -ENOMEM;
579 goto err_free_urb; 575 goto err_free_urb;
580 }
581 576
582 usb_fill_int_urb(dev->urb, udev, 577 usb_fill_int_urb(dev->urb, udev,
583 usb_rcvintpipe(udev, int_in_endpointAddr), 578 usb_rcvintpipe(udev, int_in_endpointAddr),
@@ -589,9 +584,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
589 input_dev->name = "appletouch"; 584 input_dev->name = "appletouch";
590 input_dev->phys = dev->phys; 585 input_dev->phys = dev->phys;
591 usb_to_input_id(dev->udev, &input_dev->id); 586 usb_to_input_id(dev->udev, &input_dev->id);
592 input_dev->cdev.dev = &iface->dev; 587 input_dev->dev.parent = &iface->dev;
588
589 input_set_drvdata(input_dev, dev);
593 590
594 input_dev->private = dev;
595 input_dev->open = atp_open; 591 input_dev->open = atp_open;
596 input_dev->close = atp_close; 592 input_dev->close = atp_close;
597 593
@@ -633,20 +629,25 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
633 set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 629 set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
634 set_bit(BTN_LEFT, input_dev->keybit); 630 set_bit(BTN_LEFT, input_dev->keybit);
635 631
636 input_register_device(dev->input); 632 error = input_register_device(dev->input);
633 if (error)
634 goto err_free_buffer;
637 635
638 /* save our data pointer in this interface device */ 636 /* save our data pointer in this interface device */
639 usb_set_intfdata(iface, dev); 637 usb_set_intfdata(iface, dev);
640 638
641 return 0; 639 return 0;
642 640
641 err_free_buffer:
642 usb_buffer_free(dev->udev, dev->datalen,
643 dev->data, dev->urb->transfer_dma);
643 err_free_urb: 644 err_free_urb:
644 usb_free_urb(dev->urb); 645 usb_free_urb(dev->urb);
645 err_free_devs: 646 err_free_devs:
646 usb_set_intfdata(iface, NULL); 647 usb_set_intfdata(iface, NULL);
647 kfree(dev); 648 kfree(dev);
648 input_free_device(input_dev); 649 input_free_device(input_dev);
649 return retval; 650 return error;
650} 651}
651 652
652static void atp_disconnect(struct usb_interface *iface) 653static void atp_disconnect(struct usb_interface *iface)
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index b724e36f7b92..471aab206443 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -120,6 +120,7 @@
120 * behaviour. 120 * behaviour.
121 */ 121 */
122#define FILTER_TIME 60 /* msec */ 122#define FILTER_TIME 60 /* msec */
123#define REPEAT_DELAY 500 /* msec */
123 124
124static unsigned long channel_mask; 125static unsigned long channel_mask;
125module_param(channel_mask, ulong, 0644); 126module_param(channel_mask, ulong, 0644);
@@ -133,6 +134,10 @@ static int repeat_filter = FILTER_TIME;
133module_param(repeat_filter, int, 0644); 134module_param(repeat_filter, int, 0644);
134MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec"); 135MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec");
135 136
137static int repeat_delay = REPEAT_DELAY;
138module_param(repeat_delay, int, 0644);
139MODULE_PARM_DESC(repeat_delay, "Delay before sending repeats, default = 500 msec");
140
136#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) 141#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
137#undef err 142#undef err
138#define err(format, arg...) printk(KERN_ERR format , ## arg) 143#define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -174,6 +179,8 @@ struct ati_remote {
174 unsigned char old_data[2]; /* Detect duplicate events */ 179 unsigned char old_data[2]; /* Detect duplicate events */
175 unsigned long old_jiffies; 180 unsigned long old_jiffies;
176 unsigned long acc_jiffies; /* handle acceleration */ 181 unsigned long acc_jiffies; /* handle acceleration */
182 unsigned long first_jiffies;
183
177 unsigned int repeat_count; 184 unsigned int repeat_count;
178 185
179 char name[NAME_BUFSIZE]; 186 char name[NAME_BUFSIZE];
@@ -318,7 +325,7 @@ static void ati_remote_dump(unsigned char *data, unsigned int len)
318 */ 325 */
319static int ati_remote_open(struct input_dev *inputdev) 326static int ati_remote_open(struct input_dev *inputdev)
320{ 327{
321 struct ati_remote *ati_remote = inputdev->private; 328 struct ati_remote *ati_remote = input_get_drvdata(inputdev);
322 329
323 /* On first open, submit the read urb which was set up previously. */ 330 /* On first open, submit the read urb which was set up previously. */
324 ati_remote->irq_urb->dev = ati_remote->udev; 331 ati_remote->irq_urb->dev = ati_remote->udev;
@@ -336,7 +343,7 @@ static int ati_remote_open(struct input_dev *inputdev)
336 */ 343 */
337static void ati_remote_close(struct input_dev *inputdev) 344static void ati_remote_close(struct input_dev *inputdev)
338{ 345{
339 struct ati_remote *ati_remote = inputdev->private; 346 struct ati_remote *ati_remote = input_get_drvdata(inputdev);
340 347
341 usb_kill_urb(ati_remote->irq_urb); 348 usb_kill_urb(ati_remote->irq_urb);
342} 349}
@@ -501,21 +508,31 @@ static void ati_remote_input_report(struct urb *urb)
501 } 508 }
502 509
503 if (ati_remote_tbl[index].kind == KIND_FILTERED) { 510 if (ati_remote_tbl[index].kind == KIND_FILTERED) {
511 unsigned long now = jiffies;
512
504 /* Filter duplicate events which happen "too close" together. */ 513 /* Filter duplicate events which happen "too close" together. */
505 if (ati_remote->old_data[0] == data[1] && 514 if (ati_remote->old_data[0] == data[1] &&
506 ati_remote->old_data[1] == data[2] && 515 ati_remote->old_data[1] == data[2] &&
507 time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) { 516 time_before(now, ati_remote->old_jiffies +
517 msecs_to_jiffies(repeat_filter))) {
508 ati_remote->repeat_count++; 518 ati_remote->repeat_count++;
509 } else { 519 } else {
510 ati_remote->repeat_count = 0; 520 ati_remote->repeat_count = 0;
521 ati_remote->first_jiffies = now;
511 } 522 }
512 523
513 ati_remote->old_data[0] = data[1]; 524 ati_remote->old_data[0] = data[1];
514 ati_remote->old_data[1] = data[2]; 525 ati_remote->old_data[1] = data[2];
515 ati_remote->old_jiffies = jiffies; 526 ati_remote->old_jiffies = now;
516 527
528 /* Ensure we skip at least the 4 first duplicate events (generated
529 * by a single keypress), and continue skipping until repeat_delay
530 * msecs have passed
531 */
517 if (ati_remote->repeat_count > 0 && 532 if (ati_remote->repeat_count > 0 &&
518 ati_remote->repeat_count < 5) 533 (ati_remote->repeat_count < 5 ||
534 time_before(now, ati_remote->first_jiffies +
535 msecs_to_jiffies(repeat_delay))))
519 return; 536 return;
520 537
521 538
@@ -653,7 +670,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
653 if (ati_remote_tbl[i].type == EV_KEY) 670 if (ati_remote_tbl[i].type == EV_KEY)
654 set_bit(ati_remote_tbl[i].code, idev->keybit); 671 set_bit(ati_remote_tbl[i].code, idev->keybit);
655 672
656 idev->private = ati_remote; 673 input_set_drvdata(idev, ati_remote);
674
657 idev->open = ati_remote_open; 675 idev->open = ati_remote_open;
658 idev->close = ati_remote_close; 676 idev->close = ati_remote_close;
659 677
@@ -661,7 +679,7 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
661 idev->phys = ati_remote->phys; 679 idev->phys = ati_remote->phys;
662 680
663 usb_to_input_id(ati_remote->udev, &idev->id); 681 usb_to_input_id(ati_remote->udev, &idev->id);
664 idev->cdev.dev = &ati_remote->udev->dev; 682 idev->dev.parent = &ati_remote->udev->dev;
665} 683}
666 684
667static int ati_remote_initialize(struct ati_remote *ati_remote) 685static int ati_remote_initialize(struct ati_remote *ati_remote)
@@ -772,15 +790,17 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
772 goto fail3; 790 goto fail3;
773 791
774 /* Set up and register input device */ 792 /* Set up and register input device */
775 input_register_device(ati_remote->idev); 793 err = input_register_device(ati_remote->idev);
794 if (err)
795 goto fail3;
776 796
777 usb_set_intfdata(interface, ati_remote); 797 usb_set_intfdata(interface, ati_remote);
778 return 0; 798 return 0;
779 799
780fail3: usb_kill_urb(ati_remote->irq_urb); 800 fail3: usb_kill_urb(ati_remote->irq_urb);
781 usb_kill_urb(ati_remote->out_urb); 801 usb_kill_urb(ati_remote->out_urb);
782fail2: ati_remote_free_buffers(ati_remote); 802 fail2: ati_remote_free_buffers(ati_remote);
783fail1: input_free_device(input_dev); 803 fail1: input_free_device(input_dev);
784 kfree(ati_remote); 804 kfree(ati_remote);
785 return err; 805 return err;
786} 806}
diff --git a/drivers/usb/input/ati_remote2.c b/drivers/usb/input/ati_remote2.c
index 6459be90599c..a9032aa3465f 100644
--- a/drivers/usb/input/ati_remote2.c
+++ b/drivers/usb/input/ati_remote2.c
@@ -131,7 +131,7 @@ static struct usb_driver ati_remote2_driver = {
131 131
132static int ati_remote2_open(struct input_dev *idev) 132static int ati_remote2_open(struct input_dev *idev)
133{ 133{
134 struct ati_remote2 *ar2 = idev->private; 134 struct ati_remote2 *ar2 = input_get_drvdata(idev);
135 int r; 135 int r;
136 136
137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL); 137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
@@ -153,7 +153,7 @@ static int ati_remote2_open(struct input_dev *idev)
153 153
154static void ati_remote2_close(struct input_dev *idev) 154static void ati_remote2_close(struct input_dev *idev)
155{ 155{
156 struct ati_remote2 *ar2 = idev->private; 156 struct ati_remote2 *ar2 = input_get_drvdata(idev);
157 157
158 usb_kill_urb(ar2->urb[0]); 158 usb_kill_urb(ar2->urb[0]);
159 usb_kill_urb(ar2->urb[1]); 159 usb_kill_urb(ar2->urb[1]);
@@ -337,14 +337,14 @@ static void ati_remote2_complete_key(struct urb *urb)
337static int ati_remote2_input_init(struct ati_remote2 *ar2) 337static int ati_remote2_input_init(struct ati_remote2 *ar2)
338{ 338{
339 struct input_dev *idev; 339 struct input_dev *idev;
340 int i; 340 int i, retval;
341 341
342 idev = input_allocate_device(); 342 idev = input_allocate_device();
343 if (!idev) 343 if (!idev)
344 return -ENOMEM; 344 return -ENOMEM;
345 345
346 ar2->idev = idev; 346 ar2->idev = idev;
347 idev->private = ar2; 347 input_set_drvdata(idev, ar2);
348 348
349 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL); 349 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
350 idev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 350 idev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
@@ -362,13 +362,13 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
362 idev->phys = ar2->phys; 362 idev->phys = ar2->phys;
363 363
364 usb_to_input_id(ar2->udev, &idev->id); 364 usb_to_input_id(ar2->udev, &idev->id);
365 idev->cdev.dev = &ar2->udev->dev; 365 idev->dev.parent = &ar2->udev->dev;
366 366
367 i = input_register_device(idev); 367 retval = input_register_device(idev);
368 if (i) 368 if (retval)
369 input_free_device(idev); 369 input_free_device(idev);
370 370
371 return i; 371 return retval;
372} 372}
373 373
374static int ati_remote2_urb_init(struct ati_remote2 *ar2) 374static int ati_remote2_urb_init(struct ati_remote2 *ar2)
diff --git a/drivers/usb/input/gtco.c b/drivers/usb/input/gtco.c
index ae756e0afc99..b2ca10f2fe0e 100644
--- a/drivers/usb/input/gtco.c
+++ b/drivers/usb/input/gtco.c
@@ -187,7 +187,6 @@ struct hid_descriptor
187 187
188 188
189/* 189/*
190 *
191 * This is an abbreviated parser for the HID Report Descriptor. We 190 * This is an abbreviated parser for the HID Report Descriptor. We
192 * know what devices we are talking to, so this is by no means meant 191 * know what devices we are talking to, so this is by no means meant
193 * to be generic. We can make some safe assumptions: 192 * to be generic. We can make some safe assumptions:
@@ -204,7 +203,7 @@ struct hid_descriptor
204static void parse_hid_report_descriptor(struct gtco *device, char * report, 203static void parse_hid_report_descriptor(struct gtco *device, char * report,
205 int length) 204 int length)
206{ 205{
207 int x,i=0; 206 int x, i = 0;
208 207
209 /* Tag primitive vars */ 208 /* Tag primitive vars */
210 __u8 prefix; 209 __u8 prefix;
@@ -215,7 +214,6 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
215 __u16 data16 = 0; 214 __u16 data16 = 0;
216 __u32 data32 = 0; 215 __u32 data32 = 0;
217 216
218
219 /* For parsing logic */ 217 /* For parsing logic */
220 int inputnum = 0; 218 int inputnum = 0;
221 __u32 usage = 0; 219 __u32 usage = 0;
@@ -225,46 +223,46 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
225 __u32 oldval[TAG_GLOB_MAX]; 223 __u32 oldval[TAG_GLOB_MAX];
226 224
227 /* Debug stuff */ 225 /* Debug stuff */
228 char maintype='x'; 226 char maintype = 'x';
229 char globtype[12]; 227 char globtype[12];
230 int indent=0; 228 int indent = 0;
231 char indentstr[10]=""; 229 char indentstr[10] = "";
232
233 230
234 231
235 dbg("======>>>>>>PARSE<<<<<<======"); 232 dbg("======>>>>>>PARSE<<<<<<======");
236 233
237 /* Walk this report and pull out the info we need */ 234 /* Walk this report and pull out the info we need */
238 while (i<length){ 235 while (i < length) {
239 prefix=report[i]; 236 prefix = report[i];
240 237
241 /* Skip over prefix */ 238 /* Skip over prefix */
242 i++; 239 i++;
243 240
244 /* Determine data size and save the data in the proper variable */ 241 /* Determine data size and save the data in the proper variable */
245 size = PREF_SIZE(prefix); 242 size = PREF_SIZE(prefix);
246 switch(size){ 243 switch (size) {
247 case 1: 244 case 1:
248 data = report[i]; 245 data = report[i];
249 break; 246 break;
250 case 2: 247 case 2:
251 data16 = le16_to_cpu(get_unaligned((__le16*)(&(report[i])))); 248 data16 = le16_to_cpu(get_unaligned((__le16 *)&report[i]));
252 break; 249 break;
253 case 3: 250 case 3:
254 size = 4; 251 size = 4;
255 data32 = le32_to_cpu(get_unaligned((__le32*)(&(report[i])))); 252 data32 = le32_to_cpu(get_unaligned((__le32 *)&report[i]));
253 break;
256 } 254 }
257 255
258 /* Skip size of data */ 256 /* Skip size of data */
259 i+=size; 257 i += size;
260 258
261 /* What we do depends on the tag type */ 259 /* What we do depends on the tag type */
262 tag = PREF_TAG(prefix); 260 tag = PREF_TAG(prefix);
263 type = PREF_TYPE(prefix); 261 type = PREF_TYPE(prefix);
264 switch(type){ 262 switch (type) {
265 case TYPE_MAIN: 263 case TYPE_MAIN:
266 strcpy(globtype,""); 264 strcpy(globtype, "");
267 switch(tag){ 265 switch (tag) {
268 266
269 case TAG_MAIN_INPUT: 267 case TAG_MAIN_INPUT:
270 /* 268 /*
@@ -274,19 +272,17 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
274 * min/max values 272 * min/max values
275 */ 273 */
276 274
277 maintype='I'; 275 maintype = 'I';
278 if (data==2){ 276 if (data == 2)
279 strcpy(globtype,"Variable"); 277 strcpy(globtype, "Variable");
280 } 278 else if (data == 3)
281 if (data==3){ 279 strcpy(globtype, "Var|Const");
282 strcpy(globtype,"Var|Const");
283 }
284 280
285 dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", 281 dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits",
286 globalval[TAG_GLOB_REPORT_ID],inputnum, 282 globalval[TAG_GLOB_REPORT_ID], inputnum,
287 globalval[TAG_GLOB_LOG_MAX],globalval[TAG_GLOB_LOG_MAX], 283 globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],
288 globalval[TAG_GLOB_LOG_MIN],globalval[TAG_GLOB_LOG_MIN], 284 globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],
289 (globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT])); 285 globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);
290 286
291 287
292 /* 288 /*
@@ -295,43 +291,43 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
295 that, we look for everything else by 291 that, we look for everything else by
296 local usage value 292 local usage value
297 */ 293 */
298 switch (inputnum){ 294 switch (inputnum) {
299 case 0: /* X coord */ 295 case 0: /* X coord */
300 dbg("GER: X Usage: 0x%x",usage); 296 dbg("GER: X Usage: 0x%x", usage);
301 if (device->max_X == 0){ 297 if (device->max_X == 0) {
302 device->max_X = globalval[TAG_GLOB_LOG_MAX]; 298 device->max_X = globalval[TAG_GLOB_LOG_MAX];
303 device->min_X = globalval[TAG_GLOB_LOG_MIN]; 299 device->min_X = globalval[TAG_GLOB_LOG_MIN];
304 } 300 }
305
306 break; 301 break;
302
307 case 1: /* Y coord */ 303 case 1: /* Y coord */
308 dbg("GER: Y Usage: 0x%x",usage); 304 dbg("GER: Y Usage: 0x%x", usage);
309 if (device->max_Y == 0){ 305 if (device->max_Y == 0) {
310 device->max_Y = globalval[TAG_GLOB_LOG_MAX]; 306 device->max_Y = globalval[TAG_GLOB_LOG_MAX];
311 device->min_Y = globalval[TAG_GLOB_LOG_MIN]; 307 device->min_Y = globalval[TAG_GLOB_LOG_MIN];
312 } 308 }
313 break; 309 break;
310
314 default: 311 default:
315 /* Tilt X */ 312 /* Tilt X */
316 if (usage == DIGITIZER_USAGE_TILT_X){ 313 if (usage == DIGITIZER_USAGE_TILT_X) {
317 if (device->maxtilt_X == 0){ 314 if (device->maxtilt_X == 0) {
318 device->maxtilt_X = globalval[TAG_GLOB_LOG_MAX]; 315 device->maxtilt_X = globalval[TAG_GLOB_LOG_MAX];
319 device->mintilt_X = globalval[TAG_GLOB_LOG_MIN]; 316 device->mintilt_X = globalval[TAG_GLOB_LOG_MIN];
320 } 317 }
321 } 318 }
322 319
323 /* Tilt Y */ 320 /* Tilt Y */
324 if (usage == DIGITIZER_USAGE_TILT_Y){ 321 if (usage == DIGITIZER_USAGE_TILT_Y) {
325 if (device->maxtilt_Y == 0){ 322 if (device->maxtilt_Y == 0) {
326 device->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX]; 323 device->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX];
327 device->mintilt_Y = globalval[TAG_GLOB_LOG_MIN]; 324 device->mintilt_Y = globalval[TAG_GLOB_LOG_MIN];
328 } 325 }
329 } 326 }
330 327
331
332 /* Pressure */ 328 /* Pressure */
333 if (usage == DIGITIZER_USAGE_TIP_PRESSURE){ 329 if (usage == DIGITIZER_USAGE_TIP_PRESSURE) {
334 if (device->maxpressure == 0){ 330 if (device->maxpressure == 0) {
335 device->maxpressure = globalval[TAG_GLOB_LOG_MAX]; 331 device->maxpressure = globalval[TAG_GLOB_LOG_MAX];
336 device->minpressure = globalval[TAG_GLOB_LOG_MIN]; 332 device->minpressure = globalval[TAG_GLOB_LOG_MIN];
337 } 333 }
@@ -341,214 +337,226 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
341 } 337 }
342 338
343 inputnum++; 339 inputnum++;
344
345
346 break; 340 break;
341
347 case TAG_MAIN_OUTPUT: 342 case TAG_MAIN_OUTPUT:
348 maintype='O'; 343 maintype = 'O';
349 break; 344 break;
345
350 case TAG_MAIN_FEATURE: 346 case TAG_MAIN_FEATURE:
351 maintype='F'; 347 maintype = 'F';
352 break; 348 break;
349
353 case TAG_MAIN_COL_START: 350 case TAG_MAIN_COL_START:
354 maintype='S'; 351 maintype = 'S';
355 352
356 if (data==0){ 353 if (data == 0) {
357 dbg("======>>>>>> Physical"); 354 dbg("======>>>>>> Physical");
358 strcpy(globtype,"Physical"); 355 strcpy(globtype, "Physical");
359 }else{ 356 } else
360 dbg("======>>>>>>"); 357 dbg("======>>>>>>");
361 }
362 358
363 /* Indent the debug output */ 359 /* Indent the debug output */
364 indent++; 360 indent++;
365 for (x=0;x<indent;x++){ 361 for (x = 0; x < indent; x++)
366 indentstr[x]='-'; 362 indentstr[x] = '-';
367 } 363 indentstr[x] = 0;
368 indentstr[x]=0;
369 364
370 /* Save global tags */ 365 /* Save global tags */
371 for (x=0;x<TAG_GLOB_MAX;x++){ 366 for (x = 0; x < TAG_GLOB_MAX; x++)
372 oldval[x] = globalval[x]; 367 oldval[x] = globalval[x];
373 }
374 368
375 break; 369 break;
370
376 case TAG_MAIN_COL_END: 371 case TAG_MAIN_COL_END:
377 dbg("<<<<<<======"); 372 dbg("<<<<<<======");
378 maintype='E'; 373 maintype = 'E';
379 indent--; 374 indent--;
380 for (x=0;x<indent;x++){ 375 for (x = 0; x < indent; x++)
381 indentstr[x]='-'; 376 indentstr[x] = '-';
382 } 377 indentstr[x] = 0;
383 indentstr[x]=0;
384 378
385 /* Copy global tags back */ 379 /* Copy global tags back */
386 for (x=0;x<TAG_GLOB_MAX;x++){ 380 for (x = 0; x < TAG_GLOB_MAX; x++)
387 globalval[x] = oldval[x]; 381 globalval[x] = oldval[x];
388 }
389 382
390 break; 383 break;
391 } 384 }
392 385
393 switch (size){ 386 switch (size) {
394 case 1: 387 case 1:
395 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 388 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
396 indentstr,tag,maintype,size,globtype,data); 389 indentstr, tag, maintype, size, globtype, data);
397 break; 390 break;
391
398 case 2: 392 case 2:
399 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 393 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
400 indentstr,tag,maintype,size,globtype, data16); 394 indentstr, tag, maintype, size, globtype, data16);
401 break; 395 break;
396
402 case 4: 397 case 4:
403 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", 398 dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
404 indentstr,tag,maintype,size,globtype,data32); 399 indentstr, tag, maintype, size, globtype, data32);
405 break; 400 break;
406 } 401 }
407 break; 402 break;
403
408 case TYPE_GLOBAL: 404 case TYPE_GLOBAL:
409 switch(tag){ 405 switch (tag) {
410 case TAG_GLOB_USAGE: 406 case TAG_GLOB_USAGE:
411 /* 407 /*
412 * First time we hit the global usage tag, 408 * First time we hit the global usage tag,
413 * it should tell us the type of device 409 * it should tell us the type of device
414 */ 410 */
415 if (device->usage == 0){ 411 if (device->usage == 0)
416 device->usage = data; 412 device->usage = data;
417 } 413
418 strcpy(globtype,"USAGE"); 414 strcpy(globtype, "USAGE");
419 break; 415 break;
420 case TAG_GLOB_LOG_MIN : 416
421 strcpy(globtype,"LOG_MIN"); 417 case TAG_GLOB_LOG_MIN:
418 strcpy(globtype, "LOG_MIN");
422 break; 419 break;
423 case TAG_GLOB_LOG_MAX : 420
424 strcpy(globtype,"LOG_MAX"); 421 case TAG_GLOB_LOG_MAX:
422 strcpy(globtype, "LOG_MAX");
425 break; 423 break;
426 case TAG_GLOB_PHYS_MIN : 424
427 strcpy(globtype,"PHYS_MIN"); 425 case TAG_GLOB_PHYS_MIN:
426 strcpy(globtype, "PHYS_MIN");
428 break; 427 break;
429 case TAG_GLOB_PHYS_MAX : 428
430 strcpy(globtype,"PHYS_MAX"); 429 case TAG_GLOB_PHYS_MAX:
430 strcpy(globtype, "PHYS_MAX");
431 break; 431 break;
432 case TAG_GLOB_UNIT_EXP : 432
433 strcpy(globtype,"EXP"); 433 case TAG_GLOB_UNIT_EXP:
434 strcpy(globtype, "EXP");
434 break; 435 break;
435 case TAG_GLOB_UNIT : 436
436 strcpy(globtype,"UNIT"); 437 case TAG_GLOB_UNIT:
438 strcpy(globtype, "UNIT");
437 break; 439 break;
438 case TAG_GLOB_REPORT_SZ : 440
439 strcpy(globtype,"REPORT_SZ"); 441 case TAG_GLOB_REPORT_SZ:
442 strcpy(globtype, "REPORT_SZ");
440 break; 443 break;
441 case TAG_GLOB_REPORT_ID : 444
442 strcpy(globtype,"REPORT_ID"); 445 case TAG_GLOB_REPORT_ID:
446 strcpy(globtype, "REPORT_ID");
443 /* New report, restart numbering */ 447 /* New report, restart numbering */
444 inputnum=0; 448 inputnum = 0;
445 break; 449 break;
450
446 case TAG_GLOB_REPORT_CNT: 451 case TAG_GLOB_REPORT_CNT:
447 strcpy(globtype,"REPORT_CNT"); 452 strcpy(globtype, "REPORT_CNT");
448 break; 453 break;
449 case TAG_GLOB_PUSH : 454
450 strcpy(globtype,"PUSH"); 455 case TAG_GLOB_PUSH:
456 strcpy(globtype, "PUSH");
451 break; 457 break;
458
452 case TAG_GLOB_POP: 459 case TAG_GLOB_POP:
453 strcpy(globtype,"POP"); 460 strcpy(globtype, "POP");
454 break; 461 break;
455 } 462 }
456 463
457
458 /* Check to make sure we have a good tag number 464 /* Check to make sure we have a good tag number
459 so we don't overflow array */ 465 so we don't overflow array */
460 if (tag < TAG_GLOB_MAX){ 466 if (tag < TAG_GLOB_MAX) {
461 switch (size){ 467 switch (size) {
462 case 1: 468 case 1:
463 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",indentstr,globtype,tag,size,data); 469 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
464 globalval[tag]=data; 470 indentstr, globtype, tag, size, data);
471 globalval[tag] = data;
465 break; 472 break;
473
466 case 2: 474 case 2:
467 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",indentstr,globtype,tag,size,data16); 475 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
468 globalval[tag]=data16; 476 indentstr, globtype, tag, size, data16);
477 globalval[tag] = data16;
469 break; 478 break;
479
470 case 4: 480 case 4:
471 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",indentstr,globtype,tag,size,data32); 481 dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
472 globalval[tag]=data32; 482 indentstr, globtype, tag, size, data32);
483 globalval[tag] = data32;
473 break; 484 break;
474 } 485 }
475 }else{ 486 } else {
476 dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", 487 dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ",
477 indentstr,tag,size); 488 indentstr, tag, size);
478 } 489 }
479
480
481 break; 490 break;
482 491
483 case TYPE_LOCAL: 492 case TYPE_LOCAL:
484 switch(tag){ 493 switch (tag) {
485 case TAG_GLOB_USAGE: 494 case TAG_GLOB_USAGE:
486 strcpy(globtype,"USAGE"); 495 strcpy(globtype, "USAGE");
487 /* Always 1 byte */ 496 /* Always 1 byte */
488 usage = data; 497 usage = data;
489 break; 498 break;
490 case TAG_GLOB_LOG_MIN : 499
491 strcpy(globtype,"MIN"); 500 case TAG_GLOB_LOG_MIN:
501 strcpy(globtype, "MIN");
492 break; 502 break;
493 case TAG_GLOB_LOG_MAX : 503
494 strcpy(globtype,"MAX"); 504 case TAG_GLOB_LOG_MAX:
505 strcpy(globtype, "MAX");
495 break; 506 break;
507
496 default: 508 default:
497 strcpy(globtype,"UNKNOWN"); 509 strcpy(globtype, "UNKNOWN");
510 break;
498 } 511 }
499 512
500 switch (size){ 513 switch (size) {
501 case 1: 514 case 1:
502 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 515 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
503 indentstr,tag,globtype,size,data); 516 indentstr, tag, globtype, size, data);
504 break; 517 break;
518
505 case 2: 519 case 2:
506 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 520 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
507 indentstr,tag,globtype,size,data16); 521 indentstr, tag, globtype, size, data16);
508 break; 522 break;
523
509 case 4: 524 case 4:
510 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", 525 dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
511 indentstr,tag,globtype,size,data32); 526 indentstr, tag, globtype, size, data32);
512 break; 527 break;
513 } 528 }
514 529
515 break; 530 break;
516 } 531 }
517
518 } 532 }
519
520} 533}
521 534
522
523
524/* INPUT DRIVER Routines */ 535/* INPUT DRIVER Routines */
525 536
526
527/* 537/*
528 * Called when opening the input device. This will submit the URB to 538 * Called when opening the input device. This will submit the URB to
529 * the usb system so we start getting reports 539 * the usb system so we start getting reports
530 */ 540 */
531static int gtco_input_open(struct input_dev *inputdev) 541static int gtco_input_open(struct input_dev *inputdev)
532{ 542{
533 struct gtco *device; 543 struct gtco *device = input_get_drvdata(inputdev);
534 device = inputdev->private;
535 544
536 device->urbinfo->dev = device->usbdev; 545 device->urbinfo->dev = device->usbdev;
537 if (usb_submit_urb(device->urbinfo, GFP_KERNEL)) { 546 if (usb_submit_urb(device->urbinfo, GFP_KERNEL))
538 return -EIO; 547 return -EIO;
539 } 548
540 return 0; 549 return 0;
541} 550}
542 551
543/** 552/*
544 Called when closing the input device. This will unlink the URB 553 * Called when closing the input device. This will unlink the URB
545*/ 554 */
546static void gtco_input_close(struct input_dev *inputdev) 555static void gtco_input_close(struct input_dev *inputdev)
547{ 556{
548 struct gtco *device = inputdev->private; 557 struct gtco *device = input_get_drvdata(inputdev);
549 558
550 usb_kill_urb(device->urbinfo); 559 usb_kill_urb(device->urbinfo);
551
552} 560}
553 561
554 562
@@ -560,19 +568,16 @@ static void gtco_input_close(struct input_dev *inputdev)
560 * placed in the struct gtco structure 568 * placed in the struct gtco structure
561 * 569 *
562 */ 570 */
563static void gtco_setup_caps(struct input_dev *inputdev) 571static void gtco_setup_caps(struct input_dev *inputdev)
564{ 572{
565 struct gtco *device = inputdev->private; 573 struct gtco *device = input_get_drvdata(inputdev);
566
567 574
568 /* Which events */ 575 /* Which events */
569 inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC); 576 inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC);
570 577
571
572 /* Misc event menu block */ 578 /* Misc event menu block */
573 inputdev->mscbit[0] = BIT(MSC_SCAN)|BIT(MSC_SERIAL)|BIT(MSC_RAW) ; 579 inputdev->mscbit[0] = BIT(MSC_SCAN)|BIT(MSC_SERIAL)|BIT(MSC_RAW) ;
574 580
575
576 /* Absolute values based on HID report info */ 581 /* Absolute values based on HID report info */
577 input_set_abs_params(inputdev, ABS_X, device->min_X, device->max_X, 582 input_set_abs_params(inputdev, ABS_X, device->min_X, device->max_X,
578 0, 0); 583 0, 0);
@@ -590,17 +595,12 @@ static void gtco_setup_caps(struct input_dev *inputdev)
590 input_set_abs_params(inputdev, ABS_PRESSURE, device->minpressure, 595 input_set_abs_params(inputdev, ABS_PRESSURE, device->minpressure,
591 device->maxpressure, 0, 0); 596 device->maxpressure, 0, 0);
592 597
593
594 /* Transducer */ 598 /* Transducer */
595 input_set_abs_params(inputdev, ABS_MISC, 0,0xFF, 0, 0); 599 input_set_abs_params(inputdev, ABS_MISC, 0, 0xFF, 0, 0);
596
597} 600}
598 601
599
600
601/* USB Routines */ 602/* USB Routines */
602 603
603
604/* 604/*
605 * URB callback routine. Called when we get IRQ reports from the 605 * URB callback routine. Called when we get IRQ reports from the
606 * digitizer. 606 * digitizer.
@@ -610,9 +610,7 @@ static void gtco_setup_caps(struct input_dev *inputdev)
610 */ 610 */
611static void gtco_urb_callback(struct urb *urbinfo) 611static void gtco_urb_callback(struct urb *urbinfo)
612{ 612{
613 613 struct gtco *device = urbinfo->context;
614
615 struct gtco *device = urbinfo->context;
616 struct input_dev *inputdev; 614 struct input_dev *inputdev;
617 int rc; 615 int rc;
618 u32 val = 0; 616 u32 val = 0;
@@ -621,19 +619,20 @@ static void gtco_urb_callback(struct urb *urbinfo)
621 619
622 inputdev = device->inputdevice; 620 inputdev = device->inputdevice;
623 621
624
625 /* Was callback OK? */ 622 /* Was callback OK? */
626 if ((urbinfo->status == -ECONNRESET ) || 623 if (urbinfo->status == -ECONNRESET ||
627 (urbinfo->status == -ENOENT ) || 624 urbinfo->status == -ENOENT ||
628 (urbinfo->status == -ESHUTDOWN )){ 625 urbinfo->status == -ESHUTDOWN) {
629 626
630 /* Shutdown is occurring. Return and don't queue up any more */ 627 /* Shutdown is occurring. Return and don't queue up any more */
631 return; 628 return;
632 } 629 }
633 630
634 if (urbinfo->status != 0 ) { 631 if (urbinfo->status != 0) {
635 /* Some unknown error. Hopefully temporary. Just go and */ 632 /*
636 /* requeue an URB */ 633 * Some unknown error. Hopefully temporary. Just go and
634 * requeue an URB
635 */
637 goto resubmit; 636 goto resubmit;
638 } 637 }
639 638
@@ -642,10 +641,9 @@ static void gtco_urb_callback(struct urb *urbinfo)
642 */ 641 */
643 642
644 /* PID dependent when we interpret the report */ 643 /* PID dependent when we interpret the report */
645 if ((inputdev->id.product == PID_1000 )|| 644 if (inputdev->id.product == PID_1000 ||
646 (inputdev->id.product == PID_1001 )|| 645 inputdev->id.product == PID_1001 ||
647 (inputdev->id.product == PID_1002 )) 646 inputdev->id.product == PID_1002) {
648 {
649 647
650 /* 648 /*
651 * Switch on the report ID 649 * Switch on the report ID
@@ -653,10 +651,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
653 * the report number. We can just fall through the case 651 * the report number. We can just fall through the case
654 * statements if we start with the highest number report 652 * statements if we start with the highest number report
655 */ 653 */
656 switch(device->buffer[0]){ 654 switch (device->buffer[0]) {
657 case 5: 655 case 5:
658 /* Pressure is 9 bits */ 656 /* Pressure is 9 bits */
659 val = ((u16)(device->buffer[8]) << 1); 657 val = ((u16)(device->buffer[8]) << 1);
660 val |= (u16)(device->buffer[7] >> 7); 658 val |= (u16)(device->buffer[7] >> 7);
661 input_report_abs(inputdev, ABS_PRESSURE, 659 input_report_abs(inputdev, ABS_PRESSURE,
662 device->buffer[8]); 660 device->buffer[8]);
@@ -664,7 +662,6 @@ static void gtco_urb_callback(struct urb *urbinfo)
664 /* Mask out the Y tilt value used for pressure */ 662 /* Mask out the Y tilt value used for pressure */
665 device->buffer[7] = (u8)((device->buffer[7]) & 0x7F); 663 device->buffer[7] = (u8)((device->buffer[7]) & 0x7F);
666 664
667
668 /* Fall thru */ 665 /* Fall thru */
669 case 4: 666 case 4:
670 /* Tilt */ 667 /* Tilt */
@@ -684,11 +681,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
684 input_report_abs(inputdev, ABS_TILT_Y, (s32)valsigned); 681 input_report_abs(inputdev, ABS_TILT_Y, (s32)valsigned);
685 682
686 /* Fall thru */ 683 /* Fall thru */
687
688 case 2: 684 case 2:
689 case 3: 685 case 3:
690 /* Convert buttons, only 5 bits possible */ 686 /* Convert buttons, only 5 bits possible */
691 val = (device->buffer[5])&MASK_BUTTON; 687 val = (device->buffer[5]) & MASK_BUTTON;
692 688
693 /* We don't apply any meaning to the bitmask, 689 /* We don't apply any meaning to the bitmask,
694 just report */ 690 just report */
@@ -696,132 +692,109 @@ static void gtco_urb_callback(struct urb *urbinfo)
696 692
697 /* Fall thru */ 693 /* Fall thru */
698 case 1: 694 case 1:
699
700 /* All reports have X and Y coords in the same place */ 695 /* All reports have X and Y coords in the same place */
701 val = le16_to_cpu(get_unaligned((__le16 *) &(device->buffer[1]))); 696 val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[1]));
702 input_report_abs(inputdev, ABS_X, val); 697 input_report_abs(inputdev, ABS_X, val);
703 698
704 val = le16_to_cpu(get_unaligned((__le16 *) &(device->buffer[3]))); 699 val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[3]));
705 input_report_abs(inputdev, ABS_Y, val); 700 input_report_abs(inputdev, ABS_Y, val);
706 701
707
708 /* Ditto for proximity bit */ 702 /* Ditto for proximity bit */
709 if (device->buffer[5]& MASK_INRANGE){ 703 val = device->buffer[5] & MASK_INRANGE ? 1 : 0;
710 val = 1;
711 }else{
712 val=0;
713 }
714 input_report_abs(inputdev, ABS_DISTANCE, val); 704 input_report_abs(inputdev, ABS_DISTANCE, val);
715 705
716
717 /* Report 1 is an exception to how we handle buttons */ 706 /* Report 1 is an exception to how we handle buttons */
718 /* Buttons are an index, not a bitmask */ 707 /* Buttons are an index, not a bitmask */
719 if (device->buffer[0] == 1){ 708 if (device->buffer[0] == 1) {
720 709
721 /* Convert buttons, 5 bit index */ 710 /*
722 /* Report value of index set as one, 711 * Convert buttons, 5 bit index
723 the rest as 0 */ 712 * Report value of index set as one,
724 val = device->buffer[5]& MASK_BUTTON; 713 * the rest as 0
714 */
715 val = device->buffer[5] & MASK_BUTTON;
725 dbg("======>>>>>>REPORT 1: val 0x%X(%d)", 716 dbg("======>>>>>>REPORT 1: val 0x%X(%d)",
726 val,val); 717 val, val);
727 718
728 /* 719 /*
729 * We don't apply any meaning to the button 720 * We don't apply any meaning to the button
730 * index, just report it 721 * index, just report it
731 */ 722 */
732 input_event(inputdev, EV_MSC, MSC_SERIAL, val); 723 input_event(inputdev, EV_MSC, MSC_SERIAL, val);
733
734
735 } 724 }
736
737 break; 725 break;
726
738 case 7: 727 case 7:
739 /* Menu blocks */ 728 /* Menu blocks */
740 input_event(inputdev, EV_MSC, MSC_SCAN, 729 input_event(inputdev, EV_MSC, MSC_SCAN,
741 device->buffer[1]); 730 device->buffer[1]);
742
743
744 break; 731 break;
745
746 } 732 }
747
748
749 } 733 }
734
750 /* Other pid class */ 735 /* Other pid class */
751 if ((inputdev->id.product == PID_400 )|| 736 if (inputdev->id.product == PID_400 ||
752 (inputdev->id.product == PID_401 )) 737 inputdev->id.product == PID_401) {
753 {
754 738
755 /* Report 2 */ 739 /* Report 2 */
756 if (device->buffer[0] == 2){ 740 if (device->buffer[0] == 2) {
757 /* Menu blocks */ 741 /* Menu blocks */
758 input_event(inputdev, EV_MSC, MSC_SCAN, 742 input_event(inputdev, EV_MSC, MSC_SCAN, device->buffer[1]);
759 device->buffer[1]);
760 } 743 }
761 744
762 /* Report 1 */ 745 /* Report 1 */
763 if (device->buffer[0] == 1){ 746 if (device->buffer[0] == 1) {
764 char buttonbyte; 747 char buttonbyte;
765 748
766
767 /* IF X max > 64K, we still a bit from the y report */ 749 /* IF X max > 64K, we still a bit from the y report */
768 if (device->max_X > 0x10000){ 750 if (device->max_X > 0x10000) {
769 751
770 val = (u16)(((u16)(device->buffer[2]<<8))|((u8)(device->buffer[1]))); 752 val = (u16)(((u16)(device->buffer[2] << 8)) | (u8)device->buffer[1]);
771 val |= (u32)(((u8)device->buffer[3]&0x1)<< 16); 753 val |= (u32)(((u8)device->buffer[3] & 0x1) << 16);
772 754
773 input_report_abs(inputdev, ABS_X, val); 755 input_report_abs(inputdev, ABS_X, val);
774 756
775 le_buffer[0] = (u8)((u8)(device->buffer[3])>>1); 757 le_buffer[0] = (u8)((u8)(device->buffer[3]) >> 1);
776 le_buffer[0] |= (u8)((device->buffer[3]&0x1)<<7); 758 le_buffer[0] |= (u8)((device->buffer[3] & 0x1) << 7);
777
778 le_buffer[1] = (u8)(device->buffer[4]>>1);
779 le_buffer[1] |= (u8)((device->buffer[5]&0x1)<<7);
780 759
781 val = le16_to_cpu(get_unaligned((__le16 *)(le_buffer))); 760 le_buffer[1] = (u8)(device->buffer[4] >> 1);
761 le_buffer[1] |= (u8)((device->buffer[5] & 0x1) << 7);
782 762
763 val = le16_to_cpu(get_unaligned((__le16 *)le_buffer));
783 input_report_abs(inputdev, ABS_Y, val); 764 input_report_abs(inputdev, ABS_Y, val);
784 765
785
786 /* 766 /*
787 * Shift the button byte right by one to 767 * Shift the button byte right by one to
788 * make it look like the standard report 768 * make it look like the standard report
789 */ 769 */
790 buttonbyte = (device->buffer[5])>>1; 770 buttonbyte = device->buffer[5] >> 1;
791 }else{ 771 } else {
792 772
793 val = le16_to_cpu(get_unaligned((__le16 *) (&(device->buffer[1])))); 773 val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[1]));
794 input_report_abs(inputdev, ABS_X, val); 774 input_report_abs(inputdev, ABS_X, val);
795 775
796 val = le16_to_cpu(get_unaligned((__le16 *) (&(device->buffer[3])))); 776 val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[3]));
797 input_report_abs(inputdev, ABS_Y, val); 777 input_report_abs(inputdev, ABS_Y, val);
798 778
799 buttonbyte = device->buffer[5]; 779 buttonbyte = device->buffer[5];
800
801 } 780 }
802 781
803
804 /* BUTTONS and PROXIMITY */ 782 /* BUTTONS and PROXIMITY */
805 if (buttonbyte& MASK_INRANGE){ 783 val = buttonbyte & MASK_INRANGE ? 1 : 0;
806 val = 1;
807 }else{
808 val=0;
809 }
810 input_report_abs(inputdev, ABS_DISTANCE, val); 784 input_report_abs(inputdev, ABS_DISTANCE, val);
811 785
812 /* Convert buttons, only 4 bits possible */ 786 /* Convert buttons, only 4 bits possible */
813 val = buttonbyte&0x0F; 787 val = buttonbyte & 0x0F;
814#ifdef USE_BUTTONS 788#ifdef USE_BUTTONS
815 for ( i=0;i<5;i++){ 789 for (i = 0; i < 5; i++)
816 input_report_key(inputdev, BTN_DIGI+i,val&(1<<i)); 790 input_report_key(inputdev, BTN_DIGI + i, val & (1 << i));
817 }
818#else 791#else
819 /* We don't apply any meaning to the bitmask, just report */ 792 /* We don't apply any meaning to the bitmask, just report */
820 input_event(inputdev, EV_MSC, MSC_SERIAL, val); 793 input_event(inputdev, EV_MSC, MSC_SERIAL, val);
821#endif 794#endif
795
822 /* TRANSDUCER */ 796 /* TRANSDUCER */
823 input_report_abs(inputdev, ABS_MISC, device->buffer[6]); 797 input_report_abs(inputdev, ABS_MISC, device->buffer[6]);
824
825 } 798 }
826 } 799 }
827 800
@@ -833,10 +806,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
833 806
834 resubmit: 807 resubmit:
835 rc = usb_submit_urb(urbinfo, GFP_ATOMIC); 808 rc = usb_submit_urb(urbinfo, GFP_ATOMIC);
836 if (rc != 0) { 809 if (rc != 0)
837 err("usb_submit_urb failed rc=0x%x",rc); 810 err("usb_submit_urb failed rc=0x%x", rc);
838 }
839
840} 811}
841 812
842/* 813/*
@@ -854,58 +825,46 @@ static int gtco_probe(struct usb_interface *usbinterface,
854 const struct usb_device_id *id) 825 const struct usb_device_id *id)
855{ 826{
856 827
857 struct gtco *device = NULL; 828 struct gtco *gtco;
858 char path[PATHLENGTH]; 829 struct input_dev *input_dev;
859 struct input_dev *inputdev;
860 struct hid_descriptor *hid_desc; 830 struct hid_descriptor *hid_desc;
861 char *report; 831 char *report = NULL;
862 int result=0, retry; 832 int result = 0, retry;
833 int error;
863 struct usb_endpoint_descriptor *endpoint; 834 struct usb_endpoint_descriptor *endpoint;
864 835
865 /* Allocate memory for device structure */ 836 /* Allocate memory for device structure */
866 device = kzalloc(sizeof(struct gtco), GFP_KERNEL); 837 gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL);
867 if (device == NULL) { 838 input_dev = input_allocate_device();
839 if (!gtco || !input_dev) {
868 err("No more memory"); 840 err("No more memory");
869 return -ENOMEM; 841 error = -ENOMEM;
842 goto err_free_devs;
870 } 843 }
871 844
872 845 /* Set pointer to the input device */
873 device->inputdevice = input_allocate_device(); 846 gtco->inputdevice = input_dev;
874 if (!device->inputdevice){
875 kfree(device);
876 err("No more memory");
877 return -ENOMEM;
878 }
879
880 /* Get pointer to the input device */
881 inputdev = device->inputdevice;
882 847
883 /* Save interface information */ 848 /* Save interface information */
884 device->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); 849 gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface));
885
886 850
887 /* Allocate some data for incoming reports */ 851 /* Allocate some data for incoming reports */
888 device->buffer = usb_buffer_alloc(device->usbdev, REPORT_MAX_SIZE, 852 gtco->buffer = usb_buffer_alloc(gtco->usbdev, REPORT_MAX_SIZE,
889 GFP_KERNEL, &(device->buf_dma)); 853 GFP_KERNEL, &gtco->buf_dma);
890 if (!device->buffer){ 854 if (!gtco->buffer) {
891 input_free_device(device->inputdevice); 855 err("No more memory for us buffers");
892 kfree(device); 856 error = -ENOMEM;
893 err("No more memory"); 857 goto err_free_devs;
894 return -ENOMEM;
895 } 858 }
896 859
897 /* Allocate URB for reports */ 860 /* Allocate URB for reports */
898 device->urbinfo = usb_alloc_urb(0, GFP_KERNEL); 861 gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL);
899 if (!device->urbinfo) { 862 if (!gtco->urbinfo) {
900 usb_buffer_free(device->usbdev, REPORT_MAX_SIZE, 863 err("Failed to allocate URB");
901 device->buffer, device->buf_dma);
902 input_free_device(device->inputdevice);
903 kfree(device);
904 err("No more memory");
905 return -ENOMEM; 864 return -ENOMEM;
865 goto err_free_buf;
906 } 866 }
907 867
908
909 /* 868 /*
910 * The endpoint is always altsetting 0, we know this since we know 869 * The endpoint is always altsetting 0, we know this since we know
911 * this device only has one interrupt endpoint 870 * this device only has one interrupt endpoint
@@ -913,51 +872,43 @@ static int gtco_probe(struct usb_interface *usbinterface,
913 endpoint = &usbinterface->altsetting[0].endpoint[0].desc; 872 endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
914 873
915 /* Some debug */ 874 /* Some debug */
916 dbg("gtco # interfaces: %d",usbinterface->num_altsetting); 875 dbg("gtco # interfaces: %d", usbinterface->num_altsetting);
917 dbg("num endpoints: %d",usbinterface->cur_altsetting->desc.bNumEndpoints); 876 dbg("num endpoints: %d", usbinterface->cur_altsetting->desc.bNumEndpoints);
918 dbg("interface class: %d",usbinterface->cur_altsetting->desc.bInterfaceClass); 877 dbg("interface class: %d", usbinterface->cur_altsetting->desc.bInterfaceClass);
919 dbg("endpoint: attribute:0x%x type:0x%x",endpoint->bmAttributes,endpoint->bDescriptorType); 878 dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType);
920 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 879 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)
921 dbg("endpoint: we have interrupt endpoint\n"); 880 dbg("endpoint: we have interrupt endpoint\n");
922 881
923 dbg("endpoint extra len:%d ",usbinterface->altsetting[0].extralen); 882 dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen);
924
925
926 883
927 /* 884 /*
928 * Find the HID descriptor so we can find out the size of the 885 * Find the HID descriptor so we can find out the size of the
929 * HID report descriptor 886 * HID report descriptor
930 */ 887 */
931 if (usb_get_extra_descriptor(usbinterface->cur_altsetting, 888 if (usb_get_extra_descriptor(usbinterface->cur_altsetting,
932 HID_DEVICE_TYPE,&hid_desc) != 0){ 889 HID_DEVICE_TYPE, &hid_desc) != 0){
933 err("Can't retrieve exta USB descriptor to get hid report descriptor length"); 890 err("Can't retrieve exta USB descriptor to get hid report descriptor length");
934 usb_buffer_free(device->usbdev, REPORT_MAX_SIZE, 891 error = -EIO;
935 device->buffer, device->buf_dma); 892 goto err_free_urb;
936 input_free_device(device->inputdevice);
937 kfree(device);
938 return -EIO;
939 } 893 }
940 894
941 dbg("Extra descriptor success: type:%d len:%d", 895 dbg("Extra descriptor success: type:%d len:%d",
942 hid_desc->bDescriptorType, hid_desc->wDescriptorLength); 896 hid_desc->bDescriptorType, hid_desc->wDescriptorLength);
943 897
944 if (!(report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL))) { 898 report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL);
945 usb_buffer_free(device->usbdev, REPORT_MAX_SIZE, 899 if (!report) {
946 device->buffer, device->buf_dma); 900 err("No more memory for report");
947 901 error = -ENOMEM;
948 input_free_device(device->inputdevice); 902 goto err_free_urb;
949 kfree(device);
950 err("No more memory");
951 return -ENOMEM;
952 } 903 }
953 904
954 /* Couple of tries to get reply */ 905 /* Couple of tries to get reply */
955 for (retry=0;retry<3;retry++) { 906 for (retry = 0; retry < 3; retry++) {
956 result = usb_control_msg(device->usbdev, 907 result = usb_control_msg(gtco->usbdev,
957 usb_rcvctrlpipe(device->usbdev, 0), 908 usb_rcvctrlpipe(gtco->usbdev, 0),
958 USB_REQ_GET_DESCRIPTOR, 909 USB_REQ_GET_DESCRIPTOR,
959 USB_RECIP_INTERFACE | USB_DIR_IN, 910 USB_RECIP_INTERFACE | USB_DIR_IN,
960 (REPORT_DEVICE_TYPE << 8), 911 REPORT_DEVICE_TYPE << 8,
961 0, /* interface */ 912 0, /* interface */
962 report, 913 report,
963 hid_desc->wDescriptorLength, 914 hid_desc->wDescriptorLength,
@@ -969,72 +920,76 @@ static int gtco_probe(struct usb_interface *usbinterface,
969 920
970 /* If we didn't get the report, fail */ 921 /* If we didn't get the report, fail */
971 dbg("usb_control_msg result: :%d", result); 922 dbg("usb_control_msg result: :%d", result);
972 if (result != hid_desc->wDescriptorLength){ 923 if (result != hid_desc->wDescriptorLength) {
973 kfree(report);
974 usb_buffer_free(device->usbdev, REPORT_MAX_SIZE,
975 device->buffer, device->buf_dma);
976 input_free_device(device->inputdevice);
977 kfree(device);
978 err("Failed to get HID Report Descriptor of size: %d", 924 err("Failed to get HID Report Descriptor of size: %d",
979 hid_desc->wDescriptorLength); 925 hid_desc->wDescriptorLength);
980 return -EIO; 926 error = -EIO;
927 goto err_free_urb;
981 } 928 }
982 929
983
984 /* Now we parse the report */ 930 /* Now we parse the report */
985 parse_hid_report_descriptor(device,report,result); 931 parse_hid_report_descriptor(gtco, report, result);
986 932
987 /* Now we delete it */ 933 /* Now we delete it */
988 kfree(report); 934 kfree(report);
989 935
990 /* Create a device file node */ 936 /* Create a device file node */
991 usb_make_path(device->usbdev, path, PATHLENGTH); 937 usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath));
992 sprintf(device->usbpath, "%s/input0", path); 938 strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath));
993
994 939
995 /* Set Input device functions */ 940 /* Set Input device functions */
996 inputdev->open = gtco_input_open; 941 input_dev->open = gtco_input_open;
997 inputdev->close = gtco_input_close; 942 input_dev->close = gtco_input_close;
998 943
999 /* Set input device information */ 944 /* Set input device information */
1000 inputdev->name = "GTCO_CalComp"; 945 input_dev->name = "GTCO_CalComp";
1001 inputdev->phys = device->usbpath; 946 input_dev->phys = gtco->usbpath;
1002 inputdev->private = device;
1003 947
948 input_set_drvdata(input_dev, gtco);
1004 949
1005 /* Now set up all the input device capabilities */ 950 /* Now set up all the input device capabilities */
1006 gtco_setup_caps(inputdev); 951 gtco_setup_caps(input_dev);
1007 952
1008 /* Set input device required ID information */ 953 /* Set input device required ID information */
1009 usb_to_input_id(device->usbdev, &device->inputdevice->id); 954 usb_to_input_id(gtco->usbdev, &input_dev->id);
1010 inputdev->cdev.dev = &usbinterface->dev; 955 input_dev->dev.parent = &usbinterface->dev;
1011 956
1012 /* Setup the URB, it will be posted later on open of input device */ 957 /* Setup the URB, it will be posted later on open of input device */
1013 endpoint = &usbinterface->altsetting[0].endpoint[0].desc; 958 endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
1014 959
1015 usb_fill_int_urb(device->urbinfo, 960 usb_fill_int_urb(gtco->urbinfo,
1016 device->usbdev, 961 gtco->usbdev,
1017 usb_rcvintpipe(device->usbdev, 962 usb_rcvintpipe(gtco->usbdev,
1018 endpoint->bEndpointAddress), 963 endpoint->bEndpointAddress),
1019 device->buffer, 964 gtco->buffer,
1020 REPORT_MAX_SIZE, 965 REPORT_MAX_SIZE,
1021 gtco_urb_callback, 966 gtco_urb_callback,
1022 device, 967 gtco,
1023 endpoint->bInterval); 968 endpoint->bInterval);
1024 969
1025 device->urbinfo->transfer_dma = device->buf_dma; 970 gtco->urbinfo->transfer_dma = gtco->buf_dma;
1026 device->urbinfo->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 971 gtco->urbinfo->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1027
1028 972
1029 /* Save device pointer in USB interface device */ 973 /* Save gtco pointer in USB interface gtco */
1030 usb_set_intfdata(usbinterface, device); 974 usb_set_intfdata(usbinterface, gtco);
1031 975
1032 /* All done, now register the input device */ 976 /* All done, now register the input device */
1033 input_register_device(inputdev); 977 error = input_register_device(input_dev);
978 if (error)
979 goto err_free_urb;
1034 980
1035 info( "gtco driver created usb: %s\n", path);
1036 return 0; 981 return 0;
1037 982
983 err_free_urb:
984 usb_free_urb(gtco->urbinfo);
985 err_free_buf:
986 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE,
987 gtco->buffer, gtco->buf_dma);
988 err_free_devs:
989 kfree(report);
990 input_free_device(input_dev);
991 kfree(gtco);
992 return error;
1038} 993}
1039 994
1040/* 995/*
@@ -1044,47 +999,46 @@ static int gtco_probe(struct usb_interface *usbinterface,
1044 */ 999 */
1045static void gtco_disconnect(struct usb_interface *interface) 1000static void gtco_disconnect(struct usb_interface *interface)
1046{ 1001{
1047
1048 /* Grab private device ptr */ 1002 /* Grab private device ptr */
1049 struct gtco *device = usb_get_intfdata (interface); 1003 struct gtco *gtco = usb_get_intfdata(interface);
1050 1004
1051 /* Now reverse all the registration stuff */ 1005 /* Now reverse all the registration stuff */
1052 if (device) { 1006 if (gtco) {
1053 input_unregister_device(device->inputdevice); 1007 input_unregister_device(gtco->inputdevice);
1054 usb_kill_urb(device->urbinfo); 1008 usb_kill_urb(gtco->urbinfo);
1055 usb_free_urb(device->urbinfo); 1009 usb_free_urb(gtco->urbinfo);
1056 usb_buffer_free(device->usbdev, REPORT_MAX_SIZE, 1010 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE,
1057 device->buffer, device->buf_dma); 1011 gtco->buffer, gtco->buf_dma);
1058 kfree(device); 1012 kfree(gtco);
1059 } 1013 }
1060 1014
1061 info("gtco driver disconnected"); 1015 info("gtco driver disconnected");
1062} 1016}
1063 1017
1064
1065/* STANDARD MODULE LOAD ROUTINES */ 1018/* STANDARD MODULE LOAD ROUTINES */
1066 1019
1067static struct usb_driver gtco_driverinfo_table = { 1020static struct usb_driver gtco_driverinfo_table = {
1068#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) 1021 .name = "gtco",
1069 .owner = THIS_MODULE, 1022 .id_table = gtco_usbid_table,
1070#endif 1023 .probe = gtco_probe,
1071 .name = "gtco", 1024 .disconnect = gtco_disconnect,
1072 .id_table = gtco_usbid_table,
1073 .probe = gtco_probe,
1074 .disconnect = gtco_disconnect,
1075}; 1025};
1026
1076/* 1027/*
1077 * Register this module with the USB subsystem 1028 * Register this module with the USB subsystem
1078 */ 1029 */
1079static int __init gtco_init(void) 1030static int __init gtco_init(void)
1080{ 1031{
1081 int rc; 1032 int error;
1082 rc = usb_register(&gtco_driverinfo_table); 1033
1083 if (rc) { 1034 error = usb_register(&gtco_driverinfo_table);
1084 err("usb_register() failed rc=0x%x", rc); 1035 if (error) {
1036 err("usb_register() failed rc=0x%x", error);
1037 return error;
1085 } 1038 }
1086 printk("GTCO usb driver version: %s",GTCO_VERSION); 1039
1087 return rc; 1040 printk("GTCO usb driver version: %s", GTCO_VERSION);
1041 return 0;
1088} 1042}
1089 1043
1090/* 1044/*
@@ -1095,7 +1049,7 @@ static void __exit gtco_exit(void)
1095 usb_deregister(&gtco_driverinfo_table); 1049 usb_deregister(&gtco_driverinfo_table);
1096} 1050}
1097 1051
1098module_init (gtco_init); 1052module_init(gtco_init);
1099module_exit (gtco_exit); 1053module_exit(gtco_exit);
1100 1054
1101MODULE_LICENSE("GPL"); 1055MODULE_LICENSE("GPL");
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c
deleted file mode 100644
index aac968aab860..000000000000
--- a/drivers/usb/input/itmtouch.c
+++ /dev/null
@@ -1,271 +0,0 @@
1/******************************************************************************
2 * itmtouch.c -- Driver for ITM touchscreen panel
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>.
19 *
20 * Kudos to ITM for providing me with the datasheet for the panel,
21 * even though it was a day later than I had finished writing this
22 * driver.
23 *
24 * It has meant that I've been able to correct my interpretation of the
25 * protocol packets however.
26 *
27 * CC -- 2003/9/29
28 *
29 * History
30 * 1.0 & 1.1 2003 (CC) vojtech@suse.cz
31 * Original version for 2.4.x kernels
32 *
33 * 1.2 02/03/2005 (HCE) hc@mivu.no
34 * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints.
35 * Unfortunately no calibration support at this time.
36 *
37 * 1.2.1 09/03/2005 (HCE) hc@mivu.no
38 * Code cleanup and adjusting syntax to start matching kernel standards
39 *
40 * 1.2.2 10/05/2006 (MJA) massad@gmail.com
41 * Flag for detecting if the screen was being touch was incorrectly
42 * inverted, so no touch events were being detected.
43 *
44 *****************************************************************************/
45
46#include <linux/kernel.h>
47#include <linux/slab.h>
48#include <linux/module.h>
49#include <linux/init.h>
50#include <linux/usb/input.h>
51
52/* only an 8 byte buffer necessary for a single packet */
53#define ITM_BUFSIZE 8
54#define PATH_SIZE 64
55
56#define USB_VENDOR_ID_ITMINC 0x0403
57#define USB_PRODUCT_ID_TOUCHPANEL 0xf9e9
58
59#define DRIVER_AUTHOR "Hans-Christian Egtvedt <hc@mivu.no>"
60#define DRIVER_VERSION "v1.2.2"
61#define DRIVER_DESC "USB ITM Inc Touch Panel Driver"
62#define DRIVER_LICENSE "GPL"
63
64MODULE_AUTHOR( DRIVER_AUTHOR );
65MODULE_DESCRIPTION( DRIVER_DESC );
66MODULE_LICENSE( DRIVER_LICENSE );
67
68struct itmtouch_dev {
69 struct usb_device *usbdev; /* usb device */
70 struct input_dev *inputdev; /* input device */
71 struct urb *readurb; /* urb */
72 char rbuf[ITM_BUFSIZE]; /* data */
73 int users;
74 char name[128];
75 char phys[64];
76};
77
78static struct usb_device_id itmtouch_ids [] = {
79 { USB_DEVICE(USB_VENDOR_ID_ITMINC, USB_PRODUCT_ID_TOUCHPANEL) },
80 { }
81};
82
83static void itmtouch_irq(struct urb *urb)
84{
85 struct itmtouch_dev *itmtouch = urb->context;
86 unsigned char *data = urb->transfer_buffer;
87 struct input_dev *dev = itmtouch->inputdev;
88 int retval;
89
90 switch (urb->status) {
91 case 0:
92 /* success */
93 break;
94 case -ETIME:
95 /* this urb is timing out */
96 dbg("%s - urb timed out - was the device unplugged?",
97 __FUNCTION__);
98 return;
99 case -ECONNRESET:
100 case -ENOENT:
101 case -ESHUTDOWN:
102 /* this urb is terminated, clean up */
103 dbg("%s - urb shutting down with status: %d",
104 __FUNCTION__, urb->status);
105 return;
106 default:
107 dbg("%s - nonzero urb status received: %d",
108 __FUNCTION__, urb->status);
109 goto exit;
110 }
111
112 /* if pressure has been released, then don't report X/Y */
113 if (!(data[7] & 0x20)) {
114 input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F));
115 input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F));
116 }
117
118 input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F));
119 input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20);
120 input_sync(dev);
121
122exit:
123 retval = usb_submit_urb (urb, GFP_ATOMIC);
124 if (retval)
125 printk(KERN_ERR "%s - usb_submit_urb failed with result: %d",
126 __FUNCTION__, retval);
127}
128
129static int itmtouch_open(struct input_dev *input)
130{
131 struct itmtouch_dev *itmtouch = input->private;
132
133 itmtouch->readurb->dev = itmtouch->usbdev;
134
135 if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL))
136 return -EIO;
137
138 return 0;
139}
140
141static void itmtouch_close(struct input_dev *input)
142{
143 struct itmtouch_dev *itmtouch = input->private;
144
145 usb_kill_urb(itmtouch->readurb);
146}
147
148static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id *id)
149{
150 struct itmtouch_dev *itmtouch;
151 struct input_dev *input_dev;
152 struct usb_host_interface *interface;
153 struct usb_endpoint_descriptor *endpoint;
154 struct usb_device *udev = interface_to_usbdev(intf);
155 unsigned int pipe;
156 unsigned int maxp;
157
158 interface = intf->cur_altsetting;
159 endpoint = &interface->endpoint[0].desc;
160
161 itmtouch = kzalloc(sizeof(struct itmtouch_dev), GFP_KERNEL);
162 input_dev = input_allocate_device();
163 if (!itmtouch || !input_dev) {
164 err("%s - Out of memory.", __FUNCTION__);
165 goto fail;
166 }
167
168 itmtouch->usbdev = udev;
169 itmtouch->inputdev = input_dev;
170
171 if (udev->manufacturer)
172 strlcpy(itmtouch->name, udev->manufacturer, sizeof(itmtouch->name));
173
174 if (udev->product) {
175 if (udev->manufacturer)
176 strlcat(itmtouch->name, " ", sizeof(itmtouch->name));
177 strlcat(itmtouch->name, udev->product, sizeof(itmtouch->name));
178 }
179
180 if (!strlen(itmtouch->name))
181 sprintf(itmtouch->name, "USB ITM touchscreen");
182
183 usb_make_path(udev, itmtouch->phys, sizeof(itmtouch->phys));
184 strlcpy(itmtouch->phys, "/input0", sizeof(itmtouch->phys));
185
186 input_dev->name = itmtouch->name;
187 input_dev->phys = itmtouch->phys;
188 usb_to_input_id(udev, &input_dev->id);
189 input_dev->cdev.dev = &intf->dev;
190 input_dev->private = itmtouch;
191
192 input_dev->open = itmtouch_open;
193 input_dev->close = itmtouch_close;
194
195 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
196 input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
197 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
198
199 /* device limits */
200 /* as specified by the ITM datasheet, X and Y are 12bit,
201 * Z (pressure) is 8 bit. However, the fields are defined up
202 * to 14 bits for future possible expansion.
203 */
204 input_set_abs_params(input_dev, ABS_X, 0, 0x0FFF, 2, 0);
205 input_set_abs_params(input_dev, ABS_Y, 0, 0x0FFF, 2, 0);
206 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xFF, 2, 0);
207
208 /* initialise the URB so we can read from the transport stream */
209 pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress);
210 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
211
212 if (maxp > ITM_BUFSIZE)
213 maxp = ITM_BUFSIZE;
214
215 itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL);
216 if (!itmtouch->readurb) {
217 dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__);
218 goto fail;
219 }
220
221 usb_fill_int_urb(itmtouch->readurb, itmtouch->usbdev, pipe, itmtouch->rbuf,
222 maxp, itmtouch_irq, itmtouch, endpoint->bInterval);
223
224 input_register_device(itmtouch->inputdev);
225
226 usb_set_intfdata(intf, itmtouch);
227
228 return 0;
229
230 fail: input_free_device(input_dev);
231 kfree(itmtouch);
232 return -ENOMEM;
233}
234
235static void itmtouch_disconnect(struct usb_interface *intf)
236{
237 struct itmtouch_dev *itmtouch = usb_get_intfdata(intf);
238
239 usb_set_intfdata(intf, NULL);
240
241 if (itmtouch) {
242 input_unregister_device(itmtouch->inputdev);
243 usb_kill_urb(itmtouch->readurb);
244 usb_free_urb(itmtouch->readurb);
245 kfree(itmtouch);
246 }
247}
248
249MODULE_DEVICE_TABLE(usb, itmtouch_ids);
250
251static struct usb_driver itmtouch_driver = {
252 .name = "itmtouch",
253 .probe = itmtouch_probe,
254 .disconnect = itmtouch_disconnect,
255 .id_table = itmtouch_ids,
256};
257
258static int __init itmtouch_init(void)
259{
260 info(DRIVER_DESC " " DRIVER_VERSION);
261 info(DRIVER_AUTHOR);
262 return usb_register(&itmtouch_driver);
263}
264
265static void __exit itmtouch_exit(void)
266{
267 usb_deregister(&itmtouch_driver);
268}
269
270module_init(itmtouch_init);
271module_exit(itmtouch_exit);
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index fedbcb127c21..c4781b9d1297 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -100,7 +100,7 @@ MODULE_DEVICE_TABLE(usb, kbtab_ids);
100 100
101static int kbtab_open(struct input_dev *dev) 101static int kbtab_open(struct input_dev *dev)
102{ 102{
103 struct kbtab *kbtab = dev->private; 103 struct kbtab *kbtab = input_get_drvdata(dev);
104 104
105 kbtab->irq->dev = kbtab->usbdev; 105 kbtab->irq->dev = kbtab->usbdev;
106 if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) 106 if (usb_submit_urb(kbtab->irq, GFP_KERNEL))
@@ -111,7 +111,7 @@ static int kbtab_open(struct input_dev *dev)
111 111
112static void kbtab_close(struct input_dev *dev) 112static void kbtab_close(struct input_dev *dev)
113{ 113{
114 struct kbtab *kbtab = dev->private; 114 struct kbtab *kbtab = input_get_drvdata(dev);
115 115
116 usb_kill_urb(kbtab->irq); 116 usb_kill_urb(kbtab->irq);
117} 117}
@@ -122,6 +122,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
122 struct usb_endpoint_descriptor *endpoint; 122 struct usb_endpoint_descriptor *endpoint;
123 struct kbtab *kbtab; 123 struct kbtab *kbtab;
124 struct input_dev *input_dev; 124 struct input_dev *input_dev;
125 int error = -ENOMEM;
125 126
126 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); 127 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
127 input_dev = input_allocate_device(); 128 input_dev = input_allocate_device();
@@ -145,8 +146,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
145 input_dev->name = "KB Gear Tablet"; 146 input_dev->name = "KB Gear Tablet";
146 input_dev->phys = kbtab->phys; 147 input_dev->phys = kbtab->phys;
147 usb_to_input_id(dev, &input_dev->id); 148 usb_to_input_id(dev, &input_dev->id);
148 input_dev->cdev.dev = &intf->dev; 149 input_dev->dev.parent = &intf->dev;
149 input_dev->private = kbtab; 150
151 input_set_drvdata(input_dev, kbtab);
150 152
151 input_dev->open = kbtab_open; 153 input_dev->open = kbtab_open;
152 input_dev->close = kbtab_close; 154 input_dev->close = kbtab_close;
@@ -168,15 +170,19 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
168 kbtab->irq->transfer_dma = kbtab->data_dma; 170 kbtab->irq->transfer_dma = kbtab->data_dma;
169 kbtab->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 171 kbtab->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
170 172
171 input_register_device(kbtab->dev); 173 error = input_register_device(kbtab->dev);
174 if (error)
175 goto fail3;
172 176
173 usb_set_intfdata(intf, kbtab); 177 usb_set_intfdata(intf, kbtab);
178
174 return 0; 179 return 0;
175 180
176fail2: usb_buffer_free(dev, 10, kbtab->data, kbtab->data_dma); 181 fail3: usb_free_urb(kbtab->irq);
177fail1: input_free_device(input_dev); 182 fail2: usb_buffer_free(dev, 10, kbtab->data, kbtab->data_dma);
183 fail1: input_free_device(input_dev);
178 kfree(kbtab); 184 kfree(kbtab);
179 return -ENOMEM; 185 return error;
180} 186}
181 187
182static void kbtab_disconnect(struct usb_interface *intf) 188static void kbtab_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c
index 98bd323369c7..1bffc9fa98c2 100644
--- a/drivers/usb/input/keyspan_remote.c
+++ b/drivers/usb/input/keyspan_remote.c
@@ -394,7 +394,7 @@ resubmit:
394 394
395static int keyspan_open(struct input_dev *dev) 395static int keyspan_open(struct input_dev *dev)
396{ 396{
397 struct usb_keyspan *remote = dev->private; 397 struct usb_keyspan *remote = input_get_drvdata(dev);
398 398
399 remote->irq_urb->dev = remote->udev; 399 remote->irq_urb->dev = remote->udev;
400 if (usb_submit_urb(remote->irq_urb, GFP_KERNEL)) 400 if (usb_submit_urb(remote->irq_urb, GFP_KERNEL))
@@ -405,7 +405,7 @@ static int keyspan_open(struct input_dev *dev)
405 405
406static void keyspan_close(struct input_dev *dev) 406static void keyspan_close(struct input_dev *dev)
407{ 407{
408 struct usb_keyspan *remote = dev->private; 408 struct usb_keyspan *remote = input_get_drvdata(dev);
409 409
410 usb_kill_urb(remote->irq_urb); 410 usb_kill_urb(remote->irq_urb);
411} 411}
@@ -437,7 +437,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
437 struct usb_endpoint_descriptor *endpoint; 437 struct usb_endpoint_descriptor *endpoint;
438 struct usb_keyspan *remote; 438 struct usb_keyspan *remote;
439 struct input_dev *input_dev; 439 struct input_dev *input_dev;
440 int i, retval; 440 int i, error;
441 441
442 endpoint = keyspan_get_in_endpoint(interface->cur_altsetting); 442 endpoint = keyspan_get_in_endpoint(interface->cur_altsetting);
443 if (!endpoint) 443 if (!endpoint)
@@ -446,7 +446,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
446 remote = kzalloc(sizeof(*remote), GFP_KERNEL); 446 remote = kzalloc(sizeof(*remote), GFP_KERNEL);
447 input_dev = input_allocate_device(); 447 input_dev = input_allocate_device();
448 if (!remote || !input_dev) { 448 if (!remote || !input_dev) {
449 retval = -ENOMEM; 449 error = -ENOMEM;
450 goto fail1; 450 goto fail1;
451 } 451 }
452 452
@@ -458,19 +458,19 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
458 458
459 remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma); 459 remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma);
460 if (!remote->in_buffer) { 460 if (!remote->in_buffer) {
461 retval = -ENOMEM; 461 error = -ENOMEM;
462 goto fail1; 462 goto fail1;
463 } 463 }
464 464
465 remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); 465 remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
466 if (!remote->irq_urb) { 466 if (!remote->irq_urb) {
467 retval = -ENOMEM; 467 error = -ENOMEM;
468 goto fail2; 468 goto fail2;
469 } 469 }
470 470
471 retval = keyspan_setup(udev); 471 error = keyspan_setup(udev);
472 if (retval) { 472 if (error) {
473 retval = -ENODEV; 473 error = -ENODEV;
474 goto fail3; 474 goto fail3;
475 } 475 }
476 476
@@ -495,14 +495,15 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
495 input_dev->name = remote->name; 495 input_dev->name = remote->name;
496 input_dev->phys = remote->phys; 496 input_dev->phys = remote->phys;
497 usb_to_input_id(udev, &input_dev->id); 497 usb_to_input_id(udev, &input_dev->id);
498 input_dev->cdev.dev = &interface->dev; 498 input_dev->dev.parent = &interface->dev;
499 499
500 input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ 500 input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */
501 for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) 501 for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++)
502 if (keyspan_key_table[i] != KEY_RESERVED) 502 if (keyspan_key_table[i] != KEY_RESERVED)
503 set_bit(keyspan_key_table[i], input_dev->keybit); 503 set_bit(keyspan_key_table[i], input_dev->keybit);
504 504
505 input_dev->private = remote; 505 input_set_drvdata(input_dev, remote);
506
506 input_dev->open = keyspan_open; 507 input_dev->open = keyspan_open;
507 input_dev->close = keyspan_close; 508 input_dev->close = keyspan_close;
508 509
@@ -517,7 +518,9 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
517 remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 518 remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
518 519
519 /* we can register the device now, as it is ready */ 520 /* we can register the device now, as it is ready */
520 input_register_device(remote->input); 521 error = input_register_device(remote->input);
522 if (error)
523 goto fail3;
521 524
522 /* save our data pointer in this interface device */ 525 /* save our data pointer in this interface device */
523 usb_set_intfdata(interface, remote); 526 usb_set_intfdata(interface, remote);
@@ -529,7 +532,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
529 fail1: kfree(remote); 532 fail1: kfree(remote);
530 input_free_device(input_dev); 533 input_free_device(input_dev);
531 534
532 return retval; 535 return error;
533} 536}
534 537
535/* 538/*
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
deleted file mode 100644
index 92c4e07da4c8..000000000000
--- a/drivers/usb/input/mtouchusb.c
+++ /dev/null
@@ -1,332 +0,0 @@
1/******************************************************************************
2 * mtouchusb.c -- Driver for Microtouch (Now 3M) USB Touchscreens
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Based upon original work by Radoslaw Garbacz (usb-support@ite.pl)
19 * (http://freshmeat.net/projects/3mtouchscreendriver)
20 *
21 * History
22 *
23 * 0.3 & 0.4 2002 (TEJ) tejohnson@yahoo.com
24 * Updated to 2.4.18, then 2.4.19
25 * Old version still relied on stealing a minor
26 *
27 * 0.5 02/26/2004 (TEJ) tejohnson@yahoo.com
28 * Complete rewrite using Linux Input in 2.6.3
29 * Unfortunately no calibration support at this time
30 *
31 * 1.4 04/25/2004 (TEJ) tejohnson@yahoo.com
32 * Changed reset from standard USB dev reset to vendor reset
33 * Changed data sent to host from compensated to raw coordinates
34 * Eliminated vendor/product module params
35 * Performed multiple successful tests with an EXII-5010UC
36 *
37 * 1.5 02/27/2005 ddstreet@ieee.org
38 * Added module parameter to select raw or hw-calibrated coordinate reporting
39 *
40 *****************************************************************************/
41
42#include <linux/kernel.h>
43#include <linux/slab.h>
44#include <linux/module.h>
45#include <linux/init.h>
46#include <linux/usb/input.h>
47
48#define MTOUCHUSB_MIN_XC 0x0
49#define MTOUCHUSB_MAX_RAW_XC 0x4000
50#define MTOUCHUSB_MAX_CALIB_XC 0xffff
51#define MTOUCHUSB_XC_FUZZ 0x0
52#define MTOUCHUSB_XC_FLAT 0x0
53#define MTOUCHUSB_MIN_YC 0x0
54#define MTOUCHUSB_MAX_RAW_YC 0x4000
55#define MTOUCHUSB_MAX_CALIB_YC 0xffff
56#define MTOUCHUSB_YC_FUZZ 0x0
57#define MTOUCHUSB_YC_FLAT 0x0
58
59#define MTOUCHUSB_ASYNC_REPORT 1
60#define MTOUCHUSB_RESET 7
61#define MTOUCHUSB_REPORT_DATA_SIZE 11
62#define MTOUCHUSB_REQ_CTRLLR_ID 10
63
64#define MTOUCHUSB_GET_RAW_XC(data) (data[8]<<8 | data[7])
65#define MTOUCHUSB_GET_CALIB_XC(data) (data[4]<<8 | data[3])
66#define MTOUCHUSB_GET_RAW_YC(data) (data[10]<<8 | data[9])
67#define MTOUCHUSB_GET_CALIB_YC(data) (data[6]<<8 | data[5])
68#define MTOUCHUSB_GET_XC(data) (raw_coordinates ? \
69 MTOUCHUSB_GET_RAW_XC(data) : \
70 MTOUCHUSB_GET_CALIB_XC(data))
71#define MTOUCHUSB_GET_YC(data) (raw_coordinates ? \
72 MTOUCHUSB_GET_RAW_YC(data) : \
73 MTOUCHUSB_GET_CALIB_YC(data))
74#define MTOUCHUSB_GET_TOUCHED(data) ((data[2] & 0x40) ? 1:0)
75
76#define DRIVER_VERSION "v1.5"
77#define DRIVER_AUTHOR "Todd E. Johnson, tejohnson@yahoo.com"
78#define DRIVER_DESC "3M USB Touchscreen Driver"
79#define DRIVER_LICENSE "GPL"
80
81static int raw_coordinates = 1;
82
83module_param(raw_coordinates, bool, S_IRUGO | S_IWUSR);
84MODULE_PARM_DESC(raw_coordinates, "report raw coordinate values (y, default) or hardware-calibrated coordinate values (n)");
85
86struct mtouch_usb {
87 unsigned char *data;
88 dma_addr_t data_dma;
89 struct urb *irq;
90 struct usb_device *udev;
91 struct input_dev *input;
92 char name[128];
93 char phys[64];
94};
95
96static struct usb_device_id mtouchusb_devices[] = {
97 { USB_DEVICE(0x0596, 0x0001) },
98 { }
99};
100
101static void mtouchusb_irq(struct urb *urb)
102{
103 struct mtouch_usb *mtouch = urb->context;
104 int retval;
105
106 switch (urb->status) {
107 case 0:
108 /* success */
109 break;
110 case -ETIME:
111 /* this urb is timing out */
112 dbg("%s - urb timed out - was the device unplugged?",
113 __FUNCTION__);
114 return;
115 case -ECONNRESET:
116 case -ENOENT:
117 case -ESHUTDOWN:
118 /* this urb is terminated, clean up */
119 dbg("%s - urb shutting down with status: %d",
120 __FUNCTION__, urb->status);
121 return;
122 default:
123 dbg("%s - nonzero urb status received: %d",
124 __FUNCTION__, urb->status);
125 goto exit;
126 }
127
128 input_report_key(mtouch->input, BTN_TOUCH,
129 MTOUCHUSB_GET_TOUCHED(mtouch->data));
130 input_report_abs(mtouch->input, ABS_X, MTOUCHUSB_GET_XC(mtouch->data));
131 input_report_abs(mtouch->input, ABS_Y,
132 (raw_coordinates ? MTOUCHUSB_MAX_RAW_YC : MTOUCHUSB_MAX_CALIB_YC)
133 - MTOUCHUSB_GET_YC(mtouch->data));
134 input_sync(mtouch->input);
135
136exit:
137 retval = usb_submit_urb(urb, GFP_ATOMIC);
138 if (retval)
139 err("%s - usb_submit_urb failed with result: %d",
140 __FUNCTION__, retval);
141}
142
143static int mtouchusb_open(struct input_dev *input)
144{
145 struct mtouch_usb *mtouch = input->private;
146
147 mtouch->irq->dev = mtouch->udev;
148
149 if (usb_submit_urb(mtouch->irq, GFP_ATOMIC))
150 return -EIO;
151
152 return 0;
153}
154
155static void mtouchusb_close(struct input_dev *input)
156{
157 struct mtouch_usb *mtouch = input->private;
158
159 usb_kill_urb(mtouch->irq);
160}
161
162static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *mtouch)
163{
164 dbg("%s - called", __FUNCTION__);
165
166 mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE,
167 GFP_ATOMIC, &mtouch->data_dma);
168
169 if (!mtouch->data)
170 return -1;
171
172 return 0;
173}
174
175static void mtouchusb_free_buffers(struct usb_device *udev, struct mtouch_usb *mtouch)
176{
177 dbg("%s - called", __FUNCTION__);
178
179 if (mtouch->data)
180 usb_buffer_free(udev, MTOUCHUSB_REPORT_DATA_SIZE,
181 mtouch->data, mtouch->data_dma);
182}
183
184static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
185{
186 struct mtouch_usb *mtouch;
187 struct input_dev *input_dev;
188 struct usb_host_interface *interface;
189 struct usb_endpoint_descriptor *endpoint;
190 struct usb_device *udev = interface_to_usbdev(intf);
191 int nRet;
192
193 dbg("%s - called", __FUNCTION__);
194
195 dbg("%s - setting interface", __FUNCTION__);
196 interface = intf->cur_altsetting;
197
198 dbg("%s - setting endpoint", __FUNCTION__);
199 endpoint = &interface->endpoint[0].desc;
200
201 mtouch = kzalloc(sizeof(struct mtouch_usb), GFP_KERNEL);
202 input_dev = input_allocate_device();
203 if (!mtouch || !input_dev) {
204 err("%s - Out of memory.", __FUNCTION__);
205 goto fail1;
206 }
207
208 dbg("%s - allocating buffers", __FUNCTION__);
209 if (mtouchusb_alloc_buffers(udev, mtouch))
210 goto fail2;
211
212 mtouch->udev = udev;
213 mtouch->input = input_dev;
214
215 if (udev->manufacturer)
216 strlcpy(mtouch->name, udev->manufacturer, sizeof(mtouch->name));
217
218 if (udev->product) {
219 if (udev->manufacturer)
220 strlcat(mtouch->name, " ", sizeof(mtouch->name));
221 strlcat(mtouch->name, udev->product, sizeof(mtouch->name));
222 }
223
224 if (!strlen(mtouch->name))
225 snprintf(mtouch->name, sizeof(mtouch->name),
226 "USB Touchscreen %04x:%04x",
227 le16_to_cpu(udev->descriptor.idVendor),
228 le16_to_cpu(udev->descriptor.idProduct));
229
230 usb_make_path(udev, mtouch->phys, sizeof(mtouch->phys));
231 strlcpy(mtouch->phys, "/input0", sizeof(mtouch->phys));
232
233 input_dev->name = mtouch->name;
234 input_dev->phys = mtouch->phys;
235 usb_to_input_id(udev, &input_dev->id);
236 input_dev->cdev.dev = &intf->dev;
237 input_dev->private = mtouch;
238
239 input_dev->open = mtouchusb_open;
240 input_dev->close = mtouchusb_close;
241
242 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
243 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
244 input_set_abs_params(input_dev, ABS_X, MTOUCHUSB_MIN_XC,
245 raw_coordinates ? MTOUCHUSB_MAX_RAW_XC : MTOUCHUSB_MAX_CALIB_XC,
246 MTOUCHUSB_XC_FUZZ, MTOUCHUSB_XC_FLAT);
247 input_set_abs_params(input_dev, ABS_Y, MTOUCHUSB_MIN_YC,
248 raw_coordinates ? MTOUCHUSB_MAX_RAW_YC : MTOUCHUSB_MAX_CALIB_YC,
249 MTOUCHUSB_YC_FUZZ, MTOUCHUSB_YC_FLAT);
250
251 nRet = usb_control_msg(mtouch->udev, usb_rcvctrlpipe(udev, 0),
252 MTOUCHUSB_RESET,
253 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
254 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
255 dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
256 __FUNCTION__, nRet);
257
258 dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__);
259 mtouch->irq = usb_alloc_urb(0, GFP_KERNEL);
260 if (!mtouch->irq) {
261 dbg("%s - usb_alloc_urb failed: mtouch->irq", __FUNCTION__);
262 goto fail2;
263 }
264
265 dbg("%s - usb_fill_int_urb", __FUNCTION__);
266 usb_fill_int_urb(mtouch->irq, mtouch->udev,
267 usb_rcvintpipe(mtouch->udev, 0x81),
268 mtouch->data, MTOUCHUSB_REPORT_DATA_SIZE,
269 mtouchusb_irq, mtouch, endpoint->bInterval);
270
271 dbg("%s - input_register_device", __FUNCTION__);
272 input_register_device(mtouch->input);
273
274 nRet = usb_control_msg(mtouch->udev, usb_rcvctrlpipe(udev, 0),
275 MTOUCHUSB_ASYNC_REPORT,
276 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
277 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
278 dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
279 __FUNCTION__, nRet);
280
281 usb_set_intfdata(intf, mtouch);
282 return 0;
283
284fail2: mtouchusb_free_buffers(udev, mtouch);
285fail1: input_free_device(input_dev);
286 kfree(mtouch);
287 return -ENOMEM;
288}
289
290static void mtouchusb_disconnect(struct usb_interface *intf)
291{
292 struct mtouch_usb *mtouch = usb_get_intfdata(intf);
293
294 dbg("%s - called", __FUNCTION__);
295 usb_set_intfdata(intf, NULL);
296 if (mtouch) {
297 dbg("%s - mtouch is initialized, cleaning up", __FUNCTION__);
298 usb_kill_urb(mtouch->irq);
299 input_unregister_device(mtouch->input);
300 usb_free_urb(mtouch->irq);
301 mtouchusb_free_buffers(interface_to_usbdev(intf), mtouch);
302 kfree(mtouch);
303 }
304}
305
306MODULE_DEVICE_TABLE(usb, mtouchusb_devices);
307
308static struct usb_driver mtouchusb_driver = {
309 .name = "mtouchusb",
310 .probe = mtouchusb_probe,
311 .disconnect = mtouchusb_disconnect,
312 .id_table = mtouchusb_devices,
313};
314
315static int __init mtouchusb_init(void)
316{
317 dbg("%s - called", __FUNCTION__);
318 return usb_register(&mtouchusb_driver);
319}
320
321static void __exit mtouchusb_cleanup(void)
322{
323 dbg("%s - called", __FUNCTION__);
324 usb_deregister(&mtouchusb_driver);
325}
326
327module_init(mtouchusb_init);
328module_exit(mtouchusb_cleanup);
329
330MODULE_AUTHOR(DRIVER_AUTHOR);
331MODULE_DESCRIPTION(DRIVER_DESC);
332MODULE_LICENSE("GPL");
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index fea97e5437f8..4f93a760faee 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -252,7 +252,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
252static int powermate_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int _value) 252static int powermate_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int _value)
253{ 253{
254 unsigned int command = (unsigned int)_value; 254 unsigned int command = (unsigned int)_value;
255 struct powermate_device *pm = dev->private; 255 struct powermate_device *pm = input_get_drvdata(dev);
256 256
257 if (type == EV_MSC && code == MSC_PULSELED){ 257 if (type == EV_MSC && code == MSC_PULSELED){
258 /* 258 /*
@@ -308,7 +308,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
308 struct powermate_device *pm; 308 struct powermate_device *pm;
309 struct input_dev *input_dev; 309 struct input_dev *input_dev;
310 int pipe, maxp; 310 int pipe, maxp;
311 int err = -ENOMEM; 311 int error = -ENOMEM;
312 312
313 interface = intf->cur_altsetting; 313 interface = intf->cur_altsetting;
314 endpoint = &interface->endpoint[0].desc; 314 endpoint = &interface->endpoint[0].desc;
@@ -359,8 +359,9 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
359 359
360 input_dev->phys = pm->phys; 360 input_dev->phys = pm->phys;
361 usb_to_input_id(udev, &input_dev->id); 361 usb_to_input_id(udev, &input_dev->id);
362 input_dev->cdev.dev = &intf->dev; 362 input_dev->dev.parent = &intf->dev;
363 input_dev->private = pm; 363
364 input_set_drvdata(input_dev, pm);
364 365
365 input_dev->event = powermate_input_event; 366 input_dev->event = powermate_input_event;
366 367
@@ -387,11 +388,14 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
387 388
388 /* register our interrupt URB with the USB system */ 389 /* register our interrupt URB with the USB system */
389 if (usb_submit_urb(pm->irq, GFP_KERNEL)) { 390 if (usb_submit_urb(pm->irq, GFP_KERNEL)) {
390 err = -EIO; 391 error = -EIO;
391 goto fail4; 392 goto fail4;
392 } 393 }
393 394
394 input_register_device(pm->input); 395 error = input_register_device(pm->input);
396 if (error)
397 goto fail5;
398
395 399
396 /* force an update of everything */ 400 /* force an update of everything */
397 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS; 401 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;
@@ -400,12 +404,13 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
400 usb_set_intfdata(intf, pm); 404 usb_set_intfdata(intf, pm);
401 return 0; 405 return 0;
402 406
403fail4: usb_free_urb(pm->config); 407 fail5: usb_kill_urb(pm->irq);
404fail3: usb_free_urb(pm->irq); 408 fail4: usb_free_urb(pm->config);
405fail2: powermate_free_buffers(udev, pm); 409 fail3: usb_free_urb(pm->irq);
406fail1: input_free_device(input_dev); 410 fail2: powermate_free_buffers(udev, pm);
411 fail1: input_free_device(input_dev);
407 kfree(pm); 412 kfree(pm);
408 return err; 413 return error;
409} 414}
410 415
411/* Called when a USB device we've accepted ownership of is removed */ 416/* Called when a USB device we've accepted ownership of is removed */
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
deleted file mode 100644
index 2a314b065922..000000000000
--- a/drivers/usb/input/touchkitusb.c
+++ /dev/null
@@ -1,392 +0,0 @@
1/******************************************************************************
2 * touchkitusb.c -- Driver for eGalax TouchKit USB Touchscreens
3 *
4 * Copyright (C) 2004-2005 by Daniel Ritz <daniel.ritz@gmx.ch>
5 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Based upon mtouchusb.c
22 *
23 *****************************************************************************/
24
25//#define DEBUG
26
27#include <linux/kernel.h>
28#include <linux/slab.h>
29#include <linux/module.h>
30#include <linux/init.h>
31#include <linux/usb/input.h>
32
33#define TOUCHKIT_MIN_XC 0x0
34#define TOUCHKIT_MAX_XC 0x07ff
35#define TOUCHKIT_XC_FUZZ 0x0
36#define TOUCHKIT_XC_FLAT 0x0
37#define TOUCHKIT_MIN_YC 0x0
38#define TOUCHKIT_MAX_YC 0x07ff
39#define TOUCHKIT_YC_FUZZ 0x0
40#define TOUCHKIT_YC_FLAT 0x0
41#define TOUCHKIT_REPORT_DATA_SIZE 16
42
43#define TOUCHKIT_DOWN 0x01
44
45#define TOUCHKIT_PKT_TYPE_MASK 0xFE
46#define TOUCHKIT_PKT_TYPE_REPT 0x80
47#define TOUCHKIT_PKT_TYPE_DIAG 0x0A
48
49#define DRIVER_VERSION "v0.1"
50#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
51#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver"
52
53static int swap_xy;
54module_param(swap_xy, bool, 0644);
55MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
56
57struct touchkit_usb {
58 unsigned char *data;
59 dma_addr_t data_dma;
60 char buffer[TOUCHKIT_REPORT_DATA_SIZE];
61 int buf_len;
62 struct urb *irq;
63 struct usb_device *udev;
64 struct input_dev *input;
65 char name[128];
66 char phys[64];
67};
68
69static struct usb_device_id touchkit_devices[] = {
70 {USB_DEVICE(0x3823, 0x0001)},
71 {USB_DEVICE(0x0123, 0x0001)},
72 {USB_DEVICE(0x0eef, 0x0001)},
73 {USB_DEVICE(0x0eef, 0x0002)},
74 {}
75};
76
77/* helpers to read the data */
78static inline int touchkit_get_touched(char *data)
79{
80 return (data[0] & TOUCHKIT_DOWN) ? 1 : 0;
81}
82
83static inline int touchkit_get_x(char *data)
84{
85 return ((data[3] & 0x0F) << 7) | (data[4] & 0x7F);
86}
87
88static inline int touchkit_get_y(char *data)
89{
90 return ((data[1] & 0x0F) << 7) | (data[2] & 0x7F);
91}
92
93
94/* processes one input packet. */
95static void touchkit_process_pkt(struct touchkit_usb *touchkit, char *pkt)
96{
97 int x, y;
98
99 /* only process report packets */
100 if ((pkt[0] & TOUCHKIT_PKT_TYPE_MASK) != TOUCHKIT_PKT_TYPE_REPT)
101 return;
102
103 if (swap_xy) {
104 y = touchkit_get_x(pkt);
105 x = touchkit_get_y(pkt);
106 } else {
107 x = touchkit_get_x(pkt);
108 y = touchkit_get_y(pkt);
109 }
110
111 input_report_key(touchkit->input, BTN_TOUCH, touchkit_get_touched(pkt));
112 input_report_abs(touchkit->input, ABS_X, x);
113 input_report_abs(touchkit->input, ABS_Y, y);
114 input_sync(touchkit->input);
115}
116
117
118static int touchkit_get_pkt_len(char *buf)
119{
120 switch (buf[0] & TOUCHKIT_PKT_TYPE_MASK) {
121 case TOUCHKIT_PKT_TYPE_REPT:
122 return 5;
123
124 case TOUCHKIT_PKT_TYPE_DIAG:
125 return buf[1] + 2;
126 }
127
128 return 0;
129}
130
131static void touchkit_process(struct touchkit_usb *touchkit, int len)
132{
133 char *buffer;
134 int pkt_len, buf_len, pos;
135
136 /* if the buffer contains data, append */
137 if (unlikely(touchkit->buf_len)) {
138 int tmp;
139
140 /* if only 1 byte in buffer, add another one to get length */
141 if (touchkit->buf_len == 1)
142 touchkit->buffer[1] = touchkit->data[0];
143
144 pkt_len = touchkit_get_pkt_len(touchkit->buffer);
145
146 /* unknown packet: drop everything */
147 if (!pkt_len)
148 return;
149
150 /* append, process */
151 tmp = pkt_len - touchkit->buf_len;
152 memcpy(touchkit->buffer + touchkit->buf_len, touchkit->data, tmp);
153 touchkit_process_pkt(touchkit, touchkit->buffer);
154
155 buffer = touchkit->data + tmp;
156 buf_len = len - tmp;
157 } else {
158 buffer = touchkit->data;
159 buf_len = len;
160 }
161
162 /* only one byte left in buffer */
163 if (unlikely(buf_len == 1)) {
164 touchkit->buffer[0] = buffer[0];
165 touchkit->buf_len = 1;
166 return;
167 }
168
169 /* loop over the buffer */
170 pos = 0;
171 while (pos < buf_len) {
172 /* get packet len */
173 pkt_len = touchkit_get_pkt_len(buffer + pos);
174
175 /* unknown packet: drop everything */
176 if (unlikely(!pkt_len))
177 return;
178
179 /* full packet: process */
180 if (likely(pkt_len <= buf_len)) {
181 touchkit_process_pkt(touchkit, buffer + pos);
182 } else {
183 /* incomplete packet: save in buffer */
184 memcpy(touchkit->buffer, buffer + pos, buf_len - pos);
185 touchkit->buf_len = buf_len - pos;
186 }
187 pos += pkt_len;
188 }
189}
190
191
192static void touchkit_irq(struct urb *urb)
193{
194 struct touchkit_usb *touchkit = urb->context;
195 int retval;
196
197 switch (urb->status) {
198 case 0:
199 /* success */
200 break;
201 case -ETIME:
202 /* this urb is timing out */
203 dbg("%s - urb timed out - was the device unplugged?",
204 __FUNCTION__);
205 return;
206 case -ECONNRESET:
207 case -ENOENT:
208 case -ESHUTDOWN:
209 /* this urb is terminated, clean up */
210 dbg("%s - urb shutting down with status: %d",
211 __FUNCTION__, urb->status);
212 return;
213 default:
214 dbg("%s - nonzero urb status received: %d",
215 __FUNCTION__, urb->status);
216 goto exit;
217 }
218
219 touchkit_process(touchkit, urb->actual_length);
220
221exit:
222 retval = usb_submit_urb(urb, GFP_ATOMIC);
223 if (retval)
224 err("%s - usb_submit_urb failed with result: %d",
225 __FUNCTION__, retval);
226}
227
228static int touchkit_open(struct input_dev *input)
229{
230 struct touchkit_usb *touchkit = input->private;
231
232 touchkit->irq->dev = touchkit->udev;
233
234 if (usb_submit_urb(touchkit->irq, GFP_ATOMIC))
235 return -EIO;
236
237 return 0;
238}
239
240static void touchkit_close(struct input_dev *input)
241{
242 struct touchkit_usb *touchkit = input->private;
243
244 usb_kill_urb(touchkit->irq);
245}
246
247static int touchkit_alloc_buffers(struct usb_device *udev,
248 struct touchkit_usb *touchkit)
249{
250 touchkit->data = usb_buffer_alloc(udev, TOUCHKIT_REPORT_DATA_SIZE,
251 GFP_ATOMIC, &touchkit->data_dma);
252
253 if (!touchkit->data)
254 return -1;
255
256 return 0;
257}
258
259static void touchkit_free_buffers(struct usb_device *udev,
260 struct touchkit_usb *touchkit)
261{
262 if (touchkit->data)
263 usb_buffer_free(udev, TOUCHKIT_REPORT_DATA_SIZE,
264 touchkit->data, touchkit->data_dma);
265}
266
267static int touchkit_probe(struct usb_interface *intf,
268 const struct usb_device_id *id)
269{
270 struct touchkit_usb *touchkit;
271 struct input_dev *input_dev;
272 struct usb_host_interface *interface;
273 struct usb_endpoint_descriptor *endpoint;
274 struct usb_device *udev = interface_to_usbdev(intf);
275
276 interface = intf->cur_altsetting;
277 endpoint = &interface->endpoint[0].desc;
278
279 touchkit = kzalloc(sizeof(struct touchkit_usb), GFP_KERNEL);
280 input_dev = input_allocate_device();
281 if (!touchkit || !input_dev)
282 goto out_free;
283
284 if (touchkit_alloc_buffers(udev, touchkit))
285 goto out_free;
286
287 touchkit->irq = usb_alloc_urb(0, GFP_KERNEL);
288 if (!touchkit->irq) {
289 dbg("%s - usb_alloc_urb failed: touchkit->irq", __FUNCTION__);
290 goto out_free_buffers;
291 }
292
293 touchkit->udev = udev;
294 touchkit->input = input_dev;
295
296 if (udev->manufacturer)
297 strlcpy(touchkit->name, udev->manufacturer, sizeof(touchkit->name));
298
299 if (udev->product) {
300 if (udev->manufacturer)
301 strlcat(touchkit->name, " ", sizeof(touchkit->name));
302 strlcat(touchkit->name, udev->product, sizeof(touchkit->name));
303 }
304
305 if (!strlen(touchkit->name))
306 snprintf(touchkit->name, sizeof(touchkit->name),
307 "USB Touchscreen %04x:%04x",
308 le16_to_cpu(udev->descriptor.idVendor),
309 le16_to_cpu(udev->descriptor.idProduct));
310
311 usb_make_path(udev, touchkit->phys, sizeof(touchkit->phys));
312 strlcpy(touchkit->phys, "/input0", sizeof(touchkit->phys));
313
314 input_dev->name = touchkit->name;
315 input_dev->phys = touchkit->phys;
316 usb_to_input_id(udev, &input_dev->id);
317 input_dev->cdev.dev = &intf->dev;
318 input_dev->private = touchkit;
319 input_dev->open = touchkit_open;
320 input_dev->close = touchkit_close;
321
322 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
323 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
324 input_set_abs_params(input_dev, ABS_X, TOUCHKIT_MIN_XC, TOUCHKIT_MAX_XC,
325 TOUCHKIT_XC_FUZZ, TOUCHKIT_XC_FLAT);
326 input_set_abs_params(input_dev, ABS_Y, TOUCHKIT_MIN_YC, TOUCHKIT_MAX_YC,
327 TOUCHKIT_YC_FUZZ, TOUCHKIT_YC_FLAT);
328
329 usb_fill_int_urb(touchkit->irq, touchkit->udev,
330 usb_rcvintpipe(touchkit->udev, 0x81),
331 touchkit->data, TOUCHKIT_REPORT_DATA_SIZE,
332 touchkit_irq, touchkit, endpoint->bInterval);
333
334 touchkit->irq->transfer_dma = touchkit->data_dma;
335 touchkit->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
336
337 input_register_device(touchkit->input);
338
339 usb_set_intfdata(intf, touchkit);
340 return 0;
341
342out_free_buffers:
343 touchkit_free_buffers(udev, touchkit);
344out_free:
345 input_free_device(input_dev);
346 kfree(touchkit);
347 return -ENOMEM;
348}
349
350static void touchkit_disconnect(struct usb_interface *intf)
351{
352 struct touchkit_usb *touchkit = usb_get_intfdata(intf);
353
354 dbg("%s - called", __FUNCTION__);
355
356 if (!touchkit)
357 return;
358
359 dbg("%s - touchkit is initialized, cleaning up", __FUNCTION__);
360 usb_set_intfdata(intf, NULL);
361 usb_kill_urb(touchkit->irq);
362 input_unregister_device(touchkit->input);
363 usb_free_urb(touchkit->irq);
364 touchkit_free_buffers(interface_to_usbdev(intf), touchkit);
365 kfree(touchkit);
366}
367
368MODULE_DEVICE_TABLE(usb, touchkit_devices);
369
370static struct usb_driver touchkit_driver = {
371 .name = "touchkitusb",
372 .probe = touchkit_probe,
373 .disconnect = touchkit_disconnect,
374 .id_table = touchkit_devices,
375};
376
377static int __init touchkit_init(void)
378{
379 return usb_register(&touchkit_driver);
380}
381
382static void __exit touchkit_cleanup(void)
383{
384 usb_deregister(&touchkit_driver);
385}
386
387module_init(touchkit_init);
388module_exit(touchkit_cleanup);
389
390MODULE_AUTHOR(DRIVER_AUTHOR);
391MODULE_DESCRIPTION(DRIVER_DESC);
392MODULE_LICENSE("GPL");
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c
index 86e37a20f8e5..e0829413336b 100644
--- a/drivers/usb/input/usbtouchscreen.c
+++ b/drivers/usb/input/usbtouchscreen.c
@@ -647,7 +647,7 @@ exit:
647 647
648static int usbtouch_open(struct input_dev *input) 648static int usbtouch_open(struct input_dev *input)
649{ 649{
650 struct usbtouch_usb *usbtouch = input->private; 650 struct usbtouch_usb *usbtouch = input_get_drvdata(input);
651 651
652 usbtouch->irq->dev = usbtouch->udev; 652 usbtouch->irq->dev = usbtouch->udev;
653 653
@@ -659,7 +659,7 @@ static int usbtouch_open(struct input_dev *input)
659 659
660static void usbtouch_close(struct input_dev *input) 660static void usbtouch_close(struct input_dev *input)
661{ 661{
662 struct usbtouch_usb *usbtouch = input->private; 662 struct usbtouch_usb *usbtouch = input_get_drvdata(input);
663 663
664 usb_kill_urb(usbtouch->irq); 664 usb_kill_urb(usbtouch->irq);
665} 665}
@@ -740,8 +740,10 @@ static int usbtouch_probe(struct usb_interface *intf,
740 input_dev->name = usbtouch->name; 740 input_dev->name = usbtouch->name;
741 input_dev->phys = usbtouch->phys; 741 input_dev->phys = usbtouch->phys;
742 usb_to_input_id(udev, &input_dev->id); 742 usb_to_input_id(udev, &input_dev->id);
743 input_dev->cdev.dev = &intf->dev; 743 input_dev->dev.parent = &intf->dev;
744 input_dev->private = usbtouch; 744
745 input_set_drvdata(input_dev, usbtouch);
746
745 input_dev->open = usbtouch_open; 747 input_dev->open = usbtouch_open;
746 input_dev->close = usbtouch_close; 748 input_dev->close = usbtouch_close;
747 749
diff --git a/drivers/usb/input/wacom_sys.c b/drivers/usb/input/wacom_sys.c
index 12b42746ded8..1fe48208c2f4 100644
--- a/drivers/usb/input/wacom_sys.c
+++ b/drivers/usb/input/wacom_sys.c
@@ -122,7 +122,7 @@ void wacom_input_sync(void *wcombo)
122 122
123static int wacom_open(struct input_dev *dev) 123static int wacom_open(struct input_dev *dev)
124{ 124{
125 struct wacom *wacom = dev->private; 125 struct wacom *wacom = input_get_drvdata(dev);
126 126
127 wacom->irq->dev = wacom->usbdev; 127 wacom->irq->dev = wacom->usbdev;
128 if (usb_submit_urb(wacom->irq, GFP_KERNEL)) 128 if (usb_submit_urb(wacom->irq, GFP_KERNEL))
@@ -133,7 +133,7 @@ static int wacom_open(struct input_dev *dev)
133 133
134static void wacom_close(struct input_dev *dev) 134static void wacom_close(struct input_dev *dev)
135{ 135{
136 struct wacom *wacom = dev->private; 136 struct wacom *wacom = input_get_drvdata(dev);
137 137
138 usb_kill_urb(wacom->irq); 138 usb_kill_urb(wacom->irq);
139} 139}
@@ -201,6 +201,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
201 struct wacom *wacom; 201 struct wacom *wacom;
202 struct wacom_wac *wacom_wac; 202 struct wacom_wac *wacom_wac;
203 struct input_dev *input_dev; 203 struct input_dev *input_dev;
204 int error = -ENOMEM;
204 char rep_data[2], limit = 0; 205 char rep_data[2], limit = 0;
205 206
206 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); 207 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
@@ -229,8 +230,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
229 wacom->wacom_wac = wacom_wac; 230 wacom->wacom_wac = wacom_wac;
230 usb_to_input_id(dev, &input_dev->id); 231 usb_to_input_id(dev, &input_dev->id);
231 232
232 input_dev->cdev.dev = &intf->dev; 233 input_dev->dev.parent = &intf->dev;
233 input_dev->private = wacom; 234
235 input_set_drvdata(input_dev, wacom);
236
234 input_dev->open = wacom_open; 237 input_dev->open = wacom_open;
235 input_dev->close = wacom_close; 238 input_dev->close = wacom_close;
236 239
@@ -252,7 +255,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
252 wacom->irq->transfer_dma = wacom->data_dma; 255 wacom->irq->transfer_dma = wacom->data_dma;
253 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 256 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
254 257
255 input_register_device(wacom->dev); 258 error = input_register_device(wacom->dev);
259 if (error)
260 goto fail3;
256 261
257 /* Ask the tablet to report tablet data. Repeat until it succeeds */ 262 /* Ask the tablet to report tablet data. Repeat until it succeeds */
258 do { 263 do {
@@ -265,11 +270,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
265 usb_set_intfdata(intf, wacom); 270 usb_set_intfdata(intf, wacom);
266 return 0; 271 return 0;
267 272
268fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma); 273 fail3: usb_free_urb(wacom->irq);
269fail1: input_free_device(input_dev); 274 fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma);
275 fail1: input_free_device(input_dev);
270 kfree(wacom); 276 kfree(wacom);
271 kfree(wacom_wac); 277 kfree(wacom_wac);
272 return -ENOMEM; 278 return error;
273} 279}
274 280
275static void wacom_disconnect(struct usb_interface *intf) 281static void wacom_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index e4bc76ebc835..735723912950 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -267,7 +267,7 @@ exit:
267 267
268static int xpad_open (struct input_dev *dev) 268static int xpad_open (struct input_dev *dev)
269{ 269{
270 struct usb_xpad *xpad = dev->private; 270 struct usb_xpad *xpad = input_get_drvdata(dev);
271 271
272 xpad->irq_in->dev = xpad->udev; 272 xpad->irq_in->dev = xpad->udev;
273 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) 273 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
@@ -278,7 +278,7 @@ static int xpad_open (struct input_dev *dev)
278 278
279static void xpad_close (struct input_dev *dev) 279static void xpad_close (struct input_dev *dev)
280{ 280{
281 struct usb_xpad *xpad = dev->private; 281 struct usb_xpad *xpad = input_get_drvdata(dev);
282 282
283 usb_kill_urb(xpad->irq_in); 283 usb_kill_urb(xpad->irq_in);
284} 284}
@@ -312,6 +312,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
312 struct input_dev *input_dev; 312 struct input_dev *input_dev;
313 struct usb_endpoint_descriptor *ep_irq_in; 313 struct usb_endpoint_descriptor *ep_irq_in;
314 int i; 314 int i;
315 int error = -ENOMEM;
315 316
316 for (i = 0; xpad_device[i].idVendor; i++) { 317 for (i = 0; xpad_device[i].idVendor; i++) {
317 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && 318 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
@@ -344,8 +345,10 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
344 input_dev->name = xpad_device[i].name; 345 input_dev->name = xpad_device[i].name;
345 input_dev->phys = xpad->phys; 346 input_dev->phys = xpad->phys;
346 usb_to_input_id(udev, &input_dev->id); 347 usb_to_input_id(udev, &input_dev->id);
347 input_dev->cdev.dev = &intf->dev; 348 input_dev->dev.parent = &intf->dev;
348 input_dev->private = xpad; 349
350 input_set_drvdata(input_dev, xpad);
351
349 input_dev->open = xpad_open; 352 input_dev->open = xpad_open;
350 input_dev->close = xpad_close; 353 input_dev->close = xpad_close;
351 354
@@ -373,15 +376,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
373 xpad->irq_in->transfer_dma = xpad->idata_dma; 376 xpad->irq_in->transfer_dma = xpad->idata_dma;
374 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 377 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
375 378
376 input_register_device(xpad->dev); 379 error = input_register_device(xpad->dev);
380 if (error)
381 goto fail3;
377 382
378 usb_set_intfdata(intf, xpad); 383 usb_set_intfdata(intf, xpad);
379 return 0; 384 return 0;
380 385
381fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); 386 fail3: usb_free_urb(xpad->irq_in);
382fail1: input_free_device(input_dev); 387 fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
388 fail1: input_free_device(input_dev);
383 kfree(xpad); 389 kfree(xpad);
384 return -ENOMEM; 390 return error;
385 391
386} 392}
387 393
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index caff8e6d7448..c54f1a5dcb4a 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -502,7 +502,7 @@ static int input_ev(struct input_dev *dev, unsigned int type,
502 502
503static int input_open(struct input_dev *dev) 503static int input_open(struct input_dev *dev)
504{ 504{
505 struct yealink_dev *yld = dev->private; 505 struct yealink_dev *yld = input_get_drvdata(dev);
506 int i, ret; 506 int i, ret;
507 507
508 dbg("%s", __FUNCTION__); 508 dbg("%s", __FUNCTION__);
@@ -529,7 +529,7 @@ static int input_open(struct input_dev *dev)
529 529
530static void input_close(struct input_dev *dev) 530static void input_close(struct input_dev *dev)
531{ 531{
532 struct yealink_dev *yld = dev->private; 532 struct yealink_dev *yld = input_get_drvdata(dev);
533 533
534 usb_kill_urb(yld->urb_ctl); 534 usb_kill_urb(yld->urb_ctl);
535 usb_kill_urb(yld->urb_irq); 535 usb_kill_urb(yld->urb_irq);
@@ -937,9 +937,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
937 input_dev->name = nfo->name; 937 input_dev->name = nfo->name;
938 input_dev->phys = yld->phys; 938 input_dev->phys = yld->phys;
939 usb_to_input_id(udev, &input_dev->id); 939 usb_to_input_id(udev, &input_dev->id);
940 input_dev->cdev.dev = &intf->dev; 940 input_dev->dev.parent = &intf->dev;
941
942 input_set_drvdata(input_dev, yld);
941 943
942 input_dev->private = yld;
943 input_dev->open = input_open; 944 input_dev->open = input_open;
944 input_dev->close = input_close; 945 input_dev->close = input_close;
945 /* input_dev->event = input_ev; TODO */ 946 /* input_dev->event = input_ev; TODO */
@@ -955,7 +956,9 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
955 } 956 }
956 } 957 }
957 958
958 input_register_device(yld->idev); 959 ret = input_register_device(yld->idev);
960 if (ret)
961 return usb_cleanup(yld, ret);
959 962
960 usb_set_intfdata(intf, yld); 963 usb_set_intfdata(intf, yld);
961 964
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
index a0cc05d21a6a..60d29440f316 100644
--- a/drivers/usb/net/kaweth.c
+++ b/drivers/usb/net/kaweth.c
@@ -55,7 +55,6 @@
55#include <linux/usb.h> 55#include <linux/usb.h>
56#include <linux/types.h> 56#include <linux/types.h>
57#include <linux/ethtool.h> 57#include <linux/ethtool.h>
58#include <linux/pci.h>
59#include <linux/dma-mapping.h> 58#include <linux/dma-mapping.h>
60#include <linux/wait.h> 59#include <linux/wait.h>
61#include <asm/uaccess.h> 60#include <asm/uaccess.h>
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b1cb72c3780f..344c37595305 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -191,7 +191,7 @@ config FB_ARMCLCD
191 191
192 If you want to compile this as a module (=code which can be 192 If you want to compile this as a module (=code which can be
193 inserted into and removed from the running kernel), say M 193 inserted into and removed from the running kernel), say M
194 here and read <file:Documentation/modules.txt>. The module 194 here and read <file:Documentation/kbuild/modules.txt>. The module
195 will be called amba-clcd. 195 will be called amba-clcd.
196 196
197choice 197choice
@@ -389,7 +389,10 @@ config FB_ARC
389 389
390config FB_ATARI 390config FB_ATARI
391 bool "Atari native chipset support" 391 bool "Atari native chipset support"
392 depends on (FB = y) && ATARI && BROKEN 392 depends on (FB = y) && ATARI
393 select FB_CFB_FILLRECT
394 select FB_CFB_COPYAREA
395 select FB_CFB_IMAGEBLIT
393 help 396 help
394 This is the frame buffer device driver for the builtin graphics 397 This is the frame buffer device driver for the builtin graphics
395 chipset found in Ataris. 398 chipset found in Ataris.
@@ -1380,6 +1383,32 @@ config FB_LEO
1380 This is the frame buffer device driver for the SBUS-based Sun ZX 1383 This is the frame buffer device driver for the SBUS-based Sun ZX
1381 (leo) frame buffer cards. 1384 (leo) frame buffer cards.
1382 1385
1386config FB_XVR500
1387 bool "Sun XVR-500 3DLABS Wildcat support"
1388 depends on FB && PCI && SPARC64
1389 select FB_CFB_FILLRECT
1390 select FB_CFB_COPYAREA
1391 select FB_CFB_IMAGEBLIT
1392 help
1393 This is the framebuffer device for the Sun XVR-500 and similar
1394 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1395 only works on sparc64 systems where the system firwmare has
1396 mostly initialized the card already. It is treated as a
1397 completely dumb framebuffer device.
1398
1399config FB_XVR2500
1400 bool "Sun XVR-2500 3DLABS Wildcat support"
1401 depends on FB && PCI && SPARC64
1402 select FB_CFB_FILLRECT
1403 select FB_CFB_COPYAREA
1404 select FB_CFB_IMAGEBLIT
1405 help
1406 This is the framebuffer device for the Sun XVR-2500 and similar
1407 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1408 only works on sparc64 systems where the system firwmare has
1409 mostly initialized the card already. It is treated as a
1410 completely dumb framebuffer device.
1411
1383config FB_PCI 1412config FB_PCI
1384 bool "PCI framebuffers" 1413 bool "PCI framebuffers"
1385 depends on (FB = y) && PCI && SPARC 1414 depends on (FB = y) && PCI && SPARC
@@ -1491,7 +1520,7 @@ config FB_PXA
1491 This driver is also available as a module ( = code which can be 1520 This driver is also available as a module ( = code which can be
1492 inserted and removed from the running kernel whenever you want). The 1521 inserted and removed from the running kernel whenever you want). The
1493 module will be called pxafb. If you want to compile it as a module, 1522 module will be called pxafb. If you want to compile it as a module,
1494 say M here and read <file:Documentation/modules.txt>. 1523 say M here and read <file:Documentation/kbuild/modules.txt>.
1495 1524
1496 If unsure, say N. 1525 If unsure, say N.
1497 1526
@@ -1544,7 +1573,7 @@ config FB_W100
1544 This driver is also available as a module ( = code which can be 1573 This driver is also available as a module ( = code which can be
1545 inserted and removed from the running kernel whenever you want). The 1574 inserted and removed from the running kernel whenever you want). The
1546 module will be called w100fb. If you want to compile it as a module, 1575 module will be called w100fb. If you want to compile it as a module,
1547 say M here and read <file:Documentation/modules.txt>. 1576 say M here and read <file:Documentation/kbuild/modules.txt>.
1548 1577
1549 If unsure, say N. 1578 If unsure, say N.
1550 1579
@@ -1561,7 +1590,7 @@ config FB_S3C2410
1561 This driver is also available as a module ( = code which can be 1590 This driver is also available as a module ( = code which can be
1562 inserted and removed from the running kernel whenever you want). The 1591 inserted and removed from the running kernel whenever you want). The
1563 module will be called s3c2410fb. If you want to compile it as a module, 1592 module will be called s3c2410fb. If you want to compile it as a module,
1564 say M here and read <file:Documentation/modules.txt>. 1593 say M here and read <file:Documentation/kbuild/modules.txt>.
1565 1594
1566 If unsure, say N. 1595 If unsure, say N.
1567config FB_S3C2410_DEBUG 1596config FB_S3C2410_DEBUG
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 760305c8a841..558473d040d6 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -63,9 +63,12 @@ obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o
63obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o 63obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o
64obj-$(CONFIG_FB_SGIVW) += sgivwfb.o 64obj-$(CONFIG_FB_SGIVW) += sgivwfb.o
65obj-$(CONFIG_FB_ACORN) += acornfb.o 65obj-$(CONFIG_FB_ACORN) += acornfb.o
66obj-$(CONFIG_FB_ATARI) += atafb.o 66obj-$(CONFIG_FB_ATARI) += atafb.o c2p.o atafb_mfb.o \
67 atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o
67obj-$(CONFIG_FB_MAC) += macfb.o 68obj-$(CONFIG_FB_MAC) += macfb.o
68obj-$(CONFIG_FB_HGA) += hgafb.o 69obj-$(CONFIG_FB_HGA) += hgafb.o
70obj-$(CONFIG_FB_XVR500) += sunxvr500.o
71obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o
69obj-$(CONFIG_FB_IGA) += igafb.o 72obj-$(CONFIG_FB_IGA) += igafb.o
70obj-$(CONFIG_FB_APOLLO) += dnfb.o 73obj-$(CONFIG_FB_APOLLO) += dnfb.o
71obj-$(CONFIG_FB_Q40) += q40fb.o 74obj-$(CONFIG_FB_Q40) += q40fb.o
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index bffe2b946344..0038a0541c7e 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -2,7 +2,7 @@
2 * linux/drivers/video/atafb.c -- Atari builtin chipset frame buffer device 2 * linux/drivers/video/atafb.c -- Atari builtin chipset frame buffer device
3 * 3 *
4 * Copyright (C) 1994 Martin Schaller & Roman Hodek 4 * Copyright (C) 1994 Martin Schaller & Roman Hodek
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive 7 * License. See the file COPYING in the main directory of this archive
8 * for more details. 8 * for more details.
@@ -70,14 +70,8 @@
70#include <linux/fb.h> 70#include <linux/fb.h>
71#include <asm/atarikb.h> 71#include <asm/atarikb.h>
72 72
73#include <video/fbcon.h> 73#include "c2p.h"
74#include <video/fbcon-cfb8.h> 74#include "atafb.h"
75#include <video/fbcon-cfb16.h>
76#include <video/fbcon-iplan2p2.h>
77#include <video/fbcon-iplan2p4.h>
78#include <video/fbcon-iplan2p8.h>
79#include <video/fbcon-mfb.h>
80
81 75
82#define SWITCH_ACIA 0x01 /* modes for switch on OverScan */ 76#define SWITCH_ACIA 0x01 /* modes for switch on OverScan */
83#define SWITCH_SND6 0x40 77#define SWITCH_SND6 0x40
@@ -87,22 +81,48 @@
87 81
88#define up(x, r) (((x) + (r) - 1) & ~((r)-1)) 82#define up(x, r) (((x) + (r) - 1) & ~((r)-1))
89 83
84 /*
85 * Interface to the world
86 */
87
88static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info);
89static int atafb_set_par(struct fb_info *info);
90static int atafb_setcolreg(unsigned int regno, unsigned int red, unsigned int green,
91 unsigned int blue, unsigned int transp,
92 struct fb_info *info);
93static int atafb_blank(int blank, struct fb_info *info);
94static int atafb_pan_display(struct fb_var_screeninfo *var,
95 struct fb_info *info);
96static void atafb_fillrect(struct fb_info *info,
97 const struct fb_fillrect *rect);
98static void atafb_copyarea(struct fb_info *info,
99 const struct fb_copyarea *region);
100static void atafb_imageblit(struct fb_info *info, const struct fb_image *image);
101static int atafb_ioctl(struct fb_info *info, unsigned int cmd,
102 unsigned long arg);
103
90 104
91static int default_par=0; /* default resolution (0=none) */ 105static int default_par; /* default resolution (0=none) */
92 106
93static unsigned long default_mem_req=0; 107static unsigned long default_mem_req;
94 108
95static int hwscroll=-1; 109static int hwscroll = -1;
96 110
97static int use_hwscroll = 1; 111static int use_hwscroll = 1;
98 112
99static int sttt_xres=640,st_yres=400,tt_yres=480; 113static int sttt_xres = 640, st_yres = 400, tt_yres = 480;
100static int sttt_xres_virtual=640,sttt_yres_virtual=400; 114static int sttt_xres_virtual = 640, sttt_yres_virtual = 400;
101static int ovsc_offset=0, ovsc_addlen=0; 115static int ovsc_offset, ovsc_addlen;
116
117 /*
118 * Hardware parameters for current mode
119 */
102 120
103static struct atafb_par { 121static struct atafb_par {
104 void *screen_base; 122 void *screen_base;
105 int yres_virtual; 123 int yres_virtual;
124 u_long next_line;
125 u_long next_plane;
106#if defined ATAFB_TT || defined ATAFB_STE 126#if defined ATAFB_TT || defined ATAFB_STE
107 union { 127 union {
108 struct { 128 struct {
@@ -138,7 +158,7 @@ static struct atafb_par {
138/* Don't calculate an own resolution, and thus don't change the one found when 158/* Don't calculate an own resolution, and thus don't change the one found when
139 * booting (currently used for the Falcon to keep settings for internal video 159 * booting (currently used for the Falcon to keep settings for internal video
140 * hardware extensions (e.g. ScreenBlaster) */ 160 * hardware extensions (e.g. ScreenBlaster) */
141static int DontCalcRes = 0; 161static int DontCalcRes = 0;
142 162
143#ifdef ATAFB_FALCON 163#ifdef ATAFB_FALCON
144#define HHT hw.falcon.hht 164#define HHT hw.falcon.hht
@@ -163,83 +183,84 @@ static int DontCalcRes = 0;
163#define VMO_PREMASK 0x0c 183#define VMO_PREMASK 0x0c
164#endif 184#endif
165 185
166static struct fb_info fb_info; 186static struct fb_info fb_info = {
187 .fix = {
188 .id = "Atari ",
189 .visual = FB_VISUAL_PSEUDOCOLOR,
190 .accel = FB_ACCEL_NONE,
191 }
192};
167 193
168static void *screen_base; /* base address of screen */ 194static void *screen_base; /* base address of screen */
169static void *real_screen_base; /* (only for Overscan) */ 195static void *real_screen_base; /* (only for Overscan) */
170 196
171static int screen_len; 197static int screen_len;
172 198
173static int current_par_valid=0; 199static int current_par_valid;
174 200
175static int mono_moni=0; 201static int mono_moni;
176
177static struct display disp;
178 202
179 203
180#ifdef ATAFB_EXT 204#ifdef ATAFB_EXT
181/* external video handling */
182 205
183static unsigned external_xres; 206/* external video handling */
184static unsigned external_xres_virtual; 207static unsigned int external_xres;
185static unsigned external_yres; 208static unsigned int external_xres_virtual;
186/* not needed - atafb will never support panning/hardwarescroll with external 209static unsigned int external_yres;
187 * static unsigned external_yres_virtual;
188*/
189 210
190static unsigned external_depth; 211/*
191static int external_pmode; 212 * not needed - atafb will never support panning/hardwarescroll with external
192static void *external_addr = 0; 213 * static unsigned int external_yres_virtual;
193static unsigned long external_len; 214 */
194static unsigned long external_vgaiobase = 0; 215static unsigned int external_depth;
195static unsigned int external_bitspercol = 6; 216static int external_pmode;
196 217static void *external_addr;
197/* 218static unsigned long external_len;
198JOE <joe@amber.dinoco.de>: 219static unsigned long external_vgaiobase;
199added card type for external driver, is only needed for 220static unsigned int external_bitspercol = 6;
200colormap handling.
201*/
202 221
222/*
223 * JOE <joe@amber.dinoco.de>:
224 * added card type for external driver, is only needed for
225 * colormap handling.
226 */
203enum cardtype { IS_VGA, IS_MV300 }; 227enum cardtype { IS_VGA, IS_MV300 };
204static enum cardtype external_card_type = IS_VGA; 228static enum cardtype external_card_type = IS_VGA;
205 229
206/* 230/*
207The MV300 mixes the color registers. So we need an array of munged 231 * The MV300 mixes the color registers. So we need an array of munged
208indices in order to access the correct reg. 232 * indices in order to access the correct reg.
209*/ 233 */
210static int MV300_reg_1bit[2]={0,1}; 234static int MV300_reg_1bit[2] = {
211static int MV300_reg_4bit[16]={ 235 0, 1
2120, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; 236};
213static int MV300_reg_8bit[256]={ 237static int MV300_reg_4bit[16] = {
2140, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 238 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
2158, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 239};
2164, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 240static int MV300_reg_8bit[256] = {
21712, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 241 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
2182, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 242 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
21910, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 243 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
2206, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 244 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
22114, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 245 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
2221, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 246 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
2239, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 247 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
2245, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 248 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
22513, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 249 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
2263, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 250 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
22711, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 251 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
2287, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 252 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
22915, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 }; 253 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
254 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
255 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
256 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
257};
230 258
231static int *MV300_reg = MV300_reg_8bit; 259static int *MV300_reg = MV300_reg_8bit;
232
233/*
234And on the MV300 it's difficult to read out the hardware palette. So we
235just keep track of the set colors in our own array here, and use that!
236*/
237
238static struct { unsigned char red,green,blue,pad; } ext_color[256];
239#endif /* ATAFB_EXT */ 260#endif /* ATAFB_EXT */
240 261
241 262
242static int inverse=0; 263static int inverse;
243 264
244extern int fontheight_8x8; 265extern int fontheight_8x8;
245extern int fontwidth_8x8; 266extern int fontwidth_8x8;
@@ -249,96 +270,154 @@ extern int fontheight_8x16;
249extern int fontwidth_8x16; 270extern int fontwidth_8x16;
250extern unsigned char fontdata_8x16[]; 271extern unsigned char fontdata_8x16[];
251 272
273/*
274 * struct fb_ops {
275 * * open/release and usage marking
276 * struct module *owner;
277 * int (*fb_open)(struct fb_info *info, int user);
278 * int (*fb_release)(struct fb_info *info, int user);
279 *
280 * * For framebuffers with strange non linear layouts or that do not
281 * * work with normal memory mapped access
282 * ssize_t (*fb_read)(struct file *file, char __user *buf, size_t count, loff_t *ppos);
283 * ssize_t (*fb_write)(struct file *file, const char __user *buf, size_t count, loff_t *ppos);
284 *
285 * * checks var and eventually tweaks it to something supported,
286 * * DOES NOT MODIFY PAR *
287 * int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
288 *
289 * * set the video mode according to info->var *
290 * int (*fb_set_par)(struct fb_info *info);
291 *
292 * * set color register *
293 * int (*fb_setcolreg)(unsigned int regno, unsigned int red, unsigned int green,
294 * unsigned int blue, unsigned int transp, struct fb_info *info);
295 *
296 * * set color registers in batch *
297 * int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
298 *
299 * * blank display *
300 * int (*fb_blank)(int blank, struct fb_info *info);
301 *
302 * * pan display *
303 * int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
304 *
305 * *** The meat of the drawing engine ***
306 * * Draws a rectangle *
307 * void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
308 * * Copy data from area to another *
309 * void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
310 * * Draws a image to the display *
311 * void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
312 *
313 * * Draws cursor *
314 * int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
315 *
316 * * Rotates the display *
317 * void (*fb_rotate)(struct fb_info *info, int angle);
318 *
319 * * wait for blit idle, optional *
320 * int (*fb_sync)(struct fb_info *info);
321 *
322 * * perform fb specific ioctl (optional) *
323 * int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
324 * unsigned long arg);
325 *
326 * * Handle 32bit compat ioctl (optional) *
327 * int (*fb_compat_ioctl)(struct fb_info *info, unsigned int cmd,
328 * unsigned long arg);
329 *
330 * * perform fb specific mmap *
331 * int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
332 *
333 * * save current hardware state *
334 * void (*fb_save_state)(struct fb_info *info);
335 *
336 * * restore saved state *
337 * void (*fb_restore_state)(struct fb_info *info);
338 * } ;
339 */
340
341
252/* ++roman: This structure abstracts from the underlying hardware (ST(e), 342/* ++roman: This structure abstracts from the underlying hardware (ST(e),
253 * TT, or Falcon. 343 * TT, or Falcon.
254 * 344 *
255 * int (*detect)( void ) 345 * int (*detect)(void)
256 * This function should detect the current video mode settings and 346 * This function should detect the current video mode settings and
257 * store them in atafb_predefined[0] for later reference by the 347 * store them in atafb_predefined[0] for later reference by the
258 * user. Return the index+1 of an equivalent predefined mode or 0 348 * user. Return the index+1 of an equivalent predefined mode or 0
259 * if there is no such. 349 * if there is no such.
260 * 350 *
261 * int (*encode_fix)( struct fb_fix_screeninfo *fix, 351 * int (*encode_fix)(struct fb_fix_screeninfo *fix,
262 * struct atafb_par *par ) 352 * struct atafb_par *par)
263 * This function should fill in the 'fix' structure based on the 353 * This function should fill in the 'fix' structure based on the
264 * values in the 'par' structure. 354 * values in the 'par' structure.
265 * 355 * !!! Obsolete, perhaps !!!
266 * int (*decode_var)( struct fb_var_screeninfo *var, 356 *
267 * struct atafb_par *par ) 357 * int (*decode_var)(struct fb_var_screeninfo *var,
358 * struct atafb_par *par)
268 * Get the video params out of 'var'. If a value doesn't fit, round 359 * Get the video params out of 'var'. If a value doesn't fit, round
269 * it up, if it's too big, return EINVAL. 360 * it up, if it's too big, return EINVAL.
270 * Round up in the following order: bits_per_pixel, xres, yres, 361 * Round up in the following order: bits_per_pixel, xres, yres,
271 * xres_virtual, yres_virtual, xoffset, yoffset, grayscale, bitfields, 362 * xres_virtual, yres_virtual, xoffset, yoffset, grayscale, bitfields,
272 * horizontal timing, vertical timing. 363 * horizontal timing, vertical timing.
273 * 364 *
274 * int (*encode_var)( struct fb_var_screeninfo *var, 365 * int (*encode_var)(struct fb_var_screeninfo *var,
275 * struct atafb_par *par ); 366 * struct atafb_par *par);
276 * Fill the 'var' structure based on the values in 'par' and maybe 367 * Fill the 'var' structure based on the values in 'par' and maybe
277 * other values read out of the hardware. 368 * other values read out of the hardware.
278 * 369 *
279 * void (*get_par)( struct atafb_par *par ) 370 * void (*get_par)(struct atafb_par *par)
280 * Fill the hardware's 'par' structure. 371 * Fill the hardware's 'par' structure.
281 * 372 * !!! Used only by detect() !!!
282 * void (*set_par)( struct atafb_par *par ) 373 *
374 * void (*set_par)(struct atafb_par *par)
283 * Set the hardware according to 'par'. 375 * Set the hardware according to 'par'.
284 *
285 * int (*getcolreg)( unsigned regno, unsigned *red,
286 * unsigned *green, unsigned *blue,
287 * unsigned *transp, struct fb_info *info )
288 * Read a single color register and split it into
289 * colors/transparent. Return != 0 for invalid regno.
290 * 376 *
291 * void (*set_screen_base)(void *s_base) 377 * void (*set_screen_base)(void *s_base)
292 * Set the base address of the displayed frame buffer. Only called 378 * Set the base address of the displayed frame buffer. Only called
293 * if yres_virtual > yres or xres_virtual > xres. 379 * if yres_virtual > yres or xres_virtual > xres.
294 * 380 *
295 * int (*blank)( int blank_mode ) 381 * int (*blank)(int blank_mode)
296 * Blank the screen if blank_mode!=0, else unblank. If blank==NULL then 382 * Blank the screen if blank_mode != 0, else unblank. If blank == NULL then
297 * the caller blanks by setting the CLUT to all black. Return 0 if blanking 383 * the caller blanks by setting the CLUT to all black. Return 0 if blanking
298 * succeeded, !=0 if un-/blanking failed due to e.g. a video mode which 384 * succeeded, !=0 if un-/blanking failed due to e.g. a video mode which
299 * doesn't support it. Implements VESA suspend and powerdown modes on 385 * doesn't support it. Implements VESA suspend and powerdown modes on
300 * hardware that supports disabling hsync/vsync: 386 * hardware that supports disabling hsync/vsync:
301 * blank_mode==2: suspend vsync, 3:suspend hsync, 4: powerdown. 387 * blank_mode == 2: suspend vsync, 3:suspend hsync, 4: powerdown.
302 */ 388 */
303 389
304static struct fb_hwswitch { 390static struct fb_hwswitch {
305 int (*detect)( void ); 391 int (*detect)(void);
306 int (*encode_fix)( struct fb_fix_screeninfo *fix, 392 int (*encode_fix)(struct fb_fix_screeninfo *fix,
307 struct atafb_par *par ); 393 struct atafb_par *par);
308 int (*decode_var)( struct fb_var_screeninfo *var, 394 int (*decode_var)(struct fb_var_screeninfo *var,
309 struct atafb_par *par ); 395 struct atafb_par *par);
310 int (*encode_var)( struct fb_var_screeninfo *var, 396 int (*encode_var)(struct fb_var_screeninfo *var,
311 struct atafb_par *par ); 397 struct atafb_par *par);
312 void (*get_par)( struct atafb_par *par ); 398 void (*get_par)(struct atafb_par *par);
313 void (*set_par)( struct atafb_par *par ); 399 void (*set_par)(struct atafb_par *par);
314 int (*getcolreg)( unsigned regno, unsigned *red,
315 unsigned *green, unsigned *blue,
316 unsigned *transp, struct fb_info *info );
317 void (*set_screen_base)(void *s_base); 400 void (*set_screen_base)(void *s_base);
318 int (*blank)( int blank_mode ); 401 int (*blank)(int blank_mode);
319 int (*pan_display)( struct fb_var_screeninfo *var, 402 int (*pan_display)(struct fb_var_screeninfo *var,
320 struct atafb_par *par); 403 struct fb_info *info);
321} *fbhw; 404} *fbhw;
322 405
323static char *autodetect_names[] = {"autodetect", NULL}; 406static char *autodetect_names[] = { "autodetect", NULL };
324static char *stlow_names[] = {"stlow", NULL}; 407static char *stlow_names[] = { "stlow", NULL };
325static char *stmid_names[] = {"stmid", "default5", NULL}; 408static char *stmid_names[] = { "stmid", "default5", NULL };
326static char *sthigh_names[] = {"sthigh", "default4", NULL}; 409static char *sthigh_names[] = { "sthigh", "default4", NULL };
327static char *ttlow_names[] = {"ttlow", NULL}; 410static char *ttlow_names[] = { "ttlow", NULL };
328static char *ttmid_names[]= {"ttmid", "default1", NULL}; 411static char *ttmid_names[] = { "ttmid", "default1", NULL };
329static char *tthigh_names[]= {"tthigh", "default2", NULL}; 412static char *tthigh_names[] = { "tthigh", "default2", NULL };
330static char *vga2_names[] = {"vga2", NULL}; 413static char *vga2_names[] = { "vga2", NULL };
331static char *vga4_names[] = {"vga4", NULL}; 414static char *vga4_names[] = { "vga4", NULL };
332static char *vga16_names[] = {"vga16", "default3", NULL}; 415static char *vga16_names[] = { "vga16", "default3", NULL };
333static char *vga256_names[] = {"vga256", NULL}; 416static char *vga256_names[] = { "vga256", NULL };
334static char *falh2_names[] = {"falh2", NULL}; 417static char *falh2_names[] = { "falh2", NULL };
335static char *falh16_names[] = {"falh16", NULL}; 418static char *falh16_names[] = { "falh16", NULL };
336 419
337static char **fb_var_names[] = { 420static char **fb_var_names[] = {
338 /* Writing the name arrays directly in this array (via "(char *[]){...}")
339 * crashes gcc 2.5.8 (sigsegv) if the inner array
340 * contains more than two items. I've also seen that all elements
341 * were identical to the last (my cross-gcc) :-(*/
342 autodetect_names, 421 autodetect_names,
343 stlow_names, 422 stlow_names,
344 stmid_names, 423 stmid_names,
@@ -353,18 +432,17 @@ static char **fb_var_names[] = {
353 falh2_names, 432 falh2_names,
354 falh16_names, 433 falh16_names,
355 NULL 434 NULL
356 /* ,NULL */ /* this causes a sigsegv on my gcc-2.5.8 */
357}; 435};
358 436
359static struct fb_var_screeninfo atafb_predefined[] = { 437static struct fb_var_screeninfo atafb_predefined[] = {
360 /* 438 /*
361 * yres_virtual==0 means use hw-scrolling if possible, else yres 439 * yres_virtual == 0 means use hw-scrolling if possible, else yres
362 */ 440 */
363 { /* autodetect */ 441 { /* autodetect */
364 0, 0, 0, 0, 0, 0, 0, 0, /* xres-grayscale */ 442 0, 0, 0, 0, 0, 0, 0, 0, /* xres-grayscale */
365 {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, /* red green blue tran*/ 443 {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, /* red green blue tran*/
366 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, 444 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
367 { /* st low */ 445 { /* st low */
368 320, 200, 320, 0, 0, 0, 4, 0, 446 320, 200, 320, 0, 0, 0, 4, 0,
369 {0, 4, 0}, {0, 4, 0}, {0, 4, 0}, {0, 0, 0}, 447 {0, 4, 0}, {0, 4, 0}, {0, 4, 0}, {0, 0, 0},
370 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, 448 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -414,27 +492,100 @@ static struct fb_var_screeninfo atafb_predefined[] = {
414 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, 492 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
415}; 493};
416 494
417static int num_atafb_predefined=ARRAY_SIZE(atafb_predefined); 495static int num_atafb_predefined = ARRAY_SIZE(atafb_predefined);
418 496
497static struct fb_videomode atafb_modedb[] __initdata = {
498 /*
499 * Atari Video Modes
500 *
501 * If you change these, make sure to update DEFMODE_* as well!
502 */
419 503
420static int 504 /*
421get_video_mode(char *vname) 505 * ST/TT Video Modes
506 */
507
508 {
509 /* 320x200, 15 kHz, 60 Hz (ST low) */
510 "st-low", 60, 320, 200, 32000, 32, 16, 31, 14, 96, 4,
511 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
512 }, {
513 /* 640x200, 15 kHz, 60 Hz (ST medium) */
514 "st-mid", 60, 640, 200, 32000, 32, 16, 31, 14, 96, 4,
515 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
516 }, {
517 /* 640x400, 30.25 kHz, 63.5 Hz (ST high) */
518 "st-high", 63, 640, 400, 32000, 128, 0, 40, 14, 128, 4,
519 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
520 }, {
521 /* 320x480, 15 kHz, 60 Hz (TT low) */
522 "tt-low", 60, 320, 480, 31041, 120, 100, 8, 16, 140, 30,
523 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
524 }, {
525 /* 640x480, 29 kHz, 57 Hz (TT medium) */
526 "tt-mid", 60, 640, 480, 31041, 120, 100, 8, 16, 140, 30,
527 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
528 }, {
529 /* 1280x960, 29 kHz, 60 Hz (TT high) */
530 "tt-high", 57, 640, 960, 31041, 120, 100, 8, 16, 140, 30,
531 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
532 },
533
534 /*
535 * VGA Video Modes
536 */
537
538 {
539 /* 640x480, 31 kHz, 60 Hz (VGA) */
540 "vga", 63.5, 640, 480, 32000, 18, 42, 31, 11, 96, 3,
541 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
542 }, {
543 /* 640x400, 31 kHz, 70 Hz (VGA) */
544 "vga70", 70, 640, 400, 32000, 18, 42, 31, 11, 96, 3,
545 FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
546 },
547
548 /*
549 * Falcon HiRes Video Modes
550 */
551
552 {
553 /* 896x608, 31 kHz, 60 Hz (Falcon High) */
554 "falh", 60, 896, 608, 32000, 18, 42, 31, 1, 96,3,
555 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
556 },
557};
558
559#define NUM_TOTAL_MODES ARRAY_SIZE(atafb_modedb)
560
561static char *mode_option __initdata = NULL;
562
563 /* default modes */
564
565#define DEFMODE_TT 5 /* "tt-high" for TT */
566#define DEFMODE_F30 7 /* "vga70" for Falcon */
567#define DEFMODE_STE 2 /* "st-high" for ST/E */
568#define DEFMODE_EXT 6 /* "vga" for external */
569
570
571static int get_video_mode(char *vname)
422{ 572{
423 char ***name_list; 573 char ***name_list;
424 char **name; 574 char **name;
425 int i; 575 int i;
426 name_list=fb_var_names; 576
427 for (i = 0 ; i < num_atafb_predefined ; i++) { 577 name_list = fb_var_names;
428 name=*(name_list++); 578 for (i = 0; i < num_atafb_predefined; i++) {
429 if (! name || ! *name) 579 name = *name_list++;
430 break; 580 if (!name || !*name)
431 while (*name) { 581 break;
432 if (! strcmp(vname, *name)) 582 while (*name) {
433 return i+1; 583 if (!strcmp(vname, *name))
434 name++; 584 return i + 1;
585 name++;
586 }
435 } 587 }
436 } 588 return 0;
437 return 0;
438} 589}
439 590
440 591
@@ -443,93 +594,84 @@ get_video_mode(char *vname)
443 594
444#ifdef ATAFB_TT 595#ifdef ATAFB_TT
445 596
446static int tt_encode_fix( struct fb_fix_screeninfo *fix, 597static int tt_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
447 struct atafb_par *par )
448
449{ 598{
450 int mode; 599 int mode;
451 600
452 strcpy(fix->id,"Atari Builtin"); 601 strcpy(fix->id, "Atari Builtin");
453 fix->smem_start = (unsigned long)real_screen_base; 602 fix->smem_start = (unsigned long)real_screen_base;
454 fix->smem_len = screen_len; 603 fix->smem_len = screen_len;
455 fix->type=FB_TYPE_INTERLEAVED_PLANES; 604 fix->type = FB_TYPE_INTERLEAVED_PLANES;
456 fix->type_aux=2; 605 fix->type_aux = 2;
457 fix->visual=FB_VISUAL_PSEUDOCOLOR; 606 fix->visual = FB_VISUAL_PSEUDOCOLOR;
458 mode = par->hw.tt.mode & TT_SHIFTER_MODEMASK; 607 mode = par->hw.tt.mode & TT_SHIFTER_MODEMASK;
459 if (mode == TT_SHIFTER_TTHIGH || mode == TT_SHIFTER_STHIGH) { 608 if (mode == TT_SHIFTER_TTHIGH || mode == TT_SHIFTER_STHIGH) {
460 fix->type=FB_TYPE_PACKED_PIXELS; 609 fix->type = FB_TYPE_PACKED_PIXELS;
461 fix->type_aux=0; 610 fix->type_aux = 0;
462 if (mode == TT_SHIFTER_TTHIGH) 611 if (mode == TT_SHIFTER_TTHIGH)
463 fix->visual=FB_VISUAL_MONO01; 612 fix->visual = FB_VISUAL_MONO01;
464 } 613 }
465 fix->xpanstep=0; 614 fix->xpanstep = 0;
466 fix->ypanstep=1; 615 fix->ypanstep = 1;
467 fix->ywrapstep=0; 616 fix->ywrapstep = 0;
468 fix->line_length = 0; 617 fix->line_length = 0;
469 fix->accel = FB_ACCEL_ATARIBLITT; 618 fix->accel = FB_ACCEL_ATARIBLITT;
470 return 0; 619 return 0;
471} 620}
472 621
473 622static int tt_decode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
474static int tt_decode_var( struct fb_var_screeninfo *var,
475 struct atafb_par *par )
476{ 623{
477 int xres=var->xres; 624 int xres = var->xres;
478 int yres=var->yres; 625 int yres = var->yres;
479 int bpp=var->bits_per_pixel; 626 int bpp = var->bits_per_pixel;
480 int linelen; 627 int linelen;
481 int yres_virtual = var->yres_virtual; 628 int yres_virtual = var->yres_virtual;
482 629
483 if (mono_moni) { 630 if (mono_moni) {
484 if (bpp > 1 || xres > sttt_xres*2 || yres >tt_yres*2) 631 if (bpp > 1 || xres > sttt_xres * 2 || yres > tt_yres * 2)
485 return -EINVAL; 632 return -EINVAL;
486 par->hw.tt.mode=TT_SHIFTER_TTHIGH; 633 par->hw.tt.mode = TT_SHIFTER_TTHIGH;
487 xres=sttt_xres*2; 634 xres = sttt_xres * 2;
488 yres=tt_yres*2; 635 yres = tt_yres * 2;
489 bpp=1; 636 bpp = 1;
490 } else { 637 } else {
491 if (bpp > 8 || xres > sttt_xres || yres > tt_yres) 638 if (bpp > 8 || xres > sttt_xres || yres > tt_yres)
492 return -EINVAL; 639 return -EINVAL;
493 if (bpp > 4) { 640 if (bpp > 4) {
494 if (xres > sttt_xres/2 || yres > tt_yres) 641 if (xres > sttt_xres / 2 || yres > tt_yres)
495 return -EINVAL; 642 return -EINVAL;
496 par->hw.tt.mode=TT_SHIFTER_TTLOW; 643 par->hw.tt.mode = TT_SHIFTER_TTLOW;
497 xres=sttt_xres/2; 644 xres = sttt_xres / 2;
498 yres=tt_yres; 645 yres = tt_yres;
499 bpp=8; 646 bpp = 8;
500 } 647 } else if (bpp > 2) {
501 else if (bpp > 2) {
502 if (xres > sttt_xres || yres > tt_yres) 648 if (xres > sttt_xres || yres > tt_yres)
503 return -EINVAL; 649 return -EINVAL;
504 if (xres > sttt_xres/2 || yres > st_yres/2) { 650 if (xres > sttt_xres / 2 || yres > st_yres / 2) {
505 par->hw.tt.mode=TT_SHIFTER_TTMID; 651 par->hw.tt.mode = TT_SHIFTER_TTMID;
506 xres=sttt_xres; 652 xres = sttt_xres;
507 yres=tt_yres; 653 yres = tt_yres;
508 bpp=4; 654 bpp = 4;
509 } 655 } else {
510 else { 656 par->hw.tt.mode = TT_SHIFTER_STLOW;
511 par->hw.tt.mode=TT_SHIFTER_STLOW; 657 xres = sttt_xres / 2;
512 xres=sttt_xres/2; 658 yres = st_yres / 2;
513 yres=st_yres/2; 659 bpp = 4;
514 bpp=4;
515 } 660 }
516 } 661 } else if (bpp > 1) {
517 else if (bpp > 1) { 662 if (xres > sttt_xres || yres > st_yres / 2)
518 if (xres > sttt_xres || yres > st_yres/2)
519 return -EINVAL; 663 return -EINVAL;
520 par->hw.tt.mode=TT_SHIFTER_STMID; 664 par->hw.tt.mode = TT_SHIFTER_STMID;
521 xres=sttt_xres; 665 xres = sttt_xres;
522 yres=st_yres/2; 666 yres = st_yres / 2;
523 bpp=2; 667 bpp = 2;
524 } 668 } else if (var->xres > sttt_xres || var->yres > st_yres) {
525 else if (var->xres > sttt_xres || var->yres > st_yres) {
526 return -EINVAL; 669 return -EINVAL;
527 } 670 } else {
528 else { 671 par->hw.tt.mode = TT_SHIFTER_STHIGH;
529 par->hw.tt.mode=TT_SHIFTER_STHIGH; 672 xres = sttt_xres;
530 xres=sttt_xres; 673 yres = st_yres;
531 yres=st_yres; 674 bpp = 1;
532 bpp=1;
533 } 675 }
534 } 676 }
535 if (yres_virtual <= 0) 677 if (yres_virtual <= 0)
@@ -537,10 +679,10 @@ static int tt_decode_var( struct fb_var_screeninfo *var,
537 else if (yres_virtual < yres) 679 else if (yres_virtual < yres)
538 yres_virtual = yres; 680 yres_virtual = yres;
539 if (var->sync & FB_SYNC_EXT) 681 if (var->sync & FB_SYNC_EXT)
540 par->hw.tt.sync=0; 682 par->hw.tt.sync = 0;
541 else 683 else
542 par->hw.tt.sync=1; 684 par->hw.tt.sync = 1;
543 linelen=xres*bpp/8; 685 linelen = xres * bpp / 8;
544 if (yres_virtual * linelen > screen_len && screen_len) 686 if (yres_virtual * linelen > screen_len && screen_len)
545 return -EINVAL; 687 return -EINVAL;
546 if (yres * linelen > screen_len && screen_len) 688 if (yres * linelen > screen_len && screen_len)
@@ -552,154 +694,123 @@ static int tt_decode_var( struct fb_var_screeninfo *var,
552 return 0; 694 return 0;
553} 695}
554 696
555static int tt_encode_var( struct fb_var_screeninfo *var, 697static int tt_encode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
556 struct atafb_par *par )
557{ 698{
558 int linelen; 699 int linelen;
559 memset(var, 0, sizeof(struct fb_var_screeninfo)); 700 memset(var, 0, sizeof(struct fb_var_screeninfo));
560 var->red.offset=0; 701 var->red.offset = 0;
561 var->red.length=4; 702 var->red.length = 4;
562 var->red.msb_right=0; 703 var->red.msb_right = 0;
563 var->grayscale=0; 704 var->grayscale = 0;
564 705
565 var->pixclock=31041; 706 var->pixclock = 31041;
566 var->left_margin=120; /* these may be incorrect */ 707 var->left_margin = 120; /* these may be incorrect */
567 var->right_margin=100; 708 var->right_margin = 100;
568 var->upper_margin=8; 709 var->upper_margin = 8;
569 var->lower_margin=16; 710 var->lower_margin = 16;
570 var->hsync_len=140; 711 var->hsync_len = 140;
571 var->vsync_len=30; 712 var->vsync_len = 30;
572 713
573 var->height=-1; 714 var->height = -1;
574 var->width=-1; 715 var->width = -1;
575 716
576 if (par->hw.tt.sync & 1) 717 if (par->hw.tt.sync & 1)
577 var->sync=0; 718 var->sync = 0;
578 else 719 else
579 var->sync=FB_SYNC_EXT; 720 var->sync = FB_SYNC_EXT;
580 721
581 switch (par->hw.tt.mode & TT_SHIFTER_MODEMASK) { 722 switch (par->hw.tt.mode & TT_SHIFTER_MODEMASK) {
582 case TT_SHIFTER_STLOW: 723 case TT_SHIFTER_STLOW:
583 var->xres=sttt_xres/2; 724 var->xres = sttt_xres / 2;
584 var->xres_virtual=sttt_xres_virtual/2; 725 var->xres_virtual = sttt_xres_virtual / 2;
585 var->yres=st_yres/2; 726 var->yres = st_yres / 2;
586 var->bits_per_pixel=4; 727 var->bits_per_pixel = 4;
587 break; 728 break;
588 case TT_SHIFTER_STMID: 729 case TT_SHIFTER_STMID:
589 var->xres=sttt_xres; 730 var->xres = sttt_xres;
590 var->xres_virtual=sttt_xres_virtual; 731 var->xres_virtual = sttt_xres_virtual;
591 var->yres=st_yres/2; 732 var->yres = st_yres / 2;
592 var->bits_per_pixel=2; 733 var->bits_per_pixel = 2;
593 break; 734 break;
594 case TT_SHIFTER_STHIGH: 735 case TT_SHIFTER_STHIGH:
595 var->xres=sttt_xres; 736 var->xres = sttt_xres;
596 var->xres_virtual=sttt_xres_virtual; 737 var->xres_virtual = sttt_xres_virtual;
597 var->yres=st_yres; 738 var->yres = st_yres;
598 var->bits_per_pixel=1; 739 var->bits_per_pixel = 1;
599 break; 740 break;
600 case TT_SHIFTER_TTLOW: 741 case TT_SHIFTER_TTLOW:
601 var->xres=sttt_xres/2; 742 var->xres = sttt_xres / 2;
602 var->xres_virtual=sttt_xres_virtual/2; 743 var->xres_virtual = sttt_xres_virtual / 2;
603 var->yres=tt_yres; 744 var->yres = tt_yres;
604 var->bits_per_pixel=8; 745 var->bits_per_pixel = 8;
605 break; 746 break;
606 case TT_SHIFTER_TTMID: 747 case TT_SHIFTER_TTMID:
607 var->xres=sttt_xres; 748 var->xres = sttt_xres;
608 var->xres_virtual=sttt_xres_virtual; 749 var->xres_virtual = sttt_xres_virtual;
609 var->yres=tt_yres; 750 var->yres = tt_yres;
610 var->bits_per_pixel=4; 751 var->bits_per_pixel = 4;
611 break; 752 break;
612 case TT_SHIFTER_TTHIGH: 753 case TT_SHIFTER_TTHIGH:
613 var->red.length=0; 754 var->red.length = 0;
614 var->xres=sttt_xres*2; 755 var->xres = sttt_xres * 2;
615 var->xres_virtual=sttt_xres_virtual*2; 756 var->xres_virtual = sttt_xres_virtual * 2;
616 var->yres=tt_yres*2; 757 var->yres = tt_yres * 2;
617 var->bits_per_pixel=1; 758 var->bits_per_pixel = 1;
618 break; 759 break;
619 } 760 }
620 var->blue=var->green=var->red; 761 var->blue = var->green = var->red;
621 var->transp.offset=0; 762 var->transp.offset = 0;
622 var->transp.length=0; 763 var->transp.length = 0;
623 var->transp.msb_right=0; 764 var->transp.msb_right = 0;
624 linelen=var->xres_virtual * var->bits_per_pixel / 8; 765 linelen = var->xres_virtual * var->bits_per_pixel / 8;
625 if (! use_hwscroll) 766 if (!use_hwscroll)
626 var->yres_virtual=var->yres; 767 var->yres_virtual = var->yres;
627 else if (screen_len) { 768 else if (screen_len) {
628 if (par->yres_virtual) 769 if (par->yres_virtual)
629 var->yres_virtual = par->yres_virtual; 770 var->yres_virtual = par->yres_virtual;
630 else 771 else
631 /* yres_virtual==0 means use maximum */ 772 /* yres_virtual == 0 means use maximum */
632 var->yres_virtual = screen_len / linelen; 773 var->yres_virtual = screen_len / linelen;
633 } else { 774 } else {
634 if (hwscroll < 0) 775 if (hwscroll < 0)
635 var->yres_virtual = 2 * var->yres; 776 var->yres_virtual = 2 * var->yres;
636 else 777 else
637 var->yres_virtual=var->yres+hwscroll * 16; 778 var->yres_virtual = var->yres + hwscroll * 16;
638 } 779 }
639 var->xoffset=0; 780 var->xoffset = 0;
640 if (screen_base) 781 if (screen_base)
641 var->yoffset=(par->screen_base - screen_base)/linelen; 782 var->yoffset = (par->screen_base - screen_base) / linelen;
642 else 783 else
643 var->yoffset=0; 784 var->yoffset = 0;
644 var->nonstd=0; 785 var->nonstd = 0;
645 var->activate=0; 786 var->activate = 0;
646 var->vmode=FB_VMODE_NONINTERLACED; 787 var->vmode = FB_VMODE_NONINTERLACED;
647 return 0; 788 return 0;
648} 789}
649 790
650 791static void tt_get_par(struct atafb_par *par)
651static void tt_get_par( struct atafb_par *par )
652{ 792{
653 unsigned long addr; 793 unsigned long addr;
654 par->hw.tt.mode=shifter_tt.tt_shiftmode; 794 par->hw.tt.mode = shifter_tt.tt_shiftmode;
655 par->hw.tt.sync=shifter.syncmode; 795 par->hw.tt.sync = shifter.syncmode;
656 addr = ((shifter.bas_hi & 0xff) << 16) | 796 addr = ((shifter.bas_hi & 0xff) << 16) |
657 ((shifter.bas_md & 0xff) << 8) | 797 ((shifter.bas_md & 0xff) << 8) |
658 ((shifter.bas_lo & 0xff)); 798 ((shifter.bas_lo & 0xff));
659 par->screen_base = phys_to_virt(addr); 799 par->screen_base = phys_to_virt(addr);
660} 800}
661 801
662static void tt_set_par( struct atafb_par *par ) 802static void tt_set_par(struct atafb_par *par)
663{ 803{
664 shifter_tt.tt_shiftmode=par->hw.tt.mode; 804 shifter_tt.tt_shiftmode = par->hw.tt.mode;
665 shifter.syncmode=par->hw.tt.sync; 805 shifter.syncmode = par->hw.tt.sync;
666 /* only set screen_base if really necessary */ 806 /* only set screen_base if really necessary */
667 if (current_par.screen_base != par->screen_base) 807 if (current_par.screen_base != par->screen_base)
668 fbhw->set_screen_base(par->screen_base); 808 fbhw->set_screen_base(par->screen_base);
669} 809}
670 810
671 811static int tt_setcolreg(unsigned int regno, unsigned int red,
672static int tt_getcolreg(unsigned regno, unsigned *red, 812 unsigned int green, unsigned int blue,
673 unsigned *green, unsigned *blue, 813 unsigned int transp, struct fb_info *info)
674 unsigned *transp, struct fb_info *info)
675{
676 int t, col;
677
678 if ((shifter_tt.tt_shiftmode & TT_SHIFTER_MODEMASK) == TT_SHIFTER_STHIGH)
679 regno += 254;
680 if (regno > 255)
681 return 1;
682 t = tt_palette[regno];
683 col = t & 15;
684 col |= col << 4;
685 col |= col << 8;
686 *blue = col;
687 col = (t >> 4) & 15;
688 col |= col << 4;
689 col |= col << 8;
690 *green = col;
691 col = (t >> 8) & 15;
692 col |= col << 4;
693 col |= col << 8;
694 *red = col;
695 *transp = 0;
696 return 0;
697}
698
699
700static int tt_setcolreg(unsigned regno, unsigned red,
701 unsigned green, unsigned blue,
702 unsigned transp, struct fb_info *info)
703{ 814{
704 if ((shifter_tt.tt_shiftmode & TT_SHIFTER_MODEMASK) == TT_SHIFTER_STHIGH) 815 if ((shifter_tt.tt_shiftmode & TT_SHIFTER_MODEMASK) == TT_SHIFTER_STHIGH)
705 regno += 254; 816 regno += 254;
@@ -708,15 +819,14 @@ static int tt_setcolreg(unsigned regno, unsigned red,
708 tt_palette[regno] = (((red >> 12) << 8) | ((green >> 12) << 4) | 819 tt_palette[regno] = (((red >> 12) << 8) | ((green >> 12) << 4) |
709 (blue >> 12)); 820 (blue >> 12));
710 if ((shifter_tt.tt_shiftmode & TT_SHIFTER_MODEMASK) == 821 if ((shifter_tt.tt_shiftmode & TT_SHIFTER_MODEMASK) ==
711 TT_SHIFTER_STHIGH && regno == 254) 822 TT_SHIFTER_STHIGH && regno == 254)
712 tt_palette[0] = 0; 823 tt_palette[0] = 0;
713 return 0; 824 return 0;
714} 825}
715 826
716 827static int tt_detect(void)
717static int tt_detect( void ) 828{
718 829 struct atafb_par par;
719{ struct atafb_par par;
720 830
721 /* Determine the connected monitor: The DMA sound must be 831 /* Determine the connected monitor: The DMA sound must be
722 * disabled before reading the MFP GPIP, because the Sound 832 * disabled before reading the MFP GPIP, because the Sound
@@ -726,9 +836,9 @@ static int tt_detect( void )
726 * announced that the Eagle is TT compatible, but only the PCM is 836 * announced that the Eagle is TT compatible, but only the PCM is
727 * missing... 837 * missing...
728 */ 838 */
729 if (ATARIHW_PRESENT(PCM_8BIT)) { 839 if (ATARIHW_PRESENT(PCM_8BIT)) {
730 tt_dmasnd.ctrl = DMASND_CTRL_OFF; 840 tt_dmasnd.ctrl = DMASND_CTRL_OFF;
731 udelay(20); /* wait a while for things to settle down */ 841 udelay(20); /* wait a while for things to settle down */
732 } 842 }
733 mono_moni = (mfp.par_dt_reg & 0x80) == 0; 843 mono_moni = (mfp.par_dt_reg & 0x80) == 0;
734 844
@@ -755,19 +865,24 @@ static struct pixel_clock {
755 unsigned long f; /* f/[Hz] */ 865 unsigned long f; /* f/[Hz] */
756 unsigned long t; /* t/[ps] (=1/f) */ 866 unsigned long t; /* t/[ps] (=1/f) */
757 int right, hsync, left; /* standard timing in clock cycles, not pixel */ 867 int right, hsync, left; /* standard timing in clock cycles, not pixel */
758 /* hsync initialized in falcon_detect() */ 868 /* hsync initialized in falcon_detect() */
759 int sync_mask; /* or-mask for hw.falcon.sync to set this clock */ 869 int sync_mask; /* or-mask for hw.falcon.sync to set this clock */
760 int control_mask; /* ditto, for hw.falcon.vid_control */ 870 int control_mask; /* ditto, for hw.falcon.vid_control */
761} 871} f25 = {
762f25 = {25175000, 39721, 18, 0, 42, 0x0, VCO_CLOCK25}, 872 25175000, 39721, 18, 0, 42, 0x0, VCO_CLOCK25
763f32 = {32000000, 31250, 18, 0, 42, 0x0, 0}, 873}, f32 = {
764fext = { 0, 0, 18, 0, 42, 0x1, 0}; 874 32000000, 31250, 18, 0, 42, 0x0, 0
875}, fext = {
876 0, 0, 18, 0, 42, 0x1, 0
877};
765 878
766/* VIDEL-prescale values [mon_type][pixel_length from VCO] */ 879/* VIDEL-prescale values [mon_type][pixel_length from VCO] */
767static int vdl_prescale[4][3] = {{4,2,1}, {4,2,1}, {4,2,2}, {4,2,1}}; 880static int vdl_prescale[4][3] = {
881 { 4,2,1 }, { 4,2,1 }, { 4,2,2 }, { 4,2,1 }
882};
768 883
769/* Default hsync timing [mon_type] in picoseconds */ 884/* Default hsync timing [mon_type] in picoseconds */
770static long h_syncs[4] = {3000000, 4875000, 4000000, 4875000}; 885static long h_syncs[4] = { 3000000, 4875000, 4000000, 4875000 };
771 886
772#ifdef FBCON_HAS_CFB16 887#ifdef FBCON_HAS_CFB16
773static u16 fbcon_cfb16_cmap[16]; 888static u16 fbcon_cfb16_cmap[16];
@@ -775,12 +890,12 @@ static u16 fbcon_cfb16_cmap[16];
775 890
776static inline int hxx_prescale(struct falcon_hw *hw) 891static inline int hxx_prescale(struct falcon_hw *hw)
777{ 892{
778 return hw->ste_mode ? 16 : 893 return hw->ste_mode ? 16
779 vdl_prescale[mon_type][hw->vid_mode >> 2 & 0x3]; 894 : vdl_prescale[mon_type][hw->vid_mode >> 2 & 0x3];
780} 895}
781 896
782static int falcon_encode_fix( struct fb_fix_screeninfo *fix, 897static int falcon_encode_fix(struct fb_fix_screeninfo *fix,
783 struct atafb_par *par ) 898 struct atafb_par *par)
784{ 899{
785 strcpy(fix->id, "Atari Builtin"); 900 strcpy(fix->id, "Atari Builtin");
786 fix->smem_start = (unsigned long)real_screen_base; 901 fix->smem_start = (unsigned long)real_screen_base;
@@ -796,8 +911,7 @@ static int falcon_encode_fix( struct fb_fix_screeninfo *fix,
796 fix->type_aux = 0; 911 fix->type_aux = 0;
797 /* no smooth scrolling with longword aligned video mem */ 912 /* no smooth scrolling with longword aligned video mem */
798 fix->xpanstep = 32; 913 fix->xpanstep = 32;
799 } 914 } else if (par->hw.falcon.f_shift & 0x100) {
800 else if (par->hw.falcon.f_shift & 0x100) {
801 fix->type = FB_TYPE_PACKED_PIXELS; 915 fix->type = FB_TYPE_PACKED_PIXELS;
802 fix->type_aux = 0; 916 fix->type_aux = 0;
803 /* Is this ok or should it be DIRECTCOLOR? */ 917 /* Is this ok or should it be DIRECTCOLOR? */
@@ -809,9 +923,8 @@ static int falcon_encode_fix( struct fb_fix_screeninfo *fix,
809 return 0; 923 return 0;
810} 924}
811 925
812 926static int falcon_decode_var(struct fb_var_screeninfo *var,
813static int falcon_decode_var( struct fb_var_screeninfo *var, 927 struct atafb_par *par)
814 struct atafb_par *par )
815{ 928{
816 int bpp = var->bits_per_pixel; 929 int bpp = var->bits_per_pixel;
817 int xres = var->xres; 930 int xres = var->xres;
@@ -823,17 +936,19 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
823 int linelen; 936 int linelen;
824 int interlace = 0, doubleline = 0; 937 int interlace = 0, doubleline = 0;
825 struct pixel_clock *pclock; 938 struct pixel_clock *pclock;
826 int plen; /* width of pixel in clock cycles */ 939 int plen; /* width of pixel in clock cycles */
827 int xstretch; 940 int xstretch;
828 int prescale; 941 int prescale;
829 int longoffset = 0; 942 int longoffset = 0;
830 int hfreq, vfreq; 943 int hfreq, vfreq;
944 int hdb_off, hde_off, base_off;
945 int gstart, gend1, gend2, align;
831 946
832/* 947/*
833 Get the video params out of 'var'. If a value doesn't fit, round 948 Get the video params out of 'var'. If a value doesn't fit, round
834 it up, if it's too big, return EINVAL. 949 it up, if it's too big, return EINVAL.
835 Round up in the following order: bits_per_pixel, xres, yres, 950 Round up in the following order: bits_per_pixel, xres, yres,
836 xres_virtual, yres_virtual, xoffset, yoffset, grayscale, bitfields, 951 xres_virtual, yres_virtual, xoffset, yoffset, grayscale, bitfields,
837 horizontal timing, vertical timing. 952 horizontal timing, vertical timing.
838 953
839 There is a maximum of screen resolution determined by pixelclock 954 There is a maximum of screen resolution determined by pixelclock
@@ -843,11 +958,11 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
843 Frequency range for multisync monitors is given via command line. 958 Frequency range for multisync monitors is given via command line.
844 For TV and SM124 both frequencies are fixed. 959 For TV and SM124 both frequencies are fixed.
845 960
846 X % 16 == 0 to fit 8x?? font (except 1 bitplane modes must use X%32==0) 961 X % 16 == 0 to fit 8x?? font (except 1 bitplane modes must use X%32 == 0)
847 Y % 16 == 0 to fit 8x16 font 962 Y % 16 == 0 to fit 8x16 font
848 Y % 8 == 0 if Y<400 963 Y % 8 == 0 if Y<400
849 964
850 Currently interlace and doubleline mode in var are ignored. 965 Currently interlace and doubleline mode in var are ignored.
851 On SM124 and TV only the standard resolutions can be used. 966 On SM124 and TV only the standard resolutions can be used.
852*/ 967*/
853 968
@@ -855,43 +970,38 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
855 if (!xres || !yres || !bpp) 970 if (!xres || !yres || !bpp)
856 return -EINVAL; 971 return -EINVAL;
857 972
858 if (mon_type == F_MON_SM && bpp != 1) { 973 if (mon_type == F_MON_SM && bpp != 1)
859 return -EINVAL; 974 return -EINVAL;
860 } 975
861 else if (bpp <= 1) { 976 if (bpp <= 1) {
862 bpp = 1; 977 bpp = 1;
863 par->hw.falcon.f_shift = 0x400; 978 par->hw.falcon.f_shift = 0x400;
864 par->hw.falcon.st_shift = 0x200; 979 par->hw.falcon.st_shift = 0x200;
865 } 980 } else if (bpp <= 2) {
866 else if (bpp <= 2) {
867 bpp = 2; 981 bpp = 2;
868 par->hw.falcon.f_shift = 0x000; 982 par->hw.falcon.f_shift = 0x000;
869 par->hw.falcon.st_shift = 0x100; 983 par->hw.falcon.st_shift = 0x100;
870 } 984 } else if (bpp <= 4) {
871 else if (bpp <= 4) {
872 bpp = 4; 985 bpp = 4;
873 par->hw.falcon.f_shift = 0x000; 986 par->hw.falcon.f_shift = 0x000;
874 par->hw.falcon.st_shift = 0x000; 987 par->hw.falcon.st_shift = 0x000;
875 } 988 } else if (bpp <= 8) {
876 else if (bpp <= 8) {
877 bpp = 8; 989 bpp = 8;
878 par->hw.falcon.f_shift = 0x010; 990 par->hw.falcon.f_shift = 0x010;
879 } 991 } else if (bpp <= 16) {
880 else if (bpp <= 16) { 992 bpp = 16; /* packed pixel mode */
881 bpp = 16; /* packed pixel mode */ 993 par->hw.falcon.f_shift = 0x100; /* hicolor, no overlay */
882 par->hw.falcon.f_shift = 0x100; /* hicolor, no overlay */ 994 } else
883 }
884 else
885 return -EINVAL; 995 return -EINVAL;
886 par->hw.falcon.bpp = bpp; 996 par->hw.falcon.bpp = bpp;
887 997
888 if (mon_type == F_MON_SM || DontCalcRes) { 998 if (mon_type == F_MON_SM || DontCalcRes) {
889 /* Skip all calculations. VGA/TV/SC1224 only supported. */ 999 /* Skip all calculations. VGA/TV/SC1224 only supported. */
890 struct fb_var_screeninfo *myvar = &atafb_predefined[0]; 1000 struct fb_var_screeninfo *myvar = &atafb_predefined[0];
891 1001
892 if (bpp > myvar->bits_per_pixel || 1002 if (bpp > myvar->bits_per_pixel ||
893 var->xres > myvar->xres || 1003 var->xres > myvar->xres ||
894 var->yres > myvar->yres) 1004 var->yres > myvar->yres)
895 return -EINVAL; 1005 return -EINVAL;
896 fbhw->get_par(par); /* Current par will be new par */ 1006 fbhw->get_par(par); /* Current par will be new par */
897 goto set_screen_base; /* Don't forget this */ 1007 goto set_screen_base; /* Don't forget this */
@@ -910,8 +1020,8 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
910 yres = 400; 1020 yres = 400;
911 1021
912 /* 2 planes must use STE compatibility mode */ 1022 /* 2 planes must use STE compatibility mode */
913 par->hw.falcon.ste_mode = bpp==2; 1023 par->hw.falcon.ste_mode = bpp == 2;
914 par->hw.falcon.mono = bpp==1; 1024 par->hw.falcon.mono = bpp == 1;
915 1025
916 /* Total and visible scanline length must be a multiple of one longword, 1026 /* Total and visible scanline length must be a multiple of one longword,
917 * this and the console fontwidth yields the alignment for xres and 1027 * this and the console fontwidth yields the alignment for xres and
@@ -967,8 +1077,7 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
967 left_margin = hsync_len = 128 / plen; 1077 left_margin = hsync_len = 128 / plen;
968 right_margin = 0; 1078 right_margin = 0;
969 /* TODO set all margins */ 1079 /* TODO set all margins */
970 } 1080 } else
971 else
972#endif 1081#endif
973 if (mon_type == F_MON_SC || mon_type == F_MON_TV) { 1082 if (mon_type == F_MON_SC || mon_type == F_MON_TV) {
974 plen = 2 * xstretch; 1083 plen = 2 * xstretch;
@@ -1002,26 +1111,24 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1002 vsync_len *= 2; 1111 vsync_len *= 2;
1003 } 1112 }
1004 } 1113 }
1005 } 1114 } else { /* F_MON_VGA */
1006 else
1007 { /* F_MON_VGA */
1008 if (bpp == 16) 1115 if (bpp == 16)
1009 xstretch = 2; /* Double pixel width only for hicolor */ 1116 xstretch = 2; /* Double pixel width only for hicolor */
1010 /* Default values are used for vert./hor. timing if no pixelclock given. */ 1117 /* Default values are used for vert./hor. timing if no pixelclock given. */
1011 if (var->pixclock == 0) { 1118 if (var->pixclock == 0) {
1012 int linesize; 1119 int linesize;
1013 1120
1014 /* Choose master pixelclock depending on hor. timing */ 1121 /* Choose master pixelclock depending on hor. timing */
1015 plen = 1 * xstretch; 1122 plen = 1 * xstretch;
1016 if ((plen * xres + f25.right+f25.hsync+f25.left) * 1123 if ((plen * xres + f25.right + f25.hsync + f25.left) *
1017 fb_info.monspecs.hfmin < f25.f) 1124 fb_info.monspecs.hfmin < f25.f)
1018 pclock = &f25; 1125 pclock = &f25;
1019 else if ((plen * xres + f32.right+f32.hsync+f32.left) * 1126 else if ((plen * xres + f32.right + f32.hsync +
1020 fb_info.monspecs.hfmin < f32.f) 1127 f32.left) * fb_info.monspecs.hfmin < f32.f)
1021 pclock = &f32; 1128 pclock = &f32;
1022 else if ((plen * xres + fext.right+fext.hsync+fext.left) * 1129 else if ((plen * xres + fext.right + fext.hsync +
1023 fb_info.monspecs.hfmin < fext.f 1130 fext.left) * fb_info.monspecs.hfmin < fext.f &&
1024 && fext.f) 1131 fext.f)
1025 pclock = &fext; 1132 pclock = &fext;
1026 else 1133 else
1027 return -EINVAL; 1134 return -EINVAL;
@@ -1033,22 +1140,24 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1033 upper_margin = 31; 1140 upper_margin = 31;
1034 lower_margin = 11; 1141 lower_margin = 11;
1035 vsync_len = 3; 1142 vsync_len = 3;
1036 } 1143 } else {
1037 else {
1038 /* Choose largest pixelclock <= wanted clock */ 1144 /* Choose largest pixelclock <= wanted clock */
1039 int i; 1145 int i;
1040 unsigned long pcl = ULONG_MAX; 1146 unsigned long pcl = ULONG_MAX;
1041 pclock = 0; 1147 pclock = 0;
1042 for (i=1; i <= 4; i *= 2) { 1148 for (i = 1; i <= 4; i *= 2) {
1043 if (f25.t*i >= var->pixclock && f25.t*i < pcl) { 1149 if (f25.t * i >= var->pixclock &&
1150 f25.t * i < pcl) {
1044 pcl = f25.t * i; 1151 pcl = f25.t * i;
1045 pclock = &f25; 1152 pclock = &f25;
1046 } 1153 }
1047 if (f32.t*i >= var->pixclock && f32.t*i < pcl) { 1154 if (f32.t * i >= var->pixclock &&
1155 f32.t * i < pcl) {
1048 pcl = f32.t * i; 1156 pcl = f32.t * i;
1049 pclock = &f32; 1157 pclock = &f32;
1050 } 1158 }
1051 if (fext.t && fext.t*i >= var->pixclock && fext.t*i < pcl) { 1159 if (fext.t && fext.t * i >= var->pixclock &&
1160 fext.t * i < pcl) {
1052 pcl = fext.t * i; 1161 pcl = fext.t * i;
1053 pclock = &fext; 1162 pclock = &fext;
1054 } 1163 }
@@ -1070,8 +1179,7 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1070 upper_margin = (upper_margin + 1) / 2; 1179 upper_margin = (upper_margin + 1) / 2;
1071 lower_margin = (lower_margin + 1) / 2; 1180 lower_margin = (lower_margin + 1) / 2;
1072 vsync_len = (vsync_len + 1) / 2; 1181 vsync_len = (vsync_len + 1) / 2;
1073 } 1182 } else if (var->vmode & FB_VMODE_DOUBLE) {
1074 else if (var->vmode & FB_VMODE_DOUBLE) {
1075 /* External unit is [double lines per frame] */ 1183 /* External unit is [double lines per frame] */
1076 upper_margin *= 2; 1184 upper_margin *= 2;
1077 lower_margin *= 2; 1185 lower_margin *= 2;
@@ -1079,7 +1187,7 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1079 } 1187 }
1080 } 1188 }
1081 if (pclock == &fext) 1189 if (pclock == &fext)
1082 longoffset = 1; /* VIDEL doesn't synchronize on short offset */ 1190 longoffset = 1; /* VIDEL doesn't synchronize on short offset */
1083 } 1191 }
1084 /* Is video bus bandwidth (32MB/s) too low for this resolution? */ 1192 /* Is video bus bandwidth (32MB/s) too low for this resolution? */
1085 /* this is definitely wrong if bus clock != 32MHz */ 1193 /* this is definitely wrong if bus clock != 32MHz */
@@ -1098,7 +1206,7 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1098 * between interlace and non-interlace without messing around 1206 * between interlace and non-interlace without messing around
1099 * with these. 1207 * with these.
1100 */ 1208 */
1101 again: 1209again:
1102 /* Set base_offset 128 and video bus width */ 1210 /* Set base_offset 128 and video bus width */
1103 par->hw.falcon.vid_control = mon_type | f030_bus_width; 1211 par->hw.falcon.vid_control = mon_type | f030_bus_width;
1104 if (!longoffset) 1212 if (!longoffset)
@@ -1112,37 +1220,34 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1112 /* External or internal clock */ 1220 /* External or internal clock */
1113 par->hw.falcon.sync = pclock->sync_mask | 0x2; 1221 par->hw.falcon.sync = pclock->sync_mask | 0x2;
1114 /* Pixellength and prescale */ 1222 /* Pixellength and prescale */
1115 par->hw.falcon.vid_mode = (2/plen) << 2; 1223 par->hw.falcon.vid_mode = (2 / plen) << 2;
1116 if (doubleline) 1224 if (doubleline)
1117 par->hw.falcon.vid_mode |= VMO_DOUBLE; 1225 par->hw.falcon.vid_mode |= VMO_DOUBLE;
1118 if (interlace) 1226 if (interlace)
1119 par->hw.falcon.vid_mode |= VMO_INTER; 1227 par->hw.falcon.vid_mode |= VMO_INTER;
1120 1228
1121 /********************* 1229 /*********************
1122 Horizontal timing: unit = [master clock cycles] 1230 * Horizontal timing: unit = [master clock cycles]
1123 unit of hxx-registers: [master clock cycles * prescale] 1231 * unit of hxx-registers: [master clock cycles * prescale]
1124 Hxx-registers are 9 bit wide 1232 * Hxx-registers are 9 bit wide
1125 1233 *
1126 1 line = ((hht + 2) * 2 * prescale) clock cycles 1234 * 1 line = ((hht + 2) * 2 * prescale) clock cycles
1127 1235 *
1128 graphic output = hdb & 0x200 ? 1236 * graphic output = hdb & 0x200 ?
1129 ((hht+2)*2 - hdb + hde) * prescale - hdboff + hdeoff: 1237 * ((hht + 2) * 2 - hdb + hde) * prescale - hdboff + hdeoff:
1130 ( hht + 2 - hdb + hde) * prescale - hdboff + hdeoff 1238 * (hht + 2 - hdb + hde) * prescale - hdboff + hdeoff
1131 (this must be a multiple of plen*128/bpp, on VGA pixels 1239 * (this must be a multiple of plen*128/bpp, on VGA pixels
1132 to the right may be cut off with a bigger right margin) 1240 * to the right may be cut off with a bigger right margin)
1133 1241 *
1134 start of graphics relative to start of 1st halfline = hdb & 0x200 ? 1242 * start of graphics relative to start of 1st halfline = hdb & 0x200 ?
1135 (hdb - hht - 2) * prescale + hdboff : 1243 * (hdb - hht - 2) * prescale + hdboff :
1136 hdb * prescale + hdboff 1244 * hdb * prescale + hdboff
1137 1245 *
1138 end of graphics relative to start of 1st halfline = 1246 * end of graphics relative to start of 1st halfline =
1139 (hde + hht + 2) * prescale + hdeoff 1247 * (hde + hht + 2) * prescale + hdeoff
1140 *********************/ 1248 *********************/
1141 /* Calculate VIDEL registers */ 1249 /* Calculate VIDEL registers */
1142 { 1250{
1143 int hdb_off, hde_off, base_off;
1144 int gstart, gend1, gend2, align;
1145
1146 prescale = hxx_prescale(&par->hw.falcon); 1251 prescale = hxx_prescale(&par->hw.falcon);
1147 base_off = par->hw.falcon.vid_control & VCO_SHORTOFFS ? 64 : 128; 1252 base_off = par->hw.falcon.vid_control & VCO_SHORTOFFS ? 64 : 128;
1148 1253
@@ -1154,8 +1259,7 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1154 align = 1; 1259 align = 1;
1155 hde_off = 0; 1260 hde_off = 0;
1156 hdb_off = (base_off + 16 * plen) + prescale; 1261 hdb_off = (base_off + 16 * plen) + prescale;
1157 } 1262 } else {
1158 else {
1159 align = 128 / bpp; 1263 align = 128 / bpp;
1160 hde_off = ((128 / bpp + 2) * plen); 1264 hde_off = ((128 / bpp + 2) * plen);
1161 if (par->hw.falcon.ste_mode) 1265 if (par->hw.falcon.ste_mode)
@@ -1164,23 +1268,24 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1164 hdb_off = (base_off + (128 / bpp + 18) * plen) + prescale; 1268 hdb_off = (base_off + (128 / bpp + 18) * plen) + prescale;
1165 } 1269 }
1166 1270
1167 gstart = (prescale/2 + plen * left_margin) / prescale; 1271 gstart = (prescale / 2 + plen * left_margin) / prescale;
1168 /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */ 1272 /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */
1169 gend1 = gstart + ((xres + align-1) / align)*align * plen / prescale; 1273 gend1 = gstart + ((xres + align - 1) / align) * align * plen / prescale;
1170 /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */ 1274 /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */
1171 gend2 = gstart + xres * plen / prescale; 1275 gend2 = gstart + xres * plen / prescale;
1172 par->HHT = plen * (left_margin + xres + right_margin) / 1276 par->HHT = plen * (left_margin + xres + right_margin) /
1173 (2 * prescale) - 2; 1277 (2 * prescale) - 2;
1174/* par->HHT = (gend2 + plen * right_margin / prescale) / 2 - 2;*/ 1278/* par->HHT = (gend2 + plen * right_margin / prescale) / 2 - 2;*/
1175 1279
1176 par->HDB = gstart - hdb_off/prescale; 1280 par->HDB = gstart - hdb_off / prescale;
1177 par->HBE = gstart; 1281 par->HBE = gstart;
1178 if (par->HDB < 0) par->HDB += par->HHT + 2 + 0x200; 1282 if (par->HDB < 0)
1179 par->HDE = gend1 - par->HHT - 2 - hde_off/prescale; 1283 par->HDB += par->HHT + 2 + 0x200;
1284 par->HDE = gend1 - par->HHT - 2 - hde_off / prescale;
1180 par->HBB = gend2 - par->HHT - 2; 1285 par->HBB = gend2 - par->HHT - 2;
1181#if 0 1286#if 0
1182 /* One more Videl constraint: data fetch of two lines must not overlap */ 1287 /* One more Videl constraint: data fetch of two lines must not overlap */
1183 if ((par->HDB & 0x200) && (par->HDB & ~0x200) - par->HDE <= 5) { 1288 if ((par->HDB & 0x200) && (par->HDB & ~0x200) - par->HDE <= 5) {
1184 /* if this happens increase margins, decrease hfreq. */ 1289 /* if this happens increase margins, decrease hfreq. */
1185 } 1290 }
1186#endif 1291#endif
@@ -1189,11 +1294,11 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1189 par->HSS = par->HHT + 2 - plen * hsync_len / prescale; 1294 par->HSS = par->HHT + 2 - plen * hsync_len / prescale;
1190 if (par->HSS < par->HBB) 1295 if (par->HSS < par->HBB)
1191 par->HSS = par->HBB; 1296 par->HSS = par->HBB;
1192 } 1297}
1193 1298
1194 /* check hor. frequency */ 1299 /* check hor. frequency */
1195 hfreq = pclock->f / ((par->HHT+2)*prescale*2); 1300 hfreq = pclock->f / ((par->HHT + 2) * prescale * 2);
1196 if (hfreq > fb_info.monspecs.hfmax && mon_type!=F_MON_VGA) { 1301 if (hfreq > fb_info.monspecs.hfmax && mon_type != F_MON_VGA) {
1197 /* ++guenther: ^^^^^^^^^^^^^^^^^^^ can't remember why I did this */ 1302 /* ++guenther: ^^^^^^^^^^^^^^^^^^^ can't remember why I did this */
1198 /* Too high -> enlarge margin */ 1303 /* Too high -> enlarge margin */
1199 left_margin += 1; 1304 left_margin += 1;
@@ -1213,12 +1318,14 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1213 par->VBE = (upper_margin * 2 + 1); /* must begin on odd halfline */ 1318 par->VBE = (upper_margin * 2 + 1); /* must begin on odd halfline */
1214 par->VDB = par->VBE; 1319 par->VDB = par->VBE;
1215 par->VDE = yres; 1320 par->VDE = yres;
1216 if (!interlace) par->VDE <<= 1; 1321 if (!interlace)
1217 if (doubleline) par->VDE <<= 1; /* VDE now half lines per (half-)frame */ 1322 par->VDE <<= 1;
1323 if (doubleline)
1324 par->VDE <<= 1; /* VDE now half lines per (half-)frame */
1218 par->VDE += par->VDB; 1325 par->VDE += par->VDB;
1219 par->VBB = par->VDE; 1326 par->VBB = par->VDE;
1220 par->VFT = par->VBB + (lower_margin * 2 - 1) - 1; 1327 par->VFT = par->VBB + (lower_margin * 2 - 1) - 1;
1221 par->VSS = par->VFT+1 - (vsync_len * 2 - 1); 1328 par->VSS = par->VFT + 1 - (vsync_len * 2 - 1);
1222 /* vbb,vss,vft must be even in interlace mode */ 1329 /* vbb,vss,vft must be even in interlace mode */
1223 if (interlace) { 1330 if (interlace) {
1224 par->VBB++; 1331 par->VBB++;
@@ -1229,55 +1336,53 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1229 /* V-frequency check, hope I didn't create any loop here. */ 1336 /* V-frequency check, hope I didn't create any loop here. */
1230 /* Interlace and doubleline are mutually exclusive. */ 1337 /* Interlace and doubleline are mutually exclusive. */
1231 vfreq = (hfreq * 2) / (par->VFT + 1); 1338 vfreq = (hfreq * 2) / (par->VFT + 1);
1232 if (vfreq > fb_info.monspecs.vfmax && !doubleline && !interlace) { 1339 if (vfreq > fb_info.monspecs.vfmax && !doubleline && !interlace) {
1233 /* Too high -> try again with doubleline */ 1340 /* Too high -> try again with doubleline */
1234 doubleline = 1; 1341 doubleline = 1;
1235 goto again; 1342 goto again;
1236 } 1343 } else if (vfreq < fb_info.monspecs.vfmin && !interlace && !doubleline) {
1237 else if (vfreq < fb_info.monspecs.vfmin && !interlace && !doubleline) {
1238 /* Too low -> try again with interlace */ 1344 /* Too low -> try again with interlace */
1239 interlace = 1; 1345 interlace = 1;
1240 goto again; 1346 goto again;
1241 } 1347 } else if (vfreq < fb_info.monspecs.vfmin && doubleline) {
1242 else if (vfreq < fb_info.monspecs.vfmin && doubleline) {
1243 /* Doubleline too low -> clear doubleline and enlarge margins */ 1348 /* Doubleline too low -> clear doubleline and enlarge margins */
1244 int lines; 1349 int lines;
1245 doubleline = 0; 1350 doubleline = 0;
1246 for (lines=0; 1351 for (lines = 0;
1247 (hfreq*2)/(par->VFT+1+4*lines-2*yres)>fb_info.monspecs.vfmax; 1352 (hfreq * 2) / (par->VFT + 1 + 4 * lines - 2 * yres) >
1353 fb_info.monspecs.vfmax;
1248 lines++) 1354 lines++)
1249 ; 1355 ;
1250 upper_margin += lines; 1356 upper_margin += lines;
1251 lower_margin += lines; 1357 lower_margin += lines;
1252 goto again; 1358 goto again;
1253 } 1359 } else if (vfreq > fb_info.monspecs.vfmax && doubleline) {
1254 else if (vfreq > fb_info.monspecs.vfmax && doubleline) {
1255 /* Doubleline too high -> enlarge margins */ 1360 /* Doubleline too high -> enlarge margins */
1256 int lines; 1361 int lines;
1257 for (lines=0; 1362 for (lines = 0;
1258 (hfreq*2)/(par->VFT+1+4*lines)>fb_info.monspecs.vfmax; 1363 (hfreq * 2) / (par->VFT + 1 + 4 * lines) >
1259 lines+=2) 1364 fb_info.monspecs.vfmax;
1365 lines += 2)
1260 ; 1366 ;
1261 upper_margin += lines; 1367 upper_margin += lines;
1262 lower_margin += lines; 1368 lower_margin += lines;
1263 goto again; 1369 goto again;
1264 } 1370 } else if (vfreq > fb_info.monspecs.vfmax && interlace) {
1265 else if (vfreq > fb_info.monspecs.vfmax && interlace) {
1266 /* Interlace, too high -> enlarge margins */ 1371 /* Interlace, too high -> enlarge margins */
1267 int lines; 1372 int lines;
1268 for (lines=0; 1373 for (lines = 0;
1269 (hfreq*2)/(par->VFT+1+4*lines)>fb_info.monspecs.vfmax; 1374 (hfreq * 2) / (par->VFT + 1 + 4 * lines) >
1375 fb_info.monspecs.vfmax;
1270 lines++) 1376 lines++)
1271 ; 1377 ;
1272 upper_margin += lines; 1378 upper_margin += lines;
1273 lower_margin += lines; 1379 lower_margin += lines;
1274 goto again; 1380 goto again;
1275 } 1381 } else if (vfreq < fb_info.monspecs.vfmin ||
1276 else if (vfreq < fb_info.monspecs.vfmin || 1382 vfreq > fb_info.monspecs.vfmax)
1277 vfreq > fb_info.monspecs.vfmax)
1278 return -EINVAL; 1383 return -EINVAL;
1279 1384
1280 set_screen_base: 1385set_screen_base:
1281 linelen = xres_virtual * bpp / 8; 1386 linelen = xres_virtual * bpp / 8;
1282 if (yres_virtual * linelen > screen_len && screen_len) 1387 if (yres_virtual * linelen > screen_len && screen_len)
1283 return -EINVAL; 1388 return -EINVAL;
@@ -1289,11 +1394,20 @@ static int falcon_decode_var( struct fb_var_screeninfo *var,
1289 par->screen_base = screen_base + var->yoffset * linelen; 1394 par->screen_base = screen_base + var->yoffset * linelen;
1290 par->hw.falcon.xoffset = 0; 1395 par->hw.falcon.xoffset = 0;
1291 1396
1397 // FIXME!!! sort of works, no crash
1398 //par->next_line = linelen;
1399 //par->next_plane = yres_virtual * linelen;
1400 par->next_line = linelen;
1401 par->next_plane = 2;
1402 // crashes
1403 //par->next_plane = linelen;
1404 //par->next_line = yres_virtual * linelen;
1405
1292 return 0; 1406 return 0;
1293} 1407}
1294 1408
1295static int falcon_encode_var( struct fb_var_screeninfo *var, 1409static int falcon_encode_var(struct fb_var_screeninfo *var,
1296 struct atafb_par *par ) 1410 struct atafb_par *par)
1297{ 1411{
1298/* !!! only for VGA !!! */ 1412/* !!! only for VGA !!! */
1299 int linelen; 1413 int linelen;
@@ -1306,10 +1420,10 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1306 var->pixclock = hw->sync & 0x1 ? fext.t : 1420 var->pixclock = hw->sync & 0x1 ? fext.t :
1307 hw->vid_control & VCO_CLOCK25 ? f25.t : f32.t; 1421 hw->vid_control & VCO_CLOCK25 ? f25.t : f32.t;
1308 1422
1309 var->height=-1; 1423 var->height = -1;
1310 var->width=-1; 1424 var->width = -1;
1311 1425
1312 var->sync=0; 1426 var->sync = 0;
1313 if (hw->vid_control & VCO_HSYPOS) 1427 if (hw->vid_control & VCO_HSYPOS)
1314 var->sync |= FB_SYNC_HOR_HIGH_ACT; 1428 var->sync |= FB_SYNC_HOR_HIGH_ACT;
1315 if (hw->vid_control & VCO_VSYPOS) 1429 if (hw->vid_control & VCO_VSYPOS)
@@ -1320,7 +1434,7 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1320 var->vmode |= FB_VMODE_INTERLACED; 1434 var->vmode |= FB_VMODE_INTERLACED;
1321 if (hw->vid_mode & VMO_DOUBLE) 1435 if (hw->vid_mode & VMO_DOUBLE)
1322 var->vmode |= FB_VMODE_DOUBLE; 1436 var->vmode |= FB_VMODE_DOUBLE;
1323 1437
1324 /* visible y resolution: 1438 /* visible y resolution:
1325 * Graphics display starts at line VDB and ends at line 1439 * Graphics display starts at line VDB and ends at line
1326 * VDE. If interlace mode off unit of VC-registers is 1440 * VDE. If interlace mode off unit of VC-registers is
@@ -1332,14 +1446,15 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1332 if (var->vmode & FB_VMODE_DOUBLE) 1446 if (var->vmode & FB_VMODE_DOUBLE)
1333 var->yres >>= 1; 1447 var->yres >>= 1;
1334 1448
1335 /* to get bpp, we must examine f_shift and st_shift. 1449 /*
1450 * to get bpp, we must examine f_shift and st_shift.
1336 * f_shift is valid if any of bits no. 10, 8 or 4 1451 * f_shift is valid if any of bits no. 10, 8 or 4
1337 * is set. Priority in f_shift is: 10 ">" 8 ">" 4, i.e. 1452 * is set. Priority in f_shift is: 10 ">" 8 ">" 4, i.e.
1338 * if bit 10 set then bit 8 and bit 4 don't care... 1453 * if bit 10 set then bit 8 and bit 4 don't care...
1339 * If all these bits are 0 get display depth from st_shift 1454 * If all these bits are 0 get display depth from st_shift
1340 * (as for ST and STE) 1455 * (as for ST and STE)
1341 */ 1456 */
1342 if (hw->f_shift & 0x400) /* 2 colors */ 1457 if (hw->f_shift & 0x400) /* 2 colors */
1343 var->bits_per_pixel = 1; 1458 var->bits_per_pixel = 1;
1344 else if (hw->f_shift & 0x100) /* hicolor */ 1459 else if (hw->f_shift & 0x100) /* hicolor */
1345 var->bits_per_pixel = 16; 1460 var->bits_per_pixel = 16;
@@ -1349,7 +1464,7 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1349 var->bits_per_pixel = 4; 1464 var->bits_per_pixel = 4;
1350 else if (hw->st_shift == 0x100) 1465 else if (hw->st_shift == 0x100)
1351 var->bits_per_pixel = 2; 1466 var->bits_per_pixel = 2;
1352 else /* if (hw->st_shift == 0x200) */ 1467 else /* if (hw->st_shift == 0x200) */
1353 var->bits_per_pixel = 1; 1468 var->bits_per_pixel = 1;
1354 1469
1355 var->xres = hw->line_width * 16 / var->bits_per_pixel; 1470 var->xres = hw->line_width * 16 / var->bits_per_pixel;
@@ -1358,42 +1473,42 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1358 var->xres_virtual += 16; 1473 var->xres_virtual += 16;
1359 1474
1360 if (var->bits_per_pixel == 16) { 1475 if (var->bits_per_pixel == 16) {
1361 var->red.offset=11; 1476 var->red.offset = 11;
1362 var->red.length=5; 1477 var->red.length = 5;
1363 var->red.msb_right=0; 1478 var->red.msb_right = 0;
1364 var->green.offset=5; 1479 var->green.offset = 5;
1365 var->green.length=6; 1480 var->green.length = 6;
1366 var->green.msb_right=0; 1481 var->green.msb_right = 0;
1367 var->blue.offset=0; 1482 var->blue.offset = 0;
1368 var->blue.length=5; 1483 var->blue.length = 5;
1369 var->blue.msb_right=0; 1484 var->blue.msb_right = 0;
1370 } 1485 } else {
1371 else { 1486 var->red.offset = 0;
1372 var->red.offset=0;
1373 var->red.length = hw->ste_mode ? 4 : 6; 1487 var->red.length = hw->ste_mode ? 4 : 6;
1374 var->red.msb_right=0; 1488 if (var->red.length > var->bits_per_pixel)
1375 var->grayscale=0; 1489 var->red.length = var->bits_per_pixel;
1376 var->blue=var->green=var->red; 1490 var->red.msb_right = 0;
1491 var->grayscale = 0;
1492 var->blue = var->green = var->red;
1377 } 1493 }
1378 var->transp.offset=0; 1494 var->transp.offset = 0;
1379 var->transp.length=0; 1495 var->transp.length = 0;
1380 var->transp.msb_right=0; 1496 var->transp.msb_right = 0;
1381 1497
1382 linelen = var->xres_virtual * var->bits_per_pixel / 8; 1498 linelen = var->xres_virtual * var->bits_per_pixel / 8;
1383 if (screen_len) { 1499 if (screen_len) {
1384 if (par->yres_virtual) 1500 if (par->yres_virtual)
1385 var->yres_virtual = par->yres_virtual; 1501 var->yres_virtual = par->yres_virtual;
1386 else 1502 else
1387 /* yres_virtual==0 means use maximum */ 1503 /* yres_virtual == 0 means use maximum */
1388 var->yres_virtual = screen_len / linelen; 1504 var->yres_virtual = screen_len / linelen;
1389 } 1505 } else {
1390 else {
1391 if (hwscroll < 0) 1506 if (hwscroll < 0)
1392 var->yres_virtual = 2 * var->yres; 1507 var->yres_virtual = 2 * var->yres;
1393 else 1508 else
1394 var->yres_virtual=var->yres+hwscroll * 16; 1509 var->yres_virtual = var->yres + hwscroll * 16;
1395 } 1510 }
1396 var->xoffset=0; /* TODO change this */ 1511 var->xoffset = 0; /* TODO change this */
1397 1512
1398 /* hdX-offsets */ 1513 /* hdX-offsets */
1399 prescale = hxx_prescale(hw); 1514 prescale = hxx_prescale(hw);
@@ -1402,8 +1517,7 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1402 if (hw->f_shift & 0x100) { 1517 if (hw->f_shift & 0x100) {
1403 hde_off = 0; 1518 hde_off = 0;
1404 hdb_off = (base_off + 16 * plen) + prescale; 1519 hdb_off = (base_off + 16 * plen) + prescale;
1405 } 1520 } else {
1406 else {
1407 hde_off = ((128 / var->bits_per_pixel + 2) * plen); 1521 hde_off = ((128 / var->bits_per_pixel + 2) * plen);
1408 if (hw->ste_mode) 1522 if (hw->ste_mode)
1409 hdb_off = (64 + base_off + (128 / var->bits_per_pixel + 2) * plen) 1523 hdb_off = (64 + base_off + (128 / var->bits_per_pixel + 2) * plen)
@@ -1415,8 +1529,8 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1415 1529
1416 /* Right margin includes hsync */ 1530 /* Right margin includes hsync */
1417 var->left_margin = hdb_off + prescale * ((hw->hdb & 0x1ff) - 1531 var->left_margin = hdb_off + prescale * ((hw->hdb & 0x1ff) -
1418 (hw->hdb & 0x200 ? 2+hw->hht : 0)); 1532 (hw->hdb & 0x200 ? 2 + hw->hht : 0));
1419 if (hw->ste_mode || mon_type!=F_MON_VGA) 1533 if (hw->ste_mode || mon_type != F_MON_VGA)
1420 var->right_margin = prescale * (hw->hht + 2 - hw->hde) - hde_off; 1534 var->right_margin = prescale * (hw->hht + 2 - hw->hde) - hde_off;
1421 else 1535 else
1422 /* can't use this in ste_mode, because hbb is +1 off */ 1536 /* can't use this in ste_mode, because hbb is +1 off */
@@ -1424,15 +1538,14 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1424 var->hsync_len = prescale * (hw->hht + 2 - hw->hss); 1538 var->hsync_len = prescale * (hw->hht + 2 - hw->hss);
1425 1539
1426 /* Lower margin includes vsync */ 1540 /* Lower margin includes vsync */
1427 var->upper_margin = hw->vdb / 2 ; /* round down to full lines */ 1541 var->upper_margin = hw->vdb / 2; /* round down to full lines */
1428 var->lower_margin = (hw->vft+1 - hw->vde + 1) / 2; /* round up */ 1542 var->lower_margin = (hw->vft + 1 - hw->vde + 1) / 2; /* round up */
1429 var->vsync_len = (hw->vft+1 - hw->vss + 1) / 2; /* round up */ 1543 var->vsync_len = (hw->vft + 1 - hw->vss + 1) / 2; /* round up */
1430 if (var->vmode & FB_VMODE_INTERLACED) { 1544 if (var->vmode & FB_VMODE_INTERLACED) {
1431 var->upper_margin *= 2; 1545 var->upper_margin *= 2;
1432 var->lower_margin *= 2; 1546 var->lower_margin *= 2;
1433 var->vsync_len *= 2; 1547 var->vsync_len *= 2;
1434 } 1548 } else if (var->vmode & FB_VMODE_DOUBLE) {
1435 else if (var->vmode & FB_VMODE_DOUBLE) {
1436 var->upper_margin = (var->upper_margin + 1) / 2; 1549 var->upper_margin = (var->upper_margin + 1) / 2;
1437 var->lower_margin = (var->lower_margin + 1) / 2; 1550 var->lower_margin = (var->lower_margin + 1) / 2;
1438 var->vsync_len = (var->vsync_len + 1) / 2; 1551 var->vsync_len = (var->vsync_len + 1) / 2;
@@ -1447,20 +1560,19 @@ static int falcon_encode_var( struct fb_var_screeninfo *var,
1447 var->lower_margin -= var->vsync_len; 1560 var->lower_margin -= var->vsync_len;
1448 1561
1449 if (screen_base) 1562 if (screen_base)
1450 var->yoffset=(par->screen_base - screen_base)/linelen; 1563 var->yoffset = (par->screen_base - screen_base) / linelen;
1451 else 1564 else
1452 var->yoffset=0; 1565 var->yoffset = 0;
1453 var->nonstd=0; /* what is this for? */ 1566 var->nonstd = 0; /* what is this for? */
1454 var->activate=0; 1567 var->activate = 0;
1455 return 0; 1568 return 0;
1456} 1569}
1457 1570
1458 1571static int f_change_mode;
1459static int f_change_mode = 0;
1460static struct falcon_hw f_new_mode; 1572static struct falcon_hw f_new_mode;
1461static int f_pan_display = 0; 1573static int f_pan_display;
1462 1574
1463static void falcon_get_par( struct atafb_par *par ) 1575static void falcon_get_par(struct atafb_par *par)
1464{ 1576{
1465 unsigned long addr; 1577 unsigned long addr;
1466 struct falcon_hw *hw = &par->hw.falcon; 1578 struct falcon_hw *hw = &par->hw.falcon;
@@ -1492,12 +1604,12 @@ static void falcon_get_par( struct atafb_par *par )
1492 par->screen_base = phys_to_virt(addr); 1604 par->screen_base = phys_to_virt(addr);
1493 1605
1494 /* derived parameters */ 1606 /* derived parameters */
1495 hw->ste_mode = (hw->f_shift & 0x510)==0 && hw->st_shift==0x100; 1607 hw->ste_mode = (hw->f_shift & 0x510) == 0 && hw->st_shift == 0x100;
1496 hw->mono = (hw->f_shift & 0x400) || 1608 hw->mono = (hw->f_shift & 0x400) ||
1497 ((hw->f_shift & 0x510)==0 && hw->st_shift==0x200); 1609 ((hw->f_shift & 0x510) == 0 && hw->st_shift == 0x200);
1498} 1610}
1499 1611
1500static void falcon_set_par( struct atafb_par *par ) 1612static void falcon_set_par(struct atafb_par *par)
1501{ 1613{
1502 f_change_mode = 0; 1614 f_change_mode = 0;
1503 1615
@@ -1519,8 +1631,7 @@ static void falcon_set_par( struct atafb_par *par )
1519 f_change_mode = 1; 1631 f_change_mode = 1;
1520} 1632}
1521 1633
1522 1634static irqreturn_t falcon_vbl_switcher(int irq, void *dummy)
1523static irqreturn_t falcon_vbl_switcher( int irq, void *dummy )
1524{ 1635{
1525 struct falcon_hw *hw = &f_new_mode; 1636 struct falcon_hw *hw = &f_new_mode;
1526 1637
@@ -1529,11 +1640,10 @@ static irqreturn_t falcon_vbl_switcher( int irq, void *dummy )
1529 1640
1530 if (hw->sync & 0x1) { 1641 if (hw->sync & 0x1) {
1531 /* Enable external pixelclock. This code only for ScreenWonder */ 1642 /* Enable external pixelclock. This code only for ScreenWonder */
1532 *(volatile unsigned short*)0xffff9202 = 0xffbf; 1643 *(volatile unsigned short *)0xffff9202 = 0xffbf;
1533 } 1644 } else {
1534 else {
1535 /* Turn off external clocks. Read sets all output bits to 1. */ 1645 /* Turn off external clocks. Read sets all output bits to 1. */
1536 *(volatile unsigned short*)0xffff9202; 1646 *(volatile unsigned short *)0xffff9202;
1537 } 1647 }
1538 shifter.syncmode = hw->sync; 1648 shifter.syncmode = hw->sync;
1539 1649
@@ -1550,15 +1660,14 @@ static irqreturn_t falcon_vbl_switcher( int irq, void *dummy )
1550 videl.vde = hw->vde; 1660 videl.vde = hw->vde;
1551 videl.vss = hw->vss; 1661 videl.vss = hw->vss;
1552 1662
1553 videl.f_shift = 0; /* write enables Falcon palette, 0: 4 planes */ 1663 videl.f_shift = 0; /* write enables Falcon palette, 0: 4 planes */
1554 if (hw->ste_mode) { 1664 if (hw->ste_mode) {
1555 videl.st_shift = hw->st_shift; /* write enables STE palette */ 1665 videl.st_shift = hw->st_shift; /* write enables STE palette */
1556 } 1666 } else {
1557 else {
1558 /* IMPORTANT: 1667 /* IMPORTANT:
1559 * set st_shift 0, so we can tell the screen-depth if f_shift==0. 1668 * set st_shift 0, so we can tell the screen-depth if f_shift == 0.
1560 * Writing 0 to f_shift enables 4 plane Falcon mode but 1669 * Writing 0 to f_shift enables 4 plane Falcon mode but
1561 * doesn't set st_shift. st_shift!=0 (!=4planes) is impossible 1670 * doesn't set st_shift. st_shift != 0 (!= 4planes) is impossible
1562 * with Falcon palette. 1671 * with Falcon palette.
1563 */ 1672 */
1564 videl.st_shift = 0; 1673 videl.st_shift = 0;
@@ -1580,12 +1689,13 @@ static irqreturn_t falcon_vbl_switcher( int irq, void *dummy )
1580 return IRQ_HANDLED; 1689 return IRQ_HANDLED;
1581} 1690}
1582 1691
1583 1692static int falcon_pan_display(struct fb_var_screeninfo *var,
1584static int falcon_pan_display( struct fb_var_screeninfo *var, 1693 struct fb_info *info)
1585 struct atafb_par *par )
1586{ 1694{
1695 struct atafb_par *par = (struct atafb_par *)info->par;
1696
1587 int xoffset; 1697 int xoffset;
1588 int bpp = fb_display[fb_info.currcon].var.bits_per_pixel; 1698 int bpp = info->var.bits_per_pixel;
1589 1699
1590 if (bpp == 1) 1700 if (bpp == 1)
1591 var->xoffset = up(var->xoffset, 32); 1701 var->xoffset = up(var->xoffset, 32);
@@ -1596,45 +1706,24 @@ static int falcon_pan_display( struct fb_var_screeninfo *var,
1596 var->xoffset = up(var->xoffset, 2); 1706 var->xoffset = up(var->xoffset, 2);
1597 } 1707 }
1598 par->hw.falcon.line_offset = bpp * 1708 par->hw.falcon.line_offset = bpp *
1599 (fb_display[fb_info.currcon].var.xres_virtual - fb_display[fb_info.currcon].var.xres) / 16; 1709 (info->var.xres_virtual - info->var.xres) / 16;
1600 if (par->hw.falcon.xoffset) 1710 if (par->hw.falcon.xoffset)
1601 par->hw.falcon.line_offset -= bpp; 1711 par->hw.falcon.line_offset -= bpp;
1602 xoffset = var->xoffset - par->hw.falcon.xoffset; 1712 xoffset = var->xoffset - par->hw.falcon.xoffset;
1603 1713
1604 par->screen_base = screen_base + 1714 par->screen_base = screen_base +
1605 (var->yoffset * fb_display[fb_info.currcon].var.xres_virtual + xoffset) * bpp / 8; 1715 (var->yoffset * info->var.xres_virtual + xoffset) * bpp / 8;
1606 if (fbhw->set_screen_base) 1716 if (fbhw->set_screen_base)
1607 fbhw->set_screen_base (par->screen_base); 1717 fbhw->set_screen_base(par->screen_base);
1608 else 1718 else
1609 return -EINVAL; /* shouldn't happen */ 1719 return -EINVAL; /* shouldn't happen */
1610 f_pan_display = 1; 1720 f_pan_display = 1;
1611 return 0; 1721 return 0;
1612} 1722}
1613 1723
1614 1724static int falcon_setcolreg(unsigned int regno, unsigned int red,
1615static int falcon_getcolreg( unsigned regno, unsigned *red, 1725 unsigned int green, unsigned int blue,
1616 unsigned *green, unsigned *blue, 1726 unsigned int transp, struct fb_info *info)
1617 unsigned *transp, struct fb_info *info )
1618{ unsigned long col;
1619
1620 if (regno > 255)
1621 return 1;
1622 /* This works in STE-mode (with 4bit/color) since f030_col-registers
1623 * hold up to 6bit/color.
1624 * Even with hicolor r/g/b=5/6/5 bit!
1625 */
1626 col = f030_col[regno];
1627 *red = (col >> 16) & 0xff00;
1628 *green = (col >> 8) & 0xff00;
1629 *blue = (col << 8) & 0xff00;
1630 *transp = 0;
1631 return 0;
1632}
1633
1634
1635static int falcon_setcolreg( unsigned regno, unsigned red,
1636 unsigned green, unsigned blue,
1637 unsigned transp, struct fb_info *info )
1638{ 1727{
1639 if (regno > 255) 1728 if (regno > 255)
1640 return 1; 1729 return 1;
@@ -1655,13 +1744,12 @@ static int falcon_setcolreg( unsigned regno, unsigned red,
1655 return 0; 1744 return 0;
1656} 1745}
1657 1746
1658 1747static int falcon_blank(int blank_mode)
1659static int falcon_blank( int blank_mode )
1660{ 1748{
1661/* ++guenther: we can switch off graphics by changing VDB and VDE, 1749 /* ++guenther: we can switch off graphics by changing VDB and VDE,
1662 * so VIDEL doesn't hog the bus while saving. 1750 * so VIDEL doesn't hog the bus while saving.
1663 * (this may affect usleep()). 1751 * (this may affect usleep()).
1664 */ 1752 */
1665 int vdb, vss, hbe, hss; 1753 int vdb, vss, hbe, hss;
1666 1754
1667 if (mon_type == F_MON_SM) /* this doesn't work on SM124 */ 1755 if (mon_type == F_MON_SM) /* this doesn't work on SM124 */
@@ -1694,14 +1782,13 @@ static int falcon_blank( int blank_mode )
1694 return 0; 1782 return 0;
1695} 1783}
1696 1784
1697 1785static int falcon_detect(void)
1698static int falcon_detect( void )
1699{ 1786{
1700 struct atafb_par par; 1787 struct atafb_par par;
1701 unsigned char fhw; 1788 unsigned char fhw;
1702 1789
1703 /* Determine connected monitor and set monitor parameters */ 1790 /* Determine connected monitor and set monitor parameters */
1704 fhw = *(unsigned char*)0xffff8006; 1791 fhw = *(unsigned char *)0xffff8006;
1705 mon_type = fhw >> 6 & 0x3; 1792 mon_type = fhw >> 6 & 0x3;
1706 /* bit 1 of fhw: 1=32 bit ram bus, 0=16 bit */ 1793 /* bit 1 of fhw: 1=32 bit ram bus, 0=16 bit */
1707 f030_bus_width = fhw << 6 & 0x80; 1794 f030_bus_width = fhw << 6 & 0x80;
@@ -1715,7 +1802,7 @@ static int falcon_detect( void )
1715 case F_MON_SC: 1802 case F_MON_SC:
1716 case F_MON_TV: 1803 case F_MON_TV:
1717 /* PAL...NTSC */ 1804 /* PAL...NTSC */
1718 fb_info.monspecs.vfmin = 49; /* not 50, since TOS defaults to 49.9x Hz */ 1805 fb_info.monspecs.vfmin = 49; /* not 50, since TOS defaults to 49.9x Hz */
1719 fb_info.monspecs.vfmax = 60; 1806 fb_info.monspecs.vfmax = 60;
1720 fb_info.monspecs.hfmin = 15620; 1807 fb_info.monspecs.hfmin = 15620;
1721 fb_info.monspecs.hfmax = 15755; 1808 fb_info.monspecs.hfmax = 15755;
@@ -1740,13 +1827,12 @@ static int falcon_detect( void )
1740 1827
1741#ifdef ATAFB_STE 1828#ifdef ATAFB_STE
1742 1829
1743static int stste_encode_fix( struct fb_fix_screeninfo *fix, 1830static int stste_encode_fix(struct fb_fix_screeninfo *fix,
1744 struct atafb_par *par ) 1831 struct atafb_par *par)
1745
1746{ 1832{
1747 int mode; 1833 int mode;
1748 1834
1749 strcpy(fix->id,"Atari Builtin"); 1835 strcpy(fix->id, "Atari Builtin");
1750 fix->smem_start = (unsigned long)real_screen_base; 1836 fix->smem_start = (unsigned long)real_screen_base;
1751 fix->smem_len = screen_len; 1837 fix->smem_len = screen_len;
1752 fix->type = FB_TYPE_INTERLEAVED_PLANES; 1838 fix->type = FB_TYPE_INTERLEAVED_PLANES;
@@ -1771,43 +1857,40 @@ static int stste_encode_fix( struct fb_fix_screeninfo *fix,
1771 return 0; 1857 return 0;
1772} 1858}
1773 1859
1774 1860static int stste_decode_var(struct fb_var_screeninfo *var,
1775static int stste_decode_var( struct fb_var_screeninfo *var, 1861 struct atafb_par *par)
1776 struct atafb_par *par )
1777{ 1862{
1778 int xres=var->xres; 1863 int xres = var->xres;
1779 int yres=var->yres; 1864 int yres = var->yres;
1780 int bpp=var->bits_per_pixel; 1865 int bpp = var->bits_per_pixel;
1781 int linelen; 1866 int linelen;
1782 int yres_virtual = var->yres_virtual; 1867 int yres_virtual = var->yres_virtual;
1783 1868
1784 if (mono_moni) { 1869 if (mono_moni) {
1785 if (bpp > 1 || xres > sttt_xres || yres > st_yres) 1870 if (bpp > 1 || xres > sttt_xres || yres > st_yres)
1786 return -EINVAL; 1871 return -EINVAL;
1787 par->hw.st.mode=ST_HIGH; 1872 par->hw.st.mode = ST_HIGH;
1788 xres=sttt_xres; 1873 xres = sttt_xres;
1789 yres=st_yres; 1874 yres = st_yres;
1790 bpp=1; 1875 bpp = 1;
1791 } else { 1876 } else {
1792 if (bpp > 4 || xres > sttt_xres || yres > st_yres) 1877 if (bpp > 4 || xres > sttt_xres || yres > st_yres)
1793 return -EINVAL; 1878 return -EINVAL;
1794 if (bpp > 2) { 1879 if (bpp > 2) {
1795 if (xres > sttt_xres/2 || yres > st_yres/2) 1880 if (xres > sttt_xres / 2 || yres > st_yres / 2)
1796 return -EINVAL; 1881 return -EINVAL;
1797 par->hw.st.mode=ST_LOW; 1882 par->hw.st.mode = ST_LOW;
1798 xres=sttt_xres/2; 1883 xres = sttt_xres / 2;
1799 yres=st_yres/2; 1884 yres = st_yres / 2;
1800 bpp=4; 1885 bpp = 4;
1801 } 1886 } else if (bpp > 1) {
1802 else if (bpp > 1) { 1887 if (xres > sttt_xres || yres > st_yres / 2)
1803 if (xres > sttt_xres || yres > st_yres/2)
1804 return -EINVAL; 1888 return -EINVAL;
1805 par->hw.st.mode=ST_MID; 1889 par->hw.st.mode = ST_MID;
1806 xres=sttt_xres; 1890 xres = sttt_xres;
1807 yres=st_yres/2; 1891 yres = st_yres / 2;
1808 bpp=2; 1892 bpp = 2;
1809 } 1893 } else
1810 else
1811 return -EINVAL; 1894 return -EINVAL;
1812 } 1895 }
1813 if (yres_virtual <= 0) 1896 if (yres_virtual <= 0)
@@ -1815,10 +1898,10 @@ static int stste_decode_var( struct fb_var_screeninfo *var,
1815 else if (yres_virtual < yres) 1898 else if (yres_virtual < yres)
1816 yres_virtual = yres; 1899 yres_virtual = yres;
1817 if (var->sync & FB_SYNC_EXT) 1900 if (var->sync & FB_SYNC_EXT)
1818 par->hw.st.sync=(par->hw.st.sync & ~1) | 1; 1901 par->hw.st.sync = (par->hw.st.sync & ~1) | 1;
1819 else 1902 else
1820 par->hw.st.sync=(par->hw.st.sync & ~1); 1903 par->hw.st.sync = (par->hw.st.sync & ~1);
1821 linelen=xres*bpp/8; 1904 linelen = xres * bpp / 8;
1822 if (yres_virtual * linelen > screen_len && screen_len) 1905 if (yres_virtual * linelen > screen_len && screen_len)
1823 return -EINVAL; 1906 return -EINVAL;
1824 if (yres * linelen > screen_len && screen_len) 1907 if (yres * linelen > screen_len && screen_len)
@@ -1826,93 +1909,91 @@ static int stste_decode_var( struct fb_var_screeninfo *var,
1826 if (var->yoffset + yres > yres_virtual && yres_virtual) 1909 if (var->yoffset + yres > yres_virtual && yres_virtual)
1827 return -EINVAL; 1910 return -EINVAL;
1828 par->yres_virtual = yres_virtual; 1911 par->yres_virtual = yres_virtual;
1829 par->screen_base=screen_base+ var->yoffset*linelen; 1912 par->screen_base = screen_base + var->yoffset * linelen;
1830 return 0; 1913 return 0;
1831} 1914}
1832 1915
1833static int stste_encode_var( struct fb_var_screeninfo *var, 1916static int stste_encode_var(struct fb_var_screeninfo *var,
1834 struct atafb_par *par ) 1917 struct atafb_par *par)
1835{ 1918{
1836 int linelen; 1919 int linelen;
1837 memset(var, 0, sizeof(struct fb_var_screeninfo)); 1920 memset(var, 0, sizeof(struct fb_var_screeninfo));
1838 var->red.offset=0; 1921 var->red.offset = 0;
1839 var->red.length = ATARIHW_PRESENT(EXTD_SHIFTER) ? 4 : 3; 1922 var->red.length = ATARIHW_PRESENT(EXTD_SHIFTER) ? 4 : 3;
1840 var->red.msb_right=0; 1923 var->red.msb_right = 0;
1841 var->grayscale=0; 1924 var->grayscale = 0;
1842 1925
1843 var->pixclock=31041; 1926 var->pixclock = 31041;
1844 var->left_margin=120; /* these are incorrect */ 1927 var->left_margin = 120; /* these are incorrect */
1845 var->right_margin=100; 1928 var->right_margin = 100;
1846 var->upper_margin=8; 1929 var->upper_margin = 8;
1847 var->lower_margin=16; 1930 var->lower_margin = 16;
1848 var->hsync_len=140; 1931 var->hsync_len = 140;
1849 var->vsync_len=30; 1932 var->vsync_len = 30;
1850 1933
1851 var->height=-1; 1934 var->height = -1;
1852 var->width=-1; 1935 var->width = -1;
1853 1936
1854 if (!(par->hw.st.sync & 1)) 1937 if (!(par->hw.st.sync & 1))
1855 var->sync=0; 1938 var->sync = 0;
1856 else 1939 else
1857 var->sync=FB_SYNC_EXT; 1940 var->sync = FB_SYNC_EXT;
1858 1941
1859 switch (par->hw.st.mode & 3) { 1942 switch (par->hw.st.mode & 3) {
1860 case ST_LOW: 1943 case ST_LOW:
1861 var->xres=sttt_xres/2; 1944 var->xres = sttt_xres / 2;
1862 var->yres=st_yres/2; 1945 var->yres = st_yres / 2;
1863 var->bits_per_pixel=4; 1946 var->bits_per_pixel = 4;
1864 break; 1947 break;
1865 case ST_MID: 1948 case ST_MID:
1866 var->xres=sttt_xres; 1949 var->xres = sttt_xres;
1867 var->yres=st_yres/2; 1950 var->yres = st_yres / 2;
1868 var->bits_per_pixel=2; 1951 var->bits_per_pixel = 2;
1869 break; 1952 break;
1870 case ST_HIGH: 1953 case ST_HIGH:
1871 var->xres=sttt_xres; 1954 var->xres = sttt_xres;
1872 var->yres=st_yres; 1955 var->yres = st_yres;
1873 var->bits_per_pixel=1; 1956 var->bits_per_pixel = 1;
1874 break; 1957 break;
1875 } 1958 }
1876 var->blue=var->green=var->red; 1959 var->blue = var->green = var->red;
1877 var->transp.offset=0; 1960 var->transp.offset = 0;
1878 var->transp.length=0; 1961 var->transp.length = 0;
1879 var->transp.msb_right=0; 1962 var->transp.msb_right = 0;
1880 var->xres_virtual=sttt_xres_virtual; 1963 var->xres_virtual = sttt_xres_virtual;
1881 linelen=var->xres_virtual * var->bits_per_pixel / 8; 1964 linelen = var->xres_virtual * var->bits_per_pixel / 8;
1882 ovsc_addlen=linelen*(sttt_yres_virtual - st_yres); 1965 ovsc_addlen = linelen * (sttt_yres_virtual - st_yres);
1883 1966
1884 if (! use_hwscroll) 1967 if (!use_hwscroll)
1885 var->yres_virtual=var->yres; 1968 var->yres_virtual = var->yres;
1886 else if (screen_len) { 1969 else if (screen_len) {
1887 if (par->yres_virtual) 1970 if (par->yres_virtual)
1888 var->yres_virtual = par->yres_virtual; 1971 var->yres_virtual = par->yres_virtual;
1889 else 1972 else
1890 /* yres_virtual==0 means use maximum */ 1973 /* yres_virtual == 0 means use maximum */
1891 var->yres_virtual = screen_len / linelen; 1974 var->yres_virtual = screen_len / linelen;
1892 } 1975 } else {
1893 else {
1894 if (hwscroll < 0) 1976 if (hwscroll < 0)
1895 var->yres_virtual = 2 * var->yres; 1977 var->yres_virtual = 2 * var->yres;
1896 else 1978 else
1897 var->yres_virtual=var->yres+hwscroll * 16; 1979 var->yres_virtual = var->yres + hwscroll * 16;
1898 } 1980 }
1899 var->xoffset=0; 1981 var->xoffset = 0;
1900 if (screen_base) 1982 if (screen_base)
1901 var->yoffset=(par->screen_base - screen_base)/linelen; 1983 var->yoffset = (par->screen_base - screen_base) / linelen;
1902 else 1984 else
1903 var->yoffset=0; 1985 var->yoffset = 0;
1904 var->nonstd=0; 1986 var->nonstd = 0;
1905 var->activate=0; 1987 var->activate = 0;
1906 var->vmode=FB_VMODE_NONINTERLACED; 1988 var->vmode = FB_VMODE_NONINTERLACED;
1907 return 0; 1989 return 0;
1908} 1990}
1909 1991
1910 1992static void stste_get_par(struct atafb_par *par)
1911static void stste_get_par( struct atafb_par *par )
1912{ 1993{
1913 unsigned long addr; 1994 unsigned long addr;
1914 par->hw.st.mode=shifter_tt.st_shiftmode; 1995 par->hw.st.mode = shifter_tt.st_shiftmode;
1915 par->hw.st.sync=shifter.syncmode; 1996 par->hw.st.sync = shifter.syncmode;
1916 addr = ((shifter.bas_hi & 0xff) << 16) | 1997 addr = ((shifter.bas_hi & 0xff) << 16) |
1917 ((shifter.bas_md & 0xff) << 8); 1998 ((shifter.bas_md & 0xff) << 8);
1918 if (ATARIHW_PRESENT(EXTD_SHIFTER)) 1999 if (ATARIHW_PRESENT(EXTD_SHIFTER))
@@ -1920,55 +2001,18 @@ static void stste_get_par( struct atafb_par *par )
1920 par->screen_base = phys_to_virt(addr); 2001 par->screen_base = phys_to_virt(addr);
1921} 2002}
1922 2003
1923static void stste_set_par( struct atafb_par *par ) 2004static void stste_set_par(struct atafb_par *par)
1924{ 2005{
1925 shifter_tt.st_shiftmode=par->hw.st.mode; 2006 shifter_tt.st_shiftmode = par->hw.st.mode;
1926 shifter.syncmode=par->hw.st.sync; 2007 shifter.syncmode = par->hw.st.sync;
1927 /* only set screen_base if really necessary */ 2008 /* only set screen_base if really necessary */
1928 if (current_par.screen_base != par->screen_base) 2009 if (current_par.screen_base != par->screen_base)
1929 fbhw->set_screen_base(par->screen_base); 2010 fbhw->set_screen_base(par->screen_base);
1930} 2011}
1931 2012
1932 2013static int stste_setcolreg(unsigned int regno, unsigned int red,
1933static int stste_getcolreg(unsigned regno, unsigned *red, 2014 unsigned int green, unsigned int blue,
1934 unsigned *green, unsigned *blue, 2015 unsigned int transp, struct fb_info *info)
1935 unsigned *transp, struct fb_info *info)
1936{
1937 unsigned col, t;
1938
1939 if (regno > 15)
1940 return 1;
1941 col = shifter_tt.color_reg[regno];
1942 if (ATARIHW_PRESENT(EXTD_SHIFTER)) {
1943 t = ((col >> 7) & 0xe) | ((col >> 11) & 1);
1944 t |= t << 4;
1945 *red = t | (t << 8);
1946 t = ((col >> 3) & 0xe) | ((col >> 7) & 1);
1947 t |= t << 4;
1948 *green = t | (t << 8);
1949 t = ((col << 1) & 0xe) | ((col >> 3) & 1);
1950 t |= t << 4;
1951 *blue = t | (t << 8);
1952 }
1953 else {
1954 t = (col >> 7) & 0xe;
1955 t |= t << 4;
1956 *red = t | (t << 8);
1957 t = (col >> 3) & 0xe;
1958 t |= t << 4;
1959 *green = t | (t << 8);
1960 t = (col << 1) & 0xe;
1961 t |= t << 4;
1962 *blue = t | (t << 8);
1963 }
1964 *transp = 0;
1965 return 0;
1966}
1967
1968
1969static int stste_setcolreg(unsigned regno, unsigned red,
1970 unsigned green, unsigned blue,
1971 unsigned transp, struct fb_info *info)
1972{ 2016{
1973 if (regno > 15) 2017 if (regno > 15)
1974 return 1; 2018 return 1;
@@ -1988,10 +2032,9 @@ static int stste_setcolreg(unsigned regno, unsigned red,
1988 return 0; 2032 return 0;
1989} 2033}
1990 2034
1991 2035static int stste_detect(void)
1992static int stste_detect( void ) 2036{
1993 2037 struct atafb_par par;
1994{ struct atafb_par par;
1995 2038
1996 /* Determine the connected monitor: The DMA sound must be 2039 /* Determine the connected monitor: The DMA sound must be
1997 * disabled before reading the MFP GPIP, because the Sound 2040 * disabled before reading the MFP GPIP, because the Sound
@@ -1999,7 +2042,7 @@ static int stste_detect( void )
1999 */ 2042 */
2000 if (ATARIHW_PRESENT(PCM_8BIT)) { 2043 if (ATARIHW_PRESENT(PCM_8BIT)) {
2001 tt_dmasnd.ctrl = DMASND_CTRL_OFF; 2044 tt_dmasnd.ctrl = DMASND_CTRL_OFF;
2002 udelay(20); /* wait a while for things to settle down */ 2045 udelay(20); /* wait a while for things to settle down */
2003 } 2046 }
2004 mono_moni = (mfp.par_dt_reg & 0x80) == 0; 2047 mono_moni = (mfp.par_dt_reg & 0x80) == 0;
2005 2048
@@ -2014,12 +2057,12 @@ static int stste_detect( void )
2014static void stste_set_screen_base(void *s_base) 2057static void stste_set_screen_base(void *s_base)
2015{ 2058{
2016 unsigned long addr; 2059 unsigned long addr;
2017 addr= virt_to_phys(s_base); 2060 addr = virt_to_phys(s_base);
2018 /* Setup Screen Memory */ 2061 /* Setup Screen Memory */
2019 shifter.bas_hi=(unsigned char) ((addr & 0xff0000) >> 16); 2062 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16);
2020 shifter.bas_md=(unsigned char) ((addr & 0x00ff00) >> 8); 2063 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8);
2021 if (ATARIHW_PRESENT(EXTD_SHIFTER)) 2064 if (ATARIHW_PRESENT(EXTD_SHIFTER))
2022 shifter.bas_lo=(unsigned char) (addr & 0x0000ff); 2065 shifter.bas_lo = (unsigned char)(addr & 0x0000ff);
2023} 2066}
2024 2067
2025#endif /* ATAFB_STE */ 2068#endif /* ATAFB_STE */
@@ -2045,51 +2088,49 @@ static void stste_set_screen_base(void *s_base)
2045/* SWITCH_ACIA may be used for Falcon (ScreenBlaster III internal!) */ 2088/* SWITCH_ACIA may be used for Falcon (ScreenBlaster III internal!) */
2046static void st_ovsc_switch(void) 2089static void st_ovsc_switch(void)
2047{ 2090{
2048 unsigned long flags; 2091 unsigned long flags;
2049 register unsigned char old, new; 2092 register unsigned char old, new;
2050 2093
2051 if (!(atari_switches & ATARI_SWITCH_OVSC_MASK)) 2094 if (!(atari_switches & ATARI_SWITCH_OVSC_MASK))
2052 return; 2095 return;
2053 local_irq_save(flags); 2096 local_irq_save(flags);
2054 2097
2055 mfp.tim_ct_b = 0x10; 2098 mfp.tim_ct_b = 0x10;
2056 mfp.active_edge |= 8; 2099 mfp.active_edge |= 8;
2057 mfp.tim_ct_b = 0; 2100 mfp.tim_ct_b = 0;
2058 mfp.tim_dt_b = 0xf0; 2101 mfp.tim_dt_b = 0xf0;
2059 mfp.tim_ct_b = 8; 2102 mfp.tim_ct_b = 8;
2060 while (mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ 2103 while (mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */
2061 ; 2104 ;
2062 new = mfp.tim_dt_b;
2063 do {
2064 udelay(LINE_DELAY);
2065 old = new;
2066 new = mfp.tim_dt_b; 2105 new = mfp.tim_dt_b;
2067 } while (old != new); 2106 do {
2068 mfp.tim_ct_b = 0x10; 2107 udelay(LINE_DELAY);
2069 udelay(SYNC_DELAY); 2108 old = new;
2070 2109 new = mfp.tim_dt_b;
2071 if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 2110 } while (old != new);
2072 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID | ACIA_RIE; 2111 mfp.tim_ct_b = 0x10;
2073 if (atari_switches & ATARI_SWITCH_OVSC_MIDI) 2112 udelay(SYNC_DELAY);
2074 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; 2113
2075 if (atari_switches & (ATARI_SWITCH_OVSC_SND6|ATARI_SWITCH_OVSC_SND7)) { 2114 if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
2076 sound_ym.rd_data_reg_sel = 14; 2115 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID | ACIA_RIE;
2077 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 2116 if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
2078 ((atari_switches&ATARI_SWITCH_OVSC_SND6) ? 0x40:0) | 2117 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
2079 ((atari_switches&ATARI_SWITCH_OVSC_SND7) ? 0x80:0); 2118 if (atari_switches & (ATARI_SWITCH_OVSC_SND6|ATARI_SWITCH_OVSC_SND7)) {
2080 } 2119 sound_ym.rd_data_reg_sel = 14;
2081 local_irq_restore(flags); 2120 sound_ym.wd_data = sound_ym.rd_data_reg_sel |
2121 ((atari_switches & ATARI_SWITCH_OVSC_SND6) ? 0x40:0) |
2122 ((atari_switches & ATARI_SWITCH_OVSC_SND7) ? 0x80:0);
2123 }
2124 local_irq_restore(flags);
2082} 2125}
2083 2126
2084/* ------------------- External Video ---------------------- */ 2127/* ------------------- External Video ---------------------- */
2085 2128
2086#ifdef ATAFB_EXT 2129#ifdef ATAFB_EXT
2087 2130
2088static int ext_encode_fix( struct fb_fix_screeninfo *fix, 2131static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
2089 struct atafb_par *par )
2090
2091{ 2132{
2092 strcpy(fix->id,"Unknown Extern"); 2133 strcpy(fix->id, "Unknown Extern");
2093 fix->smem_start = (unsigned long)external_addr; 2134 fix->smem_start = (unsigned long)external_addr;
2094 fix->smem_len = PAGE_ALIGN(external_len); 2135 fix->smem_len = PAGE_ALIGN(external_len);
2095 if (external_depth == 1) { 2136 if (external_depth == 1) {
@@ -2099,31 +2140,29 @@ static int ext_encode_fix( struct fb_fix_screeninfo *fix,
2099 fix->visual = 2140 fix->visual =
2100 (external_pmode == FB_TYPE_INTERLEAVED_PLANES || 2141 (external_pmode == FB_TYPE_INTERLEAVED_PLANES ||
2101 external_pmode == FB_TYPE_PACKED_PIXELS) ? 2142 external_pmode == FB_TYPE_PACKED_PIXELS) ?
2102 FB_VISUAL_MONO10 : 2143 FB_VISUAL_MONO10 : FB_VISUAL_MONO01;
2103 FB_VISUAL_MONO01; 2144 } else {
2104 }
2105 else {
2106 /* Use STATIC if we don't know how to access color registers */ 2145 /* Use STATIC if we don't know how to access color registers */
2107 int visual = external_vgaiobase ? 2146 int visual = external_vgaiobase ?
2108 FB_VISUAL_PSEUDOCOLOR : 2147 FB_VISUAL_PSEUDOCOLOR :
2109 FB_VISUAL_STATIC_PSEUDOCOLOR; 2148 FB_VISUAL_STATIC_PSEUDOCOLOR;
2110 switch (external_pmode) { 2149 switch (external_pmode) {
2111 case -1: /* truecolor */ 2150 case -1: /* truecolor */
2112 fix->type=FB_TYPE_PACKED_PIXELS; 2151 fix->type = FB_TYPE_PACKED_PIXELS;
2113 fix->visual=FB_VISUAL_TRUECOLOR; 2152 fix->visual = FB_VISUAL_TRUECOLOR;
2114 break; 2153 break;
2115 case FB_TYPE_PACKED_PIXELS: 2154 case FB_TYPE_PACKED_PIXELS:
2116 fix->type=FB_TYPE_PACKED_PIXELS; 2155 fix->type = FB_TYPE_PACKED_PIXELS;
2117 fix->visual=visual; 2156 fix->visual = visual;
2118 break; 2157 break;
2119 case FB_TYPE_PLANES: 2158 case FB_TYPE_PLANES:
2120 fix->type=FB_TYPE_PLANES; 2159 fix->type = FB_TYPE_PLANES;
2121 fix->visual=visual; 2160 fix->visual = visual;
2122 break; 2161 break;
2123 case FB_TYPE_INTERLEAVED_PLANES: 2162 case FB_TYPE_INTERLEAVED_PLANES:
2124 fix->type=FB_TYPE_INTERLEAVED_PLANES; 2163 fix->type = FB_TYPE_INTERLEAVED_PLANES;
2125 fix->type_aux=2; 2164 fix->type_aux = 2;
2126 fix->visual=visual; 2165 fix->visual = visual;
2127 break; 2166 break;
2128 } 2167 }
2129 } 2168 }
@@ -2134,137 +2173,112 @@ static int ext_encode_fix( struct fb_fix_screeninfo *fix,
2134 return 0; 2173 return 0;
2135} 2174}
2136 2175
2137 2176static int ext_decode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
2138static int ext_decode_var( struct fb_var_screeninfo *var,
2139 struct atafb_par *par )
2140{ 2177{
2141 struct fb_var_screeninfo *myvar = &atafb_predefined[0]; 2178 struct fb_var_screeninfo *myvar = &atafb_predefined[0];
2142 2179
2143 if (var->bits_per_pixel > myvar->bits_per_pixel || 2180 if (var->bits_per_pixel > myvar->bits_per_pixel ||
2144 var->xres > myvar->xres || 2181 var->xres > myvar->xres ||
2145 var->xres_virtual > myvar->xres_virtual || 2182 var->xres_virtual > myvar->xres_virtual ||
2146 var->yres > myvar->yres || 2183 var->yres > myvar->yres ||
2147 var->xoffset > 0 || 2184 var->xoffset > 0 ||
2148 var->yoffset > 0) 2185 var->yoffset > 0)
2149 return -EINVAL; 2186 return -EINVAL;
2150 return 0; 2187 return 0;
2151} 2188}
2152 2189
2153 2190static int ext_encode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
2154static int ext_encode_var( struct fb_var_screeninfo *var,
2155 struct atafb_par *par )
2156{ 2191{
2157 memset(var, 0, sizeof(struct fb_var_screeninfo)); 2192 memset(var, 0, sizeof(struct fb_var_screeninfo));
2158 var->red.offset=0; 2193 var->red.offset = 0;
2159 var->red.length=(external_pmode == -1) ? external_depth/3 : 2194 var->red.length = (external_pmode == -1) ? external_depth / 3 :
2160 (external_vgaiobase ? external_bitspercol : 0); 2195 (external_vgaiobase ? external_bitspercol : 0);
2161 var->red.msb_right=0; 2196 var->red.msb_right = 0;
2162 var->grayscale=0; 2197 var->grayscale = 0;
2163 2198
2164 var->pixclock=31041; 2199 var->pixclock = 31041;
2165 var->left_margin=120; /* these are surely incorrect */ 2200 var->left_margin = 120; /* these are surely incorrect */
2166 var->right_margin=100; 2201 var->right_margin = 100;
2167 var->upper_margin=8; 2202 var->upper_margin = 8;
2168 var->lower_margin=16; 2203 var->lower_margin = 16;
2169 var->hsync_len=140; 2204 var->hsync_len = 140;
2170 var->vsync_len=30; 2205 var->vsync_len = 30;
2171 2206
2172 var->height=-1; 2207 var->height = -1;
2173 var->width=-1; 2208 var->width = -1;
2174 2209
2175 var->sync=0; 2210 var->sync = 0;
2176 2211
2177 var->xres = external_xres; 2212 var->xres = external_xres;
2178 var->yres = external_yres; 2213 var->yres = external_yres;
2179 var->xres_virtual = external_xres_virtual; 2214 var->xres_virtual = external_xres_virtual;
2180 var->bits_per_pixel = external_depth; 2215 var->bits_per_pixel = external_depth;
2181 2216
2182 var->blue=var->green=var->red; 2217 var->blue = var->green = var->red;
2183 var->transp.offset=0; 2218 var->transp.offset = 0;
2184 var->transp.length=0; 2219 var->transp.length = 0;
2185 var->transp.msb_right=0; 2220 var->transp.msb_right = 0;
2186 var->yres_virtual=var->yres; 2221 var->yres_virtual = var->yres;
2187 var->xoffset=0; 2222 var->xoffset = 0;
2188 var->yoffset=0; 2223 var->yoffset = 0;
2189 var->nonstd=0; 2224 var->nonstd = 0;
2190 var->activate=0; 2225 var->activate = 0;
2191 var->vmode=FB_VMODE_NONINTERLACED; 2226 var->vmode = FB_VMODE_NONINTERLACED;
2192 return 0; 2227 return 0;
2193} 2228}
2194 2229
2195 2230static void ext_get_par(struct atafb_par *par)
2196static void ext_get_par( struct atafb_par *par )
2197{ 2231{
2198 par->screen_base = external_addr; 2232 par->screen_base = external_addr;
2199} 2233}
2200 2234
2201static void ext_set_par( struct atafb_par *par ) 2235static void ext_set_par(struct atafb_par *par)
2202{ 2236{
2203} 2237}
2204 2238
2205#define OUTB(port,val) \ 2239#define OUTB(port,val) \
2206 *((unsigned volatile char *) ((port)+external_vgaiobase))=(val) 2240 *((unsigned volatile char *) ((port)+external_vgaiobase)) = (val)
2207#define INB(port) \ 2241#define INB(port) \
2208 (*((unsigned volatile char *) ((port)+external_vgaiobase))) 2242 (*((unsigned volatile char *) ((port)+external_vgaiobase)))
2209#define DACDelay \ 2243#define DACDelay \
2210 do { \ 2244 do { \
2211 unsigned char tmp=INB(0x3da); \ 2245 unsigned char tmp = INB(0x3da); \
2212 tmp=INB(0x3da); \ 2246 tmp = INB(0x3da); \
2213 } while (0) 2247 } while (0)
2214 2248
2215static int ext_getcolreg( unsigned regno, unsigned *red, 2249static int ext_setcolreg(unsigned int regno, unsigned int red,
2216 unsigned *green, unsigned *blue, 2250 unsigned int green, unsigned int blue,
2217 unsigned *transp, struct fb_info *info ) 2251 unsigned int transp, struct fb_info *info)
2218{ 2252{
2219 if (! external_vgaiobase) 2253 unsigned char colmask = (1 << external_bitspercol) - 1;
2254
2255 if (!external_vgaiobase)
2220 return 1; 2256 return 1;
2221 2257
2222 *red = ext_color[regno].red; 2258 switch (external_card_type) {
2223 *green = ext_color[regno].green; 2259 case IS_VGA:
2224 *blue = ext_color[regno].blue; 2260 OUTB(0x3c8, regno);
2225 *transp=0; 2261 DACDelay;
2226 return 0; 2262 OUTB(0x3c9, red & colmask);
2227} 2263 DACDelay;
2228 2264 OUTB(0x3c9, green & colmask);
2229static int ext_setcolreg( unsigned regno, unsigned red, 2265 DACDelay;
2230 unsigned green, unsigned blue, 2266 OUTB(0x3c9, blue & colmask);
2231 unsigned transp, struct fb_info *info ) 2267 DACDelay;
2268 return 0;
2232 2269
2233{ unsigned char colmask = (1 << external_bitspercol) - 1; 2270 case IS_MV300:
2271 OUTB((MV300_reg[regno] << 2) + 1, red);
2272 OUTB((MV300_reg[regno] << 2) + 1, green);
2273 OUTB((MV300_reg[regno] << 2) + 1, blue);
2274 return 0;
2234 2275
2235 if (! external_vgaiobase) 2276 default:
2236 return 1; 2277 return 1;
2237 2278 }
2238 ext_color[regno].red = red;
2239 ext_color[regno].green = green;
2240 ext_color[regno].blue = blue;
2241
2242 switch (external_card_type) {
2243 case IS_VGA:
2244 OUTB(0x3c8, regno);
2245 DACDelay;
2246 OUTB(0x3c9, red & colmask);
2247 DACDelay;
2248 OUTB(0x3c9, green & colmask);
2249 DACDelay;
2250 OUTB(0x3c9, blue & colmask);
2251 DACDelay;
2252 return 0;
2253
2254 case IS_MV300:
2255 OUTB((MV300_reg[regno] << 2)+1, red);
2256 OUTB((MV300_reg[regno] << 2)+1, green);
2257 OUTB((MV300_reg[regno] << 2)+1, blue);
2258 return 0;
2259
2260 default:
2261 return 1;
2262 }
2263} 2279}
2264
2265
2266static int ext_detect( void )
2267 2280
2281static int ext_detect(void)
2268{ 2282{
2269 struct fb_var_screeninfo *myvar = &atafb_predefined[0]; 2283 struct fb_var_screeninfo *myvar = &atafb_predefined[0];
2270 struct atafb_par dummy_par; 2284 struct atafb_par dummy_par;
@@ -2284,213 +2298,182 @@ static int ext_detect( void )
2284static void set_screen_base(void *s_base) 2298static void set_screen_base(void *s_base)
2285{ 2299{
2286 unsigned long addr; 2300 unsigned long addr;
2287 addr= virt_to_phys(s_base); 2301
2302 addr = virt_to_phys(s_base);
2288 /* Setup Screen Memory */ 2303 /* Setup Screen Memory */
2289 shifter.bas_hi=(unsigned char) ((addr & 0xff0000) >> 16); 2304 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16);
2290 shifter.bas_md=(unsigned char) ((addr & 0x00ff00) >> 8); 2305 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8);
2291 shifter.bas_lo=(unsigned char) (addr & 0x0000ff); 2306 shifter.bas_lo = (unsigned char)(addr & 0x0000ff);
2292} 2307}
2293 2308
2294 2309static int pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
2295static int pan_display( struct fb_var_screeninfo *var,
2296 struct atafb_par *par )
2297{ 2310{
2311 struct atafb_par *par = (struct atafb_par *)info->par;
2312
2298 if (!fbhw->set_screen_base || 2313 if (!fbhw->set_screen_base ||
2299 (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset)) 2314 (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset))
2300 return -EINVAL; 2315 return -EINVAL;
2301 var->xoffset = up(var->xoffset, 16); 2316 var->xoffset = up(var->xoffset, 16);
2302 par->screen_base = screen_base + 2317 par->screen_base = screen_base +
2303 (var->yoffset * fb_display[fb_info.currcon].var.xres_virtual + var->xoffset) 2318 (var->yoffset * info->var.xres_virtual + var->xoffset)
2304 * fb_display[fb_info.currcon].var.bits_per_pixel / 8; 2319 * info->var.bits_per_pixel / 8;
2305 fbhw->set_screen_base (par->screen_base); 2320 fbhw->set_screen_base(par->screen_base);
2306 return 0; 2321 return 0;
2307} 2322}
2308 2323
2309
2310/* ------------ Interfaces to hardware functions ------------ */ 2324/* ------------ Interfaces to hardware functions ------------ */
2311 2325
2312
2313#ifdef ATAFB_TT 2326#ifdef ATAFB_TT
2314static struct fb_hwswitch tt_switch = { 2327static struct fb_hwswitch tt_switch = {
2315 tt_detect, tt_encode_fix, tt_decode_var, tt_encode_var, 2328 .detect = tt_detect,
2316 tt_get_par, tt_set_par, tt_getcolreg, 2329 .encode_fix = tt_encode_fix,
2317 set_screen_base, NULL, pan_display 2330 .decode_var = tt_decode_var,
2331 .encode_var = tt_encode_var,
2332 .get_par = tt_get_par,
2333 .set_par = tt_set_par,
2334 .set_screen_base = set_screen_base,
2335 .pan_display = pan_display,
2318}; 2336};
2319#endif 2337#endif
2320 2338
2321#ifdef ATAFB_FALCON 2339#ifdef ATAFB_FALCON
2322static struct fb_hwswitch falcon_switch = { 2340static struct fb_hwswitch falcon_switch = {
2323 falcon_detect, falcon_encode_fix, falcon_decode_var, falcon_encode_var, 2341 .detect = falcon_detect,
2324 falcon_get_par, falcon_set_par, falcon_getcolreg, 2342 .encode_fix = falcon_encode_fix,
2325 set_screen_base, falcon_blank, falcon_pan_display 2343 .decode_var = falcon_decode_var,
2344 .encode_var = falcon_encode_var,
2345 .get_par = falcon_get_par,
2346 .set_par = falcon_set_par,
2347 .set_screen_base = set_screen_base,
2348 .blank = falcon_blank,
2349 .pan_display = falcon_pan_display,
2326}; 2350};
2327#endif 2351#endif
2328 2352
2329#ifdef ATAFB_STE 2353#ifdef ATAFB_STE
2330static struct fb_hwswitch st_switch = { 2354static struct fb_hwswitch st_switch = {
2331 stste_detect, stste_encode_fix, stste_decode_var, stste_encode_var, 2355 .detect = stste_detect,
2332 stste_get_par, stste_set_par, stste_getcolreg, 2356 .encode_fix = stste_encode_fix,
2333 stste_set_screen_base, NULL, pan_display 2357 .decode_var = stste_decode_var,
2358 .encode_var = stste_encode_var,
2359 .get_par = stste_get_par,
2360 .set_par = stste_set_par,
2361 .set_screen_base = stste_set_screen_base,
2362 .pan_display = pan_display
2334}; 2363};
2335#endif 2364#endif
2336 2365
2337#ifdef ATAFB_EXT 2366#ifdef ATAFB_EXT
2338static struct fb_hwswitch ext_switch = { 2367static struct fb_hwswitch ext_switch = {
2339 ext_detect, ext_encode_fix, ext_decode_var, ext_encode_var, 2368 .detect = ext_detect,
2340 ext_get_par, ext_set_par, ext_getcolreg, NULL, NULL, NULL 2369 .encode_fix = ext_encode_fix,
2370 .decode_var = ext_decode_var,
2371 .encode_var = ext_encode_var,
2372 .get_par = ext_get_par,
2373 .set_par = ext_set_par,
2341}; 2374};
2342#endif 2375#endif
2343 2376
2344 2377static void ata_get_par(struct atafb_par *par)
2345
2346static void atafb_get_par( struct atafb_par *par )
2347{ 2378{
2348 if (current_par_valid) { 2379 if (current_par_valid)
2349 *par=current_par; 2380 *par = current_par;
2350 }
2351 else 2381 else
2352 fbhw->get_par(par); 2382 fbhw->get_par(par);
2353} 2383}
2354 2384
2355 2385static void ata_set_par(struct atafb_par *par)
2356static void atafb_set_par( struct atafb_par *par )
2357{ 2386{
2358 fbhw->set_par(par); 2387 fbhw->set_par(par);
2359 current_par=*par; 2388 current_par = *par;
2360 current_par_valid=1; 2389 current_par_valid = 1;
2361} 2390}
2362 2391
2363 2392
2364
2365/* =========================================================== */ 2393/* =========================================================== */
2366/* ============== Hardware Independent Functions ============= */ 2394/* ============== Hardware Independent Functions ============= */
2367/* =========================================================== */ 2395/* =========================================================== */
2368 2396
2369
2370/* used for hardware scrolling */ 2397/* used for hardware scrolling */
2371 2398
2372static int 2399static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive)
2373fb_update_var(int con, struct fb_info *info)
2374{
2375 int off=fb_display[con].var.yoffset*fb_display[con].var.xres_virtual*
2376 fb_display[con].var.bits_per_pixel>>3;
2377
2378 current_par.screen_base=screen_base + off;
2379
2380 if (fbhw->set_screen_base)
2381 fbhw->set_screen_base(current_par.screen_base);
2382 return 0;
2383}
2384
2385static int
2386do_fb_set_var(struct fb_var_screeninfo *var, int isactive)
2387{ 2400{
2388 int err,activate; 2401 int err, activate;
2389 struct atafb_par par; 2402 struct atafb_par par;
2390 if ((err=fbhw->decode_var(var, &par))) 2403
2404 err = fbhw->decode_var(var, &par);
2405 if (err)
2391 return err; 2406 return err;
2392 activate=var->activate; 2407 activate = var->activate;
2393 if (((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive) 2408 if (((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive)
2394 atafb_set_par(&par); 2409 ata_set_par(&par);
2395 fbhw->encode_var(var, &par); 2410 fbhw->encode_var(var, &par);
2396 var->activate=activate; 2411 var->activate = activate;
2397 return 0; 2412 return 0;
2398} 2413}
2399 2414
2400static int 2415static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
2401atafb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
2402{ 2416{
2403 struct atafb_par par; 2417 struct atafb_par par;
2404 if (con == -1) 2418 int err;
2405 atafb_get_par(&par); 2419 // Get fix directly (case con == -1 before)??
2406 else { 2420 err = fbhw->decode_var(&info->var, &par);
2407 int err; 2421 if (err)
2408 if ((err=fbhw->decode_var(&fb_display[con].var,&par))) 2422 return err;
2409 return err;
2410 }
2411 memset(fix, 0, sizeof(struct fb_fix_screeninfo)); 2423 memset(fix, 0, sizeof(struct fb_fix_screeninfo));
2412 return fbhw->encode_fix(fix, &par); 2424 return fbhw->encode_fix(fix, &par);
2413} 2425}
2414 2426
2415static int 2427static int atafb_get_var(struct fb_var_screeninfo *var, struct fb_info *info)
2416atafb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
2417{ 2428{
2418 struct atafb_par par; 2429 struct atafb_par par;
2419 if (con == -1) { 2430
2420 atafb_get_par(&par); 2431 ata_get_par(&par);
2421 fbhw->encode_var(var, &par); 2432 fbhw->encode_var(var, &par);
2422 } 2433
2423 else
2424 *var=fb_display[con].var;
2425 return 0; 2434 return 0;
2426} 2435}
2427 2436
2428static void 2437// No longer called by fbcon!
2429atafb_set_disp(int con, struct fb_info *info) 2438// Still called by set_var internally
2439
2440static void atafb_set_disp(struct fb_info *info)
2430{ 2441{
2431 struct fb_fix_screeninfo fix; 2442 atafb_get_var(&info->var, info);
2432 struct fb_var_screeninfo var; 2443 atafb_get_fix(&info->fix, info);
2433 struct display *display;
2434 2444
2435 if (con >= 0) 2445 info->screen_base = (void *)info->fix.smem_start;
2436 display = &fb_display[con]; 2446
2437 else 2447 switch (info->fix.type) {
2438 display = &disp; /* used during initialization */ 2448 case FB_TYPE_INTERLEAVED_PLANES:
2439 2449 switch (info->var.bits_per_pixel) {
2440 atafb_get_fix(&fix, con, info); 2450 case 2:
2441 atafb_get_var(&var, con, info); 2451 // display->dispsw = &fbcon_iplan2p2;
2442 if (con == -1)
2443 con=0;
2444 info->screen_base = (void *)fix.smem_start;
2445 display->visual = fix.visual;
2446 display->type = fix.type;
2447 display->type_aux = fix.type_aux;
2448 display->ypanstep = fix.ypanstep;
2449 display->ywrapstep = fix.ywrapstep;
2450 display->line_length = fix.line_length;
2451 if (fix.visual != FB_VISUAL_PSEUDOCOLOR &&
2452 fix.visual != FB_VISUAL_DIRECTCOLOR)
2453 display->can_soft_blank = 0;
2454 else
2455 display->can_soft_blank = 1;
2456 display->inverse =
2457 (fix.visual == FB_VISUAL_MONO01 ? !inverse : inverse);
2458 switch (fix.type) {
2459 case FB_TYPE_INTERLEAVED_PLANES:
2460 switch (var.bits_per_pixel) {
2461#ifdef FBCON_HAS_IPLAN2P2
2462 case 2:
2463 display->dispsw = &fbcon_iplan2p2;
2464 break; 2452 break;
2465#endif 2453 case 4:
2466#ifdef FBCON_HAS_IPLAN2P4 2454 // display->dispsw = &fbcon_iplan2p4;
2467 case 4:
2468 display->dispsw = &fbcon_iplan2p4;
2469 break; 2455 break;
2470#endif 2456 case 8:
2471#ifdef FBCON_HAS_IPLAN2P8 2457 // display->dispsw = &fbcon_iplan2p8;
2472 case 8:
2473 display->dispsw = &fbcon_iplan2p8;
2474 break; 2458 break;
2475#endif
2476 } 2459 }
2477 break; 2460 break;
2478 case FB_TYPE_PACKED_PIXELS: 2461 case FB_TYPE_PACKED_PIXELS:
2479 switch (var.bits_per_pixel) { 2462 switch (info->var.bits_per_pixel) {
2480#ifdef FBCON_HAS_MFB 2463#ifdef FBCON_HAS_MFB
2481 case 1: 2464 case 1:
2482 display->dispsw = &fbcon_mfb; 2465 // display->dispsw = &fbcon_mfb;
2483 break; 2466 break;
2484#endif 2467#endif
2485#ifdef FBCON_HAS_CFB8 2468#ifdef FBCON_HAS_CFB8
2486 case 8: 2469 case 8:
2487 display->dispsw = &fbcon_cfb8; 2470 // display->dispsw = &fbcon_cfb8;
2488 break; 2471 break;
2489#endif 2472#endif
2490#ifdef FBCON_HAS_CFB16 2473#ifdef FBCON_HAS_CFB16
2491 case 16: 2474 case 16:
2492 display->dispsw = &fbcon_cfb16; 2475 // display->dispsw = &fbcon_cfb16;
2493 display->dispsw_data = fbcon_cfb16_cmap; 2476 // display->dispsw_data = fbcon_cfb16_cmap;
2494 break; 2477 break;
2495#endif 2478#endif
2496 } 2479 }
@@ -2498,74 +2481,203 @@ atafb_set_disp(int con, struct fb_info *info)
2498 } 2481 }
2499} 2482}
2500 2483
2484static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2485 u_int transp, struct fb_info *info)
2486{
2487 red >>= 8;
2488 green >>= 8;
2489 blue >>= 8;
2490
2491 return info->fbops->fb_setcolreg(regno, red, green, blue, transp, info);
2492}
2493
2501static int 2494static int
2502atafb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) 2495atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
2503{ 2496{
2504 int err,oldxres,oldyres,oldbpp,oldxres_virtual, 2497 int xoffset = var->xoffset;
2505 oldyres_virtual,oldyoffset; 2498 int yoffset = var->yoffset;
2506 if ((err=do_fb_set_var(var, con==info->currcon))) 2499 int err;
2507 return err; 2500
2508 if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { 2501 if (var->vmode & FB_VMODE_YWRAP) {
2509 oldxres=fb_display[con].var.xres; 2502 if (yoffset < 0 || yoffset >= info->var.yres_virtual || xoffset)
2510 oldyres=fb_display[con].var.yres; 2503 return -EINVAL;
2511 oldxres_virtual=fb_display[con].var.xres_virtual; 2504 } else {
2512 oldyres_virtual=fb_display[con].var.yres_virtual; 2505 if (xoffset + info->var.xres > info->var.xres_virtual ||
2513 oldbpp=fb_display[con].var.bits_per_pixel; 2506 yoffset + info->var.yres > info->var.yres_virtual)
2514 oldyoffset=fb_display[con].var.yoffset; 2507 return -EINVAL;
2515 fb_display[con].var=*var;
2516 if (oldxres != var->xres || oldyres != var->yres
2517 || oldxres_virtual != var->xres_virtual
2518 || oldyres_virtual != var->yres_virtual
2519 || oldbpp != var->bits_per_pixel
2520 || oldyoffset != var->yoffset) {
2521 atafb_set_disp(con, info);
2522 (*fb_info.changevar)(con);
2523 fb_alloc_cmap(&fb_display[con].cmap, 0, 0);
2524 do_install_cmap(con, info);
2525 }
2526 } 2508 }
2527 var->activate=0; 2509
2510 if (fbhw->pan_display) {
2511 err = fbhw->pan_display(var, info);
2512 if (err)
2513 return err;
2514 } else
2515 return -EINVAL;
2516
2517 info->var.xoffset = xoffset;
2518 info->var.yoffset = yoffset;
2519
2520 if (var->vmode & FB_VMODE_YWRAP)
2521 info->var.vmode |= FB_VMODE_YWRAP;
2522 else
2523 info->var.vmode &= ~FB_VMODE_YWRAP;
2524
2528 return 0; 2525 return 0;
2529} 2526}
2530 2527
2528/*
2529 * generic drawing routines; imageblit needs updating for image depth > 1
2530 */
2531 2531
2532#if BITS_PER_LONG == 32
2533#define BYTES_PER_LONG 4
2534#define SHIFT_PER_LONG 5
2535#elif BITS_PER_LONG == 64
2536#define BYTES_PER_LONG 8
2537#define SHIFT_PER_LONG 6
2538#else
2539#define Please update me
2540#endif
2532 2541
2533static int 2542
2534atafb_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) 2543static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
2535{ 2544{
2536 if (con == info->currcon) /* current console ? */ 2545 struct atafb_par *par = (struct atafb_par *)info->par;
2537 return fb_get_cmap(cmap, kspc, fbhw->getcolreg, info); 2546 int x2, y2;
2547 u32 width, height;
2548
2549 if (!rect->width || !rect->height)
2550 return;
2551
2552 /*
2553 * We could use hardware clipping but on many cards you get around
2554 * hardware clipping by writing to framebuffer directly.
2555 * */
2556 x2 = rect->dx + rect->width;
2557 y2 = rect->dy + rect->height;
2558 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
2559 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
2560 width = x2 - rect->dx;
2561 height = y2 - rect->dy;
2562
2563 if (info->var.bits_per_pixel == 1)
2564 atafb_mfb_fillrect(info, par->next_line, rect->color,
2565 rect->dy, rect->dx, height, width);
2566 else if (info->var.bits_per_pixel == 2)
2567 atafb_iplan2p2_fillrect(info, par->next_line, rect->color,
2568 rect->dy, rect->dx, height, width);
2569 else if (info->var.bits_per_pixel == 4)
2570 atafb_iplan2p4_fillrect(info, par->next_line, rect->color,
2571 rect->dy, rect->dx, height, width);
2538 else 2572 else
2539 if (fb_display[con].cmap.len) /* non default colormap ? */ 2573 atafb_iplan2p8_fillrect(info, par->next_line, rect->color,
2540 fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2); 2574 rect->dy, rect->dx, height, width);
2541 else 2575
2542 fb_copy_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel), 2576 return;
2543 cmap, kspc ? 0 : 2);
2544 return 0;
2545} 2577}
2546 2578
2547static int 2579static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
2548atafb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info)
2549{ 2580{
2550 int xoffset = var->xoffset; 2581 struct atafb_par *par = (struct atafb_par *)info->par;
2551 int yoffset = var->yoffset; 2582 int x2, y2;
2552 int err; 2583 u32 dx, dy, sx, sy, width, height;
2584 int rev_copy = 0;
2585
2586 /* clip the destination */
2587 x2 = area->dx + area->width;
2588 y2 = area->dy + area->height;
2589 dx = area->dx > 0 ? area->dx : 0;
2590 dy = area->dy > 0 ? area->dy : 0;
2591 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
2592 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
2593 width = x2 - dx;
2594 height = y2 - dy;
2595
2596 /* update sx,sy */
2597 sx = area->sx + (dx - area->dx);
2598 sy = area->sy + (dy - area->dy);
2599
2600 /* the source must be completely inside the virtual screen */
2601 if (sx < 0 || sy < 0 || (sx + width) > info->var.xres_virtual ||
2602 (sy + height) > info->var.yres_virtual)
2603 return;
2553 2604
2554 if ( xoffset < 0 || xoffset + fb_display[con].var.xres > fb_display[con].var.xres_virtual 2605 if (dy > sy || (dy == sy && dx > sx)) {
2555 || yoffset < 0 || yoffset + fb_display[con].var.yres > fb_display[con].var.yres_virtual) 2606 dy += height;
2556 return -EINVAL; 2607 sy += height;
2608 rev_copy = 1;
2609 }
2610
2611 if (info->var.bits_per_pixel == 1)
2612 atafb_mfb_copyarea(info, par->next_line, sy, sx, dy, dx, height, width);
2613 else if (info->var.bits_per_pixel == 2)
2614 atafb_iplan2p2_copyarea(info, par->next_line, sy, sx, dy, dx, height, width);
2615 else if (info->var.bits_per_pixel == 4)
2616 atafb_iplan2p4_copyarea(info, par->next_line, sy, sx, dy, dx, height, width);
2617 else
2618 atafb_iplan2p8_copyarea(info, par->next_line, sy, sx, dy, dx, height, width);
2557 2619
2558 if (con == info->currcon) { 2620 return;
2559 if (fbhw->pan_display) { 2621}
2560 if ((err = fbhw->pan_display(var, &current_par))) 2622
2561 return err; 2623static void atafb_imageblit(struct fb_info *info, const struct fb_image *image)
2624{
2625 struct atafb_par *par = (struct atafb_par *)info->par;
2626 int x2, y2;
2627 unsigned long *dst;
2628 int dst_idx;
2629 const char *src;
2630 u32 dx, dy, width, height, pitch;
2631
2632 /*
2633 * We could use hardware clipping but on many cards you get around
2634 * hardware clipping by writing to framebuffer directly like we are
2635 * doing here.
2636 */
2637 x2 = image->dx + image->width;
2638 y2 = image->dy + image->height;
2639 dx = image->dx;
2640 dy = image->dy;
2641 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
2642 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
2643 width = x2 - dx;
2644 height = y2 - dy;
2645
2646 if (image->depth == 1) {
2647 // used for font data
2648 dst = (unsigned long *)
2649 ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1));
2650 dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8;
2651 dst_idx += dy * par->next_line * 8 + dx;
2652 src = image->data;
2653 pitch = (image->width + 7) / 8;
2654 while (height--) {
2655
2656 if (info->var.bits_per_pixel == 1)
2657 atafb_mfb_linefill(info, par->next_line,
2658 dy, dx, width, src,
2659 image->bg_color, image->fg_color);
2660 else if (info->var.bits_per_pixel == 2)
2661 atafb_iplan2p2_linefill(info, par->next_line,
2662 dy, dx, width, src,
2663 image->bg_color, image->fg_color);
2664 else if (info->var.bits_per_pixel == 4)
2665 atafb_iplan2p4_linefill(info, par->next_line,
2666 dy, dx, width, src,
2667 image->bg_color, image->fg_color);
2668 else
2669 atafb_iplan2p8_linefill(info, par->next_line,
2670 dy, dx, width, src,
2671 image->bg_color, image->fg_color);
2672 dy++;
2673 src += pitch;
2562 } 2674 }
2563 else 2675 } else {
2564 return -EINVAL; 2676 // only used for logo; broken
2677 c2p(info->screen_base, image->data, dx, dy, width, height,
2678 par->next_line, par->next_plane, image->width,
2679 info->var.bits_per_pixel);
2565 } 2680 }
2566 fb_display[con].var.xoffset = var->xoffset;
2567 fb_display[con].var.yoffset = var->yoffset;
2568 return 0;
2569} 2681}
2570 2682
2571static int 2683static int
@@ -2584,7 +2696,7 @@ atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
2584 if (copy_from_user((void *)&current_par, (void *)arg, 2696 if (copy_from_user((void *)&current_par, (void *)arg,
2585 sizeof(struct atafb_par))) 2697 sizeof(struct atafb_par)))
2586 return -EFAULT; 2698 return -EFAULT;
2587 atafb_set_par(&current_par); 2699 ata_set_par(&current_par);
2588 return 0; 2700 return 0;
2589#endif 2701#endif
2590 } 2702 }
@@ -2598,42 +2710,82 @@ atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
2598 * 3 = suspend hsync 2710 * 3 = suspend hsync
2599 * 4 = off 2711 * 4 = off
2600 */ 2712 */
2601static int 2713static int atafb_blank(int blank, struct fb_info *info)
2602atafb_blank(int blank, struct fb_info *info)
2603{ 2714{
2604 unsigned short black[16]; 2715 unsigned short black[16];
2605 struct fb_cmap cmap; 2716 struct fb_cmap cmap;
2606 if (fbhw->blank && !fbhw->blank(blank)) 2717 if (fbhw->blank && !fbhw->blank(blank))
2607 return 1; 2718 return 1;
2608 if (blank) { 2719 if (blank) {
2609 memset(black, 0, 16*sizeof(unsigned short)); 2720 memset(black, 0, 16 * sizeof(unsigned short));
2610 cmap.red=black; 2721 cmap.red = black;
2611 cmap.green=black; 2722 cmap.green = black;
2612 cmap.blue=black; 2723 cmap.blue = black;
2613 cmap.transp=NULL; 2724 cmap.transp = NULL;
2614 cmap.start=0; 2725 cmap.start = 0;
2615 cmap.len=16; 2726 cmap.len = 16;
2616 fb_set_cmap(&cmap, 1, info); 2727 fb_set_cmap(&cmap, info);
2617 } 2728 }
2729#if 0
2618 else 2730 else
2619 do_install_cmap(info->currcon, info); 2731 do_install_cmap(info);
2732#endif
2733 return 0;
2734}
2735
2736 /*
2737 * New fbcon interface ...
2738 */
2739
2740 /* check var by decoding var into hw par, rounding if necessary,
2741 * then encoding hw par back into new, validated var */
2742static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
2743{
2744 int err;
2745 struct atafb_par par;
2746
2747 /* Validate wanted screen parameters */
2748 // if ((err = ata_decode_var(var, &par)))
2749 err = fbhw->decode_var(var, &par);
2750 if (err)
2751 return err;
2752
2753 /* Encode (possibly rounded) screen parameters */
2754 fbhw->encode_var(var, &par);
2755 return 0;
2756}
2757
2758 /* actually set hw par by decoding var, then setting hardware from
2759 * hw par just decoded */
2760static int atafb_set_par(struct fb_info *info)
2761{
2762 struct atafb_par *par = (struct atafb_par *)info->par;
2763
2764 /* Decode wanted screen parameters */
2765 fbhw->decode_var(&info->var, par);
2766 fbhw->encode_fix(&info->fix, par);
2767
2768 /* Set new videomode */
2769 ata_set_par(par);
2770
2620 return 0; 2771 return 0;
2621} 2772}
2622 2773
2774
2623static struct fb_ops atafb_ops = { 2775static struct fb_ops atafb_ops = {
2624 .owner = THIS_MODULE, 2776 .owner = THIS_MODULE,
2625 .fb_get_fix = atafb_get_fix, 2777 .fb_check_var = atafb_check_var,
2626 .fb_get_var = atafb_get_var, 2778 .fb_set_par = atafb_set_par,
2627 .fb_set_var = atafb_set_var, 2779 .fb_setcolreg = atafb_setcolreg,
2628 .fb_get_cmap = atafb_get_cmap,
2629 .fb_set_cmap = gen_set_cmap,
2630 .fb_pan_display =atafb_pan_display,
2631 .fb_blank = atafb_blank, 2780 .fb_blank = atafb_blank,
2781 .fb_pan_display = atafb_pan_display,
2782 .fb_fillrect = atafb_fillrect,
2783 .fb_copyarea = atafb_copyarea,
2784 .fb_imageblit = atafb_imageblit,
2632 .fb_ioctl = atafb_ioctl, 2785 .fb_ioctl = atafb_ioctl,
2633}; 2786};
2634 2787
2635static void 2788static void check_default_par(int detected_mode)
2636check_default_par( int detected_mode )
2637{ 2789{
2638 char default_name[10]; 2790 char default_name[10];
2639 int i; 2791 int i;
@@ -2642,199 +2794,41 @@ check_default_par( int detected_mode )
2642 2794
2643 /* First try the user supplied mode */ 2795 /* First try the user supplied mode */
2644 if (default_par) { 2796 if (default_par) {
2645 var=atafb_predefined[default_par-1]; 2797 var = atafb_predefined[default_par - 1];
2646 var.activate = FB_ACTIVATE_TEST; 2798 var.activate = FB_ACTIVATE_TEST;
2647 if (do_fb_set_var(&var,1)) 2799 if (do_fb_set_var(&var, 1))
2648 default_par=0; /* failed */ 2800 default_par = 0; /* failed */
2649 } 2801 }
2650 /* Next is the autodetected one */ 2802 /* Next is the autodetected one */
2651 if (! default_par) { 2803 if (!default_par) {
2652 var=atafb_predefined[detected_mode-1]; /* autodetect */ 2804 var = atafb_predefined[detected_mode - 1]; /* autodetect */
2653 var.activate = FB_ACTIVATE_TEST; 2805 var.activate = FB_ACTIVATE_TEST;
2654 if (!do_fb_set_var(&var,1)) 2806 if (!do_fb_set_var(&var, 1))
2655 default_par=detected_mode; 2807 default_par = detected_mode;
2656 } 2808 }
2657 /* If that also failed, try some default modes... */ 2809 /* If that also failed, try some default modes... */
2658 if (! default_par) { 2810 if (!default_par) {
2659 /* try default1, default2... */ 2811 /* try default1, default2... */
2660 for (i=1 ; i < 10 ; i++) { 2812 for (i = 1; i < 10; i++) {
2661 sprintf(default_name,"default%d",i); 2813 sprintf(default_name,"default%d", i);
2662 default_par=get_video_mode(default_name); 2814 default_par = get_video_mode(default_name);
2663 if (! default_par) 2815 if (!default_par)
2664 panic("can't set default video mode"); 2816 panic("can't set default video mode");
2665 var=atafb_predefined[default_par-1]; 2817 var = atafb_predefined[default_par - 1];
2666 var.activate = FB_ACTIVATE_TEST; 2818 var.activate = FB_ACTIVATE_TEST;
2667 if (! do_fb_set_var(&var,1)) 2819 if (!do_fb_set_var(&var,1))
2668 break; /* ok */ 2820 break; /* ok */
2669 } 2821 }
2670 } 2822 }
2671 min_mem=var.xres_virtual * var.yres_virtual * var.bits_per_pixel/8; 2823 min_mem = var.xres_virtual * var.yres_virtual * var.bits_per_pixel / 8;
2672 if (default_mem_req < min_mem) 2824 if (default_mem_req < min_mem)
2673 default_mem_req=min_mem; 2825 default_mem_req = min_mem;
2674}
2675
2676static int
2677atafb_switch(int con, struct fb_info *info)
2678{
2679 /* Do we have to save the colormap ? */
2680 if (fb_display[info->currcon].cmap.len)
2681 fb_get_cmap(&fb_display[info->currcon].cmap, 1, fbhw->getcolreg,
2682 info);
2683 do_fb_set_var(&fb_display[con].var,1);
2684 info->currcon=con;
2685 /* Install new colormap */
2686 do_install_cmap(con, info);
2687 return 0;
2688}
2689
2690int __init atafb_init(void)
2691{
2692 int pad;
2693 int detected_mode;
2694 unsigned long mem_req;
2695
2696 if (!MACH_IS_ATARI)
2697 return -ENXIO;
2698
2699 do {
2700#ifdef ATAFB_EXT
2701 if (external_addr) {
2702 fbhw = &ext_switch;
2703 atafb_ops.fb_setcolreg = &ext_setcolreg;
2704 break;
2705 }
2706#endif
2707#ifdef ATAFB_TT
2708 if (ATARIHW_PRESENT(TT_SHIFTER)) {
2709 fbhw = &tt_switch;
2710 atafb_ops.fb_setcolreg = &tt_setcolreg;
2711 break;
2712 }
2713#endif
2714#ifdef ATAFB_FALCON
2715 if (ATARIHW_PRESENT(VIDEL_SHIFTER)) {
2716 fbhw = &falcon_switch;
2717 atafb_ops.fb_setcolreg = &falcon_setcolreg;
2718 request_irq(IRQ_AUTO_4, falcon_vbl_switcher, IRQ_TYPE_PRIO,
2719 "framebuffer/modeswitch", falcon_vbl_switcher);
2720 break;
2721 }
2722#endif
2723#ifdef ATAFB_STE
2724 if (ATARIHW_PRESENT(STND_SHIFTER) ||
2725 ATARIHW_PRESENT(EXTD_SHIFTER)) {
2726 fbhw = &st_switch;
2727 atafb_ops.fb_setcolreg = &stste_setcolreg;
2728 break;
2729 }
2730 fbhw = &st_switch;
2731 atafb_ops.fb_setcolreg = &stste_setcolreg;
2732 printk("Cannot determine video hardware; defaulting to ST(e)\n");
2733#else /* ATAFB_STE */
2734 /* no default driver included */
2735 /* Nobody will ever see this message :-) */
2736 panic("Cannot initialize video hardware");
2737#endif
2738 } while (0);
2739
2740 /* Multisync monitor capabilities */
2741 /* Atari-TOS defaults if no boot option present */
2742 if (fb_info.monspecs.hfmin == 0) {
2743 fb_info.monspecs.hfmin = 31000;
2744 fb_info.monspecs.hfmax = 32000;
2745 fb_info.monspecs.vfmin = 58;
2746 fb_info.monspecs.vfmax = 62;
2747 }
2748
2749 detected_mode = fbhw->detect();
2750 check_default_par(detected_mode);
2751#ifdef ATAFB_EXT
2752 if (!external_addr) {
2753#endif /* ATAFB_EXT */
2754 mem_req = default_mem_req + ovsc_offset + ovsc_addlen;
2755 mem_req = PAGE_ALIGN(mem_req) + PAGE_SIZE;
2756 screen_base = atari_stram_alloc(mem_req, "atafb");
2757 if (!screen_base)
2758 panic("Cannot allocate screen memory");
2759 memset(screen_base, 0, mem_req);
2760 pad = -(unsigned long)screen_base & (PAGE_SIZE-1);
2761 screen_base+=pad;
2762 real_screen_base=screen_base+ovsc_offset;
2763 screen_len = (mem_req - pad - ovsc_offset) & PAGE_MASK;
2764 st_ovsc_switch();
2765 if (CPU_IS_040_OR_060) {
2766 /* On a '040+, the cache mode of video RAM must be set to
2767 * write-through also for internal video hardware! */
2768 cache_push(virt_to_phys(screen_base), screen_len);
2769 kernel_set_cachemode(screen_base, screen_len,
2770 IOMAP_WRITETHROUGH);
2771 }
2772#ifdef ATAFB_EXT
2773 }
2774 else {
2775 /* Map the video memory (physical address given) to somewhere
2776 * in the kernel address space.
2777 */
2778 external_addr =
2779 ioremap_writethrough((unsigned long)external_addr,
2780 external_len);
2781 if (external_vgaiobase)
2782 external_vgaiobase =
2783 (unsigned long)ioremap(external_vgaiobase, 0x10000);
2784 screen_base =
2785 real_screen_base = external_addr;
2786 screen_len = external_len & PAGE_MASK;
2787 memset (screen_base, 0, external_len);
2788 }
2789#endif /* ATAFB_EXT */
2790
2791 strcpy(fb_info.modename, "Atari Builtin ");
2792 fb_info.changevar = NULL;
2793 fb_info.fbops = &atafb_ops;
2794 fb_info.disp = &disp;
2795 fb_info.currcon = -1;
2796 fb_info.switch_con = &atafb_switch;
2797 fb_info.updatevar = &fb_update_var;
2798 fb_info.flags = FBINFO_FLAG_DEFAULT;
2799 do_fb_set_var(&atafb_predefined[default_par-1], 1);
2800 strcat(fb_info.modename, fb_var_names[default_par-1][0]);
2801
2802 atafb_get_var(&disp.var, -1, &fb_info);
2803 atafb_set_disp(-1, &fb_info);
2804 do_install_cmap(0, &fb_info);
2805
2806 if (register_framebuffer(&fb_info) < 0) {
2807#ifdef ATAFB_EXT
2808 if (external_addr) {
2809 iounmap(external_addr);
2810 external_addr = NULL;
2811 }
2812 if (external_vgaiobase) {
2813 iounmap((void*)external_vgaiobase);
2814 external_vgaiobase = 0;
2815 }
2816#endif
2817 return -EINVAL;
2818 }
2819
2820 printk("Determined %dx%d, depth %d\n",
2821 disp.var.xres, disp.var.yres, disp.var.bits_per_pixel);
2822 if ((disp.var.xres != disp.var.xres_virtual) ||
2823 (disp.var.yres != disp.var.yres_virtual))
2824 printk(" virtual %dx%d\n",
2825 disp.var.xres_virtual, disp.var.yres_virtual);
2826 printk("fb%d: %s frame buffer device, using %dK of video memory\n",
2827 fb_info.node, fb_info.modename, screen_len>>10);
2828
2829 /* TODO: This driver cannot be unloaded yet */
2830 return 0;
2831} 2826}
2832 2827
2833
2834#ifdef ATAFB_EXT 2828#ifdef ATAFB_EXT
2835static void __init atafb_setup_ext(char *spec) 2829static void __init atafb_setup_ext(char *spec)
2836{ 2830{
2837 int xres, xres_virtual, yres, depth, planes; 2831 int xres, xres_virtual, yres, depth, planes;
2838 unsigned long addr, len; 2832 unsigned long addr, len;
2839 char *p; 2833 char *p;
2840 2834
@@ -2848,27 +2842,31 @@ static void __init atafb_setup_ext(char *spec)
2848 * 2842 *
2849 * Even xres_virtual is available, we neither support panning nor hw-scrolling! 2843 * Even xres_virtual is available, we neither support panning nor hw-scrolling!
2850 */ 2844 */
2851 if (!(p = strsep(&spec, ";")) || !*p) 2845 p = strsep(&spec, ";");
2852 return; 2846 if (!p || !*p)
2847 return;
2853 xres_virtual = xres = simple_strtoul(p, NULL, 10); 2848 xres_virtual = xres = simple_strtoul(p, NULL, 10);
2854 if (xres <= 0) 2849 if (xres <= 0)
2855 return; 2850 return;
2856 2851
2857 if (!(p = strsep(&spec, ";")) || !*p) 2852 p = strsep(&spec, ";");
2858 return; 2853 if (!p || !*p)
2854 return;
2859 yres = simple_strtoul(p, NULL, 10); 2855 yres = simple_strtoul(p, NULL, 10);
2860 if (yres <= 0) 2856 if (yres <= 0)
2861 return; 2857 return;
2862 2858
2863 if (!(p = strsep(&spec, ";")) || !*p) 2859 p = strsep(&spec, ";");
2864 return; 2860 if (!p || !*p)
2861 return;
2865 depth = simple_strtoul(p, NULL, 10); 2862 depth = simple_strtoul(p, NULL, 10);
2866 if (depth != 1 && depth != 2 && depth != 4 && depth != 8 && 2863 if (depth != 1 && depth != 2 && depth != 4 && depth != 8 &&
2867 depth != 16 && depth != 24) 2864 depth != 16 && depth != 24)
2868 return; 2865 return;
2869 2866
2870 if (!(p = strsep(&spec, ";")) || !*p) 2867 p = strsep(&spec, ";");
2871 return; 2868 if (!p || !*p)
2869 return;
2872 if (*p == 'i') 2870 if (*p == 'i')
2873 planes = FB_TYPE_INTERLEAVED_PLANES; 2871 planes = FB_TYPE_INTERLEAVED_PLANES;
2874 else if (*p == 'p') 2872 else if (*p == 'p')
@@ -2876,25 +2874,27 @@ static void __init atafb_setup_ext(char *spec)
2876 else if (*p == 'n') 2874 else if (*p == 'n')
2877 planes = FB_TYPE_PLANES; 2875 planes = FB_TYPE_PLANES;
2878 else if (*p == 't') 2876 else if (*p == 't')
2879 planes = -1; /* true color */ 2877 planes = -1; /* true color */
2880 else 2878 else
2881 return; 2879 return;
2882 2880
2883 2881 p = strsep(&spec, ";");
2884 if (!(p = strsep(&spec, ";")) || !*p) 2882 if (!p || !*p)
2885 return; 2883 return;
2886 addr = simple_strtoul(p, NULL, 0); 2884 addr = simple_strtoul(p, NULL, 0);
2887 2885
2888 if (!(p = strsep(&spec, ";")) || !*p) 2886 p = strsep(&spec, ";");
2889 len = xres*yres*depth/8; 2887 if (!p || !*p)
2888 len = xres * yres * depth / 8;
2890 else 2889 else
2891 len = simple_strtoul(p, NULL, 0); 2890 len = simple_strtoul(p, NULL, 0);
2892 2891
2893 if ((p = strsep(&spec, ";")) && *p) { 2892 p = strsep(&spec, ";");
2894 external_vgaiobase=simple_strtoul(p, NULL, 0); 2893 if (p && *p)
2895 } 2894 external_vgaiobase = simple_strtoul(p, NULL, 0);
2896 2895
2897 if ((p = strsep(&spec, ";")) && *p) { 2896 p = strsep(&spec, ";");
2897 if (p && *p) {
2898 external_bitspercol = simple_strtoul(p, NULL, 0); 2898 external_bitspercol = simple_strtoul(p, NULL, 0);
2899 if (external_bitspercol > 8) 2899 if (external_bitspercol > 8)
2900 external_bitspercol = 8; 2900 external_bitspercol = 8;
@@ -2902,59 +2902,61 @@ static void __init atafb_setup_ext(char *spec)
2902 external_bitspercol = 1; 2902 external_bitspercol = 1;
2903 } 2903 }
2904 2904
2905 if ((p = strsep(&spec, ";")) && *p) { 2905 p = strsep(&spec, ";");
2906 if (p && *p) {
2906 if (!strcmp(p, "vga")) 2907 if (!strcmp(p, "vga"))
2907 external_card_type = IS_VGA; 2908 external_card_type = IS_VGA;
2908 if (!strcmp(p, "mv300")) 2909 if (!strcmp(p, "mv300"))
2909 external_card_type = IS_MV300; 2910 external_card_type = IS_MV300;
2910 } 2911 }
2911 2912
2912 if ((p = strsep(&spec, ";")) && *p) { 2913 p = strsep(&spec, ";");
2914 if (p && *p) {
2913 xres_virtual = simple_strtoul(p, NULL, 10); 2915 xres_virtual = simple_strtoul(p, NULL, 10);
2914 if (xres_virtual < xres) 2916 if (xres_virtual < xres)
2915 xres_virtual = xres; 2917 xres_virtual = xres;
2916 if (xres_virtual*yres*depth/8 > len) 2918 if (xres_virtual * yres * depth / 8 > len)
2917 len=xres_virtual*yres*depth/8; 2919 len = xres_virtual * yres * depth / 8;
2918 } 2920 }
2919 2921
2920 external_xres = xres; 2922 external_xres = xres;
2921 external_xres_virtual = xres_virtual; 2923 external_xres_virtual = xres_virtual;
2922 external_yres = yres; 2924 external_yres = yres;
2923 external_depth = depth; 2925 external_depth = depth;
2924 external_pmode = planes; 2926 external_pmode = planes;
2925 external_addr = (void *)addr; 2927 external_addr = (void *)addr;
2926 external_len = len; 2928 external_len = len;
2927 2929
2928 if (external_card_type == IS_MV300) 2930 if (external_card_type == IS_MV300) {
2929 switch (external_depth) { 2931 switch (external_depth) {
2930 case 1: 2932 case 1:
2931 MV300_reg = MV300_reg_1bit; 2933 MV300_reg = MV300_reg_1bit;
2932 break; 2934 break;
2933 case 4: 2935 case 4:
2934 MV300_reg = MV300_reg_4bit; 2936 MV300_reg = MV300_reg_4bit;
2935 break; 2937 break;
2936 case 8: 2938 case 8:
2937 MV300_reg = MV300_reg_8bit; 2939 MV300_reg = MV300_reg_8bit;
2938 break; 2940 break;
2939 } 2941 }
2942 }
2940} 2943}
2941#endif /* ATAFB_EXT */ 2944#endif /* ATAFB_EXT */
2942 2945
2943
2944static void __init atafb_setup_int(char *spec) 2946static void __init atafb_setup_int(char *spec)
2945{ 2947{
2946 /* Format to config extended internal video hardware like OverScan: 2948 /* Format to config extended internal video hardware like OverScan:
2947 "internal:<xres>;<yres>;<xres_max>;<yres_max>;<offset>" 2949 * "internal:<xres>;<yres>;<xres_max>;<yres_max>;<offset>"
2948 Explanation: 2950 * Explanation:
2949 <xres>: x-resolution 2951 * <xres>: x-resolution
2950 <yres>: y-resolution 2952 * <yres>: y-resolution
2951 The following are only needed if you have an overscan which 2953 * The following are only needed if you have an overscan which
2952 needs a black border: 2954 * needs a black border:
2953 <xres_max>: max. length of a line in pixels your OverScan hardware would allow 2955 * <xres_max>: max. length of a line in pixels your OverScan hardware would allow
2954 <yres_max>: max. number of lines your OverScan hardware would allow 2956 * <yres_max>: max. number of lines your OverScan hardware would allow
2955 <offset>: Offset from physical beginning to visible beginning 2957 * <offset>: Offset from physical beginning to visible beginning
2956 of screen in bytes 2958 * of screen in bytes
2957 */ 2959 */
2958 int xres; 2960 int xres;
2959 char *p; 2961 char *p;
2960 2962
@@ -2963,23 +2965,19 @@ static void __init atafb_setup_int(char *spec)
2963 xres = simple_strtoul(p, NULL, 10); 2965 xres = simple_strtoul(p, NULL, 10);
2964 if (!(p = strsep(&spec, ";")) || !*p) 2966 if (!(p = strsep(&spec, ";")) || !*p)
2965 return; 2967 return;
2966 sttt_xres=xres; 2968 sttt_xres = xres;
2967 tt_yres=st_yres=simple_strtoul(p, NULL, 10); 2969 tt_yres = st_yres = simple_strtoul(p, NULL, 10);
2968 if ((p=strsep(&spec, ";")) && *p) { 2970 if ((p = strsep(&spec, ";")) && *p)
2969 sttt_xres_virtual=simple_strtoul(p, NULL, 10); 2971 sttt_xres_virtual = simple_strtoul(p, NULL, 10);
2970 } 2972 if ((p = strsep(&spec, ";")) && *p)
2971 if ((p=strsep(&spec, ";")) && *p) { 2973 sttt_yres_virtual = simple_strtoul(p, NULL, 0);
2972 sttt_yres_virtual=simple_strtoul(p, NULL, 0); 2974 if ((p = strsep(&spec, ";")) && *p)
2973 } 2975 ovsc_offset = simple_strtoul(p, NULL, 0);
2974 if ((p=strsep(&spec, ";")) && *p) {
2975 ovsc_offset=simple_strtoul(p, NULL, 0);
2976 }
2977 2976
2978 if (ovsc_offset || (sttt_yres_virtual != st_yres)) 2977 if (ovsc_offset || (sttt_yres_virtual != st_yres))
2979 use_hwscroll=0; 2978 use_hwscroll = 0;
2980} 2979}
2981 2980
2982
2983#ifdef ATAFB_FALCON 2981#ifdef ATAFB_FALCON
2984static void __init atafb_setup_mcap(char *spec) 2982static void __init atafb_setup_mcap(char *spec)
2985{ 2983{
@@ -3018,7 +3016,6 @@ static void __init atafb_setup_mcap(char *spec)
3018} 3016}
3019#endif /* ATAFB_FALCON */ 3017#endif /* ATAFB_FALCON */
3020 3018
3021
3022static void __init atafb_setup_user(char *spec) 3019static void __init atafb_setup_user(char *spec)
3023{ 3020{
3024 /* Format of user defined video mode is: <xres>;<yres>;<depth> 3021 /* Format of user defined video mode is: <xres>;<yres>;<depth>
@@ -3026,81 +3023,257 @@ static void __init atafb_setup_user(char *spec)
3026 char *p; 3023 char *p;
3027 int xres, yres, depth, temp; 3024 int xres, yres, depth, temp;
3028 3025
3029 if (!(p = strsep(&spec, ";")) || !*p) 3026 p = strsep(&spec, ";");
3027 if (!p || !*p)
3030 return; 3028 return;
3031 xres = simple_strtoul(p, NULL, 10); 3029 xres = simple_strtoul(p, NULL, 10);
3032 if (!(p = strsep(&spec, ";")) || !*p) 3030 p = strsep(&spec, ";");
3031 if (!p || !*p)
3033 return; 3032 return;
3034 yres = simple_strtoul(p, NULL, 10); 3033 yres = simple_strtoul(p, NULL, 10);
3035 if (!(p = strsep(&spec, "")) || !*p) 3034 p = strsep(&spec, "");
3035 if (!p || !*p)
3036 return; 3036 return;
3037 depth = simple_strtoul(p, NULL, 10); 3037 depth = simple_strtoul(p, NULL, 10);
3038 if ((temp=get_video_mode("user0"))) { 3038 temp = get_video_mode("user0");
3039 default_par=temp; 3039 if (temp) {
3040 atafb_predefined[default_par-1].xres = xres; 3040 default_par = temp;
3041 atafb_predefined[default_par-1].yres = yres; 3041 atafb_predefined[default_par - 1].xres = xres;
3042 atafb_predefined[default_par-1].bits_per_pixel = depth; 3042 atafb_predefined[default_par - 1].yres = yres;
3043 atafb_predefined[default_par - 1].bits_per_pixel = depth;
3043 } 3044 }
3044} 3045}
3045 3046
3046int __init atafb_setup( char *options ) 3047int __init atafb_setup(char *options)
3047{ 3048{
3048 char *this_opt; 3049 char *this_opt;
3049 int temp; 3050 int temp;
3050
3051 fb_info.fontname[0] = '\0';
3052 3051
3053 if (!options || !*options) 3052 if (!options || !*options)
3054 return 0; 3053 return 0;
3055 3054
3056 while ((this_opt = strsep(&options, ",")) != NULL) { 3055 while ((this_opt = strsep(&options, ",")) != NULL) {
3057 if (!*this_opt) continue; 3056 if (!*this_opt)
3058 if ((temp=get_video_mode(this_opt))) 3057 continue;
3059 default_par=temp; 3058 if ((temp = get_video_mode(this_opt))) {
3060 else if (! strcmp(this_opt, "inverse")) 3059 default_par = temp;
3061 inverse=1; 3060 mode_option = this_opt;
3062 else if (!strncmp(this_opt, "font:", 5)) 3061 } else if (!strcmp(this_opt, "inverse"))
3063 strcpy(fb_info.fontname, this_opt+5); 3062 inverse = 1;
3064 else if (! strncmp(this_opt, "hwscroll_",9)) { 3063 else if (!strncmp(this_opt, "hwscroll_", 9)) {
3065 hwscroll=simple_strtoul(this_opt+9, NULL, 10); 3064 hwscroll = simple_strtoul(this_opt + 9, NULL, 10);
3066 if (hwscroll < 0) 3065 if (hwscroll < 0)
3067 hwscroll = 0; 3066 hwscroll = 0;
3068 if (hwscroll > 200) 3067 if (hwscroll > 200)
3069 hwscroll = 200; 3068 hwscroll = 200;
3070 } 3069 }
3071#ifdef ATAFB_EXT 3070#ifdef ATAFB_EXT
3072 else if (!strcmp(this_opt,"mv300")) { 3071 else if (!strcmp(this_opt, "mv300")) {
3073 external_bitspercol = 8; 3072 external_bitspercol = 8;
3074 external_card_type = IS_MV300; 3073 external_card_type = IS_MV300;
3074 } else if (!strncmp(this_opt, "external:", 9))
3075 atafb_setup_ext(this_opt + 9);
3076#endif
3077 else if (!strncmp(this_opt, "internal:", 9))
3078 atafb_setup_int(this_opt + 9);
3079#ifdef ATAFB_FALCON
3080 else if (!strncmp(this_opt, "eclock:", 7)) {
3081 fext.f = simple_strtoul(this_opt + 7, NULL, 10);
3082 /* external pixelclock in kHz --> ps */
3083 fext.t = 1000000000 / fext.f;
3084 fext.f *= 1000;
3085 } else if (!strncmp(this_opt, "monitorcap:", 11))
3086 atafb_setup_mcap(this_opt + 11);
3087#endif
3088 else if (!strcmp(this_opt, "keep"))
3089 DontCalcRes = 1;
3090 else if (!strncmp(this_opt, "R", 1))
3091 atafb_setup_user(this_opt + 1);
3075 } 3092 }
3076 else if (!strncmp(this_opt,"external:",9)) 3093 return 0;
3077 atafb_setup_ext(this_opt+9); 3094}
3095
3096int __init atafb_init(void)
3097{
3098 int pad;
3099 int detected_mode;
3100 unsigned int defmode = 0;
3101 unsigned long mem_req;
3102
3103#ifndef MODULE
3104 char *option = NULL;
3105
3106 if (fb_get_options("atafb", &option))
3107 return -ENODEV;
3108 atafb_setup(option);
3109#endif
3110 printk("atafb_init: start\n");
3111
3112 if (!MACH_IS_ATARI)
3113 return -ENXIO;
3114
3115 do {
3116#ifdef ATAFB_EXT
3117 if (external_addr) {
3118 printk("atafb_init: initializing external hw\n");
3119 fbhw = &ext_switch;
3120 atafb_ops.fb_setcolreg = &ext_setcolreg;
3121 defmode = DEFMODE_EXT;
3122 break;
3123 }
3124#endif
3125#ifdef ATAFB_TT
3126 if (ATARIHW_PRESENT(TT_SHIFTER)) {
3127 printk("atafb_init: initializing TT hw\n");
3128 fbhw = &tt_switch;
3129 atafb_ops.fb_setcolreg = &tt_setcolreg;
3130 defmode = DEFMODE_TT;
3131 break;
3132 }
3078#endif 3133#endif
3079 else if (!strncmp(this_opt,"internal:",9))
3080 atafb_setup_int(this_opt+9);
3081#ifdef ATAFB_FALCON 3134#ifdef ATAFB_FALCON
3082 else if (!strncmp(this_opt, "eclock:", 7)) { 3135 if (ATARIHW_PRESENT(VIDEL_SHIFTER)) {
3083 fext.f = simple_strtoul(this_opt+7, NULL, 10); 3136 printk("atafb_init: initializing Falcon hw\n");
3084 /* external pixelclock in kHz --> ps */ 3137 fbhw = &falcon_switch;
3085 fext.t = 1000000000/fext.f; 3138 atafb_ops.fb_setcolreg = &falcon_setcolreg;
3086 fext.f *= 1000; 3139 request_irq(IRQ_AUTO_4, falcon_vbl_switcher, IRQ_TYPE_PRIO,
3140 "framebuffer/modeswitch", falcon_vbl_switcher);
3141 defmode = DEFMODE_F30;
3142 break;
3143 }
3144#endif
3145#ifdef ATAFB_STE
3146 if (ATARIHW_PRESENT(STND_SHIFTER) ||
3147 ATARIHW_PRESENT(EXTD_SHIFTER)) {
3148 printk("atafb_init: initializing ST/E hw\n");
3149 fbhw = &st_switch;
3150 atafb_ops.fb_setcolreg = &stste_setcolreg;
3151 defmode = DEFMODE_STE;
3152 break;
3153 }
3154 fbhw = &st_switch;
3155 atafb_ops.fb_setcolreg = &stste_setcolreg;
3156 printk("Cannot determine video hardware; defaulting to ST(e)\n");
3157#else /* ATAFB_STE */
3158 /* no default driver included */
3159 /* Nobody will ever see this message :-) */
3160 panic("Cannot initialize video hardware");
3161#endif
3162 } while (0);
3163
3164 /* Multisync monitor capabilities */
3165 /* Atari-TOS defaults if no boot option present */
3166 if (fb_info.monspecs.hfmin == 0) {
3167 fb_info.monspecs.hfmin = 31000;
3168 fb_info.monspecs.hfmax = 32000;
3169 fb_info.monspecs.vfmin = 58;
3170 fb_info.monspecs.vfmax = 62;
3087 } 3171 }
3088 else if (!strncmp(this_opt, "monitorcap:", 11)) 3172
3089 atafb_setup_mcap(this_opt+11); 3173 detected_mode = fbhw->detect();
3174 check_default_par(detected_mode);
3175#ifdef ATAFB_EXT
3176 if (!external_addr) {
3177#endif /* ATAFB_EXT */
3178 mem_req = default_mem_req + ovsc_offset + ovsc_addlen;
3179 mem_req = PAGE_ALIGN(mem_req) + PAGE_SIZE;
3180 screen_base = atari_stram_alloc(mem_req, "atafb");
3181 if (!screen_base)
3182 panic("Cannot allocate screen memory");
3183 memset(screen_base, 0, mem_req);
3184 pad = -(unsigned long)screen_base & (PAGE_SIZE - 1);
3185 screen_base += pad;
3186 real_screen_base = screen_base + ovsc_offset;
3187 screen_len = (mem_req - pad - ovsc_offset) & PAGE_MASK;
3188 st_ovsc_switch();
3189 if (CPU_IS_040_OR_060) {
3190 /* On a '040+, the cache mode of video RAM must be set to
3191 * write-through also for internal video hardware! */
3192 cache_push(virt_to_phys(screen_base), screen_len);
3193 kernel_set_cachemode(screen_base, screen_len,
3194 IOMAP_WRITETHROUGH);
3195 }
3196 printk("atafb: screen_base %p real_screen_base %p screen_len %d\n",
3197 screen_base, real_screen_base, screen_len);
3198#ifdef ATAFB_EXT
3199 } else {
3200 /* Map the video memory (physical address given) to somewhere
3201 * in the kernel address space.
3202 */
3203 external_addr = ioremap_writethrough((unsigned long)external_addr,
3204 external_len);
3205 if (external_vgaiobase)
3206 external_vgaiobase =
3207 (unsigned long)ioremap(external_vgaiobase, 0x10000);
3208 screen_base =
3209 real_screen_base = external_addr;
3210 screen_len = external_len & PAGE_MASK;
3211 memset (screen_base, 0, external_len);
3212 }
3213#endif /* ATAFB_EXT */
3214
3215// strcpy(fb_info.mode->name, "Atari Builtin ");
3216 fb_info.fbops = &atafb_ops;
3217 // try to set default (detected; requested) var
3218 do_fb_set_var(&atafb_predefined[default_par - 1], 1);
3219 // reads hw state into current par, which may not be sane yet
3220 ata_get_par(&current_par);
3221 fb_info.par = &current_par;
3222 // tries to read from HW which may not be initialized yet
3223 // so set sane var first, then call atafb_set_par
3224 atafb_get_var(&fb_info.var, &fb_info);
3225 fb_info.flags = FBINFO_FLAG_DEFAULT;
3226
3227 if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, atafb_modedb,
3228 NUM_TOTAL_MODES, &atafb_modedb[defmode],
3229 fb_info.var.bits_per_pixel)) {
3230 return -EINVAL;
3231 }
3232
3233 atafb_set_disp(&fb_info);
3234
3235 fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0);
3236
3237
3238 printk("Determined %dx%d, depth %d\n",
3239 fb_info.var.xres, fb_info.var.yres, fb_info.var.bits_per_pixel);
3240 if ((fb_info.var.xres != fb_info.var.xres_virtual) ||
3241 (fb_info.var.yres != fb_info.var.yres_virtual))
3242 printk(" virtual %dx%d\n", fb_info.var.xres_virtual,
3243 fb_info.var.yres_virtual);
3244
3245 if (register_framebuffer(&fb_info) < 0) {
3246#ifdef ATAFB_EXT
3247 if (external_addr) {
3248 iounmap(external_addr);
3249 external_addr = NULL;
3250 }
3251 if (external_vgaiobase) {
3252 iounmap((void*)external_vgaiobase);
3253 external_vgaiobase = 0;
3254 }
3090#endif 3255#endif
3091 else if (!strcmp(this_opt, "keep")) 3256 return -EINVAL;
3092 DontCalcRes = 1; 3257 }
3093 else if (!strncmp(this_opt, "R", 1)) 3258
3094 atafb_setup_user(this_opt+1); 3259 // FIXME: mode needs setting!
3095 } 3260 //printk("fb%d: %s frame buffer device, using %dK of video memory\n",
3096 return 0; 3261 // fb_info.node, fb_info.mode->name, screen_len>>10);
3262 printk("fb%d: frame buffer device, using %dK of video memory\n",
3263 fb_info.node, screen_len >> 10);
3264
3265 /* TODO: This driver cannot be unloaded yet */
3266 return 0;
3097} 3267}
3098 3268
3269module_init(atafb_init);
3270
3099#ifdef MODULE 3271#ifdef MODULE
3100MODULE_LICENSE("GPL"); 3272MODULE_LICENSE("GPL");
3101 3273
3102int init_module(void) 3274int cleanup_module(void)
3103{ 3275{
3104 return atafb_init(); 3276 unregister_framebuffer(&fb_info);
3277 return atafb_deinit();
3105} 3278}
3106#endif /* MODULE */ 3279#endif /* MODULE */
diff --git a/drivers/video/atafb.h b/drivers/video/atafb.h
new file mode 100644
index 000000000000..014e05906cb1
--- /dev/null
+++ b/drivers/video/atafb.h
@@ -0,0 +1,36 @@
1#ifndef _VIDEO_ATAFB_H
2#define _VIDEO_ATAFB_H
3
4void atafb_mfb_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
5 int dx, int height, int width);
6void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
7 int sy, int sx, int height, int width);
8void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
9 int dy, int dx, u32 width,
10 const u8 *data, u32 bgcolor, u32 fgcolor);
11
12void atafb_iplan2p2_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
13 int dx, int height, int width);
14void atafb_iplan2p2_fillrect(struct fb_info *info, u_long next_line, u32 color,
15 int sy, int sx, int height, int width);
16void atafb_iplan2p2_linefill(struct fb_info *info, u_long next_line,
17 int dy, int dx, u32 width,
18 const u8 *data, u32 bgcolor, u32 fgcolor);
19
20void atafb_iplan2p4_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
21 int dx, int height, int width);
22void atafb_iplan2p4_fillrect(struct fb_info *info, u_long next_line, u32 color,
23 int sy, int sx, int height, int width);
24void atafb_iplan2p4_linefill(struct fb_info *info, u_long next_line,
25 int dy, int dx, u32 width,
26 const u8 *data, u32 bgcolor, u32 fgcolor);
27
28void atafb_iplan2p8_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
29 int dx, int height, int width);
30void atafb_iplan2p8_fillrect(struct fb_info *info, u_long next_line, u32 color,
31 int sy, int sx, int height, int width);
32void atafb_iplan2p8_linefill(struct fb_info *info, u_long next_line,
33 int dy, int dx, u32 width,
34 const u8 *data, u32 bgcolor, u32 fgcolor);
35
36#endif /* _VIDEO_ATAFB_H */
diff --git a/drivers/video/atafb_iplan2p2.c b/drivers/video/atafb_iplan2p2.c
new file mode 100644
index 000000000000..8cc9c50379d0
--- /dev/null
+++ b/drivers/video/atafb_iplan2p2.c
@@ -0,0 +1,293 @@
1/*
2 * linux/drivers/video/iplan2p2.c -- Low level frame buffer operations for
3 * interleaved bitplanes à la Atari (2
4 * planes, 2 bytes interleave)
5 *
6 * Created 5 Apr 1997 by Geert Uytterhoeven
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
10 * more details.
11 */
12
13#include <linux/module.h>
14#include <linux/string.h>
15#include <linux/fb.h>
16
17#include <asm/setup.h>
18
19#include "atafb.h"
20
21#define BPL 2
22#include "atafb_utils.h"
23
24void atafb_iplan2p2_copyarea(struct fb_info *info, u_long next_line,
25 int sy, int sx, int dy, int dx,
26 int height, int width)
27{
28 /* bmove() has to distinguish two major cases: If both, source and
29 * destination, start at even addresses or both are at odd
30 * addresses, just the first odd and last even column (if present)
31 * require special treatment (memmove_col()). The rest between
32 * then can be copied by normal operations, because all adjacent
33 * bytes are affected and are to be stored in the same order.
34 * The pathological case is when the move should go from an odd
35 * address to an even or vice versa. Since the bytes in the plane
36 * words must be assembled in new order, it seems wisest to make
37 * all movements by memmove_col().
38 */
39
40 u8 *src, *dst;
41 u32 *s, *d;
42 int w, l , i, j;
43 u_int colsize;
44 u_int upwards = (dy < sy) || (dy == sy && dx < sx);
45
46 colsize = height;
47 if (!((sx ^ dx) & 15)) {
48 /* odd->odd or even->even */
49
50 if (upwards) {
51 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
52 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
53 if (sx & 15) {
54 memmove32_col(dst, src, 0xff00ff, height, next_line - BPL * 2);
55 src += BPL * 2;
56 dst += BPL * 2;
57 width -= 8;
58 }
59 w = width >> 4;
60 if (w) {
61 s = (u32 *)src;
62 d = (u32 *)dst;
63 w *= BPL / 2;
64 l = next_line - w * 4;
65 for (j = height; j > 0; j--) {
66 for (i = w; i > 0; i--)
67 *d++ = *s++;
68 s = (u32 *)((u8 *)s + l);
69 d = (u32 *)((u8 *)d + l);
70 }
71 }
72 if (width & 15)
73 memmove32_col(dst + width / (8 / BPL), src + width / (8 / BPL),
74 0xff00ff00, height, next_line - BPL * 2);
75 } else {
76 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
77 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
78
79 if ((sx + width) & 15) {
80 src -= BPL * 2;
81 dst -= BPL * 2;
82 memmove32_col(dst, src, 0xff00ff00, colsize, -next_line - BPL * 2);
83 width -= 8;
84 }
85 w = width >> 4;
86 if (w) {
87 s = (u32 *)src;
88 d = (u32 *)dst;
89 w *= BPL / 2;
90 l = next_line - w * 4;
91 for (j = height; j > 0; j--) {
92 for (i = w; i > 0; i--)
93 *--d = *--s;
94 s = (u32 *)((u8 *)s - l);
95 d = (u32 *)((u8 *)d - l);
96 }
97 }
98 if (sx & 15)
99 memmove32_col(dst - (width - 16) / (8 / BPL),
100 src - (width - 16) / (8 / BPL),
101 0xff00ff, colsize, -next_line - BPL * 2);
102 }
103 } else {
104 /* odd->even or even->odd */
105 if (upwards) {
106 u32 *src32, *dst32;
107 u32 pval[4], v, v1, mask;
108 int i, j, w, f;
109
110 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
111 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
112
113 mask = 0xff00ff00;
114 f = 0;
115 w = width;
116 if (sx & 15) {
117 f = 1;
118 w += 8;
119 }
120 if ((sx + width) & 15)
121 f |= 2;
122 w >>= 4;
123 for (i = height; i; i--) {
124 src32 = (u32 *)src;
125 dst32 = (u32 *)dst;
126
127 if (f & 1) {
128 pval[0] = (*src32++ << 8) & mask;
129 } else {
130 pval[0] = dst32[0] & mask;
131 }
132
133 for (j = w; j > 0; j--) {
134 v = *src32++;
135 v1 = v & mask;
136 *dst32++ = pval[0] | (v1 >> 8);
137 pval[0] = (v ^ v1) << 8;
138 }
139
140 if (f & 2) {
141 dst32[0] = (dst32[0] & mask) | pval[0];
142 }
143
144 src += next_line;
145 dst += next_line;
146 }
147 } else {
148 u32 *src32, *dst32;
149 u32 pval[4], v, v1, mask;
150 int i, j, w, f;
151
152 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
153 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
154
155 mask = 0xff00ff;
156 f = 0;
157 w = width;
158 if ((dx + width) & 15)
159 f = 1;
160 if (sx & 15) {
161 f |= 2;
162 w += 8;
163 }
164 w >>= 4;
165 for (i = height; i; i--) {
166 src32 = (u32 *)src;
167 dst32 = (u32 *)dst;
168
169 if (f & 1) {
170 pval[0] = dst32[-1] & mask;
171 } else {
172 pval[0] = (*--src32 >> 8) & mask;
173 }
174
175 for (j = w; j > 0; j--) {
176 v = *--src32;
177 v1 = v & mask;
178 *--dst32 = pval[0] | (v1 << 8);
179 pval[0] = (v ^ v1) >> 8;
180 }
181
182 if (!(f & 2)) {
183 dst32[-1] = (dst32[-1] & mask) | pval[0];
184 }
185
186 src -= next_line;
187 dst -= next_line;
188 }
189 }
190 }
191}
192
193void atafb_iplan2p2_fillrect(struct fb_info *info, u_long next_line, u32 color,
194 int sy, int sx, int height, int width)
195{
196 u32 *dest;
197 int rows, i;
198 u32 cval[4];
199
200 dest = (u32 *)(info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL));
201 if (sx & 15) {
202 u8 *dest8 = (u8 *)dest + 1;
203
204 expand8_col2mask(color, cval);
205
206 for (i = height; i; i--) {
207 fill8_col(dest8, cval);
208 dest8 += next_line;
209 }
210 dest += BPL / 2;
211 width -= 8;
212 }
213
214 expand16_col2mask(color, cval);
215 rows = width >> 4;
216 if (rows) {
217 u32 *d = dest;
218 u32 off = next_line - rows * BPL * 2;
219 for (i = height; i; i--) {
220 d = fill16_col(d, rows, cval);
221 d = (u32 *)((long)d + off);
222 }
223 dest += rows * BPL / 2;
224 width &= 15;
225 }
226
227 if (width) {
228 u8 *dest8 = (u8 *)dest;
229
230 expand8_col2mask(color, cval);
231
232 for (i = height; i; i--) {
233 fill8_col(dest8, cval);
234 dest8 += next_line;
235 }
236 }
237}
238
239void atafb_iplan2p2_linefill(struct fb_info *info, u_long next_line,
240 int dy, int dx, u32 width,
241 const u8 *data, u32 bgcolor, u32 fgcolor)
242{
243 u32 *dest;
244 const u16 *data16;
245 int rows;
246 u32 fgm[4], bgm[4], m;
247
248 dest = (u32 *)(info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL));
249 if (dx & 15) {
250 fill8_2col((u8 *)dest + 1, fgcolor, bgcolor, *data++);
251 dest += BPL / 2;
252 width -= 8;
253 }
254
255 if (width >= 16) {
256 data16 = (const u16 *)data;
257 expand16_2col2mask(fgcolor, bgcolor, fgm, bgm);
258
259 for (rows = width / 16; rows; rows--) {
260 u16 d = *data16++;
261 m = d | ((u32)d << 16);
262 *dest++ = (m & fgm[0]) ^ bgm[0];
263 }
264
265 data = (const u8 *)data16;
266 width &= 15;
267 }
268
269 if (width)
270 fill8_2col((u8 *)dest, fgcolor, bgcolor, *data);
271}
272
273#ifdef MODULE
274MODULE_LICENSE("GPL");
275
276int init_module(void)
277{
278 return 0;
279}
280
281void cleanup_module(void)
282{
283}
284#endif /* MODULE */
285
286
287 /*
288 * Visible symbols for modules
289 */
290
291EXPORT_SYMBOL(atafb_iplan2p2_copyarea);
292EXPORT_SYMBOL(atafb_iplan2p2_fillrect);
293EXPORT_SYMBOL(atafb_iplan2p2_linefill);
diff --git a/drivers/video/atafb_iplan2p4.c b/drivers/video/atafb_iplan2p4.c
new file mode 100644
index 000000000000..bee0d89463f7
--- /dev/null
+++ b/drivers/video/atafb_iplan2p4.c
@@ -0,0 +1,308 @@
1/*
2 * linux/drivers/video/iplan2p4.c -- Low level frame buffer operations for
3 * interleaved bitplanes à la Atari (4
4 * planes, 2 bytes interleave)
5 *
6 * Created 5 Apr 1997 by Geert Uytterhoeven
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
10 * more details.
11 */
12
13#include <linux/module.h>
14#include <linux/string.h>
15#include <linux/fb.h>
16
17#include <asm/setup.h>
18
19#include "atafb.h"
20
21#define BPL 4
22#include "atafb_utils.h"
23
24void atafb_iplan2p4_copyarea(struct fb_info *info, u_long next_line,
25 int sy, int sx, int dy, int dx,
26 int height, int width)
27{
28 /* bmove() has to distinguish two major cases: If both, source and
29 * destination, start at even addresses or both are at odd
30 * addresses, just the first odd and last even column (if present)
31 * require special treatment (memmove_col()). The rest between
32 * then can be copied by normal operations, because all adjacent
33 * bytes are affected and are to be stored in the same order.
34 * The pathological case is when the move should go from an odd
35 * address to an even or vice versa. Since the bytes in the plane
36 * words must be assembled in new order, it seems wisest to make
37 * all movements by memmove_col().
38 */
39
40 u8 *src, *dst;
41 u32 *s, *d;
42 int w, l , i, j;
43 u_int colsize;
44 u_int upwards = (dy < sy) || (dy == sy && dx < sx);
45
46 colsize = height;
47 if (!((sx ^ dx) & 15)) {
48 /* odd->odd or even->even */
49
50 if (upwards) {
51 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
52 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
53 if (sx & 15) {
54 memmove32_col(dst, src, 0xff00ff, height, next_line - BPL * 2);
55 src += BPL * 2;
56 dst += BPL * 2;
57 width -= 8;
58 }
59 w = width >> 4;
60 if (w) {
61 s = (u32 *)src;
62 d = (u32 *)dst;
63 w *= BPL / 2;
64 l = next_line - w * 4;
65 for (j = height; j > 0; j--) {
66 for (i = w; i > 0; i--)
67 *d++ = *s++;
68 s = (u32 *)((u8 *)s + l);
69 d = (u32 *)((u8 *)d + l);
70 }
71 }
72 if (width & 15)
73 memmove32_col(dst + width / (8 / BPL), src + width / (8 / BPL),
74 0xff00ff00, height, next_line - BPL * 2);
75 } else {
76 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
77 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
78
79 if ((sx + width) & 15) {
80 src -= BPL * 2;
81 dst -= BPL * 2;
82 memmove32_col(dst, src, 0xff00ff00, colsize, -next_line - BPL * 2);
83 width -= 8;
84 }
85 w = width >> 4;
86 if (w) {
87 s = (u32 *)src;
88 d = (u32 *)dst;
89 w *= BPL / 2;
90 l = next_line - w * 4;
91 for (j = height; j > 0; j--) {
92 for (i = w; i > 0; i--)
93 *--d = *--s;
94 s = (u32 *)((u8 *)s - l);
95 d = (u32 *)((u8 *)d - l);
96 }
97 }
98 if (sx & 15)
99 memmove32_col(dst - (width - 16) / (8 / BPL),
100 src - (width - 16) / (8 / BPL),
101 0xff00ff, colsize, -next_line - BPL * 2);
102 }
103 } else {
104 /* odd->even or even->odd */
105 if (upwards) {
106 u32 *src32, *dst32;
107 u32 pval[4], v, v1, mask;
108 int i, j, w, f;
109
110 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
111 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
112
113 mask = 0xff00ff00;
114 f = 0;
115 w = width;
116 if (sx & 15) {
117 f = 1;
118 w += 8;
119 }
120 if ((sx + width) & 15)
121 f |= 2;
122 w >>= 4;
123 for (i = height; i; i--) {
124 src32 = (u32 *)src;
125 dst32 = (u32 *)dst;
126
127 if (f & 1) {
128 pval[0] = (*src32++ << 8) & mask;
129 pval[1] = (*src32++ << 8) & mask;
130 } else {
131 pval[0] = dst32[0] & mask;
132 pval[1] = dst32[1] & mask;
133 }
134
135 for (j = w; j > 0; j--) {
136 v = *src32++;
137 v1 = v & mask;
138 *dst32++ = pval[0] | (v1 >> 8);
139 pval[0] = (v ^ v1) << 8;
140 v = *src32++;
141 v1 = v & mask;
142 *dst32++ = pval[1] | (v1 >> 8);
143 pval[1] = (v ^ v1) << 8;
144 }
145
146 if (f & 2) {
147 dst32[0] = (dst32[0] & mask) | pval[0];
148 dst32[1] = (dst32[1] & mask) | pval[1];
149 }
150
151 src += next_line;
152 dst += next_line;
153 }
154 } else {
155 u32 *src32, *dst32;
156 u32 pval[4], v, v1, mask;
157 int i, j, w, f;
158
159 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
160 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
161
162 mask = 0xff00ff;
163 f = 0;
164 w = width;
165 if ((dx + width) & 15)
166 f = 1;
167 if (sx & 15) {
168 f |= 2;
169 w += 8;
170 }
171 w >>= 4;
172 for (i = height; i; i--) {
173 src32 = (u32 *)src;
174 dst32 = (u32 *)dst;
175
176 if (f & 1) {
177 pval[0] = dst32[-1] & mask;
178 pval[1] = dst32[-2] & mask;
179 } else {
180 pval[0] = (*--src32 >> 8) & mask;
181 pval[1] = (*--src32 >> 8) & mask;
182 }
183
184 for (j = w; j > 0; j--) {
185 v = *--src32;
186 v1 = v & mask;
187 *--dst32 = pval[0] | (v1 << 8);
188 pval[0] = (v ^ v1) >> 8;
189 v = *--src32;
190 v1 = v & mask;
191 *--dst32 = pval[1] | (v1 << 8);
192 pval[1] = (v ^ v1) >> 8;
193 }
194
195 if (!(f & 2)) {
196 dst32[-1] = (dst32[-1] & mask) | pval[0];
197 dst32[-2] = (dst32[-2] & mask) | pval[1];
198 }
199
200 src -= next_line;
201 dst -= next_line;
202 }
203 }
204 }
205}
206
207void atafb_iplan2p4_fillrect(struct fb_info *info, u_long next_line, u32 color,
208 int sy, int sx, int height, int width)
209{
210 u32 *dest;
211 int rows, i;
212 u32 cval[4];
213
214 dest = (u32 *)(info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL));
215 if (sx & 15) {
216 u8 *dest8 = (u8 *)dest + 1;
217
218 expand8_col2mask(color, cval);
219
220 for (i = height; i; i--) {
221 fill8_col(dest8, cval);
222 dest8 += next_line;
223 }
224 dest += BPL / 2;
225 width -= 8;
226 }
227
228 expand16_col2mask(color, cval);
229 rows = width >> 4;
230 if (rows) {
231 u32 *d = dest;
232 u32 off = next_line - rows * BPL * 2;
233 for (i = height; i; i--) {
234 d = fill16_col(d, rows, cval);
235 d = (u32 *)((long)d + off);
236 }
237 dest += rows * BPL / 2;
238 width &= 15;
239 }
240
241 if (width) {
242 u8 *dest8 = (u8 *)dest;
243
244 expand8_col2mask(color, cval);
245
246 for (i = height; i; i--) {
247 fill8_col(dest8, cval);
248 dest8 += next_line;
249 }
250 }
251}
252
253void atafb_iplan2p4_linefill(struct fb_info *info, u_long next_line,
254 int dy, int dx, u32 width,
255 const u8 *data, u32 bgcolor, u32 fgcolor)
256{
257 u32 *dest;
258 const u16 *data16;
259 int rows;
260 u32 fgm[4], bgm[4], m;
261
262 dest = (u32 *)(info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL));
263 if (dx & 15) {
264 fill8_2col((u8 *)dest + 1, fgcolor, bgcolor, *data++);
265 dest += BPL / 2;
266 width -= 8;
267 }
268
269 if (width >= 16) {
270 data16 = (const u16 *)data;
271 expand16_2col2mask(fgcolor, bgcolor, fgm, bgm);
272
273 for (rows = width / 16; rows; rows--) {
274 u16 d = *data16++;
275 m = d | ((u32)d << 16);
276 *dest++ = (m & fgm[0]) ^ bgm[0];
277 *dest++ = (m & fgm[1]) ^ bgm[1];
278 }
279
280 data = (const u8 *)data16;
281 width &= 15;
282 }
283
284 if (width)
285 fill8_2col((u8 *)dest, fgcolor, bgcolor, *data);
286}
287
288#ifdef MODULE
289MODULE_LICENSE("GPL");
290
291int init_module(void)
292{
293 return 0;
294}
295
296void cleanup_module(void)
297{
298}
299#endif /* MODULE */
300
301
302 /*
303 * Visible symbols for modules
304 */
305
306EXPORT_SYMBOL(atafb_iplan2p4_copyarea);
307EXPORT_SYMBOL(atafb_iplan2p4_fillrect);
308EXPORT_SYMBOL(atafb_iplan2p4_linefill);
diff --git a/drivers/video/atafb_iplan2p8.c b/drivers/video/atafb_iplan2p8.c
new file mode 100644
index 000000000000..356fb52ce443
--- /dev/null
+++ b/drivers/video/atafb_iplan2p8.c
@@ -0,0 +1,345 @@
1/*
2 * linux/drivers/video/iplan2p8.c -- Low level frame buffer operations for
3 * interleaved bitplanes à la Atari (8
4 * planes, 2 bytes interleave)
5 *
6 * Created 5 Apr 1997 by Geert Uytterhoeven
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
10 * more details.
11 */
12
13#include <linux/module.h>
14#include <linux/string.h>
15#include <linux/fb.h>
16
17#include <asm/setup.h>
18
19#include "atafb.h"
20
21#define BPL 8
22#include "atafb_utils.h"
23
24
25/* Copies a 8 plane column from 's', height 'h', to 'd'. */
26
27/* This expands a 8 bit color into two longs for two movepl (8 plane)
28 * operations.
29 */
30
31void atafb_iplan2p8_copyarea(struct fb_info *info, u_long next_line,
32 int sy, int sx, int dy, int dx,
33 int height, int width)
34{
35 /* bmove() has to distinguish two major cases: If both, source and
36 * destination, start at even addresses or both are at odd
37 * addresses, just the first odd and last even column (if present)
38 * require special treatment (memmove_col()). The rest between
39 * then can be copied by normal operations, because all adjacent
40 * bytes are affected and are to be stored in the same order.
41 * The pathological case is when the move should go from an odd
42 * address to an even or vice versa. Since the bytes in the plane
43 * words must be assembled in new order, it seems wisest to make
44 * all movements by memmove_col().
45 */
46
47 u8 *src, *dst;
48 u32 *s, *d;
49 int w, l , i, j;
50 u_int colsize;
51 u_int upwards = (dy < sy) || (dy == sy && dx < sx);
52
53 colsize = height;
54 if (!((sx ^ dx) & 15)) {
55 /* odd->odd or even->even */
56
57 if (upwards) {
58 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
59 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
60 if (sx & 15) {
61 memmove32_col(dst, src, 0xff00ff, height, next_line - BPL * 2);
62 src += BPL * 2;
63 dst += BPL * 2;
64 width -= 8;
65 }
66 w = width >> 4;
67 if (w) {
68 s = (u32 *)src;
69 d = (u32 *)dst;
70 w *= BPL / 2;
71 l = next_line - w * 4;
72 for (j = height; j > 0; j--) {
73 for (i = w; i > 0; i--)
74 *d++ = *s++;
75 s = (u32 *)((u8 *)s + l);
76 d = (u32 *)((u8 *)d + l);
77 }
78 }
79 if (width & 15)
80 memmove32_col(dst + width / (8 / BPL), src + width / (8 / BPL),
81 0xff00ff00, height, next_line - BPL * 2);
82 } else {
83 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
84 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
85
86 if ((sx + width) & 15) {
87 src -= BPL * 2;
88 dst -= BPL * 2;
89 memmove32_col(dst, src, 0xff00ff00, colsize, -next_line - BPL * 2);
90 width -= 8;
91 }
92 w = width >> 4;
93 if (w) {
94 s = (u32 *)src;
95 d = (u32 *)dst;
96 w *= BPL / 2;
97 l = next_line - w * 4;
98 for (j = height; j > 0; j--) {
99 for (i = w; i > 0; i--)
100 *--d = *--s;
101 s = (u32 *)((u8 *)s - l);
102 d = (u32 *)((u8 *)d - l);
103 }
104 }
105 if (sx & 15)
106 memmove32_col(dst - (width - 16) / (8 / BPL),
107 src - (width - 16) / (8 / BPL),
108 0xff00ff, colsize, -next_line - BPL * 2);
109 }
110 } else {
111 /* odd->even or even->odd */
112 if (upwards) {
113 u32 *src32, *dst32;
114 u32 pval[4], v, v1, mask;
115 int i, j, w, f;
116
117 src = (u8 *)info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL);
118 dst = (u8 *)info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL);
119
120 mask = 0xff00ff00;
121 f = 0;
122 w = width;
123 if (sx & 15) {
124 f = 1;
125 w += 8;
126 }
127 if ((sx + width) & 15)
128 f |= 2;
129 w >>= 4;
130 for (i = height; i; i--) {
131 src32 = (u32 *)src;
132 dst32 = (u32 *)dst;
133
134 if (f & 1) {
135 pval[0] = (*src32++ << 8) & mask;
136 pval[1] = (*src32++ << 8) & mask;
137 pval[2] = (*src32++ << 8) & mask;
138 pval[3] = (*src32++ << 8) & mask;
139 } else {
140 pval[0] = dst32[0] & mask;
141 pval[1] = dst32[1] & mask;
142 pval[2] = dst32[2] & mask;
143 pval[3] = dst32[3] & mask;
144 }
145
146 for (j = w; j > 0; j--) {
147 v = *src32++;
148 v1 = v & mask;
149 *dst32++ = pval[0] | (v1 >> 8);
150 pval[0] = (v ^ v1) << 8;
151 v = *src32++;
152 v1 = v & mask;
153 *dst32++ = pval[1] | (v1 >> 8);
154 pval[1] = (v ^ v1) << 8;
155 v = *src32++;
156 v1 = v & mask;
157 *dst32++ = pval[2] | (v1 >> 8);
158 pval[2] = (v ^ v1) << 8;
159 v = *src32++;
160 v1 = v & mask;
161 *dst32++ = pval[3] | (v1 >> 8);
162 pval[3] = (v ^ v1) << 8;
163 }
164
165 if (f & 2) {
166 dst32[0] = (dst32[0] & mask) | pval[0];
167 dst32[1] = (dst32[1] & mask) | pval[1];
168 dst32[2] = (dst32[2] & mask) | pval[2];
169 dst32[3] = (dst32[3] & mask) | pval[3];
170 }
171
172 src += next_line;
173 dst += next_line;
174 }
175 } else {
176 u32 *src32, *dst32;
177 u32 pval[4], v, v1, mask;
178 int i, j, w, f;
179
180 src = (u8 *)info->screen_base + (sy - 1) * next_line + ((sx + width + 8) & ~15) / (8 / BPL);
181 dst = (u8 *)info->screen_base + (dy - 1) * next_line + ((dx + width + 8) & ~15) / (8 / BPL);
182
183 mask = 0xff00ff;
184 f = 0;
185 w = width;
186 if ((dx + width) & 15)
187 f = 1;
188 if (sx & 15) {
189 f |= 2;
190 w += 8;
191 }
192 w >>= 4;
193 for (i = height; i; i--) {
194 src32 = (u32 *)src;
195 dst32 = (u32 *)dst;
196
197 if (f & 1) {
198 pval[0] = dst32[-1] & mask;
199 pval[1] = dst32[-2] & mask;
200 pval[2] = dst32[-3] & mask;
201 pval[3] = dst32[-4] & mask;
202 } else {
203 pval[0] = (*--src32 >> 8) & mask;
204 pval[1] = (*--src32 >> 8) & mask;
205 pval[2] = (*--src32 >> 8) & mask;
206 pval[3] = (*--src32 >> 8) & mask;
207 }
208
209 for (j = w; j > 0; j--) {
210 v = *--src32;
211 v1 = v & mask;
212 *--dst32 = pval[0] | (v1 << 8);
213 pval[0] = (v ^ v1) >> 8;
214 v = *--src32;
215 v1 = v & mask;
216 *--dst32 = pval[1] | (v1 << 8);
217 pval[1] = (v ^ v1) >> 8;
218 v = *--src32;
219 v1 = v & mask;
220 *--dst32 = pval[2] | (v1 << 8);
221 pval[2] = (v ^ v1) >> 8;
222 v = *--src32;
223 v1 = v & mask;
224 *--dst32 = pval[3] | (v1 << 8);
225 pval[3] = (v ^ v1) >> 8;
226 }
227
228 if (!(f & 2)) {
229 dst32[-1] = (dst32[-1] & mask) | pval[0];
230 dst32[-2] = (dst32[-2] & mask) | pval[1];
231 dst32[-3] = (dst32[-3] & mask) | pval[2];
232 dst32[-4] = (dst32[-4] & mask) | pval[3];
233 }
234
235 src -= next_line;
236 dst -= next_line;
237 }
238 }
239 }
240}
241
242void atafb_iplan2p8_fillrect(struct fb_info *info, u_long next_line, u32 color,
243 int sy, int sx, int height, int width)
244{
245 u32 *dest;
246 int rows, i;
247 u32 cval[4];
248
249 dest = (u32 *)(info->screen_base + sy * next_line + (sx & ~15) / (8 / BPL));
250 if (sx & 15) {
251 u8 *dest8 = (u8 *)dest + 1;
252
253 expand8_col2mask(color, cval);
254
255 for (i = height; i; i--) {
256 fill8_col(dest8, cval);
257 dest8 += next_line;
258 }
259 dest += BPL / 2;
260 width -= 8;
261 }
262
263 expand16_col2mask(color, cval);
264 rows = width >> 4;
265 if (rows) {
266 u32 *d = dest;
267 u32 off = next_line - rows * BPL * 2;
268 for (i = height; i; i--) {
269 d = fill16_col(d, rows, cval);
270 d = (u32 *)((long)d + off);
271 }
272 dest += rows * BPL / 2;
273 width &= 15;
274 }
275
276 if (width) {
277 u8 *dest8 = (u8 *)dest;
278
279 expand8_col2mask(color, cval);
280
281 for (i = height; i; i--) {
282 fill8_col(dest8, cval);
283 dest8 += next_line;
284 }
285 }
286}
287
288void atafb_iplan2p8_linefill(struct fb_info *info, u_long next_line,
289 int dy, int dx, u32 width,
290 const u8 *data, u32 bgcolor, u32 fgcolor)
291{
292 u32 *dest;
293 const u16 *data16;
294 int rows;
295 u32 fgm[4], bgm[4], m;
296
297 dest = (u32 *)(info->screen_base + dy * next_line + (dx & ~15) / (8 / BPL));
298 if (dx & 15) {
299 fill8_2col((u8 *)dest + 1, fgcolor, bgcolor, *data++);
300 dest += BPL / 2;
301 width -= 8;
302 }
303
304 if (width >= 16) {
305 data16 = (const u16 *)data;
306 expand16_2col2mask(fgcolor, bgcolor, fgm, bgm);
307
308 for (rows = width / 16; rows; rows--) {
309 u16 d = *data16++;
310 m = d | ((u32)d << 16);
311 *dest++ = (m & fgm[0]) ^ bgm[0];
312 *dest++ = (m & fgm[1]) ^ bgm[1];
313 *dest++ = (m & fgm[2]) ^ bgm[2];
314 *dest++ = (m & fgm[3]) ^ bgm[3];
315 }
316
317 data = (const u8 *)data16;
318 width &= 15;
319 }
320
321 if (width)
322 fill8_2col((u8 *)dest, fgcolor, bgcolor, *data);
323}
324
325#ifdef MODULE
326MODULE_LICENSE("GPL");
327
328int init_module(void)
329{
330 return 0;
331}
332
333void cleanup_module(void)
334{
335}
336#endif /* MODULE */
337
338
339 /*
340 * Visible symbols for modules
341 */
342
343EXPORT_SYMBOL(atafb_iplan2p8_copyarea);
344EXPORT_SYMBOL(atafb_iplan2p8_fillrect);
345EXPORT_SYMBOL(atafb_iplan2p8_linefill);
diff --git a/drivers/video/atafb_mfb.c b/drivers/video/atafb_mfb.c
new file mode 100644
index 000000000000..6a352d62eecf
--- /dev/null
+++ b/drivers/video/atafb_mfb.c
@@ -0,0 +1,112 @@
1/*
2 * linux/drivers/video/mfb.c -- Low level frame buffer operations for
3 * monochrome
4 *
5 * Created 5 Apr 1997 by Geert Uytterhoeven
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#include <linux/module.h>
13#include <linux/string.h>
14#include <linux/fb.h>
15
16#include "atafb.h"
17#include "atafb_utils.h"
18
19
20 /*
21 * Monochrome
22 */
23
24void atafb_mfb_copyarea(struct fb_info *info, u_long next_line,
25 int sy, int sx, int dy, int dx,
26 int height, int width)
27{
28 u8 *src, *dest;
29 u_int rows;
30
31 if (sx == 0 && dx == 0 && width == next_line) {
32 src = (u8 *)info->screen_base + sy * (width >> 3);
33 dest = (u8 *)info->screen_base + dy * (width >> 3);
34 fb_memmove(dest, src, height * (width >> 3));
35 } else if (dy <= sy) {
36 src = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
37 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
38 for (rows = height; rows--;) {
39 fb_memmove(dest, src, width >> 3);
40 src += next_line;
41 dest += next_line;
42 }
43 } else {
44 src = (u8 *)info->screen_base + (sy + height - 1) * next_line + (sx >> 3);
45 dest = (u8 *)info->screen_base + (dy + height - 1) * next_line + (dx >> 3);
46 for (rows = height; rows--;) {
47 fb_memmove(dest, src, width >> 3);
48 src -= next_line;
49 dest -= next_line;
50 }
51 }
52}
53
54void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
55 int sy, int sx, int height, int width)
56{
57 u8 *dest;
58 u_int rows;
59
60 dest = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
61
62 if (sx == 0 && width == next_line) {
63 if (color)
64 fb_memset255(dest, height * (width >> 3));
65 else
66 fb_memclear(dest, height * (width >> 3));
67 } else {
68 for (rows = height; rows--; dest += next_line) {
69 if (color)
70 fb_memset255(dest, width >> 3);
71 else
72 fb_memclear_small(dest, width >> 3);
73 }
74 }
75}
76
77void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
78 int dy, int dx, u32 width,
79 const u8 *data, u32 bgcolor, u32 fgcolor)
80{
81 u8 *dest;
82 u_int rows;
83
84 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
85
86 for (rows = width / 8; rows--; /* check margins */ ) {
87 // use fast_memmove or fb_memmove
88 *dest++ = *data++;
89 }
90}
91
92#ifdef MODULE
93MODULE_LICENSE("GPL");
94
95int init_module(void)
96{
97 return 0;
98}
99
100void cleanup_module(void)
101{
102}
103#endif /* MODULE */
104
105
106 /*
107 * Visible symbols for modules
108 */
109
110EXPORT_SYMBOL(atafb_mfb_copyarea);
111EXPORT_SYMBOL(atafb_mfb_fillrect);
112EXPORT_SYMBOL(atafb_mfb_linefill);
diff --git a/drivers/video/atafb_utils.h b/drivers/video/atafb_utils.h
new file mode 100644
index 000000000000..ac9e19dc5057
--- /dev/null
+++ b/drivers/video/atafb_utils.h
@@ -0,0 +1,400 @@
1#ifndef _VIDEO_ATAFB_UTILS_H
2#define _VIDEO_ATAFB_UTILS_H
3
4/* ================================================================= */
5/* Utility Assembler Functions */
6/* ================================================================= */
7
8/* ====================================================================== */
9
10/* Those of a delicate disposition might like to skip the next couple of
11 * pages.
12 *
13 * These functions are drop in replacements for memmove and
14 * memset(_, 0, _). However their five instances add at least a kilobyte
15 * to the object file. You have been warned.
16 *
17 * Not a great fan of assembler for the sake of it, but I think
18 * that these routines are at least 10 times faster than their C
19 * equivalents for large blits, and that's important to the lowest level of
20 * a graphics driver. Question is whether some scheme with the blitter
21 * would be faster. I suspect not for simple text system - not much
22 * asynchrony.
23 *
24 * Code is very simple, just gruesome expansion. Basic strategy is to
25 * increase data moved/cleared at each step to 16 bytes to reduce
26 * instruction per data move overhead. movem might be faster still
27 * For more than 15 bytes, we try to align the write direction on a
28 * longword boundary to get maximum speed. This is even more gruesome.
29 * Unaligned read/write used requires 68020+ - think this is a problem?
30 *
31 * Sorry!
32 */
33
34
35/* ++roman: I've optimized Robert's original versions in some minor
36 * aspects, e.g. moveq instead of movel, let gcc choose the registers,
37 * use movem in some places...
38 * For other modes than 1 plane, lots of more such assembler functions
39 * were needed (e.g. the ones using movep or expanding color values).
40 */
41
42/* ++andreas: more optimizations:
43 subl #65536,d0 replaced by clrw d0; subql #1,d0 for dbcc
44 addal is faster than addaw
45 movep is rather expensive compared to ordinary move's
46 some functions rewritten in C for clarity, no speed loss */
47
48static inline void *fb_memclear_small(void *s, size_t count)
49{
50 if (!count)
51 return 0;
52
53 asm volatile ("\n"
54 " lsr.l #1,%1 ; jcc 1f ; move.b %2,-(%0)\n"
55 "1: lsr.l #1,%1 ; jcc 1f ; move.w %2,-(%0)\n"
56 "1: lsr.l #1,%1 ; jcc 1f ; move.l %2,-(%0)\n"
57 "1: lsr.l #1,%1 ; jcc 1f ; move.l %2,-(%0) ; move.l %2,-(%0)\n"
58 "1:"
59 : "=a" (s), "=d" (count)
60 : "d" (0), "0" ((char *)s + count), "1" (count));
61 asm volatile ("\n"
62 " subq.l #1,%1\n"
63 " jcs 3f\n"
64 " move.l %2,%%d4; move.l %2,%%d5; move.l %2,%%d6\n"
65 "2: movem.l %2/%%d4/%%d5/%%d6,-(%0)\n"
66 " dbra %1,2b\n"
67 "3:"
68 : "=a" (s), "=d" (count)
69 : "d" (0), "0" (s), "1" (count)
70 : "d4", "d5", "d6"
71 );
72
73 return 0;
74}
75
76
77static inline void *fb_memclear(void *s, size_t count)
78{
79 if (!count)
80 return 0;
81
82 if (count < 16) {
83 asm volatile ("\n"
84 " lsr.l #1,%1 ; jcc 1f ; clr.b (%0)+\n"
85 "1: lsr.l #1,%1 ; jcc 1f ; clr.w (%0)+\n"
86 "1: lsr.l #1,%1 ; jcc 1f ; clr.l (%0)+\n"
87 "1: lsr.l #1,%1 ; jcc 1f ; clr.l (%0)+ ; clr.l (%0)+\n"
88 "1:"
89 : "=a" (s), "=d" (count)
90 : "0" (s), "1" (count));
91 } else {
92 long tmp;
93 asm volatile ("\n"
94 " move.l %1,%2\n"
95 " lsr.l #1,%2 ; jcc 1f ; clr.b (%0)+ ; subq.w #1,%1\n"
96 " lsr.l #1,%2 ; jcs 2f\n" /* %0 increased=>bit 2 switched*/
97 " clr.w (%0)+ ; subq.w #2,%1 ; jra 2f\n"
98 "1: lsr.l #1,%2 ; jcc 2f\n"
99 " clr.w (%0)+ ; subq.w #2,%1\n"
100 "2: move.w %1,%2; lsr.l #2,%1 ; jeq 6f\n"
101 " lsr.l #1,%1 ; jcc 3f ; clr.l (%0)+\n"
102 "3: lsr.l #1,%1 ; jcc 4f ; clr.l (%0)+ ; clr.l (%0)+\n"
103 "4: subq.l #1,%1 ; jcs 6f\n"
104 "5: clr.l (%0)+; clr.l (%0)+ ; clr.l (%0)+ ; clr.l (%0)+\n"
105 " dbra %1,5b ; clr.w %1; subq.l #1,%1; jcc 5b\n"
106 "6: move.w %2,%1; btst #1,%1 ; jeq 7f ; clr.w (%0)+\n"
107 "7: btst #0,%1 ; jeq 8f ; clr.b (%0)+\n"
108 "8:"
109 : "=a" (s), "=d" (count), "=d" (tmp)
110 : "0" (s), "1" (count));
111 }
112
113 return 0;
114}
115
116
117static inline void *fb_memset255(void *s, size_t count)
118{
119 if (!count)
120 return 0;
121
122 asm volatile ("\n"
123 " lsr.l #1,%1 ; jcc 1f ; move.b %2,-(%0)\n"
124 "1: lsr.l #1,%1 ; jcc 1f ; move.w %2,-(%0)\n"
125 "1: lsr.l #1,%1 ; jcc 1f ; move.l %2,-(%0)\n"
126 "1: lsr.l #1,%1 ; jcc 1f ; move.l %2,-(%0) ; move.l %2,-(%0)\n"
127 "1:"
128 : "=a" (s), "=d" (count)
129 : "d" (-1), "0" ((char *)s+count), "1" (count));
130 asm volatile ("\n"
131 " subq.l #1,%1 ; jcs 3f\n"
132 " move.l %2,%%d4; move.l %2,%%d5; move.l %2,%%d6\n"
133 "2: movem.l %2/%%d4/%%d5/%%d6,-(%0)\n"
134 " dbra %1,2b\n"
135 "3:"
136 : "=a" (s), "=d" (count)
137 : "d" (-1), "0" (s), "1" (count)
138 : "d4", "d5", "d6");
139
140 return 0;
141}
142
143
144static inline void *fb_memmove(void *d, const void *s, size_t count)
145{
146 if (d < s) {
147 if (count < 16) {
148 asm volatile ("\n"
149 " lsr.l #1,%2 ; jcc 1f ; move.b (%1)+,(%0)+\n"
150 "1: lsr.l #1,%2 ; jcc 1f ; move.w (%1)+,(%0)+\n"
151 "1: lsr.l #1,%2 ; jcc 1f ; move.l (%1)+,(%0)+\n"
152 "1: lsr.l #1,%2 ; jcc 1f ; move.l (%1)+,(%0)+ ; move.l (%1)+,(%0)+\n"
153 "1:"
154 : "=a" (d), "=a" (s), "=d" (count)
155 : "0" (d), "1" (s), "2" (count));
156 } else {
157 long tmp;
158 asm volatile ("\n"
159 " move.l %0,%3\n"
160 " lsr.l #1,%3 ; jcc 1f ; move.b (%1)+,(%0)+ ; subqw #1,%2\n"
161 " lsr.l #1,%3 ; jcs 2f\n" /* %0 increased=>bit 2 switched*/
162 " move.w (%1)+,(%0)+ ; subqw #2,%2 ; jra 2f\n"
163 "1: lsr.l #1,%3 ; jcc 2f\n"
164 " move.w (%1)+,(%0)+ ; subqw #2,%2\n"
165 "2: move.w %2,%-; lsr.l #2,%2 ; jeq 6f\n"
166 " lsr.l #1,%2 ; jcc 3f ; move.l (%1)+,(%0)+\n"
167 "3: lsr.l #1,%2 ; jcc 4f ; move.l (%1)+,(%0)+ ; move.l (%1)+,(%0)+\n"
168 "4: subq.l #1,%2 ; jcs 6f\n"
169 "5: move.l (%1)+,(%0)+; move.l (%1)+,(%0)+\n"
170 " move.l (%1)+,(%0)+; move.l (%1)+,(%0)+\n"
171 " dbra %2,5b ; clr.w %2; subq.l #1,%2; jcc 5b\n"
172 "6: move.w %+,%2; btst #1,%2 ; jeq 7f ; move.w (%1)+,(%0)+\n"
173 "7: btst #0,%2 ; jeq 8f ; move.b (%1)+,(%0)+\n"
174 "8:"
175 : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
176 : "0" (d), "1" (s), "2" (count));
177 }
178 } else {
179 if (count < 16) {
180 asm volatile ("\n"
181 " lsr.l #1,%2 ; jcc 1f ; move.b -(%1),-(%0)\n"
182 "1: lsr.l #1,%2 ; jcc 1f ; move.w -(%1),-(%0)\n"
183 "1: lsr.l #1,%2 ; jcc 1f ; move.l -(%1),-(%0)\n"
184 "1: lsr.l #1,%2 ; jcc 1f ; move.l -(%1),-(%0) ; move.l -(%1),-(%0)\n"
185 "1:"
186 : "=a" (d), "=a" (s), "=d" (count)
187 : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count));
188 } else {
189 long tmp;
190
191 asm volatile ("\n"
192 " move.l %0,%3\n"
193 " lsr.l #1,%3 ; jcc 1f ; move.b -(%1),-(%0) ; subqw #1,%2\n"
194 " lsr.l #1,%3 ; jcs 2f\n" /* %0 increased=>bit 2 switched*/
195 " move.w -(%1),-(%0) ; subqw #2,%2 ; jra 2f\n"
196 "1: lsr.l #1,%3 ; jcc 2f\n"
197 " move.w -(%1),-(%0) ; subqw #2,%2\n"
198 "2: move.w %2,%-; lsr.l #2,%2 ; jeq 6f\n"
199 " lsr.l #1,%2 ; jcc 3f ; move.l -(%1),-(%0)\n"
200 "3: lsr.l #1,%2 ; jcc 4f ; move.l -(%1),-(%0) ; move.l -(%1),-(%0)\n"
201 "4: subq.l #1,%2 ; jcs 6f\n"
202 "5: move.l -(%1),-(%0); move.l -(%1),-(%0)\n"
203 " move.l -(%1),-(%0); move.l -(%1),-(%0)\n"
204 " dbra %2,5b ; clr.w %2; subq.l #1,%2; jcc 5b\n"
205 "6: move.w %+,%2; btst #1,%2 ; jeq 7f ; move.w -(%1),-(%0)\n"
206 "7: btst #0,%2 ; jeq 8f ; move.b -(%1),-(%0)\n"
207 "8:"
208 : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
209 : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count));
210 }
211 }
212
213 return 0;
214}
215
216
217/* ++andreas: Simple and fast version of memmove, assumes size is
218 divisible by 16, suitable for moving the whole screen bitplane */
219static inline void fast_memmove(char *dst, const char *src, size_t size)
220{
221 if (!size)
222 return;
223 if (dst < src)
224 asm volatile ("\n"
225 "1: movem.l (%0)+,%%d0/%%d1/%%a0/%%a1\n"
226 " movem.l %%d0/%%d1/%%a0/%%a1,%1@\n"
227 " addq.l #8,%1; addq.l #8,%1\n"
228 " dbra %2,1b\n"
229 " clr.w %2; subq.l #1,%2\n"
230 " jcc 1b"
231 : "=a" (src), "=a" (dst), "=d" (size)
232 : "0" (src), "1" (dst), "2" (size / 16 - 1)
233 : "d0", "d1", "a0", "a1", "memory");
234 else
235 asm volatile ("\n"
236 "1: subq.l #8,%0; subq.l #8,%0\n"
237 " movem.l %0@,%%d0/%%d1/%%a0/%%a1\n"
238 " movem.l %%d0/%%d1/%%a0/%%a1,-(%1)\n"
239 " dbra %2,1b\n"
240 " clr.w %2; subq.l #1,%2\n"
241 " jcc 1b"
242 : "=a" (src), "=a" (dst), "=d" (size)
243 : "0" (src + size), "1" (dst + size), "2" (size / 16 - 1)
244 : "d0", "d1", "a0", "a1", "memory");
245}
246
247#ifdef BPL
248
249/*
250 * This expands a up to 8 bit color into two longs
251 * for movel operations.
252 */
253static const u32 four2long[] = {
254 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
255 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
256 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
257 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff,
258};
259
260static inline void expand8_col2mask(u8 c, u32 m[])
261{
262 m[0] = four2long[c & 15];
263#if BPL > 4
264 m[1] = four2long[c >> 4];
265#endif
266}
267
268static inline void expand8_2col2mask(u8 fg, u8 bg, u32 fgm[], u32 bgm[])
269{
270 fgm[0] = four2long[fg & 15] ^ (bgm[0] = four2long[bg & 15]);
271#if BPL > 4
272 fgm[1] = four2long[fg >> 4] ^ (bgm[1] = four2long[bg >> 4]);
273#endif
274}
275
276/*
277 * set an 8bit value to a color
278 */
279static inline void fill8_col(u8 *dst, u32 m[])
280{
281 u32 tmp = m[0];
282 dst[0] = tmp;
283 dst[2] = (tmp >>= 8);
284#if BPL > 2
285 dst[4] = (tmp >>= 8);
286 dst[6] = tmp >> 8;
287#endif
288#if BPL > 4
289 tmp = m[1];
290 dst[8] = tmp;
291 dst[10] = (tmp >>= 8);
292 dst[12] = (tmp >>= 8);
293 dst[14] = tmp >> 8;
294#endif
295}
296
297/*
298 * set an 8bit value according to foreground/background color
299 */
300static inline void fill8_2col(u8 *dst, u8 fg, u8 bg, u32 mask)
301{
302 u32 fgm[2], bgm[2], tmp;
303
304 expand8_2col2mask(fg, bg, fgm, bgm);
305
306 mask |= mask << 8;
307#if BPL > 2
308 mask |= mask << 16;
309#endif
310 tmp = (mask & fgm[0]) ^ bgm[0];
311 dst[0] = tmp;
312 dst[2] = (tmp >>= 8);
313#if BPL > 2
314 dst[4] = (tmp >>= 8);
315 dst[6] = tmp >> 8;
316#endif
317#if BPL > 4
318 tmp = (mask & fgm[1]) ^ bgm[1];
319 dst[8] = tmp;
320 dst[10] = (tmp >>= 8);
321 dst[12] = (tmp >>= 8);
322 dst[14] = tmp >> 8;
323#endif
324}
325
326static const u32 two2word[] = {
327 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
328};
329
330static inline void expand16_col2mask(u8 c, u32 m[])
331{
332 m[0] = two2word[c & 3];
333#if BPL > 2
334 m[1] = two2word[(c >> 2) & 3];
335#endif
336#if BPL > 4
337 m[2] = two2word[(c >> 4) & 3];
338 m[3] = two2word[c >> 6];
339#endif
340}
341
342static inline void expand16_2col2mask(u8 fg, u8 bg, u32 fgm[], u32 bgm[])
343{
344 bgm[0] = two2word[bg & 3];
345 fgm[0] = two2word[fg & 3] ^ bgm[0];
346#if BPL > 2
347 bgm[1] = two2word[(bg >> 2) & 3];
348 fgm[1] = two2word[(fg >> 2) & 3] ^ bgm[1];
349#endif
350#if BPL > 4
351 bgm[2] = two2word[(bg >> 4) & 3];
352 fgm[2] = two2word[(fg >> 4) & 3] ^ bgm[2];
353 bgm[3] = two2word[bg >> 6];
354 fgm[3] = two2word[fg >> 6] ^ bgm[3];
355#endif
356}
357
358static inline u32 *fill16_col(u32 *dst, int rows, u32 m[])
359{
360 while (rows) {
361 *dst++ = m[0];
362#if BPL > 2
363 *dst++ = m[1];
364#endif
365#if BPL > 4
366 *dst++ = m[2];
367 *dst++ = m[3];
368#endif
369 rows--;
370 }
371 return dst;
372}
373
374static inline void memmove32_col(void *dst, void *src, u32 mask, u32 h, u32 bytes)
375{
376 u32 *s, *d, v;
377
378 s = src;
379 d = dst;
380 do {
381 v = (*s++ & mask) | (*d & ~mask);
382 *d++ = v;
383#if BPL > 2
384 v = (*s++ & mask) | (*d & ~mask);
385 *d++ = v;
386#endif
387#if BPL > 4
388 v = (*s++ & mask) | (*d & ~mask);
389 *d++ = v;
390 v = (*s++ & mask) | (*d & ~mask);
391 *d++ = v;
392#endif
393 d = (u32 *)((u8 *)d + bytes);
394 s = (u32 *)((u8 *)s + bytes);
395 } while (--h);
396}
397
398#endif
399
400#endif /* _VIDEO_ATAFB_UTILS_H */
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c
index 508479920705..7db9de681716 100644
--- a/drivers/video/aty/radeon_i2c.c
+++ b/drivers/video/aty/radeon_i2c.c
@@ -1,7 +1,6 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/delay.h> 3#include <linux/delay.h>
4#include <linux/pci.h>
5#include <linux/fb.h> 4#include <linux/fb.h>
6 5
7 6
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 91a20785108a..3e67c34df9a5 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -371,7 +371,8 @@ static const char *vgacon_startup(void)
371 } 371 }
372 372
373 /* VGA16 modes are not handled by VGACON */ 373 /* VGA16 modes are not handled by VGACON */
374 if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */ 374 if ((ORIG_VIDEO_MODE == 0x00) || /* SCREEN_INFO not initialized */
375 (ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */
375 (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */ 376 (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */
376 (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */ 377 (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */
377 (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */ 378 (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */
diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c
index ca93a75f2997..b7655c05da53 100644
--- a/drivers/video/g364fb.c
+++ b/drivers/video/g364fb.c
@@ -26,7 +26,6 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/fb.h> 27#include <linux/fb.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/pci.h>
30#include <asm/io.h> 29#include <asm/io.h>
31#include <asm/jazz.h> 30#include <asm/jazz.h>
32 31
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c
index f4ede5f6b588..61e4c8759b23 100644
--- a/drivers/video/intelfb/intelfb_i2c.c
+++ b/drivers/video/intelfb/intelfb_i2c.c
@@ -104,7 +104,8 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
104 104
105 chan->dinfo = dinfo; 105 chan->dinfo = dinfo;
106 chan->reg = reg; 106 chan->reg = reg;
107 snprintf(chan->adapter.name, I2C_NAME_SIZE, "intelfb %s", name); 107 snprintf(chan->adapter.name, sizeof(chan->adapter.name),
108 "intelfb %s", name);
108 chan->adapter.owner = THIS_MODULE; 109 chan->adapter.owner = THIS_MODULE;
109 chan->adapter.id = I2C_HW_B_INTELFB; 110 chan->adapter.id = I2C_HW_B_INTELFB;
110 chan->adapter.algo_data = &chan->algo; 111 chan->adapter.algo_data = &chan->algo;
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
index 5ec718a5fe22..4baab7be58de 100644
--- a/drivers/video/matrox/i2c-matroxfb.c
+++ b/drivers/video/matrox/i2c-matroxfb.c
@@ -111,7 +111,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
111 b->mask.data = data; 111 b->mask.data = data;
112 b->mask.clock = clock; 112 b->mask.clock = clock;
113 b->adapter = matrox_i2c_adapter_template; 113 b->adapter = matrox_i2c_adapter_template;
114 snprintf(b->adapter.name, I2C_NAME_SIZE, name, 114 snprintf(b->adapter.name, sizeof(b->adapter.name), name,
115 minfo->fbcon.node); 115 minfo->fbcon.node);
116 i2c_set_adapdata(&b->adapter, b); 116 i2c_set_adapdata(&b->adapter, b);
117 b->adapter.algo_data = &b->bac; 117 b->adapter.algo_data = &b->bac;
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 233871655824..e64f8b5d0056 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -28,7 +28,6 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/fb.h> 29#include <linux/fb.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/pci.h>
32#include <linux/nvram.h> 31#include <linux/nvram.h>
33#include <asm/io.h> 32#include <asm/io.h>
34#include <asm/prom.h> 33#include <asm/prom.h>
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index a9ca4986645c..9756a728b74f 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -32,6 +32,8 @@
32#include <linux/ioctl.h> 32#include <linux/ioctl.h>
33#include <linux/notifier.h> 33#include <linux/notifier.h>
34#include <linux/reboot.h> 34#include <linux/reboot.h>
35#include <linux/kthread.h>
36#include <linux/freezer.h>
35 37
36#include <asm/uaccess.h> 38#include <asm/uaccess.h>
37#include <linux/fb.h> 39#include <linux/fb.h>
@@ -45,7 +47,7 @@
45#include <asm/ps3.h> 47#include <asm/ps3.h>
46 48
47#ifdef PS3FB_DEBUG 49#ifdef PS3FB_DEBUG
48#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ##args) 50#define DPRINTK(fmt, args...) printk("%s: " fmt, __func__ , ##args)
49#else 51#else
50#define DPRINTK(fmt, args...) 52#define DPRINTK(fmt, args...)
51#endif 53#endif
@@ -129,7 +131,6 @@ struct ps3fb_priv {
129 u64 context_handle, memory_handle; 131 u64 context_handle, memory_handle;
130 void *xdr_ea; 132 void *xdr_ea;
131 struct gpu_driver_info *dinfo; 133 struct gpu_driver_info *dinfo;
132 struct semaphore sem;
133 u32 res_index; 134 u32 res_index;
134 135
135 u64 vblank_count; /* frame count */ 136 u64 vblank_count; /* frame count */
@@ -139,6 +140,8 @@ struct ps3fb_priv {
139 atomic_t ext_flip; /* on/off flip with vsync */ 140 atomic_t ext_flip; /* on/off flip with vsync */
140 atomic_t f_count; /* fb_open count */ 141 atomic_t f_count; /* fb_open count */
141 int is_blanked; 142 int is_blanked;
143 int is_kicked;
144 struct task_struct *task;
142}; 145};
143static struct ps3fb_priv ps3fb; 146static struct ps3fb_priv ps3fb;
144 147
@@ -294,10 +297,10 @@ static const struct fb_videomode ps3fb_modedb[] = {
294#define VP_OFF(i) (WIDTH(i) * Y_OFF(i) * BPP + X_OFF(i) * BPP) 297#define VP_OFF(i) (WIDTH(i) * Y_OFF(i) * BPP + X_OFF(i) * BPP)
295#define FB_OFF(i) (GPU_OFFSET - VP_OFF(i) % GPU_OFFSET) 298#define FB_OFF(i) (GPU_OFFSET - VP_OFF(i) % GPU_OFFSET)
296 299
297static int ps3fb_mode = 0; 300static int ps3fb_mode;
298module_param(ps3fb_mode, bool, 0); 301module_param(ps3fb_mode, bool, 0);
299 302
300static char *mode_option __initdata = NULL; 303static char *mode_option __initdata;
301 304
302 305
303static int ps3fb_get_res_table(u32 xres, u32 yres) 306static int ps3fb_get_res_table(u32 xres, u32 yres)
@@ -393,7 +396,7 @@ static int ps3fb_sync(u32 frame)
393 396
394 if (frame > ps3fb.num_frames - 1) { 397 if (frame > ps3fb.num_frames - 1) {
395 printk(KERN_WARNING "%s: invalid frame number (%u)\n", 398 printk(KERN_WARNING "%s: invalid frame number (%u)\n",
396 __FUNCTION__, frame); 399 __func__, frame);
397 return -EINVAL; 400 return -EINVAL;
398 } 401 }
399 offset = xres * yres * BPP * frame; 402 offset = xres * yres * BPP * frame;
@@ -406,23 +409,26 @@ static int ps3fb_sync(u32 frame)
406 (xres << 16) | yres, 409 (xres << 16) | yres,
407 xres * BPP); /* line_length */ 410 xres * BPP); /* line_length */
408 if (status) 411 if (status)
409 printk(KERN_ERR "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n", 412 printk(KERN_ERR
410 __FUNCTION__, status); 413 "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
414 __func__, status);
411#ifdef HEAD_A 415#ifdef HEAD_A
412 status = lv1_gpu_context_attribute(ps3fb.context_handle, 416 status = lv1_gpu_context_attribute(ps3fb.context_handle,
413 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 417 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
414 0, offset, 0, 0); 418 0, offset, 0, 0);
415 if (status) 419 if (status)
416 printk(KERN_ERR "%s: lv1_gpu_context_attribute FLIP failed: %d\n", 420 printk(KERN_ERR
417 __FUNCTION__, status); 421 "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
422 __func__, status);
418#endif 423#endif
419#ifdef HEAD_B 424#ifdef HEAD_B
420 status = lv1_gpu_context_attribute(ps3fb.context_handle, 425 status = lv1_gpu_context_attribute(ps3fb.context_handle,
421 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 426 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
422 1, offset, 0, 0); 427 1, offset, 0, 0);
423 if (status) 428 if (status)
424 printk(KERN_ERR "%s: lv1_gpu_context_attribute FLIP failed: %d\n", 429 printk(KERN_ERR
425 __FUNCTION__, status); 430 "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
431 __func__, status);
426#endif 432#endif
427 return 0; 433 return 0;
428} 434}
@@ -631,7 +637,7 @@ static int ps3fb_blank(int blank, struct fb_info *info)
631{ 637{
632 int retval; 638 int retval;
633 639
634 DPRINTK("%s: blank:%d\n", __FUNCTION__, blank); 640 DPRINTK("%s: blank:%d\n", __func__, blank);
635 switch (blank) { 641 switch (blank) {
636 case FB_BLANK_POWERDOWN: 642 case FB_BLANK_POWERDOWN:
637 case FB_BLANK_HSYNC_SUSPEND: 643 case FB_BLANK_HSYNC_SUSPEND:
@@ -677,13 +683,10 @@ EXPORT_SYMBOL_GPL(ps3fb_wait_for_vsync);
677 683
678void ps3fb_flip_ctl(int on) 684void ps3fb_flip_ctl(int on)
679{ 685{
680 if (on) { 686 if (on)
681 if (atomic_read(&ps3fb.ext_flip) > 0) { 687 atomic_dec_if_positive(&ps3fb.ext_flip);
682 atomic_dec(&ps3fb.ext_flip); 688 else
683 }
684 } else {
685 atomic_inc(&ps3fb.ext_flip); 689 atomic_inc(&ps3fb.ext_flip);
686 }
687} 690}
688 691
689EXPORT_SYMBOL_GPL(ps3fb_flip_ctl); 692EXPORT_SYMBOL_GPL(ps3fb_flip_ctl);
@@ -732,6 +735,11 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
732 if (copy_from_user(&val, argp, sizeof(val))) 735 if (copy_from_user(&val, argp, sizeof(val)))
733 break; 736 break;
734 737
738 if (!(val & PS3AV_MODE_MASK)) {
739 u32 id = ps3av_get_auto_mode(0);
740 if (id > 0)
741 val = (val & ~PS3AV_MODE_MASK) | id;
742 }
735 DPRINTK("PS3FB_IOCTL_SETMODE:%x\n", val); 743 DPRINTK("PS3FB_IOCTL_SETMODE:%x\n", val);
736 retval = -EINVAL; 744 retval = -EINVAL;
737 old_mode = ps3fb_mode; 745 old_mode = ps3fb_mode;
@@ -783,8 +791,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
783 791
784 case PS3FB_IOCTL_OFF: 792 case PS3FB_IOCTL_OFF:
785 DPRINTK("PS3FB_IOCTL_OFF:\n"); 793 DPRINTK("PS3FB_IOCTL_OFF:\n");
786 if (atomic_read(&ps3fb.ext_flip) > 0) 794 atomic_dec_if_positive(&ps3fb.ext_flip);
787 atomic_dec(&ps3fb.ext_flip);
788 retval = 0; 795 retval = 0;
789 break; 796 break;
790 797
@@ -805,11 +812,14 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
805 812
806static int ps3fbd(void *arg) 813static int ps3fbd(void *arg)
807{ 814{
808 daemonize("ps3fbd"); 815 while (!kthread_should_stop()) {
809 for (;;) { 816 try_to_freeze();
810 down(&ps3fb.sem); 817 set_current_state(TASK_INTERRUPTIBLE);
811 if (atomic_read(&ps3fb.ext_flip) == 0) 818 if (ps3fb.is_kicked) {
819 ps3fb.is_kicked = 0;
812 ps3fb_sync(0); /* single buffer */ 820 ps3fb_sync(0); /* single buffer */
821 }
822 schedule();
813 } 823 }
814 return 0; 824 return 0;
815} 825}
@@ -823,15 +833,18 @@ static irqreturn_t ps3fb_vsync_interrupt(int irq, void *ptr)
823 status = lv1_gpu_context_intr(ps3fb.context_handle, &v1); 833 status = lv1_gpu_context_intr(ps3fb.context_handle, &v1);
824 if (status) { 834 if (status) {
825 printk(KERN_ERR "%s: lv1_gpu_context_intr failed: %d\n", 835 printk(KERN_ERR "%s: lv1_gpu_context_intr failed: %d\n",
826 __FUNCTION__, status); 836 __func__, status);
827 return IRQ_NONE; 837 return IRQ_NONE;
828 } 838 }
829 839
830 if (v1 & (1 << GPU_INTR_STATUS_VSYNC_1)) { 840 if (v1 & (1 << GPU_INTR_STATUS_VSYNC_1)) {
831 /* VSYNC */ 841 /* VSYNC */
832 ps3fb.vblank_count = head->vblank_count; 842 ps3fb.vblank_count = head->vblank_count;
833 if (!ps3fb.is_blanked) 843 if (ps3fb.task && !ps3fb.is_blanked &&
834 up(&ps3fb.sem); 844 !atomic_read(&ps3fb.ext_flip)) {
845 ps3fb.is_kicked = 1;
846 wake_up_process(ps3fb.task);
847 }
835 wake_up_interruptible(&ps3fb.wait_vsync); 848 wake_up_interruptible(&ps3fb.wait_vsync);
836 } 849 }
837 850
@@ -879,7 +892,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
879 dinfo->nvcore_frequency/1000000, dinfo->memory_frequency/1000000); 892 dinfo->nvcore_frequency/1000000, dinfo->memory_frequency/1000000);
880 893
881 if (dinfo->version_driver != GPU_DRIVER_INFO_VERSION) { 894 if (dinfo->version_driver != GPU_DRIVER_INFO_VERSION) {
882 printk(KERN_ERR "%s: version_driver err:%x\n", __FUNCTION__, 895 printk(KERN_ERR "%s: version_driver err:%x\n", __func__,
883 dinfo->version_driver); 896 dinfo->version_driver);
884 return -EINVAL; 897 return -EINVAL;
885 } 898 }
@@ -888,7 +901,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
888 error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet, 901 error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet,
889 &ps3fb.irq_no); 902 &ps3fb.irq_no);
890 if (error) { 903 if (error) {
891 printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __FUNCTION__, 904 printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __func__,
892 error); 905 error);
893 return error; 906 return error;
894 } 907 }
@@ -896,7 +909,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
896 error = request_irq(ps3fb.irq_no, ps3fb_vsync_interrupt, IRQF_DISABLED, 909 error = request_irq(ps3fb.irq_no, ps3fb_vsync_interrupt, IRQF_DISABLED,
897 "ps3fb vsync", ps3fb.dev); 910 "ps3fb vsync", ps3fb.dev);
898 if (error) { 911 if (error) {
899 printk(KERN_ERR "%s: request_irq failed %d\n", __FUNCTION__, 912 printk(KERN_ERR "%s: request_irq failed %d\n", __func__,
900 error); 913 error);
901 ps3_irq_plug_destroy(ps3fb.irq_no); 914 ps3_irq_plug_destroy(ps3fb.irq_no);
902 return error; 915 return error;
@@ -915,7 +928,7 @@ static int ps3fb_xdr_settings(u64 xdr_lpar)
915 xdr_lpar, ps3fb_videomemory.size, 0); 928 xdr_lpar, ps3fb_videomemory.size, 0);
916 if (status) { 929 if (status) {
917 printk(KERN_ERR "%s: lv1_gpu_context_iomap failed: %d\n", 930 printk(KERN_ERR "%s: lv1_gpu_context_iomap failed: %d\n",
918 __FUNCTION__, status); 931 __func__, status);
919 return -ENXIO; 932 return -ENXIO;
920 } 933 }
921 DPRINTK("video:%p xdr_ea:%p ioif:%lx lpar:%lx phys:%lx size:%lx\n", 934 DPRINTK("video:%p xdr_ea:%p ioif:%lx lpar:%lx phys:%lx size:%lx\n",
@@ -927,8 +940,9 @@ static int ps3fb_xdr_settings(u64 xdr_lpar)
927 xdr_lpar, ps3fb_videomemory.size, 940 xdr_lpar, ps3fb_videomemory.size,
928 GPU_IOIF, 0); 941 GPU_IOIF, 0);
929 if (status) { 942 if (status) {
930 printk(KERN_ERR "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", 943 printk(KERN_ERR
931 __FUNCTION__, status); 944 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
945 __func__, status);
932 return -ENXIO; 946 return -ENXIO;
933 } 947 }
934 return 0; 948 return 0;
@@ -968,13 +982,14 @@ static int __init ps3fb_probe(struct platform_device *dev)
968 u64 xdr_lpar; 982 u64 xdr_lpar;
969 int status; 983 int status;
970 unsigned long offset; 984 unsigned long offset;
985 struct task_struct *task;
971 986
972 /* get gpu context handle */ 987 /* get gpu context handle */
973 status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, 988 status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0,
974 &ps3fb.memory_handle, &ddr_lpar); 989 &ps3fb.memory_handle, &ddr_lpar);
975 if (status) { 990 if (status) {
976 printk(KERN_ERR "%s: lv1_gpu_memory_allocate failed: %d\n", 991 printk(KERN_ERR "%s: lv1_gpu_memory_allocate failed: %d\n",
977 __FUNCTION__, status); 992 __func__, status);
978 goto err; 993 goto err;
979 } 994 }
980 DPRINTK("ddr:lpar:0x%lx\n", ddr_lpar); 995 DPRINTK("ddr:lpar:0x%lx\n", ddr_lpar);
@@ -985,14 +1000,14 @@ static int __init ps3fb_probe(struct platform_device *dev)
985 &lpar_reports, &lpar_reports_size); 1000 &lpar_reports, &lpar_reports_size);
986 if (status) { 1001 if (status) {
987 printk(KERN_ERR "%s: lv1_gpu_context_attribute failed: %d\n", 1002 printk(KERN_ERR "%s: lv1_gpu_context_attribute failed: %d\n",
988 __FUNCTION__, status); 1003 __func__, status);
989 goto err_gpu_memory_free; 1004 goto err_gpu_memory_free;
990 } 1005 }
991 1006
992 /* vsync interrupt */ 1007 /* vsync interrupt */
993 ps3fb.dinfo = ioremap(lpar_driver_info, 128 * 1024); 1008 ps3fb.dinfo = ioremap(lpar_driver_info, 128 * 1024);
994 if (!ps3fb.dinfo) { 1009 if (!ps3fb.dinfo) {
995 printk(KERN_ERR "%s: ioremap failed\n", __FUNCTION__); 1010 printk(KERN_ERR "%s: ioremap failed\n", __func__);
996 goto err_gpu_context_free; 1011 goto err_gpu_context_free;
997 } 1012 }
998 1013
@@ -1050,9 +1065,18 @@ static int __init ps3fb_probe(struct platform_device *dev)
1050 "fb%d: PS3 frame buffer device, using %ld KiB of video memory\n", 1065 "fb%d: PS3 frame buffer device, using %ld KiB of video memory\n",
1051 info->node, ps3fb_videomemory.size >> 10); 1066 info->node, ps3fb_videomemory.size >> 10);
1052 1067
1053 kernel_thread(ps3fbd, info, CLONE_KERNEL); 1068 task = kthread_run(ps3fbd, info, "ps3fbd");
1069 if (IS_ERR(task)) {
1070 retval = PTR_ERR(task);
1071 goto err_unregister_framebuffer;
1072 }
1073
1074 ps3fb.task = task;
1075
1054 return 0; 1076 return 0;
1055 1077
1078err_unregister_framebuffer:
1079 unregister_framebuffer(info);
1056err_fb_dealloc: 1080err_fb_dealloc:
1057 fb_dealloc_cmap(&info->cmap); 1081 fb_dealloc_cmap(&info->cmap);
1058err_framebuffer_release: 1082err_framebuffer_release:
@@ -1083,6 +1107,11 @@ void ps3fb_cleanup(void)
1083{ 1107{
1084 int status; 1108 int status;
1085 1109
1110 if (ps3fb.task) {
1111 struct task_struct *task = ps3fb.task;
1112 ps3fb.task = NULL;
1113 kthread_stop(task);
1114 }
1086 if (ps3fb.irq_no) { 1115 if (ps3fb.irq_no) {
1087 free_irq(ps3fb.irq_no, ps3fb.dev); 1116 free_irq(ps3fb.irq_no, ps3fb.dev);
1088 ps3_irq_plug_destroy(ps3fb.irq_no); 1117 ps3_irq_plug_destroy(ps3fb.irq_no);
@@ -1137,8 +1166,9 @@ int ps3fb_set_sync(void)
1137 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, 1166 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
1138 0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); 1167 0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0);
1139 if (status) { 1168 if (status) {
1140 printk(KERN_ERR "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: %d\n", 1169 printk(KERN_ERR
1141 __FUNCTION__, status); 1170 "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: %d\n",
1171 __func__, status);
1142 return -1; 1172 return -1;
1143 } 1173 }
1144#endif 1174#endif
@@ -1148,8 +1178,9 @@ int ps3fb_set_sync(void)
1148 1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); 1178 1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0);
1149 1179
1150 if (status) { 1180 if (status) {
1151 printk(KERN_ERR "%s: lv1_gpu_context_attribute DISPLAY_MODE failed: %d\n", 1181 printk(KERN_ERR
1152 __FUNCTION__, status); 1182 "%s: lv1_gpu_context_attribute DISPLAY_MODE failed: %d\n",
1183 __func__, status);
1153 return -1; 1184 return -1;
1154 } 1185 }
1155#endif 1186#endif
@@ -1174,7 +1205,7 @@ static int __init ps3fb_init(void)
1174 1205
1175 error = ps3av_dev_open(); 1206 error = ps3av_dev_open();
1176 if (error) { 1207 if (error) {
1177 printk(KERN_ERR "%s: ps3av_dev_open failed\n", __FUNCTION__); 1208 printk(KERN_ERR "%s: ps3av_dev_open failed\n", __func__);
1178 goto err; 1209 goto err;
1179 } 1210 }
1180 1211
@@ -1195,7 +1226,6 @@ static int __init ps3fb_init(void)
1195 1226
1196 atomic_set(&ps3fb.f_count, -1); /* fbcon opens ps3fb */ 1227 atomic_set(&ps3fb.f_count, -1); /* fbcon opens ps3fb */
1197 atomic_set(&ps3fb.ext_flip, 0); /* for flip with vsync */ 1228 atomic_set(&ps3fb.ext_flip, 0); /* for flip with vsync */
1198 init_MUTEX(&ps3fb.sem);
1199 init_waitqueue_head(&ps3fb.wait_vsync); 1229 init_waitqueue_head(&ps3fb.wait_vsync);
1200 ps3fb.num_frames = 1; 1230 ps3fb.num_frames = 1;
1201 1231
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index b4947c810706..0b195f33f84f 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -803,7 +803,7 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
803 pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); 803 pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3);
804 804
805 /* enable LCD controller clock */ 805 /* enable LCD controller clock */
806 pxa_set_cken(CKEN16_LCD, 1); 806 pxa_set_cken(CKEN_LCD, 1);
807 807
808 /* Sequence from 11.7.10 */ 808 /* Sequence from 11.7.10 */
809 LCCR3 = fbi->reg_lccr3; 809 LCCR3 = fbi->reg_lccr3;
@@ -840,7 +840,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
840 remove_wait_queue(&fbi->ctrlr_wait, &wait); 840 remove_wait_queue(&fbi->ctrlr_wait, &wait);
841 841
842 /* disable LCD controller clock */ 842 /* disable LCD controller clock */
843 pxa_set_cken(CKEN16_LCD, 0); 843 pxa_set_cken(CKEN_LCD, 0);
844} 844}
845 845
846/* 846/*
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c
index 69f3b264a22e..c97709ecbad0 100644
--- a/drivers/video/stifb.c
+++ b/drivers/video/stifb.c
@@ -64,7 +64,6 @@
64#include <linux/fb.h> 64#include <linux/fb.h>
65#include <linux/init.h> 65#include <linux/init.h>
66#include <linux/ioport.h> 66#include <linux/ioport.h>
67#include <linux/pci.h>
68 67
69#include <asm/grfioctl.h> /* for HP-UX compatibility */ 68#include <asm/grfioctl.h> /* for HP-UX compatibility */
70#include <asm/uaccess.h> 69#include <asm/uaccess.h>
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
new file mode 100644
index 000000000000..4316c7fe8e21
--- /dev/null
+++ b/drivers/video/sunxvr2500.c
@@ -0,0 +1,277 @@
1/* s3d.c: Sun 3DLABS XVR-2500 et al. driver for sparc64 systems
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/module.h>
7#include <linux/kernel.h>
8#include <linux/slab.h>
9#include <linux/fb.h>
10#include <linux/pci.h>
11#include <linux/init.h>
12
13#include <asm/io.h>
14#include <asm/prom.h>
15#include <asm/of_device.h>
16
17struct s3d_info {
18 struct fb_info *info;
19 struct pci_dev *pdev;
20
21 char __iomem *fb_base;
22 unsigned long fb_base_phys;
23
24 struct device_node *of_node;
25
26 unsigned int width;
27 unsigned int height;
28 unsigned int depth;
29 unsigned int fb_size;
30
31 u32 pseudo_palette[256];
32};
33
34static int __devinit s3d_get_props(struct s3d_info *sp)
35{
36 sp->width = of_getintprop_default(sp->of_node, "width", 0);
37 sp->height = of_getintprop_default(sp->of_node, "height", 0);
38 sp->depth = of_getintprop_default(sp->of_node, "depth", 8);
39
40 if (!sp->width || !sp->height) {
41 printk(KERN_ERR "s3d: Critical properties missing for %s\n",
42 pci_name(sp->pdev));
43 return -EINVAL;
44 }
45
46 return 0;
47}
48
49static int s3d_setcolreg(unsigned regno,
50 unsigned red, unsigned green, unsigned blue,
51 unsigned transp, struct fb_info *info)
52{
53 u32 value;
54
55 if (regno >= 256)
56 return 1;
57
58 red >>= 8;
59 green >>= 8;
60 blue >>= 8;
61
62 value = (blue << 24) | (green << 16) | (red << 8);
63 ((u32 *)info->pseudo_palette)[regno] = value;
64
65 return 0;
66}
67
68static struct fb_ops s3d_ops = {
69 .owner = THIS_MODULE,
70 .fb_setcolreg = s3d_setcolreg,
71 .fb_fillrect = cfb_fillrect,
72 .fb_copyarea = cfb_copyarea,
73 .fb_imageblit = cfb_imageblit,
74};
75
76static int __devinit s3d_set_fbinfo(struct s3d_info *sp)
77{
78 struct fb_info *info = sp->info;
79 struct fb_var_screeninfo *var = &info->var;
80
81 info->flags = FBINFO_DEFAULT;
82 info->fbops = &s3d_ops;
83 info->screen_base = sp->fb_base;
84 info->screen_size = sp->fb_size;
85
86 info->pseudo_palette = sp->pseudo_palette;
87
88 /* Fill fix common fields */
89 strlcpy(info->fix.id, "s3d", sizeof(info->fix.id));
90 info->fix.smem_start = sp->fb_base_phys;
91 info->fix.smem_len = sp->fb_size;
92 info->fix.type = FB_TYPE_PACKED_PIXELS;
93 if (sp->depth == 32 || sp->depth == 24)
94 info->fix.visual = FB_VISUAL_TRUECOLOR;
95 else
96 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
97
98 var->xres = sp->width;
99 var->yres = sp->height;
100 var->xres_virtual = var->xres;
101 var->yres_virtual = var->yres;
102 var->bits_per_pixel = sp->depth;
103
104 var->red.offset = 8;
105 var->red.length = 8;
106 var->green.offset = 16;
107 var->green.length = 8;
108 var->blue.offset = 24;
109 var->blue.length = 8;
110 var->transp.offset = 0;
111 var->transp.length = 0;
112
113 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
114 printk(KERN_ERR "s3d: Cannot allocate color map.\n");
115 return -ENOMEM;
116 }
117
118 return 0;
119}
120
121static int __devinit s3d_pci_register(struct pci_dev *pdev,
122 const struct pci_device_id *ent)
123{
124 struct fb_info *info;
125 struct s3d_info *sp;
126 int err;
127
128 err = pci_enable_device(pdev);
129 if (err < 0) {
130 printk(KERN_ERR "s3d: Cannot enable PCI device %s\n",
131 pci_name(pdev));
132 goto err_out;
133 }
134
135 info = framebuffer_alloc(sizeof(struct s3d_info), &pdev->dev);
136 if (!info) {
137 printk(KERN_ERR "s3d: Cannot allocate fb_info\n");
138 err = -ENOMEM;
139 goto err_disable;
140 }
141
142 sp = info->par;
143 sp->info = info;
144 sp->pdev = pdev;
145 sp->of_node = pci_device_to_OF_node(pdev);
146 if (!sp->of_node) {
147 printk(KERN_ERR "s3d: Cannot find OF node of %s\n",
148 pci_name(pdev));
149 err = -ENODEV;
150 goto err_release_fb;
151 }
152
153 sp->fb_base_phys = pci_resource_start (pdev, 1);
154
155 err = pci_request_region(pdev, 1, "s3d framebuffer");
156 if (err < 0) {
157 printk("s3d: Cannot request region 1 for %s\n",
158 pci_name(pdev));
159 goto err_release_fb;
160 }
161
162 err = s3d_get_props(sp);
163 if (err)
164 goto err_release_pci;
165
166 /* XXX 'linebytes' is often wrong, it is equal to the width
167 * XXX with depth of 32 on my XVR-2500 which is clearly not
168 * XXX right. So we don't try to use it.
169 */
170 switch (sp->depth) {
171 case 8:
172 info->fix.line_length = sp->width;
173 break;
174 case 16:
175 info->fix.line_length = sp->width * 2;
176 break;
177 case 24:
178 info->fix.line_length = sp->width * 3;
179 break;
180 case 32:
181 info->fix.line_length = sp->width * 4;
182 break;
183 }
184 sp->fb_size = info->fix.line_length * sp->height;
185
186 sp->fb_base = ioremap(sp->fb_base_phys, sp->fb_size);
187 if (!sp->fb_base)
188 goto err_release_pci;
189
190 err = s3d_set_fbinfo(sp);
191 if (err)
192 goto err_unmap_fb;
193
194 pci_set_drvdata(pdev, info);
195
196 printk("s3d: Found device at %s\n", pci_name(pdev));
197
198 err = register_framebuffer(info);
199 if (err < 0) {
200 printk(KERN_ERR "s3d: Could not register framebuffer %s\n",
201 pci_name(pdev));
202 goto err_unmap_fb;
203 }
204
205 return 0;
206
207err_unmap_fb:
208 iounmap(sp->fb_base);
209
210err_release_pci:
211 pci_release_region(pdev, 1);
212
213err_release_fb:
214 framebuffer_release(info);
215
216err_disable:
217 pci_disable_device(pdev);
218
219err_out:
220 return err;
221}
222
223static void __devexit s3d_pci_unregister(struct pci_dev *pdev)
224{
225 struct fb_info *info = pci_get_drvdata(pdev);
226 struct s3d_info *sp = info->par;
227
228 unregister_framebuffer(info);
229
230 iounmap(sp->fb_base);
231
232 pci_release_region(pdev, 1);
233
234 framebuffer_release(info);
235
236 pci_disable_device(pdev);
237}
238
239static struct pci_device_id s3d_pci_table[] = {
240 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x002c), },
241 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x002d), },
242 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x002e), },
243 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x002f), },
244 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x0030), },
245 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x0031), },
246 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x0032), },
247 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x0033), },
248 { 0, }
249};
250
251static struct pci_driver s3d_driver = {
252 .name = "s3d",
253 .id_table = s3d_pci_table,
254 .probe = s3d_pci_register,
255 .remove = __devexit_p(s3d_pci_unregister),
256};
257
258static int __init s3d_init(void)
259{
260 if (fb_get_options("s3d", NULL))
261 return -ENODEV;
262
263 return pci_register_driver(&s3d_driver);
264}
265
266static void __exit s3d_exit(void)
267{
268 pci_unregister_driver(&s3d_driver);
269}
270
271module_init(s3d_init);
272module_exit(s3d_exit);
273
274MODULE_DESCRIPTION("framebuffer driver for Sun XVR-2500 graphics");
275MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
276MODULE_VERSION("1.0");
277MODULE_LICENSE("GPL");
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
new file mode 100644
index 000000000000..08880a62bfa3
--- /dev/null
+++ b/drivers/video/sunxvr500.c
@@ -0,0 +1,443 @@
1/* sunxvr500.c: Sun 3DLABS XVR-500 Expert3D driver for sparc64 systems
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/module.h>
7#include <linux/kernel.h>
8#include <linux/slab.h>
9#include <linux/fb.h>
10#include <linux/pci.h>
11#include <linux/init.h>
12
13#include <asm/io.h>
14#include <asm/prom.h>
15#include <asm/of_device.h>
16
17/* XXX This device has a 'dev-comm' property which aparently is
18 * XXX a pointer into the openfirmware's address space which is
19 * XXX a shared area the kernel driver can use to keep OBP
20 * XXX informed about the current resolution setting. The idea
21 * XXX is that the kernel can change resolutions, and as long
22 * XXX as the values in the 'dev-comm' area are accurate then
23 * XXX OBP can still render text properly to the console.
24 * XXX
25 * XXX I'm still working out the layout of this and whether there
26 * XXX are any signatures we need to look for etc.
27 */
28struct e3d_info {
29 struct fb_info *info;
30 struct pci_dev *pdev;
31
32 spinlock_t lock;
33
34 char __iomem *fb_base;
35 unsigned long fb_base_phys;
36
37 unsigned long fb8_buf_diff;
38 unsigned long regs_base_phys;
39
40 void __iomem *ramdac;
41
42 struct device_node *of_node;
43
44 unsigned int width;
45 unsigned int height;
46 unsigned int depth;
47 unsigned int fb_size;
48
49 u32 fb_base_reg;
50 u32 fb8_0_off;
51 u32 fb8_1_off;
52
53 u32 pseudo_palette[256];
54};
55
56static int __devinit e3d_get_props(struct e3d_info *ep)
57{
58 ep->width = of_getintprop_default(ep->of_node, "width", 0);
59 ep->height = of_getintprop_default(ep->of_node, "height", 0);
60 ep->depth = of_getintprop_default(ep->of_node, "depth", 8);
61
62 if (!ep->width || !ep->height) {
63 printk(KERN_ERR "e3d: Critical properties missing for %s\n",
64 pci_name(ep->pdev));
65 return -EINVAL;
66 }
67
68 return 0;
69}
70
71/* My XVR-500 comes up, at 1280x768 and a FB base register value of
72 * 0x04000000, the following video layout register values:
73 *
74 * RAMDAC_VID_WH 0x03ff04ff
75 * RAMDAC_VID_CFG 0x1a0b0088
76 * RAMDAC_VID_32FB_0 0x04000000
77 * RAMDAC_VID_32FB_1 0x04800000
78 * RAMDAC_VID_8FB_0 0x05000000
79 * RAMDAC_VID_8FB_1 0x05200000
80 * RAMDAC_VID_XXXFB 0x05400000
81 * RAMDAC_VID_YYYFB 0x05c00000
82 * RAMDAC_VID_ZZZFB 0x05e00000
83 */
84/* Video layout registers */
85#define RAMDAC_VID_WH 0x00000070UL /* (height-1)<<16 | (width-1) */
86#define RAMDAC_VID_CFG 0x00000074UL /* 0x1a000088|(linesz_log2<<16) */
87#define RAMDAC_VID_32FB_0 0x00000078UL /* PCI base 32bpp FB buffer 0 */
88#define RAMDAC_VID_32FB_1 0x0000007cUL /* PCI base 32bpp FB buffer 1 */
89#define RAMDAC_VID_8FB_0 0x00000080UL /* PCI base 8bpp FB buffer 0 */
90#define RAMDAC_VID_8FB_1 0x00000084UL /* PCI base 8bpp FB buffer 1 */
91#define RAMDAC_VID_XXXFB 0x00000088UL /* PCI base of XXX FB */
92#define RAMDAC_VID_YYYFB 0x0000008cUL /* PCI base of YYY FB */
93#define RAMDAC_VID_ZZZFB 0x00000090UL /* PCI base of ZZZ FB */
94
95/* CLUT registers */
96#define RAMDAC_INDEX 0x000000bcUL
97#define RAMDAC_DATA 0x000000c0UL
98
99static void e3d_clut_write(struct e3d_info *ep, int index, u32 val)
100{
101 void __iomem *ramdac = ep->ramdac;
102 unsigned long flags;
103
104 spin_lock_irqsave(&ep->lock, flags);
105
106 writel(index, ramdac + RAMDAC_INDEX);
107 writel(val, ramdac + RAMDAC_DATA);
108
109 spin_unlock_irqrestore(&ep->lock, flags);
110}
111
112static int e3d_setcolreg(unsigned regno,
113 unsigned red, unsigned green, unsigned blue,
114 unsigned transp, struct fb_info *info)
115{
116 struct e3d_info *ep = info->par;
117 u32 red_8, green_8, blue_8;
118 u32 red_10, green_10, blue_10;
119 u32 value;
120
121 if (regno >= 256)
122 return 1;
123
124 red_8 = red >> 8;
125 green_8 = green >> 8;
126 blue_8 = blue >> 8;
127
128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
129 ((u32 *)info->pseudo_palette)[regno] = value;
130
131
132 red_10 = red >> 6;
133 green_10 = green >> 6;
134 blue_10 = blue >> 6;
135
136 value = (blue_10 << 20) | (green_10 << 10) | (red_10 << 0);
137 e3d_clut_write(ep, regno, value);
138
139 return 0;
140}
141
142/* XXX This is a bit of a hack. I can't figure out exactly how the
143 * XXX two 8bpp areas of the framebuffer work. I imagine there is
144 * XXX a WID attribute somewhere else in the framebuffer which tells
145 * XXX the ramdac which of the two 8bpp framebuffer regions to take
146 * XXX the pixel from. So, for now, render into both regions to make
147 * XXX sure the pixel shows up.
148 */
149static void e3d_imageblit(struct fb_info *info, const struct fb_image *image)
150{
151 struct e3d_info *ep = info->par;
152 unsigned long flags;
153
154 spin_lock_irqsave(&ep->lock, flags);
155 cfb_imageblit(info, image);
156 info->screen_base += ep->fb8_buf_diff;
157 cfb_imageblit(info, image);
158 info->screen_base -= ep->fb8_buf_diff;
159 spin_unlock_irqrestore(&ep->lock, flags);
160}
161
162static void e3d_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
163{
164 struct e3d_info *ep = info->par;
165 unsigned long flags;
166
167 spin_lock_irqsave(&ep->lock, flags);
168 cfb_fillrect(info, rect);
169 info->screen_base += ep->fb8_buf_diff;
170 cfb_fillrect(info, rect);
171 info->screen_base -= ep->fb8_buf_diff;
172 spin_unlock_irqrestore(&ep->lock, flags);
173}
174
175static void e3d_copyarea(struct fb_info *info, const struct fb_copyarea *area)
176{
177 struct e3d_info *ep = info->par;
178 unsigned long flags;
179
180 spin_lock_irqsave(&ep->lock, flags);
181 cfb_copyarea(info, area);
182 info->screen_base += ep->fb8_buf_diff;
183 cfb_copyarea(info, area);
184 info->screen_base -= ep->fb8_buf_diff;
185 spin_unlock_irqrestore(&ep->lock, flags);
186}
187
188static struct fb_ops e3d_ops = {
189 .owner = THIS_MODULE,
190 .fb_setcolreg = e3d_setcolreg,
191 .fb_fillrect = e3d_fillrect,
192 .fb_copyarea = e3d_copyarea,
193 .fb_imageblit = e3d_imageblit,
194};
195
196static int __devinit e3d_set_fbinfo(struct e3d_info *ep)
197{
198 struct fb_info *info = ep->info;
199 struct fb_var_screeninfo *var = &info->var;
200
201 info->flags = FBINFO_DEFAULT;
202 info->fbops = &e3d_ops;
203 info->screen_base = ep->fb_base;
204 info->screen_size = ep->fb_size;
205
206 info->pseudo_palette = ep->pseudo_palette;
207
208 /* Fill fix common fields */
209 strlcpy(info->fix.id, "e3d", sizeof(info->fix.id));
210 info->fix.smem_start = ep->fb_base_phys;
211 info->fix.smem_len = ep->fb_size;
212 info->fix.type = FB_TYPE_PACKED_PIXELS;
213 if (ep->depth == 32 || ep->depth == 24)
214 info->fix.visual = FB_VISUAL_TRUECOLOR;
215 else
216 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
217
218 var->xres = ep->width;
219 var->yres = ep->height;
220 var->xres_virtual = var->xres;
221 var->yres_virtual = var->yres;
222 var->bits_per_pixel = ep->depth;
223
224 var->red.offset = 8;
225 var->red.length = 8;
226 var->green.offset = 16;
227 var->green.length = 8;
228 var->blue.offset = 24;
229 var->blue.length = 8;
230 var->transp.offset = 0;
231 var->transp.length = 0;
232
233 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
234 printk(KERN_ERR "e3d: Cannot allocate color map.\n");
235 return -ENOMEM;
236 }
237
238 return 0;
239}
240
241static int __devinit e3d_pci_register(struct pci_dev *pdev,
242 const struct pci_device_id *ent)
243{
244 struct fb_info *info;
245 struct e3d_info *ep;
246 unsigned int line_length;
247 int err;
248
249 err = pci_enable_device(pdev);
250 if (err < 0) {
251 printk(KERN_ERR "e3d: Cannot enable PCI device %s\n",
252 pci_name(pdev));
253 goto err_out;
254 }
255
256 info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev);
257 if (!info) {
258 printk(KERN_ERR "e3d: Cannot allocate fb_info\n");
259 err = -ENOMEM;
260 goto err_disable;
261 }
262
263 ep = info->par;
264 ep->info = info;
265 ep->pdev = pdev;
266 spin_lock_init(&ep->lock);
267 ep->of_node = pci_device_to_OF_node(pdev);
268 if (!ep->of_node) {
269 printk(KERN_ERR "e3d: Cannot find OF node of %s\n",
270 pci_name(pdev));
271 err = -ENODEV;
272 goto err_release_fb;
273 }
274
275 /* Read the PCI base register of the frame buffer, which we
276 * need in order to interpret the RAMDAC_VID_*FB* values in
277 * the ramdac correctly.
278 */
279 pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0,
280 &ep->fb_base_reg);
281 ep->fb_base_reg &= PCI_BASE_ADDRESS_MEM_MASK;
282
283 ep->regs_base_phys = pci_resource_start (pdev, 1);
284 err = pci_request_region(pdev, 1, "e3d regs");
285 if (err < 0) {
286 printk("e3d: Cannot request region 1 for %s\n",
287 pci_name(pdev));
288 goto err_release_fb;
289 }
290 ep->ramdac = ioremap(ep->regs_base_phys + 0x8000, 0x1000);
291 if (!ep->ramdac)
292 goto err_release_pci1;
293
294 ep->fb8_0_off = readl(ep->ramdac + RAMDAC_VID_8FB_0);
295 ep->fb8_0_off -= ep->fb_base_reg;
296
297 ep->fb8_1_off = readl(ep->ramdac + RAMDAC_VID_8FB_1);
298 ep->fb8_1_off -= ep->fb_base_reg;
299
300 ep->fb8_buf_diff = ep->fb8_1_off - ep->fb8_0_off;
301
302 ep->fb_base_phys = pci_resource_start (pdev, 0);
303 ep->fb_base_phys += ep->fb8_0_off;
304
305 err = pci_request_region(pdev, 0, "e3d framebuffer");
306 if (err < 0) {
307 printk("e3d: Cannot request region 0 for %s\n",
308 pci_name(pdev));
309 goto err_unmap_ramdac;
310 }
311
312 err = e3d_get_props(ep);
313 if (err)
314 goto err_release_pci0;
315
316 line_length = (readl(ep->ramdac + RAMDAC_VID_CFG) >> 16) & 0xff;
317 line_length = 1 << line_length;
318
319 switch (ep->depth) {
320 case 8:
321 info->fix.line_length = line_length;
322 break;
323 case 16:
324 info->fix.line_length = line_length * 2;
325 break;
326 case 24:
327 info->fix.line_length = line_length * 3;
328 break;
329 case 32:
330 info->fix.line_length = line_length * 4;
331 break;
332 }
333 ep->fb_size = info->fix.line_length * ep->height;
334
335 ep->fb_base = ioremap(ep->fb_base_phys, ep->fb_size);
336 if (!ep->fb_base)
337 goto err_release_pci0;
338
339 err = e3d_set_fbinfo(ep);
340 if (err)
341 goto err_unmap_fb;
342
343 pci_set_drvdata(pdev, info);
344
345 printk("e3d: Found device at %s\n", pci_name(pdev));
346
347 err = register_framebuffer(info);
348 if (err < 0) {
349 printk(KERN_ERR "e3d: Could not register framebuffer %s\n",
350 pci_name(pdev));
351 goto err_unmap_fb;
352 }
353
354 return 0;
355
356err_unmap_fb:
357 iounmap(ep->fb_base);
358
359err_release_pci0:
360 pci_release_region(pdev, 0);
361
362err_unmap_ramdac:
363 iounmap(ep->ramdac);
364
365err_release_pci1:
366 pci_release_region(pdev, 1);
367
368err_release_fb:
369 framebuffer_release(info);
370
371err_disable:
372 pci_disable_device(pdev);
373
374err_out:
375 return err;
376}
377
378static void __devexit e3d_pci_unregister(struct pci_dev *pdev)
379{
380 struct fb_info *info = pci_get_drvdata(pdev);
381 struct e3d_info *ep = info->par;
382
383 unregister_framebuffer(info);
384
385 iounmap(ep->ramdac);
386 iounmap(ep->fb_base);
387
388 pci_release_region(pdev, 0);
389 pci_release_region(pdev, 1);
390
391 framebuffer_release(info);
392
393 pci_disable_device(pdev);
394}
395
396static struct pci_device_id e3d_pci_table[] = {
397 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), },
398 { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), },
399 { .vendor = PCI_VENDOR_ID_3DLABS,
400 .device = PCI_ANY_ID,
401 .subvendor = PCI_VENDOR_ID_3DLABS,
402 .subdevice = 0x0108,
403 },
404 { .vendor = PCI_VENDOR_ID_3DLABS,
405 .device = PCI_ANY_ID,
406 .subvendor = PCI_VENDOR_ID_3DLABS,
407 .subdevice = 0x0140,
408 },
409 { .vendor = PCI_VENDOR_ID_3DLABS,
410 .device = PCI_ANY_ID,
411 .subvendor = PCI_VENDOR_ID_3DLABS,
412 .subdevice = 0x1024,
413 },
414 { 0, }
415};
416
417static struct pci_driver e3d_driver = {
418 .name = "e3d",
419 .id_table = e3d_pci_table,
420 .probe = e3d_pci_register,
421 .remove = __devexit_p(e3d_pci_unregister),
422};
423
424static int __init e3d_init(void)
425{
426 if (fb_get_options("e3d", NULL))
427 return -ENODEV;
428
429 return pci_register_driver(&e3d_driver);
430}
431
432static void __exit e3d_exit(void)
433{
434 pci_unregister_driver(&e3d_driver);
435}
436
437module_init(e3d_init);
438module_exit(e3d_exit);
439
440MODULE_DESCRIPTION("framebuffer driver for Sun XVR-500 graphics");
441MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
442MODULE_VERSION("1.0");
443MODULE_LICENSE("GPL");
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c
index 06fc19a61192..ad66f070acb8 100644
--- a/drivers/video/valkyriefb.c
+++ b/drivers/video/valkyriefb.c
@@ -51,7 +51,6 @@
51#include <linux/fb.h> 51#include <linux/fb.h>
52#include <linux/selection.h> 52#include <linux/selection.h>
53#include <linux/init.h> 53#include <linux/init.h>
54#include <linux/pci.h>
55#include <linux/nvram.h> 54#include <linux/nvram.h>
56#include <linux/adb.h> 55#include <linux/adb.h>
57#include <linux/cuda.h> 56#include <linux/cuda.h>
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c
index b3ce8859a586..2ce4cebc31d9 100644
--- a/drivers/zorro/proc.c
+++ b/drivers/zorro/proc.c
@@ -90,8 +90,9 @@ get_zorro_dev_info(char *buf, char **start, off_t pos, int count)
90 for (slot = cnt = 0; slot < zorro_num_autocon && count > cnt; slot++) { 90 for (slot = cnt = 0; slot < zorro_num_autocon && count > cnt; slot++) {
91 struct zorro_dev *z = &zorro_autocon[slot]; 91 struct zorro_dev *z = &zorro_autocon[slot];
92 len = sprintf(buf, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, 92 len = sprintf(buf, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot,
93 z->id, zorro_resource_start(z), 93 z->id, (unsigned long)zorro_resource_start(z),
94 zorro_resource_len(z), z->rom.er_Type); 94 (unsigned long)zorro_resource_len(z),
95 z->rom.er_Type);
95 at += len; 96 at += len;
96 if (at >= pos) { 97 if (at >= pos) {
97 if (!*start) { 98 if (!*start) {
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 87c29d7b6c17..c3ba0ec334c4 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -42,7 +42,8 @@ static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *
42 struct zorro_dev *z = to_zorro_dev(dev); 42 struct zorro_dev *z = to_zorro_dev(dev);
43 43
44 return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n", 44 return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n",
45 zorro_resource_start(z), zorro_resource_end(z), 45 (unsigned long)zorro_resource_start(z),
46 (unsigned long)zorro_resource_end(z),
46 zorro_resource_flags(z)); 47 zorro_resource_flags(z));
47} 48}
48 49
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index 0f2b40605b06..4cc42b64820c 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -164,7 +164,8 @@ static int __init zorro_init(void)
164 if (request_resource(zorro_find_parent_resource(z), &z->resource)) 164 if (request_resource(zorro_find_parent_resource(z), &z->resource))
165 printk(KERN_ERR "Zorro: Address space collision on device %s " 165 printk(KERN_ERR "Zorro: Address space collision on device %s "
166 "[%lx:%lx]\n", 166 "[%lx:%lx]\n",
167 z->name, zorro_resource_start(z), zorro_resource_end(z)); 167 z->name, (unsigned long)zorro_resource_start(z),
168 (unsigned long)zorro_resource_end(z));
168 sprintf(z->dev.bus_id, "%02x", i); 169 sprintf(z->dev.bus_id, "%02x", i);
169 z->dev.parent = &zorro_bus.dev; 170 z->dev.parent = &zorro_bus.dev;
170 z->dev.bus = &zorro_bus_type; 171 z->dev.bus = &zorro_bus_type;