aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c314
1 files changed, 138 insertions, 176 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1dc95740b3bb..35a9f08cf74f 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -922,9 +922,6 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h)
922 return NULL; 922 return NULL;
923 } while (test_and_set_bit(i & (BITS_PER_LONG - 1), 923 } while (test_and_set_bit(i & (BITS_PER_LONG - 1),
924 h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0); 924 h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
925#ifdef CCISS_DEBUG
926 printk(KERN_DEBUG "cciss: using command buffer %d\n", i);
927#endif
928 c = h->cmd_pool + i; 925 c = h->cmd_pool + i;
929 memset(c, 0, sizeof(CommandList_struct)); 926 memset(c, 0, sizeof(CommandList_struct));
930 cmd_dma_handle = h->cmd_pool_dhandle + i * sizeof(CommandList_struct); 927 cmd_dma_handle = h->cmd_pool_dhandle + i * sizeof(CommandList_struct);
@@ -1026,10 +1023,7 @@ static int cciss_open(struct block_device *bdev, fmode_t mode)
1026 ctlr_info_t *h = get_host(bdev->bd_disk); 1023 ctlr_info_t *h = get_host(bdev->bd_disk);
1027 drive_info_struct *drv = get_drv(bdev->bd_disk); 1024 drive_info_struct *drv = get_drv(bdev->bd_disk);
1028 1025
1029#ifdef CCISS_DEBUG 1026 dev_dbg(&h->pdev->dev, "cciss_open %s\n", bdev->bd_disk->disk_name);
1030 printk(KERN_DEBUG "cciss_open %s\n", bdev->bd_disk->disk_name);
1031#endif /* CCISS_DEBUG */
1032
1033 if (drv->busy_configuring) 1027 if (drv->busy_configuring)
1034 return -EBUSY; 1028 return -EBUSY;
1035 /* 1029 /*
@@ -1081,11 +1075,7 @@ static int cciss_release(struct gendisk *disk, fmode_t mode)
1081 lock_kernel(); 1075 lock_kernel();
1082 h = get_host(disk); 1076 h = get_host(disk);
1083 drv = get_drv(disk); 1077 drv = get_drv(disk);
1084 1078 dev_dbg(&h->pdev->dev, "cciss_release %s\n", disk->disk_name);
1085#ifdef CCISS_DEBUG
1086 printk(KERN_DEBUG "cciss_release %s\n", disk->disk_name);
1087#endif /* CCISS_DEBUG */
1088
1089 drv->usage_count--; 1079 drv->usage_count--;
1090 h->usage_count--; 1080 h->usage_count--;
1091 unlock_kernel(); 1081 unlock_kernel();
@@ -1251,10 +1241,8 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
1251 drive_info_struct *drv = get_drv(disk); 1241 drive_info_struct *drv = get_drv(disk);
1252 void __user *argp = (void __user *)arg; 1242 void __user *argp = (void __user *)arg;
1253 1243
1254#ifdef CCISS_DEBUG 1244 dev_dbg(&h->pdev->dev, "cciss_ioctl: Called with cmd=%x %lx\n",
1255 printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg); 1245 cmd, arg);
1256#endif /* CCISS_DEBUG */
1257
1258 switch (cmd) { 1246 switch (cmd) {
1259 case CCISS_GETPCIINFO: 1247 case CCISS_GETPCIINFO:
1260 { 1248 {
@@ -1299,10 +1287,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
1299 (&intinfo, argp, sizeof(cciss_coalint_struct))) 1287 (&intinfo, argp, sizeof(cciss_coalint_struct)))
1300 return -EFAULT; 1288 return -EFAULT;
1301 if ((intinfo.delay == 0) && (intinfo.count == 0)) 1289 if ((intinfo.delay == 0) && (intinfo.count == 0))
1302 {
1303// printk("cciss_ioctl: delay and count cannot be 0\n");
1304 return -EINVAL; 1290 return -EINVAL;
1305 }
1306 spin_lock_irqsave(&h->lock, flags); 1291 spin_lock_irqsave(&h->lock, flags);
1307 /* Update the field, and then ring the doorbell */ 1292 /* Update the field, and then ring the doorbell */
1308 writel(intinfo.delay, 1293 writel(intinfo.delay,
@@ -1814,9 +1799,7 @@ static void cciss_softirq_done(struct request *rq)
1814 ++sg_index; 1799 ++sg_index;
1815 } 1800 }
1816 1801
1817#ifdef CCISS_DEBUG 1802 dev_dbg(&h->pdev->dev, "Done with %p\n", rq);
1818 printk("Done with %p\n", rq);
1819#endif /* CCISS_DEBUG */
1820 1803
1821 /* set the residual count for pc requests */ 1804 /* set the residual count for pc requests */
1822 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) 1805 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
@@ -2029,7 +2012,7 @@ static void cciss_update_drive_info(ctlr_info_t *h, int drv_index,
2029 * (unless it's the first disk (for the controller node). 2012 * (unless it's the first disk (for the controller node).
2030 */ 2013 */
2031 if (h->drv[drv_index]->raid_level != -1 && drv_index != 0) { 2014 if (h->drv[drv_index]->raid_level != -1 && drv_index != 0) {
2032 printk(KERN_WARNING "disk %d has changed.\n", drv_index); 2015 dev_warn(&h->pdev->dev, "disk %d has changed.\n", drv_index);
2033 spin_lock_irqsave(&h->lock, flags); 2016 spin_lock_irqsave(&h->lock, flags);
2034 h->drv[drv_index]->busy_configuring = 1; 2017 h->drv[drv_index]->busy_configuring = 1;
2035 spin_unlock_irqrestore(&h->lock, flags); 2018 spin_unlock_irqrestore(&h->lock, flags);
@@ -2082,8 +2065,8 @@ static void cciss_update_drive_info(ctlr_info_t *h, int drv_index,
2082 if (cciss_add_disk(h, disk, drv_index) != 0) { 2065 if (cciss_add_disk(h, disk, drv_index) != 0) {
2083 cciss_free_gendisk(h, drv_index); 2066 cciss_free_gendisk(h, drv_index);
2084 cciss_free_drive_info(h, drv_index); 2067 cciss_free_drive_info(h, drv_index);
2085 printk(KERN_WARNING "cciss:%d could not update " 2068 dev_warn(&h->pdev->dev, "could not update disk %d\n",
2086 "disk %d\n", h->ctlr, drv_index); 2069 drv_index);
2087 --h->num_luns; 2070 --h->num_luns;
2088 } 2071 }
2089 } 2072 }
@@ -2093,7 +2076,7 @@ freeret:
2093 kfree(drvinfo); 2076 kfree(drvinfo);
2094 return; 2077 return;
2095mem_msg: 2078mem_msg:
2096 printk(KERN_ERR "cciss: out of memory\n"); 2079 dev_err(&h->pdev->dev, "out of memory\n");
2097 goto freeret; 2080 goto freeret;
2098} 2081}
2099 2082
@@ -2185,9 +2168,9 @@ static int cciss_add_gendisk(ctlr_info_t *h, unsigned char lunid[],
2185 h->gendisk[drv_index] = 2168 h->gendisk[drv_index] =
2186 alloc_disk(1 << NWD_SHIFT); 2169 alloc_disk(1 << NWD_SHIFT);
2187 if (!h->gendisk[drv_index]) { 2170 if (!h->gendisk[drv_index]) {
2188 printk(KERN_ERR "cciss%d: could not " 2171 dev_err(&h->pdev->dev,
2189 "allocate a new disk %d\n", 2172 "could not allocate a new disk %d\n",
2190 h->ctlr, drv_index); 2173 drv_index);
2191 goto err_free_drive_info; 2174 goto err_free_drive_info;
2192 } 2175 }
2193 } 2176 }
@@ -2238,8 +2221,7 @@ static void cciss_add_controller_node(ctlr_info_t *h)
2238 cciss_free_gendisk(h, drv_index); 2221 cciss_free_gendisk(h, drv_index);
2239 cciss_free_drive_info(h, drv_index); 2222 cciss_free_drive_info(h, drv_index);
2240error: 2223error:
2241 printk(KERN_WARNING "cciss%d: could not " 2224 dev_warn(&h->pdev->dev, "could not add disk 0.\n");
2242 "add disk 0.\n", h->ctlr);
2243 return; 2225 return;
2244} 2226}
2245 2227
@@ -2287,8 +2269,8 @@ static int rebuild_lun_table(ctlr_info_t *h, int first_time,
2287 if (return_code == IO_OK) 2269 if (return_code == IO_OK)
2288 listlength = be32_to_cpu(*(__be32 *) ld_buff->LUNListLength); 2270 listlength = be32_to_cpu(*(__be32 *) ld_buff->LUNListLength);
2289 else { /* reading number of logical volumes failed */ 2271 else { /* reading number of logical volumes failed */
2290 printk(KERN_WARNING "cciss: report logical volume" 2272 dev_warn(&h->pdev->dev,
2291 " command failed\n"); 2273 "report logical volume command failed\n");
2292 listlength = 0; 2274 listlength = 0;
2293 goto freeret; 2275 goto freeret;
2294 } 2276 }
@@ -2296,7 +2278,7 @@ static int rebuild_lun_table(ctlr_info_t *h, int first_time,
2296 num_luns = listlength / 8; /* 8 bytes per entry */ 2278 num_luns = listlength / 8; /* 8 bytes per entry */
2297 if (num_luns > CISS_MAX_LUN) { 2279 if (num_luns > CISS_MAX_LUN) {
2298 num_luns = CISS_MAX_LUN; 2280 num_luns = CISS_MAX_LUN;
2299 printk(KERN_WARNING "cciss: more luns configured" 2281 dev_warn(&h->pdev->dev, "more luns configured"
2300 " on controller than can be handled by" 2282 " on controller than can be handled by"
2301 " this driver.\n"); 2283 " this driver.\n");
2302 } 2284 }
@@ -2380,7 +2362,7 @@ freeret:
2380 */ 2362 */
2381 return -1; 2363 return -1;
2382mem_msg: 2364mem_msg:
2383 printk(KERN_ERR "cciss: out of memory\n"); 2365 dev_err(&h->pdev->dev, "out of memory\n");
2384 h->busy_configuring = 0; 2366 h->busy_configuring = 0;
2385 goto freeret; 2367 goto freeret;
2386} 2368}
@@ -2587,9 +2569,7 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff,
2587 c->Request.Timeout = 0; 2569 c->Request.Timeout = 0;
2588 break; 2570 break;
2589 default: 2571 default:
2590 printk(KERN_WARNING 2572 dev_warn(&h->pdev->dev, "Unknown Command 0x%c\n", cmd);
2591 "cciss%d: Unknown Command 0x%c\n",
2592 h->ctlr, cmd);
2593 return IO_ERROR; 2573 return IO_ERROR;
2594 } 2574 }
2595 } else if (cmd_type == TYPE_MSG) { 2575 } else if (cmd_type == TYPE_MSG) {
@@ -2621,14 +2601,12 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff,
2621 c->Request.CDB[0] = cmd; 2601 c->Request.CDB[0] = cmd;
2622 break; 2602 break;
2623 default: 2603 default:
2624 printk(KERN_WARNING 2604 dev_warn(&h->pdev->dev,
2625 "cciss%d: unknown message type %d\n", 2605 "unknown message type %d\n", cmd);
2626 h->ctlr, cmd);
2627 return IO_ERROR; 2606 return IO_ERROR;
2628 } 2607 }
2629 } else { 2608 } else {
2630 printk(KERN_WARNING 2609 dev_warn(&h->pdev->dev, "unknown command type %d\n", cmd_type);
2631 "cciss%d: unknown command type %d\n", h->ctlr, cmd_type);
2632 return IO_ERROR; 2610 return IO_ERROR;
2633 } 2611 }
2634 /* Fill in the scatter gather information */ 2612 /* Fill in the scatter gather information */
@@ -2656,15 +2634,14 @@ static int check_target_status(ctlr_info_t *h, CommandList_struct *c)
2656 default: 2634 default:
2657 if (check_for_unit_attention(h, c)) 2635 if (check_for_unit_attention(h, c))
2658 return IO_NEEDS_RETRY; 2636 return IO_NEEDS_RETRY;
2659 printk(KERN_WARNING "cciss%d: cmd 0x%02x " 2637 dev_warn(&h->pdev->dev, "cmd 0x%02x "
2660 "check condition, sense key = 0x%02x\n", 2638 "check condition, sense key = 0x%02x\n",
2661 h->ctlr, c->Request.CDB[0], 2639 c->Request.CDB[0], c->err_info->SenseInfo[2]);
2662 c->err_info->SenseInfo[2]);
2663 } 2640 }
2664 break; 2641 break;
2665 default: 2642 default:
2666 printk(KERN_WARNING "cciss%d: cmd 0x%02x" 2643 dev_warn(&h->pdev->dev, "cmd 0x%02x"
2667 "scsi status = 0x%02x\n", h->ctlr, 2644 "scsi status = 0x%02x\n",
2668 c->Request.CDB[0], c->err_info->ScsiStatus); 2645 c->Request.CDB[0], c->err_info->ScsiStatus);
2669 break; 2646 break;
2670 } 2647 }
@@ -2687,43 +2664,42 @@ static int process_sendcmd_error(ctlr_info_t *h, CommandList_struct *c)
2687 /* expected for inquiry and report lun commands */ 2664 /* expected for inquiry and report lun commands */
2688 break; 2665 break;
2689 case CMD_INVALID: 2666 case CMD_INVALID:
2690 printk(KERN_WARNING "cciss: cmd 0x%02x is " 2667 dev_warn(&h->pdev->dev, "cmd 0x%02x is "
2691 "reported invalid\n", c->Request.CDB[0]); 2668 "reported invalid\n", c->Request.CDB[0]);
2692 return_status = IO_ERROR; 2669 return_status = IO_ERROR;
2693 break; 2670 break;
2694 case CMD_PROTOCOL_ERR: 2671 case CMD_PROTOCOL_ERR:
2695 printk(KERN_WARNING "cciss: cmd 0x%02x has " 2672 dev_warn(&h->pdev->dev, "cmd 0x%02x has "
2696 "protocol error \n", c->Request.CDB[0]); 2673 "protocol error\n", c->Request.CDB[0]);
2697 return_status = IO_ERROR; 2674 return_status = IO_ERROR;
2698 break; 2675 break;
2699 case CMD_HARDWARE_ERR: 2676 case CMD_HARDWARE_ERR:
2700 printk(KERN_WARNING "cciss: cmd 0x%02x had " 2677 dev_warn(&h->pdev->dev, "cmd 0x%02x had "
2701 " hardware error\n", c->Request.CDB[0]); 2678 " hardware error\n", c->Request.CDB[0]);
2702 return_status = IO_ERROR; 2679 return_status = IO_ERROR;
2703 break; 2680 break;
2704 case CMD_CONNECTION_LOST: 2681 case CMD_CONNECTION_LOST:
2705 printk(KERN_WARNING "cciss: cmd 0x%02x had " 2682 dev_warn(&h->pdev->dev, "cmd 0x%02x had "
2706 "connection lost\n", c->Request.CDB[0]); 2683 "connection lost\n", c->Request.CDB[0]);
2707 return_status = IO_ERROR; 2684 return_status = IO_ERROR;
2708 break; 2685 break;
2709 case CMD_ABORTED: 2686 case CMD_ABORTED:
2710 printk(KERN_WARNING "cciss: cmd 0x%02x was " 2687 dev_warn(&h->pdev->dev, "cmd 0x%02x was "
2711 "aborted\n", c->Request.CDB[0]); 2688 "aborted\n", c->Request.CDB[0]);
2712 return_status = IO_ERROR; 2689 return_status = IO_ERROR;
2713 break; 2690 break;
2714 case CMD_ABORT_FAILED: 2691 case CMD_ABORT_FAILED:
2715 printk(KERN_WARNING "cciss: cmd 0x%02x reports " 2692 dev_warn(&h->pdev->dev, "cmd 0x%02x reports "
2716 "abort failed\n", c->Request.CDB[0]); 2693 "abort failed\n", c->Request.CDB[0]);
2717 return_status = IO_ERROR; 2694 return_status = IO_ERROR;
2718 break; 2695 break;
2719 case CMD_UNSOLICITED_ABORT: 2696 case CMD_UNSOLICITED_ABORT:
2720 printk(KERN_WARNING 2697 dev_warn(&h->pdev->dev, "unsolicited abort 0x%02x\n",
2721 "cciss%d: unsolicited abort 0x%02x\n", h->ctlr,
2722 c->Request.CDB[0]); 2698 c->Request.CDB[0]);
2723 return_status = IO_NEEDS_RETRY; 2699 return_status = IO_NEEDS_RETRY;
2724 break; 2700 break;
2725 default: 2701 default:
2726 printk(KERN_WARNING "cciss: cmd 0x%02x returned " 2702 dev_warn(&h->pdev->dev, "cmd 0x%02x returned "
2727 "unknown status %x\n", c->Request.CDB[0], 2703 "unknown status %x\n", c->Request.CDB[0],
2728 c->err_info->CommandStatus); 2704 c->err_info->CommandStatus);
2729 return_status = IO_ERROR; 2705 return_status = IO_ERROR;
@@ -2751,7 +2727,7 @@ resend_cmd2:
2751 2727
2752 if (return_status == IO_NEEDS_RETRY && 2728 if (return_status == IO_NEEDS_RETRY &&
2753 c->retry_count < MAX_CMD_RETRIES) { 2729 c->retry_count < MAX_CMD_RETRIES) {
2754 printk(KERN_WARNING "cciss%d: retrying 0x%02x\n", h->ctlr, 2730 dev_warn(&h->pdev->dev, "retrying 0x%02x\n",
2755 c->Request.CDB[0]); 2731 c->Request.CDB[0]);
2756 c->retry_count++; 2732 c->retry_count++;
2757 /* erase the old error information */ 2733 /* erase the old error information */
@@ -2805,8 +2781,8 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
2805 sizeof(*inq_buff), 0xC1, scsi3addr, TYPE_CMD); 2781 sizeof(*inq_buff), 0xC1, scsi3addr, TYPE_CMD);
2806 if (return_code == IO_OK) { 2782 if (return_code == IO_OK) {
2807 if (inq_buff->data_byte[8] == 0xFF) { 2783 if (inq_buff->data_byte[8] == 0xFF) {
2808 printk(KERN_WARNING 2784 dev_warn(&h->pdev->dev,
2809 "cciss: reading geometry failed, volume " 2785 "reading geometry failed, volume "
2810 "does not support reading geometry\n"); 2786 "does not support reading geometry\n");
2811 drv->heads = 255; 2787 drv->heads = 255;
2812 drv->sectors = 32; /* Sectors per track */ 2788 drv->sectors = 32; /* Sectors per track */
@@ -2830,7 +2806,7 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
2830 drv->cylinders = real_size; 2806 drv->cylinders = real_size;
2831 } 2807 }
2832 } else { /* Get geometry failed */ 2808 } else { /* Get geometry failed */
2833 printk(KERN_WARNING "cciss: reading geometry failed\n"); 2809 dev_warn(&h->pdev->dev, "reading geometry failed\n");
2834 } 2810 }
2835} 2811}
2836 2812
@@ -2844,7 +2820,7 @@ cciss_read_capacity(ctlr_info_t *h, int logvol, sector_t *total_size,
2844 2820
2845 buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); 2821 buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
2846 if (!buf) { 2822 if (!buf) {
2847 printk(KERN_WARNING "cciss: out of memory\n"); 2823 dev_warn(&h->pdev->dev, "out of memory\n");
2848 return; 2824 return;
2849 } 2825 }
2850 2826
@@ -2855,7 +2831,7 @@ cciss_read_capacity(ctlr_info_t *h, int logvol, sector_t *total_size,
2855 *total_size = be32_to_cpu(*(__be32 *) buf->total_size); 2831 *total_size = be32_to_cpu(*(__be32 *) buf->total_size);
2856 *block_size = be32_to_cpu(*(__be32 *) buf->block_size); 2832 *block_size = be32_to_cpu(*(__be32 *) buf->block_size);
2857 } else { /* read capacity command failed */ 2833 } else { /* read capacity command failed */
2858 printk(KERN_WARNING "cciss: read capacity failed\n"); 2834 dev_warn(&h->pdev->dev, "read capacity failed\n");
2859 *total_size = 0; 2835 *total_size = 0;
2860 *block_size = BLOCK_SIZE; 2836 *block_size = BLOCK_SIZE;
2861 } 2837 }
@@ -2871,7 +2847,7 @@ static void cciss_read_capacity_16(ctlr_info_t *h, int logvol,
2871 2847
2872 buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); 2848 buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
2873 if (!buf) { 2849 if (!buf) {
2874 printk(KERN_WARNING "cciss: out of memory\n"); 2850 dev_warn(&h->pdev->dev, "out of memory\n");
2875 return; 2851 return;
2876 } 2852 }
2877 2853
@@ -2883,11 +2859,11 @@ static void cciss_read_capacity_16(ctlr_info_t *h, int logvol,
2883 *total_size = be64_to_cpu(*(__be64 *) buf->total_size); 2859 *total_size = be64_to_cpu(*(__be64 *) buf->total_size);
2884 *block_size = be32_to_cpu(*(__be32 *) buf->block_size); 2860 *block_size = be32_to_cpu(*(__be32 *) buf->block_size);
2885 } else { /* read capacity command failed */ 2861 } else { /* read capacity command failed */
2886 printk(KERN_WARNING "cciss: read capacity failed\n"); 2862 dev_warn(&h->pdev->dev, "read capacity failed\n");
2887 *total_size = 0; 2863 *total_size = 0;
2888 *block_size = BLOCK_SIZE; 2864 *block_size = BLOCK_SIZE;
2889 } 2865 }
2890 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2866 dev_info(&h->pdev->dev, " blocks= %llu block_size= %d\n",
2891 (unsigned long long)*total_size+1, *block_size); 2867 (unsigned long long)*total_size+1, *block_size);
2892 kfree(buf); 2868 kfree(buf);
2893} 2869}
@@ -2915,7 +2891,7 @@ static int cciss_revalidate(struct gendisk *disk)
2915 2891
2916 inq_buff = kmalloc(sizeof(InquiryData_struct), GFP_KERNEL); 2892 inq_buff = kmalloc(sizeof(InquiryData_struct), GFP_KERNEL);
2917 if (inq_buff == NULL) { 2893 if (inq_buff == NULL) {
2918 printk(KERN_WARNING "cciss: out of memory\n"); 2894 dev_warn(&h->pdev->dev, "out of memory\n");
2919 return 1; 2895 return 1;
2920 } 2896 }
2921 if (h->cciss_read == CCISS_READ_10) { 2897 if (h->cciss_read == CCISS_READ_10) {
@@ -2959,7 +2935,7 @@ static void start_io(ctlr_info_t *h)
2959 c = hlist_entry(h->reqQ.first, CommandList_struct, list); 2935 c = hlist_entry(h->reqQ.first, CommandList_struct, list);
2960 /* can't do anything if fifo is full */ 2936 /* can't do anything if fifo is full */
2961 if ((h->access.fifo_full(h))) { 2937 if ((h->access.fifo_full(h))) {
2962 printk(KERN_WARNING "cciss: fifo full\n"); 2938 dev_warn(&h->pdev->dev, "fifo full\n");
2963 break; 2939 break;
2964 } 2940 }
2965 2941
@@ -3026,7 +3002,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
3026 3002
3027 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) { 3003 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) {
3028 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC) 3004 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC)
3029 printk(KERN_WARNING "cciss: cmd %p " 3005 dev_warn(&h->pdev->dev, "cmd %p "
3030 "has SCSI Status 0x%x\n", 3006 "has SCSI Status 0x%x\n",
3031 cmd, cmd->err_info->ScsiStatus); 3007 cmd, cmd->err_info->ScsiStatus);
3032 return error_value; 3008 return error_value;
@@ -3047,7 +3023,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
3047 /* Not SG_IO or similar? */ 3023 /* Not SG_IO or similar? */
3048 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC) { 3024 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC) {
3049 if (error_value != 0) 3025 if (error_value != 0)
3050 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" 3026 dev_warn(&h->pdev->dev, "cmd %p has CHECK CONDITION"
3051 " sense key = 0x%x\n", cmd, sense_key); 3027 " sense key = 0x%x\n", cmd, sense_key);
3052 return error_value; 3028 return error_value;
3053 } 3029 }
@@ -3088,7 +3064,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3088 break; 3064 break;
3089 case CMD_DATA_UNDERRUN: 3065 case CMD_DATA_UNDERRUN:
3090 if (cmd->rq->cmd_type == REQ_TYPE_FS) { 3066 if (cmd->rq->cmd_type == REQ_TYPE_FS) {
3091 printk(KERN_WARNING "cciss: cmd %p has" 3067 dev_warn(&h->pdev->dev, "cmd %p has"
3092 " completed with data underrun " 3068 " completed with data underrun "
3093 "reported\n", cmd); 3069 "reported\n", cmd);
3094 cmd->rq->resid_len = cmd->err_info->ResidualCnt; 3070 cmd->rq->resid_len = cmd->err_info->ResidualCnt;
@@ -3096,12 +3072,12 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3096 break; 3072 break;
3097 case CMD_DATA_OVERRUN: 3073 case CMD_DATA_OVERRUN:
3098 if (cmd->rq->cmd_type == REQ_TYPE_FS) 3074 if (cmd->rq->cmd_type == REQ_TYPE_FS)
3099 printk(KERN_WARNING "cciss: cmd %p has" 3075 dev_warn(&h->pdev->dev, "cciss: cmd %p has"
3100 " completed with data overrun " 3076 " completed with data overrun "
3101 "reported\n", cmd); 3077 "reported\n", cmd);
3102 break; 3078 break;
3103 case CMD_INVALID: 3079 case CMD_INVALID:
3104 printk(KERN_WARNING "cciss: cmd %p is " 3080 dev_warn(&h->pdev->dev, "cciss: cmd %p is "
3105 "reported invalid\n", cmd); 3081 "reported invalid\n", cmd);
3106 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3082 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3107 cmd->err_info->CommandStatus, DRIVER_OK, 3083 cmd->err_info->CommandStatus, DRIVER_OK,
@@ -3109,15 +3085,15 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3109 DID_PASSTHROUGH : DID_ERROR); 3085 DID_PASSTHROUGH : DID_ERROR);
3110 break; 3086 break;
3111 case CMD_PROTOCOL_ERR: 3087 case CMD_PROTOCOL_ERR:
3112 printk(KERN_WARNING "cciss: cmd %p has " 3088 dev_warn(&h->pdev->dev, "cciss: cmd %p has "
3113 "protocol error \n", cmd); 3089 "protocol error\n", cmd);
3114 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3090 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3115 cmd->err_info->CommandStatus, DRIVER_OK, 3091 cmd->err_info->CommandStatus, DRIVER_OK,
3116 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ? 3092 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3117 DID_PASSTHROUGH : DID_ERROR); 3093 DID_PASSTHROUGH : DID_ERROR);
3118 break; 3094 break;
3119 case CMD_HARDWARE_ERR: 3095 case CMD_HARDWARE_ERR:
3120 printk(KERN_WARNING "cciss: cmd %p had " 3096 dev_warn(&h->pdev->dev, "cciss: cmd %p had "
3121 " hardware error\n", cmd); 3097 " hardware error\n", cmd);
3122 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3098 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3123 cmd->err_info->CommandStatus, DRIVER_OK, 3099 cmd->err_info->CommandStatus, DRIVER_OK,
@@ -3125,7 +3101,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3125 DID_PASSTHROUGH : DID_ERROR); 3101 DID_PASSTHROUGH : DID_ERROR);
3126 break; 3102 break;
3127 case CMD_CONNECTION_LOST: 3103 case CMD_CONNECTION_LOST:
3128 printk(KERN_WARNING "cciss: cmd %p had " 3104 dev_warn(&h->pdev->dev, "cciss: cmd %p had "
3129 "connection lost\n", cmd); 3105 "connection lost\n", cmd);
3130 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3106 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3131 cmd->err_info->CommandStatus, DRIVER_OK, 3107 cmd->err_info->CommandStatus, DRIVER_OK,
@@ -3133,7 +3109,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3133 DID_PASSTHROUGH : DID_ERROR); 3109 DID_PASSTHROUGH : DID_ERROR);
3134 break; 3110 break;
3135 case CMD_ABORTED: 3111 case CMD_ABORTED:
3136 printk(KERN_WARNING "cciss: cmd %p was " 3112 dev_warn(&h->pdev->dev, "cciss: cmd %p was "
3137 "aborted\n", cmd); 3113 "aborted\n", cmd);
3138 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3114 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3139 cmd->err_info->CommandStatus, DRIVER_OK, 3115 cmd->err_info->CommandStatus, DRIVER_OK,
@@ -3141,7 +3117,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3141 DID_PASSTHROUGH : DID_ABORT); 3117 DID_PASSTHROUGH : DID_ABORT);
3142 break; 3118 break;
3143 case CMD_ABORT_FAILED: 3119 case CMD_ABORT_FAILED:
3144 printk(KERN_WARNING "cciss: cmd %p reports " 3120 dev_warn(&h->pdev->dev, "cciss: cmd %p reports "
3145 "abort failed\n", cmd); 3121 "abort failed\n", cmd);
3146 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3122 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3147 cmd->err_info->CommandStatus, DRIVER_OK, 3123 cmd->err_info->CommandStatus, DRIVER_OK,
@@ -3149,31 +3125,29 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3149 DID_PASSTHROUGH : DID_ERROR); 3125 DID_PASSTHROUGH : DID_ERROR);
3150 break; 3126 break;
3151 case CMD_UNSOLICITED_ABORT: 3127 case CMD_UNSOLICITED_ABORT:
3152 printk(KERN_WARNING "cciss%d: unsolicited " 3128 dev_warn(&h->pdev->dev, "cciss%d: unsolicited "
3153 "abort %p\n", h->ctlr, cmd); 3129 "abort %p\n", h->ctlr, cmd);
3154 if (cmd->retry_count < MAX_CMD_RETRIES) { 3130 if (cmd->retry_count < MAX_CMD_RETRIES) {
3155 retry_cmd = 1; 3131 retry_cmd = 1;
3156 printk(KERN_WARNING 3132 dev_warn(&h->pdev->dev, "retrying %p\n", cmd);
3157 "cciss%d: retrying %p\n", h->ctlr, cmd);
3158 cmd->retry_count++; 3133 cmd->retry_count++;
3159 } else 3134 } else
3160 printk(KERN_WARNING 3135 dev_warn(&h->pdev->dev,
3161 "cciss%d: %p retried too " 3136 "%p retried too many times\n", cmd);
3162 "many times\n", h->ctlr, cmd);
3163 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3137 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3164 cmd->err_info->CommandStatus, DRIVER_OK, 3138 cmd->err_info->CommandStatus, DRIVER_OK,
3165 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ? 3139 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3166 DID_PASSTHROUGH : DID_ABORT); 3140 DID_PASSTHROUGH : DID_ABORT);
3167 break; 3141 break;
3168 case CMD_TIMEOUT: 3142 case CMD_TIMEOUT:
3169 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); 3143 dev_warn(&h->pdev->dev, "cmd %p timedout\n", cmd);
3170 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3144 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3171 cmd->err_info->CommandStatus, DRIVER_OK, 3145 cmd->err_info->CommandStatus, DRIVER_OK,
3172 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ? 3146 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3173 DID_PASSTHROUGH : DID_ERROR); 3147 DID_PASSTHROUGH : DID_ERROR);
3174 break; 3148 break;
3175 default: 3149 default:
3176 printk(KERN_WARNING "cciss: cmd %p returned " 3150 dev_warn(&h->pdev->dev, "cmd %p returned "
3177 "unknown status %x\n", cmd, 3151 "unknown status %x\n", cmd,
3178 cmd->err_info->CommandStatus); 3152 cmd->err_info->CommandStatus);
3179 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3153 rq->errors = make_status_bytes(SAM_STAT_GOOD,
@@ -3282,11 +3256,8 @@ static void do_cciss_request(struct request_queue *q)
3282 c->Request.CDB[0] = 3256 c->Request.CDB[0] =
3283 (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; 3257 (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write;
3284 start_blk = blk_rq_pos(creq); 3258 start_blk = blk_rq_pos(creq);
3285#ifdef CCISS_DEBUG 3259 dev_dbg(&h->pdev->dev, "sector =%d nr_sectors=%d\n",
3286 printk(KERN_DEBUG "ciss: sector =%d nr_sectors=%d\n",
3287 (int)blk_rq_pos(creq), (int)blk_rq_sectors(creq)); 3260 (int)blk_rq_pos(creq), (int)blk_rq_sectors(creq));
3288#endif /* CCISS_DEBUG */
3289
3290 sg_init_table(tmp_sg, h->maxsgentries); 3261 sg_init_table(tmp_sg, h->maxsgentries);
3291 seg = blk_rq_map_sg(q, creq, tmp_sg); 3262 seg = blk_rq_map_sg(q, creq, tmp_sg);
3292 3263
@@ -3326,11 +3297,9 @@ static void do_cciss_request(struct request_queue *q)
3326 if (seg > h->maxSG) 3297 if (seg > h->maxSG)
3327 h->maxSG = seg; 3298 h->maxSG = seg;
3328 3299
3329#ifdef CCISS_DEBUG 3300 dev_dbg(&h->pdev->dev, "Submitting %u sectors in %d segments "
3330 printk(KERN_DEBUG "cciss: Submitting %ld sectors in %d segments "
3331 "chained[%d]\n", 3301 "chained[%d]\n",
3332 blk_rq_sectors(creq), seg, chained); 3302 blk_rq_sectors(creq), seg, chained);
3333#endif /* CCISS_DEBUG */
3334 3303
3335 c->Header.SGTotal = seg + chained; 3304 c->Header.SGTotal = seg + chained;
3336 if (seg <= h->max_cmd_sgentries) 3305 if (seg <= h->max_cmd_sgentries)
@@ -3373,7 +3342,8 @@ static void do_cciss_request(struct request_queue *q)
3373 c->Request.CDBLen = creq->cmd_len; 3342 c->Request.CDBLen = creq->cmd_len;
3374 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB); 3343 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB);
3375 } else { 3344 } else {
3376 printk(KERN_WARNING "cciss%d: bad request type %d\n", h->ctlr, creq->cmd_type); 3345 dev_warn(&h->pdev->dev, "bad request type %d\n",
3346 creq->cmd_type);
3377 BUG(); 3347 BUG();
3378 } 3348 }
3379 3349
@@ -3675,18 +3645,17 @@ static int check_for_unit_attention(ctlr_info_t *h, CommandList_struct *c)
3675 3645
3676 switch (c->err_info->SenseInfo[12]) { 3646 switch (c->err_info->SenseInfo[12]) {
3677 case STATE_CHANGED: 3647 case STATE_CHANGED:
3678 printk(KERN_WARNING "cciss%d: a state change " 3648 dev_warn(&h->pdev->dev, "a state change "
3679 "detected, command retried\n", h->ctlr); 3649 "detected, command retried\n");
3680 return 1; 3650 return 1;
3681 break; 3651 break;
3682 case LUN_FAILED: 3652 case LUN_FAILED:
3683 printk(KERN_WARNING "cciss%d: LUN failure " 3653 dev_warn(&h->pdev->dev, "LUN failure "
3684 "detected, action required\n", h->ctlr); 3654 "detected, action required\n");
3685 return 1; 3655 return 1;
3686 break; 3656 break;
3687 case REPORT_LUNS_CHANGED: 3657 case REPORT_LUNS_CHANGED:
3688 printk(KERN_WARNING "cciss%d: report LUN data " 3658 dev_warn(&h->pdev->dev, "report LUN data changed\n");
3689 "changed\n", h->ctlr);
3690 /* 3659 /*
3691 * Here, we could call add_to_scan_list and wake up the scan thread, 3660 * Here, we could call add_to_scan_list and wake up the scan thread,
3692 * except that it's quite likely that we will get more than one 3661 * except that it's quite likely that we will get more than one
@@ -3706,19 +3675,18 @@ static int check_for_unit_attention(ctlr_info_t *h, CommandList_struct *c)
3706 return 1; 3675 return 1;
3707 break; 3676 break;
3708 case POWER_OR_RESET: 3677 case POWER_OR_RESET:
3709 printk(KERN_WARNING "cciss%d: a power on " 3678 dev_warn(&h->pdev->dev,
3710 "or device reset detected\n", h->ctlr); 3679 "a power on or device reset detected\n");
3711 return 1; 3680 return 1;
3712 break; 3681 break;
3713 case UNIT_ATTENTION_CLEARED: 3682 case UNIT_ATTENTION_CLEARED:
3714 printk(KERN_WARNING "cciss%d: unit attention " 3683 dev_warn(&h->pdev->dev,
3715 "cleared by another initiator\n", h->ctlr); 3684 "unit attention cleared by another initiator\n");
3716 return 1; 3685 return 1;
3717 break; 3686 break;
3718 default: 3687 default:
3719 printk(KERN_WARNING "cciss%d: unknown " 3688 dev_warn(&h->pdev->dev, "unknown unit attention detected\n");
3720 "unit attention detected\n", h->ctlr); 3689 return 1;
3721 return 1;
3722 } 3690 }
3723} 3691}
3724 3692
@@ -3727,38 +3695,40 @@ static int check_for_unit_attention(ctlr_info_t *h, CommandList_struct *c)
3727 * the io functions. 3695 * the io functions.
3728 * This is for debug only. 3696 * This is for debug only.
3729 */ 3697 */
3730static void print_cfg_table(CfgTable_struct *tb) 3698static void print_cfg_table(ctlr_info_t *h)
3731{ 3699{
3732#ifdef CCISS_DEBUG
3733 int i; 3700 int i;
3734 char temp_name[17]; 3701 char temp_name[17];
3702 CfgTable_struct *tb = h->cfgtable;
3735 3703
3736 printk("Controller Configuration information\n"); 3704 dev_dbg(&h->pdev->dev, "Controller Configuration information\n");
3737 printk("------------------------------------\n"); 3705 dev_dbg(&h->pdev->dev, "------------------------------------\n");
3738 for (i = 0; i < 4; i++) 3706 for (i = 0; i < 4; i++)
3739 temp_name[i] = readb(&(tb->Signature[i])); 3707 temp_name[i] = readb(&(tb->Signature[i]));
3740 temp_name[4] = '\0'; 3708 temp_name[4] = '\0';
3741 printk(" Signature = %s\n", temp_name); 3709 dev_dbg(&h->pdev->dev, " Signature = %s\n", temp_name);
3742 printk(" Spec Number = %d\n", readl(&(tb->SpecValence))); 3710 dev_dbg(&h->pdev->dev, " Spec Number = %d\n",
3743 printk(" Transport methods supported = 0x%x\n", 3711 readl(&(tb->SpecValence)));
3712 dev_dbg(&h->pdev->dev, " Transport methods supported = 0x%x\n",
3744 readl(&(tb->TransportSupport))); 3713 readl(&(tb->TransportSupport)));
3745 printk(" Transport methods active = 0x%x\n", 3714 dev_dbg(&h->pdev->dev, " Transport methods active = 0x%x\n",
3746 readl(&(tb->TransportActive))); 3715 readl(&(tb->TransportActive)));
3747 printk(" Requested transport Method = 0x%x\n", 3716 dev_dbg(&h->pdev->dev, " Requested transport Method = 0x%x\n",
3748 readl(&(tb->HostWrite.TransportRequest))); 3717 readl(&(tb->HostWrite.TransportRequest)));
3749 printk(" Coalesce Interrupt Delay = 0x%x\n", 3718 dev_dbg(&h->pdev->dev, " Coalesce Interrupt Delay = 0x%x\n",
3750 readl(&(tb->HostWrite.CoalIntDelay))); 3719 readl(&(tb->HostWrite.CoalIntDelay)));
3751 printk(" Coalesce Interrupt Count = 0x%x\n", 3720 dev_dbg(&h->pdev->dev, " Coalesce Interrupt Count = 0x%x\n",
3752 readl(&(tb->HostWrite.CoalIntCount))); 3721 readl(&(tb->HostWrite.CoalIntCount)));
3753 printk(" Max outstanding commands = 0x%d\n", 3722 dev_dbg(&h->pdev->dev, " Max outstanding commands = 0x%d\n",
3754 readl(&(tb->CmdsOutMax))); 3723 readl(&(tb->CmdsOutMax)));
3755 printk(" Bus Types = 0x%x\n", readl(&(tb->BusTypes))); 3724 dev_dbg(&h->pdev->dev, " Bus Types = 0x%x\n",
3725 readl(&(tb->BusTypes)));
3756 for (i = 0; i < 16; i++) 3726 for (i = 0; i < 16; i++)
3757 temp_name[i] = readb(&(tb->ServerName[i])); 3727 temp_name[i] = readb(&(tb->ServerName[i]));
3758 temp_name[16] = '\0'; 3728 temp_name[16] = '\0';
3759 printk(" Server Name = %s\n", temp_name); 3729 dev_dbg(&h->pdev->dev, " Server Name = %s\n", temp_name);
3760 printk(" Heartbeat Counter = 0x%x\n\n\n", readl(&(tb->HeartBeat))); 3730 dev_dbg(&h->pdev->dev, " Heartbeat Counter = 0x%x\n\n\n",
3761#endif /* CCISS_DEBUG */ 3731 readl(&(tb->HeartBeat)));
3762} 3732}
3763 3733
3764static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr) 3734static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
@@ -3783,7 +3753,7 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
3783 offset += 8; 3753 offset += 8;
3784 break; 3754 break;
3785 default: /* reserved in PCI 2.2 */ 3755 default: /* reserved in PCI 2.2 */
3786 printk(KERN_WARNING 3756 dev_warn(&pdev->dev,
3787 "Base address is invalid\n"); 3757 "Base address is invalid\n");
3788 return -1; 3758 return -1;
3789 break; 3759 break;
@@ -3908,7 +3878,7 @@ static __devinit void cciss_enter_performant_mode(ctlr_info_t *h)
3908 cciss_wait_for_mode_change_ack(h); 3878 cciss_wait_for_mode_change_ack(h);
3909 register_value = readl(&(h->cfgtable->TransportActive)); 3879 register_value = readl(&(h->cfgtable->TransportActive));
3910 if (!(register_value & CFGTBL_Trans_Performant)) 3880 if (!(register_value & CFGTBL_Trans_Performant))
3911 printk(KERN_WARNING "cciss: unable to get board into" 3881 dev_warn(&h->pdev->dev, "cciss: unable to get board into"
3912 " performant mode\n"); 3882 " performant mode\n");
3913} 3883}
3914 3884
@@ -3923,14 +3893,13 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h)
3923 if (!(trans_support & PERFORMANT_MODE)) 3893 if (!(trans_support & PERFORMANT_MODE))
3924 return; 3894 return;
3925 3895
3926 printk(KERN_WARNING "cciss%d: Placing controller into " 3896 dev_dbg(&h->pdev->dev, "Placing controller into performant mode\n");
3927 "performant mode\n", h->ctlr);
3928 /* Performant mode demands commands on a 32 byte boundary 3897 /* Performant mode demands commands on a 32 byte boundary
3929 * pci_alloc_consistent aligns on page boundarys already. 3898 * pci_alloc_consistent aligns on page boundarys already.
3930 * Just need to check if divisible by 32 3899 * Just need to check if divisible by 32
3931 */ 3900 */
3932 if ((sizeof(CommandList_struct) % 32) != 0) { 3901 if ((sizeof(CommandList_struct) % 32) != 0) {
3933 printk(KERN_WARNING "%s %d %s\n", 3902 dev_warn(&h->pdev->dev, "%s %d %s\n",
3934 "cciss info: command size[", 3903 "cciss info: command size[",
3935 (int)sizeof(CommandList_struct), 3904 (int)sizeof(CommandList_struct),
3936 "] not divisible by 32, no performant mode..\n"); 3905 "] not divisible by 32, no performant mode..\n");
@@ -3995,12 +3964,12 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h)
3995 return; 3964 return;
3996 } 3965 }
3997 if (err > 0) { 3966 if (err > 0) {
3998 printk(KERN_WARNING "cciss: only %d MSI-X vectors " 3967 dev_warn(&h->pdev->dev,
3999 "available\n", err); 3968 "only %d MSI-X vectors available\n", err);
4000 goto default_int_mode; 3969 goto default_int_mode;
4001 } else { 3970 } else {
4002 printk(KERN_WARNING "cciss: MSI-X init failed %d\n", 3971 dev_warn(&h->pdev->dev,
4003 err); 3972 "MSI-X init failed %d\n", err);
4004 goto default_int_mode; 3973 goto default_int_mode;
4005 } 3974 }
4006 } 3975 }
@@ -4008,7 +3977,7 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h)
4008 if (!pci_enable_msi(h->pdev)) 3977 if (!pci_enable_msi(h->pdev))
4009 h->msi_vector = 1; 3978 h->msi_vector = 1;
4010 else 3979 else
4011 printk(KERN_WARNING "cciss: MSI init failed\n"); 3980 dev_warn(&h->pdev->dev, "MSI init failed\n");
4012 } 3981 }
4013default_int_mode: 3982default_int_mode:
4014#endif /* CONFIG_PCI_MSI */ 3983#endif /* CONFIG_PCI_MSI */
@@ -4210,28 +4179,24 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
4210 h->access = *(products[prod_index].access); 4179 h->access = *(products[prod_index].access);
4211 4180
4212 if (cciss_board_disabled(h)) { 4181 if (cciss_board_disabled(h)) {
4213 printk(KERN_WARNING 4182 dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
4214 "cciss: controller appears to be disabled\n");
4215 return -ENODEV; 4183 return -ENODEV;
4216 } 4184 }
4217 err = pci_enable_device(h->pdev); 4185 err = pci_enable_device(h->pdev);
4218 if (err) { 4186 if (err) {
4219 printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); 4187 dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n");
4220 return err; 4188 return err;
4221 } 4189 }
4222 4190
4223 err = pci_request_regions(h->pdev, "cciss"); 4191 err = pci_request_regions(h->pdev, "cciss");
4224 if (err) { 4192 if (err) {
4225 printk(KERN_ERR "cciss: Cannot obtain PCI resources, " 4193 dev_warn(&h->pdev->dev,
4226 "aborting\n"); 4194 "Cannot obtain PCI resources, aborting\n");
4227 return err; 4195 return err;
4228 } 4196 }
4229 4197
4230#ifdef CCISS_DEBUG 4198 dev_dbg(&h->pdev->dev, "irq = %x\n", h->pdev->irq);
4231 printk(KERN_INFO "command = %x\n", command); 4199 dev_dbg(&h->pdev->dev, "board_id = %x\n", h->board_id);
4232 printk(KERN_INFO "irq = %x\n", h->pdev->irq);
4233 printk(KERN_INFO "board_id = %x\n", h->board_id);
4234#endif /* CCISS_DEBUG */
4235 4200
4236/* If the kernel supports MSI/MSI-X we will try to enable that functionality, 4201/* If the kernel supports MSI/MSI-X we will try to enable that functionality,
4237 * else we use the IO-APIC interrupt assigned to us by system ROM. 4202 * else we use the IO-APIC interrupt assigned to us by system ROM.
@@ -4251,7 +4216,7 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
4251 err = cciss_find_cfgtables(h); 4216 err = cciss_find_cfgtables(h);
4252 if (err) 4217 if (err)
4253 goto err_out_free_res; 4218 goto err_out_free_res;
4254 print_cfg_table(h->cfgtable); 4219 print_cfg_table(h);
4255 cciss_find_board_params(h); 4220 cciss_find_board_params(h);
4256 4221
4257 if (!CISS_signature_present(h)) { 4222 if (!CISS_signature_present(h)) {
@@ -4281,7 +4246,7 @@ err_out_free_res:
4281/* Function to find the first free pointer into our hba[] array 4246/* Function to find the first free pointer into our hba[] array
4282 * Returns -1 if no free entries are left. 4247 * Returns -1 if no free entries are left.
4283 */ 4248 */
4284static int alloc_cciss_hba(void) 4249static int alloc_cciss_hba(struct pci_dev *pdev)
4285{ 4250{
4286 int i; 4251 int i;
4287 4252
@@ -4296,11 +4261,11 @@ static int alloc_cciss_hba(void)
4296 return i; 4261 return i;
4297 } 4262 }
4298 } 4263 }
4299 printk(KERN_WARNING "cciss: This driver supports a maximum" 4264 dev_warn(&pdev->dev, "This driver supports a maximum"
4300 " of %d controllers.\n", MAX_CTLR); 4265 " of %d controllers.\n", MAX_CTLR);
4301 return -1; 4266 return -1;
4302Enomem: 4267Enomem:
4303 printk(KERN_ERR "cciss: out of memory.\n"); 4268 dev_warn(&pdev->dev, "out of memory.\n");
4304 return -1; 4269 return -1;
4305} 4270}
4306 4271
@@ -4388,7 +4353,8 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u
4388 /* we leak the DMA buffer here ... no choice since the controller could 4353 /* we leak the DMA buffer here ... no choice since the controller could
4389 still complete the command. */ 4354 still complete the command. */
4390 if (i == 10) { 4355 if (i == 10) {
4391 printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n", 4356 dev_err(&pdev->dev,
4357 "controller message %02x:%02x timed out\n",
4392 opcode, type); 4358 opcode, type);
4393 return -ETIMEDOUT; 4359 return -ETIMEDOUT;
4394 } 4360 }
@@ -4396,12 +4362,12 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u
4396 pci_free_consistent(pdev, cmd_sz, cmd, paddr64); 4362 pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
4397 4363
4398 if (tag & 2) { 4364 if (tag & 2) {
4399 printk(KERN_ERR "cciss: controller message %02x:%02x failed\n", 4365 dev_err(&pdev->dev, "controller message %02x:%02x failed\n",
4400 opcode, type); 4366 opcode, type);
4401 return -EIO; 4367 return -EIO;
4402 } 4368 }
4403 4369
4404 printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n", 4370 dev_info(&pdev->dev, "controller message %02x:%02x succeeded\n",
4405 opcode, type); 4371 opcode, type);
4406 return 0; 4372 return 0;
4407} 4373}
@@ -4422,7 +4388,7 @@ static __devinit int cciss_reset_msi(struct pci_dev *pdev)
4422 if (pos) { 4388 if (pos) {
4423 pci_read_config_word(pdev, msi_control_reg(pos), &control); 4389 pci_read_config_word(pdev, msi_control_reg(pos), &control);
4424 if (control & PCI_MSI_FLAGS_ENABLE) { 4390 if (control & PCI_MSI_FLAGS_ENABLE) {
4425 printk(KERN_INFO "cciss: resetting MSI\n"); 4391 dev_info(&pdev->dev, "resetting MSI\n");
4426 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE); 4392 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE);
4427 } 4393 }
4428 } 4394 }
@@ -4431,7 +4397,7 @@ static __devinit int cciss_reset_msi(struct pci_dev *pdev)
4431 if (pos) { 4397 if (pos) {
4432 pci_read_config_word(pdev, msi_control_reg(pos), &control); 4398 pci_read_config_word(pdev, msi_control_reg(pos), &control);
4433 if (control & PCI_MSIX_FLAGS_ENABLE) { 4399 if (control & PCI_MSIX_FLAGS_ENABLE) {
4434 printk(KERN_INFO "cciss: resetting MSI-X\n"); 4400 dev_info(&pdev->dev, "resetting MSI-X\n");
4435 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE); 4401 pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE);
4436 } 4402 }
4437 } 4403 }
@@ -4664,7 +4630,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4664 rc = cciss_init_reset_devices(pdev); 4630 rc = cciss_init_reset_devices(pdev);
4665 if (rc) 4631 if (rc)
4666 return rc; 4632 return rc;
4667 i = alloc_cciss_hba(); 4633 i = alloc_cciss_hba(pdev);
4668 if (i < 0) 4634 if (i < 0)
4669 return -1; 4635 return -1;
4670 4636
@@ -4692,7 +4658,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4692 else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) 4658 else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
4693 dac = 0; 4659 dac = 0;
4694 else { 4660 else {
4695 printk(KERN_ERR "cciss: no suitable DMA available\n"); 4661 dev_err(&h->pdev->dev, "no suitable DMA available\n");
4696 goto clean1; 4662 goto clean1;
4697 } 4663 }
4698 4664
@@ -4705,8 +4671,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4705 h->major = COMPAQ_CISS_MAJOR + i; 4671 h->major = COMPAQ_CISS_MAJOR + i;
4706 rc = register_blkdev(h->major, h->devname); 4672 rc = register_blkdev(h->major, h->devname);
4707 if (rc == -EBUSY || rc == -EINVAL) { 4673 if (rc == -EBUSY || rc == -EINVAL) {
4708 printk(KERN_ERR 4674 dev_err(&h->pdev->dev,
4709 "cciss: Unable to get major number %d for %s " 4675 "Unable to get major number %d for %s "
4710 "on hba %d\n", h->major, h->devname, i); 4676 "on hba %d\n", h->major, h->devname, i);
4711 goto clean1; 4677 goto clean1;
4712 } else { 4678 } else {
@@ -4720,20 +4686,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4720 if (request_irq(h->intr[PERF_MODE_INT], 4686 if (request_irq(h->intr[PERF_MODE_INT],
4721 do_cciss_msix_intr, 4687 do_cciss_msix_intr,
4722 IRQF_DISABLED, h->devname, h)) { 4688 IRQF_DISABLED, h->devname, h)) {
4723 printk(KERN_ERR "cciss: Unable to get irq %d for %s\n", 4689 dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n",
4724 h->intr[PERF_MODE_INT], h->devname); 4690 h->intr[PERF_MODE_INT], h->devname);
4725 goto clean2; 4691 goto clean2;
4726 } 4692 }
4727 } else { 4693 } else {
4728 if (request_irq(h->intr[PERF_MODE_INT], do_cciss_intx, 4694 if (request_irq(h->intr[PERF_MODE_INT], do_cciss_intx,
4729 IRQF_DISABLED, h->devname, h)) { 4695 IRQF_DISABLED, h->devname, h)) {
4730 printk(KERN_ERR "cciss: Unable to get irq %d for %s\n", 4696 dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n",
4731 h->intr[PERF_MODE_INT], h->devname); 4697 h->intr[PERF_MODE_INT], h->devname);
4732 goto clean2; 4698 goto clean2;
4733 } 4699 }
4734 } 4700 }
4735 4701
4736 printk(KERN_INFO "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", 4702 dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n",
4737 h->devname, pdev->device, pci_name(pdev), 4703 h->devname, pdev->device, pci_name(pdev),
4738 h->intr[PERF_MODE_INT], dac ? "" : " not"); 4704 h->intr[PERF_MODE_INT], dac ? "" : " not");
4739 4705
@@ -4751,7 +4717,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4751 if ((h->cmd_pool_bits == NULL) 4717 if ((h->cmd_pool_bits == NULL)
4752 || (h->cmd_pool == NULL) 4718 || (h->cmd_pool == NULL)
4753 || (h->errinfo_pool == NULL)) { 4719 || (h->errinfo_pool == NULL)) {
4754 printk(KERN_ERR "cciss: out of memory"); 4720 dev_err(&h->pdev->dev, "out of memory");
4755 goto clean4; 4721 goto clean4;
4756 } 4722 }
4757 4723
@@ -4764,8 +4730,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4764 h->maxsgentries, 4730 h->maxsgentries,
4765 GFP_KERNEL); 4731 GFP_KERNEL);
4766 if (h->scatter_list[k] == NULL) { 4732 if (h->scatter_list[k] == NULL) {
4767 printk(KERN_ERR "cciss%d: could not allocate " 4733 dev_err(&h->pdev->dev,
4768 "s/g lists\n", i); 4734 "could not allocate s/g lists\n");
4769 goto clean4; 4735 goto clean4;
4770 } 4736 }
4771 } 4737 }
@@ -4800,7 +4766,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4800 /* Get the firmware version */ 4766 /* Get the firmware version */
4801 inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL); 4767 inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
4802 if (inq_buff == NULL) { 4768 if (inq_buff == NULL) {
4803 printk(KERN_ERR "cciss: out of memory\n"); 4769 dev_err(&h->pdev->dev, "out of memory\n");
4804 goto clean4; 4770 goto clean4;
4805 } 4771 }
4806 4772
@@ -4812,7 +4778,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4812 h->firm_ver[2] = inq_buff->data_byte[34]; 4778 h->firm_ver[2] = inq_buff->data_byte[34];
4813 h->firm_ver[3] = inq_buff->data_byte[35]; 4779 h->firm_ver[3] = inq_buff->data_byte[35];
4814 } else { /* send command failed */ 4780 } else { /* send command failed */
4815 printk(KERN_WARNING "cciss: unable to determine firmware" 4781 dev_warn(&h->pdev->dev, "unable to determine firmware"
4816 " version of controller\n"); 4782 " version of controller\n");
4817 } 4783 }
4818 kfree(inq_buff); 4784 kfree(inq_buff);
@@ -4869,9 +4835,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
4869 h = pci_get_drvdata(pdev); 4835 h = pci_get_drvdata(pdev);
4870 flush_buf = kzalloc(4, GFP_KERNEL); 4836 flush_buf = kzalloc(4, GFP_KERNEL);
4871 if (!flush_buf) { 4837 if (!flush_buf) {
4872 printk(KERN_WARNING 4838 dev_warn(&h->pdev->dev, "cache not flushed, out of memory.\n");
4873 "cciss:%d cache not flushed, out of memory.\n",
4874 h->ctlr);
4875 return; 4839 return;
4876 } 4840 }
4877 /* write all data in the battery backed cache to disk */ 4841 /* write all data in the battery backed cache to disk */
@@ -4880,8 +4844,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
4880 4, 0, CTLR_LUNID, TYPE_CMD); 4844 4, 0, CTLR_LUNID, TYPE_CMD);
4881 kfree(flush_buf); 4845 kfree(flush_buf);
4882 if (return_code != IO_OK) 4846 if (return_code != IO_OK)
4883 printk(KERN_WARNING "cciss%d: Error flushing cache\n", 4847 dev_warn(&h->pdev->dev, "Error flushing cache\n");
4884 h->ctlr);
4885 h->access.set_intr_mask(h, CCISS_INTR_OFF); 4848 h->access.set_intr_mask(h, CCISS_INTR_OFF);
4886 free_irq(h->intr[PERF_MODE_INT], h); 4849 free_irq(h->intr[PERF_MODE_INT], h);
4887} 4850}
@@ -4892,15 +4855,14 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
4892 int i, j; 4855 int i, j;
4893 4856
4894 if (pci_get_drvdata(pdev) == NULL) { 4857 if (pci_get_drvdata(pdev) == NULL) {
4895 printk(KERN_ERR "cciss: Unable to remove device \n"); 4858 dev_err(&pdev->dev, "Unable to remove device\n");
4896 return; 4859 return;
4897 } 4860 }
4898 4861
4899 h = pci_get_drvdata(pdev); 4862 h = pci_get_drvdata(pdev);
4900 i = h->ctlr; 4863 i = h->ctlr;
4901 if (hba[i] == NULL) { 4864 if (hba[i] == NULL) {
4902 printk(KERN_ERR "cciss: device appears to " 4865 dev_err(&pdev->dev, "device appears to already be removed\n");
4903 "already be removed\n");
4904 return; 4866 return;
4905 } 4867 }
4906 4868
@@ -5021,8 +4983,8 @@ static void __exit cciss_cleanup(void)
5021 /* double check that all controller entrys have been removed */ 4983 /* double check that all controller entrys have been removed */
5022 for (i = 0; i < MAX_CTLR; i++) { 4984 for (i = 0; i < MAX_CTLR; i++) {
5023 if (hba[i] != NULL) { 4985 if (hba[i] != NULL) {
5024 printk(KERN_WARNING "cciss: had to remove" 4986 dev_warn(&hba[i]->pdev->dev,
5025 " controller %d\n", i); 4987 "had to remove controller\n");
5026 cciss_remove_one(hba[i]->pdev); 4988 cciss_remove_one(hba[i]->pdev);
5027 } 4989 }
5028 } 4990 }