diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-14 18:36:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-14 18:36:19 -0400 |
commit | a3ccf63ee643ef243cbf8918da8b3f9238f10029 (patch) | |
tree | 569049e38e9b420a8c0e50a84d2579e176ca29de /drivers/firewire | |
parent | d6047d79b90f6122fcbf2c3e783b507f7dd78fc6 (diff) | |
parent | eaf76e0d027a917a013ad8a88a94132d0feab622 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
firewire: sbp2: provide fallback if mgt_ORB_timeout is missing
ieee1394: add documentation entry to MAINTAINERS
ieee1394: update URLs in debugging-via-ohci1394.txt
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/sbp2.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 50f0176de615..98dbbda3ad41 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -188,14 +188,7 @@ static struct fw_device *target_device(struct sbp2_target *tgt) | |||
188 | /* Impossible login_id, to detect logout attempt before successful login */ | 188 | /* Impossible login_id, to detect logout attempt before successful login */ |
189 | #define INVALID_LOGIN_ID 0x10000 | 189 | #define INVALID_LOGIN_ID 0x10000 |
190 | 190 | ||
191 | /* | 191 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
192 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
193 | * provided in the config rom. Most devices do provide a value, which | ||
194 | * we'll use for login management orbs, but with some sane limits. | ||
195 | */ | ||
196 | #define SBP2_MIN_LOGIN_ORB_TIMEOUT 5000U /* Timeout in ms */ | ||
197 | #define SBP2_MAX_LOGIN_ORB_TIMEOUT 40000U /* Timeout in ms */ | ||
198 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | ||
199 | #define SBP2_ORB_NULL 0x80000000 | 192 | #define SBP2_ORB_NULL 0x80000000 |
200 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | 193 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ |
201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | 194 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ |
@@ -1034,7 +1027,6 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1034 | { | 1027 | { |
1035 | struct fw_csr_iterator ci; | 1028 | struct fw_csr_iterator ci; |
1036 | int key, value; | 1029 | int key, value; |
1037 | unsigned int timeout; | ||
1038 | 1030 | ||
1039 | fw_csr_iterator_init(&ci, directory); | 1031 | fw_csr_iterator_init(&ci, directory); |
1040 | while (fw_csr_iterator_next(&ci, &key, &value)) { | 1032 | while (fw_csr_iterator_next(&ci, &key, &value)) { |
@@ -1059,17 +1051,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1059 | 1051 | ||
1060 | case SBP2_CSR_UNIT_CHARACTERISTICS: | 1052 | case SBP2_CSR_UNIT_CHARACTERISTICS: |
1061 | /* the timeout value is stored in 500ms units */ | 1053 | /* the timeout value is stored in 500ms units */ |
1062 | timeout = ((unsigned int) value >> 8 & 0xff) * 500; | 1054 | tgt->mgt_orb_timeout = (value >> 8 & 0xff) * 500; |
1063 | timeout = max(timeout, SBP2_MIN_LOGIN_ORB_TIMEOUT); | ||
1064 | tgt->mgt_orb_timeout = | ||
1065 | min(timeout, SBP2_MAX_LOGIN_ORB_TIMEOUT); | ||
1066 | |||
1067 | if (timeout > tgt->mgt_orb_timeout) | ||
1068 | fw_notify("%s: config rom contains %ds " | ||
1069 | "management ORB timeout, limiting " | ||
1070 | "to %ds\n", tgt->bus_id, | ||
1071 | timeout / 1000, | ||
1072 | tgt->mgt_orb_timeout / 1000); | ||
1073 | break; | 1055 | break; |
1074 | 1056 | ||
1075 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: | 1057 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: |
@@ -1087,6 +1069,22 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1087 | return 0; | 1069 | return 0; |
1088 | } | 1070 | } |
1089 | 1071 | ||
1072 | /* | ||
1073 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
1074 | * provided in the config rom. Most devices do provide a value, which | ||
1075 | * we'll use for login management orbs, but with some sane limits. | ||
1076 | */ | ||
1077 | static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt) | ||
1078 | { | ||
1079 | unsigned int timeout = tgt->mgt_orb_timeout; | ||
1080 | |||
1081 | if (timeout > 40000) | ||
1082 | fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n", | ||
1083 | tgt->bus_id, timeout / 1000); | ||
1084 | |||
1085 | tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); | ||
1086 | } | ||
1087 | |||
1090 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, | 1088 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, |
1091 | u32 firmware_revision) | 1089 | u32 firmware_revision) |
1092 | { | 1090 | { |
@@ -1171,6 +1169,7 @@ static int sbp2_probe(struct device *dev) | |||
1171 | &firmware_revision) < 0) | 1169 | &firmware_revision) < 0) |
1172 | goto fail_tgt_put; | 1170 | goto fail_tgt_put; |
1173 | 1171 | ||
1172 | sbp2_clamp_management_orb_timeout(tgt); | ||
1174 | sbp2_init_workarounds(tgt, model, firmware_revision); | 1173 | sbp2_init_workarounds(tgt, model, firmware_revision); |
1175 | 1174 | ||
1176 | /* | 1175 | /* |