]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 5 Jan 2006 00:31:56 +0000 (16:31 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 5 Jan 2006 00:31:56 +0000 (16:31 -0800)
575 files changed:
Documentation/DocBook/usb.tmpl
Documentation/cpu-freq/governors.txt
Documentation/networking/ip-sysctl.txt
Documentation/scsi/ChangeLog.megaraid
Documentation/scsi/scsi_mid_low_api.txt
MAINTAINERS
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/pxa27x.c
arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
arch/i386/kernel/cpu/proc.c
arch/ia64/kernel/setup.c
arch/mips/kernel/linux32.c
arch/x86_64/kernel/setup.c
block/ll_rw_blk.c
block/scsi_ioctl.c
drivers/block/Kconfig
drivers/block/ub.c
drivers/bluetooth/bcm203x.c
drivers/bluetooth/bfusb.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/hci_usb.c
drivers/char/ip2/i2pack.h
drivers/char/random.c
drivers/char/watchdog/pcwd_usb.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_conservative.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/input/joystick/iforce/iforce-usb.c
drivers/isdn/hisax/hfc_usb.c
drivers/isdn/hisax/st5481_init.c
drivers/md/dm-table.c
drivers/media/dvb/b2c2/flexcop-usb.c
drivers/media/dvb/cinergyT2/cinergyT2.c
drivers/media/dvb/dvb-usb/a800.c
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/dvb-usb/dibusb-mb.c
drivers/media/dvb/dvb-usb/dibusb-mc.c
drivers/media/dvb/dvb-usb/digitv.c
drivers/media/dvb/dvb-usb/dtt200u.c
drivers/media/dvb/dvb-usb/nova-t-usb2.c
drivers/media/dvb/dvb-usb/umt-010.c
drivers/media/dvb/dvb-usb/vp702x.c
drivers/media/dvb/dvb-usb/vp7045.c
drivers/media/video/cpia_usb.c
drivers/media/video/em28xx/em28xx-video.c
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptbase.h
drivers/message/fusion/mptctl.c
drivers/message/fusion/mptfc.c
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptscsih.c
drivers/message/fusion/mptscsih.h
drivers/message/fusion/mptspi.c
drivers/net/irda/irda-usb.c
drivers/net/irda/stir4200.c
drivers/net/ns83820.c
drivers/net/pppoe.c
drivers/net/pppox.c
drivers/net/sk98lin/skge.c
drivers/net/skge.c
drivers/net/tg3.c
drivers/net/wireless/ipw2200.c
drivers/scsi/53c700.c
drivers/scsi/53c700.h
drivers/scsi/53c7xx.c
drivers/scsi/Kconfig
drivers/scsi/NCR5380.c
drivers/scsi/aha152x.c
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_osm.c
drivers/scsi/arm/Kconfig
drivers/scsi/arm/acornscsi.c
drivers/scsi/atari_NCR5380.c
drivers/scsi/ch.c
drivers/scsi/constants.c
drivers/scsi/ipr.c
drivers/scsi/ipr.h
drivers/scsi/iscsi_tcp.c
drivers/scsi/iscsi_tcp.h
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_disc.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_hw.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_version.h
drivers/scsi/megaraid.c
drivers/scsi/megaraid/Kconfig.megaraid
drivers/scsi/megaraid/megaraid_mbox.c
drivers/scsi/megaraid/megaraid_mbox.h
drivers/scsi/ncr53c8xx.c
drivers/scsi/ncr53c8xx.h
drivers/scsi/qla2xxx/Kconfig
drivers/scsi/qla2xxx/Makefile
drivers/scsi/qla2xxx/ql2400.c [new file with mode: 0644]
drivers/scsi/qla2xxx/ql2400_fw.c [new file with mode: 0644]
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/raid_class.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_priv.h
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_spi.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/sr_vendor.c
drivers/scsi/st.c
drivers/scsi/st.h
drivers/scsi/sun3_NCR5380.c
drivers/scsi/sym53c8xx_2/sym_defs.h
drivers/scsi/sym53c8xx_2/sym_fw.c
drivers/scsi/sym53c8xx_2/sym_fw.h
drivers/scsi/sym53c8xx_2/sym_fw1.h
drivers/scsi/sym53c8xx_2/sym_fw2.h
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/scsi/sym53c8xx_2/sym_glue.h
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/scsi/sym53c8xx_2/sym_hipd.h
drivers/scsi/sym53c8xx_2/sym_malloc.c
drivers/scsi/sym53c8xx_2/sym_nvram.c
drivers/scsi/sym53c8xx_2/sym_nvram.h
drivers/scsi/sym53c8xx_comm.h [deleted file]
drivers/scsi/sym53c8xx_defs.h [deleted file]
drivers/usb/Makefile
drivers/usb/atm/Kconfig
drivers/usb/atm/Makefile
drivers/usb/atm/cxacru.c
drivers/usb/atm/speedtch.c
drivers/usb/atm/ueagle-atm.c [new file with mode: 0644]
drivers/usb/atm/usbatm.c
drivers/usb/atm/xusbatm.c
drivers/usb/class/audio.c
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.h
drivers/usb/class/usb-midi.c
drivers/usb/class/usblp.c
drivers/usb/core/Makefile
drivers/usb/core/buffer.c
drivers/usb/core/devices.c
drivers/usb/core/devio.c
drivers/usb/core/driver.c [new file with mode: 0644]
drivers/usb/core/hcd.c
drivers/usb/core/hcd.h
drivers/usb/core/hub.c
drivers/usb/core/hub.h
drivers/usb/core/message.c
drivers/usb/core/usb.c
drivers/usb/core/usb.h
drivers/usb/gadget/dummy_hcd.c
drivers/usb/gadget/file_storage.c
drivers/usb/gadget/serial.c
drivers/usb/host/Makefile
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci-pci.c
drivers/usb/host/ehci-q.c
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/isp116x.h
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-hub.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/pci-quirks.c
drivers/usb/host/sl811-hcd.c
drivers/usb/host/sl811_cs.c
drivers/usb/host/uhci-debug.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/uhci-hcd.h
drivers/usb/host/uhci-q.c
drivers/usb/image/mdc800.c
drivers/usb/image/microtek.c
drivers/usb/input/Kconfig
drivers/usb/input/Makefile
drivers/usb/input/acecad.c
drivers/usb/input/aiptek.c
drivers/usb/input/appletouch.c
drivers/usb/input/ati_remote.c
drivers/usb/input/ati_remote2.c [new file with mode: 0644]
drivers/usb/input/fixp-arith.h
drivers/usb/input/hid-core.c
drivers/usb/input/hid-input.c
drivers/usb/input/hiddev.c
drivers/usb/input/itmtouch.c
drivers/usb/input/kbtab.c
drivers/usb/input/keyspan_remote.c
drivers/usb/input/mtouchusb.c
drivers/usb/input/powermate.c
drivers/usb/input/touchkitusb.c
drivers/usb/input/usbkbd.c
drivers/usb/input/usbmouse.c
drivers/usb/input/wacom.c
drivers/usb/input/xpad.c
drivers/usb/input/yealink.c
drivers/usb/media/dabusb.c
drivers/usb/media/dsbr100.c
drivers/usb/media/ibmcam.c
drivers/usb/media/konicawc.c
drivers/usb/media/ov511.c
drivers/usb/media/pwc/pwc-ctrl.c
drivers/usb/media/pwc/pwc-if.c
drivers/usb/media/se401.c
drivers/usb/media/sn9c102_core.c
drivers/usb/media/stv680.c
drivers/usb/media/stv680.h
drivers/usb/media/usbvideo.c
drivers/usb/media/vicam.c
drivers/usb/media/w9968cf.c
drivers/usb/misc/auerswald.c
drivers/usb/misc/cytherm.c
drivers/usb/misc/emi26.c
drivers/usb/misc/emi62.c
drivers/usb/misc/idmouse.c
drivers/usb/misc/ldusb.c
drivers/usb/misc/legousbtower.c
drivers/usb/misc/phidgetkit.c
drivers/usb/misc/phidgetservo.c
drivers/usb/misc/rio500.c
drivers/usb/misc/sisusbvga/sisusb.c
drivers/usb/misc/usblcd.c
drivers/usb/misc/usbled.c
drivers/usb/misc/usbtest.c
drivers/usb/misc/uss720.c
drivers/usb/mon/mon_text.c
drivers/usb/net/asix.c
drivers/usb/net/catc.c
drivers/usb/net/cdc_ether.c
drivers/usb/net/cdc_subset.c
drivers/usb/net/gl620a.c
drivers/usb/net/kaweth.c
drivers/usb/net/net1080.c
drivers/usb/net/pegasus.c
drivers/usb/net/plusb.c
drivers/usb/net/rndis_host.c
drivers/usb/net/rtl8150.c
drivers/usb/net/zaurus.c
drivers/usb/net/zd1201.c
drivers/usb/serial/airprime.c
drivers/usb/serial/anydata.c
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/cp2101.c
drivers/usb/serial/cyberjack.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/empeg.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/generic.c
drivers/usb/serial/hp4x.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_edgeport.h
drivers/usb/serial/io_fw_boot2.h
drivers/usb/serial/io_ti.c
drivers/usb/serial/ipaq.c
drivers/usb/serial/ipw.c
drivers/usb/serial/ir-usb.c
drivers/usb/serial/keyspan.h
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mct_u232.c
drivers/usb/serial/omninet.c
drivers/usb/serial/option.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/safe_serial.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb-serial.h
drivers/usb/serial/visor.c
drivers/usb/serial/whiteheat.c
drivers/usb/storage/Kconfig
drivers/usb/storage/Makefile
drivers/usb/storage/alauda.c [new file with mode: 0644]
drivers/usb/storage/alauda.h [new file with mode: 0644]
drivers/usb/storage/debug.c
drivers/usb/storage/initializers.h
drivers/usb/storage/libusual.c [new file with mode: 0644]
drivers/usb/storage/onetouch.c
drivers/usb/storage/protocol.h
drivers/usb/storage/sddr09.c
drivers/usb/storage/sddr09.h
drivers/usb/storage/transport.h
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/usb.c
drivers/usb/storage/usb.h
drivers/usb/usb-skeleton.c
drivers/w1/dscore.c
fs/9p/trans_sock.c
fs/bio.c
fs/compat.c
fs/nfs/callback.c
fs/read_write.c
include/asm-alpha/bitops.h
include/asm-arm/arch-pxa/ohci.h [new file with mode: 0644]
include/asm-arm/bitops.h
include/asm-arm26/bitops.h
include/asm-cris/bitops.h
include/asm-frv/bitops.h
include/asm-generic/bitops.h
include/asm-h8300/bitops.h
include/asm-i386/bitops.h
include/asm-ia64/bitops.h
include/asm-m32r/bitops.h
include/asm-m68k/bitops.h
include/asm-m68knommu/bitops.h
include/asm-mips/bitops.h
include/asm-parisc/bitops.h
include/asm-powerpc/bitops.h
include/asm-s390/bitops.h
include/asm-sh/bitops.h
include/asm-sh64/bitops.h
include/asm-sparc/bitops.h
include/asm-sparc64/bitops.h
include/asm-v850/bitops.h
include/asm-x86_64/bitops.h
include/asm-xtensa/bitops.h
include/linux/bio.h
include/linux/bitops.h
include/linux/blkdev.h
include/linux/cpufreq.h
include/linux/dccp.h
include/linux/etherdevice.h
include/linux/if_pppox.h
include/linux/ip.h
include/linux/ipv6.h
include/linux/net.h
include/linux/pci_ids.h
include/linux/pfkeyv2.h
include/linux/pkt_sched.h
include/linux/random.h
include/linux/security.h
include/linux/skbuff.h
include/linux/socket.h
include/linux/sysctl.h
include/linux/tcp.h
include/linux/udp.h
include/linux/usb.h
include/linux/usb_usual.h [new file with mode: 0644]
include/linux/xfrm.h
include/net/af_unix.h
include/net/atmclip.h
include/net/dst.h
include/net/flow.h
include/net/genetlink.h
include/net/icmp.h
include/net/ieee80211_crypt.h
include/net/inet6_connection_sock.h [new file with mode: 0644]
include/net/inet6_hashtables.h
include/net/inet_common.h
include/net/inet_connection_sock.h
include/net/inet_ecn.h
include/net/inet_hashtables.h
include/net/inet_sock.h [new file with mode: 0644]
include/net/inet_timewait_sock.h
include/net/inetpeer.h
include/net/ip.h
include/net/ip_fib.h
include/net/ip_vs.h
include/net/ipv6.h
include/net/ndisc.h
include/net/neighbour.h
include/net/pkt_act.h
include/net/protocol.h
include/net/raw.h
include/net/request_sock.h
include/net/sctp/structs.h
include/net/sctp/user.h
include/net/sock.h
include/net/tcp.h
include/net/tcp_states.h
include/net/timewait_sock.h [new file with mode: 0644]
include/net/transp_v6.h
include/net/udp.h
include/net/xfrm.h
include/scsi/scsi_cmnd.h
include/scsi/scsi_dbg.h
include/scsi/scsi_device.h
include/scsi/scsi_transport_spi.h
init/main.c
net/appletalk/ddp.c
net/atm/pvc.c
net/atm/svc.c
net/ax25/af_ax25.c
net/bluetooth/af_bluetooth.c
net/bluetooth/bnep/sock.c
net/bluetooth/cmtp/sock.c
net/bluetooth/hci_sock.c
net/bluetooth/hidp/sock.c
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/sock.c
net/bluetooth/sco.c
net/bridge/br.c
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_input.c
net/bridge/br_netfilter.c
net/bridge/br_notify.c
net/bridge/br_private.h
net/bridge/br_stp_if.c
net/bridge/netfilter/Kconfig
net/bridge/netfilter/ebt_log.c
net/bridge/netfilter/ebt_ulog.c
net/core/datagram.c
net/core/dev.c
net/core/filter.c
net/core/flow.c
net/core/netpoll.c
net/core/pktgen.c
net/core/skbuff.c
net/core/sock.c
net/core/stream.c
net/dccp/Makefile
net/dccp/ackvec.c
net/dccp/ackvec.h
net/dccp/ccid.h
net/dccp/dccp.h
net/dccp/diag.c
net/dccp/input.c
net/dccp/ipv4.c
net/dccp/ipv6.c [new file with mode: 0644]
net/dccp/ipv6.h [new file with mode: 0644]
net/dccp/minisocks.c
net/dccp/output.c
net/dccp/proto.c
net/decnet/af_decnet.c
net/decnet/dn_neigh.c
net/decnet/dn_nsp_in.c
net/econet/af_econet.c
net/ieee80211/ieee80211_rx.c
net/ipv4/Kconfig
net/ipv4/Makefile
net/ipv4/af_inet.c
net/ipv4/ah4.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/esp4.c
net/ipv4/fib_frontend.c
net/ipv4/fib_hash.c
net/ipv4/fib_rules.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/inet_connection_sock.c
net/ipv4/inet_diag.c
net/ipv4/inet_hashtables.c
net/ipv4/inet_timewait_sock.c
net/ipv4/inetpeer.c
net/ipv4/ip_fragment.c
net/ipv4/ip_input.c
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/ip_sockglue.c
net/ipv4/ipcomp.c
net/ipv4/ipconfig.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_app.c
net/ipv4/ipvs/ip_vs_conn.c
net/ipv4/ipvs/ip_vs_core.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_dh.c
net/ipv4/ipvs/ip_vs_est.c
net/ipv4/ipvs/ip_vs_lblc.c
net/ipv4/ipvs/ip_vs_lblcr.c
net/ipv4/ipvs/ip_vs_proto_ah.c
net/ipv4/ipvs/ip_vs_proto_esp.c
net/ipv4/ipvs/ip_vs_proto_tcp.c
net/ipv4/ipvs/ip_vs_proto_udp.c
net/ipv4/ipvs/ip_vs_sh.c
net/ipv4/ipvs/ip_vs_sync.c
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_conntrack_amanda.c
net/ipv4/netfilter/ip_conntrack_proto_gre.c
net/ipv4/netfilter/ip_conntrack_proto_udp.c
net/ipv4/netfilter/ip_conntrack_standalone.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/netfilter/ipt_MASQUERADE.c
net/ipv4/netfilter/ipt_physdev.c
net/ipv4/proc.c
net/ipv4/syncookies.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp.c
net/ipv4/tcp_bic.c
net/ipv4/tcp_cong.c
net/ipv4/tcp_cubic.c [new file with mode: 0644]
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_output.c
net/ipv4/tcp_vegas.c
net/ipv4/udp.c
net/ipv6/Makefile
net/ipv6/addrconf.c
net/ipv6/af_inet6.c
net/ipv6/ah6.c
net/ipv6/esp6.c
net/ipv6/exthdrs.c
net/ipv6/inet6_connection_sock.c [new file with mode: 0644]
net/ipv6/inet6_hashtables.c
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_output.c
net/ipv6/ipcomp6.c
net/ipv6/ipv6_sockglue.c
net/ipv6/mcast.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6t_LOG.c
net/ipv6/netfilter/ip6t_ah.c
net/ipv6/netfilter/ip6t_esp.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/raw.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipx/af_ipx.c
net/irda/af_irda.c
net/key/af_key.c
net/llc/af_llc.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netlink/af_netlink.c
net/netlink/genetlink.c
net/netrom/af_netrom.c
net/nonet.c
net/packet/af_packet.c
net/rose/af_rose.c
net/sched/sch_netem.c
net/sched/sch_teql.c
net/sctp/associola.c
net/sctp/input.c
net/sctp/ipv6.c
net/sctp/output.c
net/sctp/protocol.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sctp/transport.c
net/socket.c
net/sunrpc/svcsock.c
net/unix/af_unix.c
net/unix/garbage.c
net/wanrouter/af_wanpipe.c
net/x25/af_x25.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
security/Kconfig
security/dummy.c
security/selinux/Makefile
security/selinux/hooks.c
security/selinux/include/av_perm_to_string.h
security/selinux/include/av_permissions.h
security/selinux/include/xfrm.h [new file with mode: 0644]
security/selinux/xfrm.c [new file with mode: 0644]
sound/usb/usbaudio.c
sound/usb/usx2y/usbusx2y.c

index 15ce0f21e5e0c04c28e095941a21606192d8404b..320af25de3a276fd5b77aa830b08549c2c523793 100644 (file)
 !Edrivers/usb/core/urb.c
 !Edrivers/usb/core/message.c
 !Edrivers/usb/core/file.c
+!Edrivers/usb/core/driver.c
 !Edrivers/usb/core/usb.c
 !Edrivers/usb/core/hub.c
     </chapter>
index 933fae74c3379cba1fd7d066a2ab7f6daead76a3..f4b8dc4237e6a83b6f0cf44cfc3861f924baec10 100644 (file)
@@ -27,6 +27,7 @@ Contents:
 2.2  Powersave
 2.3  Userspace
 2.4  Ondemand
+2.5  Conservative
 
 3.   The Governor Interface in the CPUfreq Core
 
@@ -110,9 +111,64 @@ directory.
 
 The CPUfreq govenor "ondemand" sets the CPU depending on the
 current usage. To do this the CPU must have the capability to
-switch the frequency very fast.
-
-
+switch the frequency very quickly.  There are a number of sysfs file
+accessible parameters:
+
+sampling_rate: measured in uS (10^-6 seconds), this is how often you
+want the kernel to look at the CPU usage and to make decisions on
+what to do about the frequency.  Typically this is set to values of
+around '10000' or more.
+
+show_sampling_rate_(min|max): the minimum and maximum sampling rates
+available that you may set 'sampling_rate' to.
+
+up_threshold: defines what the average CPU usaged between the samplings
+of 'sampling_rate' needs to be for the kernel to make a decision on
+whether it should increase the frequency.  For example when it is set
+to its default value of '80' it means that between the checking
+intervals the CPU needs to be on average more than 80% in use to then
+decide that the CPU frequency needs to be increased.  
+
+sampling_down_factor: this parameter controls the rate that the CPU
+makes a decision on when to decrease the frequency.  When set to its
+default value of '5' it means that at 1/5 the sampling_rate the kernel
+makes a decision to lower the frequency.  Five "lower rate" decisions
+have to be made in a row before the CPU frequency is actually lower.
+If set to '1' then the frequency decreases as quickly as it increases,
+if set to '2' it decreases at half the rate of the increase.
+
+ignore_nice_load: this parameter takes a value of '0' or '1', when set
+to '0' (its default) then all processes are counted towards towards the
+'cpu utilisation' value.   When set to '1' then processes that are
+run with a 'nice' value will not count (and thus be ignored) in the
+overal usage calculation.  This is useful if you are running a CPU
+intensive calculation on your laptop that you do not care how long it
+takes to complete as you can 'nice' it and prevent it from taking part
+in the deciding process of whether to increase your CPU frequency.
+
+
+2.5 Conservative
+----------------
+
+The CPUfreq governor "conservative", much like the "ondemand"
+governor, sets the CPU depending on the current usage.  It differs in
+behaviour in that it gracefully increases and decreases the CPU speed
+rather than jumping to max speed the moment there is any load on the
+CPU.  This behaviour more suitable in a battery powered environment.
+The governor is tweaked in the same manner as the "ondemand" governor
+through sysfs with the addition of:
+
+freq_step: this describes what percentage steps the cpu freq should be
+increased and decreased smoothly by.  By default the cpu frequency will
+increase in 5% chunks of your maximum cpu frequency.  You can change this
+value to anywhere between 0 and 100 where '0' will effectively lock your
+CPU at a speed regardless of its load whilst '100' will, in theory, make
+it behave identically to the "ondemand" governor.
+
+down_threshold: same as the 'up_threshold' found for the "ondemand"
+governor but for the opposite direction.  For example when set to its
+default value of '20' it means that if the CPU usage needs to be below
+20% between samples to have the frequency decreased.
 
 3. The Governor Interface in the CPUfreq Core
 =============================================
index ebc09a159f6220d995ab39c3bbff812291f4659d..2b7cf19a06adc03435b84a04ae1dee46aae7e9a1 100644 (file)
@@ -46,6 +46,29 @@ ipfrag_secret_interval - INTEGER
        for the hash secret) for IP fragments.
        Default: 600
 
+ipfrag_max_dist - INTEGER
+       ipfrag_max_dist is a non-negative integer value which defines the 
+       maximum "disorder" which is allowed among fragments which share a 
+       common IP source address. Note that reordering of packets is 
+       not unusual, but if a large number of fragments arrive from a source 
+       IP address while a particular fragment queue remains incomplete, it 
+       probably indicates that one or more fragments belonging to that queue 
+       have been lost. When ipfrag_max_dist is positive, an additional check 
+       is done on fragments before they are added to a reassembly queue - if 
+       ipfrag_max_dist (or more) fragments have arrived from a particular IP 
+       address between additions to any IP fragment queue using that source 
+       address, it's presumed that one or more fragments in the queue are 
+       lost. The existing fragment queue will be dropped, and a new one 
+       started. An ipfrag_max_dist value of zero disables this check.
+
+       Using a very small value, e.g. 1 or 2, for ipfrag_max_dist can
+       result in unnecessarily dropping fragment queues when normal
+       reordering of packets occurs, which could lead to poor application 
+       performance. Using a very large value, e.g. 50000, increases the 
+       likelihood of incorrectly reassembling IP fragments that originate 
+       from different IP datagrams, which could result in data corruption.
+       Default: 64
+
 INET peer storage:
 
 inet_peer_threshold - INTEGER
index 5331d91432c76cb7d598165ee89db51236f27e75..09f6300eda4bef7262c5955abbe9e0bc5b41f905 100644 (file)
@@ -1,3 +1,38 @@
+Release Date   : Fri Nov 11 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
+Current Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module)
+Older Version  : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
+
+1.     Sorted out PCI IDs to remove megaraid support overlaps.
+       Based on the patch from Daniel, sorted out PCI IDs along with
+       charactor node name change from 'megadev' to 'megadev_legacy' to avoid
+       conflict.
+       ---
+       Hopefully we'll be getting the build restriction zapped much sooner, 
+       but we should also be thinking about totally removing the hardware 
+       support overlap in the megaraid drivers.
+
+       This patch pencils in a date of Feb 06 for this, and performs some 
+       printk abuse in hope that existing legacy users might pick up on what's
+       going on.
+
+       Signed-off-by: Daniel Drake <dsd@gentoo.org>
+       ---
+
+2.     Fixed a issue: megaraid always fails to reset handler.
+       ---
+       I found that the megaraid driver always fails to reset the
+       adapter with the following message:
+               megaraid: resetting the host...
+               megaraid mbox: reset sequence completed successfully
+               megaraid: fast sync command timed out
+               megaraid: reservation reset failed
+       when the "Cluster mode" of the adapter BIOS is enabled.
+       So, whenever the reset occurs, the adapter goes to
+       offline and just become unavailable.
+
+       Jun'ichi Nomura [mailto:jnomura@mtc.biglobe.ne.jp]
+       ---
+
 Release Date   : Mon Mar 07 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
 Current Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
 Older Version  : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
index 66565d42288fc446ad08930b8839a7285dee37e6..c4af92bc705df3da3d390321d479eb131418b31e 100644 (file)
@@ -150,7 +150,8 @@ scsi devices of which only the first 2 respond:
 LLD                   mid level                    LLD
 ===-------------------=========--------------------===------
 scsi_host_alloc()  -->
-scsi_add_host()  --------+
+scsi_add_host()  ---->
+scsi_scan_host()  -------+
                          |
                     slave_alloc()
                     slave_configure() -->  scsi_adjust_queue_depth()
@@ -196,7 +197,7 @@ of the issues involved. See the section on reference counting below.
 
 
 The hotplug concept may be extended to SCSI devices. Currently, when an
-HBA is added, the scsi_add_host() function causes a scan for SCSI devices
+HBA is added, the scsi_scan_host() function causes a scan for SCSI devices
 attached to the HBA's SCSI transport. On newer SCSI transports the HBA
 may become aware of a new SCSI device _after_ the scan has completed.
 An LLD can use this sequence to make the mid level aware of a SCSI device:
@@ -372,7 +373,7 @@ names all start with "scsi_".
 Summary:
    scsi_activate_tcq - turn on tag command queueing
    scsi_add_device - creates new scsi device (lu) instance
-   scsi_add_host - perform sysfs registration and SCSI bus scan.
+   scsi_add_host - perform sysfs registration and set up transport class
    scsi_adjust_queue_depth - change the queue depth on a SCSI device
    scsi_assign_lock - replace default host_lock with given lock
    scsi_bios_ptable - return copy of block device's partition table
@@ -386,6 +387,7 @@ Summary:
    scsi_remove_device - detach and remove a SCSI device
    scsi_remove_host - detach and remove all SCSI devices owned by host
    scsi_report_bus_reset - report scsi _bus_ reset observed
+   scsi_scan_host - scan SCSI bus
    scsi_track_queue_full - track successive QUEUE_FULL events 
    scsi_unblock_requests - allow further commands to be queued to given host
    scsi_unregister - [calls scsi_host_put()]
@@ -425,10 +427,10 @@ void scsi_activate_tcq(struct scsi_device *sdev, int depth)
  *      Might block: yes
  *
  *      Notes: This call is usually performed internally during a scsi
- *      bus scan when an HBA is added (i.e. scsi_add_host()). So it
+ *      bus scan when an HBA is added (i.e. scsi_scan_host()). So it
  *      should only be called if the HBA becomes aware of a new scsi
- *      device (lu) after scsi_add_host() has completed. If successful
- *      this call we lead to slave_alloc() and slave_configure() callbacks
+ *      device (lu) after scsi_scan_host() has completed. If successful
+ *      this call can lead to slave_alloc() and slave_configure() callbacks
  *      into the LLD.
  *
  *      Defined in: drivers/scsi/scsi_scan.c
@@ -439,7 +441,7 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
 
 
 /**
- * scsi_add_host - perform sysfs registration and SCSI bus scan.
+ * scsi_add_host - perform sysfs registration and set up transport class
  * @shost:   pointer to scsi host instance
  * @dev:     pointer to struct device of type scsi class
  *
@@ -448,7 +450,11 @@ struct scsi_device * scsi_add_device(struct Scsi_Host *shost,
  *      Might block: no
  *
  *      Notes: Only required in "hotplug initialization model" after a
- *      successful call to scsi_host_alloc().
+ *      successful call to scsi_host_alloc().  This function does not
+ *     scan the bus; this can be done by calling scsi_scan_host() or
+ *     in some other transport-specific way.  The LLD must set up
+ *     the transport template before calling this function and may only
+ *     access the transport class data after this function has been called.
  *
  *      Defined in: drivers/scsi/hosts.c
  **/
@@ -559,7 +565,7 @@ void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
  *      area for the LLD's exclusive use.
  *      Both associated refcounting objects have their refcount set to 1.
  *      Full registration (in sysfs) and a bus scan are performed later when
- *      scsi_add_host() is called.
+ *      scsi_add_host() and scsi_scan_host() are called.
  *
  *      Defined in: drivers/scsi/hosts.c .
  **/
@@ -698,6 +704,19 @@ int scsi_remove_host(struct Scsi_Host *shost)
 void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
 
 
+/**
+ * scsi_scan_host - scan SCSI bus
+ * @shost: a pointer to a scsi host instance
+ *
+ *     Might block: yes
+ *
+ *     Notes: Should be called after scsi_add_host()
+ *
+ *     Defined in: drivers/scsi/scsi_scan.c
+ **/
+void scsi_scan_host(struct Scsi_Host *shost)
+
+
 /**
  * scsi_track_queue_full - track successive QUEUE_FULL events on given
  *                      device to determine if and when there is a need
index 6af683025ae045101a510c30e0fb076bbdf97bda..3fd7687a6ad99463578ca4fcc5a0c89fa5504500 100644 (file)
@@ -2640,6 +2640,12 @@ L:       linux-usb-users@lists.sourceforge.net
 L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 
+USB ISP116X DRIVER
+P:     Olav Kongas
+M:     ok@artecdesign.ee
+L:     linux-usb-devel@lists.sourceforge.net
+S:     Maintained
+
 USB KAWASAKI LSI DRIVER
 P:     Oliver Neukum
 M:     oliver@neukum.name
@@ -2651,7 +2657,7 @@ USB MASS STORAGE DRIVER
 P:     Matthew Dharm
 M:     mdharm-usb@one-eyed-alien.net
 L:     linux-usb-users@lists.sourceforge.net
-L:     linux-usb-devel@lists.sourceforge.net
+L:     usb-storage@lists.one-eyed-alien.net
 S:     Maintained
 W:     http://www.one-eyed-alien.net/~mdharm/linux-usb/
 
index 07892f4012d8a2cd5d2bbddddc9ab203d78207f0..277498ae5b6c12d4911564ee4d4d999853c9c283 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/arch/pxafb.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/irda.h>
+#include <asm/arch/ohci.h>
 
 #include "generic.h"
 
@@ -393,6 +394,25 @@ static struct platform_device *platform_devices[] __initdata = {
        &mst_flash_device[1],
 };
 
+static int mainstone_ohci_init(struct device *dev)
+{
+       /* setup Port1 GPIO pin. */
+       pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN);  /* USBHPWR1 */
+       pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
+
+       /* Set the Power Control Polarity Low and Power Sense
+          Polarity Low to active low. */
+       UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
+               ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
+
+       return 0;
+}
+
+static struct pxaohci_platform_data mainstone_ohci_platform_data = {
+       .port_mode      = PMM_PERPORT_MODE,
+       .init           = mainstone_ohci_init,
+};
+
 static void __init mainstone_init(void)
 {
        int SW7 = 0;  /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
@@ -424,6 +444,7 @@ static void __init mainstone_init(void)
 
        pxa_set_mci_info(&mainstone_mci_platform_data);
        pxa_set_ficp_info(&mainstone_ficp_platform_data);
+       pxa_set_ohci_info(&mainstone_ohci_platform_data);
 }
 
 
index c722a9a91fcce243b9fce9a77f2c15f3e50b939a..b41b1efaa2cf9088e30fe8fe9ee1d4dda6fd46c7 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/hardware.h>
 #include <asm/irq.h>
 #include <asm/arch/pxa-regs.h>
+#include <asm/arch/ohci.h>
 
 #include "generic.h"
 
@@ -194,6 +195,11 @@ static struct platform_device ohci_device = {
        .resource       = pxa27x_ohci_resources,
 };
 
+void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
+{
+       ohci_device.dev.platform_data = info;
+}
+
 static struct platform_device *devices[] __initdata = {
        &ohci_device,
 };
index 04a405345203424388d15b050310642b723f00aa..2b62dee35c6c83299105b46ffc5e00b8969b3c5d 100644 (file)
@@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb)
  */
 static int nforce2_set_fsb(unsigned int fsb)
 {
-       u32 pll, temp = 0;
+       u32 temp = 0;
        unsigned int tfsb;
        int diff;
+       int pll = 0;
 
        if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) {
                printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb);
index 68a1fc87f4cabb6cb63b71a9c84bc0132494365a..0fbbd4c1072e6c19045d513af0acc9af9ad82a22 100644 (file)
@@ -45,7 +45,7 @@
 
 #define PFX "powernow-k8: "
 #define BFX PFX "BIOS error: "
-#define VERSION "version 1.50.4"
+#define VERSION "version 1.60.0"
 #include "powernow-k8.h"
 
 /* serialize freq changes  */
@@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid)
 
        do {
                wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS);
-                if (i++ > 100) {
-                        printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n");
-                        return 1;
-                }
+               if (i++ > 100) {
+                       printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n");
+                       return 1;
+               }
        } while (query_current_values_with_pending_wait(data));
 
        if (savefid != data->currfid) {
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid
 /* Phase 2 - core frequency transition */
 static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
 {
-       u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid;
+       u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid;
 
        if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) {
                printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n",
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
            : vcoreqfid - vcocurrfid;
 
        while (vcofiddiff > 2) {
+               (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2);
+
                if (reqfid > data->currfid) {
                        if (data->currfid > LO_FID_TABLE_TOP) {
-                               if (write_new_fid(data, data->currfid + 2)) {
+                               if (write_new_fid(data, data->currfid + fid_interval)) {
                                        return 1;
                                }
                        } else {
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
                                }
                        }
                } else {
-                       if (write_new_fid(data, data->currfid - 2))
+                       if (write_new_fid(data, data->currfid - fid_interval))
                                return 1;
                }
 
@@ -464,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu)
        set_cpus_allowed(current, cpumask_of_cpu(cpu));
 
        if (smp_processor_id() != cpu) {
-               printk(KERN_ERR "limiting to cpu %u failed\n", cpu);
+               printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu);
                goto out;
        }
 
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu)
        eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
        if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
            ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
-           ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) {
+           ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
                printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
                goto out;
        }
@@ -517,22 +519,24 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8
                        printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j);
                        return -ENODEV;
                }
-               if ((pst[j].fid > MAX_FID)
-                   || (pst[j].fid & 1)
-                   || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) {
+               if (pst[j].fid > MAX_FID) {
+                       printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j);
+                       return -ENODEV;
+               }
+               if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
                        /* Only first fid is allowed to be in "low" range */
-                       printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid);
+                       printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid);
                        return -EINVAL;
                }
                if (pst[j].fid < lastfid)
                        lastfid = pst[j].fid;
        }
        if (lastfid & 1) {
-               printk(KERN_ERR PFX "lastfid invalid\n");
+               printk(KERN_ERR BFX "lastfid invalid\n");
                return -EINVAL;
        }
        if (lastfid > LO_FID_TABLE_TOP)
-               printk(KERN_INFO PFX  "first fid not from lo freq table\n");
+               printk(KERN_INFO BFX  "first fid not from lo freq table\n");
 
        return 0;
 }
@@ -631,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data)
 
                dprintk("table vers: 0x%x\n", psb->tableversion);
                if (psb->tableversion != PSB_VERSION_1_4) {
-                       printk(KERN_INFO BFX "PSB table is not v1.4\n");
+                       printk(KERN_ERR BFX "PSB table is not v1.4\n");
                        return -ENODEV;
                }
 
@@ -689,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data)
         * BIOS and Kernel Developer's Guide, which is available on
         * www.amd.com
         */
-       printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n");
+       printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n");
        return -ENODEV;
 }
 
@@ -912,7 +916,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
        set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
 
        if (smp_processor_id() != pol->cpu) {
-               printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
+               printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
                goto err_out;
        }
 
@@ -982,6 +986,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
        cpumask_t oldmask = CPU_MASK_ALL;
        int rc, i;
 
+       if (!cpu_online(pol->cpu))
+               return -ENODEV;
+
        if (!check_supported_cpu(pol->cpu))
                return -ENODEV;
 
@@ -1021,7 +1028,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
        set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
 
        if (smp_processor_id() != pol->cpu) {
-               printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
+               printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
                goto err_out;
        }
 
@@ -1162,10 +1169,9 @@ static void __exit powernowk8_exit(void)
        cpufreq_unregister_driver(&cpufreq_amd64_driver);
 }
 
-MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com.");
+MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>");
 MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver.");
 MODULE_LICENSE("GPL");
 
 late_initcall(powernowk8_init);
 module_exit(powernowk8_exit);
-
index b1e85bb36396578fe8402dd2365277b32fb6e7e0..d0de37d58e9a2abe2839dd57206e5598745c54e0 100644 (file)
@@ -42,7 +42,7 @@ struct powernow_k8_data {
 #define CPUID_XFAM                     0x0ff00000      /* extended family */
 #define CPUID_XFAM_K8                  0
 #define CPUID_XMOD                     0x000f0000      /* extended model */
-#define CPUID_XMOD_REV_F               0x00040000
+#define CPUID_XMOD_REV_G               0x00060000
 #define CPUID_USE_XFAM_XMOD            0x00000f00
 #define CPUID_GET_MAX_CAPABILITIES     0x80000000
 #define CPUID_FREQ_VOLT_CAPABILITIES   0x80000007
@@ -86,13 +86,14 @@ struct powernow_k8_data {
  *   low fid table
  * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry
  *   in the low fid table
- * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid
+ * - the parts can only step at <= 200 MHz intervals, odd fid values are
+ *   supported in revision G and later revisions.
  * - lowest frequency must be >= interprocessor hypertransport link speed
  *   (only applies to MP systems obviously)
  */
 
 /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */
-#define LO_FID_TABLE_TOP     6 /* fid values marking the boundary    */
+#define LO_FID_TABLE_TOP     7 /* fid values marking the boundary    */
 #define HI_FID_TABLE_BOTTOM  8 /* between the low and high tables    */
 
 #define LO_VCOFREQ_TABLE_TOP    1400   /* corresponding vco frequency values */
@@ -106,7 +107,7 @@ struct powernow_k8_data {
 #define MIN_FREQ 800   /* Min and max freqs, per spec */
 #define MAX_FREQ 5000
 
-#define INVALID_FID_MASK 0xffffffc1  /* not a valid fid if these bits are set */
+#define INVALID_FID_MASK 0xffffffc0  /* not a valid fid if these bits are set */
 #define INVALID_VID_MASK 0xffffffc0  /* not a valid vid if these bits are set */
 
 #define VID_OFF 0x3f
index 5b7d18a06afaeee09b090c20d3bb6b7c7016f0f4..b425cd3d1838377aee89ad50411b2f51b6d40306 100644 (file)
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev;
  */
 static unsigned int speedstep_processor = 0;
 
+static u32 pmbase;
 
 /*
  *   There are only two frequency states for each processor. Values
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
 
 
 /**
- * speedstep_set_state - set the SpeedStep state
- * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
+ * speedstep_find_register - read the PMBASE address
  *
- *   Tries to change the SpeedStep state.
+ * Returns: -ENODEV if no register could be found
  */
-static void speedstep_set_state (unsigned int state)
+static int speedstep_find_register (void)
 {
-       u32 pmbase;
-       u8 pm2_blk;
-       u8 value;
-       unsigned long flags;
-
-       if (!speedstep_chipset_dev || (state > 0x1))
-               return;
+       if (!speedstep_chipset_dev)
+               return -ENODEV;
 
        /* get PMBASE */
        pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase);
        if (!(pmbase & 0x01)) {
                printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
-               return;
+               return -ENODEV;
        }
 
        pmbase &= 0xFFFFFFFE;
        if (!pmbase) {
                printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
-               return;
+               return -ENODEV;
        }
 
+       dprintk("pmbase is 0x%x\n", pmbase);
+       return 0;
+}
+
+/**
+ * speedstep_set_state - set the SpeedStep state
+ * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
+ *
+ *   Tries to change the SpeedStep state.
+ */
+static void speedstep_set_state (unsigned int state)
+{
+       u8 pm2_blk;
+       u8 value;
+       unsigned long flags;
+
+       if (state > 0x1)
+               return;
+
        /* Disable IRQs */
        local_irq_save(flags);
 
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
        cpus_allowed = current->cpus_allowed;
        set_cpus_allowed(current, policy->cpus);
 
-       /* detect low and high frequency */
+       /* detect low and high frequency and transition latency */
        result = speedstep_get_freqs(speedstep_processor,
                                     &speedstep_freqs[SPEEDSTEP_LOW].frequency,
                                     &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
+                                    &policy->cpuinfo.transition_latency,
                                     &speedstep_set_state);
        set_cpus_allowed(current, cpus_allowed);
        if (result)
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
 
        /* cpuinfo and default policy values */
        policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-       policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
        policy->cur = speed;
 
        result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
@@ -400,6 +414,9 @@ static int __init speedstep_init(void)
                return -EINVAL;
        }
 
+       if (speedstep_find_register())
+               return -ENODEV;
+
        return cpufreq_register_driver(&speedstep_driver);
 }
 
index d368b3f5fce85397e9e139eb4f5b0314ac15c178..7c47005a1805c41dec67157c18c103dd6720f3c3 100644 (file)
@@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor);
 unsigned int speedstep_get_freqs(unsigned int processor,
                                  unsigned int *low_speed,
                                  unsigned int *high_speed,
+                                 unsigned int *transition_latency,
                                  void (*set_state) (unsigned int state))
 {
        unsigned int prev_speed;
        unsigned int ret = 0;
        unsigned long flags;
+       struct timeval tv1, tv2;
 
        if ((!processor) || (!low_speed) || (!high_speed) || (!set_state))
                return -EINVAL;
@@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor,
                return -EIO;
 
        dprintk("previous speed is %u\n", prev_speed);
-       
+
        local_irq_save(flags);
 
        /* switch to low state */
@@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor,
 
        dprintk("low speed is %u\n", *low_speed);
 
+       /* start latency measurement */
+       if (transition_latency)
+               do_gettimeofday(&tv1);
+
        /* switch to high state */
        set_state(SPEEDSTEP_HIGH);
+
+       /* end latency measurement */
+       if (transition_latency)
+               do_gettimeofday(&tv2);
+
        *high_speed = speedstep_get_processor_frequency(processor);
        if (!*high_speed) {
                ret = -EIO;
@@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor,
        if (*high_speed != prev_speed)
                set_state(SPEEDSTEP_LOW);
 
+       if (transition_latency) {
+               *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC +
+                       tv2.tv_usec - tv1.tv_usec;
+               dprintk("transition latency is %u uSec\n", *transition_latency);
+
+               /* convert uSec to nSec and add 20% for safety reasons */
+               *transition_latency *= 1200;
+
+               /* check if the latency measurement is too high or too low
+                * and set it to a safe value (500uSec) in that case
+                */
+               if (*transition_latency > 10000000 || *transition_latency < 50000) {
+                       printk (KERN_WARNING "speedstep: frequency transition measured seems out of "
+                                       "range (%u nSec), falling back to a safe one of %u nSec.\n",
+                                       *transition_latency, 500000);
+                       *transition_latency = 500000;
+               }
+       }
+
  out:
        local_irq_restore(flags);
        return (ret);
index 261a2c9b7f6b875bbded0143ba87011660a4c0c1..6a727fd3a77e099e863bc982309cd1028fd2e55e 100644 (file)
@@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor);
 extern unsigned int speedstep_get_freqs(unsigned int processor,
          unsigned int *low_speed,
          unsigned int *high_speed,
+         unsigned int *transition_latency,
          void (*set_state) (unsigned int state));
index 2718fb6f6aba89467467e48f1dd24fba465fae08..28cc5d524afcd18a2dce1ee4f5ccb3d2c737faf1 100644 (file)
@@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
                result = speedstep_get_freqs(speedstep_processor,
                                &speedstep_freqs[SPEEDSTEP_LOW].frequency,
                                &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
+                               NULL,
                                &speedstep_set_state);
 
                if (result) {
index e7921315ae9d8fe5df562cc745f908b6081ed1ab..6d91b274589c7fff2bef8e0d35aaa90c41de71a6 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/string.h>
 #include <asm/semaphore.h>
 #include <linux/seq_file.h>
+#include <linux/cpufreq.h>
 
 /*
  *     Get CPU information for use by the procfs.
@@ -86,8 +87,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                seq_printf(m, "stepping\t: unknown\n");
 
        if ( cpu_has(c, X86_FEATURE_TSC) ) {
+               unsigned int freq = cpufreq_quick_get(n);
+               if (!freq)
+                       freq = cpu_khz;
                seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
-                       cpu_khz / 1000, (cpu_khz % 1000));
+                       freq / 1000, (freq % 1000));
        }
 
        /* Cache size */
index 5add0bcf87a7a338974d39fbff41fe68ce3d6956..088e5dded8dc1c2be9706ffd5819499b433f8513 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/initrd.h>
 #include <linux/platform.h>
 #include <linux/pm.h>
+#include <linux/cpufreq.h>
 
 #include <asm/ia32.h>
 #include <asm/machvec.h>
@@ -517,6 +518,7 @@ show_cpuinfo (struct seq_file *m, void *v)
        char family[32], features[128], *cp, sep;
        struct cpuinfo_ia64 *c = v;
        unsigned long mask;
+       unsigned int proc_freq;
        int i;
 
        mask = c->features;
@@ -549,6 +551,10 @@ show_cpuinfo (struct seq_file *m, void *v)
                sprintf(cp, " 0x%lx", mask);
        }
 
+       proc_freq = cpufreq_quick_get(cpunum);
+       if (!proc_freq)
+               proc_freq = c->proc_freq / 1000;
+
        seq_printf(m,
                   "processor  : %d\n"
                   "vendor     : %s\n"
@@ -565,7 +571,7 @@ show_cpuinfo (struct seq_file *m, void *v)
                   "BogoMIPS   : %lu.%02lu\n",
                   cpunum, c->vendor, family, c->model, c->revision, c->archrev,
                   features, c->ppn, c->number,
-                  c->proc_freq / 1000000, c->proc_freq % 1000000,
+                  proc_freq / 1000, proc_freq % 1000,
                   c->itc_freq / 1000000, c->itc_freq % 1000000,
                   lpj*HZ/500000, (lpj*HZ/5000) % 100);
 #ifdef CONFIG_SMP
index 330cf84d21feaf298636fe09b6d9be10d2637d03..60353f5acc48a42794bc9f5d19635a507e638176 100644 (file)
@@ -420,7 +420,7 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
                goto out;
        pos = merge_64(a4, a5);
        ret = rw_verify_area(READ, file, &pos, count);
-       if (ret)
+       if (ret < 0)
                goto out;
        ret = -EINVAL;
        if (!file->f_op || !(read = file->f_op->read))
@@ -455,7 +455,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
                goto out;
        pos = merge_64(a4, a5);
        ret = rw_verify_area(WRITE, file, &pos, count);
-       if (ret)
+       if (ret < 0)
                goto out;
        ret = -EINVAL;
        if (!file->f_op || !(write = file->f_op->write))
index 750e01dcbdf49f364940c87f5ab6b4bc158d460a..64c4534b930c74bc118cf1530a812401456f3d4e 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/edd.h>
 #include <linux/mmzone.h>
 #include <linux/kexec.h>
+#include <linux/cpufreq.h>
 
 #include <asm/mtrr.h>
 #include <asm/uaccess.h>
@@ -1256,8 +1257,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                seq_printf(m, "stepping\t: unknown\n");
        
        if (cpu_has(c,X86_FEATURE_TSC)) {
+               unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data));
+               if (!freq)
+                       freq = cpu_khz;
                seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
-                            cpu_khz / 1000, (cpu_khz % 1000));
+                            freq / 1000, (freq % 1000));
        }
 
        /* Cache size */
index 99c9ca6d5992ab18b3e40fa201423bd3e36a0055..d4beb9a89ee0b08b0b681ca5a09e5cda59b7e99f 100644 (file)
@@ -239,7 +239,7 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn)
        q->backing_dev_info.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
        q->backing_dev_info.state = 0;
        q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
-       blk_queue_max_sectors(q, MAX_SECTORS);
+       blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
        blk_queue_hardsect_size(q, 512);
        blk_queue_dma_alignment(q, 511);
        blk_queue_congestion_threshold(q);
@@ -555,7 +555,12 @@ void blk_queue_max_sectors(request_queue_t *q, unsigned short max_sectors)
                printk("%s: set to minimum %d\n", __FUNCTION__, max_sectors);
        }
 
-       q->max_sectors = q->max_hw_sectors = max_sectors;
+       if (BLK_DEF_MAX_SECTORS > max_sectors)
+               q->max_hw_sectors = q->max_sectors = max_sectors;
+       else {
+               q->max_sectors = BLK_DEF_MAX_SECTORS;
+               q->max_hw_sectors = max_sectors;
+       }
 }
 
 EXPORT_SYMBOL(blk_queue_max_sectors);
@@ -657,8 +662,8 @@ EXPORT_SYMBOL(blk_queue_hardsect_size);
 void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b)
 {
        /* zero is "infinity" */
-       t->max_sectors = t->max_hw_sectors =
-               min_not_zero(t->max_sectors,b->max_sectors);
+       t->max_sectors = min_not_zero(t->max_sectors,b->max_sectors);
+       t->max_hw_sectors = min_not_zero(t->max_hw_sectors,b->max_hw_sectors);
 
        t->max_phys_segments = min(t->max_phys_segments,b->max_phys_segments);
        t->max_hw_segments = min(t->max_hw_segments,b->max_hw_segments);
@@ -1293,9 +1298,15 @@ static inline int ll_new_hw_segment(request_queue_t *q,
 static int ll_back_merge_fn(request_queue_t *q, struct request *req, 
                            struct bio *bio)
 {
+       unsigned short max_sectors;
        int len;
 
-       if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) {
+       if (unlikely(blk_pc_request(req)))
+               max_sectors = q->max_hw_sectors;
+       else
+               max_sectors = q->max_sectors;
+
+       if (req->nr_sectors + bio_sectors(bio) > max_sectors) {
                req->flags |= REQ_NOMERGE;
                if (req == q->last_merge)
                        q->last_merge = NULL;
@@ -1325,9 +1336,16 @@ static int ll_back_merge_fn(request_queue_t *q, struct request *req,
 static int ll_front_merge_fn(request_queue_t *q, struct request *req, 
                             struct bio *bio)
 {
+       unsigned short max_sectors;
        int len;
 
-       if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) {
+       if (unlikely(blk_pc_request(req)))
+               max_sectors = q->max_hw_sectors;
+       else
+               max_sectors = q->max_sectors;
+
+
+       if (req->nr_sectors + bio_sectors(bio) > max_sectors) {
                req->flags |= REQ_NOMERGE;
                if (req == q->last_merge)
                        q->last_merge = NULL;
@@ -2144,7 +2162,7 @@ int blk_rq_map_user(request_queue_t *q, struct request *rq, void __user *ubuf,
        struct bio *bio;
        int reading;
 
-       if (len > (q->max_sectors << 9))
+       if (len > (q->max_hw_sectors << 9))
                return -EINVAL;
        if (!len || !ubuf)
                return -EINVAL;
@@ -2259,7 +2277,7 @@ int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf,
 {
        struct bio *bio;
 
-       if (len > (q->max_sectors << 9))
+       if (len > (q->max_hw_sectors << 9))
                return -EINVAL;
        if (!len || !kbuf)
                return -EINVAL;
@@ -2306,6 +2324,8 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk,
        generic_unplug_device(q);
 }
 
+EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
+
 /**
  * blk_execute_rq - insert a request into queue for execution
  * @q:         queue to insert the request in
@@ -2444,7 +2464,7 @@ void disk_round_stats(struct gendisk *disk)
 /*
  * queue lock must be held
  */
-static void __blk_put_request(request_queue_t *q, struct request *req)
+void __blk_put_request(request_queue_t *q, struct request *req)
 {
        struct request_list *rl = req->rl;
 
@@ -2473,6 +2493,8 @@ static void __blk_put_request(request_queue_t *q, struct request *req)
        }
 }
 
+EXPORT_SYMBOL_GPL(__blk_put_request);
+
 void blk_put_request(struct request *req)
 {
        unsigned long flags;
index 6e7db2e79f427833bb1ca06086d7ed1c81c40dfb..1d8852f7bbff077d14209b850b6d64e35186f81c 100644 (file)
@@ -233,7 +233,7 @@ static int sg_io(struct file *file, request_queue_t *q,
        if (verify_command(file, cmd))
                return -EPERM;
 
-       if (hdr->dxfer_len > (q->max_sectors << 9))
+       if (hdr->dxfer_len > (q->max_hw_sectors << 9))
                return -EIO;
 
        if (hdr->dxfer_len)
index 7b1cd93892be4e271d5f94ef60982607020efa76..c4b9d2adfc08bce861a9078945c4e0acf63628a4 100644 (file)
@@ -358,7 +358,8 @@ config BLK_DEV_UB
          This driver supports certain USB attached storage devices
          such as flash keys.
 
-         Warning: Enabling this cripples the usb-storage driver.
+         If you enable this driver, it is recommended to avoid conflicts
+         with usb-storage by enabling USB_LIBUSUAL.
 
          If unsure, say N.
 
index bfb23d543ff7a71d1bba7b22de0ba5a5157cfaaf..10740a065088d73218b2306f2cd6acd6ff6a21b8 100644 (file)
@@ -9,7 +9,6 @@
  *
  * TODO (sorted by decreasing priority)
  *  -- Kill first_open (Al Viro fixed the block layer now)
- *  -- Do resets with usb_device_reset (needs a thread context, use khubd)
  *  -- set readonly flag for CDs, set removable flag for CF readers
  *  -- do inquiry and verify we got a disk and not a tape (for LUN mismatch)
  *  -- special case some senses, e.g. 3a/0 -> no media present, reduce retries
@@ -29,6 +28,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <linux/usb_usual.h>
 #include <linux/blkdev.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/timer.h>
  *                                                                   +--------+
  */
 
-/*
- * Definitions which have to be scattered once we understand the layout better.
- */
-
-/* Transport (despite PR in the name) */
-#define US_PR_BULK     0x50            /* bulk only */
-
-/* Protocol */
-#define US_SC_SCSI     0x06            /* Transparent */
-
 /*
  * This many LUNs per USB device.
  * Every one of them takes a host, see UB_MAX_HOSTS.
 /*
  */
 
-#define UB_MINORS_PER_MAJOR    8
+#define UB_PARTS_PER_LUN      8
 
 #define UB_MAX_CDB_SIZE      16                /* Corresponds to Bulk */
 
@@ -245,6 +235,13 @@ struct ub_scsi_cmd {
        void *back;
 };
 
+struct ub_request {
+       struct request *rq;
+       unsigned int current_try;
+       unsigned int nsg;               /* sgv[nsg] */
+       struct scatterlist sgv[UB_MAX_REQ_SG];
+};
+
 /*
  */
 struct ub_capacity {
@@ -340,6 +337,8 @@ struct ub_lun {
        int readonly;
        int first_open;                 /* Kludge. See ub_bd_open. */
 
+       struct ub_request urq;
+
        /* Use Ingo's mempool if or when we have more than one command. */
        /*
         * Currently we never need more than one command for the whole device.
@@ -360,6 +359,7 @@ struct ub_dev {
        atomic_t poison;                /* The USB device is disconnected */
        int openc;                      /* protected by ub_lock! */
                                        /* kref is too implicit for our taste */
+       int reset;                      /* Reset is running */
        unsigned int tagcnt;
        char name[12];
        struct usb_device *dev;
@@ -387,6 +387,9 @@ struct ub_dev {
        struct bulk_cs_wrap work_bcs;
        struct usb_ctrlrequest work_cr;
 
+       struct work_struct reset_work;
+       wait_queue_head_t reset_wait;
+
        int sg_stat[6];
        struct ub_scsi_trace tr;
 };
@@ -395,12 +398,14 @@ struct ub_dev {
  */
 static void ub_cleanup(struct ub_dev *sc);
 static int ub_request_fn_1(struct ub_lun *lun, struct request *rq);
-static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
-    struct ub_scsi_cmd *cmd, struct request *rq);
-static int ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
-    struct ub_scsi_cmd *cmd, struct request *rq);
+static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_scsi_cmd *cmd, struct ub_request *urq);
+static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_scsi_cmd *cmd, struct ub_request *urq);
 static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
 static void ub_end_rq(struct request *rq, int uptodate);
+static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_request *urq, struct ub_scsi_cmd *cmd);
 static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
 static void ub_urb_complete(struct urb *urb, struct pt_regs *pt);
 static void ub_scsi_action(unsigned long _dev);
@@ -415,6 +420,8 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
 static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd,
     int stalled_pipe);
 static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd);
+static void ub_reset_enter(struct ub_dev *sc);
+static void ub_reset_task(void *arg);
 static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun);
 static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
     struct ub_capacity *ret);
@@ -422,13 +429,18 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum);
 
 /*
  */
+#ifdef CONFIG_USB_LIBUSUAL
+
+#define ub_usb_ids  storage_usb_ids
+#else
+
 static struct usb_device_id ub_usb_ids[] = {
-       // { USB_DEVICE_VER(0x0781, 0x0002, 0x0009, 0x0009) },  /* SDDR-31 */
        { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) },
        { }
 };
 
 MODULE_DEVICE_TABLE(usb, ub_usb_ids);
+#endif /* CONFIG_USB_LIBUSUAL */
 
 /*
  * Find me a way to identify "next free minor" for add_disk(),
@@ -521,6 +533,9 @@ static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr,
        cnt = 0;
        spin_lock_irqsave(&sc->lock, flags);
 
+       cnt += sprintf(page + cnt,
+           "poison %d reset %d\n",
+           atomic_read(&sc->poison), sc->reset);
        cnt += sprintf(page + cnt,
            "qlen %d qmax %d\n",
            sc->cmd_queue.qlen, sc->cmd_queue.qmax);
@@ -770,7 +785,8 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
 {
        struct ub_dev *sc = lun->udev;
        struct ub_scsi_cmd *cmd;
-       int rc;
+       struct ub_request *urq;
+       int n_elem;
 
        if (atomic_read(&sc->poison) || lun->changed) {
                blkdev_dequeue_request(rq);
@@ -778,65 +794,70 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
                return 0;
        }
 
+       if (lun->urq.rq != NULL)
+               return -1;
        if ((cmd = ub_get_cmd(lun)) == NULL)
                return -1;
        memset(cmd, 0, sizeof(struct ub_scsi_cmd));
 
        blkdev_dequeue_request(rq);
+
+       urq = &lun->urq;
+       memset(urq, 0, sizeof(struct ub_request));
+       urq->rq = rq;
+
+       /*
+        * get scatterlist from block layer
+        */
+       n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]);
+       if (n_elem < 0) {
+               printk(KERN_INFO "%s: failed request map (%d)\n",
+                   lun->name, n_elem); /* P3 */
+               goto drop;
+       }
+       if (n_elem > UB_MAX_REQ_SG) {   /* Paranoia */
+               printk(KERN_WARNING "%s: request with %d segments\n",
+                   lun->name, n_elem);
+               goto drop;
+       }
+       urq->nsg = n_elem;
+       sc->sg_stat[n_elem < 5 ? n_elem : 5]++;
+
        if (blk_pc_request(rq)) {
-               rc = ub_cmd_build_packet(sc, lun, cmd, rq);
+               ub_cmd_build_packet(sc, lun, cmd, urq);
        } else {
-               rc = ub_cmd_build_block(sc, lun, cmd, rq);
-       }
-       if (rc != 0) {
-               ub_put_cmd(lun, cmd);
-               ub_end_rq(rq, 0);
-               return 0;
+               ub_cmd_build_block(sc, lun, cmd, urq);
        }
        cmd->state = UB_CMDST_INIT;
        cmd->lun = lun;
        cmd->done = ub_rw_cmd_done;
-       cmd->back = rq;
+       cmd->back = urq;
 
        cmd->tag = sc->tagcnt++;
-       if (ub_submit_scsi(sc, cmd) != 0) {
-               ub_put_cmd(lun, cmd);
-               ub_end_rq(rq, 0);
-               return 0;
-       }
+       if (ub_submit_scsi(sc, cmd) != 0)
+               goto drop;
 
        return 0;
+
+drop:
+       ub_put_cmd(lun, cmd);
+       ub_end_rq(rq, 0);
+       return 0;
 }
 
-static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
-    struct ub_scsi_cmd *cmd, struct request *rq)
+static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_scsi_cmd *cmd, struct ub_request *urq)
 {
-       int ub_dir;
-       int n_elem;
+       struct request *rq = urq->rq;
        unsigned int block, nblks;
 
        if (rq_data_dir(rq) == WRITE)
-               ub_dir = UB_DIR_WRITE;
+               cmd->dir = UB_DIR_WRITE;
        else
-               ub_dir = UB_DIR_READ;
-       cmd->dir = ub_dir;
+               cmd->dir = UB_DIR_READ;
 
-       /*
-        * get scatterlist from block layer
-        */
-       n_elem = blk_rq_map_sg(lun->disk->queue, rq, &cmd->sgv[0]);
-       if (n_elem <= 0) {
-               printk(KERN_INFO "%s: failed request map (%d)\n",
-                   sc->name, n_elem); /* P3 */
-               return -1;              /* request with no s/g entries? */
-       }
-       if (n_elem > UB_MAX_REQ_SG) {   /* Paranoia */
-               printk(KERN_WARNING "%s: request with %d segments\n",
-                   sc->name, n_elem);
-               return -1;
-       }
-       cmd->nsg = n_elem;
-       sc->sg_stat[n_elem < 5 ? n_elem : 5]++;
+       cmd->nsg = urq->nsg;
+       memcpy(cmd->sgv, urq->sgv, sizeof(struct scatterlist) * cmd->nsg);
 
        /*
         * build the command
@@ -847,7 +868,7 @@ static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
        block = rq->sector >> lun->capacity.bshift;
        nblks = rq->nr_sectors >> lun->capacity.bshift;
 
-       cmd->cdb[0] = (ub_dir == UB_DIR_READ)? READ_10: WRITE_10;
+       cmd->cdb[0] = (cmd->dir == UB_DIR_READ)? READ_10: WRITE_10;
        /* 10-byte uses 4 bytes of LBA: 2147483648KB, 2097152MB, 2048GB */
        cmd->cdb[2] = block >> 24;
        cmd->cdb[3] = block >> 16;
@@ -858,14 +879,12 @@ static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
        cmd->cdb_len = 10;
 
        cmd->len = rq->nr_sectors * 512;
-
-       return 0;
 }
 
-static int ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
-    struct ub_scsi_cmd *cmd, struct request *rq)
+static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_scsi_cmd *cmd, struct ub_request *urq)
 {
-       int n_elem;
+       struct request *rq = urq->rq;
 
        if (rq->data_len == 0) {
                cmd->dir = UB_DIR_NONE;
@@ -874,40 +893,26 @@ static int ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
                        cmd->dir = UB_DIR_WRITE;
                else
                        cmd->dir = UB_DIR_READ;
-
        }
 
-       /*
-        * get scatterlist from block layer
-        */
-       n_elem = blk_rq_map_sg(lun->disk->queue, rq, &cmd->sgv[0]);
-       if (n_elem < 0) {
-               printk(KERN_INFO "%s: failed request map (%d)\n",
-                   sc->name, n_elem); /* P3 */
-               return -1;
-       }
-       if (n_elem > UB_MAX_REQ_SG) {   /* Paranoia */
-               printk(KERN_WARNING "%s: request with %d segments\n",
-                   sc->name, n_elem);
-               return -1;
-       }
-       cmd->nsg = n_elem;
-       sc->sg_stat[n_elem < 5 ? n_elem : 5]++;
+       cmd->nsg = urq->nsg;
+       memcpy(cmd->sgv, urq->sgv, sizeof(struct scatterlist) * cmd->nsg);
 
        memcpy(&cmd->cdb, rq->cmd, rq->cmd_len);
        cmd->cdb_len = rq->cmd_len;
 
        cmd->len = rq->data_len;
-
-       return 0;
 }
 
 static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 {
-       struct request *rq = cmd->back;
        struct ub_lun *lun = cmd->lun;
+       struct ub_request *urq = cmd->back;
+       struct request *rq;
        int uptodate;
 
+       rq = urq->rq;
+
        if (cmd->error == 0) {
                uptodate = 1;
 
@@ -928,9 +933,16 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                                rq->errors = SAM_STAT_CHECK_CONDITION;
                        else
                                rq->errors = DID_ERROR << 16;
+               } else {
+                       if (cmd->error == -EIO) {
+                               if (ub_rw_cmd_retry(sc, lun, urq, cmd) == 0)
+                                       return;
+                       }
                }
        }
 
+       urq->rq = NULL;
+
        ub_put_cmd(lun, cmd);
        ub_end_rq(rq, uptodate);
        blk_start_queue(lun->disk->queue);
@@ -938,13 +950,45 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 
 static void ub_end_rq(struct request *rq, int uptodate)
 {
-       int rc;
-
-       rc = end_that_request_first(rq, uptodate, rq->hard_nr_sectors);
-       // assert(rc == 0);
+       end_that_request_first(rq, uptodate, rq->hard_nr_sectors);
        end_that_request_last(rq);
 }
 
+static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
+    struct ub_request *urq, struct ub_scsi_cmd *cmd)
+{
+
+       if (atomic_read(&sc->poison))
+               return -ENXIO;
+
+       ub_reset_enter(sc);
+
+       if (urq->current_try >= 3)
+               return -EIO;
+       urq->current_try++;
+       /* P3 */ printk("%s: dir %c len/act %d/%d "
+           "[sense %x %02x %02x] retry %d\n",
+           sc->name, UB_DIR_CHAR(cmd->dir), cmd->len, cmd->act_len,
+           cmd->key, cmd->asc, cmd->ascq, urq->current_try);
+
+       memset(cmd, 0, sizeof(struct ub_scsi_cmd));
+       ub_cmd_build_block(sc, lun, cmd, urq);
+
+       cmd->state = UB_CMDST_INIT;
+       cmd->lun = lun;
+       cmd->done = ub_rw_cmd_done;
+       cmd->back = urq;
+
+       cmd->tag = sc->tagcnt++;
+
+#if 0 /* Wasteful */
+       return ub_submit_scsi(sc, cmd);
+#else
+       ub_cmdq_add(sc, cmd);
+       return 0;
+#endif
+}
+
 /*
  * Submit a regular SCSI operation (not an auto-sense).
  *
@@ -1075,7 +1119,7 @@ static void ub_scsi_dispatch(struct ub_dev *sc)
        struct ub_scsi_cmd *cmd;
        int rc;
 
-       while ((cmd = ub_cmdq_peek(sc)) != NULL) {
+       while (!sc->reset && (cmd = ub_cmdq_peek(sc)) != NULL) {
                if (cmd->state == UB_CMDST_DONE) {
                        ub_cmdq_pop(sc);
                        (*cmd->done)(sc, cmd);
@@ -1098,11 +1142,12 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 {
        struct urb *urb = &sc->work_urb;
        struct bulk_cs_wrap *bcs;
+       int len;
        int rc;
 
        if (atomic_read(&sc->poison)) {
-               /* A little too simplistic, I feel... */
-               goto Bad_End;
+               ub_state_done(sc, cmd, -ENODEV);
+               return;
        }
 
        if (cmd->state == UB_CMDST_CLEAR) {
@@ -1110,7 +1155,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        /*
                         * STALL while clearning STALL.
                         * The control pipe clears itself - nothing to do.
-                        * XXX Might try to reset the device here and retry.
                         */
                        printk(KERN_NOTICE "%s: stall on control pipe\n",
                            sc->name);
@@ -1129,11 +1173,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 
        } else if (cmd->state == UB_CMDST_CLR2STS) {
                if (urb->status == -EPIPE) {
-                       /*
-                        * STALL while clearning STALL.
-                        * The control pipe clears itself - nothing to do.
-                        * XXX Might try to reset the device here and retry.
-                        */
                        printk(KERN_NOTICE "%s: stall on control pipe\n",
                            sc->name);
                        goto Bad_End;
@@ -1151,11 +1190,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 
        } else if (cmd->state == UB_CMDST_CLRRS) {
                if (urb->status == -EPIPE) {
-                       /*
-                        * STALL while clearning STALL.
-                        * The control pipe clears itself - nothing to do.
-                        * XXX Might try to reset the device here and retry.
-                        */
                        printk(KERN_NOTICE "%s: stall on control pipe\n",
                            sc->name);
                        goto Bad_End;
@@ -1172,7 +1206,12 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                ub_state_stat_counted(sc, cmd);
 
        } else if (cmd->state == UB_CMDST_CMD) {
-               if (urb->status == -EPIPE) {
+               switch (urb->status) {
+               case 0:
+                       break;
+               case -EOVERFLOW:
+                       goto Bad_End;
+               case -EPIPE:
                        rc = ub_submit_clear_stall(sc, cmd, sc->last_pipe);
                        if (rc != 0) {
                                printk(KERN_NOTICE "%s: "
@@ -1182,17 +1221,20 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                                 * This is typically ENOMEM or some other such shit.
                                 * Retrying is pointless. Just do Bad End on it...
                                 */
-                               goto Bad_End;
+                               ub_state_done(sc, cmd, rc);
+                               return;
                        }
                        cmd->state = UB_CMDST_CLEAR;
                        ub_cmdtr_state(sc, cmd);
                        return;
-               }
-               if (urb->status != 0) {
+               case -ESHUTDOWN:        /* unplug */
+               case -EILSEQ:           /* unplug timeout on uhci */
+                       ub_state_done(sc, cmd, -ENODEV);
+                       return;
+               default:
                        goto Bad_End;
                }
                if (urb->actual_length != US_BULK_CB_WRAP_LEN) {
-                       /* XXX Must do reset here to unconfuse the device */
                        goto Bad_End;
                }
 
@@ -1211,11 +1253,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                                printk(KERN_NOTICE "%s: "
                                    "unable to submit clear (%d)\n",
                                    sc->name, rc);
-                               /*
-                                * This is typically ENOMEM or some other such shit.
-                                * Retrying is pointless. Just do Bad End on it...
-                                */
-                               goto Bad_End;
+                               ub_state_done(sc, cmd, rc);
+                               return;
                        }
                        cmd->state = UB_CMDST_CLR2STS;
                        ub_cmdtr_state(sc, cmd);
@@ -1224,14 +1263,50 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                if (urb->status == -EOVERFLOW) {
                        /*
                         * A babble? Failure, but we must transfer CSW now.
-                        * XXX This is going to end in perpetual babble. Reset.
                         */
                        cmd->error = -EOVERFLOW;        /* A cheap trick... */
                        ub_state_stat(sc, cmd);
                        return;
                }
-               if (urb->status != 0)
-                       goto Bad_End;
+
+               if (cmd->dir == UB_DIR_WRITE) {
+                       /*
+                        * Do not continue writes in case of a failure.
+                        * Doing so would cause sectors to be mixed up,
+                        * which is worse than sectors lost.
+                        *
+                        * We must try to read the CSW, or many devices
+                        * get confused.
+                        */
+                       len = urb->actual_length;
+                       if (urb->status != 0 ||
+                           len != cmd->sgv[cmd->current_sg].length) {
+                               cmd->act_len += len;
+                               ub_cmdtr_act_len(sc, cmd);
+
+                               cmd->error = -EIO;
+                               ub_state_stat(sc, cmd);
+                               return;
+                       }
+
+               } else {
+                       /*
+                        * If an error occurs on read, we record it, and
+                        * continue to fetch data in order to avoid bubble.
+                        *
+                        * As a small shortcut, we stop if we detect that
+                        * a CSW mixed into data.
+                        */
+                       if (urb->status != 0)
+                               cmd->error = -EIO;
+
+                       len = urb->actual_length;
+                       if (urb->status != 0 ||
+                           len != cmd->sgv[cmd->current_sg].length) {
+                               if ((len & 0x1FF) == US_BULK_CS_WRAP_LEN)
+                                       goto Bad_End;
+                       }
+               }
 
                cmd->act_len += urb->actual_length;
                ub_cmdtr_act_len(sc, cmd);
@@ -1249,11 +1324,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                                printk(KERN_NOTICE "%s: "
                                    "unable to submit clear (%d)\n",
                                    sc->name, rc);
-                               /*
-                                * This is typically ENOMEM or some other such shit.
-                                * Retrying is pointless. Just do Bad End on it...
-                                */
-                               goto Bad_End;
+                               ub_state_done(sc, cmd, rc);
+                               return;
                        }
 
                        /*
@@ -1266,14 +1338,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        ub_cmdtr_state(sc, cmd);
                        return;
                }
-               if (urb->status == -EOVERFLOW) {
-                       /*
-                        * XXX We are screwed here. Retrying is pointless,
-                        * because the pipelined data will not get in until
-                        * we read with a big enough buffer. We must reset XXX.
-                        */
-                       goto Bad_End;
-               }
+
+               /* Catch everything, including -EOVERFLOW and other nasties. */
                if (urb->status != 0)
                        goto Bad_End;
 
@@ -1319,15 +1385,15 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        return;
                }
 
-               rc = le32_to_cpu(bcs->Residue);
-               if (rc != cmd->len - cmd->act_len) {
+               len = le32_to_cpu(bcs->Residue);
+               if (len != cmd->len - cmd->act_len) {
                        /*
                         * It is all right to transfer less, the caller has
                         * to check. But it's not all right if the device
                         * counts disagree with our counts.
                         */
                        /* P3 */ printk("%s: resid %d len %d act %d\n",
-                           sc->name, rc, cmd->len, cmd->act_len);
+                           sc->name, len, cmd->len, cmd->act_len);
                        goto Bad_End;
                }
 
@@ -1338,13 +1404,13 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        ub_state_sense(sc, cmd);
                        return;
                case US_BULK_STAT_PHASE:
-                       /* XXX We must reset the transport here */
                        /* P3 */ printk("%s: status PHASE\n", sc->name);
                        goto Bad_End;
                default:
                        printk(KERN_INFO "%s: unknown CSW status 0x%x\n",
                            sc->name, bcs->Status);
-                       goto Bad_End;
+                       ub_state_done(sc, cmd, -EINVAL);
+                       return;
                }
 
                /* Not zeroing error to preserve a babble indicator */
@@ -1364,7 +1430,8 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                printk(KERN_WARNING "%s: "
                    "wrong command state %d\n",
                    sc->name, cmd->state);
-               goto Bad_End;
+               ub_state_done(sc, cmd, -EINVAL);
+               return;
        }
        return;
 
@@ -1611,6 +1678,93 @@ static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd)
        ub_scsi_urb_compl(sc, cmd);
 }
 
+/*
+ * Reset management
+ */
+
+static void ub_reset_enter(struct ub_dev *sc)
+{
+
+       if (sc->reset) {
+               /* This happens often on multi-LUN devices. */
+               return;
+       }
+       sc->reset = 1;
+
+#if 0 /* Not needed because the disconnect waits for us. */
+       unsigned long flags;
+       spin_lock_irqsave(&ub_lock, flags);
+       sc->openc++;
+       spin_unlock_irqrestore(&ub_lock, flags);
+#endif
+
+#if 0 /* We let them stop themselves. */
+       struct list_head *p;
+       struct ub_lun *lun;
+       list_for_each(p, &sc->luns) {
+               lun = list_entry(p, struct ub_lun, link);
+               blk_stop_queue(lun->disk->queue);
+       }
+#endif
+
+       schedule_work(&sc->reset_work);
+}
+
+static void ub_reset_task(void *arg)
+{
+       struct ub_dev *sc = arg;
+       unsigned long flags;
+       struct list_head *p;
+       struct ub_lun *lun;
+       int lkr, rc;
+
+       if (!sc->reset) {
+               printk(KERN_WARNING "%s: Running reset unrequested\n",
+                   sc->name);
+               return;
+       }
+
+       if (atomic_read(&sc->poison)) {
+               printk(KERN_NOTICE "%s: Not resetting disconnected device\n",
+                   sc->name); /* P3 This floods. Remove soon. XXX */
+       } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) {
+               printk(KERN_NOTICE "%s: Not resetting multi-interface device\n",
+                   sc->name); /* P3 This floods. Remove soon. XXX */
+       } else {
+               if ((lkr = usb_lock_device_for_reset(sc->dev, sc->intf)) < 0) {
+                       printk(KERN_NOTICE
+                           "%s: usb_lock_device_for_reset failed (%d)\n",
+                           sc->name, lkr);
+               } else {
+                       rc = usb_reset_device(sc->dev);
+                       if (rc < 0) {
+                               printk(KERN_NOTICE "%s: "
+                                   "usb_lock_device_for_reset failed (%d)\n",
+                                   sc->name, rc);
+                       }
+
+                       if (lkr)
+                               usb_unlock_device(sc->dev);
+               }
+       }
+
+       /*
+        * In theory, no commands can be running while reset is active,
+        * so nobody can ask for another reset, and so we do not need any
+        * queues of resets or anything. We do need a spinlock though,
+        * to interact with block layer.
+        */
+       spin_lock_irqsave(&sc->lock, flags);
+       sc->reset = 0;
+       tasklet_schedule(&sc->tasklet);
+       list_for_each(p, &sc->luns) {
+               lun = list_entry(p, struct ub_lun, link);
+               blk_start_queue(lun->disk->queue);
+       }
+       wake_up(&sc->reset_wait);
+       spin_unlock_irqrestore(&sc->lock, flags);
+}
+
 /*
  * This is called from a process context.
  */
@@ -2146,7 +2300,7 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
        if (ep_in == NULL || ep_out == NULL) {
                printk(KERN_NOTICE "%s: failed endpoint check\n",
                    sc->name);
-               return -EIO;
+               return -ENODEV;
        }
 
        /* Calculate and store the pipe values */
@@ -2172,6 +2326,9 @@ static int ub_probe(struct usb_interface *intf,
        int rc;
        int i;
 
+       if (usb_usual_check_type(dev_id, USB_US_TYPE_UB))
+               return -ENXIO;
+
        rc = -ENOMEM;
        if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL)
                goto err_core;
@@ -2181,6 +2338,8 @@ static int ub_probe(struct usb_interface *intf,
        usb_init_urb(&sc->work_urb);
        tasklet_init(&sc->tasklet, ub_scsi_action, (unsigned long)sc);
        atomic_set(&sc->poison, 0);
+       INIT_WORK(&sc->reset_work, ub_reset_task, sc);
+       init_waitqueue_head(&sc->reset_wait);
 
        init_timer(&sc->work_timer);
        sc->work_timer.data = (unsigned long) sc;
@@ -2201,7 +2360,8 @@ static int ub_probe(struct usb_interface *intf,
 
        /* XXX Verify that we can handle the device (from descriptors) */
 
-       ub_get_pipes(sc, sc->dev, intf);
+       if (ub_get_pipes(sc, sc->dev, intf) != 0)
+               goto err_dev_desc;
 
        if (device_create_file(&sc->intf->dev, &dev_attr_diag) != 0)
                goto err_diag;
@@ -2272,6 +2432,7 @@ static int ub_probe(struct usb_interface *intf,
 
        /* device_remove_file(&sc->intf->dev, &dev_attr_diag); */
 err_diag:
+err_dev_desc:
        usb_set_intfdata(intf, NULL);
        // usb_put_intf(sc->intf);
        usb_put_dev(sc->dev);
@@ -2309,14 +2470,14 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
        ub_revalidate(sc, lun);
 
        rc = -ENOMEM;
-       if ((disk = alloc_disk(UB_MINORS_PER_MAJOR)) == NULL)
+       if ((disk = alloc_disk(UB_PARTS_PER_LUN)) == NULL)
                goto err_diskalloc;
 
        lun->disk = disk;
        sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a');
        sprintf(disk->devfs_name, DEVFS_NAME "/%c", lun->id + 'a');
        disk->major = UB_MAJOR;
-       disk->first_minor = lun->id * UB_MINORS_PER_MAJOR;
+       disk->first_minor = lun->id * UB_PARTS_PER_LUN;
        disk->fops = &ub_bd_fops;
        disk->private_data = lun;
        disk->driverfs_dev = &sc->intf->dev;
@@ -2379,6 +2540,11 @@ static void ub_disconnect(struct usb_interface *intf)
         */
        atomic_set(&sc->poison, 1);
 
+       /*
+        * Wait for reset to end, if any.
+        */
+       wait_event(sc->reset_wait, !sc->reset);
+
        /*
         * Blow away queued commands.
         *
@@ -2392,7 +2558,7 @@ static void ub_disconnect(struct usb_interface *intf)
        {
                struct ub_scsi_cmd *cmd;
                int cnt = 0;
-               while ((cmd = ub_cmdq_pop(sc)) != NULL) {
+               while ((cmd = ub_cmdq_peek(sc)) != NULL) {
                        cmd->error = -ENOTCONN;
                        cmd->state = UB_CMDST_DONE;
                        ub_cmdtr_state(sc, cmd);
@@ -2461,7 +2627,6 @@ static void ub_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver ub_driver = {
-       .owner =        THIS_MODULE,
        .name =         "ub",
        .probe =        ub_probe,
        .disconnect =   ub_disconnect,
@@ -2479,6 +2644,7 @@ static int __init ub_init(void)
        if ((rc = usb_register(&ub_driver)) != 0)
                goto err_register;
 
+       usb_usual_set_present(USB_US_TYPE_UB);
        return 0;
 
 err_register:
@@ -2494,6 +2660,7 @@ static void __exit ub_exit(void)
 
        devfs_remove(DEVFS_NAME);
        unregister_blkdev(UB_MAJOR, DRV_NAME);
+       usb_usual_clear_present(USB_US_TYPE_UB);
 }
 
 module_init(ub_init);
index 8e7fb355177528fe544d32a990d5d7849ed85fda..3e7a067cc0871dafce5f0427f2690c383983a2c3 100644 (file)
@@ -275,7 +275,6 @@ static void bcm203x_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver bcm203x_driver = {
-       .owner          = THIS_MODULE,
        .name           = "bcm203x",
        .probe          = bcm203x_probe,
        .disconnect     = bcm203x_disconnect,
index 067e27893e4a8e4d5b1cbcc1692edd26d0034228..8947c8837dacf8bc64ebf202e87f1da87b58e730 100644 (file)
@@ -768,7 +768,6 @@ static void bfusb_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver bfusb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "bfusb",
        .probe          = bfusb_probe,
        .disconnect     = bfusb_disconnect,
index 394796315adcb18decd1ca61d13b62e1aae4ffe6..9446960ac742914f3c912eb15a2870bb4dc42432 100644 (file)
@@ -619,7 +619,6 @@ static void bpa10x_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver bpa10x_driver = {
-       .owner          = THIS_MODULE,
        .name           = "bpa10x",
        .probe          = bpa10x_probe,
        .disconnect     = bpa10x_disconnect,
index 057cb2b6e6d1f537723051c122eca2d59fec0c82..92382e8232855188a1f588a739c5c98a03b055ef 100644 (file)
@@ -1044,7 +1044,6 @@ static void hci_usb_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver hci_usb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "hci_usb",
        .probe          = hci_usb_probe,
        .disconnect     = hci_usb_disconnect,
index e9b87a78622ce2be0771a68cda679b7861c35ea4..00342a677c90c473bb670c5e026d8c1aaa6f187c 100644 (file)
@@ -358,7 +358,7 @@ typedef struct _failStat
 #define MB_OUT_STRIPPED    0x40  // Board has read all output from fifo 
 #define MB_FATAL_ERROR     0x20  // Board has encountered a fatal error
 
-#pragma pack(4)                  // Reset padding to command-line default
+#pragma pack()                  // Reset padding to command-line default
 
 #endif      // I2PACK_H
 
index 7999da25fe40afb035c4342cd1f227f0b4d21078..bdfdfd28594d17d648b5346c273217c097974dff 100644 (file)
@@ -1554,10 +1554,8 @@ __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
 
 EXPORT_SYMBOL(secure_tcp_sequence_number);
 
-
-
-/* Generate secure starting point for ephemeral TCP port search */
-u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
+/* Generate secure starting point for ephemeral IPV4 transport port search */
+u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
 {
        struct keydata *keyptr = get_keyptr();
        u32 hash[4];
@@ -1575,7 +1573,7 @@ u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
 }
 
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport)
+u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport)
 {
        struct keydata *keyptr = get_keyptr();
        u32 hash[12];
@@ -1586,7 +1584,7 @@ u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dp
 
        return twothirdsMD4Transform(daddr, hash);
 }
-EXPORT_SYMBOL(secure_tcpv6_port_ephemeral);
+EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
 #endif
 
 #if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
index 092e9b133750f67f56d803df1ce06039ab6c78cf..1533f56baa42f8304e889b280994510c380cabec 100644 (file)
@@ -151,7 +151,6 @@ static void usb_pcwd_disconnect     (struct usb_interface *interface);
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver usb_pcwd_driver = {
-       .owner =        THIS_MODULE,
        .name =         DRIVER_NAME,
        .probe =        usb_pcwd_probe,
        .disconnect =   usb_pcwd_disconnect,
index 815902c2c856bd08df4da65daaf996f78f07e419..a9163d02983af68f069887a520330e84470cc58b 100644 (file)
@@ -822,6 +822,30 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne
 }
 
 
+/** 
+ * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur
+ * @cpu: CPU number
+ *
+ * This is the last known freq, without actually getting it from the driver.
+ * Return value will be same as what is shown in scaling_cur_freq in sysfs.
+ */
+unsigned int cpufreq_quick_get(unsigned int cpu)
+{
+       struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+       unsigned int ret = 0;
+
+       if (policy) {
+               down(&policy->lock);
+               ret = policy->cur;
+               up(&policy->lock);
+               cpufreq_cpu_put(policy);
+       }
+
+       return (ret);
+}
+EXPORT_SYMBOL(cpufreq_quick_get);
+
+
 /** 
  * cpufreq_get - get the current CPU frequency (in kHz)
  * @cpu: CPU number
index 2ed5c4363b536220843d942af2e84276b9a1dbd0..39543a2bed0f43c232e724ce809f1c89d438f6e1 100644 (file)
@@ -93,7 +93,7 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu)
 {
        return  kstat_cpu(cpu).cpustat.idle +
                kstat_cpu(cpu).cpustat.iowait +
-               ( !dbs_tuners_ins.ignore_nice ? 
+               ( dbs_tuners_ins.ignore_nice ?
                  kstat_cpu(cpu).cpustat.nice :
                  0);
 }
@@ -127,7 +127,7 @@ show_one(sampling_rate, sampling_rate);
 show_one(sampling_down_factor, sampling_down_factor);
 show_one(up_threshold, up_threshold);
 show_one(down_threshold, down_threshold);
-show_one(ignore_nice, ignore_nice);
+show_one(ignore_nice_load, ignore_nice);
 show_one(freq_step, freq_step);
 
 static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 
@@ -207,7 +207,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
        return count;
 }
 
-static ssize_t store_ignore_nice(struct cpufreq_policy *policy,
+static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
                const char *buf, size_t count)
 {
        unsigned int input;
@@ -272,7 +272,7 @@ define_one_rw(sampling_rate);
 define_one_rw(sampling_down_factor);
 define_one_rw(up_threshold);
 define_one_rw(down_threshold);
-define_one_rw(ignore_nice);
+define_one_rw(ignore_nice_load);
 define_one_rw(freq_step);
 
 static struct attribute * dbs_attributes[] = {
@@ -282,7 +282,7 @@ static struct attribute * dbs_attributes[] = {
        &sampling_down_factor.attr,
        &up_threshold.attr,
        &down_threshold.attr,
-       &ignore_nice.attr,
+       &ignore_nice_load.attr,
        &freq_step.attr,
        NULL
 };
index 17741111246b9f21362710cdc1099c31cb69512d..e69fd8dd1f1cb7bf6042a878b2545a714c7df133 100644 (file)
@@ -89,7 +89,7 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu)
 {
        return  kstat_cpu(cpu).cpustat.idle +
                kstat_cpu(cpu).cpustat.iowait +
-               ( !dbs_tuners_ins.ignore_nice ? 
+               ( dbs_tuners_ins.ignore_nice ?
                  kstat_cpu(cpu).cpustat.nice :
                  0);
 }
@@ -122,7 +122,7 @@ static ssize_t show_##file_name                                             \
 show_one(sampling_rate, sampling_rate);
 show_one(sampling_down_factor, sampling_down_factor);
 show_one(up_threshold, up_threshold);
-show_one(ignore_nice, ignore_nice);
+show_one(ignore_nice_load, ignore_nice);
 
 static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 
                const char *buf, size_t count)
@@ -182,7 +182,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
        return count;
 }
 
-static ssize_t store_ignore_nice(struct cpufreq_policy *policy,
+static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
                const char *buf, size_t count)
 {
        unsigned int input;
@@ -223,7 +223,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
 define_one_rw(sampling_rate);
 define_one_rw(sampling_down_factor);
 define_one_rw(up_threshold);
-define_one_rw(ignore_nice);
+define_one_rw(ignore_nice_load);
 
 static struct attribute * dbs_attributes[] = {
        &sampling_rate_max.attr,
@@ -231,7 +231,7 @@ static struct attribute * dbs_attributes[] = {
        &sampling_rate.attr,
        &sampling_down_factor.attr,
        &up_threshold.attr,
-       &ignore_nice.attr,
+       &ignore_nice_load.attr,
        NULL
 };
 
index 475d98fa9e26645c2b76b001d08bbea0fc6d12a7..780009c7eaa651f908e78def9a8106eea752cd81 100644 (file)
@@ -47,6 +47,8 @@
 #include <linux/ip.h>
 #include <linux/in.h>
 
+#include <net/dst.h>
+
 MODULE_AUTHOR("Roland Dreier");
 MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
 MODULE_LICENSE("Dual BSD/GPL");
index ef3ee035bbc8e03f7930df570620368882be5fd3..ed0c2ead8bc16f0c215a054f0c765d4d2a440eee 100644 (file)
@@ -43,6 +43,8 @@
 #include <linux/delay.h>
 #include <linux/completion.h>
 
+#include <net/dst.h>
+
 #include "ipoib.h"
 
 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
index 64b4a308098521ee6d01cc6893a4e938759aa6a3..bc2fce60f9f8012484d8600fe9a8121065664498 100644 (file)
@@ -235,7 +235,6 @@ static struct usb_device_id iforce_usb_ids [] = {
 MODULE_DEVICE_TABLE (usb, iforce_usb_ids);
 
 struct usb_driver iforce_usb_driver = {
-       .owner =        THIS_MODULE,
        .name =         "iforce",
        .probe =        iforce_usb_probe,
        .disconnect =   iforce_usb_disconnect,
index f8457ef488260bc4e4af7db6a3cdc9c672c15b5a..ca5b4a3b683e67c1fc2d04df730302890048d195 100644 (file)
@@ -1715,7 +1715,6 @@ hfc_usb_disconnect(struct usb_interface
 /* our driver information structure */
 /************************************/
 static struct usb_driver hfc_drv = {
-       .owner = THIS_MODULE,
        .name  = "hfc_usb",
        .id_table = hfcusb_idtab,
        .probe = hfc_usb_probe,
index 8e192a3a34906ca80118f30c2b4ecff3bb6b2019..99cb0f3d59a15ff4e4a65748b9bb309858dc5d21 100644 (file)
@@ -180,7 +180,6 @@ static struct usb_device_id st5481_ids[] = {
 MODULE_DEVICE_TABLE (usb, st5481_ids);
 
 static struct usb_driver st5481_usb_driver = {
-       .owner =        THIS_MODULE,
        .name =         "st5481_usb",
        .probe =        probe_st5481,
        .disconnect =   disconnect_st5481,
index a6d3baa46f6168e7f9143191abe22ffa5e2a65c2..a6f2dc66c3db12b09606218e1595e147b20c8a57 100644 (file)
@@ -638,7 +638,7 @@ int dm_split_args(int *argc, char ***argvp, char *input)
 static void check_for_valid_limits(struct io_restrictions *rs)
 {
        if (!rs->max_sectors)
-               rs->max_sectors = MAX_SECTORS;
+               rs->max_sectors = SAFE_MAX_SECTORS;
        if (!rs->max_phys_segments)
                rs->max_phys_segments = MAX_PHYS_SEGMENTS;
        if (!rs->max_hw_segments)
index 0a78ba3737a58d85a64a7d902b30e9dfeeae4579..a6c91db40ad693b17a323a49034cf5b501f62eb0 100644 (file)
@@ -544,7 +544,6 @@ static struct usb_device_id flexcop_usb_table [] = {
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver flexcop_usb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "b2c2_flexcop_usb",
        .probe          = flexcop_usb_probe,
        .disconnect = flexcop_usb_disconnect,
index 336fc284fa523138d2bfd923146039ce8855db6a..b996fb59b7e44bfbda4b448ade43995c870984fb 100644 (file)
@@ -986,7 +986,6 @@ static const struct usb_device_id cinergyt2_table [] __devinitdata = {
 MODULE_DEVICE_TABLE(usb, cinergyt2_table);
 
 static struct usb_driver cinergyt2_driver = {
-       .owner  = THIS_MODULE,
        .name   = "cinergyT2",
        .probe  = cinergyt2_probe,
        .disconnect     = cinergyt2_disconnect,
index 8c7beffb045fd1335bdd23f2c7e6a47e0c538daa..ce44aa6bbb838da936e9c41466819a9d226d64cf 100644 (file)
@@ -144,7 +144,6 @@ static struct dvb_usb_properties a800_properties = {
 };
 
 static struct usb_driver a800_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_a800",
        .probe          = a800_probe,
        .disconnect = dvb_usb_device_exit,
index 3fe383f4bb4cea3d69a69bc191a4356c6bb0d979..d05fab01cccdb9b34093b0dfdda028b45ad27275 100644 (file)
@@ -241,7 +241,6 @@ static struct dvb_usb_properties cxusb_properties = {
 };
 
 static struct usb_driver cxusb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_cxusb",
        .probe          = cxusb_probe,
        .disconnect = dvb_usb_device_exit,
index aa271a2496d5faaa27cc25c172a4682d6443b099..52ac3e5adf5dd99de63a18821f57e258f8fcab69 100644 (file)
@@ -373,7 +373,6 @@ static struct dvb_usb_properties artec_t1_usb2_properties = {
 };
 
 static struct usb_driver dibusb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_dibusb_mb",
        .probe          = dibusb_probe,
        .disconnect = dvb_usb_device_exit,
index 6a0912eab396085cd99b30064d949362fca6b2b8..55802fba3c29ee71bc320cf056b6fa1a0c665eb7 100644 (file)
@@ -82,7 +82,6 @@ static struct dvb_usb_properties dibusb_mc_properties = {
 };
 
 static struct usb_driver dibusb_mc_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_dibusb_mc",
        .probe          = dibusb_mc_probe,
        .disconnect = dvb_usb_device_exit,
index f98e306a5759ed6d78fa927212706157ff4d2654..450417a9e64b6632fd62cc3affd346a55203da9d 100644 (file)
@@ -233,7 +233,6 @@ static struct dvb_usb_properties digitv_properties = {
 };
 
 static struct usb_driver digitv_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_digitv",
        .probe          = digitv_probe,
        .disconnect = dvb_usb_device_exit,
index b595476332cd9dba9006c6bcb94761122cc7ba97..6e2bac873445700e7d83b1e5317763b3e16263db 100644 (file)
@@ -198,7 +198,6 @@ static struct dvb_usb_properties wt220u_properties = {
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver dtt200u_usb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_dtt200u",
        .probe          = dtt200u_usb_probe,
        .disconnect = dvb_usb_device_exit,
index 1841a66427bfe550c7ef7d3646b487e24f2c01ce..fac48fc7a4aca3e2b7df0f455be0190d48eb8133 100644 (file)
@@ -202,7 +202,6 @@ static struct dvb_usb_properties nova_t_properties = {
 };
 
 static struct usb_driver nova_t_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_nova_t_usb2",
        .probe          = nova_t_probe,
        .disconnect = dvb_usb_device_exit,
index 6fd67657c2693a277567aa95cdd9fee70514b26a..14f1911c79bb29061817eec9ffb209083677896c 100644 (file)
@@ -128,7 +128,6 @@ static struct dvb_usb_properties umt_properties = {
 };
 
 static struct usb_driver umt_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_umt_010",
        .probe          = umt_probe,
        .disconnect = dvb_usb_device_exit,
index de13c04e8e64ce66b7806e7872fb85da31bfff5b..afa00fdb5ec0c3686fb3a6e1c49f6ac7ff3dfa9b 100644 (file)
@@ -256,7 +256,6 @@ static struct dvb_usb_properties vp702x_properties = {
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver vp702x_usb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb-usb-vp702x",
        .probe          = vp702x_usb_probe,
        .disconnect = dvb_usb_device_exit,
index 75765e3a569c811f2f93f5fd25983caf5437b055..3835235b68dff0f18793c0b711af42c3160ed6cd 100644 (file)
@@ -253,7 +253,6 @@ static struct dvb_usb_properties vp7045_properties = {
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver vp7045_usb_driver = {
-       .owner          = THIS_MODULE,
        .name           = "dvb_usb_vp7045",
        .probe          = vp7045_usb_probe,
        .disconnect = dvb_usb_device_exit,
index 9774e94d1e7d94ae7e8a8eb46a7e72b936680e8d..1439cb752874c23ef5fdf265c73d136f4f4ba895 100644 (file)
@@ -582,7 +582,6 @@ MODULE_LICENSE("GPL");
 
 
 static struct usb_driver cpia_driver = {
-       .owner          = THIS_MODULE,
        .name           = "cpia",
        .probe          = cpia_probe,
        .disconnect     = cpia_disconnect,
index 06d76879bde27abf1c55af5396e90167af4ae725..3a56120397aeb45791f36fe23fd14480ca64c84a 100644 (file)
@@ -1884,7 +1884,6 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
 }
 
 static struct usb_driver em28xx_usb_driver = {
-       .owner = THIS_MODULE,
        .name = "em28xx",
        .probe = em28xx_usb_probe,
        .disconnect = em28xx_usb_disconnect,
index 4262a22adc22d469a4a1e4991714443c04c03ec2..537836068c493736d1efc7a3139974d16faeacc1 100644 (file)
@@ -313,13 +313,13 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
                u32      log_info = le32_to_cpu(mr->u.reply.IOCLogInfo);
                if (ioc->bus_type == FC)
                        mpt_fc_log_info(ioc, log_info);
-               else if (ioc->bus_type == SCSI)
+               else if (ioc->bus_type == SPI)
                        mpt_sp_log_info(ioc, log_info);
                else if (ioc->bus_type == SAS)
                        mpt_sas_log_info(ioc, log_info);
        }
        if (ioc_stat & MPI_IOCSTATUS_MASK) {
-               if (ioc->bus_type == SCSI &&
+               if (ioc->bus_type == SPI &&
                    cb_idx != mpt_stm_index &&
                    cb_idx != mpt_lan_index)
                        mpt_sp_ioc_info(ioc, (u32)ioc_stat, mf);
@@ -1376,7 +1376,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        }
        else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) {
                ioc->prod_name = "LSI53C1030";
-               ioc->bus_type = SCSI;
+               ioc->bus_type = SPI;
                /* 1030 Chip Fix. Disable Split transactions
                 * for PCIX. Set MOST bits to zero if Rev < C0( = 8).
                 */
@@ -1389,7 +1389,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        }
        else if (pdev->device == MPI_MANUFACTPAGE_DEVID_1030_53C1035) {
                ioc->prod_name = "LSI53C1035";
-               ioc->bus_type = SCSI;
+               ioc->bus_type = SPI;
        }
        else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1064) {
                ioc->prod_name = "LSISAS1064";
@@ -3042,7 +3042,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
        /* Clear the internal flash bad bit - autoincrementing register,
         * so must do two writes.
         */
-       if (ioc->bus_type == SCSI) {
+       if (ioc->bus_type == SPI) {
                /*
                 * 1030 and 1035 H/W errata, workaround to access
                 * the ClearFlashBadSignatureBit
@@ -3152,7 +3152,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
        int cnt,cntdn;
 
        dinitprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
-       if (ioc->bus_type == SCSI) {
+       if (ioc->bus_type == SPI) {
                /* Always issue a Msg Unit Reset first. This will clear some
                 * SCSI bus hang conditions.
                 */
@@ -3580,7 +3580,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
        dinitprintk((KERN_INFO MYNAM ": %s Now numSGE=%d num_sge=%d num_chain=%d\n",
                ioc->name, numSGE, num_sge, num_chain));
 
-       if (ioc->bus_type == SCSI)
+       if (ioc->bus_type == SPI)
                num_chain *= MPT_SCSI_CAN_QUEUE;
        else
                num_chain *= MPT_FC_CAN_QUEUE;
index bac8eb4186d2f83cada0550f07ca319d584a2b17..6c48d1f54ac92552b4fdf42f4ebbf66c74d5eda9 100644 (file)
@@ -76,8 +76,8 @@
 #define COPYRIGHT      "Copyright (c) 1999-2005 " MODULEAUTHOR
 #endif
 
-#define MPT_LINUX_VERSION_COMMON       "3.03.04"
-#define MPT_LINUX_PACKAGE_NAME         "@(#)mptlinux-3.03.04"
+#define MPT_LINUX_VERSION_COMMON       "3.03.05"
+#define MPT_LINUX_PACKAGE_NAME         "@(#)mptlinux-3.03.05"
 #define WHAT_MAGIC_STRING              "@" "(" "#" ")"
 
 #define show_mptmod_ver(s,ver)  \
@@ -321,7 +321,7 @@ typedef struct _SYSIF_REGS
  *     Dynamic Multi-Pathing specific stuff...
  */
 
-/* VirtDevice negoFlags field */
+/* VirtTarget negoFlags field */
 #define MPT_TARGET_NO_NEGO_WIDE                0x01
 #define MPT_TARGET_NO_NEGO_SYNC                0x02
 #define MPT_TARGET_NO_NEGO_QAS         0x04
@@ -330,8 +330,7 @@ typedef struct _SYSIF_REGS
 /*
  *     VirtDevice - FC LUN device or SCSI target device
  */
-typedef struct _VirtDevice {
-       struct scsi_device      *device;
+typedef struct _VirtTarget {
        u8                       tflags;
        u8                       ioc_id;
        u8                       target_id;
@@ -342,21 +341,18 @@ typedef struct _VirtDevice {
        u8                       negoFlags;     /* bit field, see above */
        u8                       raidVolume;    /* set, if RAID Volume */
        u8                       type;          /* byte 0 of Inquiry data */
-       u8                       cflags;        /* controller flags */
-       u8                       rsvd1raid;
-       u16                      fc_phys_lun;
-       u16                      fc_xlat_lun;
        u32                      num_luns;
        u32                      luns[8];               /* Max LUNs is 256 */
-       u8                       pad[4];
        u8                       inq_data[8];
-               /* IEEE Registered Extended Identifier
-                  obtained via INQUIRY VPD page 0x83 */
-               /* NOTE: Do not separate uniq_prepad and uniq_data
-                  as they are treateed as a single entity in the code */
-       u8                       uniq_prepad[8];
-       u8                       uniq_data[20];
-       u8                       pad2[4];
+} VirtTarget;
+
+typedef struct _VirtDevice {
+       VirtTarget              *vtarget;
+       u8                       ioc_id;
+       u8                       bus_id;
+       u8                       target_id;
+       u8                       configured_lun;
+       u32                      lun;
 } VirtDevice;
 
 /*
@@ -903,7 +899,7 @@ typedef struct _MPT_LOCAL_REPLY {
 
 typedef enum {
        FC,
-       SCSI,
+       SPI,
        SAS
 } BUS_TYPE;
 
@@ -912,7 +908,7 @@ typedef struct _MPT_SCSI_HOST {
        int                       port;
        u32                       pad0;
        struct scsi_cmnd        **ScsiLookup;
-       VirtDevice              **Targets;
+       VirtTarget              **Targets;
        MPT_LOCAL_REPLY          *pLocal;               /* used for internal commands */
        struct timer_list         timer;
                /* Pool of memory for holding SCpnts before doing
index 602138f8544db665ded8957738b1dcca7208a772..959d2c5951b8beb072b4c00b0fbc34ac836c6acc 100644 (file)
@@ -1245,7 +1245,7 @@ mptctl_gettargetinfo (unsigned long arg)
        MPT_ADAPTER             *ioc;
        struct Scsi_Host        *sh;
        MPT_SCSI_HOST           *hd;
-       VirtDevice              *vdev;
+       VirtTarget              *vdev;
        char                    *pmem;
        int                     *pdata;
        IOCPage2_t              *pIoc2;
@@ -1822,7 +1822,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        case MPI_FUNCTION_SCSI_IO_REQUEST:
                if (ioc->sh) {
                        SCSIIORequest_t *pScsiReq = (SCSIIORequest_t *) mf;
-                       VirtDevice      *pTarget = NULL;
+                       VirtTarget      *pTarget = NULL;
                        MPT_SCSI_HOST   *hd = NULL;
                        int qtag = MPI_SCSIIO_CONTROL_UNTAGGED;
                        int scsidir = 0;
index a628be9bbbadd0070326e5af78f9dadfb2f6934a..ba61e18288585679d4915c9ec22abd82804496b7 100644 (file)
@@ -84,13 +84,16 @@ static int  mptfcTaskCtx = -1;
 static int     mptfcInternalCtx = -1; /* Used only for internal commands */
 
 static struct scsi_host_template mptfc_driver_template = {
+       .module                         = THIS_MODULE,
        .proc_name                      = "mptfc",
        .proc_info                      = mptscsih_proc_info,
        .name                           = "MPT FC Host",
        .info                           = mptscsih_info,
        .queuecommand                   = mptscsih_qcmd,
+       .target_alloc                   = mptscsih_target_alloc,
        .slave_alloc                    = mptscsih_slave_alloc,
        .slave_configure                = mptscsih_slave_configure,
+       .target_destroy                 = mptscsih_target_destroy,
        .slave_destroy                  = mptscsih_slave_destroy,
        .change_queue_depth             = mptscsih_change_queue_depth,
        .eh_abort_handler               = mptscsih_abort,
@@ -167,13 +170,15 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                printk(MYIOC_s_WARN_FMT
                  "Skipping because it's not operational!\n",
                  ioc->name);
-               return -ENODEV;
+               error = -ENODEV;
+               goto out_mptfc_probe;
        }
 
        if (!ioc->active) {
                printk(MYIOC_s_WARN_FMT "Skipping because it's disabled!\n",
                  ioc->name);
-               return -ENODEV;
+               error = -ENODEV;
+               goto out_mptfc_probe;
        }
 
        /*  Sanity check - ensure at least 1 port is INITIATOR capable
@@ -198,7 +203,8 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                printk(MYIOC_s_WARN_FMT
                        "Unable to register controller with SCSI subsystem\n",
                        ioc->name);
-                return -1;
+               error = -1;
+               goto out_mptfc_probe;
         }
 
        spin_lock_irqsave(&ioc->FreeQlock, flags);
@@ -266,7 +272,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        mem = kmalloc(sz, GFP_ATOMIC);
        if (mem == NULL) {
                error = -ENOMEM;
-               goto mptfc_probe_failed;
+               goto out_mptfc_probe;
        }
 
        memset(mem, 0, sz);
@@ -284,14 +290,14 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        mem = kmalloc(sz, GFP_ATOMIC);
        if (mem == NULL) {
                error = -ENOMEM;
-               goto mptfc_probe_failed;
+               goto out_mptfc_probe;
        }
 
        memset(mem, 0, sz);
-       hd->Targets = (VirtDevice **) mem;
+       hd->Targets = (VirtTarget **) mem;
 
        dprintk((KERN_INFO
-         "  Targets @ %p, sz=%d\n", hd->Targets, sz));
+         "  vdev @ %p, sz=%d\n", hd->Targets, sz));
 
        /* Clear the TM flags
         */
@@ -330,13 +336,13 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if(error) {
                dprintk((KERN_ERR MYNAM
                  "scsi_add_host failed\n"));
-               goto mptfc_probe_failed;
+               goto out_mptfc_probe;
        }
 
        scsi_scan_host(sh);
        return 0;
 
-mptfc_probe_failed:
+out_mptfc_probe:
 
        mptscsih_remove(pdev);
        return error;
index e0a8bb8ba7d8f15bfdd3214a63f035884295129b..17e9757e728be780211d1e7a0008aaa9e2724d18 100644 (file)
@@ -228,31 +228,35 @@ static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1)
  * implement ->target_alloc.
  */
 static int
-mptsas_slave_alloc(struct scsi_device *device)
+mptsas_slave_alloc(struct scsi_device *sdev)
 {
-       struct Scsi_Host        *host = device->host;
+       struct Scsi_Host        *host = sdev->host;
        MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)host->hostdata;
        struct sas_rphy         *rphy;
        struct mptsas_portinfo  *p;
+       VirtTarget              *vtarget;
        VirtDevice              *vdev;
-       uint                    target = device->id;
+       struct scsi_target      *starget;
        int i;
 
-       if ((vdev = hd->Targets[target]) != NULL)
-               goto out;
-
        vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL);
        if (!vdev) {
                printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
                                hd->ioc->name, sizeof(VirtDevice));
                return -ENOMEM;
        }
-
        memset(vdev, 0, sizeof(VirtDevice));
-       vdev->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY;
        vdev->ioc_id = hd->ioc->id;
+       sdev->hostdata = vdev;
+       starget = scsi_target(sdev);
+       vtarget = starget->hostdata;
+       vdev->vtarget = vtarget;
+       if (vtarget->num_luns == 0) {
+               vtarget->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY;
+               hd->Targets[sdev->id] = vtarget;
+       }
 
-       rphy = dev_to_rphy(device->sdev_target->dev.parent);
+       rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
        list_for_each_entry(p, &hd->ioc->sas_topology, list) {
                for (i = 0; i < p->num_phys; i++) {
                        if (p->phy_info[i].attached.sas_address ==
@@ -260,7 +264,7 @@ mptsas_slave_alloc(struct scsi_device *device)
                                vdev->target_id =
                                        p->phy_info[i].attached.target;
                                vdev->bus_id = p->phy_info[i].attached.bus;
-                               hd->Targets[device->id] = vdev;
+                               vdev->lun = sdev->lun;
                                goto out;
                        }
                }
@@ -271,19 +275,24 @@ mptsas_slave_alloc(struct scsi_device *device)
        return -ENODEV;
 
  out:
-       vdev->num_luns++;
-       device->hostdata = vdev;
+       vtarget->ioc_id = vdev->ioc_id;
+       vtarget->target_id = vdev->target_id;
+       vtarget->bus_id = vdev->bus_id;
+       vtarget->num_luns++;
        return 0;
 }
 
 static struct scsi_host_template mptsas_driver_template = {
+       .module                         = THIS_MODULE,
        .proc_name                      = "mptsas",
        .proc_info                      = mptscsih_proc_info,
        .name                           = "MPT SPI Host",
        .info                           = mptscsih_info,
        .queuecommand                   = mptscsih_qcmd,
+       .target_alloc                   = mptscsih_target_alloc,
        .slave_alloc                    = mptsas_slave_alloc,
        .slave_configure                = mptscsih_slave_configure,
+       .target_destroy                 = mptscsih_target_destroy,
        .slave_destroy                  = mptscsih_slave_destroy,
        .change_queue_depth             = mptscsih_change_queue_depth,
        .eh_abort_handler               = mptscsih_abort,
@@ -986,7 +995,6 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index)
                goto out_free_port_info;
 
        list_add_tail(&port_info->list, &ioc->sas_topology);
-
        for (i = 0; i < port_info->num_phys; i++) {
                mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
                        (MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER <<
@@ -1133,13 +1141,15 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                printk(MYIOC_s_WARN_FMT
                  "Skipping because it's not operational!\n",
                  ioc->name);
-               return -ENODEV;
+               error = -ENODEV;
+               goto out_mptsas_probe;
        }
 
        if (!ioc->active) {
                printk(MYIOC_s_WARN_FMT "Skipping because it's disabled!\n",
                  ioc->name);
-               return -ENODEV;
+               error = -ENODEV;
+               goto out_mptsas_probe;
        }
 
        /*  Sanity check - ensure at least 1 port is INITIATOR capable
@@ -1163,7 +1173,8 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                printk(MYIOC_s_WARN_FMT
                        "Unable to register controller with SCSI subsystem\n",
                        ioc->name);
-                return -1;
+               error = -1;
+               goto out_mptsas_probe;
         }
 
        spin_lock_irqsave(&ioc->FreeQlock, flags);
@@ -1237,7 +1248,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        mem = kmalloc(sz, GFP_ATOMIC);
        if (mem == NULL) {
                error = -ENOMEM;
-               goto mptsas_probe_failed;
+               goto out_mptsas_probe;
        }
 
        memset(mem, 0, sz);
@@ -1255,14 +1266,14 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        mem = kmalloc(sz, GFP_ATOMIC);
        if (mem == NULL) {
                error = -ENOMEM;
-               goto mptsas_probe_failed;
+               goto out_mptsas_probe;
        }
 
        memset(mem, 0, sz);
-       hd->Targets = (VirtDevice **) mem;
+       hd->Targets = (VirtTarget **) mem;
 
        dprintk((KERN_INFO
-         "  Targets @ %p, sz=%d\n", hd->Targets, sz));
+         "  vtarget @ %p, sz=%d\n", hd->Targets, sz));
 
        /* Clear the TM flags
         */
@@ -1308,14 +1319,14 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (error) {
                dprintk((KERN_ERR MYNAM
                  "scsi_add_host failed\n"));
-               goto mptsas_probe_failed;
+               goto out_mptsas_probe;
        }
 
        mptsas_scan_sas_topology(ioc);
 
        return 0;
 
-mptsas_probe_failed:
+out_mptsas_probe:
 
        mptscsih_remove(pdev);
        return error;
index b7b9846ff3fd960859bd077f2716e95a9ab23dd7..93a16fa3c4baeab822056108f9e622e906b10d5c 100644 (file)
@@ -150,28 +150,29 @@ static int        mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 tar
 int            mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
 int            mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
 
-static void    mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen);
-static void    mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56);
-static void    mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
+static void    mptscsih_initTarget(MPT_SCSI_HOST *hd, VirtTarget *vtarget, u8 lun, char *data, int dlen);
+static void    mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *vtarget, char byte56);
 static void    mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags);
-static void    mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id);
+static void    mptscsih_no_negotiate(MPT_SCSI_HOST *hd, struct scsi_cmnd *sc);
 static int     mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target, int flags);
 static int     mptscsih_writeIOCPage4(MPT_SCSI_HOST *hd, int target_id, int bus);
 int            mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
 static int     mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
-static int     mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum);
+static void    mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice);
+static void    mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget);
+static int     mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id);
 
 static struct work_struct   mptscsih_persistTask;
 
 #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
 static int     mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io);
 static void    mptscsih_domainValidation(void *hd);
-static int     mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id);
 static void    mptscsih_qas_check(MPT_SCSI_HOST *hd, int id);
 static int     mptscsih_doDv(MPT_SCSI_HOST *hd, int channel, int target);
 static void    mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage);
 static void    mptscsih_fillbuf(char *buffer, int size, int index, int width);
 static void    mptscsih_set_dvflags_raid(MPT_SCSI_HOST *hd, int id);
+static void    mptscsih_set_dvflags(MPT_SCSI_HOST *hd, struct scsi_cmnd *sc);
 #endif
 
 void           mptscsih_remove(struct pci_dev *);
@@ -627,7 +628,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                dreplyprintk((KERN_NOTICE "Reply ha=%d id=%d lun=%d:\n"
                        "IOCStatus=%04xh SCSIState=%02xh SCSIStatus=%02xh\n"
                        "resid=%d bufflen=%d xfer_cnt=%d\n",
-                       ioc->id, pScsiReq->TargetID, pScsiReq->LUN[1],
+                       ioc->id, sc->device->id, sc->device->lun,
                        status, scsi_state, scsi_status, sc->resid,
                        sc->request_bufflen, xfer_cnt));
 
@@ -641,7 +642,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                    pScsiReply->ResponseInfo) {
                        printk(KERN_NOTICE "ha=%d id=%d lun=%d: "
                        "FCP_ResponseInfo=%08xh\n",
-                       ioc->id, pScsiReq->TargetID, pScsiReq->LUN[1],
+                       ioc->id, sc->device->id, sc->device->lun,
                        le32_to_cpu(pScsiReply->ResponseInfo));
                }
 
@@ -677,8 +678,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                        sc->result = DID_RESET << 16;
 
                        /* GEM Workaround. */
-                       if (ioc->bus_type == SCSI)
-                               mptscsih_no_negotiate(hd, sc->device->id);
+                       if (ioc->bus_type == SPI)
+                               mptscsih_no_negotiate(hd, sc);
                        break;
 
                case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:      /* 0x0049 */
@@ -892,16 +893,15 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
  *             when a lun is disable by mid-layer.
  *             Do NOT access the referenced scsi_cmnd structure or
  *             members. Will cause either a paging or NULL ptr error.
- *     @hd: Pointer to a SCSI HOST structure
- *     @target: target id
- *     @lun: lun
+ *      @hd: Pointer to a SCSI HOST structure
+ *     @vdevice: per device private data
  *
  *     Returns: None.
  *
  *     Called from slave_destroy.
  */
 static void
-mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, uint lun)
+mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
 {
        SCSIIORequest_t *mf = NULL;
        int              ii;
@@ -909,7 +909,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, uint lun)
        struct scsi_cmnd *sc;
 
        dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n",
-                       target, lun, max));
+                       vdevice->target_id, vdevice->lun, max));
 
        for (ii=0; ii < max; ii++) {
                if ((sc = hd->ScsiLookup[ii]) != NULL) {
@@ -919,7 +919,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, uint lun)
                        dsprintk(( "search_running: found (sc=%p, mf = %p) target %d, lun %d \n",
                                        hd->ScsiLookup[ii], mf, mf->TargetID, mf->LUN[1]));
 
-                       if ((mf->TargetID != ((u8)target)) || (mf->LUN[1] != ((u8) lun)))
+                       if ((mf->TargetID != ((u8)vdevice->target_id)) || (mf->LUN[1] != ((u8) vdevice->lun)))
                                continue;
 
                        /* Cleanup
@@ -993,8 +993,10 @@ mptscsih_remove(struct pci_dev *pdev)
        MPT_ADAPTER             *ioc = pci_get_drvdata(pdev);
        struct Scsi_Host        *host = ioc->sh;
        MPT_SCSI_HOST           *hd;
+#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
        int                     count;
        unsigned long           flags;
+#endif 
        int sz1;
 
        if(!host) {
@@ -1075,11 +1077,6 @@ mptscsih_shutdown(struct pci_dev *pdev)
 
        hd = (MPT_SCSI_HOST *)host->hostdata;
 
-       /* Flush the cache of this adapter
-        */
-       if(hd != NULL)
-               mptscsih_synchronize_cache(hd, 0);
-
 }
 
 #ifdef CONFIG_PM
@@ -1286,7 +1283,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        MPT_SCSI_HOST           *hd;
        MPT_FRAME_HDR           *mf;
        SCSIIORequest_t         *pScsiReq;
-       VirtDevice              *pTarget = SCpnt->device->hostdata;
+       VirtDevice              *vdev = SCpnt->device->hostdata;
        int      lun;
        u32      datalen;
        u32      scsictl;
@@ -1341,8 +1338,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        /* Default to untagged. Once a target structure has been allocated,
         * use the Inquiry data to determine if device supports tagged.
         */
-       if (pTarget
-           && (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)
+       if (vdev
+           && (vdev->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)
            && (SCpnt->device->tagged_supported)) {
                scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ;
        } else {
@@ -1351,8 +1348,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
 
        /* Use the above information to set up the message frame
         */
-       pScsiReq->TargetID = (u8) pTarget->target_id;
-       pScsiReq->Bus = pTarget->bus_id;
+       pScsiReq->TargetID = (u8) vdev->target_id;
+       pScsiReq->Bus = vdev->bus_id;
        pScsiReq->ChainOffset = 0;
        pScsiReq->Function = MPI_FUNCTION_SCSI_IO_REQUEST;
        pScsiReq->CDBLength = SCpnt->cmd_len;
@@ -1403,8 +1400,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        SCpnt->host_scribble = NULL;
 
 #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
-       if (hd->ioc->bus_type == SCSI) {
-               int dvStatus = hd->ioc->spi_data.dvStatus[pTarget->target_id];
+       if (hd->ioc->bus_type == SPI) {
+               int dvStatus = hd->ioc->spi_data.dvStatus[vdev->target_id];
                int issueCmd = 1;
 
                if (dvStatus || hd->ioc->spi_data.forceDv) {
@@ -1437,7 +1434,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
                        /* Set the DV flags.
                         */
                        if (dvStatus & MPT_SCSICFG_DV_NOT_DONE)
-                               mptscsih_set_dvflags(hd, pScsiReq);
+                               mptscsih_set_dvflags(hd, SCpnt);
 
                        if (!issueCmd)
                                goto fail;
@@ -1741,6 +1738,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
        u32              ctx2abort;
        int              scpnt_idx;
        int              retval;
+       VirtDevice       *vdev;
 
        /* If we can't locate our host adapter structure, return FAILED status.
         */
@@ -1790,8 +1788,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
 
        hd->abortSCpnt = SCpnt;
 
+       vdev = SCpnt->device->hostdata;
        retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
-               SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
+               vdev->bus_id, vdev->target_id, vdev->lun,
                ctx2abort, 2 /* 2 second timeout */);
 
        printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n",
@@ -1822,6 +1821,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
 {
        MPT_SCSI_HOST   *hd;
        int              retval;
+       VirtDevice       *vdev;
 
        /* If we can't locate our host adapter structure, return FAILED status.
         */
@@ -1839,8 +1839,9 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
               hd->ioc->name, SCpnt);
        scsi_print_command(SCpnt);
 
+       vdev = SCpnt->device->hostdata;
        retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
-               SCpnt->device->channel, SCpnt->device->id,
+               vdev->bus_id, vdev->target_id,
                0, 0, 5 /* 5 second timeout */);
 
        printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n",
@@ -1871,6 +1872,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
 {
        MPT_SCSI_HOST   *hd;
        int              retval;
+       VirtDevice       *vdev;
 
        /* If we can't locate our host adapter structure, return FAILED status.
         */
@@ -1888,8 +1890,9 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
        if (hd->timeouts < -1)
                hd->timeouts++;
 
+       vdev = SCpnt->device->hostdata;
        retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
-               SCpnt->device->channel, 0, 0, 0, 5 /* 5 second timeout */);
+               vdev->bus_id, 0, 0, 0, 5 /* 5 second timeout */);
 
        printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n",
                hd->ioc->name,
@@ -2148,26 +2151,39 @@ mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev,
        return 0;
 }
 
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/*
+ *     OS entry point to allow host driver to alloc memory
+ *     for each scsi target. Called once per device the bus scan.
+ *     Return non-zero if allocation fails.
+ */
+int
+mptscsih_target_alloc(struct scsi_target *starget)
+{
+       VirtTarget              *vtarget;
+
+       vtarget = kmalloc(sizeof(VirtTarget), GFP_KERNEL);
+       if (!vtarget)
+               return -ENOMEM;
+       memset(vtarget, 0, sizeof(VirtTarget));
+       starget->hostdata = vtarget;
+       return 0;
+}
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *     OS entry point to allow host driver to alloc memory
  *     for each scsi device. Called once per device the bus scan.
  *     Return non-zero if allocation fails.
- *     Init memory once per id (not LUN).
  */
 int
-mptscsih_slave_alloc(struct scsi_device *device)
+mptscsih_slave_alloc(struct scsi_device *sdev)
 {
-       struct Scsi_Host        *host = device->host;
+       struct Scsi_Host        *host = sdev->host;
        MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)host->hostdata;
+       VirtTarget              *vtarget;
        VirtDevice              *vdev;
-       uint                    target = device->id;
-
-       if (hd == NULL)
-               return -ENODEV;
-
-       if ((vdev = hd->Targets[target]) != NULL)
-               goto out;
+       struct scsi_target      *starget;
 
        vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL);
        if (!vdev) {
@@ -2177,25 +2193,33 @@ mptscsih_slave_alloc(struct scsi_device *device)
        }
 
        memset(vdev, 0, sizeof(VirtDevice));
-       vdev->tflags = MPT_TARGET_FLAGS_Q_YES;
        vdev->ioc_id = hd->ioc->id;
-       vdev->target_id = device->id;
-       vdev->bus_id = device->channel;
-       vdev->raidVolume = 0;
-       hd->Targets[device->id] = vdev;
-       if (hd->ioc->bus_type == SCSI) {
-               if (hd->ioc->raid_data.isRaid & (1 << device->id)) {
-                       vdev->raidVolume = 1;
-                       ddvtprintk((KERN_INFO
-                           "RAID Volume @ id %d\n", device->id));
+       vdev->target_id = sdev->id;
+       vdev->bus_id = sdev->channel;
+       vdev->lun = sdev->lun;
+       sdev->hostdata = vdev;
+
+       starget = scsi_target(sdev);
+       vtarget = starget->hostdata;
+       vdev->vtarget = vtarget;
+
+       if (vtarget->num_luns == 0) {
+               hd->Targets[sdev->id] = vtarget;
+               vtarget->ioc_id = hd->ioc->id;
+               vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
+               vtarget->target_id = sdev->id;
+               vtarget->bus_id = sdev->channel;
+               if (hd->ioc->bus_type == SPI) {
+                       if (hd->ioc->raid_data.isRaid & (1 << sdev->id)) {
+                               vtarget->raidVolume = 1;
+                               ddvtprintk((KERN_INFO
+                                   "RAID Volume @ id %d\n", sdev->id));
+                       }
+               } else {
+                       vtarget->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
                }
-       } else {
-               vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
        }
-
- out:
-       vdev->num_luns++;
-       device->hostdata = vdev;
+       vtarget->num_luns++;
        return 0;
 }
 
@@ -2204,40 +2228,52 @@ mptscsih_slave_alloc(struct scsi_device *device)
  *     Called if no device present or device being unloaded
  */
 void
-mptscsih_slave_destroy(struct scsi_device *device)
+mptscsih_target_destroy(struct scsi_target *starget)
 {
-       struct Scsi_Host        *host = device->host;
-       MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)host->hostdata;
-       VirtDevice              *vdev;
-       uint                    target = device->id;
-       uint                    lun = device->lun;
-
-       if (hd == NULL)
-               return;
-
-       mptscsih_search_running_cmds(hd, target, lun);
-
-       vdev = hd->Targets[target];
-       vdev->luns[0] &= ~(1 << lun);
-       if (--vdev->num_luns)
-               return;
-
-       kfree(hd->Targets[target]);
-       hd->Targets[target] = NULL;
-
-       if (hd->ioc->bus_type == SCSI) {
-               if (mptscsih_is_phys_disk(hd->ioc, target)) {
-                       hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
-               } else {
-                       hd->ioc->spi_data.dvStatus[target] =
-                               MPT_SCSICFG_NEGOTIATE;
+       if (starget->hostdata)
+               kfree(starget->hostdata);
+       starget->hostdata = NULL;
+}
 
-                       if (!hd->negoNvram) {
-                               hd->ioc->spi_data.dvStatus[target] |=
-                                       MPT_SCSICFG_DV_NOT_DONE;
+/*
+ *     OS entry point to allow for host driver to free allocated memory
+ *     Called if no device present or device being unloaded
+ */
+void
+mptscsih_slave_destroy(struct scsi_device *sdev)
+{
+       struct Scsi_Host        *host = sdev->host;
+       MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)host->hostdata;
+       VirtTarget              *vtarget;
+       VirtDevice              *vdevice;
+       struct scsi_target      *starget;
+
+       starget = scsi_target(sdev);
+       vtarget = starget->hostdata;
+       vdevice = sdev->hostdata;
+
+       mptscsih_search_running_cmds(hd, vdevice);
+       vtarget->luns[0] &= ~(1 << vdevice->lun);
+       vtarget->num_luns--;
+       if (vtarget->num_luns == 0) {
+               mptscsih_negotiate_to_asyn_narrow(hd, vtarget);
+               if (hd->ioc->bus_type == SPI) {
+                       if (mptscsih_is_phys_disk(hd->ioc, vtarget->target_id)) {
+                               hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
+                       } else {
+                               hd->ioc->spi_data.dvStatus[vtarget->target_id] =
+                                       MPT_SCSICFG_NEGOTIATE;
+                               if (!hd->negoNvram) {
+                                       hd->ioc->spi_data.dvStatus[vtarget->target_id] |=
+                                               MPT_SCSICFG_DV_NOT_DONE;
+                               }
                        }
                }
+               hd->Targets[sdev->id] = NULL;
        }
+       mptscsih_synchronize_cache(hd, vdevice);
+       kfree(vdevice);
+       sdev->hostdata = NULL;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -2251,22 +2287,21 @@ mptscsih_slave_destroy(struct scsi_device *device)
 int
 mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
 {
-       MPT_SCSI_HOST   *hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
-       VirtDevice *pTarget;
-       int     max_depth;
-       int     tagged;
-
-       if (hd == NULL)
-               return 0;
-       if (!(pTarget = hd->Targets[sdev->id]))
-               return 0;
-
-       if (hd->ioc->bus_type == SCSI) {
-               if (pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY) {
-                       if (!(pTarget->tflags & MPT_TARGET_FLAGS_Q_YES))
+       MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
+       VirtTarget              *vtarget;
+       struct scsi_target      *starget;
+       int                     max_depth;
+       int                     tagged;
+
+       starget = scsi_target(sdev);
+       vtarget = starget->hostdata;
+
+       if (hd->ioc->bus_type == SPI) {
+               if (vtarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY) {
+                       if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
                                max_depth = 1;
-                       else if (((pTarget->inq_data[0] & 0x1f) == 0x00) &&
-                                (pTarget->minSyncFactor <= MPT_ULTRA160 ))
+                       else if (((vtarget->inq_data[0] & 0x1f) == 0x00) &&
+                                (vtarget->minSyncFactor <= MPT_ULTRA160 ))
                                max_depth = MPT_SCSI_CMD_PER_DEV_HIGH;
                        else
                                max_depth = MPT_SCSI_CMD_PER_DEV_LOW;
@@ -2295,64 +2330,58 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
  *     Return non-zero if fails.
  */
 int
-mptscsih_slave_configure(struct scsi_device *device)
+mptscsih_slave_configure(struct scsi_device *sdev)
 {
-       struct Scsi_Host        *sh = device->host;
-       VirtDevice              *pTarget;
+       struct Scsi_Host        *sh = sdev->host;
+       VirtTarget              *vtarget;
+       VirtDevice              *vdevice;
+       struct scsi_target      *starget;
        MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)sh->hostdata;
+       int                     indexed_lun, lun_index;
 
-       if ((hd == NULL) || (hd->Targets == NULL)) {
-               return 0;
-       }
+       starget = scsi_target(sdev);
+       vtarget = starget->hostdata;
+       vdevice = sdev->hostdata;
 
        dsprintk((MYIOC_s_INFO_FMT
                "device @ %p, id=%d, LUN=%d, channel=%d\n",
-               hd->ioc->name, device, device->id, device->lun, device->channel));
-       dsprintk((MYIOC_s_INFO_FMT
-               "sdtr %d wdtr %d ppr %d inq length=%d\n",
-               hd->ioc->name, device->sdtr, device->wdtr,
-               device->ppr, device->inquiry_len));
-
-       if (device->id > sh->max_id) {
+               hd->ioc->name, sdev, sdev->id, sdev->lun, sdev->channel));
+       if (hd->ioc->bus_type == SPI)
+               dsprintk((MYIOC_s_INFO_FMT
+                   "sdtr %d wdtr %d ppr %d inq length=%d\n",
+                   hd->ioc->name, sdev->sdtr, sdev->wdtr,
+                   sdev->ppr, sdev->inquiry_len));
+
+       if (sdev->id > sh->max_id) {
                /* error case, should never happen */
-               scsi_adjust_queue_depth(device, 0, 1);
-               goto slave_configure_exit;
-       }
-
-       pTarget = hd->Targets[device->id];
-
-       if (pTarget == NULL) {
-               /* Driver doesn't know about this device.
-                * Kernel may generate a "Dummy Lun 0" which
-                * may become a real Lun if a
-                * "scsi add-single-device" command is executed
-                * while the driver is active (hot-plug a
-                * device).  LSI Raid controllers need
-                * queue_depth set to DEV_HIGH for this reason.
-                */
-               scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
-                       MPT_SCSI_CMD_PER_DEV_HIGH);
+               scsi_adjust_queue_depth(sdev, 0, 1);
                goto slave_configure_exit;
        }
 
-       mptscsih_initTarget(hd, device->channel, device->id, device->lun,
-               device->inquiry, device->inquiry_len );
-       mptscsih_change_queue_depth(device, MPT_SCSI_CMD_PER_DEV_HIGH);
+       vdevice->configured_lun=1;
+       lun_index = (vdevice->lun >> 5);  /* 32 luns per lun_index */
+       indexed_lun = (vdevice->lun % 32);
+       vtarget->luns[lun_index] |= (1 << indexed_lun);
+       mptscsih_initTarget(hd, vtarget, sdev->lun, sdev->inquiry,
+           sdev->inquiry_len );
+       mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
 
        dsprintk((MYIOC_s_INFO_FMT
                "Queue depth=%d, tflags=%x\n",
-               hd->ioc->name, device->queue_depth, pTarget->tflags));
+               hd->ioc->name, sdev->queue_depth, vtarget->tflags));
 
-       dsprintk((MYIOC_s_INFO_FMT
-               "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n",
-               hd->ioc->name, pTarget->negoFlags, pTarget->maxOffset, pTarget->minSyncFactor));
+       if (hd->ioc->bus_type == SPI)
+               dsprintk((MYIOC_s_INFO_FMT
+                   "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n",
+                   hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset,
+                   vtarget->minSyncFactor));
 
 slave_configure_exit:
 
        dsprintk((MYIOC_s_INFO_FMT
                "tagged %d, simple %d, ordered %d\n",
-               hd->ioc->name,device->tagged_supported, device->simple_tags,
-               device->ordered_tags));
+               hd->ioc->name,sdev->tagged_supported, sdev->simple_tags,
+               sdev->ordered_tags));
 
        return 0;
 }
@@ -2370,16 +2399,14 @@ slave_configure_exit:
 static void
 mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply)
 {
-       VirtDevice      *target;
+       VirtDevice      *vdev;
        SCSIIORequest_t *pReq;
        u32              sense_count = le32_to_cpu(pScsiReply->SenseCount);
-       int              index;
 
        /* Get target structure
         */
        pReq = (SCSIIORequest_t *) mf;
-       index = (int) pReq->TargetID;
-       target = hd->Targets[index];
+       vdev = sc->device->hostdata;
 
        if (sense_count) {
                u8 *sense_data;
@@ -2393,7 +2420,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
                /* Log SMART data (asc = 0x5D, non-IM case only) if required.
                 */
                if ((hd->ioc->events) && (hd->ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) {
-                       if ((sense_data[12] == 0x5D) && (target->raidVolume == 0)) {
+                       if ((sense_data[12] == 0x5D) && (vdev->vtarget->raidVolume == 0)) {
                                int idx;
                                MPT_ADAPTER *ioc = hd->ioc;
 
@@ -2403,7 +2430,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
 
                                ioc->events[idx].data[0] = (pReq->LUN[1] << 24) ||
                                        (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) ||
-                                       (pReq->Bus << 8) || pReq->TargetID;
+                                       (sc->device->channel << 8) || sc->device->id;
 
                                ioc->events[idx].data[1] = (sense_data[13] << 8) || sense_data[12];
 
@@ -2503,9 +2530,9 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                /* 2. Chain Buffer initialization
                 */
 
-               /* 4. Renegotiate to all devices, if SCSI
+               /* 4. Renegotiate to all devices, if SPI
                 */
-               if (ioc->bus_type == SCSI) {
+               if (ioc->bus_type == SPI) {
                        dnegoprintk(("writeSDP1: ALL_IDS USE_NVRAM\n"));
                        mptscsih_writeSDP1(hd, 0, 0, MPT_SCSICFG_ALL_IDS | MPT_SCSICFG_USE_NVRAM);
                }
@@ -2534,7 +2561,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 
                /* 7. Set flag to force DV and re-read IOC Page 3
                 */
-               if (ioc->bus_type == SCSI) {
+               if (ioc->bus_type == SPI) {
                        ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
                        ddvtprintk(("Set reload IOC Pg3 Flag\n"));
                }
@@ -2576,7 +2603,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
                break;
        case MPI_EVENT_IOC_BUS_RESET:                   /* 04 */
        case MPI_EVENT_EXT_BUS_RESET:                   /* 05 */
-               if (hd && (ioc->bus_type == SCSI) && (hd->soft_resets < -1))
+               if (hd && (ioc->bus_type == SPI) && (hd->soft_resets < -1))
                        hd->soft_resets++;
                break;
        case MPI_EVENT_LOGOUT:                          /* 09 */
@@ -2597,11 +2624,11 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
 
        case MPI_EVENT_INTEGRATED_RAID:                 /* 0B */
        {
+#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
                pMpiEventDataRaid_t pRaidEventData =
                    (pMpiEventDataRaid_t) pEvReply->Data;
-#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
                /* Domain Validation Needed */
-               if (ioc->bus_type == SCSI &&
+               if (ioc->bus_type == SPI &&
                    pRaidEventData->ReasonCode ==
                    MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED)
                        mptscsih_set_dvflags_raid(hd, pRaidEventData->PhysDiskNum);
@@ -2632,8 +2659,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
 /*
  *     mptscsih_initTarget - Target, LUN alloc/free functionality.
  *     @hd: Pointer to MPT_SCSI_HOST structure
- *     @bus_id: Bus number (?)
- *     @target_id: SCSI target id
+ *     @vtarget: per target private data
  *     @lun: SCSI LUN id
  *     @data: Pointer to data
  *     @dlen: Number of INQUIRY bytes
@@ -2646,15 +2672,14 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
  *
  */
 static void
-mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen)
+mptscsih_initTarget(MPT_SCSI_HOST *hd, VirtTarget *vtarget, u8 lun, char *data, int dlen)
 {
-       int             indexed_lun, lun_index;
-       VirtDevice      *vdev;
        SpiCfgData      *pSpi;
        char            data_56;
+       int             inq_len;
 
        dinitprintk((MYIOC_s_INFO_FMT "initTarget bus=%d id=%d lun=%d hd=%p\n",
-                       hd->ioc->name, bus_id, target_id, lun, hd));
+               hd->ioc->name, vtarget->bus_id, vtarget->target_id, lun, hd));
 
        /*
         * If the peripheral qualifier filter is enabled then if the target reports a 0x1
@@ -2674,75 +2699,68 @@ mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *
        if (data[0] & 0xe0)
                return;
 
-       if ((vdev = hd->Targets[target_id]) == NULL) {
+       if (vtarget == NULL)
                return;
-       }
 
-       lun_index = (lun >> 5);  /* 32 luns per lun_index */
-       indexed_lun = (lun % 32);
-       vdev->luns[lun_index] |= (1 << indexed_lun);
-
-       if (hd->ioc->bus_type == SCSI) {
-               if ((data[0] == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) {
-                       /* Treat all Processors as SAF-TE if
-                        * command line option is set */
-                       vdev->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED;
-                       mptscsih_writeIOCPage4(hd, target_id, bus_id);
-               }else if ((data[0] == TYPE_PROCESSOR) &&
-                       !(vdev->tflags & MPT_TARGET_FLAGS_SAF_TE_ISSUED )) {
-                       if ( dlen > 49 ) {
-                               vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
-                               if ( data[44] == 'S' &&
-                                    data[45] == 'A' &&
-                                    data[46] == 'F' &&
-                                    data[47] == '-' &&
-                                    data[48] == 'T' &&
-                                    data[49] == 'E' ) {
-                                       vdev->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED;
-                                       mptscsih_writeIOCPage4(hd, target_id, bus_id);
-                               }
+       if (data)
+               vtarget->type = data[0];
+
+       if (hd->ioc->bus_type != SPI)
+               return;
+
+       if ((data[0] == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) {
+               /* Treat all Processors as SAF-TE if
+                * command line option is set */
+               vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED;
+               mptscsih_writeIOCPage4(hd, vtarget->target_id, vtarget->bus_id);
+       }else if ((data[0] == TYPE_PROCESSOR) &&
+               !(vtarget->tflags & MPT_TARGET_FLAGS_SAF_TE_ISSUED )) {
+               if ( dlen > 49 ) {
+                       vtarget->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
+                       if ( data[44] == 'S' &&
+                            data[45] == 'A' &&
+                            data[46] == 'F' &&
+                            data[47] == '-' &&
+                            data[48] == 'T' &&
+                            data[49] == 'E' ) {
+                               vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED;
+                               mptscsih_writeIOCPage4(hd, vtarget->target_id, vtarget->bus_id);
                        }
                }
-               if (!(vdev->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)) {
-                       if ( dlen > 8 ) {
-                               memcpy (vdev->inq_data, data, 8);
-                       } else {
-                               memcpy (vdev->inq_data, data, dlen);
-                       }
+       }
+       if (!(vtarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)) {
+               inq_len = dlen < 8 ? dlen : 8;
+               memcpy (vtarget->inq_data, data, inq_len);
+               /* If have not done DV, set the DV flag.
+                */
+               pSpi = &hd->ioc->spi_data;
+               if ((data[0] == TYPE_TAPE) || (data[0] == TYPE_PROCESSOR)) {
+                       if (pSpi->dvStatus[vtarget->target_id] & MPT_SCSICFG_DV_NOT_DONE)
+                               pSpi->dvStatus[vtarget->target_id] |= MPT_SCSICFG_NEED_DV;
+               }
+               vtarget->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
 
-                       /* If have not done DV, set the DV flag.
+               data_56 = 0x0F;  /* Default to full capabilities if Inq data length is < 57 */
+               if (dlen > 56) {
+                       if ( (!(vtarget->tflags & MPT_TARGET_FLAGS_VALID_56))) {
+                       /* Update the target capabilities
                         */
-                       pSpi = &hd->ioc->spi_data;
-                       if ((data[0] == TYPE_TAPE) || (data[0] == TYPE_PROCESSOR)) {
-                               if (pSpi->dvStatus[target_id] & MPT_SCSICFG_DV_NOT_DONE)
-                                       pSpi->dvStatus[target_id] |= MPT_SCSICFG_NEED_DV;
-                       }
-
-                       vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
-
-
-                       data_56 = 0x0F;  /* Default to full capabilities if Inq data length is < 57 */
-                       if (dlen > 56) {
-                               if ( (!(vdev->tflags & MPT_TARGET_FLAGS_VALID_56))) {
-                               /* Update the target capabilities
-                                */
-                                       data_56 = data[56];
-                                       vdev->tflags |= MPT_TARGET_FLAGS_VALID_56;
-                               }
+                               data_56 = data[56];
+                               vtarget->tflags |= MPT_TARGET_FLAGS_VALID_56;
                        }
-                       mptscsih_setTargetNegoParms(hd, vdev, data_56);
-               } else {
-                       /* Initial Inquiry may not request enough data bytes to
-                        * obtain byte 57.  DV will; if target doesn't return
-                        * at least 57 bytes, data[56] will be zero. */
-                       if (dlen > 56) {
-                               if ( (!(vdev->tflags & MPT_TARGET_FLAGS_VALID_56))) {
-                               /* Update the target capabilities
-                                */
-                                       data_56 = data[56];
-                                       vdev->tflags |= MPT_TARGET_FLAGS_VALID_56;
-                                       mptscsih_setTargetNegoParms(hd, vdev, data_56);
-                               }
+               }
+               mptscsih_setTargetNegoParms(hd, vtarget, data_56);
+       } else {
+               /* Initial Inquiry may not request enough data bytes to
+                * obtain byte 57.  DV will; if target doesn't return
+                * at least 57 bytes, data[56] will be zero. */
+               if (dlen > 56) {
+                       if ( (!(vtarget->tflags & MPT_TARGET_FLAGS_VALID_56))) {
+                       /* Update the target capabilities
+                        */
+                               data_56 = data[56];
+                               vtarget->tflags |= MPT_TARGET_FLAGS_VALID_56;
+                               mptscsih_setTargetNegoParms(hd, vtarget, data_56);
                        }
                }
        }
@@ -2755,12 +2773,12 @@ mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *
  *
  */
 static void
-mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56)
+mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, char byte56)
 {
        SpiCfgData *pspi_data = &hd->ioc->spi_data;
        int  id = (int) target->target_id;
        int  nvram;
-       VirtDevice      *vdev;
+       VirtTarget      *vtarget;
        int ii;
        u8 width = MPT_NARROW;
        u8 factor = MPT_ASYNC;
@@ -2905,9 +2923,9 @@ mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56)
 
                        ddvtprintk((KERN_INFO "Disabling QAS due to noQas=%02x on id=%d!\n", noQas, id));
                        for (ii = 0; ii < id; ii++) {
-                               if ( (vdev = hd->Targets[ii]) ) {
-                                       vdev->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
-                                       mptscsih_writeSDP1(hd, 0, ii, vdev->negoFlags);
+                               if ( (vtarget = hd->Targets[ii]) ) {
+                                       vtarget->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
+                                       mptscsih_writeSDP1(hd, 0, ii, vtarget->negoFlags);
                                }
                        }
                }
@@ -2925,106 +2943,18 @@ mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56)
        }
 }
 
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return.
- * Else set the NEED_DV flag after Read Capacity Issued (disks)
- * or Mode Sense (cdroms).
- *
- * Tapes, initTarget will set this flag on completion of Inquiry command.
- * Called only if DV_NOT_DONE flag is set
- */
-static void
-mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq)
-{
-       MPT_ADAPTER     *ioc = hd->ioc;
-       u8 cmd;
-       SpiCfgData      *pSpi;
-
-       ddvtprintk((MYIOC_s_NOTE_FMT
-               " set_dvflags: id=%d lun=%d negoNvram=%x cmd=%x\n",
-               hd->ioc->name, pReq->TargetID, pReq->LUN[1], hd->negoNvram, pReq->CDB[0]));
-
-       if ((pReq->LUN[1] != 0) || (hd->negoNvram != 0))
-               return;
-
-       cmd = pReq->CDB[0];
-
-       if ((cmd == READ_CAPACITY) || (cmd == MODE_SENSE)) {
-               pSpi = &ioc->spi_data;
-               if ((ioc->raid_data.isRaid & (1 << pReq->TargetID)) && ioc->raid_data.pIocPg3) {
-                       /* Set NEED_DV for all hidden disks
-                        */
-                       Ioc3PhysDisk_t *pPDisk =  ioc->raid_data.pIocPg3->PhysDisk;
-                       int             numPDisk = ioc->raid_data.pIocPg3->NumPhysDisks;
-
-                       while (numPDisk) {
-                               pSpi->dvStatus[pPDisk->PhysDiskID] |= MPT_SCSICFG_NEED_DV;
-                               ddvtprintk(("NEED_DV