Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2012 20:45:40 +0530
From:      "Desai, Kashyap" <Kashyap.Desai@lsi.com>
To:        Johan Hendriks <joh.hendriks@gmail.com>
Cc:        freebsd-stable <freebsd-stable@freebsd.org>
Subject:   RE: LSI supported mps(4) driver in stable/9 and stable/8
Message-ID:  <B2FD678A64EAAD45B089B123FDFC3ED729A3414E2E@inbmail01.lsi.com>
In-Reply-To: <4F2BF93F.4060407@gmail.com>
References:  <20120202191105.GA55719@nargothrond.kdm.org> <4F2BF270.70303@gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED729A3414E2A@inbmail01.lsi.com> <4F2BF93F.4060407@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Try attached patch.! (This patch is not taken against upstream code, so you may see some hunk fail.)

~ Kashyap

> -----Original Message-----
> From: Johan Hendriks [mailto:joh.hendriks@gmail.com]
> Sent: Friday, February 03, 2012 8:42 PM
> To: Desai, Kashyap
> Cc: freebsd-stable
> Subject: Re: LSI supported mps(4) driver in stable/9 and stable/8
>
> Desai, Kashyap schreef:
> > Hi Johan,
> >
> > I have already figure out this issue in our lab.
> >
> > I also have fix for this issue. (Just don't want to create regression,
> that is why I have not posted outside)
> > Since you have seen similar issue, It is worth to try my patch.
> >
> > My machine is not getting IP right now. I will send you patch once my
> machine is in network ?
> >
> > ~ Kashyap
> >
> >
> >> -----Original Message-----
> >> From: owner-freebsd-stable@freebsd.org [mailto:owner-freebsd-
> >> stable@freebsd.org] On Behalf Of Johan Hendriks
> >> Sent: Friday, February 03, 2012 8:13 PM
> >> To: Kenneth D. Merry
> >> Cc: freebsd-stable
> >> Subject: Re: LSI supported mps(4) driver in stable/9 and stable/8
> >>
> >> Kenneth D. Merry schreef:
> >>> Hi folks,
> >>>
> >>> The LSI-supported version of the mps(4) driver that supports their
> 6Gb
> >> SAS
> >>> HBAs as well as WarpDrive controllers, is now in stable/9 and
> >> stable/8.
> >>> Please test it out and let me and Kashyap (CCed) know if you run
> into
> >>> any problems.
> >>>
> >>> In addition to supporting WarpDrive, the driver also supports
> >> Integrated
> >>> RAID.
> >>>
> >>> Thanks to LSI for doing the work on this driver!
> >>>
> >>> Note that the CAM infrastructure changes that went into FreeBSD/head
> >> along
> >>> with this driver have not gone into either stable/9 or stable/8.
> Only
> >> the
> >>> driver itself has been merged.
> >>>
> >>> The CAM infrastructure changes depend on some other da(4) driver
> >> changes
> >>> that will need to get merged before they can go back.  If that merge
> >>> happens, it will probably only be into stable/9.
> >>>
> >>> A couple of notes about issues with this driver:
> >>>
> >>>    - Unlike the previous mps(4) driver, it probes sequentially.  If
> you
> >> have
> >>>      a lot of drives in your system, it will take a while to probe
> them
> >> all.
> >>>    - You may see warning messages like this:
> >>>
> >>> _mapping_add_new_device: failed to add the device with handle 0x0019
> >> to persiste
> >>> nt table because there is no free space available
> >>> _mapping_add_new_device: failed to add the device with handle 0x001a
> >> to persiste
> >>> nt table because there is no free space available
> >>>
> >>>    - The driver is not endian safe.  (It assumes a little endian
> >> machine.)
> >>>      This is not new, the previous version of the driver had the
> same
> >> issue.
> >>> The LSI folks know about these issues.  The driver has passed their
> >> testing
> >>> process.
> >>>
> >>> Many thanks to LSI for going through the effort to support FreeBSD.
> >>>
> >>> Ken
> >> Hello Ken.
> >>
> >> Just updated our 16 bay server. did a csup today.
> >> did try some commands, it looked like the drives got husseled.
> >>
> >> But after giving the command camcontrol rescan all it does not give
> back
> >> the prompt.
> >> Also top shows me the following.
> >> 1589 root        1  20    0 16384K  1376K cbwait  3   0:00  0.00%
> >> camcontrol
> >>
> >> # on another console things works
> >> filer01# camcontrol devlist
> >> <ATA WDC WD800JD-60LS 1D07>         at scbus0 target 8 lun 0
> (pass0,da0)
> >> <ATA WDC WD800JD-60LS 1D07>         at scbus0 target 9 lun 0
> (pass1,da1)
> >> <ATA WDC WD2500AAJS-6 2E25>         at scbus0 target 10 lun 0
> (pass2,da2)
> >> <ATA WDC WD2500JS-60M 2E04>         at scbus0 target 11 lun 0
> (pass3,da3)
> >> <ATA WDC WD2500JS-60M 2E04>         at scbus0 target 12 lun 0
> (pass4,da4)
> >> <ATA ST3250620NS BJH>               at scbus0 target 13 lun 0
> (pass5,da5)
> >> <LSI CORP SAS2X28 0717>             at scbus0 target 16 lun 0
> >> (probe16,ses0,pass6)
> >> <ATA Maxtor 6L080M0 1G10>           at scbus0 target 17 lun 0
> (pass7,da6)
> >> <ATA Maxtor 6L080M0 1G10>           at scbus0 target 18 lun 0
> (pass8,da7)
> >> <ATA WDC WD800JD-60LS 1D07>         at scbus0 target 19 lun 0
> (pass9,da8)
> >> <ATA WDC WD800JD-60LU 1D07>         at scbus0 target 20 lun 0
> >> (pass10,da9)
> >> <ATA GB0250EAFJF HPG6>              at scbus0 target 21 lun 0
> >> (pass11,da10)
> >> <ATA ST3250620NS 3BJP>              at scbus0 target 22 lun 0
> >> (pass12,da11)
> >> <ATA ST3250620NS 3BJP>              at scbus0 target 23 lun 0
> >> (pass13,da12)
> >> <ATA ST3250620NS 3BJP>              at scbus0 target 24 lun 0
> >> (pass14,da13)
> >> <ATA ST3250310AS B>                 at scbus0 target 27 lun 0
> >> (pass15,da14)
> >> <ATA ST3250620NS 3BJP>              at scbus0 target 28 lun 0
> >> (pass16,da15)
> >> <ST3808110AS 3.AJJ>                 at scbus1 target 0 lun 0
> >> (ada0,pass17)
> >> <TSSTcorp CDDVDW SN-208BB SB00>     at scbus3 target 0 lun 0
> (pass18,cd0)
> >>
> >> The controller is a LSI 9211-8i with IT firmware.
> >>
> >> here is the dmesg
> >> Copyright (c) 1992-2012 The FreeBSD Project.
> >> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993,
> 1994
> >>           The Regents of the University of California. All rights
> >> reserved.
> >> FreeBSD is a registered trademark of The FreeBSD Foundation.
> >> FreeBSD 9.0-STABLE #0: Fri Feb  3 10:27:18 CET 2012
> >>       root@filer01.neuteboom.local:/usr/obj/usr/src/sys/KRNL amd64
> >> CPU: Intel(R) Xeon(R) CPU E31220 @ 3.10GHz (3093.04-MHz K8-class CPU)
> >>     Origin = "GenuineIntel"  Id = 0x206a7  Family = 6  Model = 2a
> >> Stepping = 7
> >>
> >>
> Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE
> >> ,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
> >>
> >>
> Features2=0x15bae3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SS
> >> SE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,XSAVE,AVX>
> >>     AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
> >>     AMD Features2=0x1<LAHF>
> >>     TSC: P-state invariant, performance statistics
> >> real memory  = 17179869184 (16384 MB)
> >> avail memory = 16493441024 (15729 MB)
> >> Event timer "LAPIC" quality 600
> >> ACPI APIC Table:<SUPERM SMCI--MB>
> >> FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> >> FreeBSD/SMP: 1 package(s) x 4 core(s)
> >>    cpu0 (BSP): APIC ID:  0
> >>    cpu1 (AP): APIC ID:  2
> >>    cpu2 (AP): APIC ID:  4
> >>    cpu3 (AP): APIC ID:  6
> >> ioapic0<Version 2.0>  irqs 0-23 on motherboard
> >> kbd1 at kbdmux0
> >> acpi0:<SUPERM SMCI--MB>  on motherboard
> >> acpi0: Power Button (fixed)
> >> Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
> >> acpi_timer0:<24-bit timer at 3.579545MHz>  port 0x408-0x40b on acpi0
> >> cpu0:<ACPI CPU>  on acpi0
> >> cpu1:<ACPI CPU>  on acpi0
> >> cpu2:<ACPI CPU>  on acpi0
> >> cpu3:<ACPI CPU>  on acpi0
> >> pcib0:<ACPI Host-PCI bridge>  port 0xcf8-0xcff on acpi0
> >> pci0:<ACPI PCI bus>  on pcib0
> >> pcib1:<ACPI PCI-PCI bridge>  irq 19 at device 6.0 on pci0
> >> pci1:<ACPI PCI bus>  on pcib1
> >> mps0:<LSI SAS2008>  port 0xe000-0xe0ff mem 0xfb600000-0xfb603fff irq
> 19
> >> at device 0.0 on pci1
> >> mps0: Firmware: 11.00.00.00, Driver: 11.255.03.00-fbsd
> >> mps0: IOCCapabilities:
> >>
> 1285c<ScsiTaskFull,DiagTrace,SnapBuf,EEDP,TransRetry,EventReplay,HostDis
> >> c>
> >> em0:<Intel(R) PRO/1000 Network Connection 7.2.3>  port 0xf020-0xf03f
> mem
> >> 0xfb800000-0xfb81ffff,0xfb824000-0xfb824fff irq 20 at device 25.0 on
> >> pci0
> >> em0: Using an MSI interrupt
> >> em0: Ethernet address: 00:25:90:57:20:bd
> >> ehci0:<EHCI (generic) USB 2.0 controller>  mem 0xfb823000-0xfb8233ff
> irq
> >> 16 at device 26.0 on pci0
> >> usbus0: EHCI version 1.0
> >> usbus0:<EHCI (generic) USB 2.0 controller>  on ehci0
> >> pcib2:<ACPI PCI-PCI bridge>  irq 17 at device 28.0 on pci0
> >> pci2:<ACPI PCI bus>  on pcib2
> >> pcib3:<ACPI PCI-PCI bridge>  irq 17 at device 28.4 on pci0
> >> pci3:<ACPI PCI bus>  on pcib3
> >> em1:<Intel(R) PRO/1000 Network Connection 7.2.3>  port 0xd000-0xd01f
> mem
> >> 0xfb700000-0xfb71ffff,0xfb720000-0xfb723fff irq 16 at device 0.0 on
> pci3
> >> em1: Using MSIX interrupts with 3 vectors
> >> em1: Ethernet address: 00:25:90:57:20:bc
> >> ehci1:<EHCI (generic) USB 2.0 controller>  mem 0xfb822000-0xfb8223ff
> irq
> >> 23 at device 29.0 on pci0
> >> usbus1: EHCI version 1.0
> >> usbus1:<EHCI (generic) USB 2.0 controller>  on ehci1
> >> pcib4:<ACPI PCI-PCI bridge>  at device 30.0 on pci0
> >> pci4:<ACPI PCI bus>  on pcib4
> >> vgapci0:<VGA-compatible display>  mem
> >> 0xf9000000-0xf9ffffff,0xfb000000-0xfb003fff,0xfa800000-0xfaffffff irq
> 23
> >> at device 3.0 on pci4
> >> isab0:<PCI-ISA bridge>  at device 31.0 on pci0
> >> isa0:<ISA bus>  on isab0
> >> ahci0:<Intel Cougar Point AHCI SATA controller>  port
> >> 0xf070-0xf077,0xf060-0xf063,0xf050-0xf057,0xf040-0xf043,0xf000-0xf01f
> >> mem 0xfb821000-0xfb8217ff irq 19 at device 31.2 on pci0
> >> ahci0: AHCI v1.30 with 6 6Gbps ports, Port Multiplier not supported
> >> ahcich0:<AHCI channel>  at channel 0 on ahci0
> >> ahcich1:<AHCI channel>  at channel 1 on ahci0
> >> ahcich2:<AHCI channel>  at channel 2 on ahci0
> >> ahcich3:<AHCI channel>  at channel 3 on ahci0
> >> ahcich4:<AHCI channel>  at channel 4 on ahci0
> >> ahcich5:<AHCI channel>  at channel 5 on ahci0
> >> pci0:<serial bus, SMBus>  at device 31.3 (no driver attached)
> >> acpi_button0:<Power Button>  on acpi0
> >> hpet0:<High Precision Event Timer>  iomem 0xfed00000-0xfed003ff on
> acpi0
> >> ahcich0:<AHCI channel>  at channel 0 on ahci0
> >> ahcich1:<AHCI channel>  at channel 1 on ahci0
> >> ahcich2:<AHCI channel>  at channel 2 on ahci0
> >> ahcich3:<AHCI channel>  at channel 3 on ahci0
> >> ahcich4:<AHCI channel>  at channel 4 on ahci0
> >> ahcich5:<AHCI channel>  at channel 5 on ahci0
> >> pci0:<serial bus, SMBus>  at device 31.3 (no driver attached)
> >> acpi_button0:<Power Button>  on acpi0
> >> hpet0:<High Precision Event Timer>  iomem 0xfed00000-0xfed003ff on
> acpi0
> >> Timecounter "HPET" frequency 14318180 Hz quality 950
> >> Event timer "HPET" frequency 14318180 Hz quality 550
> >> Event timer "HPET1" frequency 14318180 Hz quality 440
> >> Event timer "HPET2" frequency 14318180 Hz quality 440
> >> Event timer "HPET3" frequency 14318180 Hz quality 440
> >> Event timer "HPET4" frequency 14318180 Hz quality 440
> >> attimer0:<AT timer>  port 0x40-0x43 irq 0 on acpi0
> >> Timecounter "i8254" frequency 1193182 Hz quality 0
> >> Event timer "i8254" frequency 1193182 Hz quality 100
> >> atrtc0:<AT realtime clock>  port 0x70-0x71 irq 8 on acpi0
> >> Event timer "RTC" frequency 32768 Hz quality 0
> >> atkbdc0:<Keyboard controller (i8042)>  port 0x60,0x64 irq 1 on acpi0
> >> atkbd0:<AT Keyboard>  irq 1 on atkbdc0
> >> kbd0 at atkbd0
> >> atkbd0: [GIANT-LOCKED]
> >> uart0:<16550 or compatible>  port 0x3f8-0x3ff irq 4 flags 0x10 on
> acpi0
> >> uart1:<16550 or compatible>  port 0x2f8-0x2ff irq 3 on acpi0
> >> uart2:<16550 or compatible>  port 0x3e8-0x3ef irq 10 on acpi0
> >> orm0:<ISA Option ROMs>  at iomem 0xc0000-0xc7fff,0xc8000-0xcdfff on
> isa0
> >> sc0:<System console>  at flags 0x100 on isa0
> >> sc0: VGA<16 virtual consoles, flags=0x300>
> >> vga0:<Generic ISA VGA>  at port 0x3c0-0x3df iomem 0xa0000-0xbffff on
> >> isa0
> >> ppc0: cannot reserve I/O port range
> >> est0:<Enhanced SpeedStep Frequency Control>  on cpu0
> >> p4tcc0:<CPU Frequency Thermal Control>  on cpu0
> >> est1:<Enhanced SpeedStep Frequency Control>  on cpu1
> >> p4tcc1:<CPU Frequency Thermal Control>  on cpu1
> >> est2:<Enhanced SpeedStep Frequency Control>  on cpu2
> >> p4tcc2:<CPU Frequency Thermal Control>  on cpu2
> >> est3:<Enhanced SpeedStep Frequency Control>  on cpu3
> >> p4tcc3:<CPU Frequency Thermal Control>  on cpu3
> >> ZFS filesystem version 5
> >> ZFS storage pool version 28
> >> Timecounters tick every 1.000 msec
> >> usbus0: 480Mbps High Speed USB v2.0
> >> usbus1: 480Mbps High Speed USB v2.0
> >> ugen0.1:<Intel>  at usbus0
> >> uhub0:<Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1>  on
> usbus0
> >> ugen1.1:<Intel>  at usbus1
> >> uhub1:<Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1>  on
> usbus1
> >> da0 at mps0 bus 0 scbus0 target 8 lun 0
> >> da0:<ATA WDC WD800JD-60LS 1D07>  Fixed Direct Access SCSI-6 device
> >> da0: 300.000MB/s transfers
> >> da0: Command Queueing enabled
> >> da0: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da1 at mps0 bus 0 scbus0 target 9 lun 0
> >> da1:<ATA WDC WD800JD-60LS 1D07>  Fixed Direct Access SCSI-6 device
> >> da1: 300.000MB/s transfers
> >> da1: Command Queueing enabled
> >> da1: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da2 at mps0 bus 0 scbus0 target 10 lun 0
> >> da2:<ATA WDC WD2500AAJS-6 2E25>  Fixed Direct Access SCSI-6 device
> >> da2: 300.000MB/s transfers
> >> da2: Command Queueing enabled
> >> da2: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da3 at mps0 bus 0 scbus0 target 11 lun 0
> >> da3:<ATA WDC WD2500JS-60M 2E04>  Fixed Direct Access SCSI-6 device
> >> da3: 300.000MB/s transfers
> >> da3: Command Queueing enabled
> >> da3: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da4 at mps0 bus 0 scbus0 target 12 lun 0
> >> da4:<ATA WDC WD2500JS-60M 2E04>  Fixed Direct Access SCSI-6 device
> >> da4: 300.000MB/s transfers
> >> da4: Command Queueing enabled
> >> da4: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da5 at mps0 bus 0 scbus0 target 13 lun 0
> >> da5:<ATA ST3250620NS BJH>  Fixed Direct Access SCSI-6 device
> >> da5: 150.000MB/s transfers
> >> da5: Command Queueing enabled
> >> da5: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da8 at mps0 bus 0 scbus0 target 19 lun 0
> >> da8:<ATA WDC WD800JD-60LS 1D07>  Fixed Direct Access SCSI-6 device
> >> da8: 300.000MB/s transfers
> >> da8: Command Queueing enabled
> >> da8: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da9 at mps0 bus 0 scbus0 target 20 lun 0
> >> da9:<ATA WDC WD800JD-60LU 1D07>  Fixed Direct Access SCSI-6 device
> >> da9: 300.000MB/s transfers
> >> da9: Command Queueing enabled
> >> da9: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da11 at mps0 bus 0 scbus0 target 22 lun 0
> >> da11:<ATA ST3250620NS 3BJP>  Fixed Direct Access SCSI-6 device
> >> da11: 150.000MB/s transfers
> >> da11: Command Queueing enabled
> >> da11: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da12 at mps0 bus 0 scbus0 target 23 lun 0
> >> da12:<ATA ST3250620NS 3BJP>  Fixed Direct Access SCSI-6 device
> >> da12: 150.000MB/s transfers
> >> da12: Command Queueing enabled
> >> da12: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da13 at mps0 bus 0 scbus0 target 24 lun 0
> >> da13:<ATA ST3250620NS 3BJP>  Fixed Direct Access SCSI-6 device
> >> da13: 150.000MB/s transfers
> >> da13: Command Queueing enabled
> >> da13: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da14 at mps0 bus 0 scbus0 target 27 lun 0
> >> da14:<ATA ST3250310AS B>  Fixed Direct Access SCSI-6 device
> >> da14: 300.000MB/s transfers
> >> da14: Command Queueing enabled
> >> da14: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> da15 at mps0 bus 0 scbus0 target 28 lun 0
> >> da15:<ATA ST3250620NS 3BJP>  Fixed Direct Access SCSI-6 device
> >> da15: 150.000MB/s transfers
> >> da15: Command Queueing enabled
> >> da15: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> ses0 at mps0 bus 0 scbus0 target 16 lun 0
> >> ses0:<LSI CORP SAS2X28 0717>  Fixed Enclosure Services SCSI-5 device
> >> ses0: 600.000MB/s transfers
> >> ses0: Command Queueing enabled
> >> ses0: SCSI-3 SES Device
> >> ada0 at ahcich0 bus 0 scbus1 target 0 lun 0
> >> ada0:<ST3808110AS 3.AJJ>  ATA-7 SATA 1.x device
> >> ada0: 150.000MB/s transfers (SATA 1.x, UDMA5, PIO 8192bytes)
> >> ada0: 76319MB (156301488 512 byte sectors: 16H 63S/T 16383C)
> >> ada0: Previously was known as ad4
> >> cd0 at ahcich2 bus 0 scbus3 target 0 lun 0
> >> SMP: AP CPU #3 Launched!
> >> cd0:<TSSTcorp CDDVDW SN-208BB SB00>  Removable CD-ROM SCSI-0 device
> >> cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO
> >> 8192bytes)
> >> cd0: Attempt to query device size failed: NOT READY, Medium not
> present
> >> - tray closed
> >> SMP: AP CPU #2 Launched!
> >> SMP: AP CPU #1 Launched!
> >> da6 at mps0 bus 0 scbus0 target 17 lun 0
> >> da6:<ATA Maxtor 6L080M0 1G10>  Fixed Direct Access SCSI-6 device
> >> da6: 150.000MB/s transfers
> >> da6: Command Queueing enabled
> >> da6: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da7 at mps0 bus 0 scbus0 target 18 lun 0
> >> da7:<ATA Maxtor 6L080M0 1G10>  Fixed Direct Access SCSI-6 device
> >> da7: 150.000MB/s transfers
> >> da7: Command Queueing enabled
> >> da7: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
> >> da10 at mps0 bus 0 scbus0 target 21 lun 0
> >> da10:<ATA GB0250EAFJF HPG6>  Fixed Direct Access SCSI-6 device
> >> da10: 300.000MB/s transfers
> >> da10: Command Queueing enabled
> >> da10: 238475MB (488397168 512 byte sectors: 255H 63S/T 30401C)
> >> GEOM: da15s1: geometry does not match label (16h,63s != 255h,63s).
> >> uhub1: 2 ports with 2 removable, self powered
> >> uhub0: 2 ports with 2 removable, self powered
> >> Root mount waiting for: usbus1 usbus0
> >> ugen0.2:<vendor 0x8087>  at usbus0
> >> uhub2:<vendor 0x8087 product 0x0024, class 9/0, rev 2.00/0.00, addr
> 2>
> >> on usbus0
> >> ugen1.2:<vendor 0x8087>  at usbus1
> >> uhub3:<vendor 0x8087 product 0x0024, class 9/0, rev 2.00/0.00, addr
> 2>
> >> on usbus1
> >> Root mount waiting for: usbus1 usbus0
> >> uhub3: 6 ports with 6 removable, self powered
> >> uhub2: 6 ports with 6 removable, self powered
> >> ugen0.3:<Winbond Electronics Corp>  at usbus0
> >> ums0:<Winbond Electronics Corp Hermon USB hidmouse Device, class 0/0,
> >> rev 1.10/0.01, addr 3>  on usbus0
> >> ums0: 3 buttons and [Z] coordinates ID=0
> >> ukbd0:<Winbond Electronics Corp Hermon USB hidmouse Device, class
> 0/0,
> >> rev 1.10/0.01, addr 3>  on usbus0
> >> kbd2 at ukbd0
> >> Trying to mount root from ufs:/dev/ada0p2 [rw]...
> >> em0: link state changed to UP
> >>
> >> thanks for your work.
> >>
> >> regards
> >> Johan
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> freebsd-stable@freebsd.org mailing list
> >> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> >> To unsubscribe, send any mail to "freebsd-stable-
> >> unsubscribe@freebsd.org"
>
> Ok i will try the patch, no hurry, i am back at the office on monday...
> regards
> Johan

[-- Attachment #2 --]
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps.c FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps.c
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps.c	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps.c	2012-01-17 04:32:15.000000000 +0530
@@ -529,7 +529,7 @@ mps_enqueue_request(struct mps_softc *sc
 	mps_dprint(sc, MPS_TRACE, "%s SMID %u cm %p ccb %p\n", __func__,
 	    cm->cm_desc.Default.SMID, cm, cm->cm_ccb);
 
-	if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE)
+	if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE && !(sc->mps_flags & MPS_FLAGS_SHUTDOWN))
 		mtx_assert(&sc->mps_mtx, MA_OWNED);
 
 	if (++sc->io_cmds_active > sc->io_cmds_highwater)
@@ -1342,6 +1342,8 @@ mps_free(struct mps_softc *sc)
 	    ((error = mps_detach_sas(sc)) != 0))
 		return (error);
 
+	mps_detach_user(sc);
+
 	/* Put the IOC back in the READY state. */
 	mps_lock(sc);
 	if ((error = mps_transition_ready(sc)) != 0) {
@@ -2149,7 +2151,7 @@ mps_wait_command(struct mps_softc *sc, s
 	error = mps_map_command(sc, cm);
 	if ((error != 0) && (error != EINPROGRESS))
 		return (error);
-	error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout);
+	error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz);
 	if (error == EWOULDBLOCK)
 		error = ETIMEDOUT;
 	return (error);
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas.c FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas.c
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas.c	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas.c	2012-01-17 04:32:15.000000000 +0530
@@ -138,7 +138,6 @@ static uint8_t op_code_prot[256] = {
 
 MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory");
 
-static struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t);
 static void mpssas_discovery_timeout(void *data);
 static void mpssas_remove_device(struct mps_softc *, struct mps_command *);
 static void mpssas_remove_complete(struct mps_softc *, struct mps_command *);
@@ -169,7 +168,7 @@ static int mpssas_send_portenable(struct
 static void mpssas_portenable_complete(struct mps_softc *sc,
     struct mps_command *cm);
 
-static struct mpssas_target *
+struct mpssas_target *
 mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t handle)
 {
 	struct mpssas_target *target;
@@ -342,22 +341,123 @@ static void mpssas_log_command(struct mp
 	va_end(ap);
 }
 
+
 static void
-mpssas_lost_target(struct mps_softc *sc, struct mpssas_target *targ)
+mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm)
 {
-	struct mpssas_softc *sassc = sc->sassc;
-	path_id_t pathid = cam_sim_path(sassc->sim);
-	struct cam_path *path;
+	MPI2_SCSI_TASK_MANAGE_REPLY *reply;
+	struct mpssas_target *targ;
+	uint16_t handle;
+
+	mps_dprint(sc, MPS_INFO, "%s\n", __func__);
+
+	reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
+	handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
+	targ = tm->cm_targ;
 
-	mps_printf(sc, "%s targetid %u\n", __func__, targ->tid);
-	if (xpt_create_path(&path, NULL, pathid, targ->tid, 0) != CAM_REQ_CMP) {
-		mps_printf(sc, "unable to create path for lost target %d\n", 
-		    targ->tid);
+	if (reply == NULL) {
+		/* XXX retry the remove after the diag reset completes? */
+		mps_printf(sc, "%s NULL reply reseting device 0x%04x\n", 
+		    __func__, handle);
+		mpssas_free_tm(sc, tm);
 		return;
 	}
 
-	xpt_async(AC_LOST_DEVICE, path, NULL);
-	xpt_free_path(path);
+	if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) {
+		mps_printf(sc, "IOCStatus = 0x%x while resetting device 0x%x\n",
+		   reply->IOCStatus, handle);
+		mpssas_free_tm(sc, tm);
+		return;
+	}
+
+	mps_printf(sc, "Reset aborted %u commands\n", reply->TerminationCount);
+	mps_free_reply(sc, tm->cm_reply_data);
+	tm->cm_reply = NULL;	/* Ensures the the reply won't get re-freed */
+
+	mps_printf(sc, "clearing target %u handle 0x%04x\n", targ->tid, handle);
+	
+	/*
+	 * Don't clear target if remove fails because things will get confusing.
+	 * Leave the devname and sasaddr intact so that we know to avoid reusing
+	 * this target id if possible, and so we can assign the same target id
+	 * to this device if it comes back in the future.
+	 */
+	if (reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) {
+		targ = tm->cm_targ;
+		targ->handle = 0x0;
+		targ->encl_handle = 0x0;
+		targ->encl_slot = 0x0;
+		targ->exp_dev_handle = 0x0;
+		targ->phy_num = 0x0;
+		targ->linkrate = 0x0;
+		targ->devinfo = 0x0;
+		targ->flags = 0x0;
+	}
+
+	mpssas_free_tm(sc, tm);
+}
+
+
+/*
+ * No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal.
+ * Otherwise Volume Delete is same as Bare Drive Removal.
+ */
+void
+mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle)
+{
+	MPI2_SCSI_TASK_MANAGE_REQUEST *req;
+	struct mps_softc *sc;
+	struct mps_command *cm;
+	struct mpssas_target *targ = NULL;
+
+	mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__);
+	sc = sassc->sc;
+
+#ifdef WD_SUPPORT
+	/*
+	 * If this is a WD controller, determine if the disk should be exposed
+	 * to the OS or not.  If disk should be exposed, return from this
+	 * function without doing anything.
+	 */
+	if (sc->WD_available && (sc->WD_hide_expose ==
+	    MPS_WD_EXPOSE_ALWAYS)) {
+		return;
+	}
+#endif //WD_SUPPORT
+
+	targ = mpssas_find_target_by_handle(sassc, 0, handle);
+	if (targ == NULL) {
+		/* FIXME: what is the action? */
+		/* We don't know about this device? */
+		printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
+		return;
+	}
+
+	targ->flags |= MPSSAS_TARGET_INREMOVAL;
+
+	cm = mpssas_alloc_tm(sc);
+	if (cm == NULL) {
+		mps_printf(sc, "%s: command alloc failure\n", __func__);
+		return;
+	}
+
+	mpssas_rescan_target(sc, targ);
+
+	req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req;
+	req->DevHandle = targ->handle;
+	req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
+	req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
+
+	/* SAS Hard Link Reset / SATA Link Reset */
+	req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
+
+	cm->cm_targ = targ;
+	cm->cm_data = NULL;
+	cm->cm_desc.HighPriority.RequestFlags =
+	    MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
+	cm->cm_complete = mpssas_remove_volume;
+	cm->cm_complete_data = (void *)(uintptr_t)handle;
+	mps_map_command(sc, cm);
 }
 
 /*
@@ -377,7 +477,7 @@ mpssas_prepare_remove(struct mpssas_soft
 	struct mps_command *cm;
 	struct mpssas_target *targ = NULL;
 
-	mps_dprint(sassc->sc, MPS_TRACE, "%s\n", __func__);
+	mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__);
 
 	/*
 	 * If this is a WD controller, determine if the disk should be exposed
@@ -394,7 +494,7 @@ mpssas_prepare_remove(struct mpssas_soft
 	if (targ == NULL) {
 		/* FIXME: what is the action? */
 		/* We don't know about this device? */
-		printf("%s: invalid handle 0x%x \n", __func__, handle);
+		printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
 		return;
 	}
 
@@ -406,7 +506,7 @@ mpssas_prepare_remove(struct mpssas_soft
 		return;
 	}
 
-	mpssas_lost_target(sc, targ);
+	mpssas_rescan_target(sc, targ);
 
 	req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req;
 	memset(req, 0, sizeof(*req));
@@ -434,7 +534,7 @@ mpssas_remove_device(struct mps_softc *s
 	struct mps_command *next_cm;
 	uint16_t handle;
 
-	mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+	mps_dprint(sc, MPS_INFO, "%s\n", __func__);
 
 	reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
 	handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
@@ -505,7 +605,7 @@ mpssas_remove_complete(struct mps_softc 
 	uint16_t handle;
 	struct mpssas_target *targ;
 
-	mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+	mps_dprint(sc, MPS_INFO, "%s\n", __func__);
 
 	reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply;
 	handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
@@ -549,6 +649,7 @@ mpssas_remove_complete(struct mps_softc 
 		targ->phy_num = 0x0;
 		targ->linkrate = 0x0;
 		targ->devinfo = 0x0;
+		targ->flags = 0x0;
 	}
 
 	mpssas_free_tm(sc, tm);
@@ -670,7 +771,7 @@ mps_detach_sas(struct mps_softc *sc)
 {
 	struct mpssas_softc *sassc;
 
-	mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
+	mps_dprint(sc, MPS_INFO, "%s\n", __func__);
 
 	if (sc->sassc == NULL)
 		return (0);
@@ -706,6 +807,7 @@ mps_detach_sas(struct mps_softc *sc)
 	}
 	mps_unlock(sc);
 
+	mps_dprint(sc, MPS_INFO, "%s:%d\n", __func__,__LINE__);
 	if (sassc->devq != NULL)
 		cam_simq_free(sassc->devq);
 
@@ -1442,11 +1544,11 @@ mpssas_action_scsiio(struct mpssas_softc
 	uint16_t eedp_flags;
 
 	sc = sassc->sc;
-	mps_dprint(sc, MPS_TRACE, "%s ccb %p\n", __func__, ccb);
 	mtx_assert(&sc->mps_mtx, MA_OWNED);
 
 	csio = &ccb->csio;
 	targ = &sassc->targets[csio->ccb_h.target_id];
+	mps_dprint(sc, MPS_TRACE, "%s ccb %p target flag %x\n", __func__, ccb, targ->flags);
 	if (targ->handle == 0x0) {
 		mps_dprint(sc, MPS_TRACE, "%s NULL handle for target %u\n", 
 		    __func__, csio->ccb_h.target_id);
@@ -1454,6 +1556,13 @@ mpssas_action_scsiio(struct mpssas_softc
 		xpt_done(ccb);
 		return;
 	}
+	if (targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT) {
+		mps_dprint(sc, MPS_TRACE, "%s Raid component no SCSI IO supported %u\n", 
+		    __func__, csio->ccb_h.target_id);
+		csio->ccb_h.status = CAM_TID_INVALID;
+		xpt_done(ccb);
+		return;
+	}
 	/*
 	 * If devinfo is 0 this will be a volume.  In that case don't tell CAM
 	 * that the volume has timed out.  We want volumes to be enumerated
@@ -1651,6 +1760,198 @@ mpssas_action_scsiio(struct mpssas_softc
 }
 
 static void
+mps_response_code(struct mps_softc *sc, u8 response_code)
+{
+        char *desc;
+ 
+        switch (response_code) {
+        case MPI2_SCSITASKMGMT_RSP_TM_COMPLETE:
+                desc = "task management request completed";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_INVALID_FRAME:
+                desc = "invalid frame";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED:
+                desc = "task management request not supported";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_TM_FAILED:
+                desc = "task management request failed";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED:
+                desc = "task management request succeeded";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_TM_INVALID_LUN:
+                desc = "invalid lun";
+                break;
+        case 0xA:
+                desc = "overlapped tag attempted";
+                break;
+        case MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC:
+                desc = "task queued, however not sent to target";
+                break;
+        default:
+                desc = "unknown";
+                break;
+        }
+		mps_dprint(sc, MPS_INFO, "response_code(0x%01x): %s\n",
+                response_code, desc);
+}
+/**
+ * mps_sc_failed_io_info - translated non-succesfull SCSI_IO request
+ */
+static void
+mps_sc_failed_io_info(struct mps_softc *sc, struct ccb_scsiio *csio,
+    Mpi2SCSIIOReply_t *mpi_reply)
+{
+	u32 response_info;
+	u8 *response_bytes;
+	u16 ioc_status = le16toh(mpi_reply->IOCStatus) &
+	    MPI2_IOCSTATUS_MASK;
+	u8 scsi_state = mpi_reply->SCSIState;
+	u8 scsi_status = mpi_reply->SCSIStatus;
+	char *desc_ioc_state = NULL;
+	char *desc_scsi_status = NULL;
+	char *desc_scsi_state = sc->tmp_string;
+	u32 log_info = le32toh(mpi_reply->IOCLogInfo);
+	
+	if (log_info == 0x31170000)
+		return;
+
+	switch (ioc_status) {
+	case MPI2_IOCSTATUS_SUCCESS:
+		desc_ioc_state = "success";
+		break;
+	case MPI2_IOCSTATUS_INVALID_FUNCTION:
+		desc_ioc_state = "invalid function";
+		break;
+	case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR:
+		desc_ioc_state = "scsi recovered error";
+		break;
+	case MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE:
+		desc_ioc_state = "scsi invalid dev handle";
+		break;
+	case MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE:
+		desc_ioc_state = "scsi device not there";
+		break;
+	case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN:
+		desc_ioc_state = "scsi data overrun";
+		break;
+	case MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN:
+		desc_ioc_state = "scsi data underrun";
+		break;
+	case MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR:
+		desc_ioc_state = "scsi io data error";
+		break;
+	case MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR:
+		desc_ioc_state = "scsi protocol error";
+		break;
+	case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED:
+		desc_ioc_state = "scsi task terminated";
+		break;
+	case MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
+		desc_ioc_state = "scsi residual mismatch";
+		break;
+	case MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
+		desc_ioc_state = "scsi task mgmt failed";
+		break;
+	case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED:
+		desc_ioc_state = "scsi ioc terminated";
+		break;
+	case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
+		desc_ioc_state = "scsi ext terminated";
+		break;
+	case MPI2_IOCSTATUS_EEDP_GUARD_ERROR:
+		desc_ioc_state = "eedp guard error";
+		break;
+	case MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR:
+		desc_ioc_state = "eedp ref tag error";
+		break;
+	case MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR:
+		desc_ioc_state = "eedp app tag error";
+		break;
+	default:
+		desc_ioc_state = "unknown";
+		break;
+	}
+
+	switch (scsi_status) {
+	case MPI2_SCSI_STATUS_GOOD:
+		desc_scsi_status = "good";
+		break;
+	case MPI2_SCSI_STATUS_CHECK_CONDITION:
+		desc_scsi_status = "check condition";
+		break;
+	case MPI2_SCSI_STATUS_CONDITION_MET:
+		desc_scsi_status = "condition met";
+		break;
+	case MPI2_SCSI_STATUS_BUSY:
+		desc_scsi_status = "busy";
+		break;
+	case MPI2_SCSI_STATUS_INTERMEDIATE:
+		desc_scsi_status = "intermediate";
+		break;
+	case MPI2_SCSI_STATUS_INTERMEDIATE_CONDMET:
+		desc_scsi_status = "intermediate condmet";
+		break;
+	case MPI2_SCSI_STATUS_RESERVATION_CONFLICT:
+		desc_scsi_status = "reservation conflict";
+		break;
+	case MPI2_SCSI_STATUS_COMMAND_TERMINATED:
+		desc_scsi_status = "command terminated";
+		break;
+	case MPI2_SCSI_STATUS_TASK_SET_FULL:
+		desc_scsi_status = "task set full";
+		break;
+	case MPI2_SCSI_STATUS_ACA_ACTIVE:
+		desc_scsi_status = "aca active";
+		break;
+	case MPI2_SCSI_STATUS_TASK_ABORTED:
+		desc_scsi_status = "task aborted";
+		break;
+	default:
+		desc_scsi_status = "unknown";
+		break;
+	}
+
+	desc_scsi_state[0] = '\0';
+	if (!scsi_state)
+		desc_scsi_state = " ";
+	if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
+		strcat(desc_scsi_state, "response info ");
+	if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
+		strcat(desc_scsi_state, "state terminated ");
+	if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS)
+		strcat(desc_scsi_state, "no status ");
+	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED)
+		strcat(desc_scsi_state, "autosense failed ");
+	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
+		strcat(desc_scsi_state, "autosense valid ");
+
+	mps_dprint(sc, MPS_INFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x), \n",
+		le16toh(mpi_reply->DevHandle),
+	    desc_ioc_state, ioc_status);
+	/* We can add more detail about underflow data here
+	 * TO-DO
+	 * */
+	mps_dprint(sc, MPS_INFO, "\tscsi_status(%s)(0x%02x), "
+	    "scsi_state(%s)(0x%02x)\n", desc_scsi_status,
+	    scsi_status, desc_scsi_state, scsi_state);
+
+	if (sc->mps_debug & MPS_INFO &&
+		scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
+		mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : Start :\n");
+		scsi_sense_print(csio);
+		mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : End :\n");
+	}
+
+	if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
+		response_info = le32toh(mpi_reply->ResponseInfo);
+		response_bytes = (u8 *)&response_info;
+		mps_response_code(sc,response_bytes[0]);
+	}
+}
+
+static void
 mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
 {
 	MPI2_SCSI_IO_REPLY *rep;
@@ -1976,6 +2277,8 @@ mpssas_scsiio_complete(struct mps_softc 
 		ccb->ccb_h.status = CAM_REQ_CMP_ERR;
 		break;
 	}
+	
+	mps_sc_failed_io_info(sc,csio,rep);
 
 	if (sassc->flags & MPSSAS_QUEUE_FROZEN) {
 		ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
@@ -2754,17 +3057,26 @@ mpssas_scanner_thread(void *arg)
 
 	mps_lock(sc);
 	for (;;) {
+		/* Sleep for 1 second and check the queue status*/
 		msleep(&sassc->ccb_scanq, &sc->mps_mtx, PRIBIO,
-		       "mps_scanq", 0);
+		       "mps_scanq", 1 * hz);
 		if (sassc->flags & MPSSAS_SHUTDOWN) {
 			mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n");
 			break;
 		}
+next_work:
+		// Get first work.
 		ccb = (union ccb *)TAILQ_FIRST(&sassc->ccb_scanq);
 		if (ccb == NULL)
 			continue;
+		// Got first work.
 		TAILQ_REMOVE(&sassc->ccb_scanq, &ccb->ccb_h, sim_links.tqe);
 		xpt_action(ccb);
+		if (sassc->flags & MPSSAS_SHUTDOWN) {
+			mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n");
+			break;
+		}
+		goto next_work;
 	}
 
 	sassc->flags &= ~MPSSAS_SCANTHREAD;
@@ -2827,7 +3139,7 @@ mpssas_check_eedp(struct mpssas_softc *s
 		do {
 			rcap_buf =
 			    malloc(sizeof(struct scsi_read_capacity_eedp),
-			    M_MPT2, M_WAITOK | M_ZERO);
+			    M_MPT2, M_NOWAIT| M_ZERO);
 			if (rcap_buf == NULL) {
 				mps_dprint(sc, MPS_FAULT, "Unable to alloc read "
 				    "capacity buffer for EEDP support.\n");
@@ -2869,7 +3181,7 @@ mpssas_check_eedp(struct mpssas_softc *s
 				}
 				if (!found_lun) {
 					lun = malloc(sizeof(struct mpssas_lun),
-					    M_MPT2, M_WAITOK | M_ZERO);
+					    M_MPT2, M_NOWAIT | M_ZERO);
 					if (lun == NULL) {
 						mps_dprint(sc, MPS_FAULT,
 						    "Unable to alloc LUN for "
@@ -2943,6 +3255,20 @@ mpssas_read_cap_done(struct cam_periph *
 
 	if (done_ccb == NULL)
 		return;
+	
+	/* Driver need to release devq, it Scsi command is
+	 * generated by driver internally.
+	 * Currently there is a single place where driver
+	 * calls scsi command internally. In future if driver
+	 * calls more scsi command internally, it needs to release
+	 * devq internally, since those command will not go back to
+	 * cam_periph.
+	 */
+	if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) ) {
+        	done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
+		xpt_release_devq(done_ccb->ccb_h.path,
+			       	/*count*/ 1, /*run_queue*/TRUE);
+	}
 
 	/*
 	 * Get the LUN ID for the path and look it up in the LUN list for the
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas.h FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas.h
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas.h	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas.h	2012-01-17 04:32:15.000000000 +0530
@@ -49,8 +49,11 @@ struct mpssas_target {
 #define MPSSAS_TARGET_INRESET	(1 << 1)
 #define MPSSAS_TARGET_INDIAGRESET (1 << 2)
 #define MPSSAS_TARGET_INREMOVAL	(1 << 3)
+#define MPS_TARGET_FLAGS_RAID_COMPONENT (1 << 4)
+#define MPS_TARGET_FLAGS_VOLUME         (1 << 5)
 #define MPSSAS_TARGET_INRECOVERY (MPSSAS_TARGET_INABORT | \
     MPSSAS_TARGET_INRESET | MPSSAS_TARGET_INCHIPRESET)
+
 #define MPSSAS_TARGET_ADD       (1 << 29)
 #define MPSSAS_TARGET_REMOVE    (1 << 30)
 	uint16_t	tid;
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas_lsi.c FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas_lsi.c
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_sas_lsi.c	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_sas_lsi.c	2012-01-17 04:32:15.000000000 +0530
@@ -107,7 +107,7 @@ struct _ata_identify_device_data {
 	u16 model_number[20];	/* 27-46*/
 	u16 reserved3[209];	/* 47-255*/
 };
-
+static u32 event_count;
 static void mpssas_fw_work(struct mps_softc *sc,
     struct mps_fw_event_work *fw_event);
 static void mpssas_fw_event_free(struct mps_softc *,
@@ -119,7 +119,7 @@ static int mpssas_get_sata_identify(stru
 int mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc,
     u64 *sas_address, u16 handle, u32 device_info);
 static int mpssas_volume_add(struct mps_softc *sc,
-    Mpi2EventIrConfigElement_t *element);
+    u16 handle);
 
 void
 mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
@@ -191,6 +191,8 @@ mpssas_fw_work(struct mps_softc *sc, str
 	struct mpssas_softc *sassc;
 	sassc = sc->sassc;
 
+	mps_dprint(sc, MPS_INFO, "(%d)->(%s) Working on  Event: [%x]\n",
+			event_count++,__func__,fw_event->event);
 	switch (fw_event->event) {
 	case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: 
 	{
@@ -284,7 +286,7 @@ mpssas_fw_work(struct mps_softc *sc, str
 			case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED:
 			case MPI2_EVENT_IR_CHANGE_RC_ADDED:
 				if (!foreign_config) {
-					if (mpssas_volume_add(sc, element)) {
+					if (mpssas_volume_add(sc, le16toh(element->VolDevHandle))){
 						printf("%s: failed to add RAID "
 						    "volume with handle 0x%x\n",
 						    __func__, le16toh(element->
@@ -319,12 +321,18 @@ mpssas_fw_work(struct mps_softc *sc, str
 				}
 				break;
 			case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED:
+			case MPI2_EVENT_IR_CHANGE_RC_HIDE:
 				/*
 				 * Phys Disk of a volume has been created.  Hide
 				 * it from the OS.
 				 */
-				mpssas_prepare_remove(sassc, element->
-				    PhysDiskDevHandle);
+				targ = mpssas_find_target_by_handle(sassc, 0, element->PhysDiskDevHandle);
+				if (targ == NULL) 
+					break;
+
+				targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT;
+				mpssas_rescan_target(sc, targ);
+				
 				break;
 			case MPI2_EVENT_IR_CHANGE_RC_PD_DELETED:
 				/*
@@ -379,6 +387,35 @@ mpssas_fw_work(struct mps_softc *sc, str
 			    "handle 0x%x", event_data->PreviousValue,
 			    event_data->NewValue,
 			    event_data->VolDevHandle);
+				u32 state;
+				struct mpssas_target *targ;
+				state = le32toh(event_data->NewValue);
+				switch (state) {
+				case MPI2_RAID_VOL_STATE_MISSING:
+				case MPI2_RAID_VOL_STATE_FAILED:
+					mpssas_prepare_volume_remove(sassc, event_data->
+							VolDevHandle);
+					break;
+		 
+				case MPI2_RAID_VOL_STATE_ONLINE:
+				case MPI2_RAID_VOL_STATE_DEGRADED:
+				case MPI2_RAID_VOL_STATE_OPTIMAL:
+					targ = mpssas_find_target_by_handle(sassc, 0, event_data->VolDevHandle);
+					if (targ) {
+						printf("%s %d: Volume handle 0x%x is already added \n",
+							       	__func__, __LINE__ , event_data->VolDevHandle);
+						break;
+					}
+					if (mpssas_volume_add(sc, le16toh(event_data->VolDevHandle))) {
+						printf("%s: failed to add RAID "
+							"volume with handle 0x%x\n",
+							__func__, le16toh(event_data->
+							VolDevHandle));
+					}
+					break;
+				default:
+					break;
+				}
 			break;
 		default:
 			break;
@@ -389,6 +426,7 @@ mpssas_fw_work(struct mps_softc *sc, str
 	{
 		Mpi2EventDataIrPhysicalDisk_t *event_data =
 		    fw_event->event_data;
+		struct mpssas_target *targ;
 
 		/*
 		 * Informational only.
@@ -399,7 +437,7 @@ mpssas_fw_work(struct mps_softc *sc, str
 			mps_dprint(sc, MPS_INFO, "   Phys Disk Settings "
 			    "changed from 0x%x to 0x%x for Phys Disk Number "
 			    "%d and handle 0x%x at Enclosure handle 0x%x, Slot "
-			    "%d", event_data->PreviousValue,
+			    "%d\n", event_data->PreviousValue,
 			    event_data->NewValue, event_data->PhysDiskNum,
 			    event_data->PhysDiskDevHandle,
 			    event_data->EnclosureHandle, event_data->Slot);
@@ -407,7 +445,7 @@ mpssas_fw_work(struct mps_softc *sc, str
 		case MPI2_EVENT_IR_PHYSDISK_RC_STATUS_FLAGS_CHANGED:
 			mps_dprint(sc, MPS_INFO, "   Phys Disk Status changed "
 			    "from 0x%x to 0x%x for Phys Disk Number %d and "
-			    "handle 0x%x at Enclosure handle 0x%x, Slot %d",
+			    "handle 0x%x at Enclosure handle 0x%x, Slot %d\n",
 			    event_data->PreviousValue, event_data->NewValue,
 			    event_data->PhysDiskNum,
 			    event_data->PhysDiskDevHandle,
@@ -416,12 +454,38 @@ mpssas_fw_work(struct mps_softc *sc, str
 		case MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED:
 			mps_dprint(sc, MPS_INFO, "   Phys Disk State changed "
 			    "from 0x%x to 0x%x for Phys Disk Number %d and "
-			    "handle 0x%x at Enclosure handle 0x%x, Slot %d",
+			    "handle 0x%x at Enclosure handle 0x%x, Slot %d\n",
 			    event_data->PreviousValue, event_data->NewValue,
 			    event_data->PhysDiskNum,
 			    event_data->PhysDiskDevHandle,
 			    event_data->EnclosureHandle, event_data->Slot);
-			break;
+			switch (event_data->NewValue) {
+				case MPI2_RAID_PD_STATE_ONLINE:
+				case MPI2_RAID_PD_STATE_DEGRADED:
+				case MPI2_RAID_PD_STATE_REBUILDING:
+				case MPI2_RAID_PD_STATE_OPTIMAL:
+				case MPI2_RAID_PD_STATE_HOT_SPARE:
+					targ = mpssas_find_target_by_handle(sassc, 0, 
+							event_data->PhysDiskDevHandle);
+					if (targ) {
+						targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT;
+						printf("%s %d: Found Target for handle 0x%x.  \n",
+						__func__, __LINE__ , event_data->PhysDiskDevHandle);
+					}
+				break;
+				case MPI2_RAID_PD_STATE_OFFLINE:
+				case MPI2_RAID_PD_STATE_NOT_CONFIGURED:
+				case MPI2_RAID_PD_STATE_NOT_COMPATIBLE:
+				default:
+					targ = mpssas_find_target_by_handle(sassc, 0, 
+							event_data->PhysDiskDevHandle);
+					if (targ) {
+						targ->flags |= ~MPS_TARGET_FLAGS_RAID_COMPONENT;
+						printf("%s %d: Found Target for handle 0x%x.  \n",
+						__func__, __LINE__ , event_data->PhysDiskDevHandle);
+					}
+				break;
+			}
 		default:
 			break;
 		}
@@ -494,6 +558,7 @@ mpssas_fw_work(struct mps_softc *sc, str
 		break;
 
 	}
+	mps_dprint(sc, MPS_INFO, "(%d)->(%s) Event Free: [%x]\n",event_count,__func__, fw_event->event);
 	mpssas_fw_event_free(sc, fw_event);
 }
 
@@ -584,7 +649,7 @@ mpssas_add_device(struct mps_softc *sc, 
 		error = ENXIO;
 		goto out;
 	}
-	mps_vprintf(sc, "SAS Address from SAS device page0 = %jx\n",
+	mps_dprint(sc, MPS_INFO, "SAS Address from SAS device page0 = %jx\n",
 	    sas_address);
 	targ = &sassc->targets[id];
 	targ->devinfo = device_info;
@@ -605,12 +670,12 @@ mpssas_add_device(struct mps_softc *sc, 
 	TAILQ_INIT(&targ->timedout_commands);
 	SLIST_INIT(&targ->luns);
 	mps_describe_devinfo(targ->devinfo, devstring, 80);
-	mps_vprintf(sc, "Found device <%s> <%s> <0x%04x> <%d/%d>\n", devstring,
+	mps_dprint(sc, MPS_INFO, "Found device <%s> <%s> <0x%04x> <%d/%d>\n", devstring,
 	    mps_describe_table(mps_linkrate_names, targ->linkrate),
 	    targ->handle, targ->encl_handle, targ->encl_slot);
 	if ((sassc->flags & MPSSAS_IN_STARTUP) == 0)
 		mpssas_rescan_target(sc, targ);
-	mps_vprintf(sc, "Target id 0x%x added\n", targ->tid);
+	mps_dprint(sc, MPS_INFO, "Target id 0x%x added\n", targ->tid);
 out:
 	mpssas_startup_decrement(sassc);
 	return (error);
@@ -751,12 +816,11 @@ out:
 }
 
 static int
-mpssas_volume_add(struct mps_softc *sc, Mpi2EventIrConfigElement_t *element)
+mpssas_volume_add(struct mps_softc *sc, u16 handle)
 {
 	struct mpssas_softc *sassc;
 	struct mpssas_target *targ;
 	u64 wwid;
-	u16 handle = le16toh(element->VolDevHandle);
 	unsigned int id;
 	int error = 0;
 
@@ -855,7 +919,9 @@ mpssas_ir_shutdown(struct mps_softc *sc)
 	action->Function = MPI2_FUNCTION_RAID_ACTION;
 	action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
 	cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
+	mps_lock(sc);
 	mps_request_polled(sc, cm);
+	mps_unlock(sc);
 
 	/*
 	 * Don't check for reply, just leave.
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_user.c FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_user.c
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mps_user.c	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mps_user.c	2012-01-17 04:32:15.000000000 +0530
@@ -712,7 +712,7 @@ mps_user_command(struct mps_softc *sc, s
 	cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
 
 	mps_lock(sc);
-	err = mps_wait_command(sc, cm, 0);
+	err = mps_wait_command(sc, cm, 30);
 
 	if (err) {
 		mps_printf(sc, "%s: invalid request: error %d\n",
@@ -842,7 +842,7 @@ mps_user_pass_thru(struct mps_softc *sc,
 		cm->cm_complete = NULL;
 		cm->cm_complete_data = NULL;
 
-		err = mps_wait_command(sc, cm, 0);
+		err = mps_wait_command(sc, cm, 30);
 
 		if (err != 0) {
 			err = EIO;
@@ -979,7 +979,7 @@ mps_user_pass_thru(struct mps_softc *sc,
 
 	mps_lock(sc);
 
-	err = mps_wait_command(sc, cm, 0);
+	err = mps_wait_command(sc, cm, 30);
 
 	if (err) {
 		mps_printf(sc, "%s: invalid request: error %d\n", __func__,
@@ -1098,10 +1098,12 @@ mps_user_get_adapter_data(struct mps_sof
 	 * Need to get BIOS Config Page 3 for the BIOS Version.
 	 */
 	data->BiosVersion = 0;
+	mps_lock(sc);
 	if (mps_config_get_bios_pg3(sc, &mpi_reply, &config_page))
 		printf("%s: Error while retrieving BIOS Version\n", __func__);
 	else
 		data->BiosVersion = config_page.BiosVersion;
+	mps_unlock(sc);
 }
 
 static void
@@ -1194,7 +1196,7 @@ mps_post_fw_diag_buffer(struct mps_softc
 	/*
 	 * Send command synchronously.
 	 */
-	status = mps_wait_command(sc, cm, 0);
+	status = mps_wait_command(sc, cm, 30);
 	if (status) {
 		mps_printf(sc, "%s: invalid request: error %d\n", __func__,
 		    status);
@@ -1278,7 +1280,7 @@ mps_release_fw_diag_buffer(struct mps_so
 	/*
 	 * Send command synchronously.
 	 */
-	status = mps_wait_command(sc, cm, 0);
+	status = mps_wait_command(sc, cm, 30);
 	if (status) {
 		mps_printf(sc, "%s: invalid request: error %d\n", __func__,
 		    status);
diff -aurp FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mpsvar.h FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mpsvar.h
--- FREEBSD-SAS2-12.00.00.01/mpslsi-source-12.00.00.01/sys/dev/mps/mpsvar.h	2012-01-30 20:49:09.000000000 +0530
+++ FREEBSD-SAS2-12.255.00.02/mpslsi-source-12.255.00.02/sys/dev/mps/mpsvar.h	2012-01-17 04:32:15.000000000 +0530
@@ -78,6 +78,7 @@
 #define MPS_PERIODIC_DELAY	1	/* 1 second heartbeat/watchdog check */
 
 #define MPS_SCSI_RI_INVALID_FRAME	(0x00000002)
+#define MPS_STRING_LENGTH               64
 
 /*
  * host mapping related macro definitions
@@ -308,7 +309,7 @@ struct mps_softc {
 	struct callout			periodic;
 
 	struct mpssas_softc		*sassc;
-
+	char            tmp_string[MPS_STRING_LENGTH];
 	TAILQ_HEAD(, mps_command)	req_list;
 	TAILQ_HEAD(, mps_command)	high_priority_req_list;
 	TAILQ_HEAD(, mps_chain)		chain_list;
@@ -521,6 +522,12 @@ mps_free_command(struct mps_softc *sc, s
 	cm->cm_max_segs = 0;
 	cm->cm_lun = 0;
 	cm->cm_state = MPS_CM_STATE_FREE;
+	cm->cm_data = NULL;
+	cm->cm_length = 0;
+	cm->cm_out_len = 0;
+	cm->cm_sglsize = 0;
+	cm->cm_sge = NULL;
+
 	TAILQ_FOREACH_SAFE(chain, &cm->cm_chain_list, chain_link, chain_temp) {
 		TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link);
 		mps_free_chain(sc, chain);
@@ -749,7 +756,9 @@ void mps_mapping_ir_config_change_event(
 void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
     MPI2_EVENT_NOTIFICATION_REPLY *event);
 void mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle);
+void mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle);
 int mpssas_startup(struct mps_softc *sc);
+struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t);
 
 SYSCTL_DECL(_hw_mps);
 
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B2FD678A64EAAD45B089B123FDFC3ED729A3414E2E>