tw_dev 121 drivers/scsi/3w-9xxx.c static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Header *header); tw_dev 122 drivers/scsi/3w-9xxx.c static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); tw_dev 124 drivers/scsi/3w-9xxx.c static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id); tw_dev 127 drivers/scsi/3w-9xxx.c static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host); tw_dev 128 drivers/scsi/3w-9xxx.c static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id); tw_dev 129 drivers/scsi/3w-9xxx.c static void twa_get_request_id(TW_Device_Extension *tw_dev, int *request_id); tw_dev 130 drivers/scsi/3w-9xxx.c static int twa_initconnection(TW_Device_Extension *tw_dev, int message_credits, tw_dev 140 drivers/scsi/3w-9xxx.c static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length); tw_dev 141 drivers/scsi/3w-9xxx.c static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds); tw_dev 142 drivers/scsi/3w-9xxx.c static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int seconds); tw_dev 143 drivers/scsi/3w-9xxx.c static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal); tw_dev 144 drivers/scsi/3w-9xxx.c static int twa_reset_device_extension(TW_Device_Extension *tw_dev); tw_dev 145 drivers/scsi/3w-9xxx.c static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset); tw_dev 146 drivers/scsi/3w-9xxx.c static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, tw_dev 149 drivers/scsi/3w-9xxx.c static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id); tw_dev 159 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 163 drivers/scsi/3w-9xxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 176 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count, tw_dev 177 drivers/scsi/3w-9xxx.c tw_dev->max_posted_request_count, tw_dev 178 drivers/scsi/3w-9xxx.c tw_dev->pending_request_count, tw_dev 179 drivers/scsi/3w-9xxx.c tw_dev->max_pending_request_count, tw_dev 180 drivers/scsi/3w-9xxx.c tw_dev->sgl_entries, tw_dev 181 drivers/scsi/3w-9xxx.c tw_dev->max_sgl_entries, tw_dev 182 drivers/scsi/3w-9xxx.c tw_dev->sector_count, tw_dev 183 drivers/scsi/3w-9xxx.c tw_dev->max_sector_count, tw_dev 184 drivers/scsi/3w-9xxx.c tw_dev->num_resets, tw_dev 185 drivers/scsi/3w-9xxx.c tw_dev->aen_count); tw_dev 186 drivers/scsi/3w-9xxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 226 drivers/scsi/3w-9xxx.c static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 234 drivers/scsi/3w-9xxx.c header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; tw_dev 235 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 237 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 243 drivers/scsi/3w-9xxx.c if (twa_aen_read_queue(tw_dev, request_id)) tw_dev 256 drivers/scsi/3w-9xxx.c twa_aen_sync_time(tw_dev, request_id); tw_dev 260 drivers/scsi/3w-9xxx.c twa_aen_queue_event(tw_dev, header); tw_dev 263 drivers/scsi/3w-9xxx.c if (twa_aen_read_queue(tw_dev, request_id)) tw_dev 272 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 273 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 274 drivers/scsi/3w-9xxx.c clear_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags); tw_dev 280 drivers/scsi/3w-9xxx.c static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset) tw_dev 296 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 307 drivers/scsi/3w-9xxx.c sglist[0].address = tw_dev->generic_buffer_phys[request_id]; tw_dev 310 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1, "Found unaligned address during AEN drain"); tw_dev 315 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id] = NULL; tw_dev 319 drivers/scsi/3w-9xxx.c if (twa_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { tw_dev 320 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2, "Error posting request sense"); tw_dev 325 drivers/scsi/3w-9xxx.c if (twa_poll_response(tw_dev, request_id, 30)) { tw_dev 326 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x3, "No valid response while draining AEN queue"); tw_dev 327 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 331 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 332 drivers/scsi/3w-9xxx.c header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; tw_dev 358 drivers/scsi/3w-9xxx.c twa_aen_queue_event(tw_dev, header); tw_dev 366 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 371 drivers/scsi/3w-9xxx.c static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Header *header) tw_dev 379 drivers/scsi/3w-9xxx.c tw_dev->aen_count++; tw_dev 382 drivers/scsi/3w-9xxx.c event = tw_dev->event_queue[tw_dev->error_index]; tw_dev 386 drivers/scsi/3w-9xxx.c if (tw_dev->host) { tw_dev 387 drivers/scsi/3w-9xxx.c sprintf(host, " scsi%d:", tw_dev->host->host_no); tw_dev 389 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 1; tw_dev 401 drivers/scsi/3w-9xxx.c event->sequence_id = tw_dev->error_sequence_id; tw_dev 402 drivers/scsi/3w-9xxx.c tw_dev->error_sequence_id++; tw_dev 418 drivers/scsi/3w-9xxx.c tw_dev->aen_count--; tw_dev 420 drivers/scsi/3w-9xxx.c if ((tw_dev->error_index + 1) == TW_Q_LENGTH) tw_dev 421 drivers/scsi/3w-9xxx.c tw_dev->event_queue_wrapped = 1; tw_dev 422 drivers/scsi/3w-9xxx.c tw_dev->error_index = (tw_dev->error_index + 1 ) % TW_Q_LENGTH; tw_dev 426 drivers/scsi/3w-9xxx.c static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) tw_dev 433 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 444 drivers/scsi/3w-9xxx.c sglist[0].address = tw_dev->generic_buffer_phys[request_id]; tw_dev 447 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id] = NULL; tw_dev 450 drivers/scsi/3w-9xxx.c if (twa_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { tw_dev 451 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x4, "Post failed while reading AEN queue"); tw_dev 474 drivers/scsi/3w-9xxx.c static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) tw_dev 483 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 488 drivers/scsi/3w-9xxx.c command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); tw_dev 494 drivers/scsi/3w-9xxx.c param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; tw_dev 509 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id] = NULL; tw_dev 512 drivers/scsi/3w-9xxx.c twa_post_command_packet(tw_dev, request_id, 1); tw_dev 516 drivers/scsi/3w-9xxx.c static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) tw_dev 523 drivers/scsi/3w-9xxx.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 526 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); tw_dev 531 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x6, "Failed to allocate correctly aligned memory"); tw_dev 532 drivers/scsi/3w-9xxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, tw_dev 542 drivers/scsi/3w-9xxx.c tw_dev->command_packet_phys[i] = dma_handle+(i*size); tw_dev 543 drivers/scsi/3w-9xxx.c tw_dev->command_packet_virt[i] = (TW_Command_Full *)((unsigned char *)cpu_addr + (i*size)); tw_dev 546 drivers/scsi/3w-9xxx.c tw_dev->generic_buffer_phys[i] = dma_handle+(i*size); tw_dev 547 drivers/scsi/3w-9xxx.c tw_dev->generic_buffer_virt[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)); tw_dev 572 drivers/scsi/3w-9xxx.c static int twa_check_srl(TW_Device_Extension *tw_dev, int *flashed) tw_dev 579 drivers/scsi/3w-9xxx.c if (twa_initconnection(tw_dev, TW_INIT_MESSAGE_CREDITS, tw_dev 585 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x7, "Initconnection failed while checking SRL"); tw_dev 589 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_srl = fw_on_ctlr_srl; tw_dev 590 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_branch = fw_on_ctlr_branch; tw_dev 591 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_build = fw_on_ctlr_build; tw_dev 595 drivers/scsi/3w-9xxx.c if (twa_initconnection(tw_dev, TW_INIT_MESSAGE_CREDITS, tw_dev 602 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xa, "Initconnection (base mode) failed while checking SRL"); tw_dev 607 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x32, "Firmware and driver incompatibility: please upgrade firmware"); tw_dev 609 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x33, "Firmware and driver incompatibility: please upgrade driver"); tw_dev 613 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_srl = TW_BASE_FW_SRL; tw_dev 614 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_branch = TW_BASE_FW_BRANCH; tw_dev 615 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.working_build = TW_BASE_FW_BUILD; tw_dev 619 drivers/scsi/3w-9xxx.c strlcpy(tw_dev->tw_compat_info.driver_version, TW_DRIVER_VERSION, tw_dev 620 drivers/scsi/3w-9xxx.c sizeof(tw_dev->tw_compat_info.driver_version)); tw_dev 621 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_srl_high = TW_CURRENT_DRIVER_SRL; tw_dev 622 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_branch_high = TW_CURRENT_DRIVER_BRANCH; tw_dev 623 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_build_high = TW_CURRENT_DRIVER_BUILD; tw_dev 624 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_srl_low = TW_BASE_FW_SRL; tw_dev 625 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_branch_low = TW_BASE_FW_BRANCH; tw_dev 626 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.driver_build_low = TW_BASE_FW_BUILD; tw_dev 627 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.fw_on_ctlr_srl = fw_on_ctlr_srl; tw_dev 628 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.fw_on_ctlr_branch = fw_on_ctlr_branch; tw_dev 629 drivers/scsi/3w-9xxx.c tw_dev->tw_compat_info.fw_on_ctlr_build = fw_on_ctlr_build; tw_dev 653 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = twa_device_extension_list[iminor(inode)]; tw_dev 660 drivers/scsi/3w-9xxx.c if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { tw_dev 679 drivers/scsi/3w-9xxx.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, &dma_handle, GFP_KERNEL); tw_dev 694 drivers/scsi/3w-9xxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 695 drivers/scsi/3w-9xxx.c twa_get_request_id(tw_dev, &request_id); tw_dev 698 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id] = NULL; tw_dev 701 drivers/scsi/3w-9xxx.c tw_dev->chrdev_request_id = request_id; tw_dev 706 drivers/scsi/3w-9xxx.c twa_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted); tw_dev 708 drivers/scsi/3w-9xxx.c memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_Full)); tw_dev 711 drivers/scsi/3w-9xxx.c twa_post_command_packet(tw_dev, request_id, 1); tw_dev 712 drivers/scsi/3w-9xxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 717 drivers/scsi/3w-9xxx.c timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); tw_dev 720 drivers/scsi/3w-9xxx.c if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { tw_dev 723 drivers/scsi/3w-9xxx.c tw_dev->host->host_no, TW_DRIVER, 0x37, tw_dev 726 drivers/scsi/3w-9xxx.c twa_reset_device_extension(tw_dev); tw_dev 731 drivers/scsi/3w-9xxx.c memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_Full)); tw_dev 734 drivers/scsi/3w-9xxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 735 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 736 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 737 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 738 drivers/scsi/3w-9xxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 744 drivers/scsi/3w-9xxx.c memcpy(tw_compat_info, &tw_dev->tw_compat_info, sizeof(TW_Compatibility_Info)); tw_dev 747 drivers/scsi/3w-9xxx.c if (tw_dev->event_queue_wrapped) { tw_dev 748 drivers/scsi/3w-9xxx.c if (tw_dev->aen_clobber) { tw_dev 750 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 0; tw_dev 754 drivers/scsi/3w-9xxx.c if (!tw_dev->error_index) { tw_dev 760 drivers/scsi/3w-9xxx.c event_index = (tw_dev->error_index - 1 + TW_Q_LENGTH) % TW_Q_LENGTH; tw_dev 761 drivers/scsi/3w-9xxx.c memcpy(tw_ioctl->data_buffer, tw_dev->event_queue[event_index], sizeof(TW_Event)); tw_dev 762 drivers/scsi/3w-9xxx.c tw_dev->event_queue[event_index]->retrieved = TW_AEN_RETRIEVED; tw_dev 765 drivers/scsi/3w-9xxx.c if (tw_dev->event_queue_wrapped) { tw_dev 766 drivers/scsi/3w-9xxx.c if (tw_dev->aen_clobber) { tw_dev 768 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 0; tw_dev 771 drivers/scsi/3w-9xxx.c event_index = tw_dev->error_index; tw_dev 773 drivers/scsi/3w-9xxx.c if (!tw_dev->error_index) { tw_dev 780 drivers/scsi/3w-9xxx.c memcpy(tw_ioctl->data_buffer, tw_dev->event_queue[event_index], sizeof(TW_Event)); tw_dev 781 drivers/scsi/3w-9xxx.c tw_dev->event_queue[event_index]->retrieved = TW_AEN_RETRIEVED; tw_dev 788 drivers/scsi/3w-9xxx.c if (tw_dev->event_queue_wrapped) { tw_dev 789 drivers/scsi/3w-9xxx.c if (tw_dev->aen_clobber) { tw_dev 791 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 0; tw_dev 793 drivers/scsi/3w-9xxx.c start_index = tw_dev->error_index; tw_dev 795 drivers/scsi/3w-9xxx.c if (!tw_dev->error_index) { tw_dev 801 drivers/scsi/3w-9xxx.c event_index = (start_index + sequence_id - tw_dev->event_queue[start_index]->sequence_id + 1) % TW_Q_LENGTH; tw_dev 803 drivers/scsi/3w-9xxx.c if (!(tw_dev->event_queue[event_index]->sequence_id > sequence_id)) { tw_dev 805 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 1; tw_dev 809 drivers/scsi/3w-9xxx.c memcpy(tw_ioctl->data_buffer, tw_dev->event_queue[event_index], sizeof(TW_Event)); tw_dev 810 drivers/scsi/3w-9xxx.c tw_dev->event_queue[event_index]->retrieved = TW_AEN_RETRIEVED; tw_dev 817 drivers/scsi/3w-9xxx.c if (tw_dev->event_queue_wrapped) { tw_dev 818 drivers/scsi/3w-9xxx.c if (tw_dev->aen_clobber) { tw_dev 820 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 0; tw_dev 822 drivers/scsi/3w-9xxx.c start_index = tw_dev->error_index; tw_dev 824 drivers/scsi/3w-9xxx.c if (!tw_dev->error_index) { tw_dev 830 drivers/scsi/3w-9xxx.c event_index = (start_index + sequence_id - tw_dev->event_queue[start_index]->sequence_id - 1) % TW_Q_LENGTH; tw_dev 832 drivers/scsi/3w-9xxx.c if (!(tw_dev->event_queue[event_index]->sequence_id < sequence_id)) { tw_dev 834 drivers/scsi/3w-9xxx.c tw_dev->aen_clobber = 1; tw_dev 838 drivers/scsi/3w-9xxx.c memcpy(tw_ioctl->data_buffer, tw_dev->event_queue[event_index], sizeof(TW_Event)); tw_dev 839 drivers/scsi/3w-9xxx.c tw_dev->event_queue[event_index]->retrieved = TW_AEN_RETRIEVED; tw_dev 845 drivers/scsi/3w-9xxx.c if ((tw_lock->force_flag == 1) || (tw_dev->ioctl_sem_lock == 0) || tw_dev 846 drivers/scsi/3w-9xxx.c ktime_after(current_time, tw_dev->ioctl_time)) { tw_dev 847 drivers/scsi/3w-9xxx.c tw_dev->ioctl_sem_lock = 1; tw_dev 848 drivers/scsi/3w-9xxx.c tw_dev->ioctl_time = ktime_add_ms(current_time, tw_lock->timeout_msec); tw_dev 853 drivers/scsi/3w-9xxx.c tw_lock->time_remaining_msec = ktime_ms_delta(tw_dev->ioctl_time, current_time); tw_dev 857 drivers/scsi/3w-9xxx.c if (tw_dev->ioctl_sem_lock == 1) { tw_dev 858 drivers/scsi/3w-9xxx.c tw_dev->ioctl_sem_lock = 0; tw_dev 874 drivers/scsi/3w-9xxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, cpu_addr, dma_handle); tw_dev 876 drivers/scsi/3w-9xxx.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 903 drivers/scsi/3w-9xxx.c static int twa_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value) tw_dev 909 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xc, "PCI Parity Error: clearing"); tw_dev 910 drivers/scsi/3w-9xxx.c writel(TW_CONTROL_CLEAR_PARITY_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 914 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xd, "PCI Abort: clearing"); tw_dev 915 drivers/scsi/3w-9xxx.c writel(TW_CONTROL_CLEAR_PCI_ABORT, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 916 drivers/scsi/3w-9xxx.c pci_write_config_word(tw_dev->tw_pci_dev, PCI_STATUS, TW_PCI_CLEAR_PCI_ABORT); tw_dev 920 drivers/scsi/3w-9xxx.c if (((tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9650SE) && tw_dev 921 drivers/scsi/3w-9xxx.c (tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9690SA)) || tw_dev 922 drivers/scsi/3w-9xxx.c (!test_bit(TW_IN_RESET, &tw_dev->flags))) tw_dev 923 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Controller Queue Error: clearing"); tw_dev 924 drivers/scsi/3w-9xxx.c writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 928 drivers/scsi/3w-9xxx.c if (tw_dev->reset_print == 0) { tw_dev 929 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x10, "Microcontroller Error: clearing"); tw_dev 930 drivers/scsi/3w-9xxx.c tw_dev->reset_print = 1; tw_dev 940 drivers/scsi/3w-9xxx.c static int twa_empty_response_queue(TW_Device_Extension *tw_dev) tw_dev 945 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 948 drivers/scsi/3w-9xxx.c response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 949 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 961 drivers/scsi/3w-9xxx.c static int twa_empty_response_queue_large(TW_Device_Extension *tw_dev) tw_dev 967 drivers/scsi/3w-9xxx.c if (tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9000) { tw_dev 970 drivers/scsi/3w-9xxx.c response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev)); tw_dev 985 drivers/scsi/3w-9xxx.c static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host) tw_dev 992 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1002 drivers/scsi/3w-9xxx.c tw_dev->host->host_no, tw_dev 1020 drivers/scsi/3w-9xxx.c memcpy(tw_dev->srb[request_id]->sense_buffer, full_command_packet->header.sense_data, TW_SENSE_DATA_LENGTH); tw_dev 1021 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1); tw_dev 1031 drivers/scsi/3w-9xxx.c static void twa_free_device_extension(TW_Device_Extension *tw_dev) tw_dev 1033 drivers/scsi/3w-9xxx.c if (tw_dev->command_packet_virt[0]) tw_dev 1034 drivers/scsi/3w-9xxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 1036 drivers/scsi/3w-9xxx.c tw_dev->command_packet_virt[0], tw_dev 1037 drivers/scsi/3w-9xxx.c tw_dev->command_packet_phys[0]); tw_dev 1039 drivers/scsi/3w-9xxx.c if (tw_dev->generic_buffer_virt[0]) tw_dev 1040 drivers/scsi/3w-9xxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 1042 drivers/scsi/3w-9xxx.c tw_dev->generic_buffer_virt[0], tw_dev 1043 drivers/scsi/3w-9xxx.c tw_dev->generic_buffer_phys[0]); tw_dev 1045 drivers/scsi/3w-9xxx.c kfree(tw_dev->event_queue[0]); tw_dev 1049 drivers/scsi/3w-9xxx.c static void twa_free_request_id(TW_Device_Extension *tw_dev, int request_id) tw_dev 1051 drivers/scsi/3w-9xxx.c tw_dev->free_queue[tw_dev->free_tail] = request_id; tw_dev 1052 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_FINISHED; tw_dev 1053 drivers/scsi/3w-9xxx.c tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH; tw_dev 1057 drivers/scsi/3w-9xxx.c static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter_id, int parameter_size_bytes) tw_dev 1065 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1075 drivers/scsi/3w-9xxx.c param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; tw_dev 1081 drivers/scsi/3w-9xxx.c command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); tw_dev 1085 drivers/scsi/3w-9xxx.c twa_post_command_packet(tw_dev, request_id, 1); tw_dev 1088 drivers/scsi/3w-9xxx.c if (twa_poll_response(tw_dev, request_id, 30)) tw_dev 1089 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x13, "No valid response during get param") tw_dev 1093 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 1094 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 1100 drivers/scsi/3w-9xxx.c static void twa_get_request_id(TW_Device_Extension *tw_dev, int *request_id) tw_dev 1102 drivers/scsi/3w-9xxx.c *request_id = tw_dev->free_queue[tw_dev->free_head]; tw_dev 1103 drivers/scsi/3w-9xxx.c tw_dev->free_head = (tw_dev->free_head + 1) % TW_Q_LENGTH; tw_dev 1104 drivers/scsi/3w-9xxx.c tw_dev->state[*request_id] = TW_S_STARTED; tw_dev 1108 drivers/scsi/3w-9xxx.c static int twa_initconnection(TW_Device_Extension *tw_dev, int message_credits, tw_dev 1124 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1149 drivers/scsi/3w-9xxx.c twa_post_command_packet(tw_dev, request_id, 1); tw_dev 1152 drivers/scsi/3w-9xxx.c if (twa_poll_response(tw_dev, request_id, 30)) { tw_dev 1153 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x15, "No valid response during init connection"); tw_dev 1165 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 1166 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 1172 drivers/scsi/3w-9xxx.c static int twa_initialize_device_extension(TW_Device_Extension *tw_dev) tw_dev 1177 drivers/scsi/3w-9xxx.c if (twa_allocate_memory(tw_dev, sizeof(TW_Command_Full), 0)) { tw_dev 1178 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x16, "Command packet memory allocation failed"); tw_dev 1183 drivers/scsi/3w-9xxx.c if (twa_allocate_memory(tw_dev, TW_SECTOR_SIZE, 1)) { tw_dev 1184 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x17, "Generic memory allocation failed"); tw_dev 1189 drivers/scsi/3w-9xxx.c tw_dev->event_queue[0] = kcalloc(TW_Q_LENGTH, sizeof(TW_Event), GFP_KERNEL); tw_dev 1190 drivers/scsi/3w-9xxx.c if (!tw_dev->event_queue[0]) { tw_dev 1191 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x18, "Event info memory allocation failed"); tw_dev 1197 drivers/scsi/3w-9xxx.c tw_dev->event_queue[i] = (TW_Event *)((unsigned char *)tw_dev->event_queue[0] + (i * sizeof(TW_Event))); tw_dev 1198 drivers/scsi/3w-9xxx.c tw_dev->free_queue[i] = i; tw_dev 1199 drivers/scsi/3w-9xxx.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1202 drivers/scsi/3w-9xxx.c tw_dev->pending_head = TW_Q_START; tw_dev 1203 drivers/scsi/3w-9xxx.c tw_dev->pending_tail = TW_Q_START; tw_dev 1204 drivers/scsi/3w-9xxx.c tw_dev->free_head = TW_Q_START; tw_dev 1205 drivers/scsi/3w-9xxx.c tw_dev->free_tail = TW_Q_START; tw_dev 1206 drivers/scsi/3w-9xxx.c tw_dev->error_sequence_id = 1; tw_dev 1207 drivers/scsi/3w-9xxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1209 drivers/scsi/3w-9xxx.c mutex_init(&tw_dev->ioctl_lock); tw_dev 1210 drivers/scsi/3w-9xxx.c init_waitqueue_head(&tw_dev->ioctl_wqueue); tw_dev 1224 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)dev_instance; tw_dev 1228 drivers/scsi/3w-9xxx.c spin_lock(tw_dev->host->host_lock); tw_dev 1231 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1240 drivers/scsi/3w-9xxx.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) tw_dev 1245 drivers/scsi/3w-9xxx.c if (twa_decode_bits(tw_dev, status_reg_value)) { tw_dev 1246 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 1253 drivers/scsi/3w-9xxx.c TW_CLEAR_HOST_INTERRUPT(tw_dev); tw_dev 1257 drivers/scsi/3w-9xxx.c TW_CLEAR_ATTENTION_INTERRUPT(tw_dev); tw_dev 1258 drivers/scsi/3w-9xxx.c if (!(test_and_set_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags))) { tw_dev 1259 drivers/scsi/3w-9xxx.c twa_get_request_id(tw_dev, &request_id); tw_dev 1261 drivers/scsi/3w-9xxx.c error = twa_aen_read_queue(tw_dev, request_id); tw_dev 1263 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1264 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 1265 drivers/scsi/3w-9xxx.c clear_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags); tw_dev 1272 drivers/scsi/3w-9xxx.c TW_MASK_COMMAND_INTERRUPT(tw_dev); tw_dev 1274 drivers/scsi/3w-9xxx.c while (tw_dev->pending_request_count > 0) { tw_dev 1275 drivers/scsi/3w-9xxx.c request_id = tw_dev->pending_queue[tw_dev->pending_head]; tw_dev 1276 drivers/scsi/3w-9xxx.c if (tw_dev->state[request_id] != TW_S_PENDING) { tw_dev 1277 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x19, "Found request id that wasn't pending"); tw_dev 1278 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 1281 drivers/scsi/3w-9xxx.c if (twa_post_command_packet(tw_dev, request_id, 1)==0) { tw_dev 1282 drivers/scsi/3w-9xxx.c tw_dev->pending_head = (tw_dev->pending_head + 1) % TW_Q_LENGTH; tw_dev 1283 drivers/scsi/3w-9xxx.c tw_dev->pending_request_count--; tw_dev 1297 drivers/scsi/3w-9xxx.c response_que.value = readl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 1299 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1303 drivers/scsi/3w-9xxx.c if (tw_dev->srb[request_id] != NULL) { tw_dev 1304 drivers/scsi/3w-9xxx.c error = twa_fill_sense(tw_dev, request_id, 1, 1); tw_dev 1307 drivers/scsi/3w-9xxx.c if (request_id != tw_dev->chrdev_request_id) { tw_dev 1308 drivers/scsi/3w-9xxx.c error = twa_fill_sense(tw_dev, request_id, 0, 1); tw_dev 1314 drivers/scsi/3w-9xxx.c if (tw_dev->state[request_id] != TW_S_POSTED) { tw_dev 1315 drivers/scsi/3w-9xxx.c if (tw_dev->srb[request_id] != NULL) { tw_dev 1316 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); tw_dev 1317 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 1323 drivers/scsi/3w-9xxx.c if (tw_dev->srb[request_id] == NULL) { tw_dev 1324 drivers/scsi/3w-9xxx.c if (request_id != tw_dev->chrdev_request_id) { tw_dev 1325 drivers/scsi/3w-9xxx.c if (twa_aen_complete(tw_dev, request_id)) tw_dev 1326 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); tw_dev 1328 drivers/scsi/3w-9xxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1329 drivers/scsi/3w-9xxx.c wake_up(&tw_dev->ioctl_wqueue); tw_dev 1334 drivers/scsi/3w-9xxx.c cmd = tw_dev->srb[request_id]; tw_dev 1336 drivers/scsi/3w-9xxx.c twa_scsiop_execute_scsi_complete(tw_dev, request_id); tw_dev 1350 drivers/scsi/3w-9xxx.c if (full_command_packet->command.newcommand.sg_list[0].length < scsi_bufflen(tw_dev->srb[request_id])) tw_dev 1358 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1359 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 1360 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count--; tw_dev 1364 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1366 drivers/scsi/3w-9xxx.c if (twa_decode_bits(tw_dev, status_reg_value)) { tw_dev 1367 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 1375 drivers/scsi/3w-9xxx.c spin_unlock(tw_dev->host->host_lock); tw_dev 1380 drivers/scsi/3w-9xxx.c static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length) tw_dev 1406 drivers/scsi/3w-9xxx.c if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA) tw_dev 1419 drivers/scsi/3w-9xxx.c static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) tw_dev 1423 drivers/scsi/3w-9xxx.c TW_Command_Full *full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1425 drivers/scsi/3w-9xxx.c if (twa_poll_status_gone(tw_dev, TW_STATUS_RESPONSE_QUEUE_EMPTY, seconds) == 0) { tw_dev 1426 drivers/scsi/3w-9xxx.c response_queue.value = readl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 1429 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1e, "Found unexpected request id while polling for response"); tw_dev 1435 drivers/scsi/3w-9xxx.c twa_fill_sense(tw_dev, request_id, 0, 0); tw_dev 1442 drivers/scsi/3w-9xxx.c twa_fill_sense(tw_dev, request_id, 0, 0); tw_dev 1456 drivers/scsi/3w-9xxx.c static int twa_poll_status(TW_Device_Extension *tw_dev, u32 flag, int seconds) tw_dev 1462 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1466 drivers/scsi/3w-9xxx.c twa_decode_bits(tw_dev, status_reg_value); tw_dev 1469 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1472 drivers/scsi/3w-9xxx.c twa_decode_bits(tw_dev, status_reg_value); tw_dev 1485 drivers/scsi/3w-9xxx.c static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int seconds) tw_dev 1491 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1495 drivers/scsi/3w-9xxx.c twa_decode_bits(tw_dev, status_reg_value); tw_dev 1498 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1500 drivers/scsi/3w-9xxx.c twa_decode_bits(tw_dev, status_reg_value); tw_dev 1513 drivers/scsi/3w-9xxx.c static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal) tw_dev 1519 drivers/scsi/3w-9xxx.c command_que_value = tw_dev->command_packet_phys[request_id]; tw_dev 1522 drivers/scsi/3w-9xxx.c if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) || tw_dev 1523 drivers/scsi/3w-9xxx.c (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA)) { tw_dev 1525 drivers/scsi/3w-9xxx.c writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev)); tw_dev 1528 drivers/scsi/3w-9xxx.c status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 1531 drivers/scsi/3w-9xxx.c twa_decode_bits(tw_dev, status_reg_value); tw_dev 1533 drivers/scsi/3w-9xxx.c if (((tw_dev->pending_request_count > 0) && (tw_dev->state[request_id] != TW_S_PENDING)) || (status_reg_value & TW_STATUS_COMMAND_QUEUE_FULL)) { tw_dev 1542 drivers/scsi/3w-9xxx.c if (tw_dev->state[request_id] != TW_S_PENDING) { tw_dev 1543 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_PENDING; tw_dev 1544 drivers/scsi/3w-9xxx.c tw_dev->pending_request_count++; tw_dev 1545 drivers/scsi/3w-9xxx.c if (tw_dev->pending_request_count > tw_dev->max_pending_request_count) { tw_dev 1546 drivers/scsi/3w-9xxx.c tw_dev->max_pending_request_count = tw_dev->pending_request_count; tw_dev 1548 drivers/scsi/3w-9xxx.c tw_dev->pending_queue[tw_dev->pending_tail] = request_id; tw_dev 1549 drivers/scsi/3w-9xxx.c tw_dev->pending_tail = (tw_dev->pending_tail + 1) % TW_Q_LENGTH; tw_dev 1551 drivers/scsi/3w-9xxx.c TW_UNMASK_COMMAND_INTERRUPT(tw_dev); tw_dev 1554 drivers/scsi/3w-9xxx.c if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) || tw_dev 1555 drivers/scsi/3w-9xxx.c (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9690SA)) { tw_dev 1557 drivers/scsi/3w-9xxx.c writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev) + 0x4); tw_dev 1561 drivers/scsi/3w-9xxx.c writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 1562 drivers/scsi/3w-9xxx.c writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR(tw_dev) + 0x4); tw_dev 1564 drivers/scsi/3w-9xxx.c writel(TW_COMMAND_OFFSET + command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 1567 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_POSTED; tw_dev 1568 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count++; tw_dev 1569 drivers/scsi/3w-9xxx.c if (tw_dev->posted_request_count > tw_dev->max_posted_request_count) { tw_dev 1570 drivers/scsi/3w-9xxx.c tw_dev->max_posted_request_count = tw_dev->posted_request_count; tw_dev 1579 drivers/scsi/3w-9xxx.c static int twa_reset_device_extension(TW_Device_Extension *tw_dev) tw_dev 1585 drivers/scsi/3w-9xxx.c set_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1586 drivers/scsi/3w-9xxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 1587 drivers/scsi/3w-9xxx.c TW_MASK_COMMAND_INTERRUPT(tw_dev); tw_dev 1588 drivers/scsi/3w-9xxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 1592 drivers/scsi/3w-9xxx.c if ((tw_dev->state[i] != TW_S_FINISHED) && tw_dev 1593 drivers/scsi/3w-9xxx.c (tw_dev->state[i] != TW_S_INITIAL) && tw_dev 1594 drivers/scsi/3w-9xxx.c (tw_dev->state[i] != TW_S_COMPLETED)) { tw_dev 1595 drivers/scsi/3w-9xxx.c if (tw_dev->srb[i]) { tw_dev 1596 drivers/scsi/3w-9xxx.c struct scsi_cmnd *cmd = tw_dev->srb[i]; tw_dev 1608 drivers/scsi/3w-9xxx.c tw_dev->free_queue[i] = i; tw_dev 1609 drivers/scsi/3w-9xxx.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1611 drivers/scsi/3w-9xxx.c tw_dev->free_head = TW_Q_START; tw_dev 1612 drivers/scsi/3w-9xxx.c tw_dev->free_tail = TW_Q_START; tw_dev 1613 drivers/scsi/3w-9xxx.c tw_dev->posted_request_count = 0; tw_dev 1614 drivers/scsi/3w-9xxx.c tw_dev->pending_request_count = 0; tw_dev 1615 drivers/scsi/3w-9xxx.c tw_dev->pending_head = TW_Q_START; tw_dev 1616 drivers/scsi/3w-9xxx.c tw_dev->pending_tail = TW_Q_START; tw_dev 1617 drivers/scsi/3w-9xxx.c tw_dev->reset_print = 0; tw_dev 1619 drivers/scsi/3w-9xxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 1621 drivers/scsi/3w-9xxx.c if (twa_reset_sequence(tw_dev, 1)) tw_dev 1624 drivers/scsi/3w-9xxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 1625 drivers/scsi/3w-9xxx.c clear_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1626 drivers/scsi/3w-9xxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1634 drivers/scsi/3w-9xxx.c static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset) tw_dev 1640 drivers/scsi/3w-9xxx.c TW_SOFT_RESET(tw_dev); tw_dev 1642 drivers/scsi/3w-9xxx.c if (twa_empty_response_queue_large(tw_dev)) { tw_dev 1643 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x36, "Response queue (large) empty failed during reset sequence"); tw_dev 1651 drivers/scsi/3w-9xxx.c if (twa_poll_status(tw_dev, TW_STATUS_MICROCONTROLLER_READY | (do_soft_reset == 1 ? TW_STATUS_ATTENTION_INTERRUPT : 0), 60)) { tw_dev 1652 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1f, "Microcontroller not ready during reset sequence"); tw_dev 1659 drivers/scsi/3w-9xxx.c if (twa_empty_response_queue(tw_dev)) { tw_dev 1660 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x20, "Response queue empty failed during reset sequence"); tw_dev 1669 drivers/scsi/3w-9xxx.c if (twa_check_srl(tw_dev, &flashed)) { tw_dev 1670 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x21, "Compatibility check failed during reset sequence"); tw_dev 1682 drivers/scsi/3w-9xxx.c if (twa_aen_drain_queue(tw_dev, soft_reset)) { tw_dev 1683 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x22, "AEN drain failed during reset sequence"); tw_dev 1701 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev; tw_dev 1703 drivers/scsi/3w-9xxx.c tw_dev = (TW_Device_Extension *)sdev->host->hostdata; tw_dev 1725 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = NULL; tw_dev 1728 drivers/scsi/3w-9xxx.c tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1730 drivers/scsi/3w-9xxx.c tw_dev->num_resets++; tw_dev 1737 drivers/scsi/3w-9xxx.c mutex_lock(&tw_dev->ioctl_lock); tw_dev 1740 drivers/scsi/3w-9xxx.c if (twa_reset_device_extension(tw_dev)) { tw_dev 1741 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2b, "Controller reset failed during scsi host reset"); tw_dev 1747 drivers/scsi/3w-9xxx.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 1755 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1758 drivers/scsi/3w-9xxx.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) { tw_dev 1764 drivers/scsi/3w-9xxx.c if ((SCpnt->device->lun != 0) && (tw_dev->tw_compat_info.working_srl < TW_FW_SRL_LUNS_SUPPORTED)) { tw_dev 1775 drivers/scsi/3w-9xxx.c twa_get_request_id(tw_dev, &request_id); tw_dev 1778 drivers/scsi/3w-9xxx.c tw_dev->srb[request_id] = SCpnt; tw_dev 1780 drivers/scsi/3w-9xxx.c retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); tw_dev 1785 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 1792 drivers/scsi/3w-9xxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1793 drivers/scsi/3w-9xxx.c twa_free_request_id(tw_dev, request_id); tw_dev 1803 drivers/scsi/3w-9xxx.c static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, tw_dev 1815 drivers/scsi/3w-9xxx.c if (tw_dev->srb[request_id]) { tw_dev 1816 drivers/scsi/3w-9xxx.c srb = tw_dev->srb[request_id]; tw_dev 1822 drivers/scsi/3w-9xxx.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1857 drivers/scsi/3w-9xxx.c tw_dev->generic_buffer_virt[request_id], tw_dev 1859 drivers/scsi/3w-9xxx.c command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); tw_dev 1870 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2e, "Found unaligned sgl address during execute scsi"); tw_dev 1875 drivers/scsi/3w-9xxx.c command_packet->sgl_entries__lunh = cpu_to_le16(TW_REQ_LUN_IN((srb->device->lun >> 4), scsi_sg_count(tw_dev->srb[request_id]))); tw_dev 1883 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2f, "Found unaligned sgl address during internal post"); tw_dev 1899 drivers/scsi/3w-9xxx.c tw_dev->sector_count = num_sectors; tw_dev 1900 drivers/scsi/3w-9xxx.c if (tw_dev->sector_count > tw_dev->max_sector_count) tw_dev 1901 drivers/scsi/3w-9xxx.c tw_dev->max_sector_count = tw_dev->sector_count; tw_dev 1905 drivers/scsi/3w-9xxx.c tw_dev->sgl_entries = scsi_sg_count(tw_dev->srb[request_id]); tw_dev 1906 drivers/scsi/3w-9xxx.c if (tw_dev->sgl_entries > tw_dev->max_sgl_entries) tw_dev 1907 drivers/scsi/3w-9xxx.c tw_dev->max_sgl_entries = tw_dev->sgl_entries; tw_dev 1912 drivers/scsi/3w-9xxx.c retval = twa_post_command_packet(tw_dev, request_id, 0); tw_dev 1914 drivers/scsi/3w-9xxx.c twa_post_command_packet(tw_dev, request_id, 1); tw_dev 1922 drivers/scsi/3w-9xxx.c static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 1924 drivers/scsi/3w-9xxx.c struct scsi_cmnd *cmd = tw_dev->srb[request_id]; tw_dev 1930 drivers/scsi/3w-9xxx.c void *buf = tw_dev->generic_buffer_virt[request_id]; tw_dev 1938 drivers/scsi/3w-9xxx.c static void __twa_shutdown(TW_Device_Extension *tw_dev) tw_dev 1941 drivers/scsi/3w-9xxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 1944 drivers/scsi/3w-9xxx.c free_irq(tw_dev->tw_pci_dev->irq, tw_dev); tw_dev 1946 drivers/scsi/3w-9xxx.c printk(KERN_WARNING "3w-9xxx: Shutting down host %d.\n", tw_dev->host->host_no); tw_dev 1949 drivers/scsi/3w-9xxx.c if (twa_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) { tw_dev 1950 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x31, "Connection shutdown failed"); tw_dev 1956 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 1963 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 1965 drivers/scsi/3w-9xxx.c __twa_shutdown(tw_dev); tw_dev 2010 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev; tw_dev 2038 drivers/scsi/3w-9xxx.c tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2041 drivers/scsi/3w-9xxx.c tw_dev->host = host; tw_dev 2042 drivers/scsi/3w-9xxx.c tw_dev->tw_pci_dev = pdev; tw_dev 2044 drivers/scsi/3w-9xxx.c if (twa_initialize_device_extension(tw_dev)) { tw_dev 2045 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x25, "Failed to initialize device extension"); tw_dev 2053 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x26, "Failed to get mem region"); tw_dev 2066 drivers/scsi/3w-9xxx.c tw_dev->base_addr = ioremap(mem_addr, mem_len); tw_dev 2067 drivers/scsi/3w-9xxx.c if (!tw_dev->base_addr) { tw_dev 2068 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap"); tw_dev 2074 drivers/scsi/3w-9xxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 2077 drivers/scsi/3w-9xxx.c if (twa_reset_sequence(tw_dev, 0)) { tw_dev 2092 drivers/scsi/3w-9xxx.c host->max_lun = TW_MAX_LUNS(tw_dev->tw_compat_info.working_srl); tw_dev 2098 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x27, "scsi add host failed"); tw_dev 2108 drivers/scsi/3w-9xxx.c (char *)twa_get_param(tw_dev, 0, TW_VERSION_TABLE, tw_dev 2110 drivers/scsi/3w-9xxx.c (char *)twa_get_param(tw_dev, 1, TW_VERSION_TABLE, tw_dev 2112 drivers/scsi/3w-9xxx.c le32_to_cpu(*(int *)twa_get_param(tw_dev, 2, TW_INFORMATION_TABLE, tw_dev 2118 drivers/scsi/3w-9xxx.c set_bit(TW_USING_MSI, &tw_dev->flags); tw_dev 2121 drivers/scsi/3w-9xxx.c retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev); tw_dev 2123 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x30, "Error requesting IRQ"); tw_dev 2127 drivers/scsi/3w-9xxx.c twa_device_extension_list[twa_device_extension_count] = tw_dev; tw_dev 2131 drivers/scsi/3w-9xxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 2143 drivers/scsi/3w-9xxx.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 2147 drivers/scsi/3w-9xxx.c iounmap(tw_dev->base_addr); tw_dev 2151 drivers/scsi/3w-9xxx.c twa_free_device_extension(tw_dev); tw_dev 2163 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2165 drivers/scsi/3w-9xxx.c scsi_remove_host(tw_dev->host); tw_dev 2174 drivers/scsi/3w-9xxx.c __twa_shutdown(tw_dev); tw_dev 2177 drivers/scsi/3w-9xxx.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 2181 drivers/scsi/3w-9xxx.c iounmap(tw_dev->base_addr); tw_dev 2187 drivers/scsi/3w-9xxx.c twa_free_device_extension(tw_dev); tw_dev 2189 drivers/scsi/3w-9xxx.c scsi_host_put(tw_dev->host); tw_dev 2199 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2201 drivers/scsi/3w-9xxx.c printk(KERN_WARNING "3w-9xxx: Suspending host %d.\n", tw_dev->host->host_no); tw_dev 2203 drivers/scsi/3w-9xxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 2204 drivers/scsi/3w-9xxx.c free_irq(tw_dev->tw_pci_dev->irq, tw_dev); tw_dev 2206 drivers/scsi/3w-9xxx.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 2210 drivers/scsi/3w-9xxx.c if (twa_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) { tw_dev 2211 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x38, "Connection shutdown failed during suspend"); tw_dev 2215 drivers/scsi/3w-9xxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 2229 drivers/scsi/3w-9xxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2231 drivers/scsi/3w-9xxx.c printk(KERN_WARNING "3w-9xxx: Resuming host %d.\n", tw_dev->host->host_no); tw_dev 2238 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x39, "Enable device failed during resume"); tw_dev 2255 drivers/scsi/3w-9xxx.c if (twa_reset_sequence(tw_dev, 0)) { tw_dev 2261 drivers/scsi/3w-9xxx.c retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev); tw_dev 2263 drivers/scsi/3w-9xxx.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x42, "Error requesting IRQ during resume"); tw_dev 2269 drivers/scsi/3w-9xxx.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 2273 drivers/scsi/3w-9xxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 93 drivers/scsi/3w-sas.c static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_reset); tw_dev 104 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)shost->hostdata; tw_dev 111 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 112 drivers/scsi/3w-sas.c ret = memory_read_from_buffer(outbuf, count, &offset, tw_dev->event_queue[0], sizeof(TW_Event) * TW_Q_LENGTH); tw_dev 113 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 135 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)shost->hostdata; tw_dev 142 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 143 drivers/scsi/3w-sas.c ret = memory_read_from_buffer(outbuf, count, &offset, &tw_dev->tw_compat_info, sizeof(TW_Compatibility_Info)); tw_dev 144 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 164 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 168 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 179 drivers/scsi/3w-sas.c tw_dev->posted_request_count, tw_dev 180 drivers/scsi/3w-sas.c tw_dev->max_posted_request_count, tw_dev 181 drivers/scsi/3w-sas.c tw_dev->sgl_entries, tw_dev 182 drivers/scsi/3w-sas.c tw_dev->max_sgl_entries, tw_dev 183 drivers/scsi/3w-sas.c tw_dev->sector_count, tw_dev 184 drivers/scsi/3w-sas.c tw_dev->max_sector_count, tw_dev 185 drivers/scsi/3w-sas.c tw_dev->num_resets, tw_dev 186 drivers/scsi/3w-sas.c tw_dev->aen_count); tw_dev 187 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 221 drivers/scsi/3w-sas.c static void twl_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Header *header) tw_dev 229 drivers/scsi/3w-sas.c tw_dev->aen_count++; tw_dev 232 drivers/scsi/3w-sas.c event = tw_dev->event_queue[tw_dev->error_index]; tw_dev 235 drivers/scsi/3w-sas.c if (tw_dev->host) tw_dev 236 drivers/scsi/3w-sas.c sprintf(host, " scsi%d:", tw_dev->host->host_no); tw_dev 247 drivers/scsi/3w-sas.c event->sequence_id = tw_dev->error_sequence_id; tw_dev 248 drivers/scsi/3w-sas.c tw_dev->error_sequence_id++; tw_dev 263 drivers/scsi/3w-sas.c tw_dev->aen_count--; tw_dev 265 drivers/scsi/3w-sas.c tw_dev->error_index = (tw_dev->error_index + 1 ) % TW_Q_LENGTH; tw_dev 269 drivers/scsi/3w-sas.c static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id) tw_dev 273 drivers/scsi/3w-sas.c command_que_value = tw_dev->command_packet_phys[request_id]; tw_dev 277 drivers/scsi/3w-sas.c writel((u32)((u64)command_que_value >> 32), TWL_HIBQPH_REG_ADDR(tw_dev)); tw_dev 279 drivers/scsi/3w-sas.c writel((u32)(command_que_value | TWL_PULL_MODE), TWL_HIBQPL_REG_ADDR(tw_dev)); tw_dev 281 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_POSTED; tw_dev 282 drivers/scsi/3w-sas.c tw_dev->posted_request_count++; tw_dev 283 drivers/scsi/3w-sas.c if (tw_dev->posted_request_count > tw_dev->max_posted_request_count) tw_dev 284 drivers/scsi/3w-sas.c tw_dev->max_posted_request_count = tw_dev->posted_request_count; tw_dev 290 drivers/scsi/3w-sas.c static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, tw_dev 301 drivers/scsi/3w-sas.c if (tw_dev->srb[request_id]) { tw_dev 302 drivers/scsi/3w-sas.c srb = tw_dev->srb[request_id]; tw_dev 308 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 346 drivers/scsi/3w-sas.c command_packet->sgl_entries__lunh = cpu_to_le16(TW_REQ_LUN_IN((srb->device->lun >> 4), scsi_sg_count(tw_dev->srb[request_id]))); tw_dev 359 drivers/scsi/3w-sas.c tw_dev->sector_count = scsi_bufflen(srb) / 512; tw_dev 360 drivers/scsi/3w-sas.c if (tw_dev->sector_count > tw_dev->max_sector_count) tw_dev 361 drivers/scsi/3w-sas.c tw_dev->max_sector_count = tw_dev->sector_count; tw_dev 362 drivers/scsi/3w-sas.c tw_dev->sgl_entries = scsi_sg_count(srb); tw_dev 363 drivers/scsi/3w-sas.c if (tw_dev->sgl_entries > tw_dev->max_sgl_entries) tw_dev 364 drivers/scsi/3w-sas.c tw_dev->max_sgl_entries = tw_dev->sgl_entries; tw_dev 368 drivers/scsi/3w-sas.c retval = twl_post_command_packet(tw_dev, request_id); tw_dev 375 drivers/scsi/3w-sas.c static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) tw_dev 382 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 393 drivers/scsi/3w-sas.c sglist[0].address = tw_dev->generic_buffer_phys[request_id]; tw_dev 396 drivers/scsi/3w-sas.c tw_dev->srb[request_id] = NULL; tw_dev 399 drivers/scsi/3w-sas.c if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { tw_dev 400 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2, "Post failed while reading AEN queue"); tw_dev 409 drivers/scsi/3w-sas.c static void twl_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) tw_dev 418 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 423 drivers/scsi/3w-sas.c command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); tw_dev 429 drivers/scsi/3w-sas.c param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; tw_dev 444 drivers/scsi/3w-sas.c tw_dev->srb[request_id] = NULL; tw_dev 447 drivers/scsi/3w-sas.c twl_post_command_packet(tw_dev, request_id); tw_dev 451 drivers/scsi/3w-sas.c static void twl_get_request_id(TW_Device_Extension *tw_dev, int *request_id) tw_dev 453 drivers/scsi/3w-sas.c *request_id = tw_dev->free_queue[tw_dev->free_head]; tw_dev 454 drivers/scsi/3w-sas.c tw_dev->free_head = (tw_dev->free_head + 1) % TW_Q_LENGTH; tw_dev 455 drivers/scsi/3w-sas.c tw_dev->state[*request_id] = TW_S_STARTED; tw_dev 459 drivers/scsi/3w-sas.c static void twl_free_request_id(TW_Device_Extension *tw_dev, int request_id) tw_dev 461 drivers/scsi/3w-sas.c tw_dev->free_queue[tw_dev->free_tail] = request_id; tw_dev 462 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_FINISHED; tw_dev 463 drivers/scsi/3w-sas.c tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH; tw_dev 467 drivers/scsi/3w-sas.c static int twl_aen_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 475 drivers/scsi/3w-sas.c header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; tw_dev 476 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 478 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 484 drivers/scsi/3w-sas.c if (twl_aen_read_queue(tw_dev, request_id)) tw_dev 497 drivers/scsi/3w-sas.c twl_aen_sync_time(tw_dev, request_id); tw_dev 501 drivers/scsi/3w-sas.c twl_aen_queue_event(tw_dev, header); tw_dev 504 drivers/scsi/3w-sas.c if (twl_aen_read_queue(tw_dev, request_id)) tw_dev 513 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 514 drivers/scsi/3w-sas.c twl_free_request_id(tw_dev, request_id); tw_dev 515 drivers/scsi/3w-sas.c clear_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags); tw_dev 521 drivers/scsi/3w-sas.c static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) tw_dev 534 drivers/scsi/3w-sas.c regh = readl(TWL_HOBQPH_REG_ADDR(tw_dev)); tw_dev 535 drivers/scsi/3w-sas.c regl = readl(TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 538 drivers/scsi/3w-sas.c mfa = readl(TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 556 drivers/scsi/3w-sas.c static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset) tw_dev 572 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 583 drivers/scsi/3w-sas.c sglist[0].address = tw_dev->generic_buffer_phys[request_id]; tw_dev 586 drivers/scsi/3w-sas.c tw_dev->srb[request_id] = NULL; tw_dev 590 drivers/scsi/3w-sas.c if (twl_scsiop_execute_scsi(tw_dev, request_id, cdb, 1, sglist)) { tw_dev 591 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x3, "Error posting request sense"); tw_dev 596 drivers/scsi/3w-sas.c if (twl_poll_response(tw_dev, request_id, 30)) { tw_dev 597 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x4, "No valid response while draining AEN queue"); tw_dev 598 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 602 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 603 drivers/scsi/3w-sas.c header = (TW_Command_Apache_Header *)tw_dev->generic_buffer_virt[request_id]; tw_dev 629 drivers/scsi/3w-sas.c twl_aen_queue_event(tw_dev, header); tw_dev 637 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 642 drivers/scsi/3w-sas.c static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) tw_dev 649 drivers/scsi/3w-sas.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 653 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); tw_dev 660 drivers/scsi/3w-sas.c tw_dev->command_packet_phys[i] = dma_handle+(i*size); tw_dev 661 drivers/scsi/3w-sas.c tw_dev->command_packet_virt[i] = (TW_Command_Full *)((unsigned char *)cpu_addr + (i*size)); tw_dev 664 drivers/scsi/3w-sas.c tw_dev->generic_buffer_phys[i] = dma_handle+(i*size); tw_dev 665 drivers/scsi/3w-sas.c tw_dev->generic_buffer_virt[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)); tw_dev 668 drivers/scsi/3w-sas.c tw_dev->sense_buffer_phys[i] = dma_handle+(i*size); tw_dev 669 drivers/scsi/3w-sas.c tw_dev->sense_buffer_virt[i] = (TW_Command_Apache_Header *)((unsigned char *)cpu_addr + (i*size)); tw_dev 679 drivers/scsi/3w-sas.c static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_command_packet, int request_id, dma_addr_t dma_handle, int length) tw_dev 726 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; tw_dev 733 drivers/scsi/3w-sas.c if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { tw_dev 752 drivers/scsi/3w-sas.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, &dma_handle, GFP_KERNEL); tw_dev 767 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 768 drivers/scsi/3w-sas.c twl_get_request_id(tw_dev, &request_id); tw_dev 771 drivers/scsi/3w-sas.c tw_dev->srb[request_id] = NULL; tw_dev 774 drivers/scsi/3w-sas.c tw_dev->chrdev_request_id = request_id; tw_dev 779 drivers/scsi/3w-sas.c twl_load_sgl(tw_dev, full_command_packet, request_id, dma_handle, data_buffer_length_adjusted); tw_dev 781 drivers/scsi/3w-sas.c memcpy(tw_dev->command_packet_virt[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command_Full)); tw_dev 784 drivers/scsi/3w-sas.c twl_post_command_packet(tw_dev, request_id); tw_dev 785 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 790 drivers/scsi/3w-sas.c timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); tw_dev 793 drivers/scsi/3w-sas.c if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { tw_dev 796 drivers/scsi/3w-sas.c tw_dev->host->host_no, TW_DRIVER, 0x6, tw_dev 799 drivers/scsi/3w-sas.c twl_reset_device_extension(tw_dev, 1); tw_dev 804 drivers/scsi/3w-sas.c memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_Full)); tw_dev 807 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 808 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 809 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 810 drivers/scsi/3w-sas.c twl_free_request_id(tw_dev, request_id); tw_dev 811 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 823 drivers/scsi/3w-sas.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, cpu_addr, dma_handle); tw_dev 825 drivers/scsi/3w-sas.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 860 drivers/scsi/3w-sas.c static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, int copy_sense, int print_host) tw_dev 868 drivers/scsi/3w-sas.c header = tw_dev->sense_buffer_virt[i]; tw_dev 869 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 879 drivers/scsi/3w-sas.c tw_dev->host->host_no, tw_dev 893 drivers/scsi/3w-sas.c memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH); tw_dev 894 drivers/scsi/3w-sas.c tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1); tw_dev 902 drivers/scsi/3w-sas.c static void twl_free_device_extension(TW_Device_Extension *tw_dev) tw_dev 904 drivers/scsi/3w-sas.c if (tw_dev->command_packet_virt[0]) tw_dev 905 drivers/scsi/3w-sas.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 907 drivers/scsi/3w-sas.c tw_dev->command_packet_virt[0], tw_dev 908 drivers/scsi/3w-sas.c tw_dev->command_packet_phys[0]); tw_dev 910 drivers/scsi/3w-sas.c if (tw_dev->generic_buffer_virt[0]) tw_dev 911 drivers/scsi/3w-sas.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 913 drivers/scsi/3w-sas.c tw_dev->generic_buffer_virt[0], tw_dev 914 drivers/scsi/3w-sas.c tw_dev->generic_buffer_phys[0]); tw_dev 916 drivers/scsi/3w-sas.c if (tw_dev->sense_buffer_virt[0]) tw_dev 917 drivers/scsi/3w-sas.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 920 drivers/scsi/3w-sas.c tw_dev->sense_buffer_virt[0], tw_dev 921 drivers/scsi/3w-sas.c tw_dev->sense_buffer_phys[0]); tw_dev 923 drivers/scsi/3w-sas.c kfree(tw_dev->event_queue[0]); tw_dev 927 drivers/scsi/3w-sas.c static void *twl_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter_id, int parameter_size_bytes) tw_dev 935 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 945 drivers/scsi/3w-sas.c param = (TW_Param_Apache *)tw_dev->generic_buffer_virt[request_id]; tw_dev 951 drivers/scsi/3w-sas.c command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); tw_dev 955 drivers/scsi/3w-sas.c twl_post_command_packet(tw_dev, request_id); tw_dev 958 drivers/scsi/3w-sas.c if (twl_poll_response(tw_dev, request_id, 30)) tw_dev 959 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x7, "No valid response during get param") tw_dev 963 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 964 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 970 drivers/scsi/3w-sas.c static int twl_initconnection(TW_Device_Extension *tw_dev, int message_credits, tw_dev 986 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1011 drivers/scsi/3w-sas.c twl_post_command_packet(tw_dev, request_id); tw_dev 1014 drivers/scsi/3w-sas.c if (twl_poll_response(tw_dev, request_id, 30)) { tw_dev 1015 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x8, "No valid response during init connection"); tw_dev 1027 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 1028 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_INITIAL; tw_dev 1034 drivers/scsi/3w-sas.c static int twl_initialize_device_extension(TW_Device_Extension *tw_dev) tw_dev 1039 drivers/scsi/3w-sas.c if (twl_allocate_memory(tw_dev, sizeof(TW_Command_Full), 0)) { tw_dev 1040 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x9, "Command packet memory allocation failed"); tw_dev 1045 drivers/scsi/3w-sas.c if (twl_allocate_memory(tw_dev, TW_SECTOR_SIZE, 1)) { tw_dev 1046 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xa, "Generic memory allocation failed"); tw_dev 1051 drivers/scsi/3w-sas.c if (twl_allocate_memory(tw_dev, sizeof(TW_Command_Apache_Header), 2)) { tw_dev 1052 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xb, "Sense buffer allocation failed"); tw_dev 1057 drivers/scsi/3w-sas.c tw_dev->event_queue[0] = kcalloc(TW_Q_LENGTH, sizeof(TW_Event), GFP_KERNEL); tw_dev 1058 drivers/scsi/3w-sas.c if (!tw_dev->event_queue[0]) { tw_dev 1059 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xc, "Event info memory allocation failed"); tw_dev 1064 drivers/scsi/3w-sas.c tw_dev->event_queue[i] = (TW_Event *)((unsigned char *)tw_dev->event_queue[0] + (i * sizeof(TW_Event))); tw_dev 1065 drivers/scsi/3w-sas.c tw_dev->free_queue[i] = i; tw_dev 1066 drivers/scsi/3w-sas.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1069 drivers/scsi/3w-sas.c tw_dev->free_head = TW_Q_START; tw_dev 1070 drivers/scsi/3w-sas.c tw_dev->free_tail = TW_Q_START; tw_dev 1071 drivers/scsi/3w-sas.c tw_dev->error_sequence_id = 1; tw_dev 1072 drivers/scsi/3w-sas.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1074 drivers/scsi/3w-sas.c mutex_init(&tw_dev->ioctl_lock); tw_dev 1075 drivers/scsi/3w-sas.c init_waitqueue_head(&tw_dev->ioctl_wqueue); tw_dev 1083 drivers/scsi/3w-sas.c static int twl_handle_attention_interrupt(TW_Device_Extension *tw_dev) tw_dev 1089 drivers/scsi/3w-sas.c doorbell = readl(TWL_HOBDB_REG_ADDR(tw_dev)); tw_dev 1093 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xd, "Microcontroller Error: clearing"); tw_dev 1099 drivers/scsi/3w-sas.c if (!(test_and_set_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags))) { tw_dev 1100 drivers/scsi/3w-sas.c twl_get_request_id(tw_dev, &request_id); tw_dev 1101 drivers/scsi/3w-sas.c if (twl_aen_read_queue(tw_dev, request_id)) { tw_dev 1102 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1103 drivers/scsi/3w-sas.c twl_free_request_id(tw_dev, request_id); tw_dev 1104 drivers/scsi/3w-sas.c clear_bit(TW_IN_ATTENTION_LOOP, &tw_dev->flags); tw_dev 1112 drivers/scsi/3w-sas.c TWL_CLEAR_DB_INTERRUPT(tw_dev); tw_dev 1115 drivers/scsi/3w-sas.c readl(TWL_HOBDBC_REG_ADDR(tw_dev)); tw_dev 1123 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)dev_instance; tw_dev 1130 drivers/scsi/3w-sas.c spin_lock(tw_dev->host->host_lock); tw_dev 1133 drivers/scsi/3w-sas.c reg = readl(TWL_HISTAT_REG_ADDR(tw_dev)); tw_dev 1142 drivers/scsi/3w-sas.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) tw_dev 1147 drivers/scsi/3w-sas.c if (twl_handle_attention_interrupt(tw_dev)) { tw_dev 1148 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1156 drivers/scsi/3w-sas.c regh = readl(TWL_HOBQPH_REG_ADDR(tw_dev)); tw_dev 1157 drivers/scsi/3w-sas.c regl = readl(TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 1160 drivers/scsi/3w-sas.c mfa = readl(TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 1168 drivers/scsi/3w-sas.c if (tw_dev->sense_buffer_phys[i] == mfa) { tw_dev 1169 drivers/scsi/3w-sas.c request_id = le16_to_cpu(tw_dev->sense_buffer_virt[i]->header_desc.request_id); tw_dev 1170 drivers/scsi/3w-sas.c if (tw_dev->srb[request_id] != NULL) tw_dev 1171 drivers/scsi/3w-sas.c error = twl_fill_sense(tw_dev, i, request_id, 1, 1); tw_dev 1174 drivers/scsi/3w-sas.c if (request_id != tw_dev->chrdev_request_id) tw_dev 1175 drivers/scsi/3w-sas.c error = twl_fill_sense(tw_dev, i, request_id, 0, 1); tw_dev 1177 drivers/scsi/3w-sas.c memcpy(tw_dev->command_packet_virt[request_id], tw_dev->sense_buffer_virt[i], sizeof(TW_Command_Apache_Header)); tw_dev 1181 drivers/scsi/3w-sas.c writel((u32)((u64)tw_dev->sense_buffer_phys[i] >> 32), TWL_HOBQPH_REG_ADDR(tw_dev)); tw_dev 1182 drivers/scsi/3w-sas.c writel((u32)tw_dev->sense_buffer_phys[i], TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 1189 drivers/scsi/3w-sas.c full_command_packet = tw_dev->command_packet_virt[request_id]; tw_dev 1192 drivers/scsi/3w-sas.c if (tw_dev->state[request_id] != TW_S_POSTED) { tw_dev 1193 drivers/scsi/3w-sas.c if (tw_dev->srb[request_id] != NULL) { tw_dev 1194 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Received a request id that wasn't posted"); tw_dev 1195 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1201 drivers/scsi/3w-sas.c if (tw_dev->srb[request_id] == NULL) { tw_dev 1202 drivers/scsi/3w-sas.c if (request_id != tw_dev->chrdev_request_id) { tw_dev 1203 drivers/scsi/3w-sas.c if (twl_aen_complete(tw_dev, request_id)) tw_dev 1204 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0xf, "Error completing AEN during attention interrupt"); tw_dev 1206 drivers/scsi/3w-sas.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1207 drivers/scsi/3w-sas.c wake_up(&tw_dev->ioctl_wqueue); tw_dev 1210 drivers/scsi/3w-sas.c cmd = tw_dev->srb[request_id]; tw_dev 1217 drivers/scsi/3w-sas.c if (full_command_packet->command.newcommand.sg_list[0].length < scsi_bufflen(tw_dev->srb[request_id])) tw_dev 1224 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1225 drivers/scsi/3w-sas.c twl_free_request_id(tw_dev, request_id); tw_dev 1226 drivers/scsi/3w-sas.c tw_dev->posted_request_count--; tw_dev 1230 drivers/scsi/3w-sas.c reg = readl(TWL_HISTAT_REG_ADDR(tw_dev)); tw_dev 1234 drivers/scsi/3w-sas.c spin_unlock(tw_dev->host->host_lock); tw_dev 1239 drivers/scsi/3w-sas.c static int twl_poll_register(TW_Device_Extension *tw_dev, void *reg, u32 value, u32 result, int seconds) tw_dev 1260 drivers/scsi/3w-sas.c static int twl_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset) tw_dev 1274 drivers/scsi/3w-sas.c TWL_SOFT_RESET(tw_dev); tw_dev 1277 drivers/scsi/3w-sas.c if (twl_poll_register(tw_dev, TWL_SCRPD3_REG_ADDR(tw_dev), TWL_CONTROLLER_READY, 0x0, 30)) { tw_dev 1278 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x10, "Controller never went non-ready during reset sequence"); tw_dev 1282 drivers/scsi/3w-sas.c if (twl_poll_register(tw_dev, TWL_SCRPD3_REG_ADDR(tw_dev), TWL_CONTROLLER_READY, TWL_CONTROLLER_READY, 60)) { tw_dev 1283 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x11, "Controller not ready during reset sequence"); tw_dev 1290 drivers/scsi/3w-sas.c if (twl_initconnection(tw_dev, TW_INIT_MESSAGE_CREDITS, tw_dev 1296 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x12, "Initconnection failed while checking SRL"); tw_dev 1304 drivers/scsi/3w-sas.c writel((u32)((u64)tw_dev->sense_buffer_phys[i] >> 32), TWL_HOBQPH_REG_ADDR(tw_dev)); tw_dev 1305 drivers/scsi/3w-sas.c writel((u32)tw_dev->sense_buffer_phys[i], TWL_HOBQPL_REG_ADDR(tw_dev)); tw_dev 1308 drivers/scsi/3w-sas.c status = readl(TWL_STATUS_REG_ADDR(tw_dev)); tw_dev 1314 drivers/scsi/3w-sas.c status = readl(TWL_STATUS_REG_ADDR(tw_dev)); tw_dev 1316 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x13, "Bad controller status after loading sense buffers"); tw_dev 1323 drivers/scsi/3w-sas.c if (twl_aen_drain_queue(tw_dev, soft_reset)) { tw_dev 1324 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x14, "AEN drain failed during reset sequence"); tw_dev 1331 drivers/scsi/3w-sas.c strncpy(tw_dev->tw_compat_info.driver_version, TW_DRIVER_VERSION, strlen(TW_DRIVER_VERSION)); tw_dev 1332 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_srl_high = TW_CURRENT_DRIVER_SRL; tw_dev 1333 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_branch_high = TW_CURRENT_DRIVER_BRANCH; tw_dev 1334 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_build_high = TW_CURRENT_DRIVER_BUILD; tw_dev 1335 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_srl_low = TW_BASE_FW_SRL; tw_dev 1336 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_branch_low = TW_BASE_FW_BRANCH; tw_dev 1337 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.driver_build_low = TW_BASE_FW_BUILD; tw_dev 1338 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.fw_on_ctlr_srl = fw_on_ctlr_srl; tw_dev 1339 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.fw_on_ctlr_branch = fw_on_ctlr_branch; tw_dev 1340 drivers/scsi/3w-sas.c tw_dev->tw_compat_info.fw_on_ctlr_build = fw_on_ctlr_build; tw_dev 1351 drivers/scsi/3w-sas.c static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_reset) tw_dev 1358 drivers/scsi/3w-sas.c scsi_block_requests(tw_dev->host); tw_dev 1360 drivers/scsi/3w-sas.c set_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1361 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1362 drivers/scsi/3w-sas.c TWL_CLEAR_DB_INTERRUPT(tw_dev); tw_dev 1364 drivers/scsi/3w-sas.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 1368 drivers/scsi/3w-sas.c if ((tw_dev->state[i] != TW_S_FINISHED) && tw_dev 1369 drivers/scsi/3w-sas.c (tw_dev->state[i] != TW_S_INITIAL) && tw_dev 1370 drivers/scsi/3w-sas.c (tw_dev->state[i] != TW_S_COMPLETED)) { tw_dev 1371 drivers/scsi/3w-sas.c struct scsi_cmnd *cmd = tw_dev->srb[i]; tw_dev 1383 drivers/scsi/3w-sas.c tw_dev->free_queue[i] = i; tw_dev 1384 drivers/scsi/3w-sas.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1386 drivers/scsi/3w-sas.c tw_dev->free_head = TW_Q_START; tw_dev 1387 drivers/scsi/3w-sas.c tw_dev->free_tail = TW_Q_START; tw_dev 1388 drivers/scsi/3w-sas.c tw_dev->posted_request_count = 0; tw_dev 1390 drivers/scsi/3w-sas.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 1392 drivers/scsi/3w-sas.c if (twl_reset_sequence(tw_dev, 1)) tw_dev 1395 drivers/scsi/3w-sas.c TWL_UNMASK_INTERRUPTS(tw_dev); tw_dev 1397 drivers/scsi/3w-sas.c clear_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1398 drivers/scsi/3w-sas.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1403 drivers/scsi/3w-sas.c scsi_unblock_requests(tw_dev->host); tw_dev 1411 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev; tw_dev 1413 drivers/scsi/3w-sas.c tw_dev = (TW_Device_Extension *)sdev->host->hostdata; tw_dev 1433 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = NULL; tw_dev 1436 drivers/scsi/3w-sas.c tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1438 drivers/scsi/3w-sas.c tw_dev->num_resets++; tw_dev 1445 drivers/scsi/3w-sas.c mutex_lock(&tw_dev->ioctl_lock); tw_dev 1448 drivers/scsi/3w-sas.c if (twl_reset_device_extension(tw_dev, 0)) { tw_dev 1449 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x15, "Controller reset failed during scsi host reset"); tw_dev 1455 drivers/scsi/3w-sas.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 1463 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1466 drivers/scsi/3w-sas.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) { tw_dev 1475 drivers/scsi/3w-sas.c twl_get_request_id(tw_dev, &request_id); tw_dev 1478 drivers/scsi/3w-sas.c tw_dev->srb[request_id] = SCpnt; tw_dev 1480 drivers/scsi/3w-sas.c retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); tw_dev 1482 drivers/scsi/3w-sas.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1483 drivers/scsi/3w-sas.c twl_free_request_id(tw_dev, request_id); tw_dev 1495 drivers/scsi/3w-sas.c static void __twl_shutdown(TW_Device_Extension *tw_dev) tw_dev 1498 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1501 drivers/scsi/3w-sas.c free_irq(tw_dev->tw_pci_dev->irq, tw_dev); tw_dev 1503 drivers/scsi/3w-sas.c printk(KERN_WARNING "3w-sas: Shutting down host %d.\n", tw_dev->host->host_no); tw_dev 1506 drivers/scsi/3w-sas.c if (twl_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) { tw_dev 1507 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x16, "Connection shutdown failed"); tw_dev 1513 drivers/scsi/3w-sas.c TWL_CLEAR_DB_INTERRUPT(tw_dev); tw_dev 1520 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev; tw_dev 1525 drivers/scsi/3w-sas.c tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 1527 drivers/scsi/3w-sas.c if (tw_dev->online) tw_dev 1528 drivers/scsi/3w-sas.c __twl_shutdown(tw_dev); tw_dev 1563 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev; tw_dev 1591 drivers/scsi/3w-sas.c tw_dev = shost_priv(host); tw_dev 1594 drivers/scsi/3w-sas.c tw_dev->host = host; tw_dev 1595 drivers/scsi/3w-sas.c tw_dev->tw_pci_dev = pdev; tw_dev 1597 drivers/scsi/3w-sas.c if (twl_initialize_device_extension(tw_dev)) { tw_dev 1598 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize device extension"); tw_dev 1606 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Failed to get mem region"); tw_dev 1611 drivers/scsi/3w-sas.c tw_dev->base_addr = pci_iomap(pdev, 1, 0); tw_dev 1612 drivers/scsi/3w-sas.c if (!tw_dev->base_addr) { tw_dev 1613 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap"); tw_dev 1619 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1622 drivers/scsi/3w-sas.c if (twl_reset_sequence(tw_dev, 0)) { tw_dev 1623 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset failed during probe"); tw_dev 1637 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1e, "scsi add host failed"); tw_dev 1645 drivers/scsi/3w-sas.c (char *)twl_get_param(tw_dev, 1, TW_VERSION_TABLE, tw_dev 1649 drivers/scsi/3w-sas.c ptr_phycount = twl_get_param(tw_dev, 2, TW_PARAM_PHY_SUMMARY_TABLE, tw_dev 1656 drivers/scsi/3w-sas.c (char *)twl_get_param(tw_dev, 1, TW_VERSION_TABLE, tw_dev 1658 drivers/scsi/3w-sas.c (char *)twl_get_param(tw_dev, 2, TW_VERSION_TABLE, tw_dev 1664 drivers/scsi/3w-sas.c set_bit(TW_USING_MSI, &tw_dev->flags); tw_dev 1667 drivers/scsi/3w-sas.c retval = request_irq(pdev->irq, twl_interrupt, IRQF_SHARED, "3w-sas", tw_dev); tw_dev 1669 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1f, "Error requesting IRQ"); tw_dev 1673 drivers/scsi/3w-sas.c twl_device_extension_list[twl_device_extension_count] = tw_dev; tw_dev 1677 drivers/scsi/3w-sas.c TWL_UNMASK_INTERRUPTS(tw_dev); tw_dev 1684 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x20, "Failed to create sysfs binary file: 3ware_aen_read"); tw_dev 1686 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x21, "Failed to create sysfs binary file: 3ware_compat_info"); tw_dev 1692 drivers/scsi/3w-sas.c tw_dev->online = 1; tw_dev 1696 drivers/scsi/3w-sas.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 1700 drivers/scsi/3w-sas.c iounmap(tw_dev->base_addr); tw_dev 1704 drivers/scsi/3w-sas.c twl_free_device_extension(tw_dev); tw_dev 1716 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev; tw_dev 1721 drivers/scsi/3w-sas.c tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 1723 drivers/scsi/3w-sas.c if (!tw_dev->online) tw_dev 1730 drivers/scsi/3w-sas.c scsi_remove_host(tw_dev->host); tw_dev 1739 drivers/scsi/3w-sas.c __twl_shutdown(tw_dev); tw_dev 1742 drivers/scsi/3w-sas.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 1746 drivers/scsi/3w-sas.c iounmap(tw_dev->base_addr); tw_dev 1752 drivers/scsi/3w-sas.c twl_free_device_extension(tw_dev); tw_dev 1754 drivers/scsi/3w-sas.c scsi_host_put(tw_dev->host); tw_dev 1764 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 1766 drivers/scsi/3w-sas.c printk(KERN_WARNING "3w-sas: Suspending host %d.\n", tw_dev->host->host_no); tw_dev 1768 drivers/scsi/3w-sas.c TWL_MASK_INTERRUPTS(tw_dev); tw_dev 1770 drivers/scsi/3w-sas.c free_irq(tw_dev->tw_pci_dev->irq, tw_dev); tw_dev 1773 drivers/scsi/3w-sas.c if (twl_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) { tw_dev 1774 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x23, "Connection shutdown failed during suspend"); tw_dev 1780 drivers/scsi/3w-sas.c TWL_CLEAR_DB_INTERRUPT(tw_dev); tw_dev 1794 drivers/scsi/3w-sas.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 1796 drivers/scsi/3w-sas.c printk(KERN_WARNING "3w-sas: Resuming host %d.\n", tw_dev->host->host_no); tw_dev 1803 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x24, "Enable device failed during resume"); tw_dev 1820 drivers/scsi/3w-sas.c if (twl_reset_sequence(tw_dev, 0)) { tw_dev 1826 drivers/scsi/3w-sas.c retval = request_irq(pdev->irq, twl_interrupt, IRQF_SHARED, "3w-sas", tw_dev); tw_dev 1828 drivers/scsi/3w-sas.c TW_PRINTK(tw_dev->host, TW_DRIVER, 0x26, "Error requesting IRQ during resume"); tw_dev 1834 drivers/scsi/3w-sas.c if (test_bit(TW_USING_MSI, &tw_dev->flags)) tw_dev 1838 drivers/scsi/3w-sas.c TWL_UNMASK_INTERRUPTS(tw_dev); tw_dev 185 drivers/scsi/3w-sas.h #define TWL_MASK_INTERRUPTS(x) (writel(~0, TWL_HIMASK_REG_ADDR(tw_dev))) tw_dev 186 drivers/scsi/3w-sas.h #define TWL_UNMASK_INTERRUPTS(x) (writel(~TWL_HISTATUS_VALID_INTERRUPT, TWL_HIMASK_REG_ADDR(tw_dev))) tw_dev 187 drivers/scsi/3w-sas.h #define TWL_CLEAR_DB_INTERRUPT(x) (writel(~0, TWL_HOBDBC_REG_ADDR(tw_dev))) tw_dev 188 drivers/scsi/3w-sas.h #define TWL_SOFT_RESET(x) (writel(TWL_ISSUE_SOFT_RESET, TWL_HIBDB_REG_ADDR(tw_dev))) tw_dev 235 drivers/scsi/3w-xxxx.c static int tw_reset_device_extension(TW_Device_Extension *tw_dev); tw_dev 255 drivers/scsi/3w-xxxx.c static int tw_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value, int print_host) tw_dev 262 drivers/scsi/3w-xxxx.c sprintf(host, " scsi%d:", tw_dev->host->host_no); tw_dev 268 drivers/scsi/3w-xxxx.c outl(TW_CONTROL_CLEAR_PARITY_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 273 drivers/scsi/3w-xxxx.c outl(TW_CONTROL_CLEAR_PCI_ABORT, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 274 drivers/scsi/3w-xxxx.c pci_write_config_word(tw_dev->tw_pci_dev, PCI_STATUS, TW_PCI_CLEAR_PCI_ABORT); tw_dev 279 drivers/scsi/3w-xxxx.c outl(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 284 drivers/scsi/3w-xxxx.c outl(TW_CONTROL_CLEAR_SBUF_WRITE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); tw_dev 288 drivers/scsi/3w-xxxx.c if (tw_dev->reset_print == 0) { tw_dev 290 drivers/scsi/3w-xxxx.c tw_dev->reset_print = 1; tw_dev 299 drivers/scsi/3w-xxxx.c static int tw_poll_status(TW_Device_Extension *tw_dev, u32 flag, int seconds) tw_dev 305 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 309 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 0); tw_dev 312 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 315 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 0); tw_dev 328 drivers/scsi/3w-xxxx.c static int tw_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int seconds) tw_dev 334 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 338 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 0); tw_dev 341 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 344 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 0); tw_dev 357 drivers/scsi/3w-xxxx.c static int tw_post_command_packet(TW_Device_Extension *tw_dev, int request_id) tw_dev 363 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 364 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 368 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 1); tw_dev 373 drivers/scsi/3w-xxxx.c outl(command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 374 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_POSTED; tw_dev 375 drivers/scsi/3w-xxxx.c tw_dev->posted_request_count++; tw_dev 376 drivers/scsi/3w-xxxx.c if (tw_dev->posted_request_count > tw_dev->max_posted_request_count) { tw_dev 377 drivers/scsi/3w-xxxx.c tw_dev->max_posted_request_count = tw_dev->posted_request_count; tw_dev 381 drivers/scsi/3w-xxxx.c if (tw_dev->state[request_id] != TW_S_PENDING) { tw_dev 382 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_PENDING; tw_dev 383 drivers/scsi/3w-xxxx.c tw_dev->pending_request_count++; tw_dev 384 drivers/scsi/3w-xxxx.c if (tw_dev->pending_request_count > tw_dev->max_pending_request_count) { tw_dev 385 drivers/scsi/3w-xxxx.c tw_dev->max_pending_request_count = tw_dev->pending_request_count; tw_dev 387 drivers/scsi/3w-xxxx.c tw_dev->pending_queue[tw_dev->pending_tail] = request_id; tw_dev 388 drivers/scsi/3w-xxxx.c if (tw_dev->pending_tail == TW_Q_LENGTH-1) { tw_dev 389 drivers/scsi/3w-xxxx.c tw_dev->pending_tail = TW_Q_START; tw_dev 391 drivers/scsi/3w-xxxx.c tw_dev->pending_tail = tw_dev->pending_tail + 1; tw_dev 394 drivers/scsi/3w-xxxx.c TW_UNMASK_COMMAND_INTERRUPT(tw_dev); tw_dev 401 drivers/scsi/3w-xxxx.c static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill_sense) tw_dev 407 drivers/scsi/3w-xxxx.c command = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 409 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Command failed: status = 0x%x, flags = 0x%x, unit #%d.\n", tw_dev->host->host_no, command->status, command->flags, TW_UNIT_OUT(command->unit__hostid)); tw_dev 418 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->sense_buffer[0] = (0x1 << 7 | 0x70); tw_dev 421 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->sense_buffer[2] = tw_sense_table[i][1]; tw_dev 424 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->sense_buffer[7] = 0xa; /* 10 bytes */ tw_dev 427 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->sense_buffer[12] = tw_sense_table[i][2]; tw_dev 430 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->sense_buffer[13] = tw_sense_table[i][3]; tw_dev 432 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1); tw_dev 446 drivers/scsi/3w-xxxx.c static int tw_check_errors(TW_Device_Extension *tw_dev) tw_dev 450 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 453 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 0); tw_dev 461 drivers/scsi/3w-xxxx.c static void tw_empty_response_que(TW_Device_Extension *tw_dev) tw_dev 465 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 468 drivers/scsi/3w-xxxx.c response_que_value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 469 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 474 drivers/scsi/3w-xxxx.c static void tw_state_request_finish(TW_Device_Extension *tw_dev, int request_id) tw_dev 476 drivers/scsi/3w-xxxx.c tw_dev->free_queue[tw_dev->free_tail] = request_id; tw_dev 477 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_FINISHED; tw_dev 478 drivers/scsi/3w-xxxx.c tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH; tw_dev 482 drivers/scsi/3w-xxxx.c static void tw_state_request_start(TW_Device_Extension *tw_dev, int *request_id) tw_dev 484 drivers/scsi/3w-xxxx.c *request_id = tw_dev->free_queue[tw_dev->free_head]; tw_dev 485 drivers/scsi/3w-xxxx.c tw_dev->free_head = (tw_dev->free_head + 1) % TW_Q_LENGTH; tw_dev 486 drivers/scsi/3w-xxxx.c tw_dev->state[*request_id] = TW_S_STARTED; tw_dev 494 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 498 drivers/scsi/3w-xxxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 511 drivers/scsi/3w-xxxx.c tw_dev->posted_request_count, tw_dev 512 drivers/scsi/3w-xxxx.c tw_dev->max_posted_request_count, tw_dev 513 drivers/scsi/3w-xxxx.c tw_dev->pending_request_count, tw_dev 514 drivers/scsi/3w-xxxx.c tw_dev->max_pending_request_count, tw_dev 515 drivers/scsi/3w-xxxx.c tw_dev->sgl_entries, tw_dev 516 drivers/scsi/3w-xxxx.c tw_dev->max_sgl_entries, tw_dev 517 drivers/scsi/3w-xxxx.c tw_dev->sector_count, tw_dev 518 drivers/scsi/3w-xxxx.c tw_dev->max_sector_count, tw_dev 519 drivers/scsi/3w-xxxx.c tw_dev->num_resets, tw_dev 520 drivers/scsi/3w-xxxx.c tw_dev->aen_count); tw_dev 521 drivers/scsi/3w-xxxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 541 drivers/scsi/3w-xxxx.c static int tw_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) tw_dev 551 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 554 drivers/scsi/3w-xxxx.c tw_decode_bits(tw_dev, status_reg_value, 1); tw_dev 557 drivers/scsi/3w-xxxx.c if (tw_dev->command_packet_virtual_address[request_id] == NULL) { tw_dev 561 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 569 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 575 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 579 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 584 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 595 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id] = NULL; /* Flag internal command */ tw_dev 596 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_POSTED; tw_dev 597 drivers/scsi/3w-xxxx.c outl(command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 607 drivers/scsi/3w-xxxx.c static int tw_aen_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 614 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 618 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 624 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: INFO: AEN queue overflow.\n", tw_dev->host->host_no); tw_dev 629 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s%d.\n", tw_dev->host->host_no, tw_aen_string[aen & 0xff], aen >> 8); tw_dev 632 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s.\n", tw_dev->host->host_no, tw_aen_string[aen & 0xff]); tw_dev 635 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Received AEN %d.\n", tw_dev->host->host_no, aen); tw_dev 639 drivers/scsi/3w-xxxx.c tw_dev->aen_count++; tw_dev 642 drivers/scsi/3w-xxxx.c tw_dev->aen_queue[tw_dev->aen_tail] = aen; tw_dev 643 drivers/scsi/3w-xxxx.c if (tw_dev->aen_tail == TW_Q_LENGTH - 1) { tw_dev 644 drivers/scsi/3w-xxxx.c tw_dev->aen_tail = TW_Q_START; tw_dev 646 drivers/scsi/3w-xxxx.c tw_dev->aen_tail = tw_dev->aen_tail + 1; tw_dev 648 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == tw_dev->aen_tail) { tw_dev 649 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == TW_Q_LENGTH - 1) { tw_dev 650 drivers/scsi/3w-xxxx.c tw_dev->aen_head = TW_Q_START; tw_dev 652 drivers/scsi/3w-xxxx.c tw_dev->aen_head = tw_dev->aen_head + 1; tw_dev 656 drivers/scsi/3w-xxxx.c error = tw_aen_read_queue(tw_dev, request_id); tw_dev 658 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing AEN.\n", tw_dev->host->host_no); tw_dev 659 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 660 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 663 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 664 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 671 drivers/scsi/3w-xxxx.c static int tw_aen_drain_queue(TW_Device_Extension *tw_dev) tw_dev 688 drivers/scsi/3w-xxxx.c if (tw_poll_status(tw_dev, TW_STATUS_ATTENTION_INTERRUPT | TW_STATUS_MICROCONTROLLER_READY, 30)) { tw_dev 692 drivers/scsi/3w-xxxx.c TW_CLEAR_ATTENTION_INTERRUPT(tw_dev); tw_dev 695 drivers/scsi/3w-xxxx.c tw_empty_response_que(tw_dev); tw_dev 698 drivers/scsi/3w-xxxx.c if (tw_dev->command_packet_virtual_address[request_id] == NULL) { tw_dev 702 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 710 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 717 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 721 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 726 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 737 drivers/scsi/3w-xxxx.c outl(command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 740 drivers/scsi/3w-xxxx.c if (tw_poll_status_gone(tw_dev, TW_STATUS_RESPONSE_QUEUE_EMPTY, 30) == 0) { tw_dev 741 drivers/scsi/3w-xxxx.c response_queue.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 753 drivers/scsi/3w-xxxx.c tw_decode_sense(tw_dev, request_id, 0); tw_dev 779 drivers/scsi/3w-xxxx.c tw_dev->aen_count++; tw_dev 797 drivers/scsi/3w-xxxx.c tw_dev->aen_count++; tw_dev 803 drivers/scsi/3w-xxxx.c tw_dev->aen_queue[tw_dev->aen_tail] = aen; tw_dev 804 drivers/scsi/3w-xxxx.c if (tw_dev->aen_tail == TW_Q_LENGTH - 1) { tw_dev 805 drivers/scsi/3w-xxxx.c tw_dev->aen_tail = TW_Q_START; tw_dev 807 drivers/scsi/3w-xxxx.c tw_dev->aen_tail = tw_dev->aen_tail + 1; tw_dev 809 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == tw_dev->aen_tail) { tw_dev 810 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == TW_Q_LENGTH - 1) { tw_dev 811 drivers/scsi/3w-xxxx.c tw_dev->aen_head = TW_Q_START; tw_dev 813 drivers/scsi/3w-xxxx.c tw_dev->aen_head = tw_dev->aen_head + 1; tw_dev 829 drivers/scsi/3w-xxxx.c static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) tw_dev 837 drivers/scsi/3w-xxxx.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 844 drivers/scsi/3w-xxxx.c if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) { tw_dev 846 drivers/scsi/3w-xxxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, tw_dev 856 drivers/scsi/3w-xxxx.c tw_dev->command_packet_physical_address[i] = dma_handle+(i*size); tw_dev 857 drivers/scsi/3w-xxxx.c tw_dev->command_packet_virtual_address[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)); tw_dev 860 drivers/scsi/3w-xxxx.c tw_dev->alignment_physical_address[i] = dma_handle+(i*size); tw_dev 861 drivers/scsi/3w-xxxx.c tw_dev->alignment_virtual_address[i] = (unsigned long *)((unsigned char *)cpu_addr + (i*size)); tw_dev 886 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = tw_device_extension_list[iminor(inode)]; tw_dev 894 drivers/scsi/3w-xxxx.c if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { tw_dev 913 drivers/scsi/3w-xxxx.c cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, &dma_handle, GFP_KERNEL); tw_dev 936 drivers/scsi/3w-xxxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 937 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == tw_dev->aen_tail) { tw_dev 940 drivers/scsi/3w-xxxx.c tw_aen_code = tw_dev->aen_queue[tw_dev->aen_head]; tw_dev 941 drivers/scsi/3w-xxxx.c if (tw_dev->aen_head == TW_Q_LENGTH - 1) { tw_dev 942 drivers/scsi/3w-xxxx.c tw_dev->aen_head = TW_Q_START; tw_dev 944 drivers/scsi/3w-xxxx.c tw_dev->aen_head = tw_dev->aen_head + 1; tw_dev 947 drivers/scsi/3w-xxxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 952 drivers/scsi/3w-xxxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 954 drivers/scsi/3w-xxxx.c tw_state_request_start(tw_dev, &request_id); tw_dev 957 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id] = NULL; tw_dev 960 drivers/scsi/3w-xxxx.c tw_dev->chrdev_request_id = request_id; tw_dev 980 drivers/scsi/3w-xxxx.c memcpy(tw_dev->command_packet_virtual_address[request_id], &(tw_ioctl->firmware_command), sizeof(TW_Command)); tw_dev 983 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 984 drivers/scsi/3w-xxxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 989 drivers/scsi/3w-xxxx.c timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); tw_dev 992 drivers/scsi/3w-xxxx.c if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { tw_dev 994 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Character ioctl (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, cmd); tw_dev 996 drivers/scsi/3w-xxxx.c if (tw_reset_device_extension(tw_dev)) { tw_dev 997 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): Reset failed for card %d.\n", tw_dev->host->host_no); tw_dev 1003 drivers/scsi/3w-xxxx.c memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virtual_address[request_id], sizeof(TW_Command)); tw_dev 1006 drivers/scsi/3w-xxxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 1007 drivers/scsi/3w-xxxx.c tw_dev->posted_request_count--; tw_dev 1008 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1009 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 1010 drivers/scsi/3w-xxxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 1023 drivers/scsi/3w-xxxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); tw_dev 1025 drivers/scsi/3w-xxxx.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 1061 drivers/scsi/3w-xxxx.c static void tw_free_device_extension(TW_Device_Extension *tw_dev) tw_dev 1066 drivers/scsi/3w-xxxx.c if (tw_dev->command_packet_virtual_address[0]) tw_dev 1067 drivers/scsi/3w-xxxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 1069 drivers/scsi/3w-xxxx.c tw_dev->command_packet_virtual_address[0], tw_dev 1070 drivers/scsi/3w-xxxx.c tw_dev->command_packet_physical_address[0]); tw_dev 1072 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[0]) tw_dev 1073 drivers/scsi/3w-xxxx.c dma_free_coherent(&tw_dev->tw_pci_dev->dev, tw_dev 1075 drivers/scsi/3w-xxxx.c tw_dev->alignment_virtual_address[0], tw_dev 1076 drivers/scsi/3w-xxxx.c tw_dev->alignment_physical_address[0]); tw_dev 1080 drivers/scsi/3w-xxxx.c static int tw_initconnection(TW_Device_Extension *tw_dev, int message_credits) tw_dev 1090 drivers/scsi/3w-xxxx.c if (tw_dev->command_packet_virtual_address[request_id] == NULL) { tw_dev 1095 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1104 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1112 drivers/scsi/3w-xxxx.c outl(command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 1115 drivers/scsi/3w-xxxx.c if (tw_poll_status_gone(tw_dev, TW_STATUS_RESPONSE_QUEUE_EMPTY, 30) == 0) { tw_dev 1116 drivers/scsi/3w-xxxx.c response_queue.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 1126 drivers/scsi/3w-xxxx.c tw_decode_sense(tw_dev, request_id, 0); tw_dev 1134 drivers/scsi/3w-xxxx.c static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size, tw_dev 1145 drivers/scsi/3w-xxxx.c if (tw_dev->command_packet_virtual_address[request_id] == NULL) { tw_dev 1149 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1151 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1159 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 1162 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1163 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 1164 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_OK << 16); tw_dev 1165 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); tw_dev 1174 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1181 drivers/scsi/3w-xxxx.c outl(command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); tw_dev 1184 drivers/scsi/3w-xxxx.c if (tw_poll_status_gone(tw_dev, TW_STATUS_RESPONSE_QUEUE_EMPTY, 30) == 0) { tw_dev 1185 drivers/scsi/3w-xxxx.c response_queue.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 1195 drivers/scsi/3w-xxxx.c tw_decode_sense(tw_dev, request_id, 0); tw_dev 1204 drivers/scsi/3w-xxxx.c static int tw_reset_sequence(TW_Device_Extension *tw_dev) tw_dev 1212 drivers/scsi/3w-xxxx.c TW_SOFT_RESET(tw_dev); tw_dev 1214 drivers/scsi/3w-xxxx.c error = tw_aen_drain_queue(tw_dev); tw_dev 1216 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: AEN drain failed, retrying.\n", tw_dev->host->host_no); tw_dev 1222 drivers/scsi/3w-xxxx.c if (tw_check_errors(tw_dev)) { tw_dev 1223 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Controller errors found, retrying.\n", tw_dev->host->host_no); tw_dev 1233 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Controller errors, card not responding, check all cabling.\n", tw_dev->host->host_no); tw_dev 1237 drivers/scsi/3w-xxxx.c error = tw_initconnection(tw_dev, TW_INIT_MESSAGE_CREDITS); tw_dev 1239 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Connection initialization failed.\n", tw_dev->host->host_no); tw_dev 1243 drivers/scsi/3w-xxxx.c error = tw_setfeature(tw_dev, 2, 1, &c); tw_dev 1252 drivers/scsi/3w-xxxx.c static int tw_initialize_device_extension(TW_Device_Extension *tw_dev) tw_dev 1259 drivers/scsi/3w-xxxx.c error = tw_allocate_memory(tw_dev, sizeof(TW_Command), 0); tw_dev 1266 drivers/scsi/3w-xxxx.c error = tw_allocate_memory(tw_dev, sizeof(TW_Sector), 1); tw_dev 1273 drivers/scsi/3w-xxxx.c tw_dev->free_queue[i] = i; tw_dev 1274 drivers/scsi/3w-xxxx.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1277 drivers/scsi/3w-xxxx.c tw_dev->pending_head = TW_Q_START; tw_dev 1278 drivers/scsi/3w-xxxx.c tw_dev->pending_tail = TW_Q_START; tw_dev 1279 drivers/scsi/3w-xxxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1281 drivers/scsi/3w-xxxx.c mutex_init(&tw_dev->ioctl_lock); tw_dev 1282 drivers/scsi/3w-xxxx.c init_waitqueue_head(&tw_dev->ioctl_wqueue); tw_dev 1288 drivers/scsi/3w-xxxx.c static int tw_reset_device_extension(TW_Device_Extension *tw_dev) tw_dev 1296 drivers/scsi/3w-xxxx.c set_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1297 drivers/scsi/3w-xxxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 1298 drivers/scsi/3w-xxxx.c TW_MASK_COMMAND_INTERRUPT(tw_dev); tw_dev 1299 drivers/scsi/3w-xxxx.c spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev 1303 drivers/scsi/3w-xxxx.c if ((tw_dev->state[i] != TW_S_FINISHED) && tw_dev 1304 drivers/scsi/3w-xxxx.c (tw_dev->state[i] != TW_S_INITIAL) && tw_dev 1305 drivers/scsi/3w-xxxx.c (tw_dev->state[i] != TW_S_COMPLETED)) { tw_dev 1306 drivers/scsi/3w-xxxx.c srb = tw_dev->srb[i]; tw_dev 1317 drivers/scsi/3w-xxxx.c tw_dev->free_queue[i] = i; tw_dev 1318 drivers/scsi/3w-xxxx.c tw_dev->state[i] = TW_S_INITIAL; tw_dev 1320 drivers/scsi/3w-xxxx.c tw_dev->free_head = TW_Q_START; tw_dev 1321 drivers/scsi/3w-xxxx.c tw_dev->free_tail = TW_Q_START; tw_dev 1322 drivers/scsi/3w-xxxx.c tw_dev->posted_request_count = 0; tw_dev 1323 drivers/scsi/3w-xxxx.c tw_dev->pending_request_count = 0; tw_dev 1324 drivers/scsi/3w-xxxx.c tw_dev->pending_head = TW_Q_START; tw_dev 1325 drivers/scsi/3w-xxxx.c tw_dev->pending_tail = TW_Q_START; tw_dev 1326 drivers/scsi/3w-xxxx.c tw_dev->reset_print = 0; tw_dev 1328 drivers/scsi/3w-xxxx.c spin_unlock_irqrestore(tw_dev->host->host_lock, flags); tw_dev 1330 drivers/scsi/3w-xxxx.c if (tw_reset_sequence(tw_dev)) { tw_dev 1331 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Reset sequence failed.\n", tw_dev->host->host_no); tw_dev 1335 drivers/scsi/3w-xxxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 1336 drivers/scsi/3w-xxxx.c clear_bit(TW_IN_RESET, &tw_dev->flags); tw_dev 1337 drivers/scsi/3w-xxxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 1347 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev; tw_dev 1350 drivers/scsi/3w-xxxx.c tw_dev = (TW_Device_Extension *)sdev->host->hostdata; tw_dev 1373 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev=NULL; tw_dev 1376 drivers/scsi/3w-xxxx.c tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1378 drivers/scsi/3w-xxxx.c tw_dev->num_resets++; tw_dev 1385 drivers/scsi/3w-xxxx.c mutex_lock(&tw_dev->ioctl_lock); tw_dev 1388 drivers/scsi/3w-xxxx.c if (tw_reset_device_extension(tw_dev)) { tw_dev 1389 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Reset failed.\n", tw_dev->host->host_no); tw_dev 1395 drivers/scsi/3w-xxxx.c mutex_unlock(&tw_dev->ioctl_lock); tw_dev 1400 drivers/scsi/3w-xxxx.c static int tw_scsiop_inquiry(TW_Device_Extension *tw_dev, int request_id) tw_dev 1410 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1424 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 1428 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1433 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 1441 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1448 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1453 drivers/scsi/3w-xxxx.c static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id, tw_dev 1456 drivers/scsi/3w-xxxx.c scsi_sg_copy_from_buffer(tw_dev->srb[request_id], data, len); tw_dev 1460 drivers/scsi/3w-xxxx.c static int tw_scsiop_inquiry_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 1474 drivers/scsi/3w-xxxx.c sprintf(&request_buffer[16], "Logical Disk %-2d ", tw_dev->srb[request_id]->device->id); tw_dev 1476 drivers/scsi/3w-xxxx.c tw_transfer_internal(tw_dev, request_id, request_buffer, tw_dev 1479 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1486 drivers/scsi/3w-xxxx.c if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) { tw_dev 1487 drivers/scsi/3w-xxxx.c tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1; tw_dev 1489 drivers/scsi/3w-xxxx.c tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0; tw_dev 1490 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16); tw_dev 1498 drivers/scsi/3w-xxxx.c static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id) tw_dev 1508 drivers/scsi/3w-xxxx.c if (tw_dev->srb[request_id]->cmnd[2] != 0x8) { tw_dev 1509 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1510 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 1511 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_OK << 16); tw_dev 1512 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); tw_dev 1517 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1533 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 1538 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1540 drivers/scsi/3w-xxxx.c param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + tw_dev->srb[request_id]->device->id; tw_dev 1543 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 1551 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1558 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1564 drivers/scsi/3w-xxxx.c static int tw_scsiop_mode_sense_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 1572 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1590 drivers/scsi/3w-xxxx.c tw_transfer_internal(tw_dev, request_id, request_buffer, tw_dev 1597 drivers/scsi/3w-xxxx.c static int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id) tw_dev 1607 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1617 drivers/scsi/3w-xxxx.c command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); tw_dev 1623 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 1627 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1630 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->device->id; tw_dev 1633 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 1641 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1648 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1654 drivers/scsi/3w-xxxx.c static int tw_scsiop_read_capacity_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 1664 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1691 drivers/scsi/3w-xxxx.c tw_transfer_internal(tw_dev, request_id, buff, sizeof(buff)); tw_dev 1697 drivers/scsi/3w-xxxx.c static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id) tw_dev 1708 drivers/scsi/3w-xxxx.c srb = tw_dev->srb[request_id]; tw_dev 1717 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1749 drivers/scsi/3w-xxxx.c tw_dev->sector_count = num_sectors; tw_dev 1750 drivers/scsi/3w-xxxx.c if (tw_dev->sector_count > tw_dev->max_sector_count) tw_dev 1751 drivers/scsi/3w-xxxx.c tw_dev->max_sector_count = tw_dev->sector_count; tw_dev 1761 drivers/scsi/3w-xxxx.c scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) { tw_dev 1768 drivers/scsi/3w-xxxx.c tw_dev->sgl_entries = scsi_sg_count(tw_dev->srb[request_id]); tw_dev 1769 drivers/scsi/3w-xxxx.c if (tw_dev->sgl_entries > tw_dev->max_sgl_entries) tw_dev 1770 drivers/scsi/3w-xxxx.c tw_dev->max_sgl_entries = tw_dev->sgl_entries; tw_dev 1772 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1779 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1785 drivers/scsi/3w-xxxx.c static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id) tw_dev 1795 drivers/scsi/3w-xxxx.c tw_transfer_internal(tw_dev, request_id, request_buffer, tw_dev 1798 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1799 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 1802 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_ERROR << 16); tw_dev 1803 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); tw_dev 1809 drivers/scsi/3w-xxxx.c static int tw_scsiop_synchronize_cache(TW_Device_Extension *tw_dev, int request_id) tw_dev 1817 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1828 drivers/scsi/3w-xxxx.c command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); tw_dev 1832 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1839 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1845 drivers/scsi/3w-xxxx.c static int tw_scsiop_test_unit_ready(TW_Device_Extension *tw_dev, int request_id) tw_dev 1855 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 1869 drivers/scsi/3w-xxxx.c if (tw_dev->alignment_virtual_address[request_id] == NULL) { tw_dev 1873 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1878 drivers/scsi/3w-xxxx.c param_value = tw_dev->alignment_physical_address[request_id]; tw_dev 1886 drivers/scsi/3w-xxxx.c command_que_value = tw_dev->command_packet_physical_address[request_id]; tw_dev 1893 drivers/scsi/3w-xxxx.c tw_post_command_packet(tw_dev, request_id); tw_dev 1899 drivers/scsi/3w-xxxx.c static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int request_id) tw_dev 1906 drivers/scsi/3w-xxxx.c param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; tw_dev 1913 drivers/scsi/3w-xxxx.c if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) { tw_dev 1914 drivers/scsi/3w-xxxx.c tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1; tw_dev 1916 drivers/scsi/3w-xxxx.c tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0; tw_dev 1917 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16); tw_dev 1930 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; tw_dev 1933 drivers/scsi/3w-xxxx.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) tw_dev 1940 drivers/scsi/3w-xxxx.c tw_state_request_start(tw_dev, &request_id); tw_dev 1943 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id] = SCpnt; tw_dev 1951 drivers/scsi/3w-xxxx.c retval = tw_scsiop_read_write(tw_dev, request_id); tw_dev 1955 drivers/scsi/3w-xxxx.c retval = tw_scsiop_test_unit_ready(tw_dev, request_id); tw_dev 1959 drivers/scsi/3w-xxxx.c retval = tw_scsiop_inquiry(tw_dev, request_id); tw_dev 1963 drivers/scsi/3w-xxxx.c retval = tw_scsiop_read_capacity(tw_dev, request_id); tw_dev 1967 drivers/scsi/3w-xxxx.c retval = tw_scsiop_request_sense(tw_dev, request_id); tw_dev 1971 drivers/scsi/3w-xxxx.c retval = tw_scsiop_mode_sense(tw_dev, request_id); tw_dev 1975 drivers/scsi/3w-xxxx.c retval = tw_scsiop_synchronize_cache(tw_dev, request_id); tw_dev 1981 drivers/scsi/3w-xxxx.c printk(KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n", tw_dev->host->host_no, *command); tw_dev 1982 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1983 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 1990 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 1991 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 2006 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)dev_instance; tw_dev 2013 drivers/scsi/3w-xxxx.c spin_lock(tw_dev->host->host_lock); tw_dev 2016 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 2025 drivers/scsi/3w-xxxx.c if (test_bit(TW_IN_RESET, &tw_dev->flags)) tw_dev 2031 drivers/scsi/3w-xxxx.c if (tw_decode_bits(tw_dev, status_reg_value, 1)) { tw_dev 2032 drivers/scsi/3w-xxxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 2040 drivers/scsi/3w-xxxx.c TW_CLEAR_HOST_INTERRUPT(tw_dev); tw_dev 2046 drivers/scsi/3w-xxxx.c TW_CLEAR_ATTENTION_INTERRUPT(tw_dev); tw_dev 2047 drivers/scsi/3w-xxxx.c tw_state_request_start(tw_dev, &request_id); tw_dev 2048 drivers/scsi/3w-xxxx.c error = tw_aen_read_queue(tw_dev, request_id); tw_dev 2050 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Error reading aen queue.\n", tw_dev->host->host_no); tw_dev 2051 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 2052 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 2059 drivers/scsi/3w-xxxx.c while (tw_dev->pending_request_count > 0) { tw_dev 2060 drivers/scsi/3w-xxxx.c request_id = tw_dev->pending_queue[tw_dev->pending_head]; tw_dev 2061 drivers/scsi/3w-xxxx.c if (tw_dev->state[request_id] != TW_S_PENDING) { tw_dev 2062 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Found request id that wasn't pending.\n", tw_dev->host->host_no); tw_dev 2065 drivers/scsi/3w-xxxx.c if (tw_post_command_packet(tw_dev, request_id)==0) { tw_dev 2066 drivers/scsi/3w-xxxx.c if (tw_dev->pending_head == TW_Q_LENGTH-1) { tw_dev 2067 drivers/scsi/3w-xxxx.c tw_dev->pending_head = TW_Q_START; tw_dev 2069 drivers/scsi/3w-xxxx.c tw_dev->pending_head = tw_dev->pending_head + 1; tw_dev 2071 drivers/scsi/3w-xxxx.c tw_dev->pending_request_count--; tw_dev 2078 drivers/scsi/3w-xxxx.c if (tw_dev->pending_request_count == 0) tw_dev 2079 drivers/scsi/3w-xxxx.c TW_MASK_COMMAND_INTERRUPT(tw_dev); tw_dev 2087 drivers/scsi/3w-xxxx.c response_que.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); tw_dev 2089 drivers/scsi/3w-xxxx.c command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; tw_dev 2095 drivers/scsi/3w-xxxx.c if (tw_dev->srb[request_id] == NULL) { tw_dev 2096 drivers/scsi/3w-xxxx.c tw_decode_sense(tw_dev, request_id, 0); tw_dev 2098 drivers/scsi/3w-xxxx.c error = tw_decode_sense(tw_dev, request_id, 1); tw_dev 2103 drivers/scsi/3w-xxxx.c if (tw_dev->state[request_id] != TW_S_POSTED) { tw_dev 2104 drivers/scsi/3w-xxxx.c if (tw_dev->srb[request_id] != NULL) { tw_dev 2105 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Received a request id that wasn't posted.\n", tw_dev->host->host_no); tw_dev 2113 drivers/scsi/3w-xxxx.c if (tw_dev->srb[request_id] == NULL) { tw_dev 2116 drivers/scsi/3w-xxxx.c if (request_id != tw_dev->chrdev_request_id) { tw_dev 2117 drivers/scsi/3w-xxxx.c retval = tw_aen_complete(tw_dev, request_id); tw_dev 2119 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing aen.\n", tw_dev->host->host_no); tw_dev 2122 drivers/scsi/3w-xxxx.c tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; tw_dev 2123 drivers/scsi/3w-xxxx.c wake_up(&tw_dev->ioctl_wqueue); tw_dev 2126 drivers/scsi/3w-xxxx.c switch (tw_dev->srb[request_id]->cmnd[0]) { tw_dev 2137 drivers/scsi/3w-xxxx.c error = tw_scsiop_test_unit_ready_complete(tw_dev, request_id); tw_dev 2141 drivers/scsi/3w-xxxx.c error = tw_scsiop_inquiry_complete(tw_dev, request_id); tw_dev 2145 drivers/scsi/3w-xxxx.c error = tw_scsiop_read_capacity_complete(tw_dev, request_id); tw_dev 2149 drivers/scsi/3w-xxxx.c error = tw_scsiop_mode_sense_complete(tw_dev, request_id); tw_dev 2161 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_OK << 16); tw_dev 2167 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1); tw_dev 2172 drivers/scsi/3w-xxxx.c scsi_dma_unmap(tw_dev->srb[request_id]); tw_dev 2173 drivers/scsi/3w-xxxx.c tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); tw_dev 2174 drivers/scsi/3w-xxxx.c tw_dev->state[request_id] = TW_S_COMPLETED; tw_dev 2175 drivers/scsi/3w-xxxx.c tw_state_request_finish(tw_dev, request_id); tw_dev 2176 drivers/scsi/3w-xxxx.c tw_dev->posted_request_count--; tw_dev 2181 drivers/scsi/3w-xxxx.c status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); tw_dev 2184 drivers/scsi/3w-xxxx.c if (tw_decode_bits(tw_dev, status_reg_value, 1)) { tw_dev 2185 drivers/scsi/3w-xxxx.c TW_CLEAR_ALL_INTERRUPTS(tw_dev); tw_dev 2193 drivers/scsi/3w-xxxx.c spin_unlock(tw_dev->host->host_lock); tw_dev 2198 drivers/scsi/3w-xxxx.c static void __tw_shutdown(TW_Device_Extension *tw_dev) tw_dev 2201 drivers/scsi/3w-xxxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 2204 drivers/scsi/3w-xxxx.c free_irq(tw_dev->tw_pci_dev->irq, tw_dev); tw_dev 2206 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: Shutting down host %d.\n", tw_dev->host->host_no); tw_dev 2209 drivers/scsi/3w-xxxx.c if (tw_initconnection(tw_dev, 1)) { tw_dev 2216 drivers/scsi/3w-xxxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 2223 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2225 drivers/scsi/3w-xxxx.c __tw_shutdown(tw_dev); tw_dev 2259 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev; tw_dev 2282 drivers/scsi/3w-xxxx.c tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2285 drivers/scsi/3w-xxxx.c tw_dev->host = host; tw_dev 2286 drivers/scsi/3w-xxxx.c tw_dev->tw_pci_dev = pdev; tw_dev 2288 drivers/scsi/3w-xxxx.c if (tw_initialize_device_extension(tw_dev)) { tw_dev 2302 drivers/scsi/3w-xxxx.c tw_dev->base_addr = pci_resource_start(pdev, 0); tw_dev 2303 drivers/scsi/3w-xxxx.c if (!tw_dev->base_addr) { tw_dev 2310 drivers/scsi/3w-xxxx.c TW_DISABLE_INTERRUPTS(tw_dev); tw_dev 2313 drivers/scsi/3w-xxxx.c if (tw_reset_sequence(tw_dev)) tw_dev 2333 drivers/scsi/3w-xxxx.c printk(KERN_WARNING "3w-xxxx: scsi%d: Found a 3ware Storage Controller at 0x%x, IRQ: %d.\n", host->host_no, tw_dev->base_addr, pdev->irq); tw_dev 2336 drivers/scsi/3w-xxxx.c retval = request_irq(pdev->irq, tw_interrupt, IRQF_SHARED, "3w-xxxx", tw_dev); tw_dev 2342 drivers/scsi/3w-xxxx.c tw_device_extension_list[tw_device_extension_count] = tw_dev; tw_dev 2346 drivers/scsi/3w-xxxx.c TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); tw_dev 2362 drivers/scsi/3w-xxxx.c tw_free_device_extension(tw_dev); tw_dev 2374 drivers/scsi/3w-xxxx.c TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; tw_dev 2376 drivers/scsi/3w-xxxx.c scsi_remove_host(tw_dev->host); tw_dev 2385 drivers/scsi/3w-xxxx.c __tw_shutdown(tw_dev); tw_dev 2391 drivers/scsi/3w-xxxx.c tw_free_device_extension(tw_dev); tw_dev 2393 drivers/scsi/3w-xxxx.c scsi_host_put(tw_dev->host);