GIT 02509802a76bdc9a0b81c63672d355763568e983 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/scjody/ieee1394.git#for-mm commit e4b38567a0af12016450003f7f7550d1b24732b3 Author: Jody McIntyre Date: Tue Feb 14 22:22:15 2006 -0500 ohci1394: cleanup the "Unexpected PCI resource length" warning. This warning happens in practice because the resource length reported by the chipset is too large. This is not actually a problem, so don't warn about it. If it happens to be too small, warn about that, but with a different message so people who are used to ignoring the old message don't. Signed-off-by: Jody McIntyre commit 99496037c6744fd938ffb8ccfc8fc91762322ff8 Author: Stefan Richter Date: Tue Feb 14 22:04:19 2006 -0500 sbp2: update 36byte inquiry workaround (fix compatibility regression) Since about Linux 2.6.14, sbp2's inquiry workaround did not work anymore due to changes in the SCSI layer. Update it to become effective again. Testing one of the two known affected bridges has shown that skip_ms_page_8 is required as well. Also, make force_inquiry_hack tunable via /sys/module/sbp2/parameters. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 06c37f616cd9b5d11dc01781f97e04301ea172af Author: Stefan Richter Date: Tue Feb 14 22:03:22 2006 -0500 sbp2: misc debug logging cleanups - move call of scsi_print_command from sbp2_send_command to the beginning of sbp2_queue_command to show also commands which are not sent - put sbp2's name into scsi_print_sense - use __FUNCTION__ in log messages - remove a few less useful log messages and comments Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 2fefe57b7c64bf1bacb232918b0cec5a421e7220 Author: Stefan Richter Date: Tue Feb 14 22:02:53 2006 -0500 sbp2: proper treatment of DID_OK Sbp2 relied on DID_OK to be defined as 0. Always shift DID_OK into the right position anyway, and explicitly return DID_OK together with CHECK_CONDITION. Also comment on some #if 0 code. The patch does not change current behaviour. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 217b15e0610cf80bcad88b1d39223270d0019cfa Author: Jody McIntyre Date: Sun Feb 5 23:30:31 2006 -0500 Fix make of ieee1394 when O= is used. Revert a change made to support out-of-tree modules (shock, horror) that inadvertently broke make with O=. Signed-off-by: Jody McIntyre commit 0fe8d993b7ef323fbddbe0a606cb7f8b6343708c Author: Stefan Richter Date: Sun Feb 5 22:58:35 2006 -0500 ieee1394: set read permission for parameter disable_irm No need to hide it from /sys/module/ieee1394/parameters/. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 5c2be16a73ee99b477b34e50948729718dbdcff8 Author: Stefan Richter Date: Sun Feb 5 22:57:52 2006 -0500 sbp2: check for ARM failure Sbp2 did not check for successful registration of the lower address range when CONFIG_IEEE1394_SBP2_PHYS_DMA was set. If hpsb_register_addrspace failed, a "login timed-out" would occur which is misleading. Now sbp2 logs a sensible error message. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 4c853b0fca0923b971d3bc232382c94033d4842a Author: Stefan Richter Date: Sun Feb 5 22:57:00 2006 -0500 ohci1394: clean up asynchronous and physical request filters programming Various cleanups of how ohci1394 programs AsynchronousRequestFilter, PhysicalRequestFilter, and physUpperBoundOffset. In particular, do not rewrite registers within the bus reset interrupt handler if bus resets do not affect the registers in the first place. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 2c6304bdc3f2aeeacc0d4810cff0e5c893f47d56 Author: Stefan Richter Date: Fri Feb 3 23:38:39 2006 -0500 ieee1394: remove amdtp remains from ieee1394_core.h since amdtp driver was deleted Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit d00b6099a48ebb27ef04dbe67b3e7cb1c7f0e3e6 Author: Stefan Richter Date: Fri Feb 3 23:37:26 2006 -0500 ieee1394: remove devfs support Devfs has been disabled in the last kernel releases, so let's remove it from ieee1394core, raw1394, video1394, dv1394. Signed-off-by: Stefan Richter Acked-by: Greg Kroah-Hartman Cc: Dan Dennedy Signed-off-by: Jody McIntyre commit 1be7be03e875c53ac7575ab458606dc14ae199e5 Author: Stefan Richter Date: Tue Jan 31 00:13:49 2006 -0500 ohci1394: log physical posted write errors Give a warning if incoming write requests to the physical range fail. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit b2d38cccad4ef80d6b672b8f89aae5fe2907b113 Author: Stefan Richter Date: Tue Jan 31 00:13:33 2006 -0500 sbp2: variable status FIFO address (fix login timeout) Let the ieee1394 core select a suitable 1394 address range for sbp2's status FIFO instead of using a fixed range. Since the core only selects addresses which are guaranteed to be out of the "physical range" as per OHCI 1.1, this patch also fixes an old bug: OHCI controllers which implement a writeable PhysicalUpperBound register included sbp2's status FIFO in the physical range. That way sbp2 was never notified of a succesful login and always failed after timeout. Affected OHCI host adapters include ALi and Fujitsu controllers. As another side effect of this patch, the status FIFO is no longer located in a range for which OHCI chips perform "posted writes". Each status write now requires a response subaction. But since large data transfers involve only few status writes, there is no measurable decrease of I/O throughput. What's more, the status FIFO is now safe from potential host bus errors. Nevertheless, posted writes could be re-enabled by extensions to the ARM features of the 1394 stack. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 61daa34c132c5d4ed8630e2c46e9bf2f0c7b3428 Author: Stefan Richter Date: Tue Jan 31 00:13:06 2006 -0500 sbp2: fix another deadlock after disconnection If there were commands enqueued but not completed before an SBP-2 unit was unplugged (or an attempt to reconnect failed), knodemgrd or any process which tried to remove the device would sleep uninterruptibly in blk_execute_rq(). Therefore make sure that all commands are completed when sbp2 retreats. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit d415a9a9685578058800f2677bfeb8090fc212a1 Author: Stefan Richter Date: Tue Jan 31 00:12:01 2006 -0500 sbp2: prevent unloading of 1394 low-level driver When a new SBP-2 unit is added, sbp2 now takes a reference on the 1394 low-level driver (ohci1394 or pcilynx). This prevents the 1394 host driver module from being unloaded, e.g. by an administrative routine cleanup of unused kernel modules or when another 1394 driver which depends on ohci1394 is unloaded. The reference is dropped when the SBP-2 unit was disconnected, when sbp2 is unloaded or detached from the unit, or when addition of the SBP-2 unit failed. Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre commit 9857ae47369e953b77193d20984ccfc69deb4c22 Author: Jody McIntyre Date: Tue Jan 31 00:11:24 2006 -0500 This patch allows building the modules with an absolute SUBDIRS path, especially for building them out of tree. Signed-Off-By: Johannes Berg Signed-off-by: Jody McIntyre --- diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index efeaa94..85c2d4c 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c @@ -73,7 +73,7 @@ - fix all XXX showstoppers - disable IR/IT DMA interrupts on shutdown - flush pci writes to the card by issuing a read - - devfs and character device dispatching (* needs testing with Linux 2.2.x) + - character device dispatching - switch over to the new kernel DMA API (pci_map_*()) (* needs testing on platforms with IOMMU!) - keep all video_cards in a list (for open() via chardev), set file->private_data = video - dv1394_poll should indicate POLLIN when receiving buffers are available @@ -1096,7 +1096,6 @@ static int do_dv1394_init_default(struct init.api_version = DV1394_API_VERSION; init.n_frames = DV1394_MAX_FRAMES / 4; - /* the following are now set via devfs */ init.channel = video->channel; init.format = video->pal_or_ntsc; init.cip_n = video->cip_n; @@ -1791,8 +1790,6 @@ static int dv1394_open(struct inode *ino { struct video_card *video = NULL; - /* if the device was opened through devfs, then file->private_data - has already been set to video by devfs */ if (file->private_data) { video = (struct video_card*) file->private_data; @@ -2211,7 +2208,7 @@ static int dv1394_init(struct ti_ohci *o video = kzalloc(sizeof(*video), GFP_KERNEL); if (!video) { printk(KERN_ERR "dv1394: cannot allocate video_card\n"); - goto err; + return -1; } video->ohci = ohci; @@ -2266,37 +2263,14 @@ static int dv1394_init(struct ti_ohci *o list_add_tail(&video->list, &dv1394_cards); spin_unlock_irqrestore(&dv1394_cards_lock, flags); - if (devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, - IEEE1394_MINOR_BLOCK_DV1394*16 + video->id), - S_IFCHR|S_IRUGO|S_IWUGO, - "ieee1394/dv/host%d/%s/%s", - (video->id>>2), - (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"), - (video->mode == MODE_RECEIVE ? "in" : "out")) < 0) - goto err_free; - debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id); - return 0; - - err_free: - kfree(video); - err: - return -1; } static void dv1394_un_init(struct video_card *video) { - char buf[32]; - /* obviously nobody has the driver open at this point */ do_dv1394_shutdown(video, 1); - snprintf(buf, sizeof(buf), "dv/host%d/%s/%s", (video->id >> 2), - (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"), - (video->mode == MODE_RECEIVE ? "in" : "out") - ); - - devfs_remove("ieee1394/%s", buf); kfree(video); } @@ -2333,9 +2307,6 @@ static void dv1394_remove_host (struct h class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); - devfs_remove("ieee1394/dv/host%d/NTSC", id); - devfs_remove("ieee1394/dv/host%d/PAL", id); - devfs_remove("ieee1394/dv/host%d", id); } static void dv1394_add_host (struct hpsb_host *host) @@ -2352,9 +2323,6 @@ static void dv1394_add_host (struct hpsb class_device_create(hpsb_protocol_class, NULL, MKDEV( IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), NULL, "dv1394-%d", id); - devfs_mk_dir("ieee1394/dv/host%d", id); - devfs_mk_dir("ieee1394/dv/host%d/NTSC", id); - devfs_mk_dir("ieee1394/dv/host%d/PAL", id); dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); @@ -2611,10 +2579,8 @@ MODULE_LICENSE("GPL"); static void __exit dv1394_exit_module(void) { hpsb_unregister_protocol(&dv1394_driver); - hpsb_unregister_highlevel(&dv1394_highlevel); cdev_del(&dv1394_cdev); - devfs_remove("ieee1394/dv"); } static int __init dv1394_init_module(void) @@ -2630,15 +2596,12 @@ static int __init dv1394_init_module(voi return ret; } - devfs_mk_dir("ieee1394/dv"); - hpsb_register_highlevel(&dv1394_highlevel); ret = hpsb_register_protocol(&dv1394_driver); if (ret) { printk(KERN_ERR "dv1394: failed to register protocol\n"); hpsb_unregister_highlevel(&dv1394_highlevel); - devfs_remove("ieee1394/dv"); cdev_del(&dv1394_cdev); return ret; } diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 25ef5a8..be6854e 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c @@ -58,7 +58,7 @@ MODULE_PARM_DESC(disable_nodemgr, "Disab /* Disable Isochronous Resource Manager functionality */ int hpsb_disable_irm = 0; -module_param_named(disable_irm, hpsb_disable_irm, bool, 0); +module_param_named(disable_irm, hpsb_disable_irm, bool, 0444); MODULE_PARM_DESC(disable_irm, "Disable Isochronous Resource Manager functionality."); @@ -1078,17 +1078,10 @@ static int __init ieee1394_init(void) goto exit_release_kernel_thread; } - /* actually this is a non-fatal error */ - ret = devfs_mk_dir("ieee1394"); - if (ret < 0) { - HPSB_ERR("unable to make devfs dir for device major %d!\n", IEEE1394_MAJOR); - goto release_chrdev; - } - ret = bus_register(&ieee1394_bus_type); if (ret < 0) { HPSB_INFO("bus register failed"); - goto release_devfs; + goto release_chrdev; } for (i = 0; fw_bus_attrs[i]; i++) { @@ -1099,7 +1092,7 @@ static int __init ieee1394_init(void) fw_bus_attrs[i--]); } bus_unregister(&ieee1394_bus_type); - goto release_devfs; + goto release_chrdev; } } @@ -1152,8 +1145,6 @@ release_all_bus: for (i = 0; fw_bus_attrs[i]; i++) bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]); bus_unregister(&ieee1394_bus_type); -release_devfs: - devfs_remove("ieee1394"); release_chrdev: unregister_chrdev_region(IEEE1394_CORE_DEV, 256); exit_release_kernel_thread: @@ -1191,7 +1182,6 @@ static void __exit ieee1394_cleanup(void hpsb_cleanup_config_roms(); unregister_chrdev_region(IEEE1394_CORE_DEV, 256); - devfs_remove("ieee1394"); } module_init(ieee1394_init); diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h index b354660..e7b55e8 100644 --- a/drivers/ieee1394/ieee1394_core.h +++ b/drivers/ieee1394/ieee1394_core.h @@ -3,7 +3,6 @@ #define _IEEE1394_CORE_H #include -#include #include #include #include "hosts.h" @@ -202,14 +201,12 @@ void hpsb_packet_received(struct hpsb_ho #define IEEE1394_MINOR_BLOCK_RAW1394 0 #define IEEE1394_MINOR_BLOCK_VIDEO1394 1 #define IEEE1394_MINOR_BLOCK_DV1394 2 -#define IEEE1394_MINOR_BLOCK_AMDTP 3 #define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 #define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) #define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16) #define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) #define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16) -#define IEEE1394_AMDTP_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_AMDTP * 16) #define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) /* return the index (within a minor number block) of a file */ diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index b6b96fa..ab01a54 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -544,12 +544,19 @@ static void ohci_initialize(struct ti_oh /* Initialize IR Legacy DMA channel mask */ ohci->ir_legacy_channels = 0; - /* - * Accept AT requests from all nodes. This probably - * will have to be controlled from the subsystem - * on a per node basis. - */ - reg_write(ohci,OHCI1394_AsReqFilterHiSet, 0x80000000); + /* Accept AR requests from all nodes */ + reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); + + /* Set the address range of the physical response unit. + * Most controllers do not implement it as a writable register though. + * They will keep a hardwired offset of 0x00010000 and show 0x0 as + * register content. + * To actually enable physical responses is the job of our interrupt + * handler which programs the physical request filter. */ + reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000); + + DBGMSG("physUpperBoundOffset=%08x", + reg_read(ohci, OHCI1394_PhyUpperBound)); /* Specify AT retries */ reg_write(ohci, OHCI1394_ATRetries, @@ -572,6 +579,7 @@ static void ohci_initialize(struct ti_oh OHCI1394_reqTxComplete | OHCI1394_isochRx | OHCI1394_isochTx | + OHCI1394_postedWriteErr | OHCI1394_cycleInconsistent); /* Enable link */ @@ -2374,7 +2382,10 @@ static irqreturn_t ohci_irq_handler(int event &= ~OHCI1394_unrecoverableError; } - + if (event & OHCI1394_postedWriteErr) { + PRINT(KERN_ERR, "physical posted write error"); + /* no recovery strategy yet, had to involve protocol drivers */ + } if (event & OHCI1394_cycleInconsistent) { /* We subscribe to the cycleInconsistent event only to * clear the corresponding event bit... otherwise, @@ -2382,7 +2393,6 @@ static irqreturn_t ohci_irq_handler(int DBGMSG("OHCI1394_cycleInconsistent"); event &= ~OHCI1394_cycleInconsistent; } - if (event & OHCI1394_busReset) { /* The busReset event bit can't be cleared during the * selfID phase, so we disable busReset interrupts, to @@ -2426,7 +2436,6 @@ static irqreturn_t ohci_irq_handler(int } event &= ~OHCI1394_busReset; } - if (event & OHCI1394_reqTxComplete) { struct dma_trm_ctx *d = &ohci->at_req_context; DBGMSG("Got reqTxComplete interrupt " @@ -2514,26 +2523,20 @@ static irqreturn_t ohci_irq_handler(int reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_busReset); spin_unlock_irqrestore(&ohci->event_lock, flags); - /* Accept Physical requests from all nodes. */ - reg_write(ohci,OHCI1394_AsReqFilterHiSet, 0xffffffff); - reg_write(ohci,OHCI1394_AsReqFilterLoSet, 0xffffffff); - /* Turn on phys dma reception. * * TODO: Enable some sort of filtering management. */ if (phys_dma) { - reg_write(ohci,OHCI1394_PhyReqFilterHiSet, 0xffffffff); - reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0xffffffff); - reg_write(ohci,OHCI1394_PhyUpperBound, 0xffff0000); - } else { - reg_write(ohci,OHCI1394_PhyReqFilterHiSet, 0x00000000); - reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0x00000000); + reg_write(ohci, OHCI1394_PhyReqFilterHiSet, + 0xffffffff); + reg_write(ohci, OHCI1394_PhyReqFilterLoSet, + 0xffffffff); } DBGMSG("PhyReqFilter=%08x%08x", - reg_read(ohci,OHCI1394_PhyReqFilterHiSet), - reg_read(ohci,OHCI1394_PhyReqFilterLoSet)); + reg_read(ohci, OHCI1394_PhyReqFilterHiSet), + reg_read(ohci, OHCI1394_PhyReqFilterLoSet)); hpsb_selfid_complete(host, phyid, isroot); } else @@ -3259,8 +3262,8 @@ static int __devinit ohci1394_pci_probe( * fail to report the right length. Anyway, the ohci spec * clearly says it's 2kb, so this shouldn't be a problem. */ ohci_base = pci_resource_start(dev, 0); - if (pci_resource_len(dev, 0) != OHCI1394_REGISTER_SIZE) - PRINT(KERN_WARNING, "Unexpected PCI resource length of %lx!", + if (pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) + PRINT(KERN_WARNING, "PCI resource length of 0x%lx too small!", pci_resource_len(dev, 0)); /* Seems PCMCIA handles this internally. Not sure why. Seems diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index b052356..7d86a3f 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c @@ -41,7 +41,6 @@ #include #include #include -#include #include "csr1212.h" #include "ieee1394.h" @@ -2913,9 +2912,6 @@ static int __init init_raw1394(void) goto out_unreg; } - devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), - S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME); - cdev_init(&raw1394_cdev, &raw1394_fops); raw1394_cdev.owner = THIS_MODULE; kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME); @@ -2937,7 +2933,6 @@ static int __init init_raw1394(void) goto out; out_dev: - devfs_remove(RAW1394_DEVICE_NAME); class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); @@ -2953,7 +2948,6 @@ static void __exit cleanup_raw1394(void) MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); cdev_del(&raw1394_cdev); - devfs_remove(RAW1394_DEVICE_NAME); hpsb_unregister_highlevel(&raw1394_highlevel); hpsb_unregister_protocol(&raw1394_driver); } diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index eca92eb..2c765ca 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c @@ -214,6 +214,7 @@ static u32 global_outstanding_dmas = 0; #endif #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) +#define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__) /* * Globals @@ -535,7 +536,7 @@ static struct sbp2_command_info *sbp2uti command->Current_SCpnt = Current_SCpnt; list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); } else { - SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); + SBP2_ERR("%s: no orbs available", __FUNCTION__); } spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return command; @@ -549,7 +550,7 @@ static void sbp2util_free_command_dma(st struct hpsb_host *host; if (!scsi_id) { - printk(KERN_ERR "%s: scsi_id == NULL\n", __FUNCTION__); + SBP2_ERR("%s: scsi_id == NULL", __FUNCTION__); return; } @@ -610,7 +611,7 @@ static int sbp2_probe(struct device *dev struct unit_directory *ud; struct scsi_id_instance_data *scsi_id; - SBP2_DEBUG("sbp2_probe"); + SBP2_DEBUG_ENTER(); ud = container_of(dev, struct unit_directory, device); @@ -635,7 +636,7 @@ static int sbp2_remove(struct device *de struct scsi_id_instance_data *scsi_id; struct scsi_device *sdev; - SBP2_DEBUG("sbp2_remove"); + SBP2_DEBUG_ENTER(); ud = container_of(dev, struct unit_directory, device); scsi_id = ud->device.driver_data; @@ -667,7 +668,7 @@ static int sbp2_update(struct unit_direc { struct scsi_id_instance_data *scsi_id = ud->device.driver_data; - SBP2_DEBUG("sbp2_update"); + SBP2_DEBUG_ENTER(); if (sbp2_reconnect_device(scsi_id)) { @@ -715,7 +716,7 @@ static struct scsi_id_instance_data *sbp struct Scsi_Host *scsi_host = NULL; struct scsi_id_instance_data *scsi_id = NULL; - SBP2_DEBUG("sbp2_alloc_device"); + SBP2_DEBUG_ENTER(); scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); if (!scsi_id) { @@ -749,12 +750,22 @@ static struct scsi_id_instance_data *sbp #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA /* Handle data movement if physical dma is not - * enabled/supportedon host controller */ - hpsb_register_addrspace(&sbp2_highlevel, ud->ne->host, &sbp2_physdma_ops, - 0x0ULL, 0xfffffffcULL); + * enabled or not supported on host controller */ + if (!hpsb_register_addrspace(&sbp2_highlevel, ud->ne->host, + &sbp2_physdma_ops, + 0x0ULL, 0xfffffffcULL)) { + SBP2_ERR("failed to register lower 4GB address range"); + goto failed_alloc; + } #endif } + /* Prevent unloading of the 1394 host */ + if (!try_module_get(hi->host->driver->owner)) { + SBP2_ERR("failed to get a reference on 1394 host driver"); + goto failed_alloc; + } + scsi_id->hi = hi; list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); @@ -816,7 +827,7 @@ static int sbp2_start_device(struct scsi struct sbp2scsi_host_info *hi = scsi_id->hi; int error; - SBP2_DEBUG("sbp2_start_device"); + SBP2_DEBUG_ENTER(); /* Login FIFO DMA */ scsi_id->login_response = @@ -891,7 +902,6 @@ static int sbp2_start_device(struct scsi * allows someone else to login instead. One second makes sense. */ msleep_interruptible(1000); if (signal_pending(current)) { - SBP2_WARN("aborting sbp2_start_device due to event"); sbp2_remove_device(scsi_id); return -EINTR; } @@ -944,7 +954,7 @@ static void sbp2_remove_device(struct sc { struct sbp2scsi_host_info *hi; - SBP2_DEBUG("sbp2_remove_device"); + SBP2_DEBUG_ENTER(); if (!scsi_id) return; @@ -1015,6 +1025,9 @@ static void sbp2_remove_device(struct sc scsi_id->ud->device.driver_data = NULL; + if (hi) + module_put(hi->host->driver->owner); + SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); kfree(scsi_id); @@ -1073,23 +1086,20 @@ static int sbp2_query_logins(struct scsi int max_logins; int active_logins; - SBP2_DEBUG("sbp2_query_logins"); + SBP2_DEBUG_ENTER(); scsi_id->query_logins_orb->reserved1 = 0x0; scsi_id->query_logins_orb->reserved2 = 0x0; scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma; scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id); - SBP2_DEBUG("sbp2_query_logins: query_response_hi/lo initialized"); scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); - SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); scsi_id->query_logins_orb->reserved_resp_length = ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); - SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized"); scsi_id->query_logins_orb->status_fifo_hi = 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 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); - SBP2_DEBUG("sbp2_query_logins: orb byte-swapped"); - sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), "sbp2 query logins orb", scsi_id->query_logins_orb_dma); memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); - SBP2_DEBUG("sbp2_query_logins: query_logins_response/status FIFO memset"); - data[0] = ORB_SET_NODE_ID(hi->host->node_id); data[1] = scsi_id->query_logins_orb_dma; sbp2util_cpu_to_be32_buffer(data, 8); atomic_set(&scsi_id->sbp2_login_complete, 0); - SBP2_DEBUG("sbp2_query_logins: prepared to write"); hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); - SBP2_DEBUG("sbp2_query_logins: written"); if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { SBP2_INFO("Error querying logins to SBP-2 device - timed out"); @@ -1165,10 +1169,10 @@ static int sbp2_login_device(struct scsi struct sbp2scsi_host_info *hi = scsi_id->hi; quadlet_t data[2]; - SBP2_DEBUG("sbp2_login_device"); + SBP2_DEBUG_ENTER(); if (!scsi_id->login_orb) { - SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); + SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__); return -EIO; } @@ -1182,59 +1186,39 @@ static int sbp2_login_device(struct scsi /* Set-up login ORB, assume no password */ scsi_id->login_orb->password_hi = 0; scsi_id->login_orb->password_lo = 0; - SBP2_DEBUG("sbp2_login_device: password_hi/lo initialized"); scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma; scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id); - SBP2_DEBUG("sbp2_login_device: login_response_hi/lo initialized"); scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST); scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); - SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); scsi_id->login_orb->passwd_resp_lengths = ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); - SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized"); scsi_id->login_orb->status_fifo_hi = ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); scsi_id->login_orb->status_fifo_lo = ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); - /* - * Byte swap ORB if necessary - */ sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); - SBP2_DEBUG("sbp2_login_device: orb byte-swapped"); - sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), "sbp2 login orb", scsi_id->login_orb_dma); - /* - * Initialize login response and status fifo - */ memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); - SBP2_DEBUG("sbp2_login_device: login_response/status FIFO memset"); - - /* - * Ok, let's write to the target's management agent register - */ data[0] = ORB_SET_NODE_ID(hi->host->node_id); data[1] = scsi_id->login_orb_dma; sbp2util_cpu_to_be32_buffer(data, 8); atomic_set(&scsi_id->sbp2_login_complete, 0); - SBP2_DEBUG("sbp2_login_device: prepared to write to %08x", - (unsigned int)scsi_id->sbp2_management_agent_addr); hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); - SBP2_DEBUG("sbp2_login_device: written"); /* * Wait for login status (up to 20 seconds)... @@ -1298,7 +1282,7 @@ static int sbp2_logout_device(struct scs quadlet_t data[2]; int error; - SBP2_DEBUG("sbp2_logout_device"); + SBP2_DEBUG_ENTER(); /* * Set-up logout ORB @@ -1362,7 +1346,7 @@ static int sbp2_reconnect_device(struct quadlet_t data[2]; int error; - SBP2_DEBUG("sbp2_reconnect_device"); + SBP2_DEBUG_ENTER(); /* * Set-up reconnect ORB @@ -1453,17 +1437,11 @@ static int sbp2_set_busy_timeout(struct { quadlet_t data; - SBP2_DEBUG("sbp2_set_busy_timeout"); + SBP2_DEBUG_ENTER(); - /* - * Ok, let's write to the target's busy timeout register - */ data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); - - if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) { - SBP2_ERR("sbp2_set_busy_timeout error"); - } - + if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) + SBP2_ERR("%s error", __FUNCTION__); return 0; } @@ -1482,7 +1460,7 @@ static void sbp2_parse_unit_directory(st firmware_revision, workarounds; int i; - SBP2_DEBUG("sbp2_parse_unit_directory"); + SBP2_DEBUG_ENTER(); management_agent_addr = 0x0; command_set_spec_id = 0x0; @@ -1615,7 +1593,7 @@ static int sbp2_max_speed_and_size(struc { struct sbp2scsi_host_info *hi = scsi_id->hi; - SBP2_DEBUG("sbp2_max_speed_and_size"); + SBP2_DEBUG_ENTER(); /* Initial setting comes from the hosts speed map */ scsi_id->speed_code = @@ -1652,11 +1630,8 @@ static int sbp2_agent_reset(struct scsi_ u64 addr; int retval; - SBP2_DEBUG("sbp2_agent_reset"); + SBP2_DEBUG_ENTER(); - /* - * Ok, let's write to the target's management agent register - */ data = ntohl(SBP2_AGENT_RESET_DATA); addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; @@ -2004,11 +1979,7 @@ static int sbp2_send_command(struct scsi unsigned int request_bufflen = SCpnt->request_bufflen; struct sbp2_command_info *command; - SBP2_DEBUG("sbp2_send_command"); -#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) - printk("[scsi command]\n "); - scsi_print_command(SCpnt); -#endif + SBP2_DEBUG_ENTER(); SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); @@ -2048,7 +2019,7 @@ static int sbp2_send_command(struct scsi */ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) { - SBP2_DEBUG("sbp2_status_to_sense_data"); + SBP2_DEBUG_ENTER(); /* * Ok, it's pretty ugly... ;-) @@ -2082,7 +2053,7 @@ static void sbp2_check_sbp2_response(str { u8 *scsi_buf = SCpnt->request_buffer; - SBP2_DEBUG("sbp2_check_sbp2_response"); + SBP2_DEBUG_ENTER(); if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) { /* @@ -2113,7 +2084,7 @@ static int sbp2_handle_status_write(stru struct sbp2_command_info *command; unsigned long flags; - SBP2_DEBUG("sbp2_handle_status_write"); + SBP2_DEBUG_ENTER(); sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); @@ -2260,7 +2231,10 @@ static int sbp2scsi_queuecommand(struct struct sbp2scsi_host_info *hi; int result = DID_NO_CONNECT << 16; - SBP2_DEBUG("sbp2scsi_queuecommand"); + SBP2_DEBUG_ENTER(); +#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) + scsi_print_command(SCpnt); +#endif if (!sbp2util_node_is_available(scsi_id)) goto done; @@ -2338,7 +2312,7 @@ static void sbp2scsi_complete_all_comman struct sbp2_command_info *command; unsigned long flags; - SBP2_DEBUG("sbp2scsi_complete_all_commands"); + SBP2_DEBUG_ENTER(); spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { @@ -2371,7 +2345,7 @@ static void sbp2scsi_complete_command(st u32 scsi_status, struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { - SBP2_DEBUG("sbp2scsi_complete_command"); + SBP2_DEBUG_ENTER(); /* * Sanity @@ -2397,7 +2371,7 @@ static void sbp2scsi_complete_command(st */ switch (scsi_status) { case SBP2_SCSI_STATUS_GOOD: - SCpnt->result = DID_OK; + SCpnt->result = DID_OK << 16; break; case SBP2_SCSI_STATUS_BUSY: @@ -2407,16 +2381,11 @@ static void sbp2scsi_complete_command(st case SBP2_SCSI_STATUS_CHECK_CONDITION: SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); - SCpnt->result = CHECK_CONDITION << 1; - - /* - * Debug stuff - */ + SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 scsi_print_command(SCpnt); - scsi_print_sense("bh", SCpnt); + scsi_print_sense(SBP2_DEVICE_NAME, SCpnt); #endif - break; case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: @@ -2441,7 +2410,7 @@ static void sbp2scsi_complete_command(st /* * Take care of any sbp2 response data mucking here (RBC stuff, etc.) */ - if (SCpnt->result == DID_OK) { + if (SCpnt->result == DID_OK << 16) { sbp2_check_sbp2_response(scsi_id, SCpnt); } @@ -2459,6 +2428,8 @@ static void sbp2scsi_complete_command(st * If a unit attention occurs, return busy status so it gets * retried... it could have happened because of a 1394 bus reset * or hot-plug... + * XXX DID_BUS_BUSY is actually a bad idea because it will defy + * the scsi layer's retry logic. */ #if 0 if ((scsi_status == SBP2_SCSI_STATUS_CHECK_CONDITION) && @@ -2624,7 +2595,7 @@ static int sbp2_module_init(void) { int ret; - SBP2_DEBUG("sbp2_module_init"); + SBP2_DEBUG_ENTER(); /* Module load debug option to force one command at a time (serializing I/O) */ if (serialize_io) { @@ -2652,7 +2623,7 @@ static int sbp2_module_init(void) static void __exit sbp2_module_exit(void) { - SBP2_DEBUG("sbp2_module_exit"); + SBP2_DEBUG_ENTER(); hpsb_unregister_protocol(&sbp2_driver); diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 39fb883..fbca737 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -1322,9 +1321,6 @@ static void video1394_add_host (struct h class_device_create(hpsb_protocol_class, NULL, MKDEV( IEEE1394_MAJOR, minor), NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); - devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), - S_IFCHR | S_IRUSR | S_IWUSR, - "%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id); } @@ -1332,12 +1328,9 @@ static void video1394_remove_host (struc { struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host); - if (ohci) { + if (ohci) class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); - devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id); - } - return; } @@ -1478,12 +1471,8 @@ static long video1394_compat_ioctl(struc static void __exit video1394_exit_module (void) { hpsb_unregister_protocol(&video1394_driver); - hpsb_unregister_highlevel(&video1394_highlevel); - - devfs_remove(VIDEO1394_DRIVER_NAME); cdev_del(&video1394_cdev); - PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module"); } @@ -1500,15 +1489,12 @@ static int __init video1394_init_module return ret; } - devfs_mk_dir(VIDEO1394_DRIVER_NAME); - hpsb_register_highlevel(&video1394_highlevel); ret = hpsb_register_protocol(&video1394_driver); if (ret) { PRINT_G(KERN_ERR, "video1394: failed to register protocol"); hpsb_unregister_highlevel(&video1394_highlevel); - devfs_remove(VIDEO1394_DRIVER_NAME); cdev_del(&video1394_cdev); return ret; }