| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
|---|
| 3 | 4 | * Copyright (c) 2014- QLogic Corporation. |
|---|
| .. | .. |
|---|
| 5 | 6 | * www.qlogic.com |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License (GPL) Version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #include "bfad_drv.h" |
|---|
| .. | .. |
|---|
| 709 | 701 | bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf) |
|---|
| 710 | 702 | { |
|---|
| 711 | 703 | struct bfi_ioc_image_hdr_s fwhdr; |
|---|
| 712 | | - u32 r32, fwstate, pgnum, pgoff, loff = 0; |
|---|
| 704 | + u32 r32, fwstate, pgnum, loff = 0; |
|---|
| 713 | 705 | int i; |
|---|
| 714 | 706 | |
|---|
| 715 | 707 | /* |
|---|
| .. | .. |
|---|
| 739 | 731 | * Clear fwver hdr |
|---|
| 740 | 732 | */ |
|---|
| 741 | 733 | pgnum = PSS_SMEM_PGNUM(iocpf->ioc->ioc_regs.smem_pg0, loff); |
|---|
| 742 | | - pgoff = PSS_SMEM_PGOFF(loff); |
|---|
| 743 | 734 | writel(pgnum, iocpf->ioc->ioc_regs.host_page_num_fn); |
|---|
| 744 | 735 | |
|---|
| 745 | 736 | for (i = 0; i < sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32); i++) { |
|---|
| .. | .. |
|---|
| 978 | 969 | |
|---|
| 979 | 970 | case IOCPF_E_INITFAIL: |
|---|
| 980 | 971 | bfa_iocpf_timer_stop(ioc); |
|---|
| 981 | | - /* |
|---|
| 982 | | - * !!! fall through !!! |
|---|
| 983 | | - */ |
|---|
| 972 | + fallthrough; |
|---|
| 984 | 973 | |
|---|
| 985 | 974 | case IOCPF_E_TIMEOUT: |
|---|
| 986 | 975 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
|---|
| .. | .. |
|---|
| 1056 | 1045 | |
|---|
| 1057 | 1046 | case IOCPF_E_FAIL: |
|---|
| 1058 | 1047 | bfa_iocpf_timer_stop(ioc); |
|---|
| 1059 | | - /* |
|---|
| 1060 | | - * !!! fall through !!! |
|---|
| 1061 | | - */ |
|---|
| 1048 | + fallthrough; |
|---|
| 1062 | 1049 | |
|---|
| 1063 | 1050 | case IOCPF_E_TIMEOUT: |
|---|
| 1064 | 1051 | bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL); |
|---|
| .. | .. |
|---|
| 1452 | 1439 | void |
|---|
| 1453 | 1440 | bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) |
|---|
| 1454 | 1441 | { |
|---|
| 1455 | | - u32 pgnum, pgoff; |
|---|
| 1442 | + u32 pgnum; |
|---|
| 1456 | 1443 | u32 loff = 0; |
|---|
| 1457 | 1444 | int i; |
|---|
| 1458 | 1445 | u32 *fwsig = (u32 *) fwhdr; |
|---|
| 1459 | 1446 | |
|---|
| 1460 | 1447 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
|---|
| 1461 | | - pgoff = PSS_SMEM_PGOFF(loff); |
|---|
| 1462 | 1448 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
|---|
| 1463 | 1449 | |
|---|
| 1464 | 1450 | for (i = 0; i < (sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32)); |
|---|
| .. | .. |
|---|
| 1674 | 1660 | bfa_ioc_fwsig_invalidate(struct bfa_ioc_s *ioc) |
|---|
| 1675 | 1661 | { |
|---|
| 1676 | 1662 | |
|---|
| 1677 | | - u32 pgnum, pgoff; |
|---|
| 1663 | + u32 pgnum; |
|---|
| 1678 | 1664 | u32 loff = 0; |
|---|
| 1679 | 1665 | enum bfi_ioc_state ioc_fwstate; |
|---|
| 1680 | 1666 | |
|---|
| .. | .. |
|---|
| 1683 | 1669 | return BFA_STATUS_ADAPTER_ENABLED; |
|---|
| 1684 | 1670 | |
|---|
| 1685 | 1671 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
|---|
| 1686 | | - pgoff = PSS_SMEM_PGOFF(loff); |
|---|
| 1687 | 1672 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
|---|
| 1688 | 1673 | bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, BFA_IOC_FW_INV_SIGN); |
|---|
| 1689 | 1674 | |
|---|
| .. | .. |
|---|
| 1875 | 1860 | u32 boot_env) |
|---|
| 1876 | 1861 | { |
|---|
| 1877 | 1862 | u32 *fwimg; |
|---|
| 1878 | | - u32 pgnum, pgoff; |
|---|
| 1863 | + u32 pgnum; |
|---|
| 1879 | 1864 | u32 loff = 0; |
|---|
| 1880 | 1865 | u32 chunkno = 0; |
|---|
| 1881 | 1866 | u32 i; |
|---|
| .. | .. |
|---|
| 1904 | 1889 | |
|---|
| 1905 | 1890 | |
|---|
| 1906 | 1891 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
|---|
| 1907 | | - pgoff = PSS_SMEM_PGOFF(loff); |
|---|
| 1908 | | - |
|---|
| 1909 | 1892 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
|---|
| 1910 | 1893 | |
|---|
| 1911 | 1894 | for (i = 0; i < fwimg_size; i++) { |
|---|
| .. | .. |
|---|
| 3819 | 3802 | sfp->state = BFA_SFP_STATE_REMOVED; |
|---|
| 3820 | 3803 | sfp->data_valid = 0; |
|---|
| 3821 | 3804 | bfa_sfp_scn_aen_post(sfp, rsp); |
|---|
| 3822 | | - break; |
|---|
| 3805 | + break; |
|---|
| 3823 | 3806 | case BFA_SFP_SCN_FAILED: |
|---|
| 3824 | 3807 | sfp->state = BFA_SFP_STATE_FAILED; |
|---|
| 3825 | 3808 | sfp->data_valid = 0; |
|---|
| .. | .. |
|---|
| 4775 | 4758 | struct bfa_ioc_s *ioc = diag->ioc; |
|---|
| 4776 | 4759 | struct bfa_diag_memtest_result *res = diag->result; |
|---|
| 4777 | 4760 | u32 loff = BFI_BOOT_MEMTEST_RES_ADDR; |
|---|
| 4778 | | - u32 pgnum, pgoff, i; |
|---|
| 4761 | + u32 pgnum, i; |
|---|
| 4779 | 4762 | |
|---|
| 4780 | 4763 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
|---|
| 4781 | | - pgoff = PSS_SMEM_PGOFF(loff); |
|---|
| 4782 | | - |
|---|
| 4783 | 4764 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
|---|
| 4784 | 4765 | |
|---|
| 4785 | 4766 | for (i = 0; i < (sizeof(struct bfa_diag_memtest_result) / |
|---|
| .. | .. |
|---|
| 5038 | 5019 | /* |
|---|
| 5039 | 5020 | * Diag hmbox handler |
|---|
| 5040 | 5021 | */ |
|---|
| 5041 | | -void |
|---|
| 5022 | +static void |
|---|
| 5042 | 5023 | bfa_diag_intr(void *diagarg, struct bfi_mbmsg_s *msg) |
|---|
| 5043 | 5024 | { |
|---|
| 5044 | 5025 | struct bfa_diag_s *diag = diagarg; |
|---|
| .. | .. |
|---|
| 5763 | 5744 | (struct bfa_phy_stats_s *) phy->ubuf; |
|---|
| 5764 | 5745 | bfa_phy_ntoh32((u32 *)stats, (u32 *)phy->dbuf_kva, |
|---|
| 5765 | 5746 | sizeof(struct bfa_phy_stats_s)); |
|---|
| 5766 | | - bfa_trc(phy, stats->status); |
|---|
| 5747 | + bfa_trc(phy, stats->status); |
|---|
| 5767 | 5748 | } |
|---|
| 5768 | 5749 | |
|---|
| 5769 | 5750 | phy->status = status; |
|---|
| .. | .. |
|---|
| 6007 | 5988 | case BFA_DCONF_SM_IOCDISABLE: |
|---|
| 6008 | 5989 | case BFA_DCONF_SM_FLASH_COMP: |
|---|
| 6009 | 5990 | bfa_timer_stop(&dconf->timer); |
|---|
| 5991 | + fallthrough; |
|---|
| 6010 | 5992 | case BFA_DCONF_SM_TIMEOUT: |
|---|
| 6011 | 5993 | bfa_sm_set_state(dconf, bfa_dconf_sm_uninit); |
|---|
| 6012 | 5994 | bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE); |
|---|
| .. | .. |
|---|
| 6660 | 6642 | BFA_FLASH_READ_STATUS = 0x05, /* read status */ |
|---|
| 6661 | 6643 | }; |
|---|
| 6662 | 6644 | |
|---|
| 6663 | | -/** |
|---|
| 6664 | | - * @brief hardware error definition |
|---|
| 6645 | +/* |
|---|
| 6646 | + * Hardware error definition |
|---|
| 6665 | 6647 | */ |
|---|
| 6666 | 6648 | enum bfa_flash_err { |
|---|
| 6667 | 6649 | BFA_FLASH_NOT_PRESENT = -1, /*!< flash not present */ |
|---|
| .. | .. |
|---|
| 6675 | 6657 | BFA_FLASH_ERR_LEN = -9, /*!< invalid length */ |
|---|
| 6676 | 6658 | }; |
|---|
| 6677 | 6659 | |
|---|
| 6678 | | -/** |
|---|
| 6679 | | - * @brief flash command register data structure |
|---|
| 6660 | +/* |
|---|
| 6661 | + * Flash command register data structure |
|---|
| 6680 | 6662 | */ |
|---|
| 6681 | 6663 | union bfa_flash_cmd_reg_u { |
|---|
| 6682 | 6664 | struct { |
|---|
| .. | .. |
|---|
| 6699 | 6681 | u32 i; |
|---|
| 6700 | 6682 | }; |
|---|
| 6701 | 6683 | |
|---|
| 6702 | | -/** |
|---|
| 6703 | | - * @brief flash device status register data structure |
|---|
| 6684 | +/* |
|---|
| 6685 | + * Flash device status register data structure |
|---|
| 6704 | 6686 | */ |
|---|
| 6705 | 6687 | union bfa_flash_dev_status_reg_u { |
|---|
| 6706 | 6688 | struct { |
|---|
| .. | .. |
|---|
| 6725 | 6707 | u32 i; |
|---|
| 6726 | 6708 | }; |
|---|
| 6727 | 6709 | |
|---|
| 6728 | | -/** |
|---|
| 6729 | | - * @brief flash address register data structure |
|---|
| 6710 | +/* |
|---|
| 6711 | + * Flash address register data structure |
|---|
| 6730 | 6712 | */ |
|---|
| 6731 | 6713 | union bfa_flash_addr_reg_u { |
|---|
| 6732 | 6714 | struct { |
|---|
| .. | .. |
|---|
| 6741 | 6723 | u32 i; |
|---|
| 6742 | 6724 | }; |
|---|
| 6743 | 6725 | |
|---|
| 6744 | | -/** |
|---|
| 6726 | +/* |
|---|
| 6745 | 6727 | * dg flash_raw_private Flash raw private functions |
|---|
| 6746 | 6728 | */ |
|---|
| 6747 | 6729 | static void |
|---|
| .. | .. |
|---|
| 6782 | 6764 | return 0; |
|---|
| 6783 | 6765 | } |
|---|
| 6784 | 6766 | |
|---|
| 6785 | | -/** |
|---|
| 6767 | +/* |
|---|
| 6786 | 6768 | * @brief |
|---|
| 6787 | 6769 | * Flush FLI data fifo. |
|---|
| 6788 | 6770 | * |
|---|
| .. | .. |
|---|
| 6795 | 6777 | bfa_flash_fifo_flush(void __iomem *pci_bar) |
|---|
| 6796 | 6778 | { |
|---|
| 6797 | 6779 | u32 i; |
|---|
| 6798 | | - u32 t; |
|---|
| 6799 | 6780 | union bfa_flash_dev_status_reg_u dev_status; |
|---|
| 6800 | 6781 | |
|---|
| 6801 | 6782 | dev_status.i = readl(pci_bar + FLI_DEV_STATUS_REG); |
|---|
| .. | .. |
|---|
| 6805 | 6786 | |
|---|
| 6806 | 6787 | /* fifo counter in terms of words */ |
|---|
| 6807 | 6788 | for (i = 0; i < dev_status.r.fifo_cnt; i++) |
|---|
| 6808 | | - t = readl(pci_bar + FLI_RDDATA_REG); |
|---|
| 6789 | + readl(pci_bar + FLI_RDDATA_REG); |
|---|
| 6809 | 6790 | |
|---|
| 6810 | 6791 | /* |
|---|
| 6811 | 6792 | * Check the device status. It may take some time. |
|---|
| .. | .. |
|---|
| 6822 | 6803 | return 0; |
|---|
| 6823 | 6804 | } |
|---|
| 6824 | 6805 | |
|---|
| 6825 | | -/** |
|---|
| 6806 | +/* |
|---|
| 6826 | 6807 | * @brief |
|---|
| 6827 | 6808 | * Read flash status. |
|---|
| 6828 | 6809 | * |
|---|
| .. | .. |
|---|
| 6867 | 6848 | return ret_status; |
|---|
| 6868 | 6849 | } |
|---|
| 6869 | 6850 | |
|---|
| 6870 | | -/** |
|---|
| 6851 | +/* |
|---|
| 6871 | 6852 | * @brief |
|---|
| 6872 | 6853 | * Start flash read operation. |
|---|
| 6873 | 6854 | * |
|---|
| .. | .. |
|---|
| 6913 | 6894 | return 0; |
|---|
| 6914 | 6895 | } |
|---|
| 6915 | 6896 | |
|---|
| 6916 | | -/** |
|---|
| 6897 | +/* |
|---|
| 6917 | 6898 | * @brief |
|---|
| 6918 | 6899 | * Check flash read operation. |
|---|
| 6919 | 6900 | * |
|---|
| .. | .. |
|---|
| 6929 | 6910 | |
|---|
| 6930 | 6911 | return 0; |
|---|
| 6931 | 6912 | } |
|---|
| 6932 | | -/** |
|---|
| 6913 | + |
|---|
| 6914 | +/* |
|---|
| 6933 | 6915 | * @brief |
|---|
| 6934 | 6916 | * End flash read operation. |
|---|
| 6935 | 6917 | * |
|---|
| .. | .. |
|---|
| 6955 | 6937 | bfa_flash_fifo_flush(pci_bar); |
|---|
| 6956 | 6938 | } |
|---|
| 6957 | 6939 | |
|---|
| 6958 | | -/** |
|---|
| 6940 | +/* |
|---|
| 6959 | 6941 | * @brief |
|---|
| 6960 | 6942 | * Perform flash raw read. |
|---|
| 6961 | 6943 | * |
|---|
| .. | .. |
|---|
| 6981 | 6963 | |
|---|
| 6982 | 6964 | } |
|---|
| 6983 | 6965 | |
|---|
| 6984 | | -bfa_status_t |
|---|
| 6966 | +static bfa_status_t |
|---|
| 6985 | 6967 | bfa_flash_sem_get(void __iomem *bar) |
|---|
| 6986 | 6968 | { |
|---|
| 6987 | 6969 | u32 n = FLASH_BLOCKING_OP_MAX; |
|---|
| .. | .. |
|---|
| 6994 | 6976 | return BFA_STATUS_OK; |
|---|
| 6995 | 6977 | } |
|---|
| 6996 | 6978 | |
|---|
| 6997 | | -void |
|---|
| 6979 | +static void |
|---|
| 6998 | 6980 | bfa_flash_sem_put(void __iomem *bar) |
|---|
| 6999 | 6981 | { |
|---|
| 7000 | 6982 | writel(0, (bar + FLASH_SEM_LOCK_REG)); |
|---|