Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394

* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394:
ohci1394: cleanup the "Unexpected PCI resource length" warning.
sbp2: misc debug logging cleanups
sbp2: proper treatment of DID_OK
ieee1394: set read permission for parameter disable_irm
sbp2: check for ARM failure
ohci1394: clean up asynchronous and physical request filters programming
ieee1394: remove amdtp remains from ieee1394_core.h
ieee1394: remove devfs support
Signed-off-by: Jody McIntyre <scjody@modernduck.com>
sbp2: prevent unloading of 1394 low-level driver

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