| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ipr.c -- driver for IBM Power Linux RAID adapters |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Written By: Brian King <brking@us.ibm.com>, IBM Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 2003, 2004 IBM Corporation |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 21 | | - * |
|---|
| 22 | 8 | */ |
|---|
| 23 | 9 | |
|---|
| 24 | 10 | /* |
|---|
| .. | .. |
|---|
| 684 | 670 | /** |
|---|
| 685 | 671 | * ipr_init_ipr_cmnd - Initialize an IPR Cmnd block |
|---|
| 686 | 672 | * @ipr_cmd: ipr command struct |
|---|
| 673 | + * @fast_done: fast done function call-back |
|---|
| 687 | 674 | * |
|---|
| 688 | 675 | * Return value: |
|---|
| 689 | 676 | * none |
|---|
| .. | .. |
|---|
| 701 | 688 | |
|---|
| 702 | 689 | /** |
|---|
| 703 | 690 | * __ipr_get_free_ipr_cmnd - Get a free IPR Cmnd block |
|---|
| 704 | | - * @ioa_cfg: ioa config struct |
|---|
| 691 | + * @hrrq: hrr queue |
|---|
| 705 | 692 | * |
|---|
| 706 | 693 | * Return value: |
|---|
| 707 | 694 | * pointer to ipr command struct |
|---|
| .. | .. |
|---|
| 751 | 738 | static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg, |
|---|
| 752 | 739 | u32 clr_ints) |
|---|
| 753 | 740 | { |
|---|
| 754 | | - volatile u32 int_reg; |
|---|
| 755 | 741 | int i; |
|---|
| 756 | 742 | |
|---|
| 757 | 743 | /* Stop new interrupts */ |
|---|
| .. | .. |
|---|
| 771 | 757 | if (ioa_cfg->sis64) |
|---|
| 772 | 758 | writel(~0, ioa_cfg->regs.clr_interrupt_reg); |
|---|
| 773 | 759 | writel(clr_ints, ioa_cfg->regs.clr_interrupt_reg32); |
|---|
| 774 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 760 | + readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 775 | 761 | } |
|---|
| 776 | 762 | |
|---|
| 777 | 763 | /** |
|---|
| .. | .. |
|---|
| 1178 | 1164 | default: |
|---|
| 1179 | 1165 | res->ata_class = ATA_DEV_UNKNOWN; |
|---|
| 1180 | 1166 | break; |
|---|
| 1181 | | - }; |
|---|
| 1167 | + } |
|---|
| 1182 | 1168 | } |
|---|
| 1183 | 1169 | |
|---|
| 1184 | 1170 | /** |
|---|
| .. | .. |
|---|
| 1301 | 1287 | /** |
|---|
| 1302 | 1288 | * __ipr_format_res_path - Format the resource path for printing. |
|---|
| 1303 | 1289 | * @res_path: resource path |
|---|
| 1304 | | - * @buf: buffer |
|---|
| 1290 | + * @buffer: buffer |
|---|
| 1305 | 1291 | * @len: length of buffer provided |
|---|
| 1306 | 1292 | * |
|---|
| 1307 | 1293 | * Return value: |
|---|
| .. | .. |
|---|
| 1313 | 1299 | char *p = buffer; |
|---|
| 1314 | 1300 | |
|---|
| 1315 | 1301 | *p = '\0'; |
|---|
| 1316 | | - p += snprintf(p, buffer + len - p, "%02X", res_path[0]); |
|---|
| 1302 | + p += scnprintf(p, buffer + len - p, "%02X", res_path[0]); |
|---|
| 1317 | 1303 | for (i = 1; res_path[i] != 0xff && ((i * 3) < len); i++) |
|---|
| 1318 | | - p += snprintf(p, buffer + len - p, "-%02X", res_path[i]); |
|---|
| 1304 | + p += scnprintf(p, buffer + len - p, "-%02X", res_path[i]); |
|---|
| 1319 | 1305 | |
|---|
| 1320 | 1306 | return buffer; |
|---|
| 1321 | 1307 | } |
|---|
| .. | .. |
|---|
| 1324 | 1310 | * ipr_format_res_path - Format the resource path for printing. |
|---|
| 1325 | 1311 | * @ioa_cfg: ioa config struct |
|---|
| 1326 | 1312 | * @res_path: resource path |
|---|
| 1327 | | - * @buf: buffer |
|---|
| 1313 | + * @buffer: buffer |
|---|
| 1328 | 1314 | * @len: length of buffer provided |
|---|
| 1329 | 1315 | * |
|---|
| 1330 | 1316 | * Return value: |
|---|
| .. | .. |
|---|
| 1336 | 1322 | char *p = buffer; |
|---|
| 1337 | 1323 | |
|---|
| 1338 | 1324 | *p = '\0'; |
|---|
| 1339 | | - p += snprintf(p, buffer + len - p, "%d/", ioa_cfg->host->host_no); |
|---|
| 1325 | + p += scnprintf(p, buffer + len - p, "%d/", ioa_cfg->host->host_no); |
|---|
| 1340 | 1326 | __ipr_format_res_path(res_path, p, len - (buffer - p)); |
|---|
| 1341 | 1327 | return buffer; |
|---|
| 1342 | 1328 | } |
|---|
| .. | .. |
|---|
| 1405 | 1391 | * ipr_clear_res_target - Clear the bit in the bit map representing the target |
|---|
| 1406 | 1392 | * for the resource. |
|---|
| 1407 | 1393 | * @res: resource entry struct |
|---|
| 1408 | | - * @cfgtew: config table entry wrapper struct |
|---|
| 1409 | 1394 | * |
|---|
| 1410 | 1395 | * Return value: |
|---|
| 1411 | 1396 | * none |
|---|
| .. | .. |
|---|
| 2681 | 2666 | |
|---|
| 2682 | 2667 | /** |
|---|
| 2683 | 2668 | * ipr_timeout - An internally generated op has timed out. |
|---|
| 2684 | | - * @ipr_cmd: ipr command struct |
|---|
| 2669 | + * @t: Timer context used to fetch ipr command struct |
|---|
| 2685 | 2670 | * |
|---|
| 2686 | 2671 | * This function blocks host requests and initiates an |
|---|
| 2687 | 2672 | * adapter reset. |
|---|
| .. | .. |
|---|
| 2714 | 2699 | |
|---|
| 2715 | 2700 | /** |
|---|
| 2716 | 2701 | * ipr_oper_timeout - Adapter timed out transitioning to operational |
|---|
| 2717 | | - * @ipr_cmd: ipr command struct |
|---|
| 2702 | + * @t: Timer context used to fetch ipr command struct |
|---|
| 2718 | 2703 | * |
|---|
| 2719 | 2704 | * This function blocks host requests and initiates an |
|---|
| 2720 | 2705 | * adapter reset. |
|---|
| .. | .. |
|---|
| 3498 | 3483 | /** |
|---|
| 3499 | 3484 | * ipr_show_fw_version - Show the firmware version |
|---|
| 3500 | 3485 | * @dev: class device struct |
|---|
| 3486 | + * @attr: device attribute (unused) |
|---|
| 3501 | 3487 | * @buf: buffer |
|---|
| 3502 | 3488 | * |
|---|
| 3503 | 3489 | * Return value: |
|---|
| .. | .. |
|---|
| 3532 | 3518 | /** |
|---|
| 3533 | 3519 | * ipr_show_log_level - Show the adapter's error logging level |
|---|
| 3534 | 3520 | * @dev: class device struct |
|---|
| 3521 | + * @attr: device attribute (unused) |
|---|
| 3535 | 3522 | * @buf: buffer |
|---|
| 3536 | 3523 | * |
|---|
| 3537 | 3524 | * Return value: |
|---|
| .. | .. |
|---|
| 3554 | 3541 | /** |
|---|
| 3555 | 3542 | * ipr_store_log_level - Change the adapter's error logging level |
|---|
| 3556 | 3543 | * @dev: class device struct |
|---|
| 3544 | + * @attr: device attribute (unused) |
|---|
| 3557 | 3545 | * @buf: buffer |
|---|
| 3546 | + * @count: buffer size |
|---|
| 3558 | 3547 | * |
|---|
| 3559 | 3548 | * Return value: |
|---|
| 3560 | 3549 | * number of bytes printed to buffer |
|---|
| .. | .. |
|---|
| 3585 | 3574 | /** |
|---|
| 3586 | 3575 | * ipr_store_diagnostics - IOA Diagnostics interface |
|---|
| 3587 | 3576 | * @dev: device struct |
|---|
| 3577 | + * @attr: device attribute (unused) |
|---|
| 3588 | 3578 | * @buf: buffer |
|---|
| 3589 | 3579 | * @count: buffer size |
|---|
| 3590 | 3580 | * |
|---|
| .. | .. |
|---|
| 3645 | 3635 | |
|---|
| 3646 | 3636 | /** |
|---|
| 3647 | 3637 | * ipr_show_adapter_state - Show the adapter's state |
|---|
| 3648 | | - * @class_dev: device struct |
|---|
| 3638 | + * @dev: device struct |
|---|
| 3639 | + * @attr: device attribute (unused) |
|---|
| 3649 | 3640 | * @buf: buffer |
|---|
| 3650 | 3641 | * |
|---|
| 3651 | 3642 | * Return value: |
|---|
| .. | .. |
|---|
| 3671 | 3662 | /** |
|---|
| 3672 | 3663 | * ipr_store_adapter_state - Change adapter state |
|---|
| 3673 | 3664 | * @dev: device struct |
|---|
| 3665 | + * @attr: device attribute (unused) |
|---|
| 3674 | 3666 | * @buf: buffer |
|---|
| 3675 | 3667 | * @count: buffer size |
|---|
| 3676 | 3668 | * |
|---|
| .. | .. |
|---|
| 3722 | 3714 | /** |
|---|
| 3723 | 3715 | * ipr_store_reset_adapter - Reset the adapter |
|---|
| 3724 | 3716 | * @dev: device struct |
|---|
| 3717 | + * @attr: device attribute (unused) |
|---|
| 3725 | 3718 | * @buf: buffer |
|---|
| 3726 | 3719 | * @count: buffer size |
|---|
| 3727 | 3720 | * |
|---|
| .. | .. |
|---|
| 3763 | 3756 | /** |
|---|
| 3764 | 3757 | * ipr_show_iopoll_weight - Show ipr polling mode |
|---|
| 3765 | 3758 | * @dev: class device struct |
|---|
| 3759 | + * @attr: device attribute (unused) |
|---|
| 3766 | 3760 | * @buf: buffer |
|---|
| 3767 | 3761 | * |
|---|
| 3768 | 3762 | * Return value: |
|---|
| .. | .. |
|---|
| 3786 | 3780 | /** |
|---|
| 3787 | 3781 | * ipr_store_iopoll_weight - Change the adapter's polling mode |
|---|
| 3788 | 3782 | * @dev: class device struct |
|---|
| 3783 | + * @attr: device attribute (unused) |
|---|
| 3789 | 3784 | * @buf: buffer |
|---|
| 3785 | + * @count: buffer size |
|---|
| 3790 | 3786 | * |
|---|
| 3791 | 3787 | * Return value: |
|---|
| 3792 | 3788 | * number of bytes printed to buffer |
|---|
| .. | .. |
|---|
| 3885 | 3881 | |
|---|
| 3886 | 3882 | /** |
|---|
| 3887 | 3883 | * ipr_free_ucode_buffer - Frees a microcode download buffer |
|---|
| 3888 | | - * @p_dnld: scatter/gather list pointer |
|---|
| 3884 | + * @sglist: scatter/gather list pointer |
|---|
| 3889 | 3885 | * |
|---|
| 3890 | 3886 | * Free a DMA'able ucode download buffer previously allocated with |
|---|
| 3891 | 3887 | * ipr_alloc_ucode_buffer |
|---|
| .. | .. |
|---|
| 3915 | 3911 | u8 *buffer, u32 len) |
|---|
| 3916 | 3912 | { |
|---|
| 3917 | 3913 | int bsize_elem, i, result = 0; |
|---|
| 3918 | | - struct scatterlist *scatterlist; |
|---|
| 3914 | + struct scatterlist *sg; |
|---|
| 3919 | 3915 | void *kaddr; |
|---|
| 3920 | 3916 | |
|---|
| 3921 | 3917 | /* Determine the actual number of bytes per element */ |
|---|
| 3922 | 3918 | bsize_elem = PAGE_SIZE * (1 << sglist->order); |
|---|
| 3923 | 3919 | |
|---|
| 3924 | | - scatterlist = sglist->scatterlist; |
|---|
| 3920 | + sg = sglist->scatterlist; |
|---|
| 3925 | 3921 | |
|---|
| 3926 | | - for (i = 0; i < (len / bsize_elem); i++, buffer += bsize_elem) { |
|---|
| 3927 | | - struct page *page = sg_page(&scatterlist[i]); |
|---|
| 3922 | + for (i = 0; i < (len / bsize_elem); i++, sg = sg_next(sg), |
|---|
| 3923 | + buffer += bsize_elem) { |
|---|
| 3924 | + struct page *page = sg_page(sg); |
|---|
| 3928 | 3925 | |
|---|
| 3929 | 3926 | kaddr = kmap(page); |
|---|
| 3930 | 3927 | memcpy(kaddr, buffer, bsize_elem); |
|---|
| 3931 | 3928 | kunmap(page); |
|---|
| 3932 | 3929 | |
|---|
| 3933 | | - scatterlist[i].length = bsize_elem; |
|---|
| 3930 | + sg->length = bsize_elem; |
|---|
| 3934 | 3931 | |
|---|
| 3935 | 3932 | if (result != 0) { |
|---|
| 3936 | 3933 | ipr_trace; |
|---|
| .. | .. |
|---|
| 3939 | 3936 | } |
|---|
| 3940 | 3937 | |
|---|
| 3941 | 3938 | if (len % bsize_elem) { |
|---|
| 3942 | | - struct page *page = sg_page(&scatterlist[i]); |
|---|
| 3939 | + struct page *page = sg_page(sg); |
|---|
| 3943 | 3940 | |
|---|
| 3944 | 3941 | kaddr = kmap(page); |
|---|
| 3945 | 3942 | memcpy(kaddr, buffer, len % bsize_elem); |
|---|
| 3946 | 3943 | kunmap(page); |
|---|
| 3947 | 3944 | |
|---|
| 3948 | | - scatterlist[i].length = len % bsize_elem; |
|---|
| 3945 | + sg->length = len % bsize_elem; |
|---|
| 3949 | 3946 | } |
|---|
| 3950 | 3947 | |
|---|
| 3951 | 3948 | sglist->buffer_len = len; |
|---|
| .. | .. |
|---|
| 3966 | 3963 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
|---|
| 3967 | 3964 | struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64; |
|---|
| 3968 | 3965 | struct scatterlist *scatterlist = sglist->scatterlist; |
|---|
| 3966 | + struct scatterlist *sg; |
|---|
| 3969 | 3967 | int i; |
|---|
| 3970 | 3968 | |
|---|
| 3971 | 3969 | ipr_cmd->dma_use_sg = sglist->num_dma_sg; |
|---|
| .. | .. |
|---|
| 3974 | 3972 | |
|---|
| 3975 | 3973 | ioarcb->ioadl_len = |
|---|
| 3976 | 3974 | cpu_to_be32(sizeof(struct ipr_ioadl64_desc) * ipr_cmd->dma_use_sg); |
|---|
| 3977 | | - for (i = 0; i < ipr_cmd->dma_use_sg; i++) { |
|---|
| 3975 | + for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { |
|---|
| 3978 | 3976 | ioadl64[i].flags = cpu_to_be32(IPR_IOADL_FLAGS_WRITE); |
|---|
| 3979 | | - ioadl64[i].data_len = cpu_to_be32(sg_dma_len(&scatterlist[i])); |
|---|
| 3980 | | - ioadl64[i].address = cpu_to_be64(sg_dma_address(&scatterlist[i])); |
|---|
| 3977 | + ioadl64[i].data_len = cpu_to_be32(sg_dma_len(sg)); |
|---|
| 3978 | + ioadl64[i].address = cpu_to_be64(sg_dma_address(sg)); |
|---|
| 3981 | 3979 | } |
|---|
| 3982 | 3980 | |
|---|
| 3983 | 3981 | ioadl64[i-1].flags |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); |
|---|
| .. | .. |
|---|
| 3997 | 3995 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
|---|
| 3998 | 3996 | struct ipr_ioadl_desc *ioadl = ipr_cmd->i.ioadl; |
|---|
| 3999 | 3997 | struct scatterlist *scatterlist = sglist->scatterlist; |
|---|
| 3998 | + struct scatterlist *sg; |
|---|
| 4000 | 3999 | int i; |
|---|
| 4001 | 4000 | |
|---|
| 4002 | 4001 | ipr_cmd->dma_use_sg = sglist->num_dma_sg; |
|---|
| .. | .. |
|---|
| 4006 | 4005 | ioarcb->ioadl_len = |
|---|
| 4007 | 4006 | cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); |
|---|
| 4008 | 4007 | |
|---|
| 4009 | | - for (i = 0; i < ipr_cmd->dma_use_sg; i++) { |
|---|
| 4008 | + for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { |
|---|
| 4010 | 4009 | ioadl[i].flags_and_data_len = |
|---|
| 4011 | | - cpu_to_be32(IPR_IOADL_FLAGS_WRITE | sg_dma_len(&scatterlist[i])); |
|---|
| 4010 | + cpu_to_be32(IPR_IOADL_FLAGS_WRITE | sg_dma_len(sg)); |
|---|
| 4012 | 4011 | ioadl[i].address = |
|---|
| 4013 | | - cpu_to_be32(sg_dma_address(&scatterlist[i])); |
|---|
| 4012 | + cpu_to_be32(sg_dma_address(sg)); |
|---|
| 4014 | 4013 | } |
|---|
| 4015 | 4014 | |
|---|
| 4016 | 4015 | ioadl[i-1].flags_and_data_len |= |
|---|
| .. | .. |
|---|
| 4070 | 4069 | |
|---|
| 4071 | 4070 | /** |
|---|
| 4072 | 4071 | * ipr_store_update_fw - Update the firmware on the adapter |
|---|
| 4073 | | - * @class_dev: device struct |
|---|
| 4072 | + * @dev: device struct |
|---|
| 4073 | + * @attr: device attribute (unused) |
|---|
| 4074 | 4074 | * @buf: buffer |
|---|
| 4075 | 4075 | * @count: buffer size |
|---|
| 4076 | 4076 | * |
|---|
| .. | .. |
|---|
| 4150 | 4150 | /** |
|---|
| 4151 | 4151 | * ipr_show_fw_type - Show the adapter's firmware type. |
|---|
| 4152 | 4152 | * @dev: class device struct |
|---|
| 4153 | + * @attr: device attribute (unused) |
|---|
| 4153 | 4154 | * @buf: buffer |
|---|
| 4154 | 4155 | * |
|---|
| 4155 | 4156 | * Return value: |
|---|
| .. | .. |
|---|
| 4491 | 4492 | * ipr_change_queue_depth - Change the device's queue depth |
|---|
| 4492 | 4493 | * @sdev: scsi device struct |
|---|
| 4493 | 4494 | * @qdepth: depth to set |
|---|
| 4494 | | - * @reason: calling context |
|---|
| 4495 | 4495 | * |
|---|
| 4496 | 4496 | * Return value: |
|---|
| 4497 | 4497 | * actual depth set |
|---|
| .. | .. |
|---|
| 4661 | 4661 | /** |
|---|
| 4662 | 4662 | * ipr_show_raw_mode - Show the adapter's raw mode |
|---|
| 4663 | 4663 | * @dev: class device struct |
|---|
| 4664 | + * @attr: device attribute (unused) |
|---|
| 4664 | 4665 | * @buf: buffer |
|---|
| 4665 | 4666 | * |
|---|
| 4666 | 4667 | * Return value: |
|---|
| .. | .. |
|---|
| 4688 | 4689 | /** |
|---|
| 4689 | 4690 | * ipr_store_raw_mode - Change the adapter's raw mode |
|---|
| 4690 | 4691 | * @dev: class device struct |
|---|
| 4692 | + * @attr: device attribute (unused) |
|---|
| 4691 | 4693 | * @buf: buffer |
|---|
| 4694 | + * @count: buffer size |
|---|
| 4692 | 4695 | * |
|---|
| 4693 | 4696 | * Return value: |
|---|
| 4694 | 4697 | * number of bytes printed to buffer |
|---|
| .. | .. |
|---|
| 5071 | 5074 | |
|---|
| 5072 | 5075 | /** |
|---|
| 5073 | 5076 | * ipr_cmnd_is_free - Check if a command is free or not |
|---|
| 5074 | | - * @ipr_cmd ipr command struct |
|---|
| 5077 | + * @ipr_cmd: ipr command struct |
|---|
| 5075 | 5078 | * |
|---|
| 5076 | 5079 | * Returns: |
|---|
| 5077 | 5080 | * true / false |
|---|
| .. | .. |
|---|
| 5107 | 5110 | |
|---|
| 5108 | 5111 | /** |
|---|
| 5109 | 5112 | * ipr_wait_for_ops - Wait for matching commands to complete |
|---|
| 5110 | | - * @ipr_cmd: ipr command struct |
|---|
| 5113 | + * @ioa_cfg: ioa config struct |
|---|
| 5111 | 5114 | * @device: device to match (sdev) |
|---|
| 5112 | 5115 | * @match: match function to use |
|---|
| 5113 | 5116 | * |
|---|
| .. | .. |
|---|
| 5272 | 5275 | * ipr_sata_reset - Reset the SATA port |
|---|
| 5273 | 5276 | * @link: SATA link to reset |
|---|
| 5274 | 5277 | * @classes: class of the attached device |
|---|
| 5278 | + * @deadline: unused |
|---|
| 5275 | 5279 | * |
|---|
| 5276 | 5280 | * This function issues a SATA phy reset to the affected ATA link. |
|---|
| 5277 | 5281 | * |
|---|
| .. | .. |
|---|
| 5451 | 5455 | |
|---|
| 5452 | 5456 | /** |
|---|
| 5453 | 5457 | * ipr_abort_timeout - An abort task has timed out |
|---|
| 5454 | | - * @ipr_cmd: ipr command struct |
|---|
| 5458 | + * @t: Timer context used to fetch ipr command struct |
|---|
| 5455 | 5459 | * |
|---|
| 5456 | 5460 | * This function handles when an abort task times out. If this |
|---|
| 5457 | 5461 | * happens we issue a bus reset since we have resources tied |
|---|
| .. | .. |
|---|
| 5505 | 5509 | struct ipr_ioa_cfg *ioa_cfg; |
|---|
| 5506 | 5510 | struct ipr_resource_entry *res; |
|---|
| 5507 | 5511 | struct ipr_cmd_pkt *cmd_pkt; |
|---|
| 5508 | | - u32 ioasc, int_reg; |
|---|
| 5512 | + u32 ioasc; |
|---|
| 5509 | 5513 | int i, op_found = 0; |
|---|
| 5510 | 5514 | struct ipr_hrr_queue *hrrq; |
|---|
| 5511 | 5515 | |
|---|
| .. | .. |
|---|
| 5528 | 5532 | * by a still not detected EEH error. In such cases, reading a register will |
|---|
| 5529 | 5533 | * trigger the EEH recovery infrastructure. |
|---|
| 5530 | 5534 | */ |
|---|
| 5531 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 5535 | + readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 5532 | 5536 | |
|---|
| 5533 | 5537 | if (!ipr_is_gscsi(res)) |
|---|
| 5534 | 5538 | return FAILED; |
|---|
| .. | .. |
|---|
| 5580 | 5584 | |
|---|
| 5581 | 5585 | /** |
|---|
| 5582 | 5586 | * ipr_eh_abort - Abort a single op |
|---|
| 5583 | | - * @scsi_cmd: scsi command struct |
|---|
| 5587 | + * @shost: scsi host struct |
|---|
| 5588 | + * @elapsed_time: elapsed time |
|---|
| 5584 | 5589 | * |
|---|
| 5585 | 5590 | * Return value: |
|---|
| 5586 | 5591 | * 0 if scan in progress / 1 if scan is complete |
|---|
| .. | .. |
|---|
| 5707 | 5712 | * ipr_isr_eh - Interrupt service routine error handler |
|---|
| 5708 | 5713 | * @ioa_cfg: ioa config struct |
|---|
| 5709 | 5714 | * @msg: message to log |
|---|
| 5715 | + * @number: various meanings depending on the caller/message |
|---|
| 5710 | 5716 | * |
|---|
| 5711 | 5717 | * Return value: |
|---|
| 5712 | 5718 | * none |
|---|
| .. | .. |
|---|
| 5773 | 5779 | |
|---|
| 5774 | 5780 | static int ipr_iopoll(struct irq_poll *iop, int budget) |
|---|
| 5775 | 5781 | { |
|---|
| 5776 | | - struct ipr_ioa_cfg *ioa_cfg; |
|---|
| 5777 | 5782 | struct ipr_hrr_queue *hrrq; |
|---|
| 5778 | 5783 | struct ipr_cmnd *ipr_cmd, *temp; |
|---|
| 5779 | 5784 | unsigned long hrrq_flags; |
|---|
| .. | .. |
|---|
| 5781 | 5786 | LIST_HEAD(doneq); |
|---|
| 5782 | 5787 | |
|---|
| 5783 | 5788 | hrrq = container_of(iop, struct ipr_hrr_queue, iopoll); |
|---|
| 5784 | | - ioa_cfg = hrrq->ioa_cfg; |
|---|
| 5785 | 5789 | |
|---|
| 5786 | 5790 | spin_lock_irqsave(hrrq->lock, hrrq_flags); |
|---|
| 5787 | 5791 | completed_ops = ipr_process_hrrq(hrrq, budget, &doneq); |
|---|
| .. | .. |
|---|
| 6279 | 6283 | |
|---|
| 6280 | 6284 | /** |
|---|
| 6281 | 6285 | * ipr_gen_sense - Generate SCSI sense data from an IOASA |
|---|
| 6282 | | - * @ioasa: IOASA |
|---|
| 6283 | | - * @sense_buf: sense data buffer |
|---|
| 6286 | + * @ipr_cmd: ipr command struct |
|---|
| 6284 | 6287 | * |
|---|
| 6285 | 6288 | * Return value: |
|---|
| 6286 | 6289 | * none |
|---|
| .. | .. |
|---|
| 6696 | 6699 | * Return value: |
|---|
| 6697 | 6700 | * 0 on success / other on failure |
|---|
| 6698 | 6701 | **/ |
|---|
| 6699 | | -static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) |
|---|
| 6702 | +static int ipr_ioctl(struct scsi_device *sdev, unsigned int cmd, |
|---|
| 6703 | + void __user *arg) |
|---|
| 6700 | 6704 | { |
|---|
| 6701 | 6705 | struct ipr_resource_entry *res; |
|---|
| 6702 | 6706 | |
|---|
| .. | .. |
|---|
| 6712 | 6716 | |
|---|
| 6713 | 6717 | /** |
|---|
| 6714 | 6718 | * ipr_info - Get information about the card/driver |
|---|
| 6715 | | - * @scsi_host: scsi host struct |
|---|
| 6719 | + * @host: scsi host struct |
|---|
| 6716 | 6720 | * |
|---|
| 6717 | 6721 | * Return value: |
|---|
| 6718 | 6722 | * pointer to buffer with description string |
|---|
| .. | .. |
|---|
| 6737 | 6741 | .name = "IPR", |
|---|
| 6738 | 6742 | .info = ipr_ioa_info, |
|---|
| 6739 | 6743 | .ioctl = ipr_ioctl, |
|---|
| 6744 | +#ifdef CONFIG_COMPAT |
|---|
| 6745 | + .compat_ioctl = ipr_ioctl, |
|---|
| 6746 | +#endif |
|---|
| 6740 | 6747 | .queuecommand = ipr_queuecommand, |
|---|
| 6748 | + .dma_need_drain = ata_scsi_dma_need_drain, |
|---|
| 6741 | 6749 | .eh_abort_handler = ipr_eh_abort, |
|---|
| 6742 | 6750 | .eh_device_reset_handler = ipr_eh_dev_reset, |
|---|
| 6743 | 6751 | .eh_host_reset_handler = ipr_eh_host_reset, |
|---|
| .. | .. |
|---|
| 6754 | 6762 | .sg_tablesize = IPR_MAX_SGLIST, |
|---|
| 6755 | 6763 | .max_sectors = IPR_IOA_MAX_SECTORS, |
|---|
| 6756 | 6764 | .cmd_per_lun = IPR_MAX_CMD_PER_LUN, |
|---|
| 6757 | | - .use_clustering = ENABLE_CLUSTERING, |
|---|
| 6758 | 6765 | .shost_attrs = ipr_ioa_attrs, |
|---|
| 6759 | 6766 | .sdev_attrs = ipr_dev_attrs, |
|---|
| 6760 | 6767 | .proc_name = IPR_NAME, |
|---|
| .. | .. |
|---|
| 7599 | 7606 | /** |
|---|
| 7600 | 7607 | * ipr_build_mode_sense - Builds a mode sense command |
|---|
| 7601 | 7608 | * @ipr_cmd: ipr command struct |
|---|
| 7602 | | - * @res: resource entry struct |
|---|
| 7609 | + * @res_handle: resource entry struct |
|---|
| 7603 | 7610 | * @parm: Byte 2 of mode sense command |
|---|
| 7604 | 7611 | * @dma_addr: DMA address of mode sense buffer |
|---|
| 7605 | 7612 | * @xfer_len: Size of DMA buffer |
|---|
| .. | .. |
|---|
| 7946 | 7953 | /** |
|---|
| 7947 | 7954 | * ipr_ioafp_set_caching_parameters - Issue Set Cache parameters service |
|---|
| 7948 | 7955 | * action |
|---|
| 7956 | + * @ipr_cmd: ipr command struct |
|---|
| 7949 | 7957 | * |
|---|
| 7950 | 7958 | * Return value: |
|---|
| 7951 | 7959 | * none |
|---|
| .. | .. |
|---|
| 7982 | 7990 | /** |
|---|
| 7983 | 7991 | * ipr_ioafp_inquiry - Send an Inquiry to the adapter. |
|---|
| 7984 | 7992 | * @ipr_cmd: ipr command struct |
|---|
| 7993 | + * @flags: flags to send |
|---|
| 7994 | + * @page: page to inquire |
|---|
| 7995 | + * @dma_addr: DMA address |
|---|
| 7996 | + * @xfer_len: transfer data length |
|---|
| 7985 | 7997 | * |
|---|
| 7986 | 7998 | * This utility function sends an inquiry to the adapter. |
|---|
| 7987 | 7999 | * |
|---|
| .. | .. |
|---|
| 8272 | 8284 | |
|---|
| 8273 | 8285 | /** |
|---|
| 8274 | 8286 | * ipr_reset_timer_done - Adapter reset timer function |
|---|
| 8275 | | - * @ipr_cmd: ipr command struct |
|---|
| 8287 | + * @t: Timer context used to fetch ipr command struct |
|---|
| 8276 | 8288 | * |
|---|
| 8277 | 8289 | * Description: This function is used in adapter reset processing |
|---|
| 8278 | 8290 | * for timing events. If the reset_cmd pointer in the IOA |
|---|
| .. | .. |
|---|
| 8666 | 8678 | static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd) |
|---|
| 8667 | 8679 | { |
|---|
| 8668 | 8680 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
|---|
| 8669 | | - u32 int_reg; |
|---|
| 8670 | 8681 | |
|---|
| 8671 | 8682 | ENTER; |
|---|
| 8672 | 8683 | ioa_cfg->pdev->state_saved = true; |
|---|
| .. | .. |
|---|
| 8682 | 8693 | if (ioa_cfg->sis64) { |
|---|
| 8683 | 8694 | /* Set the adapter to the correct endian mode. */ |
|---|
| 8684 | 8695 | writel(IPR_ENDIAN_SWAP_KEY, ioa_cfg->regs.endian_swap_reg); |
|---|
| 8685 | | - int_reg = readl(ioa_cfg->regs.endian_swap_reg); |
|---|
| 8696 | + readl(ioa_cfg->regs.endian_swap_reg); |
|---|
| 8686 | 8697 | } |
|---|
| 8687 | 8698 | |
|---|
| 8688 | 8699 | if (ioa_cfg->ioa_unit_checked) { |
|---|
| .. | .. |
|---|
| 9490 | 9501 | * Description: This is the second phase of adapter initialization |
|---|
| 9491 | 9502 | * This function takes care of initilizing the adapter to the point |
|---|
| 9492 | 9503 | * where it can accept new commands. |
|---|
| 9493 | | - |
|---|
| 9494 | 9504 | * Return value: |
|---|
| 9495 | 9505 | * 0 on success / -EIO on failure |
|---|
| 9496 | 9506 | **/ |
|---|
| .. | .. |
|---|
| 9537 | 9547 | } |
|---|
| 9538 | 9548 | } |
|---|
| 9539 | 9549 | |
|---|
| 9540 | | - if (ioa_cfg->ipr_cmd_pool) |
|---|
| 9541 | | - dma_pool_destroy(ioa_cfg->ipr_cmd_pool); |
|---|
| 9550 | + dma_pool_destroy(ioa_cfg->ipr_cmd_pool); |
|---|
| 9542 | 9551 | |
|---|
| 9543 | 9552 | kfree(ioa_cfg->ipr_cmnd_list); |
|---|
| 9544 | 9553 | kfree(ioa_cfg->ipr_cmnd_list_dma); |
|---|
| .. | .. |
|---|
| 9605 | 9614 | |
|---|
| 9606 | 9615 | /** |
|---|
| 9607 | 9616 | * ipr_free_all_resources - Free all allocated resources for an adapter. |
|---|
| 9608 | | - * @ipr_cmd: ipr command struct |
|---|
| 9617 | + * @ioa_cfg: ioa config struct |
|---|
| 9609 | 9618 | * |
|---|
| 9610 | 9619 | * This function frees all allocated resources for the |
|---|
| 9611 | 9620 | * specified adapter. |
|---|
| .. | .. |
|---|
| 9783 | 9792 | GFP_KERNEL); |
|---|
| 9784 | 9793 | |
|---|
| 9785 | 9794 | if (!ioa_cfg->hrrq[i].host_rrq) { |
|---|
| 9786 | | - while (--i > 0) |
|---|
| 9795 | + while (--i >= 0) |
|---|
| 9787 | 9796 | dma_free_coherent(&pdev->dev, |
|---|
| 9788 | 9797 | sizeof(u32) * ioa_cfg->hrrq[i].size, |
|---|
| 9789 | 9798 | ioa_cfg->hrrq[i].host_rrq, |
|---|
| .. | .. |
|---|
| 10056 | 10065 | ioa_cfg->vectors_info[i].desc, |
|---|
| 10057 | 10066 | &ioa_cfg->hrrq[i]); |
|---|
| 10058 | 10067 | if (rc) { |
|---|
| 10059 | | - while (--i >= 0) |
|---|
| 10068 | + while (--i > 0) |
|---|
| 10060 | 10069 | free_irq(pci_irq_vector(pdev, i), |
|---|
| 10061 | 10070 | &ioa_cfg->hrrq[i]); |
|---|
| 10062 | 10071 | return rc; |
|---|
| .. | .. |
|---|
| 10067 | 10076 | |
|---|
| 10068 | 10077 | /** |
|---|
| 10069 | 10078 | * ipr_test_intr - Handle the interrupt generated in ipr_test_msi(). |
|---|
| 10070 | | - * @pdev: PCI device struct |
|---|
| 10079 | + * @devp: PCI device struct |
|---|
| 10080 | + * @irq: IRQ number |
|---|
| 10071 | 10081 | * |
|---|
| 10072 | 10082 | * Description: Simply set the msi_received flag to 1 indicating that |
|---|
| 10073 | 10083 | * Message Signaled Interrupts are supported. |
|---|
| .. | .. |
|---|
| 10093 | 10103 | |
|---|
| 10094 | 10104 | /** |
|---|
| 10095 | 10105 | * ipr_test_msi - Test for Message Signaled Interrupt (MSI) support. |
|---|
| 10106 | + * @ioa_cfg: ioa config struct |
|---|
| 10096 | 10107 | * @pdev: PCI device struct |
|---|
| 10097 | 10108 | * |
|---|
| 10098 | 10109 | * Description: This routine sets up and initiates a test interrupt to determine |
|---|
| .. | .. |
|---|
| 10105 | 10116 | static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) |
|---|
| 10106 | 10117 | { |
|---|
| 10107 | 10118 | int rc; |
|---|
| 10108 | | - volatile u32 int_reg; |
|---|
| 10109 | 10119 | unsigned long lock_flags = 0; |
|---|
| 10110 | 10120 | int irq = pci_irq_vector(pdev, 0); |
|---|
| 10111 | 10121 | |
|---|
| .. | .. |
|---|
| 10116 | 10126 | ioa_cfg->msi_received = 0; |
|---|
| 10117 | 10127 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); |
|---|
| 10118 | 10128 | writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE, ioa_cfg->regs.clr_interrupt_mask_reg32); |
|---|
| 10119 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
|---|
| 10129 | + readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
|---|
| 10120 | 10130 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
|---|
| 10121 | 10131 | |
|---|
| 10122 | 10132 | rc = request_irq(irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); |
|---|
| .. | .. |
|---|
| 10127 | 10137 | dev_info(&pdev->dev, "IRQ assigned: %d\n", irq); |
|---|
| 10128 | 10138 | |
|---|
| 10129 | 10139 | writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE, ioa_cfg->regs.sense_interrupt_reg32); |
|---|
| 10130 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 10140 | + readl(ioa_cfg->regs.sense_interrupt_reg); |
|---|
| 10131 | 10141 | wait_event_timeout(ioa_cfg->msi_wait_q, ioa_cfg->msi_received, HZ); |
|---|
| 10132 | 10142 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
|---|
| 10133 | 10143 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); |
|---|
| .. | .. |
|---|
| 10538 | 10548 | |
|---|
| 10539 | 10549 | /** |
|---|
| 10540 | 10550 | * ipr_probe - Adapter hot plug add entry point |
|---|
| 10551 | + * @pdev: pci device struct |
|---|
| 10552 | + * @dev_id: pci device ID |
|---|
| 10541 | 10553 | * |
|---|
| 10542 | 10554 | * Return value: |
|---|
| 10543 | 10555 | * 0 on success / non-zero on failure |
|---|
| .. | .. |
|---|
| 10794 | 10806 | |
|---|
| 10795 | 10807 | /** |
|---|
| 10796 | 10808 | * ipr_halt_done - Shutdown prepare completion |
|---|
| 10809 | + * @ipr_cmd: ipr command struct |
|---|
| 10797 | 10810 | * |
|---|
| 10798 | 10811 | * Return value: |
|---|
| 10799 | 10812 | * none |
|---|
| .. | .. |
|---|
| 10805 | 10818 | |
|---|
| 10806 | 10819 | /** |
|---|
| 10807 | 10820 | * ipr_halt - Issue shutdown prepare to all adapters |
|---|
| 10821 | + * @nb: Notifier block |
|---|
| 10822 | + * @event: Notifier event |
|---|
| 10823 | + * @buf: Notifier data (unused) |
|---|
| 10808 | 10824 | * |
|---|
| 10809 | 10825 | * Return value: |
|---|
| 10810 | 10826 | * NOTIFY_OK on success / NOTIFY_DONE on failure |
|---|