diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/cciss.c | 163 |
1 files changed, 0 insertions, 163 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index f804542c1cf2..23c2910aa7bb 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -190,8 +190,6 @@ static void cciss_geometry_inquiry(int ctlr, int logvol, | |||
190 | static void __devinit cciss_interrupt_mode(ctlr_info_t *, struct pci_dev *, | 190 | static void __devinit cciss_interrupt_mode(ctlr_info_t *, struct pci_dev *, |
191 | __u32); | 191 | __u32); |
192 | static void start_io(ctlr_info_t *h); | 192 | static void start_io(ctlr_info_t *h); |
193 | static int sendcmd(__u8 cmd, int ctlr, void *buff, size_t size, | ||
194 | __u8 page_code, unsigned char *scsi3addr, int cmd_type); | ||
195 | static int sendcmd_withirq(__u8 cmd, int ctlr, void *buff, size_t size, | 193 | static int sendcmd_withirq(__u8 cmd, int ctlr, void *buff, size_t size, |
196 | __u8 page_code, unsigned char scsi3addr[], | 194 | __u8 page_code, unsigned char scsi3addr[], |
197 | int cmd_type); | 195 | int cmd_type); |
@@ -2808,167 +2806,6 @@ static int cciss_revalidate(struct gendisk *disk) | |||
2808 | } | 2806 | } |
2809 | 2807 | ||
2810 | /* | 2808 | /* |
2811 | * Wait polling for a command to complete. | ||
2812 | * The memory mapped FIFO is polled for the completion. | ||
2813 | * Used only at init time, interrupts from the HBA are disabled. | ||
2814 | */ | ||
2815 | static unsigned long pollcomplete(int ctlr) | ||
2816 | { | ||
2817 | unsigned long done; | ||
2818 | int i; | ||
2819 | |||
2820 | /* Wait (up to 20 seconds) for a command to complete */ | ||
2821 | |||
2822 | for (i = 20 * HZ; i > 0; i--) { | ||
2823 | done = hba[ctlr]->access.command_completed(hba[ctlr]); | ||
2824 | if (done == FIFO_EMPTY) | ||
2825 | schedule_timeout_uninterruptible(1); | ||
2826 | else | ||
2827 | return done; | ||
2828 | } | ||
2829 | /* Invalid address to tell caller we ran out of time */ | ||
2830 | return 1; | ||
2831 | } | ||
2832 | |||
2833 | /* Send command c to controller h and poll for it to complete. | ||
2834 | * Turns interrupts off on the board. Used at driver init time | ||
2835 | * and during SCSI error recovery. | ||
2836 | */ | ||
2837 | static int sendcmd_core(ctlr_info_t *h, CommandList_struct *c) | ||
2838 | { | ||
2839 | int i; | ||
2840 | unsigned long complete; | ||
2841 | int status = IO_ERROR; | ||
2842 | u64bit buff_dma_handle; | ||
2843 | |||
2844 | resend_cmd1: | ||
2845 | |||
2846 | /* Disable interrupt on the board. */ | ||
2847 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | ||
2848 | |||
2849 | /* Make sure there is room in the command FIFO */ | ||
2850 | /* Actually it should be completely empty at this time */ | ||
2851 | /* unless we are in here doing error handling for the scsi */ | ||
2852 | /* tape side of the driver. */ | ||
2853 | for (i = 200000; i > 0; i--) { | ||
2854 | /* if fifo isn't full go */ | ||
2855 | if (!(h->access.fifo_full(h))) | ||
2856 | break; | ||
2857 | udelay(10); | ||
2858 | printk(KERN_WARNING "cciss cciss%d: SendCmd FIFO full," | ||
2859 | " waiting!\n", h->ctlr); | ||
2860 | } | ||
2861 | h->access.submit_command(h, c); /* Send the cmd */ | ||
2862 | do { | ||
2863 | complete = pollcomplete(h->ctlr); | ||
2864 | |||
2865 | #ifdef CCISS_DEBUG | ||
2866 | printk(KERN_DEBUG "cciss: command completed\n"); | ||
2867 | #endif /* CCISS_DEBUG */ | ||
2868 | |||
2869 | if (complete == 1) { | ||
2870 | printk(KERN_WARNING | ||
2871 | "cciss cciss%d: SendCmd Timeout out, " | ||
2872 | "No command list address returned!\n", h->ctlr); | ||
2873 | status = IO_ERROR; | ||
2874 | break; | ||
2875 | } | ||
2876 | |||
2877 | /* Make sure it's the command we're expecting. */ | ||
2878 | if ((complete & ~CISS_ERROR_BIT) != c->busaddr) { | ||
2879 | printk(KERN_WARNING "cciss%d: Unexpected command " | ||
2880 | "completion.\n", h->ctlr); | ||
2881 | continue; | ||
2882 | } | ||
2883 | |||
2884 | /* It is our command. If no error, we're done. */ | ||
2885 | if (!(complete & CISS_ERROR_BIT)) { | ||
2886 | status = IO_OK; | ||
2887 | break; | ||
2888 | } | ||
2889 | |||
2890 | /* There is an error... */ | ||
2891 | |||
2892 | /* if data overrun or underun on Report command ignore it */ | ||
2893 | if (((c->Request.CDB[0] == CISS_REPORT_LOG) || | ||
2894 | (c->Request.CDB[0] == CISS_REPORT_PHYS) || | ||
2895 | (c->Request.CDB[0] == CISS_INQUIRY)) && | ||
2896 | ((c->err_info->CommandStatus == CMD_DATA_OVERRUN) || | ||
2897 | (c->err_info->CommandStatus == CMD_DATA_UNDERRUN))) { | ||
2898 | complete = c->busaddr; | ||
2899 | status = IO_OK; | ||
2900 | break; | ||
2901 | } | ||
2902 | |||
2903 | if (c->err_info->CommandStatus == CMD_UNSOLICITED_ABORT) { | ||
2904 | printk(KERN_WARNING "cciss%d: unsolicited abort %p\n", | ||
2905 | h->ctlr, c); | ||
2906 | if (c->retry_count < MAX_CMD_RETRIES) { | ||
2907 | printk(KERN_WARNING "cciss%d: retrying %p\n", | ||
2908 | h->ctlr, c); | ||
2909 | c->retry_count++; | ||
2910 | /* erase the old error information */ | ||
2911 | memset(c->err_info, 0, sizeof(c->err_info)); | ||
2912 | goto resend_cmd1; | ||
2913 | } | ||
2914 | printk(KERN_WARNING "cciss%d: retried %p too many " | ||
2915 | "times\n", h->ctlr, c); | ||
2916 | status = IO_ERROR; | ||
2917 | break; | ||
2918 | } | ||
2919 | |||
2920 | if (c->err_info->CommandStatus == CMD_UNABORTABLE) { | ||
2921 | printk(KERN_WARNING "cciss%d: command could not be " | ||
2922 | "aborted.\n", h->ctlr); | ||
2923 | status = IO_ERROR; | ||
2924 | break; | ||
2925 | } | ||
2926 | |||
2927 | if (c->err_info->CommandStatus == CMD_TARGET_STATUS) { | ||
2928 | status = check_target_status(h, c); | ||
2929 | break; | ||
2930 | } | ||
2931 | |||
2932 | printk(KERN_WARNING "cciss%d: sendcmd error\n", h->ctlr); | ||
2933 | printk(KERN_WARNING "cmd = 0x%02x, CommandStatus = 0x%02x\n", | ||
2934 | c->Request.CDB[0], c->err_info->CommandStatus); | ||
2935 | status = IO_ERROR; | ||
2936 | break; | ||
2937 | |||
2938 | } while (1); | ||
2939 | |||
2940 | /* unlock the data buffer from DMA */ | ||
2941 | buff_dma_handle.val32.lower = c->SG[0].Addr.lower; | ||
2942 | buff_dma_handle.val32.upper = c->SG[0].Addr.upper; | ||
2943 | pci_unmap_single(h->pdev, (dma_addr_t) buff_dma_handle.val, | ||
2944 | c->SG[0].Len, PCI_DMA_BIDIRECTIONAL); | ||
2945 | return status; | ||
2946 | } | ||
2947 | |||
2948 | /* | ||
2949 | * Send a command to the controller, and wait for it to complete. | ||
2950 | * Used at init time, and during SCSI error recovery. | ||
2951 | */ | ||
2952 | static int sendcmd(__u8 cmd, int ctlr, void *buff, size_t size, | ||
2953 | __u8 page_code, unsigned char *scsi3addr, int cmd_type) | ||
2954 | { | ||
2955 | CommandList_struct *c; | ||
2956 | int status; | ||
2957 | |||
2958 | c = cmd_alloc(hba[ctlr], 1); | ||
2959 | if (!c) { | ||
2960 | printk(KERN_WARNING "cciss: unable to get memory"); | ||
2961 | return IO_ERROR; | ||
2962 | } | ||
2963 | status = fill_cmd(c, cmd, ctlr, buff, size, page_code, | ||
2964 | scsi3addr, cmd_type); | ||
2965 | if (status == IO_OK) | ||
2966 | status = sendcmd_core(hba[ctlr], c); | ||
2967 | cmd_free(hba[ctlr], c, 1); | ||
2968 | return status; | ||
2969 | } | ||
2970 | |||
2971 | /* | ||
2972 | * Map (physical) PCI mem into (virtual) kernel space | 2809 | * Map (physical) PCI mem into (virtual) kernel space |
2973 | */ | 2810 | */ |
2974 | static void __iomem *remap_pci_mem(ulong base, ulong size) | 2811 | static void __iomem *remap_pci_mem(ulong base, ulong size) |