diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-01-24 13:41:46 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-01-28 14:31:07 -0500 |
commit | f746072abc12d0e10ecd7847f1846157fde15987 (patch) | |
tree | b58abd8312e1fe845f99aaa6a6071d1d04cd6d24 /drivers | |
parent | a08e100aece16e33a45b82924ad85f4066c4ed1c (diff) |
firewire: sbp2: define some magic numbers as macros
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index ac8038431585..5739caaaec7b 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -311,14 +311,16 @@ struct sbp2_command_orb { | |||
311 | dma_addr_t page_table_bus; | 311 | dma_addr_t page_table_bus; |
312 | }; | 312 | }; |
313 | 313 | ||
314 | #define SBP2_ROM_VALUE_WILDCARD ~0 /* match all */ | ||
315 | #define SBP2_ROM_VALUE_MISSING 0xff000000 /* not present in the unit dir. */ | ||
316 | |||
314 | /* | 317 | /* |
315 | * List of devices with known bugs. | 318 | * List of devices with known bugs. |
316 | * | 319 | * |
317 | * The firmware_revision field, masked with 0xffff00, is the best | 320 | * The firmware_revision field, masked with 0xffff00, is the best |
318 | * indicator for the type of bridge chip of a device. It yields a few | 321 | * indicator for the type of bridge chip of a device. It yields a few |
319 | * false positives but this did not break correctly behaving devices | 322 | * false positives but this did not break correctly behaving devices |
320 | * so far. We use ~0 as a wildcard, since the 24 bit values we get | 323 | * so far. |
321 | * from the config rom can never match that. | ||
322 | */ | 324 | */ |
323 | static const struct { | 325 | static const struct { |
324 | u32 firmware_revision; | 326 | u32 firmware_revision; |
@@ -340,22 +342,22 @@ static const struct { | |||
340 | }, | 342 | }, |
341 | /* Initio bridges, actually only needed for some older ones */ { | 343 | /* Initio bridges, actually only needed for some older ones */ { |
342 | .firmware_revision = 0x000200, | 344 | .firmware_revision = 0x000200, |
343 | .model = ~0, | 345 | .model = SBP2_ROM_VALUE_WILDCARD, |
344 | .workarounds = SBP2_WORKAROUND_INQUIRY_36, | 346 | .workarounds = SBP2_WORKAROUND_INQUIRY_36, |
345 | }, | 347 | }, |
346 | /* PL-3507 bridge with Prolific firmware */ { | 348 | /* PL-3507 bridge with Prolific firmware */ { |
347 | .firmware_revision = 0x012800, | 349 | .firmware_revision = 0x012800, |
348 | .model = ~0, | 350 | .model = SBP2_ROM_VALUE_WILDCARD, |
349 | .workarounds = SBP2_WORKAROUND_POWER_CONDITION, | 351 | .workarounds = SBP2_WORKAROUND_POWER_CONDITION, |
350 | }, | 352 | }, |
351 | /* Symbios bridge */ { | 353 | /* Symbios bridge */ { |
352 | .firmware_revision = 0xa0b800, | 354 | .firmware_revision = 0xa0b800, |
353 | .model = ~0, | 355 | .model = SBP2_ROM_VALUE_WILDCARD, |
354 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 356 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
355 | }, | 357 | }, |
356 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { | 358 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { |
357 | .firmware_revision = 0x002600, | 359 | .firmware_revision = 0x002600, |
358 | .model = ~0, | 360 | .model = SBP2_ROM_VALUE_WILDCARD, |
359 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 361 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
360 | }, | 362 | }, |
361 | 363 | ||
@@ -1093,7 +1095,7 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, | |||
1093 | continue; | 1095 | continue; |
1094 | 1096 | ||
1095 | if (sbp2_workarounds_table[i].model != model && | 1097 | if (sbp2_workarounds_table[i].model != model && |
1096 | sbp2_workarounds_table[i].model != ~0) | 1098 | sbp2_workarounds_table[i].model != SBP2_ROM_VALUE_WILDCARD) |
1097 | continue; | 1099 | continue; |
1098 | 1100 | ||
1099 | w |= sbp2_workarounds_table[i].workarounds; | 1101 | w |= sbp2_workarounds_table[i].workarounds; |
@@ -1143,14 +1145,13 @@ static int sbp2_probe(struct device *dev) | |||
1143 | fw_device_get(device); | 1145 | fw_device_get(device); |
1144 | fw_unit_get(unit); | 1146 | fw_unit_get(unit); |
1145 | 1147 | ||
1146 | /* Initialize to values that won't match anything in our table. */ | ||
1147 | firmware_revision = 0xff000000; | ||
1148 | model = 0xff000000; | ||
1149 | |||
1150 | /* implicit directory ID */ | 1148 | /* implicit directory ID */ |
1151 | tgt->directory_id = ((unit->directory - device->config_rom) * 4 | 1149 | tgt->directory_id = ((unit->directory - device->config_rom) * 4 |
1152 | + CSR_CONFIG_ROM) & 0xffffff; | 1150 | + CSR_CONFIG_ROM) & 0xffffff; |
1153 | 1151 | ||
1152 | firmware_revision = SBP2_ROM_VALUE_MISSING; | ||
1153 | model = SBP2_ROM_VALUE_MISSING; | ||
1154 | |||
1154 | if (sbp2_scan_unit_dir(tgt, unit->directory, &model, | 1155 | if (sbp2_scan_unit_dir(tgt, unit->directory, &model, |
1155 | &firmware_revision) < 0) | 1156 | &firmware_revision) < 0) |
1156 | goto fail_tgt_put; | 1157 | goto fail_tgt_put; |