[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.17 / 0125-libsas-fix-false-positive-device-attached-conditions.patch
1 From 18c33d9e87a0a285218cc075f4a471fe53142061 Mon Sep 17 00:00:00 2001
2 From: Dan Williams <dan.j.williams@intel.com>
3 Date: Tue, 20 Mar 2012 10:50:27 -0700
4 Subject: [PATCH 125/165] libsas: fix false positive 'device attached'
5 conditions
7 commit 7d1d865181185bdf1316d236b1b4bd02c9020729 upstream.
9 Normalize phy->attached_sas_addr to return a zero-address in the case
10 when device-type == NO_DEVICE or the linkrate is invalid to handle
11 expanders that put non-zero sas addresses in the discovery response:
13 sas: ex 5001b4da000f903f phy02:U:0 attached: 0100000000000000 (no device)
14 sas: ex 5001b4da000f903f phy01:U:0 attached: 0100000000000000 (no device)
15 sas: ex 5001b4da000f903f phy03:U:0 attached: 0100000000000000 (no device)
16 sas: ex 5001b4da000f903f phy00:U:0 attached: 0100000000000000 (no device)
18 Reported-by: Andrzej Jakowski <andrzej.jakowski@intel.com>
19 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
20 Signed-off-by: James Bottomley <JBottomley@Parallels.com>
21 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22 ---
23 drivers/scsi/libsas/sas_expander.c | 9 ++++++++-
24 1 files changed, 8 insertions(+), 1 deletions(-)
26 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
27 index a68780b..e48ba4b 100644
28 --- a/drivers/scsi/libsas/sas_expander.c
29 +++ b/drivers/scsi/libsas/sas_expander.c
30 @@ -192,7 +192,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
31 phy->attached_sata_ps = dr->attached_sata_ps;
32 phy->attached_iproto = dr->iproto << 1;
33 phy->attached_tproto = dr->tproto << 1;
34 - memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
35 + /* help some expanders that fail to zero sas_address in the 'no
36 + * device' case
37 + */
38 + if (phy->attached_dev_type == NO_DEVICE ||
39 + phy->linkrate < SAS_LINK_RATE_1_5_GBPS)
40 + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
41 + else
42 + memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
43 phy->attached_phy_id = dr->attached_phy_id;
44 phy->phy_change_count = dr->change_count;
45 phy->routing_attr = dr->routing_attr;
46 --
47 1.7.7.6