diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/Kconfig | 12 | ||||
-rw-r--r-- | drivers/ieee1394/csr.c | 3 | ||||
-rw-r--r-- | drivers/ieee1394/csr1212.c | 37 | ||||
-rw-r--r-- | drivers/ieee1394/dma.c | 2 | ||||
-rw-r--r-- | drivers/ieee1394/eth1394.c | 6 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.c | 35 | ||||
-rw-r--r-- | drivers/ieee1394/iso.c | 27 | ||||
-rw-r--r-- | drivers/ieee1394/iso.h | 13 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 2 | ||||
-rw-r--r-- | drivers/ieee1394/ohci1394.c | 40 | ||||
-rw-r--r-- | drivers/ieee1394/pcilynx.c | 4 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 7 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 135 |
13 files changed, 260 insertions, 63 deletions
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index 7d58af1ae306..25103a0ef9b3 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig | |||
@@ -66,6 +66,18 @@ config IEEE1394_CONFIG_ROM_IP1394 | |||
66 | with MacOSX and WinXP IP-over-1394), enable this option and the | 66 | with MacOSX and WinXP IP-over-1394), enable this option and the |
67 | eth1394 option below. | 67 | eth1394 option below. |
68 | 68 | ||
69 | config IEEE1394_EXPORT_FULL_API | ||
70 | bool "Export all symbols of ieee1394's API" | ||
71 | depends on IEEE1394 | ||
72 | default n | ||
73 | help | ||
74 | Export all symbols of ieee1394's driver programming interface, even | ||
75 | those that are not currently used by the standard IEEE 1394 drivers. | ||
76 | |||
77 | This option does not affect the interface to userspace applications. | ||
78 | Say Y here if you want to compile externally developed drivers that | ||
79 | make extended use of ieee1394's API. It is otherwise safe to say N. | ||
80 | |||
69 | comment "Device Drivers" | 81 | comment "Device Drivers" |
70 | depends on IEEE1394 | 82 | depends on IEEE1394 |
71 | 83 | ||
diff --git a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c index 1b98684aebcd..149573db91c5 100644 --- a/drivers/ieee1394/csr.c +++ b/drivers/ieee1394/csr.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "hosts.h" | 28 | #include "hosts.h" |
29 | #include "ieee1394.h" | 29 | #include "ieee1394.h" |
30 | #include "highlevel.h" | 30 | #include "highlevel.h" |
31 | #include "ieee1394_core.h" | ||
31 | 32 | ||
32 | /* Module Parameters */ | 33 | /* Module Parameters */ |
33 | /* this module parameter can be used to disable mapping of the FCP registers */ | 34 | /* this module parameter can be used to disable mapping of the FCP registers */ |
@@ -232,7 +233,7 @@ static void add_host(struct hpsb_host *host) | |||
232 | host->csr.generation = 2; | 233 | host->csr.generation = 2; |
233 | 234 | ||
234 | bus_info[1] = __constant_cpu_to_be32(0x31333934); | 235 | bus_info[1] = __constant_cpu_to_be32(0x31333934); |
235 | bus_info[2] = cpu_to_be32((1 << CSR_IRMC_SHIFT) | | 236 | bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) | |
236 | (1 << CSR_CMC_SHIFT) | | 237 | (1 << CSR_CMC_SHIFT) | |
237 | (1 << CSR_ISC_SHIFT) | | 238 | (1 << CSR_ISC_SHIFT) | |
238 | (0 << CSR_BMC_SHIFT) | | 239 | (0 << CSR_BMC_SHIFT) | |
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 7c4330e2e875..61ddd5d37eff 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -209,7 +209,15 @@ void csr1212_init_local_csr(struct csr1212_csr *csr, | |||
209 | { | 209 | { |
210 | static const int mr_map[] = { 4, 64, 1024, 0 }; | 210 | static const int mr_map[] = { 4, 64, 1024, 0 }; |
211 | 211 | ||
212 | #ifdef __KERNEL__ | ||
213 | BUG_ON(max_rom & ~0x3); | ||
212 | csr->max_rom = mr_map[max_rom]; | 214 | csr->max_rom = mr_map[max_rom]; |
215 | #else | ||
216 | if (max_rom & ~0x3) /* caller supplied invalid argument */ | ||
217 | csr->max_rom = 0; | ||
218 | else | ||
219 | csr->max_rom = mr_map[max_rom]; | ||
220 | #endif | ||
213 | memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len); | 221 | memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len); |
214 | } | 222 | } |
215 | 223 | ||
@@ -533,12 +541,15 @@ struct csr1212_keyval *csr1212_new_icon_descriptor_leaf(u_int32_t version, | |||
533 | static const int pd[4] = { 0, 4, 16, 256 }; | 541 | static const int pd[4] = { 0, 4, 16, 256 }; |
534 | static const int cs[16] = { 4, 2 }; | 542 | static const int cs[16] = { 4, 2 }; |
535 | struct csr1212_keyval *kv; | 543 | struct csr1212_keyval *kv; |
536 | int palette_size = pd[palette_depth] * cs[color_space]; | 544 | int palette_size; |
537 | int pixel_size = (hscan * vscan + 3) & ~0x3; | 545 | int pixel_size = (hscan * vscan + 3) & ~0x3; |
538 | 546 | ||
539 | if ((palette_depth && !palette) || !pixels) | 547 | if (!pixels || (!palette && palette_depth) || |
548 | (palette_depth & ~0x3) || (color_space & ~0xf)) | ||
540 | return NULL; | 549 | return NULL; |
541 | 550 | ||
551 | palette_size = pd[palette_depth] * cs[color_space]; | ||
552 | |||
542 | kv = csr1212_new_descriptor_leaf(1, 0, NULL, | 553 | kv = csr1212_new_descriptor_leaf(1, 0, NULL, |
543 | palette_size + pixel_size + | 554 | palette_size + pixel_size + |
544 | CSR1212_ICON_DESCRIPTOR_LEAF_OVERHEAD); | 555 | CSR1212_ICON_DESCRIPTOR_LEAF_OVERHEAD); |
@@ -760,9 +771,9 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) | |||
760 | struct csr1212_csr_rom_cache *cache; | 771 | struct csr1212_csr_rom_cache *cache; |
761 | u_int64_t csr_addr; | 772 | u_int64_t csr_addr; |
762 | 773 | ||
763 | if (!csr || !csr->ops->allocate_addr_range || | 774 | if (!csr || !csr->ops || !csr->ops->allocate_addr_range || |
764 | !csr->ops->release_addr) | 775 | !csr->ops->release_addr || csr->max_rom < 1) |
765 | return CSR1212_ENOMEM; | 776 | return CSR1212_EINVAL; |
766 | 777 | ||
767 | /* ROM size must be a multiple of csr->max_rom */ | 778 | /* ROM size must be a multiple of csr->max_rom */ |
768 | romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); | 779 | romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); |
@@ -1145,6 +1156,8 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
1145 | 1156 | ||
1146 | /* Make sure the Extended ROM leaf is a multiple of | 1157 | /* Make sure the Extended ROM leaf is a multiple of |
1147 | * max_rom in size. */ | 1158 | * max_rom in size. */ |
1159 | if (csr->max_rom < 1) | ||
1160 | return CSR1212_EINVAL; | ||
1148 | leaf_size = (cache->len + (csr->max_rom - 1)) & | 1161 | leaf_size = (cache->len + (csr->max_rom - 1)) & |
1149 | ~(csr->max_rom - 1); | 1162 | ~(csr->max_rom - 1); |
1150 | 1163 | ||
@@ -1409,7 +1422,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1409 | u_int32_t *cache_ptr; | 1422 | u_int32_t *cache_ptr; |
1410 | u_int16_t kv_len = 0; | 1423 | u_int16_t kv_len = 0; |
1411 | 1424 | ||
1412 | if (!csr || !kv) | 1425 | if (!csr || !kv || csr->max_rom < 1) |
1413 | return CSR1212_EINVAL; | 1426 | return CSR1212_EINVAL; |
1414 | 1427 | ||
1415 | /* First find which cache the data should be in (or go in if not read | 1428 | /* First find which cache the data should be in (or go in if not read |
@@ -1572,7 +1585,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1572 | struct csr1212_dentry *dentry; | 1585 | struct csr1212_dentry *dentry; |
1573 | int ret; | 1586 | int ret; |
1574 | 1587 | ||
1575 | if (!csr || !csr->ops->bus_read) | 1588 | if (!csr || !csr->ops || !csr->ops->bus_read) |
1576 | return CSR1212_EINVAL; | 1589 | return CSR1212_EINVAL; |
1577 | 1590 | ||
1578 | ret = csr1212_parse_bus_info_block(csr); | 1591 | ret = csr1212_parse_bus_info_block(csr); |
@@ -1581,9 +1594,13 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1581 | 1594 | ||
1582 | if (!csr->ops->get_max_rom) | 1595 | if (!csr->ops->get_max_rom) |
1583 | csr->max_rom = mr_map[0]; /* default value */ | 1596 | csr->max_rom = mr_map[0]; /* default value */ |
1584 | else | 1597 | else { |
1585 | csr->max_rom = mr_map[csr->ops->get_max_rom(csr->bus_info_data, | 1598 | int i = csr->ops->get_max_rom(csr->bus_info_data, |
1586 | csr->private)]; | 1599 | csr->private); |
1600 | if (i & ~0x3) | ||
1601 | return CSR1212_EINVAL; | ||
1602 | csr->max_rom = mr_map[i]; | ||
1603 | } | ||
1587 | 1604 | ||
1588 | csr->cache_head->layout_head = csr->root_kv; | 1605 | csr->cache_head->layout_head = csr->root_kv; |
1589 | csr->cache_head->layout_tail = csr->root_kv; | 1606 | csr->cache_head->layout_tail = csr->root_kv; |
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c index 758819d1999d..b79ddb43e746 100644 --- a/drivers/ieee1394/dma.c +++ b/drivers/ieee1394/dma.c | |||
@@ -158,7 +158,7 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset, | |||
158 | 158 | ||
159 | dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset) | 159 | dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset) |
160 | { | 160 | { |
161 | unsigned long rem; | 161 | unsigned long rem = 0; |
162 | 162 | ||
163 | struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, &rem)]; | 163 | struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, &rem)]; |
164 | return sg_dma_address(sg) + rem; | 164 | return sg_dma_address(sg) + rem; |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 654da76bf811..cd53c174ced1 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -89,7 +89,7 @@ | |||
89 | #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) | 89 | #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) |
90 | 90 | ||
91 | static char version[] __devinitdata = | 91 | static char version[] __devinitdata = |
92 | "$Rev: 1247 $ Ben Collins <bcollins@debian.org>"; | 92 | "$Rev: 1264 $ Ben Collins <bcollins@debian.org>"; |
93 | 93 | ||
94 | struct fragment_info { | 94 | struct fragment_info { |
95 | struct list_head list; | 95 | struct list_head list; |
@@ -706,7 +706,7 @@ static void ether1394_host_reset (struct hpsb_host *host) | |||
706 | return; | 706 | return; |
707 | 707 | ||
708 | dev = hi->dev; | 708 | dev = hi->dev; |
709 | priv = netdev_priv(dev); | 709 | priv = (struct eth1394_priv *)netdev_priv(dev); |
710 | 710 | ||
711 | /* Reset our private host data, but not our mtu */ | 711 | /* Reset our private host data, but not our mtu */ |
712 | netif_stop_queue (dev); | 712 | netif_stop_queue (dev); |
@@ -1770,7 +1770,7 @@ fail: | |||
1770 | static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1770 | static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1771 | { | 1771 | { |
1772 | strcpy (info->driver, driver_name); | 1772 | strcpy (info->driver, driver_name); |
1773 | strcpy (info->version, "$Rev: 1247 $"); | 1773 | strcpy (info->version, "$Rev: 1264 $"); |
1774 | /* FIXME XXX provide sane businfo */ | 1774 | /* FIXME XXX provide sane businfo */ |
1775 | strcpy (info->bus_info, "ieee1394"); | 1775 | strcpy (info->bus_info, "ieee1394"); |
1776 | } | 1776 | } |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 629070b83a33..b248d89de8b4 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -52,7 +52,7 @@ | |||
52 | /* | 52 | /* |
53 | * Disable the nodemgr detection and config rom reading functionality. | 53 | * Disable the nodemgr detection and config rom reading functionality. |
54 | */ | 54 | */ |
55 | static int disable_nodemgr = 0; | 55 | static int disable_nodemgr; |
56 | module_param(disable_nodemgr, int, 0444); | 56 | module_param(disable_nodemgr, int, 0444); |
57 | MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality."); | 57 | MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality."); |
58 | 58 | ||
@@ -520,6 +520,9 @@ int hpsb_send_packet(struct hpsb_packet *packet) | |||
520 | 520 | ||
521 | if (!packet->no_waiter || packet->expect_response) { | 521 | if (!packet->no_waiter || packet->expect_response) { |
522 | atomic_inc(&packet->refcnt); | 522 | atomic_inc(&packet->refcnt); |
523 | /* Set the initial "sendtime" to 10 seconds from now, to | ||
524 | prevent premature expiry. If a packet takes more than | ||
525 | 10 seconds to hit the wire, we have bigger problems :) */ | ||
523 | packet->sendtime = jiffies + 10 * HZ; | 526 | packet->sendtime = jiffies + 10 * HZ; |
524 | skb_queue_tail(&host->pending_packet_queue, packet->skb); | 527 | skb_queue_tail(&host->pending_packet_queue, packet->skb); |
525 | } | 528 | } |
@@ -1223,9 +1226,7 @@ EXPORT_SYMBOL(hpsb_protocol_class); | |||
1223 | EXPORT_SYMBOL(hpsb_set_packet_complete_task); | 1226 | EXPORT_SYMBOL(hpsb_set_packet_complete_task); |
1224 | EXPORT_SYMBOL(hpsb_alloc_packet); | 1227 | EXPORT_SYMBOL(hpsb_alloc_packet); |
1225 | EXPORT_SYMBOL(hpsb_free_packet); | 1228 | EXPORT_SYMBOL(hpsb_free_packet); |
1226 | EXPORT_SYMBOL(hpsb_send_phy_config); | ||
1227 | EXPORT_SYMBOL(hpsb_send_packet); | 1229 | EXPORT_SYMBOL(hpsb_send_packet); |
1228 | EXPORT_SYMBOL(hpsb_send_packet_and_wait); | ||
1229 | EXPORT_SYMBOL(hpsb_reset_bus); | 1230 | EXPORT_SYMBOL(hpsb_reset_bus); |
1230 | EXPORT_SYMBOL(hpsb_bus_reset); | 1231 | EXPORT_SYMBOL(hpsb_bus_reset); |
1231 | EXPORT_SYMBOL(hpsb_selfid_received); | 1232 | EXPORT_SYMBOL(hpsb_selfid_received); |
@@ -1233,6 +1234,10 @@ EXPORT_SYMBOL(hpsb_selfid_complete); | |||
1233 | EXPORT_SYMBOL(hpsb_packet_sent); | 1234 | EXPORT_SYMBOL(hpsb_packet_sent); |
1234 | EXPORT_SYMBOL(hpsb_packet_received); | 1235 | EXPORT_SYMBOL(hpsb_packet_received); |
1235 | EXPORT_SYMBOL_GPL(hpsb_disable_irm); | 1236 | EXPORT_SYMBOL_GPL(hpsb_disable_irm); |
1237 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API | ||
1238 | EXPORT_SYMBOL(hpsb_send_phy_config); | ||
1239 | EXPORT_SYMBOL(hpsb_send_packet_and_wait); | ||
1240 | #endif | ||
1236 | 1241 | ||
1237 | /** ieee1394_transactions.c **/ | 1242 | /** ieee1394_transactions.c **/ |
1238 | EXPORT_SYMBOL(hpsb_get_tlabel); | 1243 | EXPORT_SYMBOL(hpsb_get_tlabel); |
@@ -1262,9 +1267,11 @@ EXPORT_SYMBOL(hpsb_destroy_hostinfo); | |||
1262 | EXPORT_SYMBOL(hpsb_set_hostinfo_key); | 1267 | EXPORT_SYMBOL(hpsb_set_hostinfo_key); |
1263 | EXPORT_SYMBOL(hpsb_get_hostinfo_bykey); | 1268 | EXPORT_SYMBOL(hpsb_get_hostinfo_bykey); |
1264 | EXPORT_SYMBOL(hpsb_set_hostinfo); | 1269 | EXPORT_SYMBOL(hpsb_set_hostinfo); |
1270 | EXPORT_SYMBOL(highlevel_host_reset); | ||
1271 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API | ||
1265 | EXPORT_SYMBOL(highlevel_add_host); | 1272 | EXPORT_SYMBOL(highlevel_add_host); |
1266 | EXPORT_SYMBOL(highlevel_remove_host); | 1273 | EXPORT_SYMBOL(highlevel_remove_host); |
1267 | EXPORT_SYMBOL(highlevel_host_reset); | 1274 | #endif |
1268 | 1275 | ||
1269 | /** nodemgr.c **/ | 1276 | /** nodemgr.c **/ |
1270 | EXPORT_SYMBOL(hpsb_node_fill_packet); | 1277 | EXPORT_SYMBOL(hpsb_node_fill_packet); |
@@ -1272,7 +1279,9 @@ EXPORT_SYMBOL(hpsb_node_write); | |||
1272 | EXPORT_SYMBOL(hpsb_register_protocol); | 1279 | EXPORT_SYMBOL(hpsb_register_protocol); |
1273 | EXPORT_SYMBOL(hpsb_unregister_protocol); | 1280 | EXPORT_SYMBOL(hpsb_unregister_protocol); |
1274 | EXPORT_SYMBOL(ieee1394_bus_type); | 1281 | EXPORT_SYMBOL(ieee1394_bus_type); |
1282 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API | ||
1275 | EXPORT_SYMBOL(nodemgr_for_each_host); | 1283 | EXPORT_SYMBOL(nodemgr_for_each_host); |
1284 | #endif | ||
1276 | 1285 | ||
1277 | /** csr.c **/ | 1286 | /** csr.c **/ |
1278 | EXPORT_SYMBOL(hpsb_update_config_rom); | 1287 | EXPORT_SYMBOL(hpsb_update_config_rom); |
@@ -1309,19 +1318,21 @@ EXPORT_SYMBOL(hpsb_iso_wake); | |||
1309 | EXPORT_SYMBOL(hpsb_iso_recv_flush); | 1318 | EXPORT_SYMBOL(hpsb_iso_recv_flush); |
1310 | 1319 | ||
1311 | /** csr1212.c **/ | 1320 | /** csr1212.c **/ |
1312 | EXPORT_SYMBOL(csr1212_create_csr); | ||
1313 | EXPORT_SYMBOL(csr1212_init_local_csr); | ||
1314 | EXPORT_SYMBOL(csr1212_new_immediate); | ||
1315 | EXPORT_SYMBOL(csr1212_new_directory); | 1321 | EXPORT_SYMBOL(csr1212_new_directory); |
1316 | EXPORT_SYMBOL(csr1212_associate_keyval); | ||
1317 | EXPORT_SYMBOL(csr1212_attach_keyval_to_directory); | 1322 | EXPORT_SYMBOL(csr1212_attach_keyval_to_directory); |
1318 | EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf); | ||
1319 | EXPORT_SYMBOL(csr1212_detach_keyval_from_directory); | 1323 | EXPORT_SYMBOL(csr1212_detach_keyval_from_directory); |
1320 | EXPORT_SYMBOL(csr1212_release_keyval); | 1324 | EXPORT_SYMBOL(csr1212_release_keyval); |
1321 | EXPORT_SYMBOL(csr1212_destroy_csr); | ||
1322 | EXPORT_SYMBOL(csr1212_read); | 1325 | EXPORT_SYMBOL(csr1212_read); |
1323 | EXPORT_SYMBOL(csr1212_generate_csr_image); | ||
1324 | EXPORT_SYMBOL(csr1212_parse_keyval); | 1326 | EXPORT_SYMBOL(csr1212_parse_keyval); |
1325 | EXPORT_SYMBOL(csr1212_parse_csr); | ||
1326 | EXPORT_SYMBOL(_csr1212_read_keyval); | 1327 | EXPORT_SYMBOL(_csr1212_read_keyval); |
1327 | EXPORT_SYMBOL(_csr1212_destroy_keyval); | 1328 | EXPORT_SYMBOL(_csr1212_destroy_keyval); |
1329 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API | ||
1330 | EXPORT_SYMBOL(csr1212_create_csr); | ||
1331 | EXPORT_SYMBOL(csr1212_init_local_csr); | ||
1332 | EXPORT_SYMBOL(csr1212_new_immediate); | ||
1333 | EXPORT_SYMBOL(csr1212_associate_keyval); | ||
1334 | EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf); | ||
1335 | EXPORT_SYMBOL(csr1212_destroy_csr); | ||
1336 | EXPORT_SYMBOL(csr1212_generate_csr_image); | ||
1337 | EXPORT_SYMBOL(csr1212_parse_csr); | ||
1338 | #endif | ||
diff --git a/drivers/ieee1394/iso.c b/drivers/ieee1394/iso.c index f05759107f7e..615541b8b90f 100644 --- a/drivers/ieee1394/iso.c +++ b/drivers/ieee1394/iso.c | |||
@@ -62,10 +62,10 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i | |||
62 | if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) | 62 | if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) |
63 | dma_mode=HPSB_ISO_DMA_DEFAULT; | 63 | dma_mode=HPSB_ISO_DMA_DEFAULT; |
64 | 64 | ||
65 | if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) | ||
66 | irq_interval = buf_packets / 4; | ||
65 | if (irq_interval == 0) /* really interrupt for each packet*/ | 67 | if (irq_interval == 0) /* really interrupt for each packet*/ |
66 | irq_interval = 1; | 68 | irq_interval = 1; |
67 | else if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) | ||
68 | irq_interval = buf_packets / 4; | ||
69 | 69 | ||
70 | if (channel < -1 || channel >= 64) | 70 | if (channel < -1 || channel >= 64) |
71 | return NULL; | 71 | return NULL; |
@@ -106,6 +106,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i | |||
106 | } | 106 | } |
107 | 107 | ||
108 | atomic_set(&iso->overflows, 0); | 108 | atomic_set(&iso->overflows, 0); |
109 | iso->bytes_discarded = 0; | ||
109 | iso->flags = 0; | 110 | iso->flags = 0; |
110 | iso->prebuffer = 0; | 111 | iso->prebuffer = 0; |
111 | 112 | ||
@@ -241,12 +242,12 @@ int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer) | |||
241 | iso->xmit_cycle = cycle; | 242 | iso->xmit_cycle = cycle; |
242 | 243 | ||
243 | if (prebuffer < 0) | 244 | if (prebuffer < 0) |
244 | prebuffer = iso->buf_packets; | 245 | prebuffer = iso->buf_packets - 1; |
245 | else if (prebuffer == 0) | 246 | else if (prebuffer == 0) |
246 | prebuffer = 1; | 247 | prebuffer = 1; |
247 | 248 | ||
248 | if (prebuffer > iso->buf_packets) | 249 | if (prebuffer >= iso->buf_packets) |
249 | prebuffer = iso->buf_packets; | 250 | prebuffer = iso->buf_packets - 1; |
250 | 251 | ||
251 | iso->prebuffer = prebuffer; | 252 | iso->prebuffer = prebuffer; |
252 | 253 | ||
@@ -395,7 +396,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) | |||
395 | } | 396 | } |
396 | 397 | ||
397 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 398 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, |
398 | u16 cycle, u8 channel, u8 tag, u8 sy) | 399 | u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) |
399 | { | 400 | { |
400 | unsigned long flags; | 401 | unsigned long flags; |
401 | spin_lock_irqsave(&iso->lock, flags); | 402 | spin_lock_irqsave(&iso->lock, flags); |
@@ -403,10 +404,13 @@ void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | |||
403 | if (iso->n_ready_packets == iso->buf_packets) { | 404 | if (iso->n_ready_packets == iso->buf_packets) { |
404 | /* overflow! */ | 405 | /* overflow! */ |
405 | atomic_inc(&iso->overflows); | 406 | atomic_inc(&iso->overflows); |
407 | /* Record size of this discarded packet */ | ||
408 | iso->bytes_discarded += total_len; | ||
406 | } else { | 409 | } else { |
407 | struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma]; | 410 | struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma]; |
408 | info->offset = offset; | 411 | info->offset = offset; |
409 | info->len = len; | 412 | info->len = len; |
413 | info->total_len = total_len; | ||
410 | info->cycle = cycle; | 414 | info->cycle = cycle; |
411 | info->channel = channel; | 415 | info->channel = channel; |
412 | info->tag = tag; | 416 | info->tag = tag; |
@@ -437,6 +441,17 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) | |||
437 | 441 | ||
438 | iso->first_packet = (iso->first_packet+1) % iso->buf_packets; | 442 | iso->first_packet = (iso->first_packet+1) % iso->buf_packets; |
439 | iso->n_ready_packets--; | 443 | iso->n_ready_packets--; |
444 | |||
445 | /* release memory from packets discarded when queue was full */ | ||
446 | if (iso->n_ready_packets == 0) { /* Release only after all prior packets handled */ | ||
447 | if (iso->bytes_discarded != 0) { | ||
448 | struct hpsb_iso_packet_info inf; | ||
449 | inf.total_len = iso->bytes_discarded; | ||
450 | iso->host->driver->isoctl(iso, RECV_RELEASE, | ||
451 | (unsigned long) &inf); | ||
452 | iso->bytes_discarded = 0; | ||
453 | } | ||
454 | } | ||
440 | } | 455 | } |
441 | spin_unlock_irqrestore(&iso->lock, flags); | 456 | spin_unlock_irqrestore(&iso->lock, flags); |
442 | return rv; | 457 | return rv; |
diff --git a/drivers/ieee1394/iso.h b/drivers/ieee1394/iso.h index fb654d9639a7..3efc60b33a88 100644 --- a/drivers/ieee1394/iso.h +++ b/drivers/ieee1394/iso.h | |||
@@ -47,6 +47,14 @@ struct hpsb_iso_packet_info { | |||
47 | /* 2-bit 'tag' and 4-bit 'sy' fields of the isochronous header */ | 47 | /* 2-bit 'tag' and 4-bit 'sy' fields of the isochronous header */ |
48 | __u8 tag; | 48 | __u8 tag; |
49 | __u8 sy; | 49 | __u8 sy; |
50 | |||
51 | /* | ||
52 | * length in bytes of the packet including header/trailer. | ||
53 | * MUST be at structure end, since the first part of this structure is also | ||
54 | * defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is copied to | ||
55 | * userspace and is accessed there through libraw1394. | ||
56 | */ | ||
57 | __u16 total_len; | ||
50 | }; | 58 | }; |
51 | 59 | ||
52 | enum hpsb_iso_type { HPSB_ISO_RECV = 0, HPSB_ISO_XMIT = 1 }; | 60 | enum hpsb_iso_type { HPSB_ISO_RECV = 0, HPSB_ISO_XMIT = 1 }; |
@@ -111,6 +119,9 @@ struct hpsb_iso { | |||
111 | /* how many times the buffer has overflowed or underflowed */ | 119 | /* how many times the buffer has overflowed or underflowed */ |
112 | atomic_t overflows; | 120 | atomic_t overflows; |
113 | 121 | ||
122 | /* Current number of bytes lost in discarded packets */ | ||
123 | int bytes_discarded; | ||
124 | |||
114 | /* private flags to track initialization progress */ | 125 | /* private flags to track initialization progress */ |
115 | #define HPSB_ISO_DRIVER_INIT (1<<0) | 126 | #define HPSB_ISO_DRIVER_INIT (1<<0) |
116 | #define HPSB_ISO_DRIVER_STARTED (1<<1) | 127 | #define HPSB_ISO_DRIVER_STARTED (1<<1) |
@@ -193,7 +204,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); | |||
193 | 204 | ||
194 | /* call after a packet has been received (interrupt context OK) */ | 205 | /* call after a packet has been received (interrupt context OK) */ |
195 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 206 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, |
196 | u16 cycle, u8 channel, u8 tag, u8 sy); | 207 | u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy); |
197 | 208 | ||
198 | /* call to wake waiting processes after buffer space has opened up. */ | 209 | /* call to wake waiting processes after buffer space has opened up. */ |
199 | void hpsb_iso_wake(struct hpsb_iso *iso); | 210 | void hpsb_iso_wake(struct hpsb_iso *iso); |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 9a46c3b44bf8..bebcc47ab06c 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "csr.h" | 30 | #include "csr.h" |
31 | #include "nodemgr.h" | 31 | #include "nodemgr.h" |
32 | 32 | ||
33 | static int ignore_drivers = 0; | 33 | static int ignore_drivers; |
34 | module_param(ignore_drivers, int, 0444); | 34 | module_param(ignore_drivers, int, 0444); |
35 | MODULE_PARM_DESC(ignore_drivers, "Disable automatic probing for drivers."); | 35 | MODULE_PARM_DESC(ignore_drivers, "Disable automatic probing for drivers."); |
36 | 36 | ||
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index b3d3d22fde64..a485f47bb21e 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -162,7 +162,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) | |||
162 | printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) | 162 | printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) |
163 | 163 | ||
164 | static char version[] __devinitdata = | 164 | static char version[] __devinitdata = |
165 | "$Rev: 1250 $ Ben Collins <bcollins@debian.org>"; | 165 | "$Rev: 1299 $ Ben Collins <bcollins@debian.org>"; |
166 | 166 | ||
167 | /* Module Parameters */ | 167 | /* Module Parameters */ |
168 | static int phys_dma = 1; | 168 | static int phys_dma = 1; |
@@ -483,7 +483,9 @@ static void ohci_initialize(struct ti_ohci *ohci) | |||
483 | /* Put some defaults to these undefined bus options */ | 483 | /* Put some defaults to these undefined bus options */ |
484 | buf = reg_read(ohci, OHCI1394_BusOptions); | 484 | buf = reg_read(ohci, OHCI1394_BusOptions); |
485 | buf |= 0x60000000; /* Enable CMC and ISC */ | 485 | buf |= 0x60000000; /* Enable CMC and ISC */ |
486 | if (!hpsb_disable_irm) | 486 | if (hpsb_disable_irm) |
487 | buf &= ~0x80000000; | ||
488 | else | ||
487 | buf |= 0x80000000; /* Enable IRMC */ | 489 | buf |= 0x80000000; /* Enable IRMC */ |
488 | buf &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */ | 490 | buf &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */ |
489 | buf &= ~0x18000000; /* Disable PMC and BMC */ | 491 | buf &= ~0x18000000; /* Disable PMC and BMC */ |
@@ -503,8 +505,12 @@ static void ohci_initialize(struct ti_ohci *ohci) | |||
503 | reg_write(ohci, OHCI1394_LinkControlSet, | 505 | reg_write(ohci, OHCI1394_LinkControlSet, |
504 | OHCI1394_LinkControl_CycleTimerEnable | | 506 | OHCI1394_LinkControl_CycleTimerEnable | |
505 | OHCI1394_LinkControl_CycleMaster); | 507 | OHCI1394_LinkControl_CycleMaster); |
506 | set_phy_reg_mask(ohci, 4, PHY_04_LCTRL | | 508 | i = get_phy_reg(ohci, 4) | PHY_04_LCTRL; |
507 | (hpsb_disable_irm ? 0 : PHY_04_CONTENDER)); | 509 | if (hpsb_disable_irm) |
510 | i &= ~PHY_04_CONTENDER; | ||
511 | else | ||
512 | i |= PHY_04_CONTENDER; | ||
513 | set_phy_reg(ohci, 4, i); | ||
508 | 514 | ||
509 | /* Set up self-id dma buffer */ | 515 | /* Set up self-id dma buffer */ |
510 | reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus); | 516 | reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus); |
@@ -1566,6 +1572,10 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block) | |||
1566 | 1572 | ||
1567 | struct dma_cmd *next = &recv->block[next_i]; | 1573 | struct dma_cmd *next = &recv->block[next_i]; |
1568 | struct dma_cmd *prev = &recv->block[prev_i]; | 1574 | struct dma_cmd *prev = &recv->block[prev_i]; |
1575 | |||
1576 | /* ignore out-of-range requests */ | ||
1577 | if ((block < 0) || (block > recv->nblocks)) | ||
1578 | return; | ||
1569 | 1579 | ||
1570 | /* 'next' becomes the new end of the DMA chain, | 1580 | /* 'next' becomes the new end of the DMA chain, |
1571 | so disable branch and enable interrupt */ | 1581 | so disable branch and enable interrupt */ |
@@ -1593,19 +1603,8 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block) | |||
1593 | static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv, | 1603 | static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv, |
1594 | struct hpsb_iso_packet_info *info) | 1604 | struct hpsb_iso_packet_info *info) |
1595 | { | 1605 | { |
1596 | int len; | ||
1597 | |||
1598 | /* release the memory where the packet was */ | 1606 | /* release the memory where the packet was */ |
1599 | len = info->len; | 1607 | recv->released_bytes += info->total_len; |
1600 | |||
1601 | /* add the wasted space for padding to 4 bytes */ | ||
1602 | if (len % 4) | ||
1603 | len += 4 - (len % 4); | ||
1604 | |||
1605 | /* add 8 bytes for the OHCI DMA data format overhead */ | ||
1606 | len += 8; | ||
1607 | |||
1608 | recv->released_bytes += len; | ||
1609 | 1608 | ||
1610 | /* have we released enough memory for one block? */ | 1609 | /* have we released enough memory for one block? */ |
1611 | while (recv->released_bytes > recv->buf_stride) { | 1610 | while (recv->released_bytes > recv->buf_stride) { |
@@ -1637,7 +1636,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso | |||
1637 | /* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */ | 1636 | /* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */ |
1638 | 1637 | ||
1639 | unsigned int offset; | 1638 | unsigned int offset; |
1640 | unsigned short len, cycle; | 1639 | unsigned short len, cycle, total_len; |
1641 | unsigned char channel, tag, sy; | 1640 | unsigned char channel, tag, sy; |
1642 | 1641 | ||
1643 | unsigned char *p = iso->data_buf.kvirt; | 1642 | unsigned char *p = iso->data_buf.kvirt; |
@@ -1688,9 +1687,11 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso | |||
1688 | /* advance to xferStatus/timeStamp */ | 1687 | /* advance to xferStatus/timeStamp */ |
1689 | recv->dma_offset += len; | 1688 | recv->dma_offset += len; |
1690 | 1689 | ||
1690 | total_len = len + 8; /* 8 bytes header+trailer in OHCI packet */ | ||
1691 | /* payload is padded to 4 bytes */ | 1691 | /* payload is padded to 4 bytes */ |
1692 | if (len % 4) { | 1692 | if (len % 4) { |
1693 | recv->dma_offset += 4 - (len%4); | 1693 | recv->dma_offset += 4 - (len%4); |
1694 | total_len += 4 - (len%4); | ||
1694 | } | 1695 | } |
1695 | 1696 | ||
1696 | /* check for wrap-around */ | 1697 | /* check for wrap-around */ |
@@ -1724,7 +1725,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso | |||
1724 | recv->dma_offset -= recv->buf_stride*recv->nblocks; | 1725 | recv->dma_offset -= recv->buf_stride*recv->nblocks; |
1725 | } | 1726 | } |
1726 | 1727 | ||
1727 | hpsb_iso_packet_received(iso, offset, len, cycle, channel, tag, sy); | 1728 | hpsb_iso_packet_received(iso, offset, len, total_len, cycle, channel, tag, sy); |
1728 | } | 1729 | } |
1729 | 1730 | ||
1730 | if (wake) | 1731 | if (wake) |
@@ -1850,7 +1851,8 @@ static void ohci_iso_recv_packetperbuf_task(struct hpsb_iso *iso, struct ohci_is | |||
1850 | tag = hdr[5] >> 6; | 1851 | tag = hdr[5] >> 6; |
1851 | sy = hdr[4] & 0xF; | 1852 | sy = hdr[4] & 0xF; |
1852 | 1853 | ||
1853 | hpsb_iso_packet_received(iso, offset, packet_len, cycle, channel, tag, sy); | 1854 | hpsb_iso_packet_received(iso, offset, packet_len, |
1855 | recv->buf_stride, cycle, channel, tag, sy); | ||
1854 | } | 1856 | } |
1855 | 1857 | ||
1856 | /* reset the DMA descriptor */ | 1858 | /* reset the DMA descriptor */ |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index bdb3a85cafa6..36074e6eeebb 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | 77 | ||
78 | /* Module Parameters */ | 78 | /* Module Parameters */ |
79 | static int skip_eeprom = 0; | 79 | static int skip_eeprom; |
80 | module_param(skip_eeprom, int, 0444); | 80 | module_param(skip_eeprom, int, 0444); |
81 | MODULE_PARM_DESC(skip_eeprom, "Use generic bus info block instead of serial eeprom (default = 0)."); | 81 | MODULE_PARM_DESC(skip_eeprom, "Use generic bus info block instead of serial eeprom (default = 0)."); |
82 | 82 | ||
@@ -1422,7 +1422,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1422 | i = get_phy_reg(lynx, 4); | 1422 | i = get_phy_reg(lynx, 4); |
1423 | i |= PHY_04_LCTRL; | 1423 | i |= PHY_04_LCTRL; |
1424 | if (hpsb_disable_irm) | 1424 | if (hpsb_disable_irm) |
1425 | i &= !PHY_04_CONTENDER; | 1425 | i &= ~PHY_04_CONTENDER; |
1426 | else | 1426 | else |
1427 | i |= PHY_04_CONTENDER; | 1427 | i |= PHY_04_CONTENDER; |
1428 | if (i != -1) set_phy_reg(lynx, 4, i); | 1428 | if (i != -1) set_phy_reg(lynx, 4, i); |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 7419af450bd1..b4fa14793fe5 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -98,7 +98,7 @@ static struct hpsb_address_ops arm_ops = { | |||
98 | 98 | ||
99 | static void queue_complete_cb(struct pending_request *req); | 99 | static void queue_complete_cb(struct pending_request *req); |
100 | 100 | ||
101 | static struct pending_request *__alloc_pending_request(int flags) | 101 | static struct pending_request *__alloc_pending_request(unsigned int __nocast flags) |
102 | { | 102 | { |
103 | struct pending_request *req; | 103 | struct pending_request *req; |
104 | 104 | ||
@@ -2506,9 +2506,12 @@ static int raw1394_iso_send_packets(struct file_info *fi, void __user * uaddr) | |||
2506 | if (copy_from_user(&upackets, uaddr, sizeof(upackets))) | 2506 | if (copy_from_user(&upackets, uaddr, sizeof(upackets))) |
2507 | return -EFAULT; | 2507 | return -EFAULT; |
2508 | 2508 | ||
2509 | if (upackets.n_packets > hpsb_iso_n_ready(fi->iso_handle)) | 2509 | if (upackets.n_packets >= fi->iso_handle->buf_packets) |
2510 | return -EINVAL; | 2510 | return -EINVAL; |
2511 | 2511 | ||
2512 | if (upackets.n_packets >= hpsb_iso_n_ready(fi->iso_handle)) | ||
2513 | return -EAGAIN; | ||
2514 | |||
2512 | /* ensure user-supplied buffer is accessible and big enough */ | 2515 | /* ensure user-supplied buffer is accessible and big enough */ |
2513 | if (!access_ok(VERIFY_READ, upackets.infos, | 2516 | if (!access_ok(VERIFY_READ, upackets.infos, |
2514 | upackets.n_packets * | 2517 | upackets.n_packets * |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 32368f3428ec..fe3e1703fa61 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #include "sbp2.h" | 81 | #include "sbp2.h" |
82 | 82 | ||
83 | static char version[] __devinitdata = | 83 | static char version[] __devinitdata = |
84 | "$Rev: 1219 $ Ben Collins <bcollins@debian.org>"; | 84 | "$Rev: 1306 $ Ben Collins <bcollins@debian.org>"; |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * Module load parameter definitions | 87 | * Module load parameter definitions |
@@ -104,7 +104,7 @@ MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb default, 1 = | |||
104 | * down to us at a time (debugging). This might be necessary for very | 104 | * down to us at a time (debugging). This might be necessary for very |
105 | * badly behaved sbp2 devices. | 105 | * badly behaved sbp2 devices. |
106 | */ | 106 | */ |
107 | static int serialize_io = 0; | 107 | static int serialize_io; |
108 | module_param(serialize_io, int, 0444); | 108 | module_param(serialize_io, int, 0444); |
109 | MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); | 109 | MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); |
110 | 110 | ||
@@ -145,7 +145,7 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)" | |||
145 | * please submit the logged sbp2_firmware_revision value of this device to | 145 | * please submit the logged sbp2_firmware_revision value of this device to |
146 | * the linux1394-devel mailing list. | 146 | * the linux1394-devel mailing list. |
147 | */ | 147 | */ |
148 | static int force_inquiry_hack = 0; | 148 | static int force_inquiry_hack; |
149 | module_param(force_inquiry_hack, int, 0444); | 149 | module_param(force_inquiry_hack, int, 0444); |
150 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 150 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); |
151 | 151 | ||
@@ -2112,6 +2112,102 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2112 | */ | 2112 | */ |
2113 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) | 2113 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) |
2114 | { | 2114 | { |
2115 | unchar new_cmd[16]; | ||
2116 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2117 | |||
2118 | SBP2_DEBUG("sbp2_check_sbp2_command"); | ||
2119 | |||
2120 | switch (*cmd) { | ||
2121 | |||
2122 | case READ_6: | ||
2123 | |||
2124 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2125 | |||
2126 | SBP2_DEBUG("Convert READ_6 to READ_10"); | ||
2127 | |||
2128 | /* | ||
2129 | * Need to turn read_6 into read_10 | ||
2130 | */ | ||
2131 | new_cmd[0] = 0x28; | ||
2132 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2133 | new_cmd[2] = 0x0; | ||
2134 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2135 | new_cmd[4] = cmd[2]; | ||
2136 | new_cmd[5] = cmd[3]; | ||
2137 | new_cmd[6] = 0x0; | ||
2138 | new_cmd[7] = 0x0; | ||
2139 | new_cmd[8] = cmd[4]; | ||
2140 | new_cmd[9] = cmd[5]; | ||
2141 | |||
2142 | memcpy(cmd, new_cmd, 10); | ||
2143 | |||
2144 | } | ||
2145 | |||
2146 | break; | ||
2147 | |||
2148 | case WRITE_6: | ||
2149 | |||
2150 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2151 | |||
2152 | SBP2_DEBUG("Convert WRITE_6 to WRITE_10"); | ||
2153 | |||
2154 | /* | ||
2155 | * Need to turn write_6 into write_10 | ||
2156 | */ | ||
2157 | new_cmd[0] = 0x2a; | ||
2158 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2159 | new_cmd[2] = 0x0; | ||
2160 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2161 | new_cmd[4] = cmd[2]; | ||
2162 | new_cmd[5] = cmd[3]; | ||
2163 | new_cmd[6] = 0x0; | ||
2164 | new_cmd[7] = 0x0; | ||
2165 | new_cmd[8] = cmd[4]; | ||
2166 | new_cmd[9] = cmd[5]; | ||
2167 | |||
2168 | memcpy(cmd, new_cmd, 10); | ||
2169 | |||
2170 | } | ||
2171 | |||
2172 | break; | ||
2173 | |||
2174 | case MODE_SENSE: | ||
2175 | |||
2176 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2177 | |||
2178 | SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10"); | ||
2179 | |||
2180 | /* | ||
2181 | * Need to turn mode_sense_6 into mode_sense_10 | ||
2182 | */ | ||
2183 | new_cmd[0] = 0x5a; | ||
2184 | new_cmd[1] = cmd[1]; | ||
2185 | new_cmd[2] = cmd[2]; | ||
2186 | new_cmd[3] = 0x0; | ||
2187 | new_cmd[4] = 0x0; | ||
2188 | new_cmd[5] = 0x0; | ||
2189 | new_cmd[6] = 0x0; | ||
2190 | new_cmd[7] = 0x0; | ||
2191 | new_cmd[8] = cmd[4]; | ||
2192 | new_cmd[9] = cmd[5]; | ||
2193 | |||
2194 | memcpy(cmd, new_cmd, 10); | ||
2195 | |||
2196 | } | ||
2197 | |||
2198 | break; | ||
2199 | |||
2200 | case MODE_SELECT: | ||
2201 | |||
2202 | /* | ||
2203 | * TODO. Probably need to change mode select to 10 byte version | ||
2204 | */ | ||
2205 | |||
2206 | default: | ||
2207 | break; | ||
2208 | } | ||
2209 | |||
2210 | return; | ||
2115 | } | 2211 | } |
2116 | 2212 | ||
2117 | /* | 2213 | /* |
@@ -2152,6 +2248,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2152 | struct scsi_cmnd *SCpnt) | 2248 | struct scsi_cmnd *SCpnt) |
2153 | { | 2249 | { |
2154 | u8 *scsi_buf = SCpnt->request_buffer; | 2250 | u8 *scsi_buf = SCpnt->request_buffer; |
2251 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2155 | 2252 | ||
2156 | SBP2_DEBUG("sbp2_check_sbp2_response"); | 2253 | SBP2_DEBUG("sbp2_check_sbp2_response"); |
2157 | 2254 | ||
@@ -2176,6 +2273,14 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2176 | } | 2273 | } |
2177 | 2274 | ||
2178 | /* | 2275 | /* |
2276 | * Check for Simple Direct Access Device and change it to TYPE_DISK | ||
2277 | */ | ||
2278 | if ((scsi_buf[0] & 0x1f) == TYPE_RBC) { | ||
2279 | SBP2_DEBUG("Changing TYPE_RBC to TYPE_DISK"); | ||
2280 | scsi_buf[0] &= 0xe0; | ||
2281 | } | ||
2282 | |||
2283 | /* | ||
2179 | * Fix ansi revision and response data format | 2284 | * Fix ansi revision and response data format |
2180 | */ | 2285 | */ |
2181 | scsi_buf[2] |= 2; | 2286 | scsi_buf[2] |= 2; |
@@ -2183,6 +2288,27 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2183 | 2288 | ||
2184 | break; | 2289 | break; |
2185 | 2290 | ||
2291 | case MODE_SENSE: | ||
2292 | |||
2293 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2294 | |||
2295 | SBP2_DEBUG("Modify mode sense response (10 byte version)"); | ||
2296 | |||
2297 | scsi_buf[0] = scsi_buf[1]; /* Mode data length */ | ||
2298 | scsi_buf[1] = scsi_buf[2]; /* Medium type */ | ||
2299 | scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */ | ||
2300 | scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */ | ||
2301 | memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]); | ||
2302 | } | ||
2303 | |||
2304 | break; | ||
2305 | |||
2306 | case MODE_SELECT: | ||
2307 | |||
2308 | /* | ||
2309 | * TODO. Probably need to change mode select to 10 byte version | ||
2310 | */ | ||
2311 | |||
2186 | default: | 2312 | default: |
2187 | break; | 2313 | break; |
2188 | } | 2314 | } |
@@ -2559,8 +2685,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2559 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) | 2685 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) |
2560 | { | 2686 | { |
2561 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2687 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2562 | sdev->use_10_for_rw = 1; | 2688 | |
2563 | sdev->use_10_for_ms = 1; | ||
2564 | return 0; | 2689 | return 0; |
2565 | } | 2690 | } |
2566 | 2691 | ||