.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * QLogic Fibre Channel HBA Driver |
---|
3 | 4 | * Copyright (c) 2003-2014 QLogic Corporation |
---|
4 | | - * |
---|
5 | | - * See LICENSE.qla2xxx for copyright and licensing details. |
---|
6 | 5 | */ |
---|
7 | 6 | #include "qla_def.h" |
---|
8 | 7 | #include <linux/delay.h> |
---|
| 8 | +#include <linux/io-64-nonatomic-lo-hi.h> |
---|
9 | 9 | #include <linux/pci.h> |
---|
10 | 10 | #include <linux/ratelimit.h> |
---|
11 | 11 | #include <linux/vmalloc.h> |
---|
.. | .. |
---|
369 | 369 | /* Read back value to make sure write has gone through before trying |
---|
370 | 370 | * to use it. |
---|
371 | 371 | */ |
---|
372 | | - win_read = RD_REG_DWORD(CRB_WINDOW_2M + ha->nx_pcibase); |
---|
| 372 | + win_read = rd_reg_dword(CRB_WINDOW_2M + ha->nx_pcibase); |
---|
373 | 373 | if (win_read != ha->crb_win) { |
---|
374 | 374 | ql_dbg(ql_dbg_p3p, vha, 0xb000, |
---|
375 | 375 | "%s: Written crbwin (0x%x) " |
---|
.. | .. |
---|
377 | 377 | __func__, ha->crb_win, win_read, off_in); |
---|
378 | 378 | } |
---|
379 | 379 | *off_out = (off_in & MASK(16)) + CRB_INDIRECT_2M + ha->nx_pcibase; |
---|
380 | | -} |
---|
381 | | - |
---|
382 | | -static inline unsigned long |
---|
383 | | -qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off) |
---|
384 | | -{ |
---|
385 | | - scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
386 | | - /* See if we are currently pointing to the region we want to use next */ |
---|
387 | | - if ((off >= QLA82XX_CRB_PCIX_HOST) && (off < QLA82XX_CRB_DDR_NET)) { |
---|
388 | | - /* No need to change window. PCIX and PCIEregs are in both |
---|
389 | | - * regs are in both windows. |
---|
390 | | - */ |
---|
391 | | - return off; |
---|
392 | | - } |
---|
393 | | - |
---|
394 | | - if ((off >= QLA82XX_CRB_PCIX_HOST) && (off < QLA82XX_CRB_PCIX_HOST2)) { |
---|
395 | | - /* We are in first CRB window */ |
---|
396 | | - if (ha->curr_window != 0) |
---|
397 | | - WARN_ON(1); |
---|
398 | | - return off; |
---|
399 | | - } |
---|
400 | | - |
---|
401 | | - if ((off > QLA82XX_CRB_PCIX_HOST2) && (off < QLA82XX_CRB_MAX)) { |
---|
402 | | - /* We are in second CRB window */ |
---|
403 | | - off = off - QLA82XX_CRB_PCIX_HOST2 + QLA82XX_CRB_PCIX_HOST; |
---|
404 | | - |
---|
405 | | - if (ha->curr_window != 1) |
---|
406 | | - return off; |
---|
407 | | - |
---|
408 | | - /* We are in the QM or direct access |
---|
409 | | - * register region - do nothing |
---|
410 | | - */ |
---|
411 | | - if ((off >= QLA82XX_PCI_DIRECT_CRB) && |
---|
412 | | - (off < QLA82XX_PCI_CAMQM_MAX)) |
---|
413 | | - return off; |
---|
414 | | - } |
---|
415 | | - /* strange address given */ |
---|
416 | | - ql_dbg(ql_dbg_p3p, vha, 0xb001, |
---|
417 | | - "%s: Warning: unm_nic_pci_set_crbwindow " |
---|
418 | | - "called with an unknown address(%llx).\n", |
---|
419 | | - QLA2XXX_DRIVER_NAME, off); |
---|
420 | | - return off; |
---|
421 | 380 | } |
---|
422 | 381 | |
---|
423 | 382 | static int |
---|
.. | .. |
---|
519 | 478 | qla82xx_crb_win_lock(ha); |
---|
520 | 479 | qla82xx_pci_set_crbwindow_2M(ha, off_in, &off); |
---|
521 | 480 | } |
---|
522 | | - data = RD_REG_DWORD(off); |
---|
| 481 | + data = rd_reg_dword(off); |
---|
523 | 482 | |
---|
524 | 483 | if (rv == 1) { |
---|
525 | 484 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM7_UNLOCK)); |
---|
.. | .. |
---|
608 | 567 | } else if (addr_in_range(addr, QLA82XX_ADDR_OCM0, |
---|
609 | 568 | QLA82XX_ADDR_OCM0_MAX)) { |
---|
610 | 569 | unsigned int temp1; |
---|
| 570 | + |
---|
611 | 571 | if ((addr & 0x00ff800) == 0xff800) { |
---|
612 | 572 | ql_log(ql_log_warn, vha, 0xb004, |
---|
613 | 573 | "%s: QM access not handled.\n", __func__); |
---|
.. | .. |
---|
935 | 895 | { |
---|
936 | 896 | uint32_t off_value, rval = 0; |
---|
937 | 897 | |
---|
938 | | - WRT_REG_DWORD(CRB_WINDOW_2M + ha->nx_pcibase, off & 0xFFFF0000); |
---|
| 898 | + wrt_reg_dword(CRB_WINDOW_2M + ha->nx_pcibase, off & 0xFFFF0000); |
---|
939 | 899 | |
---|
940 | 900 | /* Read back value to make sure write has gone through */ |
---|
941 | | - RD_REG_DWORD(CRB_WINDOW_2M + ha->nx_pcibase); |
---|
| 901 | + rd_reg_dword(CRB_WINDOW_2M + ha->nx_pcibase); |
---|
942 | 902 | off_value = (off & 0x0000FFFF); |
---|
943 | 903 | |
---|
944 | 904 | if (flag) |
---|
945 | | - WRT_REG_DWORD(off_value + CRB_INDIRECT_2M + ha->nx_pcibase, |
---|
| 905 | + wrt_reg_dword(off_value + CRB_INDIRECT_2M + ha->nx_pcibase, |
---|
946 | 906 | data); |
---|
947 | 907 | else |
---|
948 | | - rval = RD_REG_DWORD(off_value + CRB_INDIRECT_2M + |
---|
| 908 | + rval = rd_reg_dword(off_value + CRB_INDIRECT_2M + |
---|
949 | 909 | ha->nx_pcibase); |
---|
950 | 910 | |
---|
951 | 911 | return rval; |
---|
.. | .. |
---|
990 | 950 | qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val) |
---|
991 | 951 | { |
---|
992 | 952 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
| 953 | + |
---|
993 | 954 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_RDSR); |
---|
994 | 955 | qla82xx_wait_rom_busy(ha); |
---|
995 | 956 | if (qla82xx_wait_rom_done(ha)) { |
---|
.. | .. |
---|
1004 | 965 | static int |
---|
1005 | 966 | qla82xx_flash_wait_write_finish(struct qla_hw_data *ha) |
---|
1006 | 967 | { |
---|
1007 | | - long timeout = 0; |
---|
1008 | | - uint32_t done = 1 ; |
---|
1009 | 968 | uint32_t val; |
---|
1010 | | - int ret = 0; |
---|
| 969 | + int i, ret; |
---|
1011 | 970 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
1012 | 971 | |
---|
1013 | 972 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0); |
---|
1014 | | - while ((done != 0) && (ret == 0)) { |
---|
| 973 | + for (i = 0; i < 50000; i++) { |
---|
1015 | 974 | ret = qla82xx_read_status_reg(ha, &val); |
---|
1016 | | - done = val & 1; |
---|
1017 | | - timeout++; |
---|
| 975 | + if (ret < 0 || (val & 1) == 0) |
---|
| 976 | + return ret; |
---|
1018 | 977 | udelay(10); |
---|
1019 | 978 | cond_resched(); |
---|
1020 | | - if (timeout >= 50000) { |
---|
1021 | | - ql_log(ql_log_warn, vha, 0xb00d, |
---|
1022 | | - "Timeout reached waiting for write finish.\n"); |
---|
1023 | | - return -1; |
---|
1024 | | - } |
---|
1025 | 979 | } |
---|
1026 | | - return ret; |
---|
| 980 | + ql_log(ql_log_warn, vha, 0xb00d, |
---|
| 981 | + "Timeout reached waiting for write finish.\n"); |
---|
| 982 | + return -1; |
---|
1027 | 983 | } |
---|
1028 | 984 | |
---|
1029 | 985 | static int |
---|
1030 | 986 | qla82xx_flash_set_write_enable(struct qla_hw_data *ha) |
---|
1031 | 987 | { |
---|
1032 | 988 | uint32_t val; |
---|
| 989 | + |
---|
1033 | 990 | qla82xx_wait_rom_busy(ha); |
---|
1034 | 991 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0); |
---|
1035 | 992 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_WREN); |
---|
.. | .. |
---|
1047 | 1004 | qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val) |
---|
1048 | 1005 | { |
---|
1049 | 1006 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
| 1007 | + |
---|
1050 | 1008 | if (qla82xx_flash_set_write_enable(ha)) |
---|
1051 | 1009 | return -1; |
---|
1052 | 1010 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, val); |
---|
.. | .. |
---|
1063 | 1021 | qla82xx_write_disable_flash(struct qla_hw_data *ha) |
---|
1064 | 1022 | { |
---|
1065 | 1023 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
| 1024 | + |
---|
1066 | 1025 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_WRDI); |
---|
1067 | 1026 | if (qla82xx_wait_rom_done(ha)) { |
---|
1068 | 1027 | ql_log(ql_log_warn, vha, 0xb00f, |
---|
.. | .. |
---|
1208 | 1167 | * Offset 4: Offset and number of addr/value pairs |
---|
1209 | 1168 | * that present in CRB initialize sequence |
---|
1210 | 1169 | */ |
---|
| 1170 | + n = 0; |
---|
1211 | 1171 | if (qla82xx_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafeUL || |
---|
1212 | 1172 | qla82xx_rom_fast_read(ha, 4, &n) != 0) { |
---|
1213 | 1173 | ql_log(ql_log_fatal, vha, 0x006e, |
---|
.. | .. |
---|
1436 | 1396 | long memaddr = BOOTLD_START; |
---|
1437 | 1397 | u64 data; |
---|
1438 | 1398 | u32 high, low; |
---|
| 1399 | + |
---|
1439 | 1400 | size = (IMAGE_START - BOOTLD_START) / 8; |
---|
1440 | 1401 | |
---|
1441 | 1402 | for (i = 0; i < size; i++) { |
---|
.. | .. |
---|
1555 | 1516 | uint32_t i; |
---|
1556 | 1517 | struct qla82xx_uri_table_desc *directory = |
---|
1557 | 1518 | (struct qla82xx_uri_table_desc *)&unirom[0]; |
---|
1558 | | - __le32 offset; |
---|
1559 | | - __le32 tab_type; |
---|
1560 | | - __le32 entries = cpu_to_le32(directory->num_entries); |
---|
| 1519 | + uint32_t offset; |
---|
| 1520 | + uint32_t tab_type; |
---|
| 1521 | + uint32_t entries = le32_to_cpu(directory->num_entries); |
---|
1561 | 1522 | |
---|
1562 | 1523 | for (i = 0; i < entries; i++) { |
---|
1563 | | - offset = cpu_to_le32(directory->findex) + |
---|
1564 | | - (i * cpu_to_le32(directory->entry_size)); |
---|
1565 | | - tab_type = cpu_to_le32(*((u32 *)&unirom[offset] + 8)); |
---|
| 1524 | + offset = le32_to_cpu(directory->findex) + |
---|
| 1525 | + (i * le32_to_cpu(directory->entry_size)); |
---|
| 1526 | + tab_type = get_unaligned_le32((u32 *)&unirom[offset] + 8); |
---|
1566 | 1527 | |
---|
1567 | 1528 | if (tab_type == section) |
---|
1568 | 1529 | return (struct qla82xx_uri_table_desc *)&unirom[offset]; |
---|
.. | .. |
---|
1576 | 1537 | u32 section, u32 idx_offset) |
---|
1577 | 1538 | { |
---|
1578 | 1539 | const u8 *unirom = ha->hablob->fw->data; |
---|
1579 | | - int idx = cpu_to_le32(*((int *)&unirom[ha->file_prd_off] + idx_offset)); |
---|
| 1540 | + int idx = get_unaligned_le32((u32 *)&unirom[ha->file_prd_off] + |
---|
| 1541 | + idx_offset); |
---|
1580 | 1542 | struct qla82xx_uri_table_desc *tab_desc = NULL; |
---|
1581 | | - __le32 offset; |
---|
| 1543 | + uint32_t offset; |
---|
1582 | 1544 | |
---|
1583 | 1545 | tab_desc = qla82xx_get_table_desc(unirom, section); |
---|
1584 | 1546 | if (!tab_desc) |
---|
1585 | 1547 | return NULL; |
---|
1586 | 1548 | |
---|
1587 | | - offset = cpu_to_le32(tab_desc->findex) + |
---|
1588 | | - (cpu_to_le32(tab_desc->entry_size) * idx); |
---|
| 1549 | + offset = le32_to_cpu(tab_desc->findex) + |
---|
| 1550 | + (le32_to_cpu(tab_desc->entry_size) * idx); |
---|
1589 | 1551 | |
---|
1590 | 1552 | return (struct qla82xx_uri_data_desc *)&unirom[offset]; |
---|
1591 | 1553 | } |
---|
.. | .. |
---|
1600 | 1562 | uri_desc = qla82xx_get_data_desc(ha, |
---|
1601 | 1563 | QLA82XX_URI_DIR_SECT_BOOTLD, QLA82XX_URI_BOOTLD_IDX_OFF); |
---|
1602 | 1564 | if (uri_desc) |
---|
1603 | | - offset = cpu_to_le32(uri_desc->findex); |
---|
| 1565 | + offset = le32_to_cpu(uri_desc->findex); |
---|
1604 | 1566 | } |
---|
1605 | 1567 | |
---|
1606 | 1568 | return (u8 *)&ha->hablob->fw->data[offset]; |
---|
.. | .. |
---|
1614 | 1576 | uri_desc = qla82xx_get_data_desc(ha, QLA82XX_URI_DIR_SECT_FW, |
---|
1615 | 1577 | QLA82XX_URI_FIRMWARE_IDX_OFF); |
---|
1616 | 1578 | if (uri_desc) |
---|
1617 | | - return cpu_to_le32(uri_desc->size); |
---|
| 1579 | + return le32_to_cpu(uri_desc->size); |
---|
1618 | 1580 | } |
---|
1619 | 1581 | |
---|
1620 | 1582 | return get_unaligned_le32(&ha->hablob->fw->data[FW_SIZE_OFFSET]); |
---|
.. | .. |
---|
1630 | 1592 | uri_desc = qla82xx_get_data_desc(ha, QLA82XX_URI_DIR_SECT_FW, |
---|
1631 | 1593 | QLA82XX_URI_FIRMWARE_IDX_OFF); |
---|
1632 | 1594 | if (uri_desc) |
---|
1633 | | - offset = cpu_to_le32(uri_desc->findex); |
---|
| 1595 | + offset = le32_to_cpu(uri_desc->findex); |
---|
1634 | 1596 | } |
---|
1635 | 1597 | |
---|
1636 | 1598 | return (u8 *)&ha->hablob->fw->data[offset]; |
---|
.. | .. |
---|
1757 | 1719 | * |
---|
1758 | 1720 | * Returns 0 on success. |
---|
1759 | 1721 | */ |
---|
1760 | | -void |
---|
| 1722 | +int |
---|
1761 | 1723 | qla82xx_reset_chip(scsi_qla_host_t *vha) |
---|
1762 | 1724 | { |
---|
1763 | 1725 | struct qla_hw_data *ha = vha->hw; |
---|
| 1726 | + |
---|
1764 | 1727 | ha->isp_ops->disable_intrs(ha); |
---|
| 1728 | + |
---|
| 1729 | + return QLA_SUCCESS; |
---|
1765 | 1730 | } |
---|
1766 | 1731 | |
---|
1767 | 1732 | void qla82xx_config_rings(struct scsi_qla_host *vha) |
---|
.. | .. |
---|
1778 | 1743 | icb->response_q_inpointer = cpu_to_le16(0); |
---|
1779 | 1744 | icb->request_q_length = cpu_to_le16(req->length); |
---|
1780 | 1745 | icb->response_q_length = cpu_to_le16(rsp->length); |
---|
1781 | | - icb->request_q_address[0] = cpu_to_le32(LSD(req->dma)); |
---|
1782 | | - icb->request_q_address[1] = cpu_to_le32(MSD(req->dma)); |
---|
1783 | | - icb->response_q_address[0] = cpu_to_le32(LSD(rsp->dma)); |
---|
1784 | | - icb->response_q_address[1] = cpu_to_le32(MSD(rsp->dma)); |
---|
| 1746 | + put_unaligned_le64(req->dma, &icb->request_q_address); |
---|
| 1747 | + put_unaligned_le64(rsp->dma, &icb->response_q_address); |
---|
1785 | 1748 | |
---|
1786 | | - WRT_REG_DWORD(®->req_q_out[0], 0); |
---|
1787 | | - WRT_REG_DWORD(®->rsp_q_in[0], 0); |
---|
1788 | | - WRT_REG_DWORD(®->rsp_q_out[0], 0); |
---|
| 1749 | + wrt_reg_dword(®->req_q_out[0], 0); |
---|
| 1750 | + wrt_reg_dword(®->rsp_q_in[0], 0); |
---|
| 1751 | + wrt_reg_dword(®->rsp_q_out[0], 0); |
---|
1789 | 1752 | } |
---|
1790 | 1753 | |
---|
1791 | 1754 | static int |
---|
.. | .. |
---|
1840 | 1803 | struct qla82xx_uri_table_desc *ptab_desc = NULL; |
---|
1841 | 1804 | const uint8_t *unirom = ha->hablob->fw->data; |
---|
1842 | 1805 | uint32_t i; |
---|
1843 | | - __le32 entries; |
---|
1844 | | - __le32 flags, file_chiprev, offset; |
---|
| 1806 | + uint32_t entries; |
---|
| 1807 | + uint32_t flags, file_chiprev, offset; |
---|
1845 | 1808 | uint8_t chiprev = ha->chip_revision; |
---|
1846 | 1809 | /* Hardcoding mn_present flag for P3P */ |
---|
1847 | 1810 | int mn_present = 0; |
---|
.. | .. |
---|
1852 | 1815 | if (!ptab_desc) |
---|
1853 | 1816 | return -1; |
---|
1854 | 1817 | |
---|
1855 | | - entries = cpu_to_le32(ptab_desc->num_entries); |
---|
| 1818 | + entries = le32_to_cpu(ptab_desc->num_entries); |
---|
1856 | 1819 | |
---|
1857 | 1820 | for (i = 0; i < entries; i++) { |
---|
1858 | | - offset = cpu_to_le32(ptab_desc->findex) + |
---|
1859 | | - (i * cpu_to_le32(ptab_desc->entry_size)); |
---|
1860 | | - flags = cpu_to_le32(*((int *)&unirom[offset] + |
---|
| 1821 | + offset = le32_to_cpu(ptab_desc->findex) + |
---|
| 1822 | + (i * le32_to_cpu(ptab_desc->entry_size)); |
---|
| 1823 | + flags = le32_to_cpu(*((__le32 *)&unirom[offset] + |
---|
1861 | 1824 | QLA82XX_URI_FLAGS_OFF)); |
---|
1862 | | - file_chiprev = cpu_to_le32(*((int *)&unirom[offset] + |
---|
| 1825 | + file_chiprev = le32_to_cpu(*((__le32 *)&unirom[offset] + |
---|
1863 | 1826 | QLA82XX_URI_CHIP_REV_OFF)); |
---|
1864 | 1827 | |
---|
1865 | 1828 | flagbit = mn_present ? 1 : 2; |
---|
.. | .. |
---|
1875 | 1838 | static int |
---|
1876 | 1839 | qla82xx_validate_firmware_blob(scsi_qla_host_t *vha, uint8_t fw_type) |
---|
1877 | 1840 | { |
---|
1878 | | - __le32 val; |
---|
| 1841 | + uint32_t val; |
---|
1879 | 1842 | uint32_t min_size; |
---|
1880 | 1843 | struct qla_hw_data *ha = vha->hw; |
---|
1881 | 1844 | const struct firmware *fw = ha->hablob->fw; |
---|
.. | .. |
---|
1888 | 1851 | |
---|
1889 | 1852 | min_size = QLA82XX_URI_FW_MIN_SIZE; |
---|
1890 | 1853 | } else { |
---|
1891 | | - val = cpu_to_le32(*(u32 *)&fw->data[QLA82XX_FW_MAGIC_OFFSET]); |
---|
1892 | | - if ((__force u32)val != QLA82XX_BDINFO_MAGIC) |
---|
| 1854 | + val = get_unaligned_le32(&fw->data[QLA82XX_FW_MAGIC_OFFSET]); |
---|
| 1855 | + if (val != QLA82XX_BDINFO_MAGIC) |
---|
1893 | 1856 | return -EINVAL; |
---|
1894 | 1857 | |
---|
1895 | 1858 | min_size = QLA82XX_FW_MIN_SIZE; |
---|
.. | .. |
---|
1969 | 1932 | } while (--retries); |
---|
1970 | 1933 | |
---|
1971 | 1934 | ql_log(ql_log_fatal, vha, 0x00ac, |
---|
1972 | | - "Rcv Peg initializatin failed: 0x%x.\n", val); |
---|
| 1935 | + "Rcv Peg initialization failed: 0x%x.\n", val); |
---|
1973 | 1936 | read_lock(&ha->hw_lock); |
---|
1974 | 1937 | qla82xx_wr_32(ha, CRB_RCVPEG_STATE, PHAN_INITIALIZE_FAILED); |
---|
1975 | 1938 | read_unlock(&ha->hw_lock); |
---|
.. | .. |
---|
1977 | 1940 | } |
---|
1978 | 1941 | |
---|
1979 | 1942 | /* ISR related functions */ |
---|
1980 | | -static struct qla82xx_legacy_intr_set legacy_intr[] = \ |
---|
| 1943 | +static struct qla82xx_legacy_intr_set legacy_intr[] = |
---|
1981 | 1944 | QLA82XX_LEGACY_INTR_CONFIG; |
---|
1982 | 1945 | |
---|
1983 | 1946 | /* |
---|
.. | .. |
---|
1989 | 1952 | qla82xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0) |
---|
1990 | 1953 | { |
---|
1991 | 1954 | uint16_t cnt; |
---|
1992 | | - uint16_t __iomem *wptr; |
---|
| 1955 | + __le16 __iomem *wptr; |
---|
1993 | 1956 | struct qla_hw_data *ha = vha->hw; |
---|
1994 | 1957 | struct device_reg_82xx __iomem *reg = &ha->iobase->isp82; |
---|
1995 | | - wptr = (uint16_t __iomem *)®->mailbox_out[1]; |
---|
| 1958 | + |
---|
| 1959 | + wptr = ®->mailbox_out[1]; |
---|
1996 | 1960 | |
---|
1997 | 1961 | /* Load return mailbox registers. */ |
---|
1998 | 1962 | ha->flags.mbox_int = 1; |
---|
1999 | 1963 | ha->mailbox_out[0] = mb0; |
---|
2000 | 1964 | |
---|
2001 | 1965 | for (cnt = 1; cnt < ha->mbx_count; cnt++) { |
---|
2002 | | - ha->mailbox_out[cnt] = RD_REG_WORD(wptr); |
---|
| 1966 | + ha->mailbox_out[cnt] = rd_reg_word(wptr); |
---|
2003 | 1967 | wptr++; |
---|
2004 | 1968 | } |
---|
2005 | 1969 | |
---|
.. | .. |
---|
2010 | 1974 | |
---|
2011 | 1975 | /** |
---|
2012 | 1976 | * qla82xx_intr_handler() - Process interrupts for the ISP23xx and ISP63xx. |
---|
2013 | | - * @irq: |
---|
| 1977 | + * @irq: interrupt number |
---|
2014 | 1978 | * @dev_id: SCSI driver HA context |
---|
2015 | 1979 | * |
---|
2016 | 1980 | * Called by system whenever the host adapter generates an interrupt. |
---|
.. | .. |
---|
2028 | 1992 | unsigned long flags; |
---|
2029 | 1993 | unsigned long iter; |
---|
2030 | 1994 | uint32_t stat = 0; |
---|
2031 | | - uint16_t mb[4]; |
---|
| 1995 | + uint16_t mb[8]; |
---|
2032 | 1996 | |
---|
2033 | 1997 | rsp = (struct rsp_que *) dev_id; |
---|
2034 | 1998 | if (!rsp) { |
---|
.. | .. |
---|
2061 | 2025 | vha = pci_get_drvdata(ha->pdev); |
---|
2062 | 2026 | for (iter = 1; iter--; ) { |
---|
2063 | 2027 | |
---|
2064 | | - if (RD_REG_DWORD(®->host_int)) { |
---|
2065 | | - stat = RD_REG_DWORD(®->host_status); |
---|
| 2028 | + if (rd_reg_dword(®->host_int)) { |
---|
| 2029 | + stat = rd_reg_dword(®->host_status); |
---|
2066 | 2030 | |
---|
2067 | 2031 | switch (stat & 0xff) { |
---|
2068 | 2032 | case 0x1: |
---|
.. | .. |
---|
2074 | 2038 | break; |
---|
2075 | 2039 | case 0x12: |
---|
2076 | 2040 | mb[0] = MSW(stat); |
---|
2077 | | - mb[1] = RD_REG_WORD(®->mailbox_out[1]); |
---|
2078 | | - mb[2] = RD_REG_WORD(®->mailbox_out[2]); |
---|
2079 | | - mb[3] = RD_REG_WORD(®->mailbox_out[3]); |
---|
| 2041 | + mb[1] = rd_reg_word(®->mailbox_out[1]); |
---|
| 2042 | + mb[2] = rd_reg_word(®->mailbox_out[2]); |
---|
| 2043 | + mb[3] = rd_reg_word(®->mailbox_out[3]); |
---|
2080 | 2044 | qla2x00_async_event(vha, rsp, mb); |
---|
2081 | 2045 | break; |
---|
2082 | 2046 | case 0x13: |
---|
.. | .. |
---|
2089 | 2053 | break; |
---|
2090 | 2054 | } |
---|
2091 | 2055 | } |
---|
2092 | | - WRT_REG_DWORD(®->host_int, 0); |
---|
| 2056 | + wrt_reg_dword(®->host_int, 0); |
---|
2093 | 2057 | } |
---|
2094 | 2058 | |
---|
2095 | 2059 | qla2x00_handle_mbx_completion(ha, status); |
---|
.. | .. |
---|
2112 | 2076 | unsigned long flags; |
---|
2113 | 2077 | uint32_t stat = 0; |
---|
2114 | 2078 | uint32_t host_int = 0; |
---|
2115 | | - uint16_t mb[4]; |
---|
| 2079 | + uint16_t mb[8]; |
---|
2116 | 2080 | |
---|
2117 | 2081 | rsp = (struct rsp_que *) dev_id; |
---|
2118 | 2082 | if (!rsp) { |
---|
.. | .. |
---|
2127 | 2091 | spin_lock_irqsave(&ha->hardware_lock, flags); |
---|
2128 | 2092 | vha = pci_get_drvdata(ha->pdev); |
---|
2129 | 2093 | do { |
---|
2130 | | - host_int = RD_REG_DWORD(®->host_int); |
---|
| 2094 | + host_int = rd_reg_dword(®->host_int); |
---|
2131 | 2095 | if (qla2x00_check_reg32_for_disconnect(vha, host_int)) |
---|
2132 | 2096 | break; |
---|
2133 | 2097 | if (host_int) { |
---|
2134 | | - stat = RD_REG_DWORD(®->host_status); |
---|
| 2098 | + stat = rd_reg_dword(®->host_status); |
---|
2135 | 2099 | |
---|
2136 | 2100 | switch (stat & 0xff) { |
---|
2137 | 2101 | case 0x1: |
---|
.. | .. |
---|
2143 | 2107 | break; |
---|
2144 | 2108 | case 0x12: |
---|
2145 | 2109 | mb[0] = MSW(stat); |
---|
2146 | | - mb[1] = RD_REG_WORD(®->mailbox_out[1]); |
---|
2147 | | - mb[2] = RD_REG_WORD(®->mailbox_out[2]); |
---|
2148 | | - mb[3] = RD_REG_WORD(®->mailbox_out[3]); |
---|
| 2110 | + mb[1] = rd_reg_word(®->mailbox_out[1]); |
---|
| 2111 | + mb[2] = rd_reg_word(®->mailbox_out[2]); |
---|
| 2112 | + mb[3] = rd_reg_word(®->mailbox_out[3]); |
---|
2149 | 2113 | qla2x00_async_event(vha, rsp, mb); |
---|
2150 | 2114 | break; |
---|
2151 | 2115 | case 0x13: |
---|
.. | .. |
---|
2158 | 2122 | break; |
---|
2159 | 2123 | } |
---|
2160 | 2124 | } |
---|
2161 | | - WRT_REG_DWORD(®->host_int, 0); |
---|
| 2125 | + wrt_reg_dword(®->host_int, 0); |
---|
2162 | 2126 | } while (0); |
---|
2163 | 2127 | |
---|
2164 | 2128 | qla2x00_handle_mbx_completion(ha, status); |
---|
.. | .. |
---|
2188 | 2152 | reg = &ha->iobase->isp82; |
---|
2189 | 2153 | spin_lock_irqsave(&ha->hardware_lock, flags); |
---|
2190 | 2154 | vha = pci_get_drvdata(ha->pdev); |
---|
2191 | | - host_int = RD_REG_DWORD(®->host_int); |
---|
| 2155 | + host_int = rd_reg_dword(®->host_int); |
---|
2192 | 2156 | if (qla2x00_check_reg32_for_disconnect(vha, host_int)) |
---|
2193 | 2157 | goto out; |
---|
2194 | 2158 | qla24xx_process_response_queue(vha, rsp); |
---|
2195 | | - WRT_REG_DWORD(®->host_int, 0); |
---|
| 2159 | + wrt_reg_dword(®->host_int, 0); |
---|
2196 | 2160 | out: |
---|
2197 | 2161 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
---|
2198 | 2162 | return IRQ_HANDLED; |
---|
.. | .. |
---|
2208 | 2172 | int status = 0; |
---|
2209 | 2173 | uint32_t stat; |
---|
2210 | 2174 | uint32_t host_int = 0; |
---|
2211 | | - uint16_t mb[4]; |
---|
| 2175 | + uint16_t mb[8]; |
---|
2212 | 2176 | unsigned long flags; |
---|
2213 | 2177 | |
---|
2214 | 2178 | rsp = (struct rsp_que *) dev_id; |
---|
.. | .. |
---|
2223 | 2187 | spin_lock_irqsave(&ha->hardware_lock, flags); |
---|
2224 | 2188 | vha = pci_get_drvdata(ha->pdev); |
---|
2225 | 2189 | |
---|
2226 | | - host_int = RD_REG_DWORD(®->host_int); |
---|
| 2190 | + host_int = rd_reg_dword(®->host_int); |
---|
2227 | 2191 | if (qla2x00_check_reg32_for_disconnect(vha, host_int)) |
---|
2228 | 2192 | goto out; |
---|
2229 | 2193 | if (host_int) { |
---|
2230 | | - stat = RD_REG_DWORD(®->host_status); |
---|
| 2194 | + stat = rd_reg_dword(®->host_status); |
---|
2231 | 2195 | switch (stat & 0xff) { |
---|
2232 | 2196 | case 0x1: |
---|
2233 | 2197 | case 0x2: |
---|
.. | .. |
---|
2238 | 2202 | break; |
---|
2239 | 2203 | case 0x12: |
---|
2240 | 2204 | mb[0] = MSW(stat); |
---|
2241 | | - mb[1] = RD_REG_WORD(®->mailbox_out[1]); |
---|
2242 | | - mb[2] = RD_REG_WORD(®->mailbox_out[2]); |
---|
2243 | | - mb[3] = RD_REG_WORD(®->mailbox_out[3]); |
---|
| 2205 | + mb[1] = rd_reg_word(®->mailbox_out[1]); |
---|
| 2206 | + mb[2] = rd_reg_word(®->mailbox_out[2]); |
---|
| 2207 | + mb[3] = rd_reg_word(®->mailbox_out[3]); |
---|
2244 | 2208 | qla2x00_async_event(vha, rsp, mb); |
---|
2245 | 2209 | break; |
---|
2246 | 2210 | case 0x13: |
---|
.. | .. |
---|
2252 | 2216 | stat * 0xff); |
---|
2253 | 2217 | break; |
---|
2254 | 2218 | } |
---|
2255 | | - WRT_REG_DWORD(®->host_int, 0); |
---|
| 2219 | + wrt_reg_dword(®->host_int, 0); |
---|
2256 | 2220 | } |
---|
2257 | 2221 | out: |
---|
2258 | 2222 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
---|
.. | .. |
---|
2262 | 2226 | qla82xx_enable_intrs(struct qla_hw_data *ha) |
---|
2263 | 2227 | { |
---|
2264 | 2228 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
| 2229 | + |
---|
2265 | 2230 | qla82xx_mbx_intr_enable(vha); |
---|
2266 | 2231 | spin_lock_irq(&ha->hardware_lock); |
---|
2267 | 2232 | if (IS_QLA8044(ha)) |
---|
.. | .. |
---|
2276 | 2241 | qla82xx_disable_intrs(struct qla_hw_data *ha) |
---|
2277 | 2242 | { |
---|
2278 | 2243 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); |
---|
2279 | | - qla82xx_mbx_intr_disable(vha); |
---|
| 2244 | + |
---|
| 2245 | + if (ha->interrupts_on) |
---|
| 2246 | + qla82xx_mbx_intr_disable(vha); |
---|
| 2247 | + |
---|
2280 | 2248 | spin_lock_irq(&ha->hardware_lock); |
---|
2281 | 2249 | if (IS_QLA8044(ha)) |
---|
2282 | 2250 | qla8044_wr_reg(ha, LEG_INTR_MASK_OFFSET, 1); |
---|
.. | .. |
---|
2537 | 2505 | return qla82xx_check_rcvpeg_state(ha); |
---|
2538 | 2506 | } |
---|
2539 | 2507 | |
---|
2540 | | -static uint32_t * |
---|
2541 | | -qla82xx_read_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, |
---|
| 2508 | +static __le32 * |
---|
| 2509 | +qla82xx_read_flash_data(scsi_qla_host_t *vha, __le32 *dwptr, uint32_t faddr, |
---|
2542 | 2510 | uint32_t length) |
---|
2543 | 2511 | { |
---|
2544 | 2512 | uint32_t i; |
---|
.. | .. |
---|
2658 | 2626 | /* |
---|
2659 | 2627 | * Address and length are byte address |
---|
2660 | 2628 | */ |
---|
2661 | | -uint8_t * |
---|
2662 | | -qla82xx_read_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, |
---|
| 2629 | +void * |
---|
| 2630 | +qla82xx_read_optrom_data(struct scsi_qla_host *vha, void *buf, |
---|
2663 | 2631 | uint32_t offset, uint32_t length) |
---|
2664 | 2632 | { |
---|
2665 | 2633 | scsi_block_requests(vha->host); |
---|
2666 | | - qla82xx_read_flash_data(vha, (uint32_t *)buf, offset, length); |
---|
| 2634 | + qla82xx_read_flash_data(vha, buf, offset, length); |
---|
2667 | 2635 | scsi_unblock_requests(vha->host); |
---|
2668 | 2636 | return buf; |
---|
2669 | 2637 | } |
---|
2670 | 2638 | |
---|
2671 | 2639 | static int |
---|
2672 | | -qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, |
---|
| 2640 | +qla82xx_write_flash_data(struct scsi_qla_host *vha, __le32 *dwptr, |
---|
2673 | 2641 | uint32_t faddr, uint32_t dwords) |
---|
2674 | 2642 | { |
---|
2675 | 2643 | int ret; |
---|
.. | .. |
---|
2746 | 2714 | } |
---|
2747 | 2715 | |
---|
2748 | 2716 | ret = qla82xx_write_flash_dword(ha, faddr, |
---|
2749 | | - cpu_to_le32(*dwptr)); |
---|
| 2717 | + le32_to_cpu(*dwptr)); |
---|
2750 | 2718 | if (ret) { |
---|
2751 | 2719 | ql_dbg(ql_dbg_p3p, vha, 0xb020, |
---|
2752 | 2720 | "Unable to program flash address=%x data=%x.\n", |
---|
.. | .. |
---|
2767 | 2735 | } |
---|
2768 | 2736 | |
---|
2769 | 2737 | int |
---|
2770 | | -qla82xx_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, |
---|
| 2738 | +qla82xx_write_optrom_data(struct scsi_qla_host *vha, void *buf, |
---|
2771 | 2739 | uint32_t offset, uint32_t length) |
---|
2772 | 2740 | { |
---|
2773 | 2741 | int rval; |
---|
2774 | 2742 | |
---|
2775 | 2743 | /* Suspend HBA. */ |
---|
2776 | 2744 | scsi_block_requests(vha->host); |
---|
2777 | | - rval = qla82xx_write_flash_data(vha, (uint32_t *)buf, offset, |
---|
2778 | | - length >> 2); |
---|
| 2745 | + rval = qla82xx_write_flash_data(vha, buf, offset, length >> 2); |
---|
2779 | 2746 | scsi_unblock_requests(vha->host); |
---|
2780 | 2747 | |
---|
2781 | 2748 | /* Convert return ISP82xx to generic */ |
---|
.. | .. |
---|
2807 | 2774 | if (ql2xdbwr) |
---|
2808 | 2775 | qla82xx_wr_32(ha, (unsigned long)ha->nxdb_wr_ptr, dbval); |
---|
2809 | 2776 | else { |
---|
2810 | | - WRT_REG_DWORD(ha->nxdb_wr_ptr, dbval); |
---|
| 2777 | + wrt_reg_dword(ha->nxdb_wr_ptr, dbval); |
---|
2811 | 2778 | wmb(); |
---|
2812 | | - while (RD_REG_DWORD(ha->nxdb_rd_ptr) != dbval) { |
---|
2813 | | - WRT_REG_DWORD(ha->nxdb_wr_ptr, dbval); |
---|
| 2779 | + while (rd_reg_dword(ha->nxdb_rd_ptr) != dbval) { |
---|
| 2780 | + wrt_reg_dword(ha->nxdb_wr_ptr, dbval); |
---|
2814 | 2781 | wmb(); |
---|
2815 | 2782 | } |
---|
2816 | 2783 | } |
---|
.. | .. |
---|
3018 | 2985 | /* Set DEV_FAILED flag to disable timer */ |
---|
3019 | 2986 | vha->device_flags |= DFLG_DEV_FAILED; |
---|
3020 | 2987 | qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16); |
---|
3021 | | - qla2x00_mark_all_devices_lost(vha, 0); |
---|
| 2988 | + qla2x00_mark_all_devices_lost(vha); |
---|
3022 | 2989 | vha->flags.online = 0; |
---|
3023 | 2990 | vha->flags.init_done = 0; |
---|
3024 | 2991 | } |
---|
.. | .. |
---|
3276 | 3243 | case QLA8XXX_DEV_NEED_QUIESCENT: |
---|
3277 | 3244 | qla82xx_need_qsnt_handler(vha); |
---|
3278 | 3245 | /* Reset timeout value after quiescence handler */ |
---|
3279 | | - dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout\ |
---|
| 3246 | + dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout |
---|
3280 | 3247 | * HZ); |
---|
3281 | 3248 | break; |
---|
3282 | 3249 | case QLA8XXX_DEV_QUIESCENT: |
---|
.. | .. |
---|
3291 | 3258 | qla82xx_idc_lock(ha); |
---|
3292 | 3259 | |
---|
3293 | 3260 | /* Reset timeout value after quiescence handler */ |
---|
3294 | | - dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout\ |
---|
| 3261 | + dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout |
---|
3295 | 3262 | * HZ); |
---|
3296 | 3263 | break; |
---|
3297 | 3264 | case QLA8XXX_DEV_FAILED: |
---|
.. | .. |
---|
3676 | 3643 | for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { |
---|
3677 | 3644 | sp = req->outstanding_cmds[cnt]; |
---|
3678 | 3645 | if (sp) { |
---|
3679 | | - if ((!sp->u.scmd.ctx || |
---|
| 3646 | + if ((!sp->u.scmd.crc_ctx || |
---|
3680 | 3647 | (sp->flags & |
---|
3681 | 3648 | SRB_FCP_CMND_DMA_VALID)) && |
---|
3682 | 3649 | !ha->flags.isp82xx_fw_hung) { |
---|
.. | .. |
---|
3699 | 3666 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
---|
3700 | 3667 | |
---|
3701 | 3668 | /* Wait for pending cmds (physical and virtual) to complete */ |
---|
3702 | | - if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0, |
---|
| 3669 | + if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, |
---|
3703 | 3670 | WAIT_HOST) == QLA_SUCCESS) { |
---|
3704 | 3671 | ql_dbg(ql_dbg_init, vha, 0x00b3, |
---|
3705 | 3672 | "Done wait for " |
---|
3706 | 3673 | "pending commands.\n"); |
---|
| 3674 | + } else { |
---|
| 3675 | + WARN_ON_ONCE(true); |
---|
3707 | 3676 | } |
---|
3708 | 3677 | } |
---|
3709 | 3678 | } |
---|
.. | .. |
---|
3711 | 3680 | /* Minidump related functions */ |
---|
3712 | 3681 | static int |
---|
3713 | 3682 | qla82xx_minidump_process_control(scsi_qla_host_t *vha, |
---|
3714 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3683 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3715 | 3684 | { |
---|
3716 | 3685 | struct qla_hw_data *ha = vha->hw; |
---|
3717 | 3686 | struct qla82xx_md_entry_crb *crb_entry; |
---|
.. | .. |
---|
3828 | 3797 | |
---|
3829 | 3798 | static void |
---|
3830 | 3799 | qla82xx_minidump_process_rdocm(scsi_qla_host_t *vha, |
---|
3831 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3800 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3832 | 3801 | { |
---|
3833 | 3802 | struct qla_hw_data *ha = vha->hw; |
---|
3834 | 3803 | uint32_t r_addr, r_stride, loop_cnt, i, r_value; |
---|
3835 | 3804 | struct qla82xx_md_entry_rdocm *ocm_hdr; |
---|
3836 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3805 | + __le32 *data_ptr = *d_ptr; |
---|
3837 | 3806 | |
---|
3838 | 3807 | ocm_hdr = (struct qla82xx_md_entry_rdocm *)entry_hdr; |
---|
3839 | 3808 | r_addr = ocm_hdr->read_addr; |
---|
.. | .. |
---|
3841 | 3810 | loop_cnt = ocm_hdr->op_count; |
---|
3842 | 3811 | |
---|
3843 | 3812 | for (i = 0; i < loop_cnt; i++) { |
---|
3844 | | - r_value = RD_REG_DWORD(r_addr + ha->nx_pcibase); |
---|
| 3813 | + r_value = rd_reg_dword(r_addr + ha->nx_pcibase); |
---|
3845 | 3814 | *data_ptr++ = cpu_to_le32(r_value); |
---|
3846 | 3815 | r_addr += r_stride; |
---|
3847 | 3816 | } |
---|
.. | .. |
---|
3850 | 3819 | |
---|
3851 | 3820 | static void |
---|
3852 | 3821 | qla82xx_minidump_process_rdmux(scsi_qla_host_t *vha, |
---|
3853 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3822 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3854 | 3823 | { |
---|
3855 | 3824 | struct qla_hw_data *ha = vha->hw; |
---|
3856 | 3825 | uint32_t r_addr, s_stride, s_addr, s_value, loop_cnt, i, r_value; |
---|
3857 | 3826 | struct qla82xx_md_entry_mux *mux_hdr; |
---|
3858 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3827 | + __le32 *data_ptr = *d_ptr; |
---|
3859 | 3828 | |
---|
3860 | 3829 | mux_hdr = (struct qla82xx_md_entry_mux *)entry_hdr; |
---|
3861 | 3830 | r_addr = mux_hdr->read_addr; |
---|
.. | .. |
---|
3876 | 3845 | |
---|
3877 | 3846 | static void |
---|
3878 | 3847 | qla82xx_minidump_process_rdcrb(scsi_qla_host_t *vha, |
---|
3879 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3848 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3880 | 3849 | { |
---|
3881 | 3850 | struct qla_hw_data *ha = vha->hw; |
---|
3882 | 3851 | uint32_t r_addr, r_stride, loop_cnt, i, r_value; |
---|
3883 | 3852 | struct qla82xx_md_entry_crb *crb_hdr; |
---|
3884 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3853 | + __le32 *data_ptr = *d_ptr; |
---|
3885 | 3854 | |
---|
3886 | 3855 | crb_hdr = (struct qla82xx_md_entry_crb *)entry_hdr; |
---|
3887 | 3856 | r_addr = crb_hdr->addr; |
---|
.. | .. |
---|
3899 | 3868 | |
---|
3900 | 3869 | static int |
---|
3901 | 3870 | qla82xx_minidump_process_l2tag(scsi_qla_host_t *vha, |
---|
3902 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3871 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3903 | 3872 | { |
---|
3904 | 3873 | struct qla_hw_data *ha = vha->hw; |
---|
3905 | 3874 | uint32_t addr, r_addr, c_addr, t_r_addr; |
---|
.. | .. |
---|
3908 | 3877 | uint32_t c_value_w, c_value_r; |
---|
3909 | 3878 | struct qla82xx_md_entry_cache *cache_hdr; |
---|
3910 | 3879 | int rval = QLA_FUNCTION_FAILED; |
---|
3911 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3880 | + __le32 *data_ptr = *d_ptr; |
---|
3912 | 3881 | |
---|
3913 | 3882 | cache_hdr = (struct qla82xx_md_entry_cache *)entry_hdr; |
---|
3914 | 3883 | loop_count = cache_hdr->op_count; |
---|
.. | .. |
---|
3958 | 3927 | |
---|
3959 | 3928 | static void |
---|
3960 | 3929 | qla82xx_minidump_process_l1cache(scsi_qla_host_t *vha, |
---|
3961 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3930 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3962 | 3931 | { |
---|
3963 | 3932 | struct qla_hw_data *ha = vha->hw; |
---|
3964 | 3933 | uint32_t addr, r_addr, c_addr, t_r_addr; |
---|
3965 | 3934 | uint32_t i, k, loop_count, t_value, r_cnt, r_value; |
---|
3966 | 3935 | uint32_t c_value_w; |
---|
3967 | 3936 | struct qla82xx_md_entry_cache *cache_hdr; |
---|
3968 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3937 | + __le32 *data_ptr = *d_ptr; |
---|
3969 | 3938 | |
---|
3970 | 3939 | cache_hdr = (struct qla82xx_md_entry_cache *)entry_hdr; |
---|
3971 | 3940 | loop_count = cache_hdr->op_count; |
---|
.. | .. |
---|
3993 | 3962 | |
---|
3994 | 3963 | static void |
---|
3995 | 3964 | qla82xx_minidump_process_queue(scsi_qla_host_t *vha, |
---|
3996 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3965 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
3997 | 3966 | { |
---|
3998 | 3967 | struct qla_hw_data *ha = vha->hw; |
---|
3999 | 3968 | uint32_t s_addr, r_addr; |
---|
4000 | 3969 | uint32_t r_stride, r_value, r_cnt, qid = 0; |
---|
4001 | 3970 | uint32_t i, k, loop_cnt; |
---|
4002 | 3971 | struct qla82xx_md_entry_queue *q_hdr; |
---|
4003 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 3972 | + __le32 *data_ptr = *d_ptr; |
---|
4004 | 3973 | |
---|
4005 | 3974 | q_hdr = (struct qla82xx_md_entry_queue *)entry_hdr; |
---|
4006 | 3975 | s_addr = q_hdr->select_addr; |
---|
.. | .. |
---|
4023 | 3992 | |
---|
4024 | 3993 | static void |
---|
4025 | 3994 | qla82xx_minidump_process_rdrom(scsi_qla_host_t *vha, |
---|
4026 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 3995 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
4027 | 3996 | { |
---|
4028 | 3997 | struct qla_hw_data *ha = vha->hw; |
---|
4029 | 3998 | uint32_t r_addr, r_value; |
---|
4030 | 3999 | uint32_t i, loop_cnt; |
---|
4031 | 4000 | struct qla82xx_md_entry_rdrom *rom_hdr; |
---|
4032 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 4001 | + __le32 *data_ptr = *d_ptr; |
---|
4033 | 4002 | |
---|
4034 | 4003 | rom_hdr = (struct qla82xx_md_entry_rdrom *)entry_hdr; |
---|
4035 | 4004 | r_addr = rom_hdr->read_addr; |
---|
.. | .. |
---|
4049 | 4018 | |
---|
4050 | 4019 | static int |
---|
4051 | 4020 | qla82xx_minidump_process_rdmem(scsi_qla_host_t *vha, |
---|
4052 | | - qla82xx_md_entry_hdr_t *entry_hdr, uint32_t **d_ptr) |
---|
| 4021 | + qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr) |
---|
4053 | 4022 | { |
---|
4054 | 4023 | struct qla_hw_data *ha = vha->hw; |
---|
4055 | 4024 | uint32_t r_addr, r_value, r_data; |
---|
.. | .. |
---|
4057 | 4026 | struct qla82xx_md_entry_rdmem *m_hdr; |
---|
4058 | 4027 | unsigned long flags; |
---|
4059 | 4028 | int rval = QLA_FUNCTION_FAILED; |
---|
4060 | | - uint32_t *data_ptr = *d_ptr; |
---|
| 4029 | + __le32 *data_ptr = *d_ptr; |
---|
4061 | 4030 | |
---|
4062 | 4031 | m_hdr = (struct qla82xx_md_entry_rdmem *)entry_hdr; |
---|
4063 | 4032 | r_addr = m_hdr->read_addr; |
---|
.. | .. |
---|
4150 | 4119 | int no_entry_hdr = 0; |
---|
4151 | 4120 | qla82xx_md_entry_hdr_t *entry_hdr; |
---|
4152 | 4121 | struct qla82xx_md_template_hdr *tmplt_hdr; |
---|
4153 | | - uint32_t *data_ptr; |
---|
| 4122 | + __le32 *data_ptr; |
---|
4154 | 4123 | uint32_t total_data_size = 0, f_capture_mask, data_collected = 0; |
---|
4155 | 4124 | int i = 0, rval = QLA_FUNCTION_FAILED; |
---|
4156 | 4125 | |
---|
4157 | 4126 | tmplt_hdr = (struct qla82xx_md_template_hdr *)ha->md_tmplt_hdr; |
---|
4158 | | - data_ptr = (uint32_t *)ha->md_dump; |
---|
| 4127 | + data_ptr = ha->md_dump; |
---|
4159 | 4128 | |
---|
4160 | 4129 | if (ha->fw_dumped) { |
---|
4161 | 4130 | ql_log(ql_log_warn, vha, 0xb037, |
---|
.. | .. |
---|
4164 | 4133 | goto md_failed; |
---|
4165 | 4134 | } |
---|
4166 | 4135 | |
---|
4167 | | - ha->fw_dumped = 0; |
---|
| 4136 | + ha->fw_dumped = false; |
---|
4168 | 4137 | |
---|
4169 | 4138 | if (!ha->md_tmplt_hdr || !ha->md_dump) { |
---|
4170 | 4139 | ql_log(ql_log_warn, vha, 0xb038, |
---|
.. | .. |
---|
4222 | 4191 | goto md_failed; |
---|
4223 | 4192 | } |
---|
4224 | 4193 | |
---|
4225 | | - entry_hdr = (qla82xx_md_entry_hdr_t *) \ |
---|
| 4194 | + entry_hdr = (qla82xx_md_entry_hdr_t *) |
---|
4226 | 4195 | (((uint8_t *)ha->md_tmplt_hdr) + tmplt_hdr->first_entry_offset); |
---|
4227 | 4196 | |
---|
4228 | 4197 | /* Walk through the entry headers */ |
---|
.. | .. |
---|
4329 | 4298 | data_collected = (uint8_t *)data_ptr - |
---|
4330 | 4299 | (uint8_t *)ha->md_dump; |
---|
4331 | 4300 | skip_nxt_entry: |
---|
4332 | | - entry_hdr = (qla82xx_md_entry_hdr_t *) \ |
---|
| 4301 | + entry_hdr = (qla82xx_md_entry_hdr_t *) |
---|
4333 | 4302 | (((uint8_t *)entry_hdr) + entry_hdr->entry_size); |
---|
4334 | 4303 | } |
---|
4335 | 4304 | |
---|
.. | .. |
---|
4344 | 4313 | ql_log(ql_log_info, vha, 0xb044, |
---|
4345 | 4314 | "Firmware dump saved to temp buffer (%ld/%p %ld/%p).\n", |
---|
4346 | 4315 | vha->host_no, ha->md_tmplt_hdr, vha->host_no, ha->md_dump); |
---|
4347 | | - ha->fw_dumped = 1; |
---|
| 4316 | + ha->fw_dumped = true; |
---|
4348 | 4317 | qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP); |
---|
4349 | 4318 | |
---|
4350 | 4319 | md_failed: |
---|
.. | .. |
---|
4464 | 4433 | |
---|
4465 | 4434 | int rval; |
---|
4466 | 4435 | struct qla_hw_data *ha = vha->hw; |
---|
| 4436 | + |
---|
4467 | 4437 | qla82xx_idc_lock(ha); |
---|
4468 | 4438 | rval = qla82xx_mbx_beacon_ctl(vha, 1); |
---|
4469 | 4439 | |
---|
.. | .. |
---|
4484 | 4454 | |
---|
4485 | 4455 | int rval; |
---|
4486 | 4456 | struct qla_hw_data *ha = vha->hw; |
---|
| 4457 | + |
---|
4487 | 4458 | qla82xx_idc_lock(ha); |
---|
4488 | 4459 | rval = qla82xx_mbx_beacon_ctl(vha, 0); |
---|
4489 | 4460 | |
---|
.. | .. |
---|
4499 | 4470 | } |
---|
4500 | 4471 | |
---|
4501 | 4472 | void |
---|
4502 | | -qla82xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) |
---|
| 4473 | +qla82xx_fw_dump(scsi_qla_host_t *vha) |
---|
4503 | 4474 | { |
---|
4504 | 4475 | struct qla_hw_data *ha = vha->hw; |
---|
4505 | 4476 | |
---|