.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /****************************************************************************** |
---|
2 | 3 | * QLOGIC LINUX SOFTWARE |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Copyright (C) 2000 Qlogic Corporation (www.qlogic.com) |
---|
6 | 7 | * Copyright (C) 2001-2004 Jes Sorensen, Wild Open Source Inc. |
---|
7 | 8 | * Copyright (C) 2003-2004 Christoph Hellwig |
---|
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 as published by the |
---|
11 | | -* Free Software Foundation; either version 2, or (at your option) any |
---|
12 | | -* later version. |
---|
13 | | -* |
---|
14 | | -* This program is distributed in the hope that it will be useful, but |
---|
15 | | -* WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | | -* General Public License for more details. |
---|
18 | 9 | * |
---|
19 | 10 | ******************************************************************************/ |
---|
20 | 11 | #define QLA1280_VERSION "3.27.1" |
---|
.. | .. |
---|
366 | 357 | #include <scsi/scsi_host.h> |
---|
367 | 358 | #include <scsi/scsi_tcq.h> |
---|
368 | 359 | |
---|
369 | | -#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
---|
370 | | -#include <asm/sn/io.h> |
---|
371 | | -#endif |
---|
372 | | - |
---|
373 | 360 | |
---|
374 | 361 | /* |
---|
375 | 362 | * Compile time Options: |
---|
.. | .. |
---|
383 | 370 | |
---|
384 | 371 | #include "qla1280.h" |
---|
385 | 372 | |
---|
386 | | -#ifndef BITS_PER_LONG |
---|
387 | | -#error "BITS_PER_LONG not defined!" |
---|
388 | | -#endif |
---|
389 | | -#if (BITS_PER_LONG == 64) || defined CONFIG_HIGHMEM |
---|
| 373 | +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
---|
390 | 374 | #define QLA_64BIT_PTR 1 |
---|
391 | 375 | #endif |
---|
392 | 376 | |
---|
393 | | -#ifdef QLA_64BIT_PTR |
---|
394 | | -#define pci_dma_hi32(a) ((a >> 16) >> 16) |
---|
395 | | -#else |
---|
396 | | -#define pci_dma_hi32(a) 0 |
---|
397 | | -#endif |
---|
398 | | -#define pci_dma_lo32(a) (a & 0xffffffff) |
---|
399 | | - |
---|
400 | 377 | #define NVRAM_DELAY() udelay(500) /* 2 microseconds */ |
---|
401 | | - |
---|
402 | | -#if defined(__ia64__) && !defined(ia64_platform_is) |
---|
403 | | -#define ia64_platform_is(foo) (!strcmp(x, platform_name)) |
---|
404 | | -#endif |
---|
405 | | - |
---|
406 | 378 | |
---|
407 | 379 | #define IS_ISP1040(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020) |
---|
408 | 380 | #define IS_ISP1x40(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020 || \ |
---|
.. | .. |
---|
554 | 526 | }; |
---|
555 | 527 | MODULE_DEVICE_TABLE(pci, qla1280_pci_tbl); |
---|
556 | 528 | |
---|
557 | | -DEFINE_MUTEX(qla1280_firmware_mutex); |
---|
| 529 | +static DEFINE_MUTEX(qla1280_firmware_mutex); |
---|
558 | 530 | |
---|
559 | 531 | struct qla_fw { |
---|
560 | 532 | char *fwname; |
---|
.. | .. |
---|
563 | 535 | |
---|
564 | 536 | #define QL_NUM_FW_IMAGES 3 |
---|
565 | 537 | |
---|
566 | | -struct qla_fw qla1280_fw_tbl[QL_NUM_FW_IMAGES] = { |
---|
| 538 | +static struct qla_fw qla1280_fw_tbl[QL_NUM_FW_IMAGES] = { |
---|
567 | 539 | {"qlogic/1040.bin", NULL}, /* image 0 */ |
---|
568 | 540 | {"qlogic/1280.bin", NULL}, /* image 1 */ |
---|
569 | 541 | {"qlogic/12160.bin", NULL}, /* image 2 */ |
---|
.. | .. |
---|
1269 | 1241 | { |
---|
1270 | 1242 | struct srb *sp; |
---|
1271 | 1243 | struct list_head *done_q; |
---|
1272 | | - int bus, target, lun; |
---|
| 1244 | + int bus, target; |
---|
1273 | 1245 | struct scsi_cmnd *cmd; |
---|
1274 | 1246 | |
---|
1275 | 1247 | ENTER("qla1280_done"); |
---|
.. | .. |
---|
1284 | 1256 | cmd = sp->cmd; |
---|
1285 | 1257 | bus = SCSI_BUS_32(cmd); |
---|
1286 | 1258 | target = SCSI_TCN_32(cmd); |
---|
1287 | | - lun = SCSI_LUN_32(cmd); |
---|
1288 | 1259 | |
---|
1289 | 1260 | switch ((CMD_RESULT(cmd) >> 16)) { |
---|
1290 | 1261 | case DID_RESET: |
---|
.. | .. |
---|
1445 | 1416 | ha->flags.disable_host_adapter = 0; |
---|
1446 | 1417 | ha->flags.reset_active = 0; |
---|
1447 | 1418 | ha->flags.abort_isp_active = 0; |
---|
1448 | | - |
---|
1449 | | -#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
---|
1450 | | - if (ia64_platform_is("sn2")) { |
---|
1451 | | - printk(KERN_INFO "scsi(%li): Enabling SN2 PCI DMA " |
---|
1452 | | - "dual channel lockup workaround\n", ha->host_no); |
---|
1453 | | - ha->flags.use_pci_vchannel = 1; |
---|
1454 | | - driver_setup.no_nvram = 1; |
---|
1455 | | - } |
---|
1456 | | -#endif |
---|
1457 | 1419 | |
---|
1458 | 1420 | /* TODO: implement support for the 1040 nvram format */ |
---|
1459 | 1421 | if (IS_ISP1040(ha)) |
---|
.. | .. |
---|
1736 | 1698 | return err; |
---|
1737 | 1699 | } |
---|
1738 | 1700 | |
---|
| 1701 | +#ifdef QLA_64BIT_PTR |
---|
| 1702 | +#define LOAD_CMD MBC_LOAD_RAM_A64_ROM |
---|
| 1703 | +#define DUMP_CMD MBC_DUMP_RAM_A64_ROM |
---|
| 1704 | +#define CMD_ARGS (BIT_7 | BIT_6 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0) |
---|
| 1705 | +#else |
---|
| 1706 | +#define LOAD_CMD MBC_LOAD_RAM |
---|
| 1707 | +#define DUMP_CMD MBC_DUMP_RAM |
---|
| 1708 | +#define CMD_ARGS (BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0) |
---|
| 1709 | +#endif |
---|
| 1710 | + |
---|
1739 | 1711 | #define DUMP_IT_BACK 0 /* for debug of RISC loading */ |
---|
1740 | 1712 | static int |
---|
1741 | 1713 | qla1280_load_firmware_dma(struct scsi_qla_host *ha) |
---|
.. | .. |
---|
1750 | 1722 | uint8_t *sp, *tbuf; |
---|
1751 | 1723 | dma_addr_t p_tbuf; |
---|
1752 | 1724 | |
---|
1753 | | - tbuf = pci_alloc_consistent(ha->pdev, 8000, &p_tbuf); |
---|
| 1725 | + tbuf = dma_alloc_coherent(&ha->pdev->dev, 8000, &p_tbuf, GFP_KERNEL); |
---|
1754 | 1726 | if (!tbuf) |
---|
1755 | 1727 | return -ENOMEM; |
---|
1756 | 1728 | #endif |
---|
.. | .. |
---|
1785 | 1757 | for(i = 0; i < cnt; i++) |
---|
1786 | 1758 | ((__le16 *)ha->request_ring)[i] = fw_data[i]; |
---|
1787 | 1759 | |
---|
1788 | | - mb[0] = MBC_LOAD_RAM; |
---|
| 1760 | + mb[0] = LOAD_CMD; |
---|
1789 | 1761 | mb[1] = risc_address; |
---|
1790 | 1762 | mb[4] = cnt; |
---|
1791 | 1763 | mb[3] = ha->request_dma & 0xffff; |
---|
1792 | 1764 | mb[2] = (ha->request_dma >> 16) & 0xffff; |
---|
1793 | | - mb[7] = pci_dma_hi32(ha->request_dma) & 0xffff; |
---|
1794 | | - mb[6] = pci_dma_hi32(ha->request_dma) >> 16; |
---|
| 1765 | + mb[7] = upper_32_bits(ha->request_dma) & 0xffff; |
---|
| 1766 | + mb[6] = upper_32_bits(ha->request_dma) >> 16; |
---|
1795 | 1767 | dprintk(2, "%s: op=%d 0x%p = 0x%4x,0x%4x,0x%4x,0x%4x\n", |
---|
1796 | 1768 | __func__, mb[0], |
---|
1797 | 1769 | (void *)(long)ha->request_dma, |
---|
1798 | 1770 | mb[6], mb[7], mb[2], mb[3]); |
---|
1799 | | - err = qla1280_mailbox_command(ha, BIT_4 | BIT_3 | BIT_2 | |
---|
1800 | | - BIT_1 | BIT_0, mb); |
---|
| 1771 | + err = qla1280_mailbox_command(ha, CMD_ARGS, mb); |
---|
1801 | 1772 | if (err) { |
---|
1802 | 1773 | printk(KERN_ERR "scsi(%li): Failed to load partial " |
---|
1803 | 1774 | "segment of f\n", ha->host_no); |
---|
.. | .. |
---|
1805 | 1776 | } |
---|
1806 | 1777 | |
---|
1807 | 1778 | #if DUMP_IT_BACK |
---|
1808 | | - mb[0] = MBC_DUMP_RAM; |
---|
| 1779 | + mb[0] = DUMP_CMD; |
---|
1809 | 1780 | mb[1] = risc_address; |
---|
1810 | 1781 | mb[4] = cnt; |
---|
1811 | 1782 | mb[3] = p_tbuf & 0xffff; |
---|
1812 | 1783 | mb[2] = (p_tbuf >> 16) & 0xffff; |
---|
1813 | | - mb[7] = pci_dma_hi32(p_tbuf) & 0xffff; |
---|
1814 | | - mb[6] = pci_dma_hi32(p_tbuf) >> 16; |
---|
| 1784 | + mb[7] = upper_32_bits(p_tbuf) & 0xffff; |
---|
| 1785 | + mb[6] = upper_32_bits(p_tbuf) >> 16; |
---|
1815 | 1786 | |
---|
1816 | | - err = qla1280_mailbox_command(ha, BIT_4 | BIT_3 | BIT_2 | |
---|
1817 | | - BIT_1 | BIT_0, mb); |
---|
| 1787 | + err = qla1280_mailbox_command(ha, CMD_ARGS, mb); |
---|
1818 | 1788 | if (err) { |
---|
1819 | 1789 | printk(KERN_ERR |
---|
1820 | 1790 | "Failed to dump partial segment of f/w\n"); |
---|
.. | .. |
---|
1841 | 1811 | |
---|
1842 | 1812 | out: |
---|
1843 | 1813 | #if DUMP_IT_BACK |
---|
1844 | | - pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf); |
---|
| 1814 | + dma_free_coherent(&ha->pdev->dev, 8000, tbuf, p_tbuf); |
---|
1845 | 1815 | #endif |
---|
1846 | 1816 | return err; |
---|
1847 | 1817 | } |
---|
.. | .. |
---|
1933 | 1903 | mb[3] = ha->request_dma & 0xffff; |
---|
1934 | 1904 | mb[2] = (ha->request_dma >> 16) & 0xffff; |
---|
1935 | 1905 | mb[4] = 0; |
---|
1936 | | - mb[7] = pci_dma_hi32(ha->request_dma) & 0xffff; |
---|
1937 | | - mb[6] = pci_dma_hi32(ha->request_dma) >> 16; |
---|
| 1906 | + mb[7] = upper_32_bits(ha->request_dma) & 0xffff; |
---|
| 1907 | + mb[6] = upper_32_bits(ha->request_dma) >> 16; |
---|
1938 | 1908 | if (!(status = qla1280_mailbox_command(ha, BIT_7 | BIT_6 | BIT_4 | |
---|
1939 | 1909 | BIT_3 | BIT_2 | BIT_1 | BIT_0, |
---|
1940 | 1910 | &mb[0]))) { |
---|
.. | .. |
---|
1947 | 1917 | mb[3] = ha->response_dma & 0xffff; |
---|
1948 | 1918 | mb[2] = (ha->response_dma >> 16) & 0xffff; |
---|
1949 | 1919 | mb[5] = 0; |
---|
1950 | | - mb[7] = pci_dma_hi32(ha->response_dma) & 0xffff; |
---|
1951 | | - mb[6] = pci_dma_hi32(ha->response_dma) >> 16; |
---|
| 1920 | + mb[7] = upper_32_bits(ha->response_dma) & 0xffff; |
---|
| 1921 | + mb[6] = upper_32_bits(ha->response_dma) >> 16; |
---|
1952 | 1922 | status = qla1280_mailbox_command(ha, BIT_7 | BIT_6 | BIT_5 | |
---|
1953 | 1923 | BIT_3 | BIT_2 | BIT_1 | BIT_0, |
---|
1954 | 1924 | &mb[0]); |
---|
.. | .. |
---|
2214 | 2184 | nv->cntr_flags_1.disable_loading_risc_code; |
---|
2215 | 2185 | |
---|
2216 | 2186 | if (IS_ISP1040(ha)) { |
---|
2217 | | - uint16_t hwrev, cfg1, cdma_conf, ddma_conf; |
---|
| 2187 | + uint16_t hwrev, cfg1, cdma_conf; |
---|
2218 | 2188 | |
---|
2219 | 2189 | hwrev = RD_REG_WORD(®->cfg_0) & ISP_CFG0_HWMSK; |
---|
2220 | 2190 | |
---|
2221 | 2191 | cfg1 = RD_REG_WORD(®->cfg_1) & ~(BIT_4 | BIT_5 | BIT_6); |
---|
2222 | 2192 | cdma_conf = RD_REG_WORD(®->cdma_cfg); |
---|
2223 | | - ddma_conf = RD_REG_WORD(®->ddma_cfg); |
---|
2224 | 2193 | |
---|
2225 | 2194 | /* Busted fifo, says mjacob. */ |
---|
2226 | 2195 | if (hwrev != ISP_CFG0_1040A) |
---|
.. | .. |
---|
2270 | 2239 | mb[1] = nv->firmware_feature.f.enable_fast_posting; |
---|
2271 | 2240 | mb[1] |= nv->firmware_feature.f.report_lvd_bus_transition << 1; |
---|
2272 | 2241 | mb[1] |= nv->firmware_feature.f.disable_synchronous_backoff << 5; |
---|
2273 | | -#if defined(CONFIG_IA64_GENERIC) || defined (CONFIG_IA64_SGI_SN2) |
---|
2274 | | - if (ia64_platform_is("sn2")) { |
---|
2275 | | - printk(KERN_INFO "scsi(%li): Enabling SN2 PCI DMA " |
---|
2276 | | - "workaround\n", ha->host_no); |
---|
2277 | | - mb[1] |= nv->firmware_feature.f.unused_9 << 9; /* XXX */ |
---|
2278 | | - } |
---|
2279 | | -#endif |
---|
2280 | 2242 | status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb); |
---|
2281 | 2243 | |
---|
2282 | 2244 | /* Retry count and delay. */ |
---|
.. | .. |
---|
2463 | 2425 | int cnt; |
---|
2464 | 2426 | uint16_t *optr, *iptr; |
---|
2465 | 2427 | uint16_t __iomem *mptr; |
---|
2466 | | - uint16_t data; |
---|
2467 | 2428 | DECLARE_COMPLETION_ONSTACK(wait); |
---|
2468 | 2429 | |
---|
2469 | 2430 | ENTER("qla1280_mailbox_command"); |
---|
.. | .. |
---|
2498 | 2459 | |
---|
2499 | 2460 | spin_unlock_irq(ha->host->host_lock); |
---|
2500 | 2461 | WRT_REG_WORD(®->host_cmd, HC_SET_HOST_INT); |
---|
2501 | | - data = qla1280_debounce_register(®->istatus); |
---|
| 2462 | + qla1280_debounce_register(®->istatus); |
---|
2502 | 2463 | |
---|
2503 | 2464 | wait_for_completion(&wait); |
---|
2504 | 2465 | del_timer_sync(&ha->mailbox_timer); |
---|
.. | .. |
---|
2907 | 2868 | break; |
---|
2908 | 2869 | |
---|
2909 | 2870 | dma_handle = sg_dma_address(s); |
---|
2910 | | -#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
---|
2911 | | - if (ha->flags.use_pci_vchannel) |
---|
2912 | | - sn_pci_set_vchan(ha->pdev, |
---|
2913 | | - (unsigned long *)&dma_handle, |
---|
2914 | | - SCSI_BUS_32(cmd)); |
---|
2915 | | -#endif |
---|
2916 | 2871 | *dword_ptr++ = |
---|
2917 | | - cpu_to_le32(pci_dma_lo32(dma_handle)); |
---|
| 2872 | + cpu_to_le32(lower_32_bits(dma_handle)); |
---|
2918 | 2873 | *dword_ptr++ = |
---|
2919 | | - cpu_to_le32(pci_dma_hi32(dma_handle)); |
---|
| 2874 | + cpu_to_le32(upper_32_bits(dma_handle)); |
---|
2920 | 2875 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); |
---|
2921 | 2876 | dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", |
---|
2922 | | - cpu_to_le32(pci_dma_hi32(dma_handle)), |
---|
2923 | | - cpu_to_le32(pci_dma_lo32(dma_handle)), |
---|
| 2877 | + cpu_to_le32(upper_32_bits(dma_handle)), |
---|
| 2878 | + cpu_to_le32(lower_32_bits(dma_handle)), |
---|
2924 | 2879 | cpu_to_le32(sg_dma_len(sg_next(s)))); |
---|
2925 | 2880 | remseg--; |
---|
2926 | 2881 | } |
---|
.. | .. |
---|
2969 | 2924 | if (cnt == 5) |
---|
2970 | 2925 | break; |
---|
2971 | 2926 | dma_handle = sg_dma_address(s); |
---|
2972 | | -#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
---|
2973 | | - if (ha->flags.use_pci_vchannel) |
---|
2974 | | - sn_pci_set_vchan(ha->pdev, |
---|
2975 | | - (unsigned long *)&dma_handle, |
---|
2976 | | - SCSI_BUS_32(cmd)); |
---|
2977 | | -#endif |
---|
2978 | 2927 | *dword_ptr++ = |
---|
2979 | | - cpu_to_le32(pci_dma_lo32(dma_handle)); |
---|
| 2928 | + cpu_to_le32(lower_32_bits(dma_handle)); |
---|
2980 | 2929 | *dword_ptr++ = |
---|
2981 | | - cpu_to_le32(pci_dma_hi32(dma_handle)); |
---|
| 2930 | + cpu_to_le32(upper_32_bits(dma_handle)); |
---|
2982 | 2931 | *dword_ptr++ = |
---|
2983 | 2932 | cpu_to_le32(sg_dma_len(s)); |
---|
2984 | 2933 | dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n", |
---|
2985 | | - cpu_to_le32(pci_dma_hi32(dma_handle)), |
---|
2986 | | - cpu_to_le32(pci_dma_lo32(dma_handle)), |
---|
| 2934 | + cpu_to_le32(upper_32_bits(dma_handle)), |
---|
| 2935 | + cpu_to_le32(lower_32_bits(dma_handle)), |
---|
2987 | 2936 | cpu_to_le32(sg_dma_len(s))); |
---|
2988 | 2937 | } |
---|
2989 | 2938 | remseg -= cnt; |
---|
.. | .. |
---|
3014 | 2963 | sp->flags |= SRB_SENT; |
---|
3015 | 2964 | ha->actthreads++; |
---|
3016 | 2965 | WRT_REG_WORD(®->mailbox4, ha->req_ring_index); |
---|
3017 | | - /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ |
---|
3018 | | - mmiowb(); |
---|
3019 | 2966 | |
---|
3020 | 2967 | out: |
---|
3021 | 2968 | if (status) |
---|
.. | .. |
---|
3178 | 3125 | if (cnt == 4) |
---|
3179 | 3126 | break; |
---|
3180 | 3127 | *dword_ptr++ = |
---|
3181 | | - cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); |
---|
| 3128 | + cpu_to_le32(lower_32_bits(sg_dma_address(s))); |
---|
3182 | 3129 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); |
---|
3183 | 3130 | dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", |
---|
3184 | | - (pci_dma_lo32(sg_dma_address(s))), |
---|
| 3131 | + (lower_32_bits(sg_dma_address(s))), |
---|
3185 | 3132 | (sg_dma_len(s))); |
---|
3186 | 3133 | remseg--; |
---|
3187 | 3134 | } |
---|
.. | .. |
---|
3224 | 3171 | if (cnt == 7) |
---|
3225 | 3172 | break; |
---|
3226 | 3173 | *dword_ptr++ = |
---|
3227 | | - cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); |
---|
| 3174 | + cpu_to_le32(lower_32_bits(sg_dma_address(s))); |
---|
3228 | 3175 | *dword_ptr++ = |
---|
3229 | 3176 | cpu_to_le32(sg_dma_len(s)); |
---|
3230 | 3177 | dprintk(1, |
---|
3231 | 3178 | "S/G Segment Cont. phys_addr=0x%x, " |
---|
3232 | 3179 | "len=0x%x\n", |
---|
3233 | | - cpu_to_le32(pci_dma_lo32(sg_dma_address(s))), |
---|
| 3180 | + cpu_to_le32(lower_32_bits(sg_dma_address(s))), |
---|
3234 | 3181 | cpu_to_le32(sg_dma_len(s))); |
---|
3235 | 3182 | } |
---|
3236 | 3183 | remseg -= cnt; |
---|
.. | .. |
---|
3264 | 3211 | sp->flags |= SRB_SENT; |
---|
3265 | 3212 | ha->actthreads++; |
---|
3266 | 3213 | WRT_REG_WORD(®->mailbox4, ha->req_ring_index); |
---|
3267 | | - /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ |
---|
3268 | | - mmiowb(); |
---|
3269 | 3214 | |
---|
3270 | 3215 | out: |
---|
3271 | 3216 | if (status) |
---|
.. | .. |
---|
3377 | 3322 | |
---|
3378 | 3323 | /* |
---|
3379 | 3324 | * Update request index to mailbox4 (Request Queue In). |
---|
3380 | | - * The mmiowb() ensures that this write is ordered with writes by other |
---|
3381 | | - * CPUs. Without the mmiowb(), it is possible for the following: |
---|
3382 | | - * CPUA posts write of index 5 to mailbox4 |
---|
3383 | | - * CPUA releases host lock |
---|
3384 | | - * CPUB acquires host lock |
---|
3385 | | - * CPUB posts write of index 6 to mailbox4 |
---|
3386 | | - * On PCI bus, order reverses and write of 6 posts, then index 5, |
---|
3387 | | - * causing chip to issue full queue of stale commands |
---|
3388 | | - * The mmiowb() prevents future writes from crossing the barrier. |
---|
3389 | | - * See Documentation/driver-api/device-io.rst for more information. |
---|
3390 | 3325 | */ |
---|
3391 | 3326 | WRT_REG_WORD(®->mailbox4, ha->req_ring_index); |
---|
3392 | | - mmiowb(); |
---|
3393 | 3327 | |
---|
3394 | 3328 | LEAVE("qla1280_isp_cmd"); |
---|
3395 | 3329 | } |
---|
.. | .. |
---|
3667 | 3601 | qla1280_status_entry(struct scsi_qla_host *ha, struct response *pkt, |
---|
3668 | 3602 | struct list_head *done_q) |
---|
3669 | 3603 | { |
---|
3670 | | - unsigned int bus, target, lun; |
---|
3671 | 3604 | int sense_sz; |
---|
3672 | 3605 | struct srb *sp; |
---|
3673 | 3606 | struct scsi_cmnd *cmd; |
---|
.. | .. |
---|
3692 | 3625 | ha->outstanding_cmds[handle] = NULL; |
---|
3693 | 3626 | |
---|
3694 | 3627 | cmd = sp->cmd; |
---|
3695 | | - |
---|
3696 | | - /* Generate LU queue on cntrl, target, LUN */ |
---|
3697 | | - bus = SCSI_BUS_32(cmd); |
---|
3698 | | - target = SCSI_TCN_32(cmd); |
---|
3699 | | - lun = SCSI_LUN_32(cmd); |
---|
3700 | 3628 | |
---|
3701 | 3629 | if (comp_status || scsi_status) { |
---|
3702 | 3630 | dprintk(3, "scsi: comp_status = 0x%x, scsi_status = " |
---|
.. | .. |
---|
3736 | 3664 | |
---|
3737 | 3665 | dprintk(2, "qla1280_status_entry: Check " |
---|
3738 | 3666 | "condition Sense data, b %i, t %i, " |
---|
3739 | | - "l %i\n", bus, target, lun); |
---|
| 3667 | + "l %i\n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), |
---|
| 3668 | + SCSI_LUN_32(cmd)); |
---|
3740 | 3669 | if (sense_sz) |
---|
3741 | 3670 | qla1280_dump_buffer(2, |
---|
3742 | 3671 | (char *)cmd->sense_buffer, |
---|
.. | .. |
---|
4213 | 4142 | .can_queue = MAX_OUTSTANDING_COMMANDS, |
---|
4214 | 4143 | .this_id = -1, |
---|
4215 | 4144 | .sg_tablesize = SG_ALL, |
---|
4216 | | - .use_clustering = ENABLE_CLUSTERING, |
---|
4217 | 4145 | }; |
---|
4218 | 4146 | |
---|
4219 | 4147 | |
---|
.. | .. |
---|
4259 | 4187 | ha->devnum = devnum; /* specifies microcode load address */ |
---|
4260 | 4188 | |
---|
4261 | 4189 | #ifdef QLA_64BIT_PTR |
---|
4262 | | - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(64))) { |
---|
4263 | | - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { |
---|
| 4190 | + if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) { |
---|
| 4191 | + if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { |
---|
4264 | 4192 | printk(KERN_WARNING "scsi(%li): Unable to set a " |
---|
4265 | 4193 | "suitable DMA mask - aborting\n", ha->host_no); |
---|
4266 | 4194 | error = -ENODEV; |
---|
.. | .. |
---|
4270 | 4198 | dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n", |
---|
4271 | 4199 | ha->host_no); |
---|
4272 | 4200 | #else |
---|
4273 | | - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { |
---|
| 4201 | + if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { |
---|
4274 | 4202 | printk(KERN_WARNING "scsi(%li): Unable to set a " |
---|
4275 | 4203 | "suitable DMA mask - aborting\n", ha->host_no); |
---|
4276 | 4204 | error = -ENODEV; |
---|
.. | .. |
---|
4278 | 4206 | } |
---|
4279 | 4207 | #endif |
---|
4280 | 4208 | |
---|
4281 | | - ha->request_ring = pci_alloc_consistent(ha->pdev, |
---|
| 4209 | + ha->request_ring = dma_alloc_coherent(&ha->pdev->dev, |
---|
4282 | 4210 | ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)), |
---|
4283 | | - &ha->request_dma); |
---|
| 4211 | + &ha->request_dma, GFP_KERNEL); |
---|
4284 | 4212 | if (!ha->request_ring) { |
---|
4285 | 4213 | printk(KERN_INFO "qla1280: Failed to get request memory\n"); |
---|
4286 | 4214 | goto error_put_host; |
---|
4287 | 4215 | } |
---|
4288 | 4216 | |
---|
4289 | | - ha->response_ring = pci_alloc_consistent(ha->pdev, |
---|
| 4217 | + ha->response_ring = dma_alloc_coherent(&ha->pdev->dev, |
---|
4290 | 4218 | ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)), |
---|
4291 | | - &ha->response_dma); |
---|
| 4219 | + &ha->response_dma, GFP_KERNEL); |
---|
4292 | 4220 | if (!ha->response_ring) { |
---|
4293 | 4221 | printk(KERN_INFO "qla1280: Failed to get response memory\n"); |
---|
4294 | 4222 | goto error_free_request_ring; |
---|
.. | .. |
---|
4370 | 4298 | release_region(host->io_port, 0xff); |
---|
4371 | 4299 | #endif |
---|
4372 | 4300 | error_free_response_ring: |
---|
4373 | | - pci_free_consistent(ha->pdev, |
---|
| 4301 | + dma_free_coherent(&ha->pdev->dev, |
---|
4374 | 4302 | ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)), |
---|
4375 | 4303 | ha->response_ring, ha->response_dma); |
---|
4376 | 4304 | error_free_request_ring: |
---|
4377 | | - pci_free_consistent(ha->pdev, |
---|
| 4305 | + dma_free_coherent(&ha->pdev->dev, |
---|
4378 | 4306 | ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)), |
---|
4379 | 4307 | ha->request_ring, ha->request_dma); |
---|
4380 | 4308 | error_put_host: |
---|
.. | .. |
---|
4404 | 4332 | release_region(host->io_port, 0xff); |
---|
4405 | 4333 | #endif |
---|
4406 | 4334 | |
---|
4407 | | - pci_free_consistent(ha->pdev, |
---|
| 4335 | + dma_free_coherent(&ha->pdev->dev, |
---|
4408 | 4336 | ((REQUEST_ENTRY_CNT + 1) * (sizeof(request_t))), |
---|
4409 | 4337 | ha->request_ring, ha->request_dma); |
---|
4410 | | - pci_free_consistent(ha->pdev, |
---|
| 4338 | + dma_free_coherent(&ha->pdev->dev, |
---|
4411 | 4339 | ((RESPONSE_ENTRY_CNT + 1) * (sizeof(struct response))), |
---|
4412 | 4340 | ha->response_ring, ha->response_dma); |
---|
4413 | 4341 | |
---|