Lines Matching +full:host +full:- +full:command

2    3w-xxxx.c -- 3ware Storage Controller device driver for Linux.
9 Copyright (C) 1999-2010 3ware Inc.
12 Non-Copyright (C) 2000 Andre Hedrick <andre@suse.com>
28 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
47 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
55 -------
56 0.1.000 - Initial release.
57 0.4.000 - Added support for Asynchronous Event Notification through
59 1.0.000 - Added DPO & FUA bit support for WRITE_10 & WRITE_6 cdb
60 to disable drive write-cache before writes.
61 1.1.000 - Fixed performance bug with DPO & FUA not existing for WRITE_6.
62 1.2.000 - Added support for clean shutdown notification/feature table.
63 1.02.00.001 - Added support for full command packet posts through ioctls
66 1.02.00.002 - Fix bug with tw_setfeature() call that caused oops on some
68 08/21/00 - release previously allocated resources on failure at
70 1.02.00.003 - Fix tw_interrupt() to report error to scsi layer when
71 controller status is non-zero.
75 1.02.00.004 - Add support for device id of 3ware 7000 series controllers.
79 1.02.00.005 - Allocate bounce buffers and custom queue depth for raid5 for
84 Add aen count to /proc/scsi/3w-xxxx.
86 1.02.00.006 - Remove unit from printk in tw_scsi_eh_abort(), causing
90 1.02.00.007 - Fix possible null pointer dereferences in tw_ioctl().
93 1.02.00.008 - Set max sectors per io to TW_MAX_SECTORS in tw_findcards().
99 Re-add spinlocks in tw_scsi_detect().
103 1.02.00.009 - Remove redundant increment in tw_state_request_start().
104 Add ioctl support for direct ATA command passthru.
106 1.02.00.010 - Cleanup queueing code, fix jbod thoughput.
108 1.02.00.011 - Fix bug in tw_aen_complete() where aen's could be lost.
110 Set tw_host->max_id for 12 port cards.
111 Add ioctl support for raw command packet post from userspace
113 1.02.00.012 - Fix read capacity to under report by 1 sector to fix get
115 1.02.00.013 - Fix bug where more AEN codes weren't coming out during
118 1.02.00.014 - Fix bug in tw_findcards() where AEN code could be lost.
120 1.02.00.015 - Re-write raw command post with data ioctl method.
125 1.02.00.016 - Set host->max_sectors back up to 256.
126 1.02.00.017 - Modified pci parity error handling/clearing from config space
128 1.02.00.018 - Better handling of request sense opcode and sense information
131 1.02.00.019 - Revert mdelay's and scsi_sleep's, this caused problems on
133 1.02.00.020 - Add pci_set_dma_mask(), rewrite kmalloc()/virt_to_bus() to
137 1.02.00.021 - Bump cmd_per_lun in SHT to 255 for better jbod performance.
143 1.02.00.022 - Fix possible null pointer dereference in tw_scsi_release().
144 1.02.00.023 - Fix bug in tw_aen_drain_queue() where unit # was always zero.
145 1.02.00.024 - Add severity levels to AEN strings.
146 1.02.00.025 - Fix command interrupt spurious error messages.
147 Fix bug in raw command post with data ioctl method.
149 Print unit # on all command timeouts.
150 1.02.00.026 - Fix possible infinite retry bug with power glitch induced
153 1.02.00.027 - Add drive not supported AEN code for SATA controllers.
155 1.02.00.028 - Fix bug where multiple controllers with no units were the
158 1.02.00.029 - Add missing pci_free_consistent() in tw_allocate_memory().
161 1.02.00.030 - Make driver 64-bit clean.
162 1.02.00.031 - Cleanup polling timeouts/routines in several places.
166 1.02.00.032 - Fix small multicard rollcall bug.
171 1.02.00.033 - Fix tw_aen_complete() to not queue 'queue empty' AEN's.
173 1.02.00.034 - Fix tw_decode_bits() to handle multiple errors.
175 Add support for sht->slave_configure().
176 1.02.00.035 - Improve tw_allocate_memory() memory allocation.
178 1.02.00.036 - Increase character ioctl timeout to 60 seconds.
179 1.02.00.037 - Fix tw_ioctl() to handle all non-data ATA passthru cmds
181 1.26.00.038 - Roll driver minor version to 26 to denote kernel 2.6.
183 1.26.00.039 - Fix bug in tw_chrdev_ioctl() polling code.
186 1.26.02.000 - Convert driver to pci_driver format.
187 1.26.02.001 - Increase max ioctl buffer size to 512 sectors.
193 1.26.02.002 - Free irq handler in __tw_shutdown().
196 1.26.02.003 - Force 60 second timeout default.
219 #include "3w-xxxx.h"
226 static int twe_major = -1;
243 dprintk(KERN_WARNING "3w-xxxx: tw_check_bits(): No expected bits (0x%x).\n", status_reg_value); in tw_check_bits()
247 …dprintk(KERN_WARNING "3w-xxxx: tw_check_bits(): Found unexpected bits (0x%x).\n", status_reg_value… in tw_check_bits()
257 char host[16]; in tw_decode_bits() local
259 dprintk(KERN_WARNING "3w-xxxx: tw_decode_bits()\n"); in tw_decode_bits()
262 sprintf(host, " scsi%d:", tw_dev->host->host_no); in tw_decode_bits()
264 host[0] = '\0'; in tw_decode_bits()
267 printk(KERN_WARNING "3w-xxxx:%s PCI Parity Error: clearing.\n", host); in tw_decode_bits()
272 printk(KERN_WARNING "3w-xxxx:%s PCI Abort: clearing.\n", host); in tw_decode_bits()
274 pci_write_config_word(tw_dev->tw_pci_dev, PCI_STATUS, TW_PCI_CLEAR_PCI_ABORT); in tw_decode_bits()
278 printk(KERN_WARNING "3w-xxxx:%s Controller Queue Error: clearing.\n", host); in tw_decode_bits()
283 printk(KERN_WARNING "3w-xxxx:%s SBUF Write Error: clearing.\n", host); in tw_decode_bits()
288 if (tw_dev->reset_print == 0) { in tw_decode_bits()
289 printk(KERN_WARNING "3w-xxxx:%s Microcontroller Error: clearing.\n", host); in tw_decode_bits()
290 tw_dev->reset_print = 1; in tw_decode_bits()
356 /* This function will attempt to post a command packet to the board */
362 dprintk(KERN_NOTICE "3w-xxxx: tw_post_command_packet()\n"); in tw_post_command_packet()
363 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_post_command_packet()
367 dprintk(KERN_WARNING "3w-xxxx: tw_post_command_packet(): Unexpected bits.\n"); in tw_post_command_packet()
372 /* We successfully posted the command packet */ in tw_post_command_packet()
374 tw_dev->state[request_id] = TW_S_POSTED; in tw_post_command_packet()
375 tw_dev->posted_request_count++; in tw_post_command_packet()
376 if (tw_dev->posted_request_count > tw_dev->max_posted_request_count) { in tw_post_command_packet()
377 tw_dev->max_posted_request_count = tw_dev->posted_request_count; in tw_post_command_packet()
380 /* Couldn't post the command packet, so we do it in the isr */ in tw_post_command_packet()
381 if (tw_dev->state[request_id] != TW_S_PENDING) { in tw_post_command_packet()
382 tw_dev->state[request_id] = TW_S_PENDING; in tw_post_command_packet()
383 tw_dev->pending_request_count++; in tw_post_command_packet()
384 if (tw_dev->pending_request_count > tw_dev->max_pending_request_count) { in tw_post_command_packet()
385 tw_dev->max_pending_request_count = tw_dev->pending_request_count; in tw_post_command_packet()
387 tw_dev->pending_queue[tw_dev->pending_tail] = request_id; in tw_post_command_packet()
388 if (tw_dev->pending_tail == TW_Q_LENGTH-1) { in tw_post_command_packet()
389 tw_dev->pending_tail = TW_Q_START; in tw_post_command_packet()
391 tw_dev->pending_tail = tw_dev->pending_tail + 1; in tw_post_command_packet()
404 TW_Command *command; in tw_decode_sense() local
406 dprintk(KERN_WARNING "3w-xxxx: tw_decode_sense()\n"); in tw_decode_sense()
407 command = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_decode_sense()
409 …w-xxxx: scsi%d: Command failed: status = 0x%x, flags = 0x%x, unit #%d.\n", tw_dev->host->host_no, in tw_decode_sense()
413 if ((command->status == 0xc7) || (command->status == 0xcb)) { in tw_decode_sense()
415 if (command->flags == tw_sense_table[i][0]) { in tw_decode_sense()
418 tw_dev->srb[request_id]->sense_buffer[0] = (0x1 << 7 | 0x70); in tw_decode_sense()
421 tw_dev->srb[request_id]->sense_buffer[2] = tw_sense_table[i][1]; in tw_decode_sense()
424 tw_dev->srb[request_id]->sense_buffer[7] = 0xa; /* 10 bytes */ in tw_decode_sense()
427 tw_dev->srb[request_id]->sense_buffer[12] = tw_sense_table[i][2]; in tw_decode_sense()
430 tw_dev->srb[request_id]->sense_buffer[13] = tw_sense_table[i][3]; in tw_decode_sense()
432 tw_dev->srb[request_id]->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; in tw_decode_sense()
433 return TW_ISR_DONT_RESULT; /* Special case for isr to not over-write result */ in tw_decode_sense()
476 tw_dev->free_queue[tw_dev->free_tail] = request_id; in tw_state_request_finish()
477 tw_dev->state[request_id] = TW_S_FINISHED; in tw_state_request_finish()
478 tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH; in tw_state_request_finish()
484 *request_id = tw_dev->free_queue[tw_dev->free_head]; in tw_state_request_start()
485 tw_dev->free_head = (tw_dev->free_head + 1) % TW_Q_LENGTH; in tw_state_request_start()
486 tw_dev->state[*request_id] = TW_S_STARTED; in tw_state_request_start()
493 struct Scsi_Host *host = class_to_shost(dev); in tw_show_stats() local
494 TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; in tw_show_stats()
498 spin_lock_irqsave(tw_dev->host->host_lock, flags); in tw_show_stats()
499 len = sysfs_emit(buf, "3w-xxxx Driver version: %s\n" in tw_show_stats()
508 "SCSI Host Resets: %4d\n" in tw_show_stats()
511 tw_dev->posted_request_count, in tw_show_stats()
512 tw_dev->max_posted_request_count, in tw_show_stats()
513 tw_dev->pending_request_count, in tw_show_stats()
514 tw_dev->max_pending_request_count, in tw_show_stats()
515 tw_dev->sgl_entries, in tw_show_stats()
516 tw_dev->max_sgl_entries, in tw_show_stats()
517 tw_dev->sector_count, in tw_show_stats()
518 tw_dev->max_sector_count, in tw_show_stats()
519 tw_dev->num_resets, in tw_show_stats()
520 tw_dev->aen_count); in tw_show_stats()
521 spin_unlock_irqrestore(tw_dev->host->host_lock, flags); in tw_show_stats()
534 /* Host attributes initializer */
551 dprintk(KERN_NOTICE "3w-xxxx: tw_aen_read_queue()\n"); in tw_aen_read_queue()
555 dprintk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Unexpected bits.\n"); in tw_aen_read_queue()
559 if (tw_dev->command_packet_virtual_address[request_id] == NULL) { in tw_aen_read_queue()
560 printk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Bad command packet virtual address.\n"); in tw_aen_read_queue()
563 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_aen_read_queue()
565 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_aen_read_queue()
566 command_packet->size = 4; in tw_aen_read_queue()
567 command_packet->request_id = request_id; in tw_aen_read_queue()
568 command_packet->status = 0; in tw_aen_read_queue()
569 command_packet->flags = 0; in tw_aen_read_queue()
570 command_packet->byte6.parameter_count = 1; in tw_aen_read_queue()
571 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_aen_read_queue()
573 printk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Bad command packet physical address.\n"); in tw_aen_read_queue()
577 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_aen_read_queue()
578 printk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Bad alignment virtual address.\n"); in tw_aen_read_queue()
581 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_aen_read_queue()
583 param->table_id = 0x401; /* AEN table */ in tw_aen_read_queue()
584 param->parameter_id = 2; /* Unit code */ in tw_aen_read_queue()
585 param->parameter_size_bytes = 2; in tw_aen_read_queue()
586 param_value = tw_dev->alignment_physical_address[request_id]; in tw_aen_read_queue()
588 printk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Bad alignment physical address.\n"); in tw_aen_read_queue()
591 command_packet->byte8.param.sgl[0].address = param_value; in tw_aen_read_queue()
592 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_aen_read_queue()
594 /* Now post the command packet */ in tw_aen_read_queue()
596 dprintk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Post succeeded.\n"); in tw_aen_read_queue()
597 tw_dev->srb[request_id] = NULL; /* Flag internal command */ in tw_aen_read_queue()
598 tw_dev->state[request_id] = TW_S_POSTED; in tw_aen_read_queue()
601 printk(KERN_WARNING "3w-xxxx: tw_aen_read_queue(): Post failed, will retry.\n"); in tw_aen_read_queue()
615 dprintk(KERN_WARNING "3w-xxxx: tw_aen_complete()\n"); in tw_aen_complete()
616 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_aen_complete()
617 printk(KERN_WARNING "3w-xxxx: tw_aen_complete(): Bad alignment virtual address.\n"); in tw_aen_complete()
620 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_aen_complete()
621 aen = *(unsigned short *)(param->data); in tw_aen_complete()
622 dprintk(KERN_NOTICE "3w-xxxx: tw_aen_complete(): Queue'd code 0x%x\n", aen); in tw_aen_complete()
626 printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: INFO: AEN queue overflow.\n", tw_dev->host->host_no); in tw_aen_complete()
630 if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { in tw_aen_complete()
631 …printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s%d.\n", tw_dev->host->host_no, tw_aen_string[aen & 0x… in tw_aen_complete()
634 …printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s.\n", tw_dev->host->host_no, tw_aen_string[aen & 0xff… in tw_aen_complete()
637 printk(KERN_WARNING "3w-xxxx: scsi%d: Received AEN %d.\n", tw_dev->host->host_no, aen); in tw_aen_complete()
641 tw_dev->aen_count++; in tw_aen_complete()
644 tw_dev->aen_queue[tw_dev->aen_tail] = aen; in tw_aen_complete()
645 if (tw_dev->aen_tail == TW_Q_LENGTH - 1) { in tw_aen_complete()
646 tw_dev->aen_tail = TW_Q_START; in tw_aen_complete()
648 tw_dev->aen_tail = tw_dev->aen_tail + 1; in tw_aen_complete()
650 if (tw_dev->aen_head == tw_dev->aen_tail) { in tw_aen_complete()
651 if (tw_dev->aen_head == TW_Q_LENGTH - 1) { in tw_aen_complete()
652 tw_dev->aen_head = TW_Q_START; in tw_aen_complete()
654 tw_dev->aen_head = tw_dev->aen_head + 1; in tw_aen_complete()
660 printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing AEN.\n", tw_dev->host->host_no); in tw_aen_complete()
661 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_aen_complete()
665 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_aen_complete()
688 dprintk(KERN_NOTICE "3w-xxxx: tw_aen_drain_queue()\n"); in tw_aen_drain_queue()
691 …dprintk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): No attention interrupt for card %d.\n", tw_de… in tw_aen_drain_queue()
699 /* Initialize command packet */ in tw_aen_drain_queue()
700 if (tw_dev->command_packet_virtual_address[request_id] == NULL) { in tw_aen_drain_queue()
701 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Bad command packet virtual address.\n"); in tw_aen_drain_queue()
704 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_aen_drain_queue()
706 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_aen_drain_queue()
707 command_packet->size = 4; in tw_aen_drain_queue()
708 command_packet->request_id = request_id; in tw_aen_drain_queue()
709 command_packet->status = 0; in tw_aen_drain_queue()
710 command_packet->flags = 0; in tw_aen_drain_queue()
711 command_packet->byte6.parameter_count = 1; in tw_aen_drain_queue()
712 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_aen_drain_queue()
714 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Bad command packet physical address.\n"); in tw_aen_drain_queue()
719 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_aen_drain_queue()
720 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Bad alignment virtual address.\n"); in tw_aen_drain_queue()
723 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_aen_drain_queue()
725 param->table_id = 0x401; /* AEN table */ in tw_aen_drain_queue()
726 param->parameter_id = 2; /* Unit code */ in tw_aen_drain_queue()
727 param->parameter_size_bytes = 2; in tw_aen_drain_queue()
728 param_value = tw_dev->alignment_physical_address[request_id]; in tw_aen_drain_queue()
730 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Bad alignment physical address.\n"); in tw_aen_drain_queue()
733 command_packet->byte8.param.sgl[0].address = param_value; in tw_aen_drain_queue()
734 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_aen_drain_queue()
738 /* Post command packet */ in tw_aen_drain_queue()
748 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Unexpected request id.\n"); in tw_aen_drain_queue()
752 if (command_packet->status != 0) { in tw_aen_drain_queue()
753 if (command_packet->flags != TW_AEN_TABLE_UNDEFINED) { in tw_aen_drain_queue()
758 /* We know this is a 3w-1x00, and doesn't support aen's */ in tw_aen_drain_queue()
764 aen = *(unsigned short *)(param->data); in tw_aen_drain_queue()
769 dprintk(KERN_WARNING "3w-xxxx: AEN: %s.\n", tw_aen_string[aen & 0xff]); in tw_aen_drain_queue()
780 printk(KERN_WARNING "3w-xxxx: AEN: %s.\n", tw_aen_string[aen & 0xff]); in tw_aen_drain_queue()
781 tw_dev->aen_count++; in tw_aen_drain_queue()
787 printk(KERN_WARNING "3w-xxxx: AEN: INFO: AEN queue overflow.\n"); in tw_aen_drain_queue()
791 if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { in tw_aen_drain_queue()
792 printk(KERN_WARNING "3w-xxxx: AEN: %s%d.\n", tw_aen_string[aen & 0xff], aen >> 8); in tw_aen_drain_queue()
794 printk(KERN_WARNING "3w-xxxx: AEN: %s.\n", tw_aen_string[aen & 0xff]); in tw_aen_drain_queue()
797 printk(KERN_WARNING "3w-xxxx: Received AEN %d.\n", aen); in tw_aen_drain_queue()
799 tw_dev->aen_count++; in tw_aen_drain_queue()
805 tw_dev->aen_queue[tw_dev->aen_tail] = aen; in tw_aen_drain_queue()
806 if (tw_dev->aen_tail == TW_Q_LENGTH - 1) { in tw_aen_drain_queue()
807 tw_dev->aen_tail = TW_Q_START; in tw_aen_drain_queue()
809 tw_dev->aen_tail = tw_dev->aen_tail + 1; in tw_aen_drain_queue()
811 if (tw_dev->aen_head == tw_dev->aen_tail) { in tw_aen_drain_queue()
812 if (tw_dev->aen_head == TW_Q_LENGTH - 1) { in tw_aen_drain_queue()
813 tw_dev->aen_head = TW_Q_START; in tw_aen_drain_queue()
815 tw_dev->aen_head = tw_dev->aen_head + 1; in tw_aen_drain_queue()
822 printk(KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Response never received.\n"); in tw_aen_drain_queue()
837 dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n"); in tw_allocate_memory()
839 cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, in tw_allocate_memory()
842 printk(KERN_WARNING "3w-xxxx: dma_alloc_coherent() failed.\n"); in tw_allocate_memory()
846 …if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW… in tw_allocate_memory()
847 printk(KERN_WARNING "3w-xxxx: Couldn't allocate correctly aligned memory.\n"); in tw_allocate_memory()
848 dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, in tw_allocate_memory()
858 tw_dev->command_packet_physical_address[i] = dma_handle+(i*size); in tw_allocate_memory()
859 …tw_dev->command_packet_virtual_address[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)… in tw_allocate_memory()
862 tw_dev->alignment_physical_address[i] = dma_handle+(i*size); in tw_allocate_memory()
863 tw_dev->alignment_virtual_address[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)); in tw_allocate_memory()
866 printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): case slip in tw_allocate_memory()\n"); in tw_allocate_memory()
889 int retval = -EFAULT; in tw_chrdev_ioctl()
892 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); in tw_chrdev_ioctl()
896 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { in tw_chrdev_ioctl()
898 return -EINTR; in tw_chrdev_ioctl()
907 retval = -EINVAL; in tw_chrdev_ioctl()
915 …cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted + sizeof(TW_Ne… in tw_chrdev_ioctl()
917 retval = -ENOMEM; in tw_chrdev_ioctl()
927 passthru = (TW_Passthru *)&tw_ioctl->firmware_command; in tw_chrdev_ioctl()
932 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_OP_NOP.\n"); in tw_chrdev_ioctl()
935 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_AEN_LISTEN.\n"); in tw_chrdev_ioctl()
936 memset(tw_ioctl->data_buffer, 0, data_buffer_length); in tw_chrdev_ioctl()
938 spin_lock_irqsave(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
939 if (tw_dev->aen_head == tw_dev->aen_tail) { in tw_chrdev_ioctl()
942 tw_aen_code = tw_dev->aen_queue[tw_dev->aen_head]; in tw_chrdev_ioctl()
943 if (tw_dev->aen_head == TW_Q_LENGTH - 1) { in tw_chrdev_ioctl()
944 tw_dev->aen_head = TW_Q_START; in tw_chrdev_ioctl()
946 tw_dev->aen_head = tw_dev->aen_head + 1; in tw_chrdev_ioctl()
949 spin_unlock_irqrestore(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
950 memcpy(tw_ioctl->data_buffer, &tw_aen_code, sizeof(tw_aen_code)); in tw_chrdev_ioctl()
953 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_CMD_PACKET_WITH_DATA.\n"); in tw_chrdev_ioctl()
954 spin_lock_irqsave(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
958 /* Flag internal command */ in tw_chrdev_ioctl()
959 tw_dev->srb[request_id] = NULL; in tw_chrdev_ioctl()
962 tw_dev->chrdev_request_id = request_id; in tw_chrdev_ioctl()
964 tw_ioctl->firmware_command.request_id = request_id; in tw_chrdev_ioctl()
967 switch (TW_SGL_OUT(tw_ioctl->firmware_command.opcode__sgloffset)) { in tw_chrdev_ioctl()
969 tw_ioctl->firmware_command.byte8.param.sgl[0].address = dma_handle + sizeof(TW_New_Ioctl); in tw_chrdev_ioctl()
970 tw_ioctl->firmware_command.byte8.param.sgl[0].length = data_buffer_length_adjusted; in tw_chrdev_ioctl()
973 tw_ioctl->firmware_command.byte8.io.sgl[0].address = dma_handle + sizeof(TW_New_Ioctl); in tw_chrdev_ioctl()
974 tw_ioctl->firmware_command.byte8.io.sgl[0].length = data_buffer_length_adjusted; in tw_chrdev_ioctl()
977 passthru->sg_list[0].address = dma_handle + sizeof(TW_New_Ioctl); in tw_chrdev_ioctl()
978 passthru->sg_list[0].length = data_buffer_length_adjusted; in tw_chrdev_ioctl()
982 …memcpy(tw_dev->command_packet_virtual_address[request_id], &(tw_ioctl->firmware_command), sizeof(T… in tw_chrdev_ioctl()
984 /* Now post the command packet to the controller */ in tw_chrdev_ioctl()
986 spin_unlock_irqrestore(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
990 /* Now wait for the command to complete */ in tw_chrdev_ioctl()
991 …timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FR… in tw_chrdev_ioctl()
994 if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { in tw_chrdev_ioctl()
996 …printk(KERN_WARNING "3w-xxxx: scsi%d: Character ioctl (0x%x) timed out, resetting card.\n", tw_dev in tw_chrdev_ioctl()
997 retval = -EIO; in tw_chrdev_ioctl()
999 …printk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): Reset failed for card %d.\n", tw_dev->host->host_… in tw_chrdev_ioctl()
1004 /* Now copy in the command packet response */ in tw_chrdev_ioctl()
1005 …memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virtual_address[request_id], sizeof(T… in tw_chrdev_ioctl()
1008 spin_lock_irqsave(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
1009 tw_dev->posted_request_count--; in tw_chrdev_ioctl()
1010 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_chrdev_ioctl()
1012 spin_unlock_irqrestore(tw_dev->host->host_lock, flags); in tw_chrdev_ioctl()
1015 retval = -ENOTTY; in tw_chrdev_ioctl()
1025 …dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted + sizeof(TW_New_Ioctl), cp… in tw_chrdev_ioctl()
1027 mutex_unlock(&tw_dev->ioctl_lock); in tw_chrdev_ioctl()
1038 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n"); in tw_chrdev_open()
1041 return -EACCES; in tw_chrdev_open()
1045 return -ENODEV; in tw_chrdev_open()
1063 dprintk(KERN_NOTICE "3w-xxxx: tw_free_device_extension()\n"); in tw_free_device_extension()
1065 /* Free command packet and generic buffer memory */ in tw_free_device_extension()
1066 if (tw_dev->command_packet_virtual_address[0]) in tw_free_device_extension()
1067 dma_free_coherent(&tw_dev->tw_pci_dev->dev, in tw_free_device_extension()
1069 tw_dev->command_packet_virtual_address[0], in tw_free_device_extension()
1070 tw_dev->command_packet_physical_address[0]); in tw_free_device_extension()
1072 if (tw_dev->alignment_virtual_address[0]) in tw_free_device_extension()
1073 dma_free_coherent(&tw_dev->tw_pci_dev->dev, in tw_free_device_extension()
1075 tw_dev->alignment_virtual_address[0], in tw_free_device_extension()
1076 tw_dev->alignment_physical_address[0]); in tw_free_device_extension()
1079 /* This function will send an initconnection command to controller */
1087 dprintk(KERN_NOTICE "3w-xxxx: tw_initconnection()\n"); in tw_initconnection()
1089 /* Initialize InitConnection command packet */ in tw_initconnection()
1090 if (tw_dev->command_packet_virtual_address[request_id] == NULL) { in tw_initconnection()
1091 printk(KERN_WARNING "3w-xxxx: tw_initconnection(): Bad command packet virtual address.\n"); in tw_initconnection()
1095 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_initconnection()
1097 command_packet->opcode__sgloffset = TW_OPSGL_IN(0, TW_OP_INIT_CONNECTION); in tw_initconnection()
1098 command_packet->size = TW_INIT_COMMAND_PACKET_SIZE; in tw_initconnection()
1099 command_packet->request_id = request_id; in tw_initconnection()
1100 command_packet->status = 0x0; in tw_initconnection()
1101 command_packet->flags = 0x0; in tw_initconnection()
1102 command_packet->byte6.message_credits = message_credits; in tw_initconnection()
1103 command_packet->byte8.init_connection.response_queue_pointer = 0x0; in tw_initconnection()
1104 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_initconnection()
1107 printk(KERN_WARNING "3w-xxxx: tw_initconnection(): Bad command packet physical address.\n"); in tw_initconnection()
1111 /* Send command packet to the board */ in tw_initconnection()
1121 printk(KERN_WARNING "3w-xxxx: tw_initconnection(): Unexpected request id.\n"); in tw_initconnection()
1124 if (command_packet->status != 0) { in tw_initconnection()
1144 /* Initialize SetParam command packet */ in tw_setfeature()
1145 if (tw_dev->command_packet_virtual_address[request_id] == NULL) { in tw_setfeature()
1146 printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad command packet virtual address.\n"); in tw_setfeature()
1149 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_setfeature()
1151 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_setfeature()
1153 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_SET_PARAM); in tw_setfeature()
1154 param->table_id = 0x404; /* Features table */ in tw_setfeature()
1155 param->parameter_id = parm; in tw_setfeature()
1156 param->parameter_size_bytes = param_size; in tw_setfeature()
1157 memcpy(param->data, val, param_size); in tw_setfeature()
1159 param_value = tw_dev->alignment_physical_address[request_id]; in tw_setfeature()
1161 printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad alignment physical address.\n"); in tw_setfeature()
1162 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_setfeature()
1164 tw_dev->srb[request_id]->result = (DID_OK << 16); in tw_setfeature()
1165 scsi_done(tw_dev->srb[request_id]); in tw_setfeature()
1167 command_packet->byte8.param.sgl[0].address = param_value; in tw_setfeature()
1168 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_setfeature()
1170 command_packet->size = 4; in tw_setfeature()
1171 command_packet->request_id = request_id; in tw_setfeature()
1172 command_packet->byte6.parameter_count = 1; in tw_setfeature()
1174 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_setfeature()
1176 printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad command packet physical address.\n"); in tw_setfeature()
1180 /* Send command packet to the board */ in tw_setfeature()
1190 printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Unexpected request id.\n"); in tw_setfeature()
1193 if (command_packet->status != 0) { in tw_setfeature()
1216 printk(KERN_WARNING "3w-xxxx: scsi%d: AEN drain failed, retrying.\n", tw_dev->host->host_no); in tw_reset_sequence()
1223 …printk(KERN_WARNING "3w-xxxx: scsi%d: Controller errors found, retrying.\n", tw_dev->host->host_no… in tw_reset_sequence()
1233 …printk(KERN_WARNING "3w-xxxx: scsi%d: Controller errors, card not responding, check all cabling.\n… in tw_reset_sequence()
1239 …printk(KERN_WARNING "3w-xxxx: scsi%d: Connection initialization failed.\n", tw_dev->host->host_no); in tw_reset_sequence()
1245 printk(KERN_WARNING "3w-xxxx: Unable to set features for card, probable old firmware or card.\n"); in tw_reset_sequence()
1256 dprintk(KERN_NOTICE "3w-xxxx: tw_initialize_device_extension()\n"); in tw_initialize_device_extension()
1258 /* Initialize command packet buffers */ in tw_initialize_device_extension()
1261 printk(KERN_WARNING "3w-xxxx: Command packet memory allocation failed.\n"); in tw_initialize_device_extension()
1268 printk(KERN_WARNING "3w-xxxx: Generic memory allocation failed.\n"); in tw_initialize_device_extension()
1273 tw_dev->free_queue[i] = i; in tw_initialize_device_extension()
1274 tw_dev->state[i] = TW_S_INITIAL; in tw_initialize_device_extension()
1277 tw_dev->pending_head = TW_Q_START; in tw_initialize_device_extension()
1278 tw_dev->pending_tail = TW_Q_START; in tw_initialize_device_extension()
1279 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; in tw_initialize_device_extension()
1281 mutex_init(&tw_dev->ioctl_lock); in tw_initialize_device_extension()
1282 init_waitqueue_head(&tw_dev->ioctl_wqueue); in tw_initialize_device_extension()
1294 dprintk(KERN_NOTICE "3w-xxxx: tw_reset_device_extension()\n"); in tw_reset_device_extension()
1296 set_bit(TW_IN_RESET, &tw_dev->flags); in tw_reset_device_extension()
1299 spin_lock_irqsave(tw_dev->host->host_lock, flags); in tw_reset_device_extension()
1303 if ((tw_dev->state[i] != TW_S_FINISHED) && in tw_reset_device_extension()
1304 (tw_dev->state[i] != TW_S_INITIAL) && in tw_reset_device_extension()
1305 (tw_dev->state[i] != TW_S_COMPLETED)) { in tw_reset_device_extension()
1306 srb = tw_dev->srb[i]; in tw_reset_device_extension()
1308 srb->result = (DID_RESET << 16); in tw_reset_device_extension()
1317 tw_dev->free_queue[i] = i; in tw_reset_device_extension()
1318 tw_dev->state[i] = TW_S_INITIAL; in tw_reset_device_extension()
1320 tw_dev->free_head = TW_Q_START; in tw_reset_device_extension()
1321 tw_dev->free_tail = TW_Q_START; in tw_reset_device_extension()
1322 tw_dev->posted_request_count = 0; in tw_reset_device_extension()
1323 tw_dev->pending_request_count = 0; in tw_reset_device_extension()
1324 tw_dev->pending_head = TW_Q_START; in tw_reset_device_extension()
1325 tw_dev->pending_tail = TW_Q_START; in tw_reset_device_extension()
1326 tw_dev->reset_print = 0; in tw_reset_device_extension()
1328 spin_unlock_irqrestore(tw_dev->host->host_lock, flags); in tw_reset_device_extension()
1331 printk(KERN_WARNING "3w-xxxx: scsi%d: Reset sequence failed.\n", tw_dev->host->host_no); in tw_reset_device_extension()
1336 clear_bit(TW_IN_RESET, &tw_dev->flags); in tw_reset_device_extension()
1337 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; in tw_reset_device_extension()
1348 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_biosparam()\n"); in tw_scsi_biosparam()
1360 …dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_biosparam(): heads = %d, sectors = %d, cylinders = %d\n", he… in tw_scsi_biosparam()
1374 tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; in tw_scsi_eh_reset()
1376 tw_dev->num_resets++; in tw_scsi_eh_reset()
1378 sdev_printk(KERN_WARNING, SCpnt->device, in tw_scsi_eh_reset()
1379 "WARNING: Command (0x%x) timed out, resetting card.\n", in tw_scsi_eh_reset()
1380 SCpnt->cmnd[0]); in tw_scsi_eh_reset()
1383 mutex_lock(&tw_dev->ioctl_lock); in tw_scsi_eh_reset()
1387 printk(KERN_WARNING "3w-xxxx: scsi%d: Reset failed.\n", tw_dev->host->host_no); in tw_scsi_eh_reset()
1393 mutex_unlock(&tw_dev->ioctl_lock); in tw_scsi_eh_reset()
1405 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_inquiry()\n"); in tw_scsiop_inquiry()
1407 /* Initialize command packet */ in tw_scsiop_inquiry()
1408 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_inquiry()
1410 printk(KERN_WARNING "3w-xxxx: tw_scsiop_inquiry(): Bad command packet virtual address.\n"); in tw_scsiop_inquiry()
1414 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_scsiop_inquiry()
1415 command_packet->size = 4; in tw_scsiop_inquiry()
1416 command_packet->request_id = request_id; in tw_scsiop_inquiry()
1417 command_packet->status = 0; in tw_scsiop_inquiry()
1418 command_packet->flags = 0; in tw_scsiop_inquiry()
1419 command_packet->byte6.parameter_count = 1; in tw_scsiop_inquiry()
1422 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_scsiop_inquiry()
1423 printk(KERN_WARNING "3w-xxxx: tw_scsiop_inquiry(): Bad alignment virtual address.\n"); in tw_scsiop_inquiry()
1426 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_inquiry()
1428 param->table_id = 3; /* unit summary table */ in tw_scsiop_inquiry()
1429 param->parameter_id = 3; /* unitsstatus parameter */ in tw_scsiop_inquiry()
1430 param->parameter_size_bytes = TW_MAX_UNITS; in tw_scsiop_inquiry()
1431 param_value = tw_dev->alignment_physical_address[request_id]; in tw_scsiop_inquiry()
1433 printk(KERN_WARNING "3w-xxxx: tw_scsiop_inquiry(): Bad alignment physical address.\n"); in tw_scsiop_inquiry()
1437 command_packet->byte8.param.sgl[0].address = param_value; in tw_scsiop_inquiry()
1438 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_scsiop_inquiry()
1439 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_inquiry()
1441 printk(KERN_WARNING "3w-xxxx: tw_scsiop_inquiry(): Bad command packet physical address.\n"); in tw_scsiop_inquiry()
1445 /* Now try to post the command packet */ in tw_scsiop_inquiry()
1454 scsi_sg_copy_from_buffer(tw_dev->srb[request_id], data, len); in tw_transfer_internal()
1457 /* This function is called by the isr to complete an inquiry command */
1464 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_inquiry_complete()\n"); in tw_scsiop_inquiry_complete()
1472 sprintf(&request_buffer[16], "Logical Disk %-2d ", tw_dev->srb[request_id]->device->id); in tw_scsiop_inquiry_complete()
1477 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_inquiry_complete()
1479 printk(KERN_WARNING "3w-xxxx: tw_scsiop_inquiry_complete(): Bad alignment virtual address.\n"); in tw_scsiop_inquiry_complete()
1482 is_unit_present = &(param->data[0]); in tw_scsiop_inquiry_complete()
1484 if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) { in tw_scsiop_inquiry_complete()
1485 tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1; in tw_scsiop_inquiry_complete()
1487 tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0; in tw_scsiop_inquiry_complete()
1488 tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16); in tw_scsiop_inquiry_complete()
1503 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_mode_sense()\n"); in tw_scsiop_mode_sense()
1506 if (tw_dev->srb[request_id]->cmnd[2] != 0x8) { in tw_scsiop_mode_sense()
1507 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_scsiop_mode_sense()
1509 tw_dev->srb[request_id]->result = (DID_OK << 16); in tw_scsiop_mode_sense()
1510 scsi_done(tw_dev->srb[request_id]); in tw_scsiop_mode_sense()
1515 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_mode_sense()
1517 printk(KERN_WARNING "3w-xxxx: tw_scsiop_mode_sense(): Bad command packet virtual address.\n"); in tw_scsiop_mode_sense()
1521 /* Setup the command packet */ in tw_scsiop_mode_sense()
1523 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_scsiop_mode_sense()
1524 command_packet->size = 4; in tw_scsiop_mode_sense()
1525 command_packet->request_id = request_id; in tw_scsiop_mode_sense()
1526 command_packet->status = 0; in tw_scsiop_mode_sense()
1527 command_packet->flags = 0; in tw_scsiop_mode_sense()
1528 command_packet->byte6.parameter_count = 1; in tw_scsiop_mode_sense()
1531 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_scsiop_mode_sense()
1532 printk(KERN_WARNING "3w-xxxx: tw_scsiop_mode_sense(): Bad alignment virtual address.\n"); in tw_scsiop_mode_sense()
1536 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_mode_sense()
1538 param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + tw_dev->srb[request_id]->device->id; in tw_scsiop_mode_sense()
1539 param->parameter_id = 7; /* unit flags */ in tw_scsiop_mode_sense()
1540 param->parameter_size_bytes = 1; in tw_scsiop_mode_sense()
1541 param_value = tw_dev->alignment_physical_address[request_id]; in tw_scsiop_mode_sense()
1543 printk(KERN_WARNING "3w-xxxx: tw_scsiop_mode_sense(): Bad alignment physical address.\n"); in tw_scsiop_mode_sense()
1547 command_packet->byte8.param.sgl[0].address = param_value; in tw_scsiop_mode_sense()
1548 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_scsiop_mode_sense()
1549 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_mode_sense()
1551 printk(KERN_WARNING "3w-xxxx: tw_scsiop_mode_sense(): Bad command packet physical address.\n"); in tw_scsiop_mode_sense()
1555 /* Now try to post the command packet */ in tw_scsiop_mode_sense()
1561 /* This function is called by the isr to complete a mode sense command */
1568 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_mode_sense_complete()\n"); in tw_scsiop_mode_sense_complete()
1570 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_mode_sense_complete()
1572 printk(KERN_WARNING "3w-xxxx: tw_scsiop_mode_sense_complete(): Bad alignment virtual address.\n"); in tw_scsiop_mode_sense_complete()
1575 flags = (char *)&(param->data[0]); in tw_scsiop_mode_sense_complete()
1602 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity()\n"); in tw_scsiop_read_capacity()
1604 /* Initialize command packet */ in tw_scsiop_read_capacity()
1605 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_read_capacity()
1608 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity(): Bad command packet virtual address.\n"); in tw_scsiop_read_capacity()
1612 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_scsiop_read_capacity()
1613 command_packet->size = 4; in tw_scsiop_read_capacity()
1614 command_packet->request_id = request_id; in tw_scsiop_read_capacity()
1615 command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); in tw_scsiop_read_capacity()
1616 command_packet->status = 0; in tw_scsiop_read_capacity()
1617 command_packet->flags = 0; in tw_scsiop_read_capacity()
1618 command_packet->byte6.block_count = 1; in tw_scsiop_read_capacity()
1621 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_scsiop_read_capacity()
1622 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity(): Bad alignment virtual address.\n"); in tw_scsiop_read_capacity()
1625 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_read_capacity()
1627 param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + in tw_scsiop_read_capacity()
1628 tw_dev->srb[request_id]->device->id; in tw_scsiop_read_capacity()
1629 param->parameter_id = 4; /* unitcapacity parameter */ in tw_scsiop_read_capacity()
1630 param->parameter_size_bytes = 4; in tw_scsiop_read_capacity()
1631 param_value = tw_dev->alignment_physical_address[request_id]; in tw_scsiop_read_capacity()
1633 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity(): Bad alignment physical address.\n"); in tw_scsiop_read_capacity()
1637 command_packet->byte8.param.sgl[0].address = param_value; in tw_scsiop_read_capacity()
1638 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_scsiop_read_capacity()
1639 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_read_capacity()
1641 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity(): Bad command packet physical address.\n"); in tw_scsiop_read_capacity()
1645 /* Now try to post the command to the board */ in tw_scsiop_read_capacity()
1651 /* This function is called by the isr to complete a readcapacity command */
1659 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity_complete()\n"); in tw_scsiop_read_capacity_complete()
1662 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_read_capacity_complete()
1664 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_read_capacity_complete(): Bad alignment virtual address.\n… in tw_scsiop_read_capacity_complete()
1667 param_data = &(param->data[0]); in tw_scsiop_read_capacity_complete()
1673 capacity -= 1; in tw_scsiop_read_capacity_complete()
1675 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity_complete(): Capacity = 0x%x.\n", capacity); in tw_scsiop_read_capacity_complete()
1704 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_write()\n"); in tw_scsiop_read_write()
1706 srb = tw_dev->srb[request_id]; in tw_scsiop_read_write()
1710 printk(KERN_WARNING "3w-xxxx: tw_scsiop_read_write(): Request buffer NULL.\n"); in tw_scsiop_read_write()
1714 /* Initialize command packet */ in tw_scsiop_read_write()
1715 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_read_write()
1717 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_write(): Bad command packet virtual address.\n"); in tw_scsiop_read_write()
1721 if (srb->cmnd[0] == READ_6 || srb->cmnd[0] == READ_10) { in tw_scsiop_read_write()
1722 command_packet->opcode__sgloffset = TW_OPSGL_IN(3, TW_OP_READ); in tw_scsiop_read_write()
1724 command_packet->opcode__sgloffset = TW_OPSGL_IN(3, TW_OP_WRITE); in tw_scsiop_read_write()
1727 command_packet->size = 3; in tw_scsiop_read_write()
1728 command_packet->request_id = request_id; in tw_scsiop_read_write()
1729 command_packet->unit__hostid = TW_UNITHOST_IN(0, srb->device->id); in tw_scsiop_read_write()
1730 command_packet->status = 0; in tw_scsiop_read_write()
1731 command_packet->flags = 0; in tw_scsiop_read_write()
1733 if (srb->cmnd[0] == WRITE_10) { in tw_scsiop_read_write()
1734 if ((srb->cmnd[1] & 0x8) || (srb->cmnd[1] & 0x10)) in tw_scsiop_read_write()
1735 command_packet->flags = 1; in tw_scsiop_read_write()
1738 if (srb->cmnd[0] == READ_6 || srb->cmnd[0] == WRITE_6) { in tw_scsiop_read_write()
1739 lba = ((u32)srb->cmnd[1] << 16) | ((u32)srb->cmnd[2] << 8) | (u32)srb->cmnd[3]; in tw_scsiop_read_write()
1740 num_sectors = (u32)srb->cmnd[4]; in tw_scsiop_read_write()
1742 …lba = ((u32)srb->cmnd[2] << 24) | ((u32)srb->cmnd[3] << 16) | ((u32)srb->cmnd[4] << 8) | (u32)srb- in tw_scsiop_read_write()
1743 num_sectors = (u32)srb->cmnd[8] | ((u32)srb->cmnd[7] << 8); in tw_scsiop_read_write()
1747 tw_dev->sector_count = num_sectors; in tw_scsiop_read_write()
1748 if (tw_dev->sector_count > tw_dev->max_sector_count) in tw_scsiop_read_write()
1749 tw_dev->max_sector_count = tw_dev->sector_count; in tw_scsiop_read_write()
1751 …dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_read_write(): lba = 0x%x num_sectors = 0x%x\n", lba, num_s… in tw_scsiop_read_write()
1752 command_packet->byte8.io.lba = lba; in tw_scsiop_read_write()
1753 command_packet->byte6.block_count = num_sectors; in tw_scsiop_read_write()
1759 scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) { in tw_scsiop_read_write()
1760 command_packet->byte8.io.sgl[i].address = sg_dma_address(sg); in tw_scsiop_read_write()
1761 command_packet->byte8.io.sgl[i].length = sg_dma_len(sg); in tw_scsiop_read_write()
1762 command_packet->size+=2; in tw_scsiop_read_write()
1766 tw_dev->sgl_entries = scsi_sg_count(tw_dev->srb[request_id]); in tw_scsiop_read_write()
1767 if (tw_dev->sgl_entries > tw_dev->max_sgl_entries) in tw_scsiop_read_write()
1768 tw_dev->max_sgl_entries = tw_dev->sgl_entries; in tw_scsiop_read_write()
1770 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_read_write()
1772 dprintk(KERN_WARNING "3w-xxxx: tw_scsiop_read_write(): Bad command packet physical address.\n"); in tw_scsiop_read_write()
1776 /* Now try to post the command to the board */ in tw_scsiop_read_write()
1782 /* This function will handle the request sense scsi command */
1787 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_request_sense()\n"); in tw_scsiop_request_sense()
1796 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_scsiop_request_sense()
1800 tw_dev->srb[request_id]->result = (DID_ERROR << 16); in tw_scsiop_request_sense()
1801 scsi_done(tw_dev->srb[request_id]); in tw_scsiop_request_sense()
1806 /* This function will handle synchronize cache scsi command */
1812 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_synchronize_cache()\n"); in tw_scsiop_synchronize_cache()
1814 /* Send firmware flush command for this unit */ in tw_scsiop_synchronize_cache()
1815 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_synchronize_cache()
1817 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_synchronize_cache(): Bad command packet virtual address.\n… in tw_scsiop_synchronize_cache()
1821 /* Setup the command packet */ in tw_scsiop_synchronize_cache()
1823 command_packet->opcode__sgloffset = TW_OPSGL_IN(0, TW_OP_FLUSH_CACHE); in tw_scsiop_synchronize_cache()
1824 command_packet->size = 2; in tw_scsiop_synchronize_cache()
1825 command_packet->request_id = request_id; in tw_scsiop_synchronize_cache()
1826 command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); in tw_scsiop_synchronize_cache()
1827 command_packet->status = 0; in tw_scsiop_synchronize_cache()
1828 command_packet->flags = 0; in tw_scsiop_synchronize_cache()
1829 command_packet->byte6.parameter_count = 1; in tw_scsiop_synchronize_cache()
1830 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_synchronize_cache()
1832 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_synchronize_cache(): Bad command packet physical address.\… in tw_scsiop_synchronize_cache()
1836 /* Now try to post the command packet */ in tw_scsiop_synchronize_cache()
1842 /* This function will handle test unit ready scsi command */
1850 dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_test_unit_ready()\n"); in tw_scsiop_test_unit_ready()
1852 /* Initialize command packet */ in tw_scsiop_test_unit_ready()
1853 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in tw_scsiop_test_unit_ready()
1855 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready(): Bad command packet virtual address.\n"); in tw_scsiop_test_unit_ready()
1859 command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); in tw_scsiop_test_unit_ready()
1860 command_packet->size = 4; in tw_scsiop_test_unit_ready()
1861 command_packet->request_id = request_id; in tw_scsiop_test_unit_ready()
1862 command_packet->status = 0; in tw_scsiop_test_unit_ready()
1863 command_packet->flags = 0; in tw_scsiop_test_unit_ready()
1864 command_packet->byte6.parameter_count = 1; in tw_scsiop_test_unit_ready()
1867 if (tw_dev->alignment_virtual_address[request_id] == NULL) { in tw_scsiop_test_unit_ready()
1868 printk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready(): Bad alignment virtual address.\n"); in tw_scsiop_test_unit_ready()
1871 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_test_unit_ready()
1873 param->table_id = 3; /* unit summary table */ in tw_scsiop_test_unit_ready()
1874 param->parameter_id = 3; /* unitsstatus parameter */ in tw_scsiop_test_unit_ready()
1875 param->parameter_size_bytes = TW_MAX_UNITS; in tw_scsiop_test_unit_ready()
1876 param_value = tw_dev->alignment_physical_address[request_id]; in tw_scsiop_test_unit_ready()
1878 printk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready(): Bad alignment physical address.\n"); in tw_scsiop_test_unit_ready()
1882 command_packet->byte8.param.sgl[0].address = param_value; in tw_scsiop_test_unit_ready()
1883 command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector); in tw_scsiop_test_unit_ready()
1884 command_que_value = tw_dev->command_packet_physical_address[request_id]; in tw_scsiop_test_unit_ready()
1886 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready(): Bad command packet physical address.\n"… in tw_scsiop_test_unit_ready()
1890 /* Now try to post the command packet */ in tw_scsiop_test_unit_ready()
1896 /* This function is called by the isr to complete a testunitready command */
1902 dprintk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready_complete()\n"); in tw_scsiop_test_unit_ready_complete()
1904 param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; in tw_scsiop_test_unit_ready_complete()
1906 …printk(KERN_WARNING "3w-xxxx: tw_scsiop_test_unit_ready_complete(): Bad alignment virtual address.… in tw_scsiop_test_unit_ready_complete()
1909 is_unit_present = &(param->data[0]); in tw_scsiop_test_unit_ready_complete()
1911 if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) { in tw_scsiop_test_unit_ready_complete()
1912 tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1; in tw_scsiop_test_unit_ready_complete()
1914 tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0; in tw_scsiop_test_unit_ready_complete()
1915 tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16); in tw_scsiop_test_unit_ready_complete()
1926 unsigned char *command = SCpnt->cmnd; in tw_scsi_queue_lck() local
1929 TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; in tw_scsi_queue_lck()
1932 if (test_bit(TW_IN_RESET, &tw_dev->flags)) in tw_scsi_queue_lck()
1935 /* Queue the command and get a request id */ in tw_scsi_queue_lck()
1938 /* Save the scsi command for use by the ISR */ in tw_scsi_queue_lck()
1939 tw_dev->srb[request_id] = SCpnt; in tw_scsi_queue_lck()
1941 switch (*command) { in tw_scsi_queue_lck()
1946 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ/WRITE.\n"); in tw_scsi_queue_lck()
1950 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught TEST_UNIT_READY.\n"); in tw_scsi_queue_lck()
1954 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught INQUIRY.\n"); in tw_scsi_queue_lck()
1958 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ_CAPACITY.\n"); in tw_scsi_queue_lck()
1962 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught REQUEST_SENSE.\n"); in tw_scsi_queue_lck()
1966 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught MODE_SENSE.\n"); in tw_scsi_queue_lck()
1970 dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught SYNCHRONIZE_CACHE.\n"); in tw_scsi_queue_lck()
1974 …printk(KERN_WARNING "3w-xxxx: SCSI_IOCTL_SEND_COMMAND deprecated, please update your 3ware tools.\… in tw_scsi_queue_lck()
1977 …printk(KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n", tw_dev->host->host_no, *command in tw_scsi_queue_lck()
1978 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_scsi_queue_lck()
1985 tw_dev->state[request_id] = TW_S_COMPLETED; in tw_scsi_queue_lck()
1987 SCpnt->result = (DID_ERROR << 16); in tw_scsi_queue_lck()
2007 /* Get the host lock for io completions */ in DEF_SCSI_QCMD()
2008 spin_lock(tw_dev->host->host_lock); in DEF_SCSI_QCMD()
2020 if (test_bit(TW_IN_RESET, &tw_dev->flags)) in DEF_SCSI_QCMD()
2025 dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); in DEF_SCSI_QCMD()
2032 /* Handle host interrupt */ in DEF_SCSI_QCMD()
2034 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received host interrupt.\n"); in DEF_SCSI_QCMD()
2040 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received attention interrupt.\n"); in DEF_SCSI_QCMD()
2045 printk(KERN_WARNING "3w-xxxx: scsi%d: Error reading aen queue.\n", tw_dev->host->host_no); in DEF_SCSI_QCMD()
2046 tw_dev->state[request_id] = TW_S_COMPLETED; in DEF_SCSI_QCMD()
2051 /* Handle command interrupt */ in DEF_SCSI_QCMD()
2054 while (tw_dev->pending_request_count > 0) { in DEF_SCSI_QCMD()
2055 request_id = tw_dev->pending_queue[tw_dev->pending_head]; in DEF_SCSI_QCMD()
2056 if (tw_dev->state[request_id] != TW_S_PENDING) { in DEF_SCSI_QCMD()
2057 …printk(KERN_WARNING "3w-xxxx: scsi%d: Found request id that wasn't pending.\n", tw_dev->host->host… in DEF_SCSI_QCMD()
2061 if (tw_dev->pending_head == TW_Q_LENGTH-1) { in DEF_SCSI_QCMD()
2062 tw_dev->pending_head = TW_Q_START; in DEF_SCSI_QCMD()
2064 tw_dev->pending_head = tw_dev->pending_head + 1; in DEF_SCSI_QCMD()
2066 tw_dev->pending_request_count--; in DEF_SCSI_QCMD()
2068 /* If we get here, we will continue re-posting on the next command interrupt */ in DEF_SCSI_QCMD()
2072 /* If there are no more pending requests, we mask command interrupt */ in DEF_SCSI_QCMD()
2073 if (tw_dev->pending_request_count == 0) in DEF_SCSI_QCMD()
2084 command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; in DEF_SCSI_QCMD()
2088 if (command_packet->status != 0) { in DEF_SCSI_QCMD()
2089 /* If internal command, don't error, don't fill sense */ in DEF_SCSI_QCMD()
2090 if (tw_dev->srb[request_id] == NULL) { in DEF_SCSI_QCMD()
2098 if (tw_dev->state[request_id] != TW_S_POSTED) { in DEF_SCSI_QCMD()
2099 if (tw_dev->srb[request_id] != NULL) { in DEF_SCSI_QCMD()
2100 …printk(KERN_WARNING "3w-xxxx: scsi%d: Received a request id that wasn't posted.\n", tw_dev->host->… in DEF_SCSI_QCMD()
2105 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Response queue request id: %d.\n", request_id); in DEF_SCSI_QCMD()
2107 /* Check for internal command completion */ in DEF_SCSI_QCMD()
2108 if (tw_dev->srb[request_id] == NULL) { in DEF_SCSI_QCMD()
2109 dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Found internally posted command.\n"); in DEF_SCSI_QCMD()
2111 if (request_id != tw_dev->chrdev_request_id) { in DEF_SCSI_QCMD()
2114 printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing aen.\n", tw_dev->host->host_no); in DEF_SCSI_QCMD()
2117 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; in DEF_SCSI_QCMD()
2118 wake_up(&tw_dev->ioctl_wqueue); in DEF_SCSI_QCMD()
2121 switch (tw_dev->srb[request_id]->cmnd[0]) { in DEF_SCSI_QCMD()
2124 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_10/READ_6\n"); in DEF_SCSI_QCMD()
2128 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught WRITE_10/WRITE_6\n"); in DEF_SCSI_QCMD()
2131 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught TEST_UNIT_READY\n"); in DEF_SCSI_QCMD()
2135 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught INQUIRY\n"); in DEF_SCSI_QCMD()
2139 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_CAPACITY\n"); in DEF_SCSI_QCMD()
2143 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught MODE_SENSE\n"); in DEF_SCSI_QCMD()
2147 dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught SYNCHRONIZE_CACHE\n"); in DEF_SCSI_QCMD()
2150 printk(KERN_WARNING "3w-xxxx: case slip in tw_interrupt()\n"); in DEF_SCSI_QCMD()
2154 /* If no error command was a success */ in DEF_SCSI_QCMD()
2156 tw_dev->srb[request_id]->result = (DID_OK << 16); in DEF_SCSI_QCMD()
2159 /* If error, command failed */ in DEF_SCSI_QCMD()
2161 /* Ask for a host reset */ in DEF_SCSI_QCMD()
2162 tw_dev->srb[request_id]->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; in DEF_SCSI_QCMD()
2167 scsi_dma_unmap(tw_dev->srb[request_id]); in DEF_SCSI_QCMD()
2168 scsi_done(tw_dev->srb[request_id]); in DEF_SCSI_QCMD()
2169 tw_dev->state[request_id] = TW_S_COMPLETED; in DEF_SCSI_QCMD()
2171 tw_dev->posted_request_count--; in DEF_SCSI_QCMD()
2178 dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); in DEF_SCSI_QCMD()
2188 spin_unlock(tw_dev->host->host_lock); in DEF_SCSI_QCMD()
2199 free_irq(tw_dev->tw_pci_dev->irq, tw_dev); in __tw_shutdown()
2201 printk(KERN_WARNING "3w-xxxx: Shutting down host %d.\n", tw_dev->host->host_no); in __tw_shutdown()
2205 printk(KERN_WARNING "3w-xxxx: Connection shutdown failed.\n"); in __tw_shutdown()
2207 printk(KERN_WARNING "3w-xxxx: Shutdown complete.\n"); in __tw_shutdown()
2217 struct Scsi_Host *host = pci_get_drvdata(pdev); in tw_shutdown() local
2218 TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; in tw_shutdown()
2227 blk_queue_rq_timeout(sdev->request_queue, 60 * HZ); in tw_slave_configure()
2239 .can_queue = TW_Q_LENGTH-2,
2241 .this_id = -1,
2253 struct Scsi_Host *host = NULL; in tw_probe() local
2259 printk(KERN_WARNING "3w-xxxx: Failed to enable pci device."); in tw_probe()
2265 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in tw_probe()
2267 printk(KERN_WARNING "3w-xxxx: Failed to set dma mask."); in tw_probe()
2271 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension)); in tw_probe()
2272 if (!host) { in tw_probe()
2273 printk(KERN_WARNING "3w-xxxx: Failed to allocate memory for device extension."); in tw_probe()
2274 retval = -ENOMEM; in tw_probe()
2277 tw_dev = (TW_Device_Extension *)host->hostdata; in tw_probe()
2280 tw_dev->host = host; in tw_probe()
2281 tw_dev->tw_pci_dev = pdev; in tw_probe()
2284 printk(KERN_WARNING "3w-xxxx: Failed to initialize device extension."); in tw_probe()
2285 retval = -ENOMEM; in tw_probe()
2290 retval = pci_request_regions(pdev, "3w-xxxx"); in tw_probe()
2292 printk(KERN_WARNING "3w-xxxx: Failed to get mem region."); in tw_probe()
2297 tw_dev->base_addr = pci_resource_start(pdev, 0); in tw_probe()
2298 if (!tw_dev->base_addr) { in tw_probe()
2299 printk(KERN_WARNING "3w-xxxx: Failed to get io address."); in tw_probe()
2300 retval = -ENOMEM; in tw_probe()
2309 retval = -EINVAL; in tw_probe()
2313 /* Set host specific parameters */ in tw_probe()
2314 host->max_id = TW_MAX_UNITS; in tw_probe()
2315 host->max_cmd_len = TW_MAX_CDB_LEN; in tw_probe()
2318 host->max_lun = 0; in tw_probe()
2319 host->max_channel = 0; in tw_probe()
2322 retval = scsi_add_host(host, &pdev->dev); in tw_probe()
2324 printk(KERN_WARNING "3w-xxxx: scsi add host failed"); in tw_probe()
2328 pci_set_drvdata(pdev, host); in tw_probe()
2330 …rintk(KERN_WARNING "3w-xxxx: scsi%d: Found a 3ware Storage Controller at 0x%x, IRQ: %d.\n", host->… in tw_probe()
2333 retval = request_irq(pdev->irq, tw_interrupt, IRQF_SHARED, "3w-xxxx", tw_dev); in tw_probe()
2335 printk(KERN_WARNING "3w-xxxx: Error requesting IRQ."); in tw_probe()
2342 /* Re-enable interrupts on the card */ in tw_probe()
2345 /* Finally, scan the host */ in tw_probe()
2346 scsi_scan_host(host); in tw_probe()
2348 if (twe_major == -1) { in tw_probe()
2350 printk(KERN_WARNING "3w-xxxx: Failed to register character device."); in tw_probe()
2355 scsi_remove_host(host); in tw_probe()
2360 scsi_host_put(host); in tw_probe()
2370 struct Scsi_Host *host = pci_get_drvdata(pdev); in tw_remove() local
2371 TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; in tw_remove()
2373 scsi_remove_host(tw_dev->host); in tw_remove()
2378 twe_major = -1; in tw_remove()
2390 scsi_host_put(tw_dev->host); in tw_remove()
2392 tw_device_extension_count--; in tw_remove()
2407 .name = "3w-xxxx",