Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292998
b: refs/heads/master
c: 81c757b
h: refs/heads/master
v: v3
  • Loading branch information
Dan Williams authored and James Bottomley committed Feb 19, 2012
1 parent 7edec74 commit bd38a46
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b3e09da1350397f3f8b6fd839ab455b0b587451
refs/heads/master: 81c757bc696284f39f07766f0c2ca67af64ce9bd
1 change: 1 addition & 0 deletions trunk/drivers/ata/libata-eh.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ void ata_port_wait_eh(struct ata_port *ap)
goto retry;
}
}
EXPORT_SYMBOL_GPL(ata_port_wait_eh);

static int ata_eh_nr_in_flight(struct ata_port *ap)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/ata/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ extern void ata_eh_acquire(struct ata_port *ap);
extern void ata_eh_release(struct ata_port *ap);
extern enum blk_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd);
extern void ata_scsi_error(struct Scsi_Host *host);
extern void ata_port_wait_eh(struct ata_port *ap);
extern void ata_eh_fastdrain_timerfn(unsigned long arg);
extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc);
extern void ata_dev_disable(struct ata_device *dev);
Expand Down
11 changes: 11 additions & 0 deletions trunk/drivers/scsi/libsas/sas_ata.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,14 @@ void sas_ata_schedule_reset(struct domain_device *dev)
ata_port_schedule_eh(ap);
spin_unlock_irqrestore(ap->lock, flags);
}

void sas_ata_wait_eh(struct domain_device *dev)
{
struct ata_port *ap;

if (!dev_is_sata(dev))
return;

ap = dev->sata_dev.ap;
ata_port_wait_eh(ap);
}
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/libsas/sas_expander.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
}

/* check if we have an existing attached ata device on this expander phy */
static struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id)
struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id)
{
struct ex_phy *ex_phy = &ex_dev->ex_dev.ex_phy[phy_id];
struct domain_device *dev;
Expand Down
56 changes: 55 additions & 1 deletion trunk/drivers/scsi/libsas/sas_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <scsi/sas_ata.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_transport.h>
Expand Down Expand Up @@ -195,6 +196,59 @@ static int sas_get_linkerrors(struct sas_phy *phy)
return sas_smp_get_phy_events(phy);
}

/**
* transport_sas_phy_reset - reset a phy and permit libata to manage the link
*
* phy reset request via sysfs in host workqueue context so we know we
* can block on eh and safely traverse the domain_device topology
*/
static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
{
int ret;
enum phy_func reset_type;

if (hard_reset)
reset_type = PHY_FUNC_HARD_RESET;
else
reset_type = PHY_FUNC_LINK_RESET;

if (scsi_is_sas_phy_local(phy)) {
struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
struct sas_internal *i =
to_sas_internal(sas_ha->core.shost->transportt);
struct domain_device *dev = NULL;

if (asd_phy->port)
dev = asd_phy->port->port_dev;

/* validate that dev has been probed */
if (dev)
dev = sas_find_dev_by_rphy(dev->rphy);

if (dev && dev_is_sata(dev) && !hard_reset) {
sas_ata_schedule_reset(dev);
sas_ata_wait_eh(dev);
ret = 0;
} else
ret = i->dft->lldd_control_phy(asd_phy, reset_type, NULL);
} else {
struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
struct domain_device *ddev = sas_find_dev_by_rphy(rphy);
struct domain_device *ata_dev = sas_ex_to_ata(ddev, phy->number);

if (ata_dev && !hard_reset) {
sas_ata_schedule_reset(ata_dev);
sas_ata_wait_eh(ata_dev);
ret = 0;
} else
ret = sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
}

return ret;
}

int sas_phy_enable(struct sas_phy *phy, int enable)
{
int ret;
Expand Down Expand Up @@ -300,7 +354,7 @@ static void phy_reset_work(struct work_struct *work)
{
struct sas_phy_data *d = container_of(work, typeof(*d), reset_work);

d->reset_result = sas_phy_reset(d->phy, d->hard_reset);
d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset);
}

static int sas_phy_setup(struct sas_phy *phy)
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/libsas/sas_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id,
int sas_smp_get_phy_events(struct sas_phy *phy);

struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy);
struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id);

void sas_hae_reset(struct work_struct *work);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
* EH - drivers/ata/libata-eh.c
*/
extern void ata_port_schedule_eh(struct ata_port *ap);
extern void ata_port_wait_eh(struct ata_port *ap);
extern int ata_link_abort(struct ata_link *link);
extern int ata_port_abort(struct ata_port *ap);
extern int ata_port_freeze(struct ata_port *ap);
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/scsi/sas_ata.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
struct list_head *done_q);
void sas_probe_sata(struct work_struct *work);
void sas_ata_schedule_reset(struct domain_device *dev);
void sas_ata_wait_eh(struct domain_device *dev);
#else


Expand Down Expand Up @@ -79,6 +80,9 @@ static inline void sas_ata_schedule_reset(struct domain_device *dev)
{
}

static inline void sas_ata_wait_eh(struct domain_device *dev)
{
}
#endif

#endif /* _SAS_ATA_H_ */

0 comments on commit bd38a46

Please sign in to comment.