Commit Graph

413 Commits (master)

Author SHA1 Message Date
Maciej Trela 27234ab44f [SCSI] isci: remove unused 'isci_tmf->device' field
As the field was never set, isci_print_tmf() using 'isci_tmf->device'
sometimes causes a kernel crash if the dev_dbg() statement is enabled.
Remove the unused field both from isci_tmf struct definition and from
isci_print_tmf()

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:44:15 +04:00
Jeff Skirvin be168a3b89 [SCSI] isci: link speeds default to gen 2
Gen-3 operation is marginal, default to gen-2 for now.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:43:59 +04:00
Marcin Tomczak 6024d38b86 [SCSI] isci: performance-fix, shorten default "no outbound task" timeout
"No task timeout timer reduced from 20 to 2 This timer controls how
long the SCU hardware will hold open the TX side of the connection
before sending a DONE.  The timer allows the hardware to attempt to
optimize the DONE/CLOSE behavior to allow for new COMMAND IU to be
posted.  In practice closing the connection quicker is better."

Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:43:39 +04:00
Jeff Skirvin 9fee607f0b [SCSI] isci: oem parameter format v1.3 (cable select)
v1.3 allows the attenuation of the attached cables to be specified to
the driver in terms of 'short', 'medium', and 'long' (see probe_roms.h).
These settings (per phy) are retrieved from the platform oem-parameters
(BIOS rom) or via a module parameter override.

Reviewed-by: Jiangbi Liu <jiangbi.liu@intel.com>
Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:43:04 +04:00
Dave Jiang 594e566ae5 [SCSI] isci: oem parameter format v1.1 (ssc select)
v1.1 allows finer grained tuning of the SSC (spread-spectrum-clocking)
settings for SAS and SATA.  See notes in probe_roms.h

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:42:00 +04:00
Jeff Skirvin afd13a1f2b [SCSI] isci: update afe (analog-front-end) recipe for C1
C1 silicon requires updates to the phy tuning recipe and also support
for user provided cable selects (per-phy) for short, medium, and long
cables.  Default to 'short' awaiting support for selecting the cable via
oem parameters.

Reviewed-by: Jiangbi Liu <jiangbi.liu@intel.com>
Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:40:29 +04:00
Dan Williams 2e5da889d4 [SCSI] isci: cleanup oem parameter and recipe handling
Before updating the code to support the latest platform updates and
silicon revision cleanup some of the long deref chains.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:39:52 +04:00
Ben Hutchings 7d99b3abaf [SCSI] isci, firmware: Remove isci fallback parameter blob and generator
This parameter blob and generator program have been moved to the
linux-firmware.git repository.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:34:37 +04:00
Andrzej Jakowski 7000f7c71e [SCSI] isci: overriding max_concurr_spinup oem parameter by max(oem, user)
Fixes bug where max_concurr_spinup oem parameter should be
overriden by max_concurr_spinup user parameter. Override should
happen only when max_concurr_spinup user parameter is specified
in command line (greater than 0). Also this fix shortens variables
representing max_conxurr_spinup for oem and user parameters.

Signed-off-by: Andrzej Jakowski <andrzej.jakowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:23:18 +04:00
Dan Williams 52d7463433 [SCSI] isci: revert bcn filtering
The initial bcn filtering implementation was validated on a kernel
baseline that predated the switch to new libata error handling.  Also,
prior to that conversion we borrowed the mvsas MVS_DEV_EH approach to
prevent the unwanted extra ap->ops->phy_reset(ap) that occurred in the
ata_bus_probe() path.

After the conversion to new libata eh resets at discovery are more
frequent and get filtered prematurely by IDEV_EH.  The result is that
our bcn filtering has been blocked from running and at discovery and it
appears to stall discovery completion to the point of triggering hung
task timeouts.  So, revert the implementation for now.  When it returns
it will go into libsas proper.

The domain rediscovery that takes place due to ->lldd_I_T_nexus_reset()
events should now be properly waited for by the ata_port_wait_eh() call
in ata_port_probe().  So the hard coded delay in the isci
->lldd_I_T_nexus_reset() and other libsas drivers should help debounce
the libsas thread from seeing temporary device removals.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:23:01 +04:00
Jeff Skirvin 8e35a1398c [SCSI] isci: Fix hard reset timeout conditions.
A hard reset can timeout before or after the last phy in the
port goes away.  If after, then notify the OS that the last
phy has failed.

The recovery for the failed hard reset has been removed.
This recovery code was unecessary in that the link would
recover from the failure normally by a new link reset sequence
or hotplug of the remote device.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:22:41 +04:00
Jeff Skirvin 5412e25c55 [SCSI] isci: No need to manage the pending reset bit on pending requests.
The lldd does not need to look at or manage the pending device
reset bit in pending sas_tasks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:20:28 +04:00
Jeff Skirvin 3b34c169f8 [SCSI] isci: Remove redundant isci_request.ttype field.
Use the existing IREQ_TMF flag as a request type indicator.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:19:47 +04:00
Jeff Skirvin 98145cb722 [SCSI] isci: Fix task management for SMP, SATA and on dev remove.
libsas uses the LLDD abort task interface to handle I/O timeouts
in the SATA/STP and SMP discovery paths, so this change will terminate
STP/SMP requests. Also, if the device is gone, the lldd will prevent
libsas from further escalations in the error handler.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:17:48 +04:00
Jeff Skirvin db49c2d037 [SCSI] isci: No task_done callbacks in error handler paths.
libsas will cleanup pending sas_tasks after error handler
path functions are called; do not call task_done callbacks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:17:04 +04:00
Jeff Skirvin b343dff1a2 [SCSI] isci: Handle task request timeouts correctly.
In the case where "task" requests timeout (note that this class of
requests can also include SATA/STP soft reset FIS transmissions),
handle the case where the task was being managed by some call to
terminate the task request by completing both the tmf and the aborting
process.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:16:23 +04:00
Jeff Skirvin d689168222 [SCSI] isci: Fix tag leak in tasks and terminated requests.
Make sure terminated requests and completed task tags are freed.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:16:04 +04:00
Jeff Skirvin c2cb8a5fd7 [SCSI] isci: Immediately fail I/O to removed devices.
In the case where an I/O fails to start in isci_request_execute,
only allow retries if the device is not already gone.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:15:17 +04:00
Jeff Skirvin 0e2e27990e [SCSI] isci: Lookup device references through requests in completions.
The LLDD needs to obtain a reference to the device through the request
itself and not through the domain_device, because the
domain_device.lldd_dev is set to NULL early in the lldd_dev_gone call.
This relies on the fact that the isci_remote_device object is keeping a
seperate reference count of outstanding requests.  TODO: unify the
request count tracking with the isci_remote_device kref.

The failure signature of this condition looks like the following
log, where the important bits are the call to lldd_dev_gone followed
by a crash in isci_terminate_request_core:

[  229.151541] isci 0000:0b:00.0: isci_remote_device_gone: domain_device = ffff8801492d4800, isci_device = ffff880143c657d0, isci_port = ffff880143c63658
[  229.166007] isci 0000:0b:00.0: isci_remote_device_stop: isci_device = ffff880143c657d0
[  229.175317] isci 0000:0b:00.0: isci_terminate_pending_requests: idev=ffff880143c657d0 request=ffff88014741f000; task=ffff8801470f46c0 old_state=2
[  229.189702] isci 0000:0b:00.0: isci_terminate_request_core: device = ffff880143c657d0; request = ffff88014741f000
[  229.201339] isci 0000:0b:00.0: isci_terminate_request_core: before completion wait (ffff88014741f000/ffff880149715ad0)
[  229.213414] isci 0000:0b:00.0: sci_controller_process_completions: completion queue entry:0x8000a0e9
[  229.214401] BUG: unable to handle kernel NULL pointer dereference at 0000000000000228
[  229.214401] IP:jdskirvi-testlbo [<ffffffffa00a58be>] sci_request_completed_state_enter+0x50/0xafb [isci]
[  229.214401] PGD 13d19e067 PUD 13d104067 PMD 0
[  229.214401] Oops: 0000 [#1] SMP
[  229.214401] CPU 0 x kernel: [  226
[  229.214401] Modules linked in: ipv6 dm_multipath uinput nouveau snd_hda_codec_realtek snd_hda_intel ttm drm_kms_helper drm snd_hda_codec snd_hwdep snd_pcm snd_timer i2c_algo_bit isci snd libsas ioatdma mxm_wmi iTCO_wdt soundcore snd_page_alloc scsi_transport_sas iTCO_vendor_support wmi dca video i2c_i801 i2c_core [last unloaded: speedstep_lib]
[  229.214401]
[  229.214401] Pid: 5, comm: kworker/u:0 Not tainted 3.0.0-isci-11.7.29+ #30.353196] Buffer  Intel Corporation Stoakley/Pearlcity Workstation
[  229.214401] RIP: 0010:[<ffffffffa00a58be>] I/O error on dev [<ffffffffa00a58be>] sci_request_completed_state_enter+0x50/0xafb [isci]
[  229.214401] RSP: 0018:ffff88014fc03d20  EFLAGS: 00010046
[  229.214401] RAX: 0000000000000000 RBX: ffff88014741f000 RCX: 0000000000000000
[  229.214401] RDX: ffffffffa00b2c90 RSI: 0000000000000017 RDI: ffff88014741f0a0
[  229.214401] RBP: ffff88014fc03d90 R08: 0000000000000018 R09: 0000000000000000
[  229.214401] R10: 0000000000000000 R11: ffffffff81a17d98 R12: 000000000000001d
[  229.214401] R13: ffff8801470f46c0 R14: 0000000000000000 R15: 0000000000008000
[  229.214401] FS:  0000000000000000(0000) GS:ffff88014fc00000(0000) knlGS:0000000000000000
[  229.214401] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  229.214401] CR2: 0000000000000228 CR3: 000000013ceaa000 CR4: 00000000000406f0
[  229.214401] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  229.214401] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  229.214401] Process kworker/u:0 (pid: 5, threadinfo ffff880149714000, task ffff880149718000)
[  229.214401] Call Trace:
[  229.214401]  <IRQ>
[  229.214401]  [<ffffffffa00aa6ce>] sci_change_state+0x4a/0x4f [isci]
[  229.214401]  [<ffffffffa00a4ca6>] sci_io_request_tc_completion+0x79c/0x7a0 [isci]
[  229.214401]  [<ffffffffa00acf35>] sci_controller_process_completions+0x14f/0x396 [isci]
[  229.214401]  [<ffffffffa00abbda>] ? spin_lock_irq+0xe/0x10 [isci]
[  229.214401]  [<ffffffffa00ad2cf>] isci_host_completion_routine+0x71/0x2be [isci]
[  229.214401]  [<ffffffff8107c6b3>] ? mark_held_locks+0x52/0x70
[  229.214401]  [<ffffffff810538e8>] tasklet_action+0x90/0xf1
[  229.214401]  [<ffffffff81054050>] __do_softirq+0xe5/0x1bf
[  229.214401]  [<ffffffff8106d9d1>] ? hrtimer_interrupt+0x129/0x1bb
[  229.214401]  [<ffffffff814ff69c>] call_softirq+0x1c/0x30
[  229.214401]  [<ffffffff8100bb67>] do_softirq+0x4b/0xa3
[  229.214401]  [<ffffffff81053d84>] irq_exit+0x53/0xb4
[  229.214401]  [<ffffffff814fffe7>] smp_apic_timer_interrupt+0x83/0x91
[  229.214401]  [<ffffffff814fee53>] apic_timer_interrupt+0x13/0x20
[  229.214401]  <EOI>
[  229.214401]  [<ffffffff814f7ad4>] ? retint_restore_args+0x13/0x13
[  229.214401]  [<ffffffff8107af29>] ? trace_hardirqs_off+0xd/0xf
[  229.214401]  [<ffffffff8104ea71>] ? vprintk+0x40b/0x452
[  229.214401]  [<ffffffff814f4b5a>] printk+0x41/0x47
[  229.214401]  [<ffffffff81314484>] __dev_printk+0x78/0x7a
[  229.214401]  [<ffffffff8131471e>] dev_printk+0x45/0x47
[  229.214401]  [<ffffffffa00ae2a3>] isci_terminate_request_core+0x15d/0x317 [isci]
[  229.214401]  [<ffffffffa00af1ad>] isci_terminate_pending_requests+0x1a4/0x204 [isci]
[  229.214401]  [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[  229.214401]  [<ffffffffa00a7d9e>] isci_remote_device_nuke_requests+0xa6/0xff [isci]
[  229.214401]  [<ffffffffa00a811a>] isci_remote_device_stop+0x7c/0x166 [isci]
[  229.214401]  [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[  229.214401]  [<ffffffffa00a827a>] isci_remote_device_gone+0x76/0x7e [isci]
[  229.214401]  [<ffffffffa002363e>] sas_notify_lldd_dev_gone+0x34/0x36 [libsas]
[  229.214401]  [<ffffffffa0023945>] sas_unregister_dev+0x57/0x9c [libsas]
[  229.214401]  [<ffffffffa00239c0>] sas_unregister_domain_devices+0x36/0x65 [libsas]
[  229.214401]  [<ffffffffa0022cb8>] sas_deform_port+0x72/0x1ac [libsas]
[  229.214401]  [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[  229.214401]  [<ffffffffa0022a34>] sas_phye_loss_of_signal+0x3e/0x42 [libsas]

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-31 13:14:44 +04:00
Linus Torvalds ec7ae51753 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (204 commits)
  [SCSI] qla4xxx: export address/port of connection (fix udev disk names)
  [SCSI] ipr: Fix BUG on adapter dump timeout
  [SCSI] megaraid_sas: Fix instance access in megasas_reset_timer
  [SCSI] hpsa: change confusing message to be more clear
  [SCSI] iscsi class: fix vlan configuration
  [SCSI] qla4xxx: fix data alignment and use nl helpers
  [SCSI] iscsi class: fix link local mispelling
  [SCSI] iscsi class: Replace iscsi_get_next_target_id with IDA
  [SCSI] aacraid: use lower snprintf() limit
  [SCSI] lpfc 8.3.27: Change driver version to 8.3.27
  [SCSI] lpfc 8.3.27: T10 additions for SLI4
  [SCSI] lpfc 8.3.27: Fix queue allocation failure recovery
  [SCSI] lpfc 8.3.27: Change algorithm for getting physical port name
  [SCSI] lpfc 8.3.27: Changed worst case mailbox timeout
  [SCSI] lpfc 8.3.27: Miscellanous logic and interface fixes
  [SCSI] megaraid_sas: Changelog and version update
  [SCSI] megaraid_sas: Add driver workaround for PERC5/1068 kdump kernel panic
  [SCSI] megaraid_sas: Add multiple MSI-X vector/multiple reply queue support
  [SCSI] megaraid_sas: Add support for MegaRAID 9360/9380 12GB/s controllers
  [SCSI] megaraid_sas: Clear FUSION_IN_RESET before enabling interrupts
  ...
2011-10-28 16:44:18 -07:00
Dan Williams ac013ed1cb [SCSI] isci: export phy events via ->lldd_control_phy()
Allow the sas-transport-class to update events for local phys via a new
PHY_FUNC_GET_EVENTS command to ->lldd_control_phy().  Fixup drivers that
are not prepared for new enum phy_func values, and unify
->lldd_control_phy() error codes.

These are the SAS defined phy events that are reported in a
smp-report-phy-error-log command:
 * /sys/class/sas_phy/<phyX>/invalid_dword_count
 * /sys/class/sas_phy/<phyX>/running_disparity_error_count
 * /sys/class/sas_phy/<phyX>/loss_of_dword_sync_count
 * /sys/class/sas_phy/<phyX>/phy_reset_problem_count

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:24:26 -05:00
Jeff Skirvin cdd05f05b4 [SCSI] isci: The port state should be set to stopping on the last phy.
Fixes a bug where any phy removed from the port set the port
state to "stopping" - do this only when the last phy removed
from the port.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:22:28 -05:00
Jeff Skirvin 7582ba8bdf [SCSI] isci: fix decode of DONE_CRC_ERR TC completion status
DONE_CRC_ERR is not a RNC suspension condition, so do not change the
state to expect the incoming suspension notification.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
[djbw: dropped DONE_CMD_LL_R_ERR change]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:21:51 -05:00
Jeff Skirvin cd06b9bae1 [SCSI] isci: SATA/STP I/O is only returned in the normal path to libsas
Since libsas has it's own means to escalate SATA/STP device error
handling depending on task status codes, return all SATA/STP I/O
on the normal path.

i.e. skip sas_task_abort() and let sas_ata_task_done() disposition the
qc.  Longer term we want to audit non-essential calls to
sas_task_abort().

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:21:24 -05:00
Dan Williams b50102d3e9 [SCSI] isci: atapi support
Based on original implementation from Jiangbi Liu and Maciej Trela.

ATAPI transfers happen in two-to-three stages.  The two stage atapi
commands are those that include a dma data transfer.  The data transfer
portion of these operations is handled by the hardware packet-dma
acceleration.  The three-stage commands do not have a data transfer and
are handled without hardware assistance in raw frame mode.

stage1: transmit host-to-device fis to notify the device of an incoming
atapi cdb.  Upon reception of the pio-setup-fis repost the task_context
to perform the dma transfer of the cdb+data (go to stage3), or repost
the task_context to transmit the cdb as a raw frame (go to stage 2).

stage2: wait for hardware notification of the cdb transmission and then
go to stage 3.

stage3: wait for the arrival of the terminating device-to-host fis and
terminate the command.

To keep the implementation simple we only support ATAPI packet-dma
protocol (for commands with data) to avoid needing to handle the data
transfer manually (like we do for SATA-PIO).  This may affect
compatibility for a small number of devices (see
ATA_HORKAGE_ATAPI_MOD16_DMA).

If the data-transfer underruns, or encounters an error the
device-to-host fis is expected to arrive in the unsolicited frame queue
to pass to libata for disposition.  However, in the DONE_UNEXP_FIS (data
underrun) case it appears we need to craft a response.  In the
DONE_REG_ERR case we do receive the UF and propagate it to libsas.

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:20:03 -05:00
Jeff Skirvin 983d3fdd33 [SCSI] isci: fix missed unlock in apc_agent_timeout()
Needed to jump to scic_lock unlock.

Also spotted by coccicheck.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:08:00 -05:00
Dan Williams 54b5e3a4bf [SCSI] isci: fix support for large smp requests
Kill the local smp response buffer.

Besides being unnecessary, it is too small (currently truncates
responses to 60 bytes).  The mid-layer will have already allocated a
sufficiently sized buffer, just kmap and copy into it directly.

Cc: <stable@kernel.org>
Reported-by: Derick Marks <derick.w.marks@intel.com>
Tested-by: Derick Marks <derick.w.marks@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-10-02 13:07:17 -05:00
Dan Williams ad4f4c1de8 [SCSI] isci: initial sgpio write support
Basic support to initialize the gpio unit, accept an incomming
SAS_GPIO_REG_TX_GP bitstream, and translate it to the ODx.n fields in
the hardware registers.  If register indexes outside the supported range
are specified in the SMP frame we simply accept the write and return how
many registers (SFF-8485) were written (libsas reports this as residue
in the request).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-09-22 15:01:56 +04:00
Dan Williams 13257cfbc5 [SCSI] isci: fix sgpio register definitions
output_data_select registers are off by one u32

delete the macros we will never use.

Reported-by: Artur Wojcik <artur.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-09-22 15:00:56 +04:00
Jiri Kosina e060c38434 Merge branch 'master' into for-next
Fast-forward merge with Linus to be able to merge patches
based on more recent version of the tree.
2011-09-15 15:08:18 +02:00
Justin P. Mattock 699324871f treewide: remove extra semicolons from various parts of the kernel
This is a resend from the original, changing the title from PATCH to
RFC(since this is a review for commit, and I should have put that the first go around).
and also removing some of the commit's with ia64 and bash since it is significant.
let me know if I might have missed anything etc..

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-09-15 14:50:49 +02:00
Dan Williams 4fcf812ca3 [SCSI] libsas: export sas_alloc_task()
Now that isci has added a 3rd open coded user of this functionality just
share the libsas version.

Acked-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-27 08:35:13 -06:00
Dan Williams 98e2a5a3a1 [SCSI] isci: add version number
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 20:06:14 -07:00
Dan Williams 77cd72a53f [SCSI] isci: fix event-get pointer increment
Hardware only increments the put pointer on event types >= 4.  Do not
increment the get pointer for event type 3.

Reported-by: Kapil Karkra <kapil.karkra@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 20:05:47 -07:00
Dan Williams 9b4be52899 [SCSI] isci: dynamic interrupt coalescing
Hardware allows both an outstanding number commands and a timeout value
(whichever occurs first) as a gate to the next interrupt generation.  This
scheme at completion time looks at the remaining number of outstanding tasks
and sets the timeout to maximize small transaction operation.  If transactions
are large (take more than a few 10s of microseconds to complete) then
performance is not interrupt processing bound, so the small timeouts this
scheme generates are overridden by the time it takes for a completion to
arrive.

Tested-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 20:04:42 -07:00
Jeff Skirvin 39ea2c5b5f [SCSI] isci: Leave requests alone if already terminating.
Instead of immediately completing any request that has a second
termination call made on it, wait for the TC done/abort HW event.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 19:58:44 -07:00
Dave Jiang 3a7bda830f [SCSI] isci: Adding documentation to API change and fixup sysfs registration
Adding API update for adding isci_id entry scsi_host sysfs entry.
Also fixing up the sysfs registration to the scsi_host template

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 19:54:24 -07:00
Marcin Tomczak 985af6f70d [SCSI] isci: change sas phy timeouts from 54us to 59us
Need the following workaround in the driver for interoperability with
the older Intel SSD drives and any other SATA drive that may exhibit the
same behavior. This is a corner case where SCU speed is limited to
either 3G or 1.5G and the drive has a period of DC idle when it switches
speed during SATA speed negotiation. Workaround :change PHYTOV[31:24]
from 0x36 to 0x3B.

Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 19:52:14 -07:00
Dan Williams ee33e2b771 [SCSI] isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n
The unsolicited frame control infrastructure requires a table of dma
addresses for the hardware to lookup the frame buffer location by an
index.  The hardware expects the elements of this table to be 64-bit
quantities, so we cannot reference these elements as dma_addr_t.  All
unsolicited frame protocols are affected, particularly SATA-PIO and SMP
which prevented direct-attached SATA drives and expander-attached drives
to not be discovered.

Cc: <stable@kernel.org>
Reported-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 19:50:27 -07:00
Dan Williams 1a87828447 [SCSI] isci: fix sata response handling
A bug (likely copy/paste) that has been carried from the original
implementation.  The unsolicited frame handling structure returns the
d2h fis in the isci_request.stp.rsp buffer.

Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-23 19:45:45 -07:00
James Bottomley a5ec7f86dc [SCSI] isci: fix checkpatch errors
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-03 14:26:24 -05:00
Jeff Skirvin bc6f387d31 isci: Device reset should request sas_phy_reset(phy, true)
The hard_reset parameter passed to the LLDD in the direct-attached
phy control case allows the LLDD to filter link failure events
while the direct-attached device reset is executing.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams a8a0a133b0 isci: pare back error messsages
The messages emitted from task.c and some from request.c likely
duplicate (in a less undertandable way) what is reported by the
midlayer.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams dc00c8b694 isci: cleanup silicon revision detection
Perform checking per-pci device (even though all systems will only have
1 pci device in this generation), and delete support for silicon that
does not report a proper revision (i.e. A0).

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 4e4dca3de9 isci: merge scu_unsolicited_frame.h into unsolicited_frame_control.h
Does not need its own file.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 16ba77091b isci: merge sata.[ch] into request.c
Undo some needless separation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 34a991587a isci: kill 'get/set' macros
Most of these simple dereference macros are longer than their open coded
equivalent.  Deleting enum sci_controller_mode is thrown in for good
measure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 89a7301f21 isci: retire scic_sds_ and scic_ prefixes
The distinction between scic_sds_ scic_ and sci_ are no longer relevant
so just unify the prefixes on sci_.  The distinction between isci_ and
sci_ is historically significant, and useful for comparing the old
'core' to the current Linux driver. 'sci_' represents the former core as
well as the routines that are closer to the hardware and protocol than
their 'isci_' brethren. sci == sas controller interface.

Also unwind the 'sds1' out of the parameter structs.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams d9dcb4ba79 isci: unify isci_host and scic_sds_controller
Remove the distinction between these two implementations and unify on
isci_host (local instances named ihost).  Hmmm, we had two
'oem_parameters' instances, one was unused... nice.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 78a6f06e0e isci: unify isci_remote_device and scic_sds_remote_device
Remove the distinction between these two implementations and unify on
isci_remote_device (local instances named idev).

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams ffe191c92f isci: unify isci_port and scic_sds_port
Remove the distinction between these two implementations and unify on
isci_port (local instances named iport).  The duplicate '->owning_port' and
'->isci_port' in both isci_phy and isci_remote_device will be fixed in a later
patch... this is just the straightforward rename/unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 76802ce675 isci: fix scic_sds_remote_device_terminate_requests
Commit 0815632 "isci: unify remote_device stop_handlers" introduced the
possibility that not all requests get terminated if we reach the
request_count.  Now that we properly reference count devices we don't
need this self-defense and can do the straightforward scan of all active
requests.

Reported-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Acked-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 852809559e isci: unify isci_phy and scic_sds_phy
They are one in the same object so remove the distinction.  The near
duplicate fields (owning_port, and isci_port) will be cleaned up
after the scic_sds_port isci_port unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams 5076a1a97e isci: unify isci_request and scic_sds_request
They are one in the same object so remove the distinction.  The near
duplicate fields (owning_controller, and isci_host) will be cleaned up
after the scic_sds_contoller isci_host unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:52 -07:00
Dan Williams ba7cb22342 isci: rename / clean up scic_sds_stp_request
* Rename scic_sds_stp_request to isci_stp_request
* Remove the unused fields and union indirection

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams db05625098 isci: preallocate requests
the dma_pool interface is optimized for object_size << page_size which
is not the case with isci_request objects and the dma_pool routines show
up in the top of the profile.

The old io_request_table which tracked whether tci slots were in-flight
or not is replaced with an IREQ_ACTIVE flag per request.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 38d8879bae isci: combine request flags
Combine three bools into one unsigned long 'flags'.  Doesn't increase the
request size due to packing. (to do: optimize the structure layout).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 312e0c2455 isci: unify can_queue tracking on the tci_pool, uplevel tag assignment
The tci_pool tracks our outstanding command slots which are also the 'index'
portion of our tags.  Grabbing the tag early in ->lldd_execute_task let's us
drop the isci_host_can_queue() and ->was_tag_assigned_by_user infrastructure.
->was_tag_assigned_by_user required the task context to be duplicated in
request-local buffer.  With the tci established early we can build the
task_context directly into its final location and skip a memcpy.

With the task context buffer at a known address at request construction we
have the opportunity/obligation to also fix sgl handling.  This rework feels
like it belongs in another patch but the sgl handling and task_context are too
intertwined.
1/ fix the 'ab' pair embedded in the task context to point to the 'cd' pair in
   the task context (previously we were prematurely linking to the staging
   buffer).
2/ fix the broken iteration of pio sgls that assumes all sgls are relative to
   the request, and does a dangerous looking reverse lookup of physical
   address to virtual address.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Jeff Skirvin 9274f45ea5 isci: Terminate dev requests on FIS err bit rx in NCQ
When the remote device transitions to a not-ready state because of
an NCQ error condition, all outstanding requests to that device
are terminated and completed to libsas on the normal path.  The
device then waits for a READ LOG EXT command to issue on the task
management path.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 4cffe13e0d isci: fix frame received locking
Updates to the frame_rcvd before need to be atomic with respect to when
they are evaluated by libsas.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Maciej Patelczyk 7cafbf1bd5 isci: possible buffer overflow in isci_parse_oem_parameters fixed
scu_index is a parameter of isci_parse_eom_parameters and is an index
in controller table. There is a check: scu_index > SCI_MAX_CONTROLLERS
which is insufficient and should be: scu_index >= SCI_MAX_CONTROLLERS.
scu_index is used as an index in the table which size is
SCI_MAX_CONTROLLERS.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 086a0dabc5 isci: fix isci_task_execute_tmf completion
1/ fix the timeout for wait_for_completion_timeout
2/ In the tmf timeout case we need to wait for our termination callback
3/ Once the request is successfully started it will be freed according to the
   normal lifetime for requests.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams e9bf709564 isci: fix support for arbitrarily large smp requests
Instead of duplicating the smp request buffer reuse the one provided by
libsas.  This future proofs the driver to support arbitrarily large smp
requests, and shrinks the request structure size by ~700 bytes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams ddcc7e347a isci: fix dma_unmap_sg usage
One bug and a cleanup:
1/ Fix cases where we were unmapping invalid addresses (smp requests were
   being unmapped)

[  604.662770] ------------[ cut here ]------------
[  604.668026] WARNING: at lib/dma-debug.c:800 check_unmap+0x418/0x740()
[  604.675315] Hardware name: SandyBridge Platform
[  604.680465] isci 0000:03:00.0: DMA-API: device driver tries to free an invalid DMA memory address

2/ The unmap routine is too large to be an inline function, and
   isci_request_io_request_get_next_sge is unused.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 5edc33480c isci: fix smp response frame overrun
Due to a typo we currently copy way too much when copying over the
response data, but since a request is likely backed by a full page
allocation we don't corrupt live data.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams ff60639dc9 isci: kill device_sequence
Now that we have upleveled device reassignment protection to the
isci_remote_device reference count we no longer need this level of
self-defense.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams f208826751 isci: kill isci_remote_device_change_state()
Now that "stopping/stopped" are one in the same and signalled by a NULL device
pointer the rest of the device status infrastructure can be removed (->status
and ->state_lock).  The "not ready for i/o state" is replaced with a state
flag, and is evaluated under scic_lock so that we don't see transients from
taking the device reference to submitting the i/o.

This also fixes a potential leakage of can_queue slots in the rare case that
SAS_TASK_ABORTED is set at submission.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 209fae14fa isci: atomic device lookup and reference counting
We have unsafe references to remote devices that are notified to
disappear at lldd_dev_gone.  In order to clean this up we need a single
canonical source for device lookups and stable references once a lookup
succeeds.  Towards that end guarantee that domain_device.lldd_dev is
NULL as soon as we start the process of stopping a device.  Any code
path that wants to safely lookup a remote device must do so through
task->dev->lldd_dev (isci_lookup_device()).

For in-flight references outside of scic_lock we need reference counting
to ensure that the device is not recycled before we are done with it.
Simplify device back references to just scic_sds_request.target_device
which is now the only permissible internal reference that is maintained
relative to the reference count.

There were two occasions where we wanted new i/o's to be treated as
SAS_TASK_UNDELIVERED but where the domain_dev->lldd_dev link is still
intact.  Introduce a 'gone' flag to prevent i/o while waiting for libsas
to take action on the port down event.

One 'core' leftover is that we currently call
scic_remote_device_destruct() from isci_remote_device_deconstruct()
which is called when the 'core' says the device is stopped.  It would be
more natural for the final put to trigger
isci_remote_device_deconstruct() but this implementation is deferred as
it requires other changes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 360b03ed17 isci: fix ssp response iu buffer size in isci_tmf
In isci_task_request_complete() we save the response/sense data from the
command.  Make sure isci_tmf has enough space to hold the full response.

[ it does not look like we actually use this data, and
  response_data_len/sense_data_len should be specifying the byte count,
  in any event do the simple fix first so we don't corrupt memory ]

Reported-by: Adam Gruchala <adam.gruchala@intel.com>
Tested-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 0d0cf14c9b isci: cleanup request allocation
Rather than return an error code and update a pointer that was passed by
reference just return the request object directly (or null if allocation
failed).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams 994a9303d3 isci: cleanup/optimize queue increment macros
Every single i/o or event completion incurs a test and branch to see if
the cycle bit changed.  For power-of-2 queue sizes the cycle bit can be
read directly from the rollover of the queue pointer.

Likely premature optimization, but the hidden if() and hidden
assignments / side-effects in the macros were already asking to be
cleaned up.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams dd047c8e2b isci: cleanup tag macros
A tag is a 16 bit number where the upper four bits is a sequence number
and the remainder is the task context index (tci).  Sanitize the macro
names and shave 256-bytes out of scic_sds_controller by reducing the size of
io_request_sequence.

scic_sds_io_tag_construct --> ISCI_TAG
scic_sds_io_tag_get_sequence --> ISCI_TAG_SEQ
scic_sds_io_tag_get_index() --> ISCI_TAG_TCI
scic_sds_io_sequence_increment() [delete / open code]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Dan Williams ac668c6970 isci: cleanup/optimize pool implementation
The circ_buf macros are ~6% faster, as measured by perf, because they take
advantage of power-of-two math assumptions i.e. no test and branch for
rollover. Their semantics are clearer than the hidden side effects in pool.h
(like sci_pool_get() which hides an assignment).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:51 -07:00
Jeff Skirvin 9b917987fd isci: Disable link layer hang detection
Some targets exceed the hang detect timer.  Use the OS timeout to
catch hung tasks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin fd0527ab15 isci: Hard reset failure will link reset all phys in the port
In the case where the hard reset process fails, each link in
the port is put through a link reset sequence.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin fd53660120 isci: Explicitly decode remote node ready and suspended states
The remote node context should only signal a device reset condition
in a suspended state.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Dan Williams 980d3aeb38 isci: fix isci_terminate_pending() list management
Walk through the list of pending requests being careful to consider that
multiple requests can be terminated when the lock is dropped (i.e.
invalidating the 'next' reference established by
list_for_each_entry_safe).

Also noticed that all callers to isci_terminate_pending_requests()
specifying terminating, so just drop the parameter.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin 77c852f312 isci: Handle timed-out request terminations correctly
In the situation where a termination of an I/O times-out,
make sure that the linkage from the request to the task
is severed completely.  Also make sure that the selection
of tasks to terminate occurs under scic_lock.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin f53a3a32c1 isci: Requests that do not start must be set to "complete"
Requests that fail at start because of a reset pending condition
must be set to complete in order to allow for later cleanup.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin cde76fbf1f isci: Add decode for SMP request retry error condition
There are situations with slow expanders in which a first attempt
to execute an SMP request will fail with a timeout.  Immediate
subsequent retries will generally succeed.  This change makes sure
SMP I/O failures are immediately failed to libsas so that retries
happen with no discovery process timeout delay.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin 61aaff49e2 isci: filter broadcast change notifications during SMP phy resets
When resetting a sata device in the domain we have seen occasions where
libsas prematurely marks a device gone in the time it takes for the
device to re-establish the link.  This plays badly with software raid
arrays.  Other libsas drivers have non-uniform delays in their reset
handlers to try to cover this condition, but not sufficient to close the
hole.  Given that a sata device can take many seconds to recover we
filter bcns and poll for the device reattach state before notifying
libsas that the port needs the domain to be rediscovered.  Once this has
been proven out at the lldd level we can think about uplevelling this
feature to a common implementation in libsas.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
[ use kzalloc instead of kmem_cache ]
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ use eventq and time macros ]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Jeff Skirvin ff717ab05f isci: Move the reset delay after the remote node resumption.
Delay after bringing up the RNC to allow for resumption latency.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Dan Williams 7c78da3175 isci: remove 'min memory' infrastructure
The old 'core' had aspirations of running in severely memory constrained
environments like bios option-rom, it's not needed for Linux and gets in
the way of other cleanups (like unifying/reducing the number of structure
members in scic_sds_controller/isci_host).

This also fixes a theoretical bug in that the driver would blindly override
the silicon advertised limits for number of ports, task contexts, and remote
node contexts.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Adam Gruchala dbb0743a58 isci: Added support for C0 to SCU Driver
C0 silicon updates the pci revision id and requires new AFE parameters
for phy signal integrity.  Support for previous silicon revisions is
deprecated (it's also broken for the theoretical case of multiple
controllers at different silicon revisions, all the more reason to get
it removed as soon as possible)

Signed-off-by: Adam Gruchala <adam.gruchala@intel.com>
[fixed up deprecated silicon support]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Edmund Nadolski 12ef65444d isci: additional state machine cleanup
Additional state machine cleanups:

 o Remove static functions sci_state_machine_exit_state() and
   sci_state_machine_enter_state()
 o Combines sci_base_state_machine_construct() and
   sci_base_state_machine_start() into a single function,
   sci_init_sm()
 o Remove sci_base_state_machine_stop() which is unused.
 o Kill state_machine.[ch]

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[fixed too large to inline functions]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Edmund Nadolski e301370ac5 isci: state machine cleanup
This cleans up several areas of the state machine mechanism:

 o Rename sci_base_state_machine_change_state to sci_change_state
 o Remove sci_base_state_machine_get_state function
 o Rename 'state_machine' struct member to 'sm' in client structs
 o Shorten the name of request states
 o Shorten state machine state names as follows:
        SCI_BASE_CONTROLLER_STATE_xxx to SCIC_xxx
        SCI_BASE_PHY_STATE_xxx to SCI_PHY_xxx
        SCIC_SDS_PHY_STARTING_SUBSTATE_xxx to SCI_PHY_SUB_xxx
        SCI_BASE_PORT_STATE_xxx to SCI_PORT_xxx and
        SCIC_SDS_PORT_READY_SUBSTATE_xxx to SCI_PORT_SUB_xxx
        SCI_BASE_REMOTE_DEVICE_STATE_xxx to SCI_DEV_xxx
        SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_STP_DEV_xxx
        SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_SMP_DEV_xxx
        SCIC_SDS_REMOTE_NODE_CONTEXT_xxx_STATE to SCI_RNC_xxx

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Dave Jiang 8d2c65c09c isci: Removing unused variables compiler warnings
Newer gcc's are better at identifying "set, but not used" variables.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Dave Jiang bf482c6069 isci: Retrieve the EFI variable for OEM parameter
We can call the EFI get_variable service routine directly to retrieve
the EFI variable that holds the OEM parameters table.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Dave Jiang 77d67385f7 isci: removing the kmalloc in smp request construct
It doesn't look like there is any reason to do a kmalloc. We can do the
byte swap in place and avoid the allocation. This allow us to remove
a kmalloc and a memcpy.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Edmund Nadolski 8db02da528 isci: remove isci_timer interface
Delete code which is no longer used.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Edmund Nadolski fd18388bc5 isci: Remove tmf timeout_timer
Replace the timeout_timer in the isci_tmf with a call to
wait_for_completion_timeout

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:50 -07:00
Edmund Nadolski bb3dbdf6c8 isci: convert phy_startup_timer to sci_timer
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Edmund Nadolski 6cb5853d3e isci: convert scic_timeout_timer to sci_timer
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Edmund Nadolski 0473661a12 isci: convert power control timer to sci_timer
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Edmund Nadolski a628d47857 isci: convert phy sata_timeout_timer to sci_timer
Convert the sata_timeout_timer in the scic_sds_phy struct to
use a struct sci_timer

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Edmund Nadolski ac0eeb4f77 isci: convert port config agent timer to sci_timer
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[squashed collateral cleanups]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Edmund Nadolski 5553ba2be0 isci: replace isci_timer list with proper embedded timers
Rather than preallocating a list of timers and doling them out at runtime,
embed a struct timerlist in each object that needs one.  A struct sci_timer
interface is introduced to manage the timer cancellation semantics which
currently need to guarantee the timer is cancelled while holding
spin_lock(ihost->scic_lock).  Since the timeout functions also need to acquire
the lock it currently prevents the driver from using del_timer_sync() for
runtime cancellations.

del_timer_sync() is used however before the objects go out of scope.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams 9269e0e898 isci: add some type safety to the state machine interface
Now that any given object type only has one state_machine we can use
container_of() to get back to the given state machine owner.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams f34d9e5d3f isci: unify rnc start{io|task} handlers
Unify rnc start{io|task} handlers and delete the state handler
infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams ed3efb7784 isci: unify rnc suspend/resume handlers
Unify rnc suspend/resume handlers and delete the state handlers.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams c845ae96bc isci: unify rnc destruct handlers
Unify rnc destruct handlers and delete the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams 338e386d12 isci: unify rnc event handlers
Unify rnc event handlers and delete the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Dan Williams 6813820c7b isci: unify port start_io and complete_io handlers
Unify the handlers and kill the state handler infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki 051266caae isci: unify port link_up and link_down handlers
Unify the handlers and kill the state handler implementations.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki 13721e186f isci: remove port frame and event handlers
Unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki bd6713b416 isci: unify port reset, add_phy, and remove_phy handlers
Unify the implementations and remove the state handlers.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki e6ec5afde9 isci: remove port destruct handler
The handler was never used.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki 8bc80d3030 isci: unify port stop handlers
Implement the stop handlers directly in scic_sds_port_stop()

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki d76f71d988 isci: remove port start handler
remove the handler from the port state handler table and implement the
logic directly in scic_sds_port_start().

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
[remove a level of indirection]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki e91f41ef80 isci: merge port ready substates into primary state machine
This conversion was complicated by the fact that the ready state exit routine
took unconditional action beyond just stopping the substate machine (like in
previous conversions).  In order to ensure identical behaviour every state
transition needs to be instrumented to catch ready-->!ready transitions and
execute scic_sds_port_invalidate_dummy_remote_node()

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
[fix ready state exit handling]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:49 -07:00
Piotr Sawicki c777c26ca2 isci: c99 port state handlers
Name the table fields for consistancy and clarity.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 4f20ef4f57 isci: clarify phy to port lookups
While cleaning up the driver it is very tempting to convert scic_sds_get_*
macros to their open coded equivalent.  They are all just pointer dereferences
*except* scic_sds_phy_get_port() which returns NULL if the phy is assigned to
the dummy port.  Clarify this by renaming it to phy_get_non_dummy_port().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 5b1d4af251 isci: unify phy consume_power handlers
Unify the implementations in scic_sds_phy_consume_power_handler(), and kill
the state handler plus infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 23506a69e2 isci: unify phy event handlers
Unify the implementations in scic_sds_phy_event_handler(), and kill the state handler

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams c4441abc25 isci: unify phy frame handlers
Unify the implementations in scic_sds_phy_frame_handler(), and kill the state handler

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 35b317bec5 isci: remove phy destruct handlers
Unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 0cf36fa9f1 isci: unify phy reset handlers
Unify the implementations in scic_sds_phy_reset(), and kill the state handler

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 931532364e isci: unify phy stop handlers
Merge all implementations in scic_sds_phy_stop(), and kill the state handler

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 966699b50c isci: unify phy start handlers
Implement all handlers in scic_sds_phy_start(), and kill the state handler

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Adam Gruchala 4a33c525f0 isci: merge phy substates
Merged states and substates into one state machine, as we always
unconditionally transitioned to the substate machine it was straightforward to
enter that substate from the starting state.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Adam Gruchala <adam.gruchala@intel.com>
[fixed construction, starting_state_enter, and starting check]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 79e2b6b276 isci: remove the completion and event state handlers
With these handlers gone the rest of the state handler infrastructure is
removed.

Added some WARN_ONCEs where previously we would cause NULL pointer
dereferences or silently run handlers from a previous state.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams a7e255a342 isci: remove request task context completion state handler
Unlike the other conversions this only updates
scic_sds_io_request_tc_completion() to call the old state handlers directly
(with less verbose names).  This was done for future patch readability, the
implementations have only minor differences for different completion codes.
Without a reference to the function name it would be difficult to dicern which
state is being updated.  Considered changing the order to look up the
completion code before the state but that was not a clean conversion either.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams d1c637c35b isci: unify request frame handlers
Unify the implementation in scic_sds_io_request_frame_handler and kill
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Piotr Sawicki f4636a7b2a isci: unify request start handlers
Unify the implementation in scic_sds_request_start and kill the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
[remove scic_sds_request_constructed_state_start_handler]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams f00e6ba499 isci: unify request abort handlers
Unify the implementation in scic_sds_io_request_terminate and kill the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:48 -07:00
Dan Williams 5dec6f4e41 isci: merge stp request substates into primary state machine
Remove usage of the request substate machine for stp requests, and kill
the request substate infrastructure.

Similar to the previous conversions this adds the substates to the
primary state machine and arranges for the 'started' state to transition
to the proper stp substate.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams c72086e3c2 isci: merge smp request substates into primary state machine
Remove usage of the request substate machine for smp requests identified by:
	task->task_proto == SAS_PROTOCOL_SMP

While merging over the smp_request infrastructure noticed that all the
assign buffer implementations are now equal, so moved it to
scic_sds_general_request_construct.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams f139303d17 isci: merge ssp task management substates into primary state machine
Remove usage of the request substate machine for ssp task management
requests identified by:
	ireq->ttype == tmf_task && dev->dev_type == SAS_END_DEV;

The only routine that checks the base 'started' state is
scic_sds_io_request_tc_completion which calls the substate machine
handler if we are not in the 'started' state or we are 'started' and no
substate machine is defined.  This routine requires no conversion
because we have transitioned out of 'started' and the substate routine
will be called naturally as a result.

There are also no side effects of this conversion on exiting the
'started', state because it only stops the substate machine, which is no
longer relevant for this transaction type.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams e2f8db509f isci: uplevel port infrastructure
* Move port configuration agent implementation
* Merge core/scic_sds_port.[ch] into port.[ch]

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams d35bc1bd18 isci: uplevel phy infrastructure
Merge core/scic_sds_phy.[ch] into phy.[ch]

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams f1f52e7593 isci: uplevel request infrastructure
* Consolidate tiny header files
* Move files out of core/ (drop core/scic_sds_ prefix)
* Merge core/scic_sds_request.[ch] into request.[ch]
* Cleanup request.c namespace (clean forward declarations and global
  namespace pollution)

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 3bff9d54ec isci: uplevel state machine
unify core/sci_base_state.h and core/sci_base_state_machine.[ch] into
state_machine.[ch]

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 63a3a15fb0 isci: uplevel register hardware data structures and unsolicited frame handling
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams cc9203bf38 isci: move core/controller to host
Now that the data structures are unified unify the implementation in
host.[ch] and cleanup namespace pollution.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams ce2b3261b6 isci: unify constants
cross driver constants are spread out over multiple header files, consolidate
them into isci.h, and push some includes out to the source files that need
them.

TODO: remove SCI_MODE_SIZE infrastructure.
TODO: task.h is full of inlines that are too large

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 67ea838d17 isci: unify request data structures
Make scic_sds_request a proper member of isci_request.  Also let's us
get rid of the dma pool object size tracking since we now know that all
requests are sizeof(isci_request).  While cleaning up the construct
routine incidentally replaced SCI_FIELD_OFFSET with offsetof.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams b7645818cf isci: make command/response iu explicit request object members
Final elimination of the anonymous data at the end of the request
structure.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 26298264a5 isci: move task context alignment from run-time to compile time
Remove usage of PTR_ALIGN by arranging for the task context to be aligned by
the compiler.  Another step towards unifying isci_request and
scic_sds_request.  Once this is complete the task context in the request can
likely be removed in favor of building the task directly to tc memory (see:
scic_sds_controller_copy_task_context).  It's not clear why this needs to be
cacheline aligned if we just end up copying before submission...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 0d84366fbe isci: make sgl explicit/aligned request object member
Towards unifying request objects we need all members to be defined in the
object and not carved out of anonymous buffer space.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 827a84d4e0 isci: move stp request info to scic_sds_request
In preparation for unifying allocation of all request information make stp
data available in all requests.  Incidentally collapse indentation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams e531381e2f isci: unify port data structures
Make scic_sds_port a member of isci_port and merge their lifetimes which
means removing the port table from scic_sds_controller in favor of the
one at the isci_host level.  Merge ihost->sas_ports into ihost->ports.
_
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Dan Williams 4b33981ade isci: unify phy data structures
Make scic_sds_phy a member of isci_phy and merge their lifetimes which
means removing the phy table from scic_sds_controller in favor of the
one at that isci_host level.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Jacek Danecki a98a7426bc isci: rnc state machine table c99 conversion
This makes the subsequent patches to delete rnc->state_handler more
clear.

Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:47 -07:00
Edmund Nadolski b9988b8e7f isci: remove scic_sds_port_increment_request_count
Removes excessive encapsulation function.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Edmund Nadolski ed30c275dd isci: kill scic_controller_get_port_handle function
This function is just overkill and its usage is inconsistent. Replace
with inlined code.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Dave Jiang 9286a1959c isci: Removing unnecessary functions in request.c
No need for wrappers, just access sas_task directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Artur Wojcik cc3dbd0a91 isci: unify isci_host data structures
Make it explicit that isci_host and scic_sds_controller are one in the same
object.

Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
[removed ->ihost back pointer]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Dan Williams d06b487b78 isci: implement I_T_nexus_reset
This is a requirement for 2.6.39's new libata eh.

Still some questions about lldd_dev_gone racing against dev->lldd_dev
lookups, but we are at least no more broken than mvsas in this regard.

We also short-circuit I_T_nexus_reset invocations from the device
discovery path (IDEV_EH similar to MVS_DEV_EH) to filter out the
resulting domain rediscoveries triggered by the reset.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Dan Williams 5b3f2bd877 isci: fix ata locking
Upstream commit a29b5dad "libata: fix locking for sas paths" switched
libsas ata locking to the ata_host lock.  We need to do the same when
returning ata tasks from the execute path.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00
Dave Jiang 8694e79287 isci: removing intel_*.h headers
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 04:04:46 -07:00