aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee1394/dv1394.c41
-rw-r--r--drivers/ieee1394/ieee1394_core.c16
-rw-r--r--drivers/ieee1394/ieee1394_core.h3
-rw-r--r--drivers/ieee1394/ohci1394.c49
-rw-r--r--drivers/ieee1394/raw1394.c6
-rw-r--r--drivers/ieee1394/sbp2.c137
-rw-r--r--drivers/ieee1394/video1394.c16
7 files changed, 86 insertions, 182 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index efeaa944bd0a..85c2d4ca0def 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -73,7 +73,7 @@
73 - fix all XXX showstoppers 73 - fix all XXX showstoppers
74 - disable IR/IT DMA interrupts on shutdown 74 - disable IR/IT DMA interrupts on shutdown
75 - flush pci writes to the card by issuing a read 75 - flush pci writes to the card by issuing a read
76 - devfs and character device dispatching (* needs testing with Linux 2.2.x) 76 - character device dispatching
77 - switch over to the new kernel DMA API (pci_map_*()) (* needs testing on platforms with IOMMU!) 77 - switch over to the new kernel DMA API (pci_map_*()) (* needs testing on platforms with IOMMU!)
78 - keep all video_cards in a list (for open() via chardev), set file->private_data = video 78 - keep all video_cards in a list (for open() via chardev), set file->private_data = video
79 - dv1394_poll should indicate POLLIN when receiving buffers are available 79 - dv1394_poll should indicate POLLIN when receiving buffers are available
@@ -1096,7 +1096,6 @@ static int do_dv1394_init_default(struct video_card *video)
1096 1096
1097 init.api_version = DV1394_API_VERSION; 1097 init.api_version = DV1394_API_VERSION;
1098 init.n_frames = DV1394_MAX_FRAMES / 4; 1098 init.n_frames = DV1394_MAX_FRAMES / 4;
1099 /* the following are now set via devfs */
1100 init.channel = video->channel; 1099 init.channel = video->channel;
1101 init.format = video->pal_or_ntsc; 1100 init.format = video->pal_or_ntsc;
1102 init.cip_n = video->cip_n; 1101 init.cip_n = video->cip_n;
@@ -1791,8 +1790,6 @@ static int dv1394_open(struct inode *inode, struct file *file)
1791{ 1790{
1792 struct video_card *video = NULL; 1791 struct video_card *video = NULL;
1793 1792
1794 /* if the device was opened through devfs, then file->private_data
1795 has already been set to video by devfs */
1796 if (file->private_data) { 1793 if (file->private_data) {
1797 video = (struct video_card*) file->private_data; 1794 video = (struct video_card*) file->private_data;
1798 1795
@@ -2211,7 +2208,7 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
2211 video = kzalloc(sizeof(*video), GFP_KERNEL); 2208 video = kzalloc(sizeof(*video), GFP_KERNEL);
2212 if (!video) { 2209 if (!video) {
2213 printk(KERN_ERR "dv1394: cannot allocate video_card\n"); 2210 printk(KERN_ERR "dv1394: cannot allocate video_card\n");
2214 goto err; 2211 return -1;
2215 } 2212 }
2216 2213
2217 video->ohci = ohci; 2214 video->ohci = ohci;
@@ -2266,37 +2263,14 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes
2266 list_add_tail(&video->list, &dv1394_cards); 2263 list_add_tail(&video->list, &dv1394_cards);
2267 spin_unlock_irqrestore(&dv1394_cards_lock, flags); 2264 spin_unlock_irqrestore(&dv1394_cards_lock, flags);
2268 2265
2269 if (devfs_mk_cdev(MKDEV(IEEE1394_MAJOR,
2270 IEEE1394_MINOR_BLOCK_DV1394*16 + video->id),
2271 S_IFCHR|S_IRUGO|S_IWUGO,
2272 "ieee1394/dv/host%d/%s/%s",
2273 (video->id>>2),
2274 (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"),
2275 (video->mode == MODE_RECEIVE ? "in" : "out")) < 0)
2276 goto err_free;
2277
2278 debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id); 2266 debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id);
2279
2280 return 0; 2267 return 0;
2281
2282 err_free:
2283 kfree(video);
2284 err:
2285 return -1;
2286} 2268}
2287 2269
2288static void dv1394_un_init(struct video_card *video) 2270static void dv1394_un_init(struct video_card *video)
2289{ 2271{
2290 char buf[32];
2291
2292 /* obviously nobody has the driver open at this point */ 2272 /* obviously nobody has the driver open at this point */
2293 do_dv1394_shutdown(video, 1); 2273 do_dv1394_shutdown(video, 1);
2294 snprintf(buf, sizeof(buf), "dv/host%d/%s/%s", (video->id >> 2),
2295 (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"),
2296 (video->mode == MODE_RECEIVE ? "in" : "out")
2297 );
2298
2299 devfs_remove("ieee1394/%s", buf);
2300 kfree(video); 2274 kfree(video);
2301} 2275}
2302 2276
@@ -2333,9 +2307,6 @@ static void dv1394_remove_host (struct hpsb_host *host)
2333 2307
2334 class_device_destroy(hpsb_protocol_class, 2308 class_device_destroy(hpsb_protocol_class,
2335 MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); 2309 MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)));
2336 devfs_remove("ieee1394/dv/host%d/NTSC", id);
2337 devfs_remove("ieee1394/dv/host%d/PAL", id);
2338 devfs_remove("ieee1394/dv/host%d", id);
2339} 2310}
2340 2311
2341static void dv1394_add_host (struct hpsb_host *host) 2312static void dv1394_add_host (struct hpsb_host *host)
@@ -2352,9 +2323,6 @@ static void dv1394_add_host (struct hpsb_host *host)
2352 class_device_create(hpsb_protocol_class, NULL, MKDEV( 2323 class_device_create(hpsb_protocol_class, NULL, MKDEV(
2353 IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), 2324 IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)),
2354 NULL, "dv1394-%d", id); 2325 NULL, "dv1394-%d", id);
2355 devfs_mk_dir("ieee1394/dv/host%d", id);
2356 devfs_mk_dir("ieee1394/dv/host%d/NTSC", id);
2357 devfs_mk_dir("ieee1394/dv/host%d/PAL", id);
2358 2326
2359 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); 2327 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE);
2360 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); 2328 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT);
@@ -2611,10 +2579,8 @@ MODULE_LICENSE("GPL");
2611static void __exit dv1394_exit_module(void) 2579static void __exit dv1394_exit_module(void)
2612{ 2580{
2613 hpsb_unregister_protocol(&dv1394_driver); 2581 hpsb_unregister_protocol(&dv1394_driver);
2614
2615 hpsb_unregister_highlevel(&dv1394_highlevel); 2582 hpsb_unregister_highlevel(&dv1394_highlevel);
2616 cdev_del(&dv1394_cdev); 2583 cdev_del(&dv1394_cdev);
2617 devfs_remove("ieee1394/dv");
2618} 2584}
2619 2585
2620static int __init dv1394_init_module(void) 2586static int __init dv1394_init_module(void)
@@ -2630,15 +2596,12 @@ static int __init dv1394_init_module(void)
2630 return ret; 2596 return ret;
2631 } 2597 }
2632 2598
2633 devfs_mk_dir("ieee1394/dv");
2634
2635 hpsb_register_highlevel(&dv1394_highlevel); 2599 hpsb_register_highlevel(&dv1394_highlevel);
2636 2600
2637 ret = hpsb_register_protocol(&dv1394_driver); 2601 ret = hpsb_register_protocol(&dv1394_driver);
2638 if (ret) { 2602 if (ret) {
2639 printk(KERN_ERR "dv1394: failed to register protocol\n"); 2603 printk(KERN_ERR "dv1394: failed to register protocol\n");
2640 hpsb_unregister_highlevel(&dv1394_highlevel); 2604 hpsb_unregister_highlevel(&dv1394_highlevel);
2641 devfs_remove("ieee1394/dv");
2642 cdev_del(&dv1394_cdev); 2605 cdev_del(&dv1394_cdev);
2643 return ret; 2606 return ret;
2644 } 2607 }
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index 25ef5a86f5f0..be6854e25ad4 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality.");
58 58
59/* Disable Isochronous Resource Manager functionality */ 59/* Disable Isochronous Resource Manager functionality */
60int hpsb_disable_irm = 0; 60int hpsb_disable_irm = 0;
61module_param_named(disable_irm, hpsb_disable_irm, bool, 0); 61module_param_named(disable_irm, hpsb_disable_irm, bool, 0444);
62MODULE_PARM_DESC(disable_irm, 62MODULE_PARM_DESC(disable_irm,
63 "Disable Isochronous Resource Manager functionality."); 63 "Disable Isochronous Resource Manager functionality.");
64 64
@@ -1078,17 +1078,10 @@ static int __init ieee1394_init(void)
1078 goto exit_release_kernel_thread; 1078 goto exit_release_kernel_thread;
1079 } 1079 }
1080 1080
1081 /* actually this is a non-fatal error */
1082 ret = devfs_mk_dir("ieee1394");
1083 if (ret < 0) {
1084 HPSB_ERR("unable to make devfs dir for device major %d!\n", IEEE1394_MAJOR);
1085 goto release_chrdev;
1086 }
1087
1088 ret = bus_register(&ieee1394_bus_type); 1081 ret = bus_register(&ieee1394_bus_type);
1089 if (ret < 0) { 1082 if (ret < 0) {
1090 HPSB_INFO("bus register failed"); 1083 HPSB_INFO("bus register failed");
1091 goto release_devfs; 1084 goto release_chrdev;
1092 } 1085 }
1093 1086
1094 for (i = 0; fw_bus_attrs[i]; i++) { 1087 for (i = 0; fw_bus_attrs[i]; i++) {
@@ -1099,7 +1092,7 @@ static int __init ieee1394_init(void)
1099 fw_bus_attrs[i--]); 1092 fw_bus_attrs[i--]);
1100 } 1093 }
1101 bus_unregister(&ieee1394_bus_type); 1094 bus_unregister(&ieee1394_bus_type);
1102 goto release_devfs; 1095 goto release_chrdev;
1103 } 1096 }
1104 } 1097 }
1105 1098
@@ -1152,8 +1145,6 @@ release_all_bus:
1152 for (i = 0; fw_bus_attrs[i]; i++) 1145 for (i = 0; fw_bus_attrs[i]; i++)
1153 bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]); 1146 bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
1154 bus_unregister(&ieee1394_bus_type); 1147 bus_unregister(&ieee1394_bus_type);
1155release_devfs:
1156 devfs_remove("ieee1394");
1157release_chrdev: 1148release_chrdev:
1158 unregister_chrdev_region(IEEE1394_CORE_DEV, 256); 1149 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
1159exit_release_kernel_thread: 1150exit_release_kernel_thread:
@@ -1191,7 +1182,6 @@ static void __exit ieee1394_cleanup(void)
1191 hpsb_cleanup_config_roms(); 1182 hpsb_cleanup_config_roms();
1192 1183
1193 unregister_chrdev_region(IEEE1394_CORE_DEV, 256); 1184 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
1194 devfs_remove("ieee1394");
1195} 1185}
1196 1186
1197module_init(ieee1394_init); 1187module_init(ieee1394_init);
diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
index b35466023f00..e7b55e895f50 100644
--- a/drivers/ieee1394/ieee1394_core.h
+++ b/drivers/ieee1394/ieee1394_core.h
@@ -3,7 +3,6 @@
3#define _IEEE1394_CORE_H 3#define _IEEE1394_CORE_H
4 4
5#include <linux/slab.h> 5#include <linux/slab.h>
6#include <linux/devfs_fs_kernel.h>
7#include <asm/atomic.h> 6#include <asm/atomic.h>
8#include <asm/semaphore.h> 7#include <asm/semaphore.h>
9#include "hosts.h" 8#include "hosts.h"
@@ -202,14 +201,12 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
202#define IEEE1394_MINOR_BLOCK_RAW1394 0 201#define IEEE1394_MINOR_BLOCK_RAW1394 0
203#define IEEE1394_MINOR_BLOCK_VIDEO1394 1 202#define IEEE1394_MINOR_BLOCK_VIDEO1394 1
204#define IEEE1394_MINOR_BLOCK_DV1394 2 203#define IEEE1394_MINOR_BLOCK_DV1394 2
205#define IEEE1394_MINOR_BLOCK_AMDTP 3
206#define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 204#define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15
207 205
208#define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) 206#define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0)
209#define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16) 207#define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)
210#define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) 208#define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16)
211#define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16) 209#define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16)
212#define IEEE1394_AMDTP_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_AMDTP * 16)
213#define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) 210#define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16)
214 211
215/* return the index (within a minor number block) of a file */ 212/* return the index (within a minor number block) of a file */
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index b6b96fa04d62..a86beeb6af5d 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -544,12 +544,19 @@ static void ohci_initialize(struct ti_ohci *ohci)
544 /* Initialize IR Legacy DMA channel mask */ 544 /* Initialize IR Legacy DMA channel mask */
545 ohci->ir_legacy_channels = 0; 545 ohci->ir_legacy_channels = 0;
546 546
547 /* 547 /* Accept AR requests from all nodes */
548 * Accept AT requests from all nodes. This probably 548 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000);
549 * will have to be controlled from the subsystem 549
550 * on a per node basis. 550 /* Set the address range of the physical response unit.
551 */ 551 * Most controllers do not implement it as a writable register though.
552 reg_write(ohci,OHCI1394_AsReqFilterHiSet, 0x80000000); 552 * They will keep a hardwired offset of 0x00010000 and show 0x0 as
553 * register content.
554 * To actually enable physical responses is the job of our interrupt
555 * handler which programs the physical request filter. */
556 reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000);
557
558 DBGMSG("physUpperBoundOffset=%08x",
559 reg_read(ohci, OHCI1394_PhyUpperBound));
553 560
554 /* Specify AT retries */ 561 /* Specify AT retries */
555 reg_write(ohci, OHCI1394_ATRetries, 562 reg_write(ohci, OHCI1394_ATRetries,
@@ -572,6 +579,7 @@ static void ohci_initialize(struct ti_ohci *ohci)
572 OHCI1394_reqTxComplete | 579 OHCI1394_reqTxComplete |
573 OHCI1394_isochRx | 580 OHCI1394_isochRx |
574 OHCI1394_isochTx | 581 OHCI1394_isochTx |
582 OHCI1394_postedWriteErr |
575 OHCI1394_cycleInconsistent); 583 OHCI1394_cycleInconsistent);
576 584
577 /* Enable link */ 585 /* Enable link */
@@ -2374,7 +2382,10 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
2374 2382
2375 event &= ~OHCI1394_unrecoverableError; 2383 event &= ~OHCI1394_unrecoverableError;
2376 } 2384 }
2377 2385 if (event & OHCI1394_postedWriteErr) {
2386 PRINT(KERN_ERR, "physical posted write error");
2387 /* no recovery strategy yet, had to involve protocol drivers */
2388 }
2378 if (event & OHCI1394_cycleInconsistent) { 2389 if (event & OHCI1394_cycleInconsistent) {
2379 /* We subscribe to the cycleInconsistent event only to 2390 /* We subscribe to the cycleInconsistent event only to
2380 * clear the corresponding event bit... otherwise, 2391 * clear the corresponding event bit... otherwise,
@@ -2382,7 +2393,6 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
2382 DBGMSG("OHCI1394_cycleInconsistent"); 2393 DBGMSG("OHCI1394_cycleInconsistent");
2383 event &= ~OHCI1394_cycleInconsistent; 2394 event &= ~OHCI1394_cycleInconsistent;
2384 } 2395 }
2385
2386 if (event & OHCI1394_busReset) { 2396 if (event & OHCI1394_busReset) {
2387 /* The busReset event bit can't be cleared during the 2397 /* The busReset event bit can't be cleared during the
2388 * selfID phase, so we disable busReset interrupts, to 2398 * selfID phase, so we disable busReset interrupts, to
@@ -2426,7 +2436,6 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
2426 } 2436 }
2427 event &= ~OHCI1394_busReset; 2437 event &= ~OHCI1394_busReset;
2428 } 2438 }
2429
2430 if (event & OHCI1394_reqTxComplete) { 2439 if (event & OHCI1394_reqTxComplete) {
2431 struct dma_trm_ctx *d = &ohci->at_req_context; 2440 struct dma_trm_ctx *d = &ohci->at_req_context;
2432 DBGMSG("Got reqTxComplete interrupt " 2441 DBGMSG("Got reqTxComplete interrupt "
@@ -2514,26 +2523,20 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
2514 reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_busReset); 2523 reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_busReset);
2515 spin_unlock_irqrestore(&ohci->event_lock, flags); 2524 spin_unlock_irqrestore(&ohci->event_lock, flags);
2516 2525
2517 /* Accept Physical requests from all nodes. */
2518 reg_write(ohci,OHCI1394_AsReqFilterHiSet, 0xffffffff);
2519 reg_write(ohci,OHCI1394_AsReqFilterLoSet, 0xffffffff);
2520
2521 /* Turn on phys dma reception. 2526 /* Turn on phys dma reception.
2522 * 2527 *
2523 * TODO: Enable some sort of filtering management. 2528 * TODO: Enable some sort of filtering management.
2524 */ 2529 */
2525 if (phys_dma) { 2530 if (phys_dma) {
2526 reg_write(ohci,OHCI1394_PhyReqFilterHiSet, 0xffffffff); 2531 reg_write(ohci, OHCI1394_PhyReqFilterHiSet,
2527 reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0xffffffff); 2532 0xffffffff);
2528 reg_write(ohci,OHCI1394_PhyUpperBound, 0xffff0000); 2533 reg_write(ohci, OHCI1394_PhyReqFilterLoSet,
2529 } else { 2534 0xffffffff);
2530 reg_write(ohci,OHCI1394_PhyReqFilterHiSet, 0x00000000);
2531 reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0x00000000);
2532 } 2535 }
2533 2536
2534 DBGMSG("PhyReqFilter=%08x%08x", 2537 DBGMSG("PhyReqFilter=%08x%08x",
2535 reg_read(ohci,OHCI1394_PhyReqFilterHiSet), 2538 reg_read(ohci, OHCI1394_PhyReqFilterHiSet),
2536 reg_read(ohci,OHCI1394_PhyReqFilterLoSet)); 2539 reg_read(ohci, OHCI1394_PhyReqFilterLoSet));
2537 2540
2538 hpsb_selfid_complete(host, phyid, isroot); 2541 hpsb_selfid_complete(host, phyid, isroot);
2539 } else 2542 } else
@@ -3259,8 +3262,8 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3259 * fail to report the right length. Anyway, the ohci spec 3262 * fail to report the right length. Anyway, the ohci spec
3260 * clearly says it's 2kb, so this shouldn't be a problem. */ 3263 * clearly says it's 2kb, so this shouldn't be a problem. */
3261 ohci_base = pci_resource_start(dev, 0); 3264 ohci_base = pci_resource_start(dev, 0);
3262 if (pci_resource_len(dev, 0) != OHCI1394_REGISTER_SIZE) 3265 if (pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE)
3263 PRINT(KERN_WARNING, "Unexpected PCI resource length of %lx!", 3266 PRINT(KERN_WARNING, "PCI resource length of %lx too small!",
3264 pci_resource_len(dev, 0)); 3267 pci_resource_len(dev, 0));
3265 3268
3266 /* Seems PCMCIA handles this internally. Not sure why. Seems 3269 /* Seems PCMCIA handles this internally. Not sure why. Seems
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index 19f26c5c9479..f7de546f2ed6 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -41,7 +41,6 @@
41#include <linux/cdev.h> 41#include <linux/cdev.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/atomic.h> 43#include <asm/atomic.h>
44#include <linux/devfs_fs_kernel.h>
45#include <linux/compat.h> 44#include <linux/compat.h>
46 45
47#include "csr1212.h" 46#include "csr1212.h"
@@ -2999,9 +2998,6 @@ static int __init init_raw1394(void)
2999 goto out_unreg; 2998 goto out_unreg;
3000 } 2999 }
3001 3000
3002 devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
3003 S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME);
3004
3005 cdev_init(&raw1394_cdev, &raw1394_fops); 3001 cdev_init(&raw1394_cdev, &raw1394_fops);
3006 raw1394_cdev.owner = THIS_MODULE; 3002 raw1394_cdev.owner = THIS_MODULE;
3007 kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME); 3003 kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
@@ -3023,7 +3019,6 @@ static int __init init_raw1394(void)
3023 goto out; 3019 goto out;
3024 3020
3025 out_dev: 3021 out_dev:
3026 devfs_remove(RAW1394_DEVICE_NAME);
3027 class_device_destroy(hpsb_protocol_class, 3022 class_device_destroy(hpsb_protocol_class,
3028 MKDEV(IEEE1394_MAJOR, 3023 MKDEV(IEEE1394_MAJOR,
3029 IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3024 IEEE1394_MINOR_BLOCK_RAW1394 * 16));
@@ -3039,7 +3034,6 @@ static void __exit cleanup_raw1394(void)
3039 MKDEV(IEEE1394_MAJOR, 3034 MKDEV(IEEE1394_MAJOR,
3040 IEEE1394_MINOR_BLOCK_RAW1394 * 16)); 3035 IEEE1394_MINOR_BLOCK_RAW1394 * 16));
3041 cdev_del(&raw1394_cdev); 3036 cdev_del(&raw1394_cdev);
3042 devfs_remove(RAW1394_DEVICE_NAME);
3043 hpsb_unregister_highlevel(&raw1394_highlevel); 3037 hpsb_unregister_highlevel(&raw1394_highlevel);
3044 hpsb_unregister_protocol(&raw1394_driver); 3038 hpsb_unregister_protocol(&raw1394_driver);
3045} 3039}
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index eca92eb475a1..2c765ca5aa50 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -214,6 +214,7 @@ static u32 global_outstanding_dmas = 0;
214#endif 214#endif
215 215
216#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) 216#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
217#define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__)
217 218
218/* 219/*
219 * Globals 220 * Globals
@@ -535,7 +536,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb(
535 command->Current_SCpnt = Current_SCpnt; 536 command->Current_SCpnt = Current_SCpnt;
536 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); 537 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse);
537 } else { 538 } else {
538 SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); 539 SBP2_ERR("%s: no orbs available", __FUNCTION__);
539 } 540 }
540 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 541 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
541 return command; 542 return command;
@@ -549,7 +550,7 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
549 struct hpsb_host *host; 550 struct hpsb_host *host;
550 551
551 if (!scsi_id) { 552 if (!scsi_id) {
552 printk(KERN_ERR "%s: scsi_id == NULL\n", __FUNCTION__); 553 SBP2_ERR("%s: scsi_id == NULL", __FUNCTION__);
553 return; 554 return;
554 } 555 }
555 556
@@ -610,7 +611,7 @@ static int sbp2_probe(struct device *dev)
610 struct unit_directory *ud; 611 struct unit_directory *ud;
611 struct scsi_id_instance_data *scsi_id; 612 struct scsi_id_instance_data *scsi_id;
612 613
613 SBP2_DEBUG("sbp2_probe"); 614 SBP2_DEBUG_ENTER();
614 615
615 ud = container_of(dev, struct unit_directory, device); 616 ud = container_of(dev, struct unit_directory, device);
616 617
@@ -635,7 +636,7 @@ static int sbp2_remove(struct device *dev)
635 struct scsi_id_instance_data *scsi_id; 636 struct scsi_id_instance_data *scsi_id;
636 struct scsi_device *sdev; 637 struct scsi_device *sdev;
637 638
638 SBP2_DEBUG("sbp2_remove"); 639 SBP2_DEBUG_ENTER();
639 640
640 ud = container_of(dev, struct unit_directory, device); 641 ud = container_of(dev, struct unit_directory, device);
641 scsi_id = ud->device.driver_data; 642 scsi_id = ud->device.driver_data;
@@ -667,7 +668,7 @@ static int sbp2_update(struct unit_directory *ud)
667{ 668{
668 struct scsi_id_instance_data *scsi_id = ud->device.driver_data; 669 struct scsi_id_instance_data *scsi_id = ud->device.driver_data;
669 670
670 SBP2_DEBUG("sbp2_update"); 671 SBP2_DEBUG_ENTER();
671 672
672 if (sbp2_reconnect_device(scsi_id)) { 673 if (sbp2_reconnect_device(scsi_id)) {
673 674
@@ -715,7 +716,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
715 struct Scsi_Host *scsi_host = NULL; 716 struct Scsi_Host *scsi_host = NULL;
716 struct scsi_id_instance_data *scsi_id = NULL; 717 struct scsi_id_instance_data *scsi_id = NULL;
717 718
718 SBP2_DEBUG("sbp2_alloc_device"); 719 SBP2_DEBUG_ENTER();
719 720
720 scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); 721 scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL);
721 if (!scsi_id) { 722 if (!scsi_id) {
@@ -749,12 +750,22 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
749 750
750#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA 751#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA
751 /* Handle data movement if physical dma is not 752 /* Handle data movement if physical dma is not
752 * enabled/supportedon host controller */ 753 * enabled or not supported on host controller */
753 hpsb_register_addrspace(&sbp2_highlevel, ud->ne->host, &sbp2_physdma_ops, 754 if (!hpsb_register_addrspace(&sbp2_highlevel, ud->ne->host,
754 0x0ULL, 0xfffffffcULL); 755 &sbp2_physdma_ops,
756 0x0ULL, 0xfffffffcULL)) {
757 SBP2_ERR("failed to register lower 4GB address range");
758 goto failed_alloc;
759 }
755#endif 760#endif
756 } 761 }
757 762
763 /* Prevent unloading of the 1394 host */
764 if (!try_module_get(hi->host->driver->owner)) {
765 SBP2_ERR("failed to get a reference on 1394 host driver");
766 goto failed_alloc;
767 }
768
758 scsi_id->hi = hi; 769 scsi_id->hi = hi;
759 770
760 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); 771 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids);
@@ -816,7 +827,7 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
816 struct sbp2scsi_host_info *hi = scsi_id->hi; 827 struct sbp2scsi_host_info *hi = scsi_id->hi;
817 int error; 828 int error;
818 829
819 SBP2_DEBUG("sbp2_start_device"); 830 SBP2_DEBUG_ENTER();
820 831
821 /* Login FIFO DMA */ 832 /* Login FIFO DMA */
822 scsi_id->login_response = 833 scsi_id->login_response =
@@ -891,7 +902,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
891 * allows someone else to login instead. One second makes sense. */ 902 * allows someone else to login instead. One second makes sense. */
892 msleep_interruptible(1000); 903 msleep_interruptible(1000);
893 if (signal_pending(current)) { 904 if (signal_pending(current)) {
894 SBP2_WARN("aborting sbp2_start_device due to event");
895 sbp2_remove_device(scsi_id); 905 sbp2_remove_device(scsi_id);
896 return -EINTR; 906 return -EINTR;
897 } 907 }
@@ -944,7 +954,7 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
944{ 954{
945 struct sbp2scsi_host_info *hi; 955 struct sbp2scsi_host_info *hi;
946 956
947 SBP2_DEBUG("sbp2_remove_device"); 957 SBP2_DEBUG_ENTER();
948 958
949 if (!scsi_id) 959 if (!scsi_id)
950 return; 960 return;
@@ -1015,6 +1025,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1015 1025
1016 scsi_id->ud->device.driver_data = NULL; 1026 scsi_id->ud->device.driver_data = NULL;
1017 1027
1028 if (hi)
1029 module_put(hi->host->driver->owner);
1030
1018 SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); 1031 SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id);
1019 1032
1020 kfree(scsi_id); 1033 kfree(scsi_id);
@@ -1073,23 +1086,20 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1073 int max_logins; 1086 int max_logins;
1074 int active_logins; 1087 int active_logins;
1075 1088
1076 SBP2_DEBUG("sbp2_query_logins"); 1089 SBP2_DEBUG_ENTER();
1077 1090
1078 scsi_id->query_logins_orb->reserved1 = 0x0; 1091 scsi_id->query_logins_orb->reserved1 = 0x0;
1079 scsi_id->query_logins_orb->reserved2 = 0x0; 1092 scsi_id->query_logins_orb->reserved2 = 0x0;
1080 1093
1081 scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma; 1094 scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma;
1082 scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id); 1095 scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id);
1083 SBP2_DEBUG("sbp2_query_logins: query_response_hi/lo initialized");
1084 1096
1085 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); 1097 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST);
1086 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); 1098 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1);
1087 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1099 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun);
1088 SBP2_DEBUG("sbp2_query_logins: lun_misc initialized");
1089 1100
1090 scsi_id->query_logins_orb->reserved_resp_length = 1101 scsi_id->query_logins_orb->reserved_resp_length =
1091 ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); 1102 ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response));
1092 SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized");
1093 1103
1094 scsi_id->query_logins_orb->status_fifo_hi = 1104 scsi_id->query_logins_orb->status_fifo_hi =
1095 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); 1105 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id);
@@ -1098,25 +1108,19 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1098 1108
1099 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); 1109 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb));
1100 1110
1101 SBP2_DEBUG("sbp2_query_logins: orb byte-swapped");
1102
1103 sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), 1111 sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb),
1104 "sbp2 query logins orb", scsi_id->query_logins_orb_dma); 1112 "sbp2 query logins orb", scsi_id->query_logins_orb_dma);
1105 1113
1106 memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); 1114 memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response));
1107 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); 1115 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block));
1108 1116
1109 SBP2_DEBUG("sbp2_query_logins: query_logins_response/status FIFO memset");
1110
1111 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1117 data[0] = ORB_SET_NODE_ID(hi->host->node_id);
1112 data[1] = scsi_id->query_logins_orb_dma; 1118 data[1] = scsi_id->query_logins_orb_dma;
1113 sbp2util_cpu_to_be32_buffer(data, 8); 1119 sbp2util_cpu_to_be32_buffer(data, 8);
1114 1120
1115 atomic_set(&scsi_id->sbp2_login_complete, 0); 1121 atomic_set(&scsi_id->sbp2_login_complete, 0);
1116 1122
1117 SBP2_DEBUG("sbp2_query_logins: prepared to write");
1118 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1123 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8);
1119 SBP2_DEBUG("sbp2_query_logins: written");
1120 1124
1121 if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { 1125 if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) {
1122 SBP2_INFO("Error querying logins to SBP-2 device - timed out"); 1126 SBP2_INFO("Error querying logins to SBP-2 device - timed out");
@@ -1165,10 +1169,10 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1165 struct sbp2scsi_host_info *hi = scsi_id->hi; 1169 struct sbp2scsi_host_info *hi = scsi_id->hi;
1166 quadlet_t data[2]; 1170 quadlet_t data[2];
1167 1171
1168 SBP2_DEBUG("sbp2_login_device"); 1172 SBP2_DEBUG_ENTER();
1169 1173
1170 if (!scsi_id->login_orb) { 1174 if (!scsi_id->login_orb) {
1171 SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); 1175 SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__);
1172 return -EIO; 1176 return -EIO;
1173 } 1177 }
1174 1178
@@ -1182,59 +1186,39 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1182 /* Set-up login ORB, assume no password */ 1186 /* Set-up login ORB, assume no password */
1183 scsi_id->login_orb->password_hi = 0; 1187 scsi_id->login_orb->password_hi = 0;
1184 scsi_id->login_orb->password_lo = 0; 1188 scsi_id->login_orb->password_lo = 0;
1185 SBP2_DEBUG("sbp2_login_device: password_hi/lo initialized");
1186 1189
1187 scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma; 1190 scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma;
1188 scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id); 1191 scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id);
1189 SBP2_DEBUG("sbp2_login_device: login_response_hi/lo initialized");
1190 1192
1191 scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST); 1193 scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST);
1192 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ 1194 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */
1193 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ 1195 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */
1194 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ 1196 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */
1195 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1197 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun);
1196 SBP2_DEBUG("sbp2_login_device: lun_misc initialized");
1197 1198
1198 scsi_id->login_orb->passwd_resp_lengths = 1199 scsi_id->login_orb->passwd_resp_lengths =
1199 ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); 1200 ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response));
1200 SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized");
1201 1201
1202 scsi_id->login_orb->status_fifo_hi = 1202 scsi_id->login_orb->status_fifo_hi =
1203 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); 1203 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id);
1204 scsi_id->login_orb->status_fifo_lo = 1204 scsi_id->login_orb->status_fifo_lo =
1205 ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); 1205 ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr);
1206 1206
1207 /*
1208 * Byte swap ORB if necessary
1209 */
1210 sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); 1207 sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb));
1211 1208
1212 SBP2_DEBUG("sbp2_login_device: orb byte-swapped");
1213
1214 sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), 1209 sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb),
1215 "sbp2 login orb", scsi_id->login_orb_dma); 1210 "sbp2 login orb", scsi_id->login_orb_dma);
1216 1211
1217 /*
1218 * Initialize login response and status fifo
1219 */
1220 memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); 1212 memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response));
1221 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); 1213 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block));
1222 1214
1223 SBP2_DEBUG("sbp2_login_device: login_response/status FIFO memset");
1224
1225 /*
1226 * Ok, let's write to the target's management agent register
1227 */
1228 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1215 data[0] = ORB_SET_NODE_ID(hi->host->node_id);
1229 data[1] = scsi_id->login_orb_dma; 1216 data[1] = scsi_id->login_orb_dma;
1230 sbp2util_cpu_to_be32_buffer(data, 8); 1217 sbp2util_cpu_to_be32_buffer(data, 8);
1231 1218
1232 atomic_set(&scsi_id->sbp2_login_complete, 0); 1219 atomic_set(&scsi_id->sbp2_login_complete, 0);
1233 1220
1234 SBP2_DEBUG("sbp2_login_device: prepared to write to %08x",
1235 (unsigned int)scsi_id->sbp2_management_agent_addr);
1236 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1221 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8);
1237 SBP2_DEBUG("sbp2_login_device: written");
1238 1222
1239 /* 1223 /*
1240 * Wait for login status (up to 20 seconds)... 1224 * Wait for login status (up to 20 seconds)...
@@ -1298,7 +1282,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1298 quadlet_t data[2]; 1282 quadlet_t data[2];
1299 int error; 1283 int error;
1300 1284
1301 SBP2_DEBUG("sbp2_logout_device"); 1285 SBP2_DEBUG_ENTER();
1302 1286
1303 /* 1287 /*
1304 * Set-up logout ORB 1288 * Set-up logout ORB
@@ -1362,7 +1346,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
1362 quadlet_t data[2]; 1346 quadlet_t data[2];
1363 int error; 1347 int error;
1364 1348
1365 SBP2_DEBUG("sbp2_reconnect_device"); 1349 SBP2_DEBUG_ENTER();
1366 1350
1367 /* 1351 /*
1368 * Set-up reconnect ORB 1352 * Set-up reconnect ORB
@@ -1453,17 +1437,11 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id)
1453{ 1437{
1454 quadlet_t data; 1438 quadlet_t data;
1455 1439
1456 SBP2_DEBUG("sbp2_set_busy_timeout"); 1440 SBP2_DEBUG_ENTER();
1457 1441
1458 /*
1459 * Ok, let's write to the target's busy timeout register
1460 */
1461 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); 1442 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE);
1462 1443 if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4))
1463 if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) { 1444 SBP2_ERR("%s error", __FUNCTION__);
1464 SBP2_ERR("sbp2_set_busy_timeout error");
1465 }
1466
1467 return 0; 1445 return 0;
1468} 1446}
1469 1447
@@ -1482,7 +1460,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1482 firmware_revision, workarounds; 1460 firmware_revision, workarounds;
1483 int i; 1461 int i;
1484 1462
1485 SBP2_DEBUG("sbp2_parse_unit_directory"); 1463 SBP2_DEBUG_ENTER();
1486 1464
1487 management_agent_addr = 0x0; 1465 management_agent_addr = 0x0;
1488 command_set_spec_id = 0x0; 1466 command_set_spec_id = 0x0;
@@ -1615,7 +1593,7 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
1615{ 1593{
1616 struct sbp2scsi_host_info *hi = scsi_id->hi; 1594 struct sbp2scsi_host_info *hi = scsi_id->hi;
1617 1595
1618 SBP2_DEBUG("sbp2_max_speed_and_size"); 1596 SBP2_DEBUG_ENTER();
1619 1597
1620 /* Initial setting comes from the hosts speed map */ 1598 /* Initial setting comes from the hosts speed map */
1621 scsi_id->speed_code = 1599 scsi_id->speed_code =
@@ -1652,11 +1630,8 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait)
1652 u64 addr; 1630 u64 addr;
1653 int retval; 1631 int retval;
1654 1632
1655 SBP2_DEBUG("sbp2_agent_reset"); 1633 SBP2_DEBUG_ENTER();
1656 1634
1657 /*
1658 * Ok, let's write to the target's management agent register
1659 */
1660 data = ntohl(SBP2_AGENT_RESET_DATA); 1635 data = ntohl(SBP2_AGENT_RESET_DATA);
1661 addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; 1636 addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET;
1662 1637
@@ -2004,11 +1979,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2004 unsigned int request_bufflen = SCpnt->request_bufflen; 1979 unsigned int request_bufflen = SCpnt->request_bufflen;
2005 struct sbp2_command_info *command; 1980 struct sbp2_command_info *command;
2006 1981
2007 SBP2_DEBUG("sbp2_send_command"); 1982 SBP2_DEBUG_ENTER();
2008#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP)
2009 printk("[scsi command]\n ");
2010 scsi_print_command(SCpnt);
2011#endif
2012 SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); 1983 SBP2_DEBUG("SCSI transfer size = %x", request_bufflen);
2013 SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); 1984 SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg);
2014 1985
@@ -2048,7 +2019,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2048 */ 2019 */
2049static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) 2020static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data)
2050{ 2021{
2051 SBP2_DEBUG("sbp2_status_to_sense_data"); 2022 SBP2_DEBUG_ENTER();
2052 2023
2053 /* 2024 /*
2054 * Ok, it's pretty ugly... ;-) 2025 * Ok, it's pretty ugly... ;-)
@@ -2082,7 +2053,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2082{ 2053{
2083 u8 *scsi_buf = SCpnt->request_buffer; 2054 u8 *scsi_buf = SCpnt->request_buffer;
2084 2055
2085 SBP2_DEBUG("sbp2_check_sbp2_response"); 2056 SBP2_DEBUG_ENTER();
2086 2057
2087 if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) { 2058 if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) {
2088 /* 2059 /*
@@ -2113,7 +2084,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
2113 struct sbp2_command_info *command; 2084 struct sbp2_command_info *command;
2114 unsigned long flags; 2085 unsigned long flags;
2115 2086
2116 SBP2_DEBUG("sbp2_handle_status_write"); 2087 SBP2_DEBUG_ENTER();
2117 2088
2118 sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); 2089 sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr);
2119 2090
@@ -2260,7 +2231,10 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2260 struct sbp2scsi_host_info *hi; 2231 struct sbp2scsi_host_info *hi;
2261 int result = DID_NO_CONNECT << 16; 2232 int result = DID_NO_CONNECT << 16;
2262 2233
2263 SBP2_DEBUG("sbp2scsi_queuecommand"); 2234 SBP2_DEBUG_ENTER();
2235#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP)
2236 scsi_print_command(SCpnt);
2237#endif
2264 2238
2265 if (!sbp2util_node_is_available(scsi_id)) 2239 if (!sbp2util_node_is_available(scsi_id))
2266 goto done; 2240 goto done;
@@ -2338,7 +2312,7 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
2338 struct sbp2_command_info *command; 2312 struct sbp2_command_info *command;
2339 unsigned long flags; 2313 unsigned long flags;
2340 2314
2341 SBP2_DEBUG("sbp2scsi_complete_all_commands"); 2315 SBP2_DEBUG_ENTER();
2342 2316
2343 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 2317 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
2344 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { 2318 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
@@ -2371,7 +2345,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2371 u32 scsi_status, struct scsi_cmnd *SCpnt, 2345 u32 scsi_status, struct scsi_cmnd *SCpnt,
2372 void (*done)(struct scsi_cmnd *)) 2346 void (*done)(struct scsi_cmnd *))
2373{ 2347{
2374 SBP2_DEBUG("sbp2scsi_complete_command"); 2348 SBP2_DEBUG_ENTER();
2375 2349
2376 /* 2350 /*
2377 * Sanity 2351 * Sanity
@@ -2397,7 +2371,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2397 */ 2371 */
2398 switch (scsi_status) { 2372 switch (scsi_status) {
2399 case SBP2_SCSI_STATUS_GOOD: 2373 case SBP2_SCSI_STATUS_GOOD:
2400 SCpnt->result = DID_OK; 2374 SCpnt->result = DID_OK << 16;
2401 break; 2375 break;
2402 2376
2403 case SBP2_SCSI_STATUS_BUSY: 2377 case SBP2_SCSI_STATUS_BUSY:
@@ -2407,16 +2381,11 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2407 2381
2408 case SBP2_SCSI_STATUS_CHECK_CONDITION: 2382 case SBP2_SCSI_STATUS_CHECK_CONDITION:
2409 SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); 2383 SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION");
2410 SCpnt->result = CHECK_CONDITION << 1; 2384 SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16;
2411
2412 /*
2413 * Debug stuff
2414 */
2415#if CONFIG_IEEE1394_SBP2_DEBUG >= 1 2385#if CONFIG_IEEE1394_SBP2_DEBUG >= 1
2416 scsi_print_command(SCpnt); 2386 scsi_print_command(SCpnt);
2417 scsi_print_sense("bh", SCpnt); 2387 scsi_print_sense(SBP2_DEVICE_NAME, SCpnt);
2418#endif 2388#endif
2419
2420 break; 2389 break;
2421 2390
2422 case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: 2391 case SBP2_SCSI_STATUS_SELECTION_TIMEOUT:
@@ -2441,7 +2410,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2441 /* 2410 /*
2442 * Take care of any sbp2 response data mucking here (RBC stuff, etc.) 2411 * Take care of any sbp2 response data mucking here (RBC stuff, etc.)
2443 */ 2412 */
2444 if (SCpnt->result == DID_OK) { 2413 if (SCpnt->result == DID_OK << 16) {
2445 sbp2_check_sbp2_response(scsi_id, SCpnt); 2414 sbp2_check_sbp2_response(scsi_id, SCpnt);
2446 } 2415 }
2447 2416
@@ -2459,6 +2428,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2459 * If a unit attention occurs, return busy status so it gets 2428 * If a unit attention occurs, return busy status so it gets
2460 * retried... it could have happened because of a 1394 bus reset 2429 * retried... it could have happened because of a 1394 bus reset
2461 * or hot-plug... 2430 * or hot-plug...
2431 * XXX DID_BUS_BUSY is actually a bad idea because it will defy
2432 * the scsi layer's retry logic.
2462 */ 2433 */
2463#if 0 2434#if 0
2464 if ((scsi_status == SBP2_SCSI_STATUS_CHECK_CONDITION) && 2435 if ((scsi_status == SBP2_SCSI_STATUS_CHECK_CONDITION) &&
@@ -2624,7 +2595,7 @@ static int sbp2_module_init(void)
2624{ 2595{
2625 int ret; 2596 int ret;
2626 2597
2627 SBP2_DEBUG("sbp2_module_init"); 2598 SBP2_DEBUG_ENTER();
2628 2599
2629 /* Module load debug option to force one command at a time (serializing I/O) */ 2600 /* Module load debug option to force one command at a time (serializing I/O) */
2630 if (serialize_io) { 2601 if (serialize_io) {
@@ -2652,7 +2623,7 @@ static int sbp2_module_init(void)
2652 2623
2653static void __exit sbp2_module_exit(void) 2624static void __exit sbp2_module_exit(void)
2654{ 2625{
2655 SBP2_DEBUG("sbp2_module_exit"); 2626 SBP2_DEBUG_ENTER();
2656 2627
2657 hpsb_unregister_protocol(&sbp2_driver); 2628 hpsb_unregister_protocol(&sbp2_driver);
2658 2629
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index 216dbbf1dc8e..4e3bd62c458d 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -42,7 +42,6 @@
42#include <linux/poll.h> 42#include <linux/poll.h>
43#include <linux/smp_lock.h> 43#include <linux/smp_lock.h>
44#include <linux/delay.h> 44#include <linux/delay.h>
45#include <linux/devfs_fs_kernel.h>
46#include <linux/bitops.h> 45#include <linux/bitops.h>
47#include <linux/types.h> 46#include <linux/types.h>
48#include <linux/vmalloc.h> 47#include <linux/vmalloc.h>
@@ -1322,9 +1321,6 @@ static void video1394_add_host (struct hpsb_host *host)
1322 class_device_create(hpsb_protocol_class, NULL, MKDEV( 1321 class_device_create(hpsb_protocol_class, NULL, MKDEV(
1323 IEEE1394_MAJOR, minor), 1322 IEEE1394_MAJOR, minor),
1324 NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); 1323 NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
1325 devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor),
1326 S_IFCHR | S_IRUSR | S_IWUSR,
1327 "%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
1328} 1324}
1329 1325
1330 1326
@@ -1332,12 +1328,9 @@ static void video1394_remove_host (struct hpsb_host *host)
1332{ 1328{
1333 struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host); 1329 struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host);
1334 1330
1335 if (ohci) { 1331 if (ohci)
1336 class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, 1332 class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR,
1337 IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); 1333 IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id));
1338 devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
1339 }
1340
1341 return; 1334 return;
1342} 1335}
1343 1336
@@ -1478,12 +1471,8 @@ static long video1394_compat_ioctl(struct file *f, unsigned cmd, unsigned long a
1478static void __exit video1394_exit_module (void) 1471static void __exit video1394_exit_module (void)
1479{ 1472{
1480 hpsb_unregister_protocol(&video1394_driver); 1473 hpsb_unregister_protocol(&video1394_driver);
1481
1482 hpsb_unregister_highlevel(&video1394_highlevel); 1474 hpsb_unregister_highlevel(&video1394_highlevel);
1483
1484 devfs_remove(VIDEO1394_DRIVER_NAME);
1485 cdev_del(&video1394_cdev); 1475 cdev_del(&video1394_cdev);
1486
1487 PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module"); 1476 PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module");
1488} 1477}
1489 1478
@@ -1500,15 +1489,12 @@ static int __init video1394_init_module (void)
1500 return ret; 1489 return ret;
1501 } 1490 }
1502 1491
1503 devfs_mk_dir(VIDEO1394_DRIVER_NAME);
1504
1505 hpsb_register_highlevel(&video1394_highlevel); 1492 hpsb_register_highlevel(&video1394_highlevel);
1506 1493
1507 ret = hpsb_register_protocol(&video1394_driver); 1494 ret = hpsb_register_protocol(&video1394_driver);
1508 if (ret) { 1495 if (ret) {
1509 PRINT_G(KERN_ERR, "video1394: failed to register protocol"); 1496 PRINT_G(KERN_ERR, "video1394: failed to register protocol");
1510 hpsb_unregister_highlevel(&video1394_highlevel); 1497 hpsb_unregister_highlevel(&video1394_highlevel);
1511 devfs_remove(VIDEO1394_DRIVER_NAME);
1512 cdev_del(&video1394_cdev); 1498 cdev_del(&video1394_cdev);
1513 return ret; 1499 return ret;
1514 } 1500 }