.. | .. |
---|
| 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 |
---|
.. | .. |
---|
1531 | 1516 | } |
---|
1532 | 1517 | |
---|
1533 | 1518 | /** |
---|
1534 | | - * strip_and_pad_whitespace - Strip and pad trailing whitespace. |
---|
1535 | | - * @i: index into buffer |
---|
1536 | | - * @buf: string to modify |
---|
| 1519 | + * strip_whitespace - Strip and pad trailing whitespace. |
---|
| 1520 | + * @i: size of buffer |
---|
| 1521 | + * @buf: string to modify |
---|
1537 | 1522 | * |
---|
1538 | | - * This function will strip all trailing whitespace, pad the end |
---|
1539 | | - * of the string with a single space, and NULL terminate the string. |
---|
| 1523 | + * This function will strip all trailing whitespace and |
---|
| 1524 | + * NUL terminate the string. |
---|
1540 | 1525 | * |
---|
1541 | | - * Return value: |
---|
1542 | | - * new length of string |
---|
1543 | 1526 | **/ |
---|
1544 | | -static int strip_and_pad_whitespace(int i, char *buf) |
---|
| 1527 | +static void strip_whitespace(int i, char *buf) |
---|
1545 | 1528 | { |
---|
| 1529 | + if (i < 1) |
---|
| 1530 | + return; |
---|
| 1531 | + i--; |
---|
1546 | 1532 | while (i && buf[i] == ' ') |
---|
1547 | 1533 | i--; |
---|
1548 | | - buf[i+1] = ' '; |
---|
1549 | | - buf[i+2] = '\0'; |
---|
1550 | | - return i + 2; |
---|
| 1534 | + buf[i+1] = '\0'; |
---|
1551 | 1535 | } |
---|
1552 | 1536 | |
---|
1553 | 1537 | /** |
---|
.. | .. |
---|
1562 | 1546 | static void ipr_log_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb, |
---|
1563 | 1547 | struct ipr_vpd *vpd) |
---|
1564 | 1548 | { |
---|
1565 | | - char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN + IPR_SERIAL_NUM_LEN + 3]; |
---|
1566 | | - int i = 0; |
---|
| 1549 | + char vendor_id[IPR_VENDOR_ID_LEN + 1]; |
---|
| 1550 | + char product_id[IPR_PROD_ID_LEN + 1]; |
---|
| 1551 | + char sn[IPR_SERIAL_NUM_LEN + 1]; |
---|
1567 | 1552 | |
---|
1568 | | - memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN); |
---|
1569 | | - i = strip_and_pad_whitespace(IPR_VENDOR_ID_LEN - 1, buffer); |
---|
| 1553 | + memcpy(vendor_id, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN); |
---|
| 1554 | + strip_whitespace(IPR_VENDOR_ID_LEN, vendor_id); |
---|
1570 | 1555 | |
---|
1571 | | - memcpy(&buffer[i], vpd->vpids.product_id, IPR_PROD_ID_LEN); |
---|
1572 | | - i = strip_and_pad_whitespace(i + IPR_PROD_ID_LEN - 1, buffer); |
---|
| 1556 | + memcpy(product_id, vpd->vpids.product_id, IPR_PROD_ID_LEN); |
---|
| 1557 | + strip_whitespace(IPR_PROD_ID_LEN, product_id); |
---|
1573 | 1558 | |
---|
1574 | | - memcpy(&buffer[i], vpd->sn, IPR_SERIAL_NUM_LEN); |
---|
1575 | | - buffer[IPR_SERIAL_NUM_LEN + i] = '\0'; |
---|
| 1559 | + memcpy(sn, vpd->sn, IPR_SERIAL_NUM_LEN); |
---|
| 1560 | + strip_whitespace(IPR_SERIAL_NUM_LEN, sn); |
---|
1576 | 1561 | |
---|
1577 | | - ipr_hcam_err(hostrcb, "%s VPID/SN: %s\n", prefix, buffer); |
---|
| 1562 | + ipr_hcam_err(hostrcb, "%s VPID/SN: %s %s %s\n", prefix, |
---|
| 1563 | + vendor_id, product_id, sn); |
---|
1578 | 1564 | } |
---|
1579 | 1565 | |
---|
1580 | 1566 | /** |
---|
.. | .. |
---|
2681 | 2667 | |
---|
2682 | 2668 | /** |
---|
2683 | 2669 | * ipr_timeout - An internally generated op has timed out. |
---|
2684 | | - * @ipr_cmd: ipr command struct |
---|
| 2670 | + * @t: Timer context used to fetch ipr command struct |
---|
2685 | 2671 | * |
---|
2686 | 2672 | * This function blocks host requests and initiates an |
---|
2687 | 2673 | * adapter reset. |
---|
.. | .. |
---|
2714 | 2700 | |
---|
2715 | 2701 | /** |
---|
2716 | 2702 | * ipr_oper_timeout - Adapter timed out transitioning to operational |
---|
2717 | | - * @ipr_cmd: ipr command struct |
---|
| 2703 | + * @t: Timer context used to fetch ipr command struct |
---|
2718 | 2704 | * |
---|
2719 | 2705 | * This function blocks host requests and initiates an |
---|
2720 | 2706 | * adapter reset. |
---|
.. | .. |
---|
3498 | 3484 | /** |
---|
3499 | 3485 | * ipr_show_fw_version - Show the firmware version |
---|
3500 | 3486 | * @dev: class device struct |
---|
| 3487 | + * @attr: device attribute (unused) |
---|
3501 | 3488 | * @buf: buffer |
---|
3502 | 3489 | * |
---|
3503 | 3490 | * Return value: |
---|
.. | .. |
---|
3532 | 3519 | /** |
---|
3533 | 3520 | * ipr_show_log_level - Show the adapter's error logging level |
---|
3534 | 3521 | * @dev: class device struct |
---|
| 3522 | + * @attr: device attribute (unused) |
---|
3535 | 3523 | * @buf: buffer |
---|
3536 | 3524 | * |
---|
3537 | 3525 | * Return value: |
---|
.. | .. |
---|
3554 | 3542 | /** |
---|
3555 | 3543 | * ipr_store_log_level - Change the adapter's error logging level |
---|
3556 | 3544 | * @dev: class device struct |
---|
| 3545 | + * @attr: device attribute (unused) |
---|
3557 | 3546 | * @buf: buffer |
---|
| 3547 | + * @count: buffer size |
---|
3558 | 3548 | * |
---|
3559 | 3549 | * Return value: |
---|
3560 | 3550 | * number of bytes printed to buffer |
---|
.. | .. |
---|
3585 | 3575 | /** |
---|
3586 | 3576 | * ipr_store_diagnostics - IOA Diagnostics interface |
---|
3587 | 3577 | * @dev: device struct |
---|
| 3578 | + * @attr: device attribute (unused) |
---|
3588 | 3579 | * @buf: buffer |
---|
3589 | 3580 | * @count: buffer size |
---|
3590 | 3581 | * |
---|
.. | .. |
---|
3645 | 3636 | |
---|
3646 | 3637 | /** |
---|
3647 | 3638 | * ipr_show_adapter_state - Show the adapter's state |
---|
3648 | | - * @class_dev: device struct |
---|
| 3639 | + * @dev: device struct |
---|
| 3640 | + * @attr: device attribute (unused) |
---|
3649 | 3641 | * @buf: buffer |
---|
3650 | 3642 | * |
---|
3651 | 3643 | * Return value: |
---|
.. | .. |
---|
3671 | 3663 | /** |
---|
3672 | 3664 | * ipr_store_adapter_state - Change adapter state |
---|
3673 | 3665 | * @dev: device struct |
---|
| 3666 | + * @attr: device attribute (unused) |
---|
3674 | 3667 | * @buf: buffer |
---|
3675 | 3668 | * @count: buffer size |
---|
3676 | 3669 | * |
---|
.. | .. |
---|
3722 | 3715 | /** |
---|
3723 | 3716 | * ipr_store_reset_adapter - Reset the adapter |
---|
3724 | 3717 | * @dev: device struct |
---|
| 3718 | + * @attr: device attribute (unused) |
---|
3725 | 3719 | * @buf: buffer |
---|
3726 | 3720 | * @count: buffer size |
---|
3727 | 3721 | * |
---|
.. | .. |
---|
3763 | 3757 | /** |
---|
3764 | 3758 | * ipr_show_iopoll_weight - Show ipr polling mode |
---|
3765 | 3759 | * @dev: class device struct |
---|
| 3760 | + * @attr: device attribute (unused) |
---|
3766 | 3761 | * @buf: buffer |
---|
3767 | 3762 | * |
---|
3768 | 3763 | * Return value: |
---|
.. | .. |
---|
3786 | 3781 | /** |
---|
3787 | 3782 | * ipr_store_iopoll_weight - Change the adapter's polling mode |
---|
3788 | 3783 | * @dev: class device struct |
---|
| 3784 | + * @attr: device attribute (unused) |
---|
3789 | 3785 | * @buf: buffer |
---|
| 3786 | + * @count: buffer size |
---|
3790 | 3787 | * |
---|
3791 | 3788 | * Return value: |
---|
3792 | 3789 | * number of bytes printed to buffer |
---|
.. | .. |
---|
3885 | 3882 | |
---|
3886 | 3883 | /** |
---|
3887 | 3884 | * ipr_free_ucode_buffer - Frees a microcode download buffer |
---|
3888 | | - * @p_dnld: scatter/gather list pointer |
---|
| 3885 | + * @sglist: scatter/gather list pointer |
---|
3889 | 3886 | * |
---|
3890 | 3887 | * Free a DMA'able ucode download buffer previously allocated with |
---|
3891 | 3888 | * ipr_alloc_ucode_buffer |
---|
.. | .. |
---|
3915 | 3912 | u8 *buffer, u32 len) |
---|
3916 | 3913 | { |
---|
3917 | 3914 | int bsize_elem, i, result = 0; |
---|
3918 | | - struct scatterlist *scatterlist; |
---|
| 3915 | + struct scatterlist *sg; |
---|
3919 | 3916 | void *kaddr; |
---|
3920 | 3917 | |
---|
3921 | 3918 | /* Determine the actual number of bytes per element */ |
---|
3922 | 3919 | bsize_elem = PAGE_SIZE * (1 << sglist->order); |
---|
3923 | 3920 | |
---|
3924 | | - scatterlist = sglist->scatterlist; |
---|
| 3921 | + sg = sglist->scatterlist; |
---|
3925 | 3922 | |
---|
3926 | | - for (i = 0; i < (len / bsize_elem); i++, buffer += bsize_elem) { |
---|
3927 | | - struct page *page = sg_page(&scatterlist[i]); |
---|
| 3923 | + for (i = 0; i < (len / bsize_elem); i++, sg = sg_next(sg), |
---|
| 3924 | + buffer += bsize_elem) { |
---|
| 3925 | + struct page *page = sg_page(sg); |
---|
3928 | 3926 | |
---|
3929 | 3927 | kaddr = kmap(page); |
---|
3930 | 3928 | memcpy(kaddr, buffer, bsize_elem); |
---|
3931 | 3929 | kunmap(page); |
---|
3932 | 3930 | |
---|
3933 | | - scatterlist[i].length = bsize_elem; |
---|
| 3931 | + sg->length = bsize_elem; |
---|
3934 | 3932 | |
---|
3935 | 3933 | if (result != 0) { |
---|
3936 | 3934 | ipr_trace; |
---|
.. | .. |
---|
3939 | 3937 | } |
---|
3940 | 3938 | |
---|
3941 | 3939 | if (len % bsize_elem) { |
---|
3942 | | - struct page *page = sg_page(&scatterlist[i]); |
---|
| 3940 | + struct page *page = sg_page(sg); |
---|
3943 | 3941 | |
---|
3944 | 3942 | kaddr = kmap(page); |
---|
3945 | 3943 | memcpy(kaddr, buffer, len % bsize_elem); |
---|
3946 | 3944 | kunmap(page); |
---|
3947 | 3945 | |
---|
3948 | | - scatterlist[i].length = len % bsize_elem; |
---|
| 3946 | + sg->length = len % bsize_elem; |
---|
3949 | 3947 | } |
---|
3950 | 3948 | |
---|
3951 | 3949 | sglist->buffer_len = len; |
---|
.. | .. |
---|
3966 | 3964 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
---|
3967 | 3965 | struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64; |
---|
3968 | 3966 | struct scatterlist *scatterlist = sglist->scatterlist; |
---|
| 3967 | + struct scatterlist *sg; |
---|
3969 | 3968 | int i; |
---|
3970 | 3969 | |
---|
3971 | 3970 | ipr_cmd->dma_use_sg = sglist->num_dma_sg; |
---|
.. | .. |
---|
3974 | 3973 | |
---|
3975 | 3974 | ioarcb->ioadl_len = |
---|
3976 | 3975 | cpu_to_be32(sizeof(struct ipr_ioadl64_desc) * ipr_cmd->dma_use_sg); |
---|
3977 | | - for (i = 0; i < ipr_cmd->dma_use_sg; i++) { |
---|
| 3976 | + for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { |
---|
3978 | 3977 | 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])); |
---|
| 3978 | + ioadl64[i].data_len = cpu_to_be32(sg_dma_len(sg)); |
---|
| 3979 | + ioadl64[i].address = cpu_to_be64(sg_dma_address(sg)); |
---|
3981 | 3980 | } |
---|
3982 | 3981 | |
---|
3983 | 3982 | ioadl64[i-1].flags |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); |
---|
.. | .. |
---|
3997 | 3996 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
---|
3998 | 3997 | struct ipr_ioadl_desc *ioadl = ipr_cmd->i.ioadl; |
---|
3999 | 3998 | struct scatterlist *scatterlist = sglist->scatterlist; |
---|
| 3999 | + struct scatterlist *sg; |
---|
4000 | 4000 | int i; |
---|
4001 | 4001 | |
---|
4002 | 4002 | ipr_cmd->dma_use_sg = sglist->num_dma_sg; |
---|
.. | .. |
---|
4006 | 4006 | ioarcb->ioadl_len = |
---|
4007 | 4007 | cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); |
---|
4008 | 4008 | |
---|
4009 | | - for (i = 0; i < ipr_cmd->dma_use_sg; i++) { |
---|
| 4009 | + for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { |
---|
4010 | 4010 | ioadl[i].flags_and_data_len = |
---|
4011 | | - cpu_to_be32(IPR_IOADL_FLAGS_WRITE | sg_dma_len(&scatterlist[i])); |
---|
| 4011 | + cpu_to_be32(IPR_IOADL_FLAGS_WRITE | sg_dma_len(sg)); |
---|
4012 | 4012 | ioadl[i].address = |
---|
4013 | | - cpu_to_be32(sg_dma_address(&scatterlist[i])); |
---|
| 4013 | + cpu_to_be32(sg_dma_address(sg)); |
---|
4014 | 4014 | } |
---|
4015 | 4015 | |
---|
4016 | 4016 | ioadl[i-1].flags_and_data_len |= |
---|
.. | .. |
---|
4070 | 4070 | |
---|
4071 | 4071 | /** |
---|
4072 | 4072 | * ipr_store_update_fw - Update the firmware on the adapter |
---|
4073 | | - * @class_dev: device struct |
---|
| 4073 | + * @dev: device struct |
---|
| 4074 | + * @attr: device attribute (unused) |
---|
4074 | 4075 | * @buf: buffer |
---|
4075 | 4076 | * @count: buffer size |
---|
4076 | 4077 | * |
---|
.. | .. |
---|
4150 | 4151 | /** |
---|
4151 | 4152 | * ipr_show_fw_type - Show the adapter's firmware type. |
---|
4152 | 4153 | * @dev: class device struct |
---|
| 4154 | + * @attr: device attribute (unused) |
---|
4153 | 4155 | * @buf: buffer |
---|
4154 | 4156 | * |
---|
4155 | 4157 | * Return value: |
---|
.. | .. |
---|
4491 | 4493 | * ipr_change_queue_depth - Change the device's queue depth |
---|
4492 | 4494 | * @sdev: scsi device struct |
---|
4493 | 4495 | * @qdepth: depth to set |
---|
4494 | | - * @reason: calling context |
---|
4495 | 4496 | * |
---|
4496 | 4497 | * Return value: |
---|
4497 | 4498 | * actual depth set |
---|
.. | .. |
---|
4661 | 4662 | /** |
---|
4662 | 4663 | * ipr_show_raw_mode - Show the adapter's raw mode |
---|
4663 | 4664 | * @dev: class device struct |
---|
| 4665 | + * @attr: device attribute (unused) |
---|
4664 | 4666 | * @buf: buffer |
---|
4665 | 4667 | * |
---|
4666 | 4668 | * Return value: |
---|
.. | .. |
---|
4688 | 4690 | /** |
---|
4689 | 4691 | * ipr_store_raw_mode - Change the adapter's raw mode |
---|
4690 | 4692 | * @dev: class device struct |
---|
| 4693 | + * @attr: device attribute (unused) |
---|
4691 | 4694 | * @buf: buffer |
---|
| 4695 | + * @count: buffer size |
---|
4692 | 4696 | * |
---|
4693 | 4697 | * Return value: |
---|
4694 | 4698 | * number of bytes printed to buffer |
---|
.. | .. |
---|
5071 | 5075 | |
---|
5072 | 5076 | /** |
---|
5073 | 5077 | * ipr_cmnd_is_free - Check if a command is free or not |
---|
5074 | | - * @ipr_cmd ipr command struct |
---|
| 5078 | + * @ipr_cmd: ipr command struct |
---|
5075 | 5079 | * |
---|
5076 | 5080 | * Returns: |
---|
5077 | 5081 | * true / false |
---|
.. | .. |
---|
5107 | 5111 | |
---|
5108 | 5112 | /** |
---|
5109 | 5113 | * ipr_wait_for_ops - Wait for matching commands to complete |
---|
5110 | | - * @ipr_cmd: ipr command struct |
---|
| 5114 | + * @ioa_cfg: ioa config struct |
---|
5111 | 5115 | * @device: device to match (sdev) |
---|
5112 | 5116 | * @match: match function to use |
---|
5113 | 5117 | * |
---|
.. | .. |
---|
5272 | 5276 | * ipr_sata_reset - Reset the SATA port |
---|
5273 | 5277 | * @link: SATA link to reset |
---|
5274 | 5278 | * @classes: class of the attached device |
---|
| 5279 | + * @deadline: unused |
---|
5275 | 5280 | * |
---|
5276 | 5281 | * This function issues a SATA phy reset to the affected ATA link. |
---|
5277 | 5282 | * |
---|
.. | .. |
---|
5451 | 5456 | |
---|
5452 | 5457 | /** |
---|
5453 | 5458 | * ipr_abort_timeout - An abort task has timed out |
---|
5454 | | - * @ipr_cmd: ipr command struct |
---|
| 5459 | + * @t: Timer context used to fetch ipr command struct |
---|
5455 | 5460 | * |
---|
5456 | 5461 | * This function handles when an abort task times out. If this |
---|
5457 | 5462 | * happens we issue a bus reset since we have resources tied |
---|
.. | .. |
---|
5505 | 5510 | struct ipr_ioa_cfg *ioa_cfg; |
---|
5506 | 5511 | struct ipr_resource_entry *res; |
---|
5507 | 5512 | struct ipr_cmd_pkt *cmd_pkt; |
---|
5508 | | - u32 ioasc, int_reg; |
---|
| 5513 | + u32 ioasc; |
---|
5509 | 5514 | int i, op_found = 0; |
---|
5510 | 5515 | struct ipr_hrr_queue *hrrq; |
---|
5511 | 5516 | |
---|
.. | .. |
---|
5528 | 5533 | * by a still not detected EEH error. In such cases, reading a register will |
---|
5529 | 5534 | * trigger the EEH recovery infrastructure. |
---|
5530 | 5535 | */ |
---|
5531 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); |
---|
| 5536 | + readl(ioa_cfg->regs.sense_interrupt_reg); |
---|
5532 | 5537 | |
---|
5533 | 5538 | if (!ipr_is_gscsi(res)) |
---|
5534 | 5539 | return FAILED; |
---|
.. | .. |
---|
5580 | 5585 | |
---|
5581 | 5586 | /** |
---|
5582 | 5587 | * ipr_eh_abort - Abort a single op |
---|
5583 | | - * @scsi_cmd: scsi command struct |
---|
| 5588 | + * @shost: scsi host struct |
---|
| 5589 | + * @elapsed_time: elapsed time |
---|
5584 | 5590 | * |
---|
5585 | 5591 | * Return value: |
---|
5586 | 5592 | * 0 if scan in progress / 1 if scan is complete |
---|
.. | .. |
---|
5707 | 5713 | * ipr_isr_eh - Interrupt service routine error handler |
---|
5708 | 5714 | * @ioa_cfg: ioa config struct |
---|
5709 | 5715 | * @msg: message to log |
---|
| 5716 | + * @number: various meanings depending on the caller/message |
---|
5710 | 5717 | * |
---|
5711 | 5718 | * Return value: |
---|
5712 | 5719 | * none |
---|
.. | .. |
---|
5773 | 5780 | |
---|
5774 | 5781 | static int ipr_iopoll(struct irq_poll *iop, int budget) |
---|
5775 | 5782 | { |
---|
5776 | | - struct ipr_ioa_cfg *ioa_cfg; |
---|
5777 | 5783 | struct ipr_hrr_queue *hrrq; |
---|
5778 | 5784 | struct ipr_cmnd *ipr_cmd, *temp; |
---|
5779 | 5785 | unsigned long hrrq_flags; |
---|
.. | .. |
---|
5781 | 5787 | LIST_HEAD(doneq); |
---|
5782 | 5788 | |
---|
5783 | 5789 | hrrq = container_of(iop, struct ipr_hrr_queue, iopoll); |
---|
5784 | | - ioa_cfg = hrrq->ioa_cfg; |
---|
5785 | 5790 | |
---|
5786 | 5791 | spin_lock_irqsave(hrrq->lock, hrrq_flags); |
---|
5787 | 5792 | completed_ops = ipr_process_hrrq(hrrq, budget, &doneq); |
---|
.. | .. |
---|
6279 | 6284 | |
---|
6280 | 6285 | /** |
---|
6281 | 6286 | * ipr_gen_sense - Generate SCSI sense data from an IOASA |
---|
6282 | | - * @ioasa: IOASA |
---|
6283 | | - * @sense_buf: sense data buffer |
---|
| 6287 | + * @ipr_cmd: ipr command struct |
---|
6284 | 6288 | * |
---|
6285 | 6289 | * Return value: |
---|
6286 | 6290 | * none |
---|
.. | .. |
---|
6696 | 6700 | * Return value: |
---|
6697 | 6701 | * 0 on success / other on failure |
---|
6698 | 6702 | **/ |
---|
6699 | | -static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) |
---|
| 6703 | +static int ipr_ioctl(struct scsi_device *sdev, unsigned int cmd, |
---|
| 6704 | + void __user *arg) |
---|
6700 | 6705 | { |
---|
6701 | 6706 | struct ipr_resource_entry *res; |
---|
6702 | 6707 | |
---|
.. | .. |
---|
6712 | 6717 | |
---|
6713 | 6718 | /** |
---|
6714 | 6719 | * ipr_info - Get information about the card/driver |
---|
6715 | | - * @scsi_host: scsi host struct |
---|
| 6720 | + * @host: scsi host struct |
---|
6716 | 6721 | * |
---|
6717 | 6722 | * Return value: |
---|
6718 | 6723 | * pointer to buffer with description string |
---|
.. | .. |
---|
6737 | 6742 | .name = "IPR", |
---|
6738 | 6743 | .info = ipr_ioa_info, |
---|
6739 | 6744 | .ioctl = ipr_ioctl, |
---|
| 6745 | +#ifdef CONFIG_COMPAT |
---|
| 6746 | + .compat_ioctl = ipr_ioctl, |
---|
| 6747 | +#endif |
---|
6740 | 6748 | .queuecommand = ipr_queuecommand, |
---|
| 6749 | + .dma_need_drain = ata_scsi_dma_need_drain, |
---|
6741 | 6750 | .eh_abort_handler = ipr_eh_abort, |
---|
6742 | 6751 | .eh_device_reset_handler = ipr_eh_dev_reset, |
---|
6743 | 6752 | .eh_host_reset_handler = ipr_eh_host_reset, |
---|
.. | .. |
---|
6754 | 6763 | .sg_tablesize = IPR_MAX_SGLIST, |
---|
6755 | 6764 | .max_sectors = IPR_IOA_MAX_SECTORS, |
---|
6756 | 6765 | .cmd_per_lun = IPR_MAX_CMD_PER_LUN, |
---|
6757 | | - .use_clustering = ENABLE_CLUSTERING, |
---|
6758 | 6766 | .shost_attrs = ipr_ioa_attrs, |
---|
6759 | 6767 | .sdev_attrs = ipr_dev_attrs, |
---|
6760 | 6768 | .proc_name = IPR_NAME, |
---|
.. | .. |
---|
7599 | 7607 | /** |
---|
7600 | 7608 | * ipr_build_mode_sense - Builds a mode sense command |
---|
7601 | 7609 | * @ipr_cmd: ipr command struct |
---|
7602 | | - * @res: resource entry struct |
---|
| 7610 | + * @res_handle: resource entry struct |
---|
7603 | 7611 | * @parm: Byte 2 of mode sense command |
---|
7604 | 7612 | * @dma_addr: DMA address of mode sense buffer |
---|
7605 | 7613 | * @xfer_len: Size of DMA buffer |
---|
.. | .. |
---|
7946 | 7954 | /** |
---|
7947 | 7955 | * ipr_ioafp_set_caching_parameters - Issue Set Cache parameters service |
---|
7948 | 7956 | * action |
---|
| 7957 | + * @ipr_cmd: ipr command struct |
---|
7949 | 7958 | * |
---|
7950 | 7959 | * Return value: |
---|
7951 | 7960 | * none |
---|
.. | .. |
---|
7982 | 7991 | /** |
---|
7983 | 7992 | * ipr_ioafp_inquiry - Send an Inquiry to the adapter. |
---|
7984 | 7993 | * @ipr_cmd: ipr command struct |
---|
| 7994 | + * @flags: flags to send |
---|
| 7995 | + * @page: page to inquire |
---|
| 7996 | + * @dma_addr: DMA address |
---|
| 7997 | + * @xfer_len: transfer data length |
---|
7985 | 7998 | * |
---|
7986 | 7999 | * This utility function sends an inquiry to the adapter. |
---|
7987 | 8000 | * |
---|
.. | .. |
---|
8272 | 8285 | |
---|
8273 | 8286 | /** |
---|
8274 | 8287 | * ipr_reset_timer_done - Adapter reset timer function |
---|
8275 | | - * @ipr_cmd: ipr command struct |
---|
| 8288 | + * @t: Timer context used to fetch ipr command struct |
---|
8276 | 8289 | * |
---|
8277 | 8290 | * Description: This function is used in adapter reset processing |
---|
8278 | 8291 | * for timing events. If the reset_cmd pointer in the IOA |
---|
.. | .. |
---|
8666 | 8679 | static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd) |
---|
8667 | 8680 | { |
---|
8668 | 8681 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
---|
8669 | | - u32 int_reg; |
---|
8670 | 8682 | |
---|
8671 | 8683 | ENTER; |
---|
8672 | 8684 | ioa_cfg->pdev->state_saved = true; |
---|
.. | .. |
---|
8682 | 8694 | if (ioa_cfg->sis64) { |
---|
8683 | 8695 | /* Set the adapter to the correct endian mode. */ |
---|
8684 | 8696 | writel(IPR_ENDIAN_SWAP_KEY, ioa_cfg->regs.endian_swap_reg); |
---|
8685 | | - int_reg = readl(ioa_cfg->regs.endian_swap_reg); |
---|
| 8697 | + readl(ioa_cfg->regs.endian_swap_reg); |
---|
8686 | 8698 | } |
---|
8687 | 8699 | |
---|
8688 | 8700 | if (ioa_cfg->ioa_unit_checked) { |
---|
.. | .. |
---|
9490 | 9502 | * Description: This is the second phase of adapter initialization |
---|
9491 | 9503 | * This function takes care of initilizing the adapter to the point |
---|
9492 | 9504 | * where it can accept new commands. |
---|
9493 | | - |
---|
9494 | 9505 | * Return value: |
---|
9495 | 9506 | * 0 on success / -EIO on failure |
---|
9496 | 9507 | **/ |
---|
.. | .. |
---|
9537 | 9548 | } |
---|
9538 | 9549 | } |
---|
9539 | 9550 | |
---|
9540 | | - if (ioa_cfg->ipr_cmd_pool) |
---|
9541 | | - dma_pool_destroy(ioa_cfg->ipr_cmd_pool); |
---|
| 9551 | + dma_pool_destroy(ioa_cfg->ipr_cmd_pool); |
---|
9542 | 9552 | |
---|
9543 | 9553 | kfree(ioa_cfg->ipr_cmnd_list); |
---|
9544 | 9554 | kfree(ioa_cfg->ipr_cmnd_list_dma); |
---|
.. | .. |
---|
9605 | 9615 | |
---|
9606 | 9616 | /** |
---|
9607 | 9617 | * ipr_free_all_resources - Free all allocated resources for an adapter. |
---|
9608 | | - * @ipr_cmd: ipr command struct |
---|
| 9618 | + * @ioa_cfg: ioa config struct |
---|
9609 | 9619 | * |
---|
9610 | 9620 | * This function frees all allocated resources for the |
---|
9611 | 9621 | * specified adapter. |
---|
.. | .. |
---|
9783 | 9793 | GFP_KERNEL); |
---|
9784 | 9794 | |
---|
9785 | 9795 | if (!ioa_cfg->hrrq[i].host_rrq) { |
---|
9786 | | - while (--i > 0) |
---|
| 9796 | + while (--i >= 0) |
---|
9787 | 9797 | dma_free_coherent(&pdev->dev, |
---|
9788 | 9798 | sizeof(u32) * ioa_cfg->hrrq[i].size, |
---|
9789 | 9799 | ioa_cfg->hrrq[i].host_rrq, |
---|
.. | .. |
---|
10056 | 10066 | ioa_cfg->vectors_info[i].desc, |
---|
10057 | 10067 | &ioa_cfg->hrrq[i]); |
---|
10058 | 10068 | if (rc) { |
---|
10059 | | - while (--i >= 0) |
---|
| 10069 | + while (--i > 0) |
---|
10060 | 10070 | free_irq(pci_irq_vector(pdev, i), |
---|
10061 | 10071 | &ioa_cfg->hrrq[i]); |
---|
10062 | 10072 | return rc; |
---|
.. | .. |
---|
10067 | 10077 | |
---|
10068 | 10078 | /** |
---|
10069 | 10079 | * ipr_test_intr - Handle the interrupt generated in ipr_test_msi(). |
---|
10070 | | - * @pdev: PCI device struct |
---|
| 10080 | + * @devp: PCI device struct |
---|
| 10081 | + * @irq: IRQ number |
---|
10071 | 10082 | * |
---|
10072 | 10083 | * Description: Simply set the msi_received flag to 1 indicating that |
---|
10073 | 10084 | * Message Signaled Interrupts are supported. |
---|
.. | .. |
---|
10093 | 10104 | |
---|
10094 | 10105 | /** |
---|
10095 | 10106 | * ipr_test_msi - Test for Message Signaled Interrupt (MSI) support. |
---|
| 10107 | + * @ioa_cfg: ioa config struct |
---|
10096 | 10108 | * @pdev: PCI device struct |
---|
10097 | 10109 | * |
---|
10098 | 10110 | * Description: This routine sets up and initiates a test interrupt to determine |
---|
.. | .. |
---|
10105 | 10117 | static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) |
---|
10106 | 10118 | { |
---|
10107 | 10119 | int rc; |
---|
10108 | | - volatile u32 int_reg; |
---|
10109 | 10120 | unsigned long lock_flags = 0; |
---|
10110 | 10121 | int irq = pci_irq_vector(pdev, 0); |
---|
10111 | 10122 | |
---|
.. | .. |
---|
10116 | 10127 | ioa_cfg->msi_received = 0; |
---|
10117 | 10128 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); |
---|
10118 | 10129 | writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE, ioa_cfg->regs.clr_interrupt_mask_reg32); |
---|
10119 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
---|
| 10130 | + readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
---|
10120 | 10131 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
---|
10121 | 10132 | |
---|
10122 | 10133 | rc = request_irq(irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); |
---|
.. | .. |
---|
10127 | 10138 | dev_info(&pdev->dev, "IRQ assigned: %d\n", irq); |
---|
10128 | 10139 | |
---|
10129 | 10140 | writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE, ioa_cfg->regs.sense_interrupt_reg32); |
---|
10130 | | - int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); |
---|
| 10141 | + readl(ioa_cfg->regs.sense_interrupt_reg); |
---|
10131 | 10142 | wait_event_timeout(ioa_cfg->msi_wait_q, ioa_cfg->msi_received, HZ); |
---|
10132 | 10143 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
---|
10133 | 10144 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); |
---|
.. | .. |
---|
10538 | 10549 | |
---|
10539 | 10550 | /** |
---|
10540 | 10551 | * ipr_probe - Adapter hot plug add entry point |
---|
| 10552 | + * @pdev: pci device struct |
---|
| 10553 | + * @dev_id: pci device ID |
---|
10541 | 10554 | * |
---|
10542 | 10555 | * Return value: |
---|
10543 | 10556 | * 0 on success / non-zero on failure |
---|
.. | .. |
---|
10794 | 10807 | |
---|
10795 | 10808 | /** |
---|
10796 | 10809 | * ipr_halt_done - Shutdown prepare completion |
---|
| 10810 | + * @ipr_cmd: ipr command struct |
---|
10797 | 10811 | * |
---|
10798 | 10812 | * Return value: |
---|
10799 | 10813 | * none |
---|
.. | .. |
---|
10805 | 10819 | |
---|
10806 | 10820 | /** |
---|
10807 | 10821 | * ipr_halt - Issue shutdown prepare to all adapters |
---|
| 10822 | + * @nb: Notifier block |
---|
| 10823 | + * @event: Notifier event |
---|
| 10824 | + * @buf: Notifier data (unused) |
---|
10808 | 10825 | * |
---|
10809 | 10826 | * Return value: |
---|
10810 | 10827 | * NOTIFY_OK on success / NOTIFY_DONE on failure |
---|
.. | .. |
---|
10854 | 10871 | **/ |
---|
10855 | 10872 | static int __init ipr_init(void) |
---|
10856 | 10873 | { |
---|
| 10874 | + int rc; |
---|
| 10875 | + |
---|
10857 | 10876 | ipr_info("IBM Power RAID SCSI Device Driver version: %s %s\n", |
---|
10858 | 10877 | IPR_DRIVER_VERSION, IPR_DRIVER_DATE); |
---|
10859 | 10878 | |
---|
10860 | 10879 | register_reboot_notifier(&ipr_notifier); |
---|
10861 | | - return pci_register_driver(&ipr_driver); |
---|
| 10880 | + rc = pci_register_driver(&ipr_driver); |
---|
| 10881 | + if (rc) { |
---|
| 10882 | + unregister_reboot_notifier(&ipr_notifier); |
---|
| 10883 | + return rc; |
---|
| 10884 | + } |
---|
| 10885 | + |
---|
| 10886 | + return 0; |
---|
10862 | 10887 | } |
---|
10863 | 10888 | |
---|
10864 | 10889 | /** |
---|