.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Adaptec AAC series RAID controller driver |
---|
3 | 4 | * (c) Copyright 2001 Red Hat Inc. <alan@redhat.com> |
---|
.. | .. |
---|
9 | 10 | * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com) |
---|
10 | 11 | * 2016-2017 Microsemi Corp. (aacraid@microsemi.com) |
---|
11 | 12 | * |
---|
12 | | - * This program is free software; you can redistribute it and/or modify |
---|
13 | | - * it under the terms of the GNU General Public License as published by |
---|
14 | | - * the Free Software Foundation; either version 2, or (at your option) |
---|
15 | | - * any later version. |
---|
16 | | - * |
---|
17 | | - * This program is distributed in the hope that it will be useful, |
---|
18 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | | - * GNU General Public License for more details. |
---|
21 | | - * |
---|
22 | | - * You should have received a copy of the GNU General Public License |
---|
23 | | - * along with this program; see the file COPYING. If not, write to |
---|
24 | | - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
25 | | - * |
---|
26 | 13 | * Module Name: |
---|
27 | 14 | * aacraid.h |
---|
28 | 15 | * |
---|
29 | 16 | * Abstract: Contains all routines for control of the aacraid driver |
---|
30 | | - * |
---|
31 | 17 | */ |
---|
32 | 18 | |
---|
33 | 19 | #ifndef _AACRAID_H_ |
---|
.. | .. |
---|
40 | 26 | #define nblank(x) _nblank(x)[0] |
---|
41 | 27 | |
---|
42 | 28 | #include <linux/interrupt.h> |
---|
| 29 | +#include <linux/completion.h> |
---|
43 | 30 | #include <linux/pci.h> |
---|
44 | 31 | #include <scsi/scsi_host.h> |
---|
45 | 32 | |
---|
.. | .. |
---|
98 | 85 | #define PMC_GLOBAL_INT_BIT0 0x00000001 |
---|
99 | 86 | |
---|
100 | 87 | #ifndef AAC_DRIVER_BUILD |
---|
101 | | -# define AAC_DRIVER_BUILD 50877 |
---|
| 88 | +# define AAC_DRIVER_BUILD 50983 |
---|
102 | 89 | # define AAC_DRIVER_BRANCH "-custom" |
---|
103 | 90 | #endif |
---|
104 | 91 | #define MAXIMUM_NUM_CONTAINERS 32 |
---|
.. | .. |
---|
121 | 108 | #define AAC_BUS_TARGET_LOOP (AAC_MAX_BUSES * AAC_MAX_TARGETS) |
---|
122 | 109 | #define AAC_MAX_NATIVE_SIZE 2048 |
---|
123 | 110 | #define FW_ERROR_BUFFER_SIZE 512 |
---|
| 111 | +#define AAC_SA_TIMEOUT 180 |
---|
| 112 | +#define AAC_ARC_TIMEOUT 60 |
---|
124 | 113 | |
---|
125 | 114 | #define get_bus_number(x) (x/AAC_MAX_TARGETS) |
---|
126 | 115 | #define get_target_number(x) (x%AAC_MAX_TARGETS) |
---|
.. | .. |
---|
1241 | 1230 | u32 unique; // unique value representing this context |
---|
1242 | 1231 | ulong jiffies; // used for cleanup - dmb changed to ulong |
---|
1243 | 1232 | struct list_head next; // used to link context's into a linked list |
---|
1244 | | - struct semaphore wait_sem; // this is used to wait for the next fib to arrive. |
---|
| 1233 | + struct completion completion; // this is used to wait for the next fib to arrive. |
---|
1245 | 1234 | int wait; // Set to true when thread is in WaitForSingleObject |
---|
1246 | 1235 | unsigned long count; // total number of FIBs on FibList |
---|
1247 | 1236 | struct list_head fib_list; // this holds fibs and their attachd hw_fibs |
---|
.. | .. |
---|
1313 | 1302 | * This is the event the sendfib routine will wait on if the |
---|
1314 | 1303 | * caller did not pass one and this is synch io. |
---|
1315 | 1304 | */ |
---|
1316 | | - struct semaphore event_wait; |
---|
| 1305 | + struct completion event_wait; |
---|
1317 | 1306 | spinlock_t event_lock; |
---|
1318 | 1307 | |
---|
1319 | 1308 | u32 done; /* gets set to 1 when fib is complete */ |
---|
.. | .. |
---|
1341 | 1330 | #define AAC_DEVTYPE_ARC_RAW 2 |
---|
1342 | 1331 | #define AAC_DEVTYPE_NATIVE_RAW 3 |
---|
1343 | 1332 | |
---|
1344 | | -#define AAC_SAFW_RESCAN_DELAY (10 * HZ) |
---|
| 1333 | +#define AAC_RESCAN_DELAY (10 * HZ) |
---|
1345 | 1334 | |
---|
1346 | 1335 | struct aac_hba_map_info { |
---|
1347 | 1336 | __le32 rmw_nexus; /* nexus for native HBA devices */ |
---|
.. | .. |
---|
1614 | 1603 | struct fsa_dev_info *fsa_dev; |
---|
1615 | 1604 | struct task_struct *thread; |
---|
1616 | 1605 | struct delayed_work safw_rescan_work; |
---|
| 1606 | + struct delayed_work src_reinit_aif_worker; |
---|
1617 | 1607 | int cardtype; |
---|
1618 | 1608 | /* |
---|
1619 | 1609 | *This lock will protect the two 32-bit |
---|
.. | .. |
---|
1686 | 1676 | u8 adapter_shutdown; |
---|
1687 | 1677 | u32 handle_pci_error; |
---|
1688 | 1678 | bool init_reset; |
---|
| 1679 | + u8 soft_reset_support; |
---|
1689 | 1680 | }; |
---|
1690 | 1681 | |
---|
1691 | 1682 | #define aac_adapter_interrupt(dev) \ |
---|
.. | .. |
---|
2657 | 2648 | |
---|
2658 | 2649 | static inline void aac_schedule_safw_scan_worker(struct aac_dev *dev) |
---|
2659 | 2650 | { |
---|
2660 | | - schedule_delayed_work(&dev->safw_rescan_work, AAC_SAFW_RESCAN_DELAY); |
---|
| 2651 | + schedule_delayed_work(&dev->safw_rescan_work, AAC_RESCAN_DELAY); |
---|
| 2652 | +} |
---|
| 2653 | + |
---|
| 2654 | +static inline void aac_schedule_src_reinit_aif_worker(struct aac_dev *dev) |
---|
| 2655 | +{ |
---|
| 2656 | + schedule_delayed_work(&dev->src_reinit_aif_worker, AAC_RESCAN_DELAY); |
---|
2661 | 2657 | } |
---|
2662 | 2658 | |
---|
2663 | 2659 | static inline void aac_safw_rescan_worker(struct work_struct *work) |
---|
.. | .. |
---|
2671 | 2667 | aac_scan_host(dev); |
---|
2672 | 2668 | } |
---|
2673 | 2669 | |
---|
2674 | | -static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev) |
---|
| 2670 | +static inline void aac_cancel_rescan_worker(struct aac_dev *dev) |
---|
2675 | 2671 | { |
---|
2676 | | - if (dev->sa_firmware) |
---|
2677 | | - cancel_delayed_work_sync(&dev->safw_rescan_work); |
---|
| 2672 | + cancel_delayed_work_sync(&dev->safw_rescan_work); |
---|
| 2673 | + cancel_delayed_work_sync(&dev->src_reinit_aif_worker); |
---|
2678 | 2674 | } |
---|
2679 | 2675 | |
---|
2680 | 2676 | /* SCp.phase values */ |
---|
.. | .. |
---|
2684 | 2680 | #define AAC_OWNER_FIRMWARE 0x106 |
---|
2685 | 2681 | |
---|
2686 | 2682 | void aac_safw_rescan_worker(struct work_struct *work); |
---|
| 2683 | +void aac_src_reinit_aif_worker(struct work_struct *work); |
---|
2687 | 2684 | int aac_acquire_irq(struct aac_dev *dev); |
---|
2688 | 2685 | void aac_free_irq(struct aac_dev *dev); |
---|
2689 | 2686 | int aac_setup_safw_adapter(struct aac_dev *dev); |
---|
.. | .. |
---|
2710 | 2707 | int aac_get_config_status(struct aac_dev *dev, int commit_flag); |
---|
2711 | 2708 | int aac_get_containers(struct aac_dev *dev); |
---|
2712 | 2709 | int aac_scsi_cmd(struct scsi_cmnd *cmd); |
---|
2713 | | -int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); |
---|
| 2710 | +int aac_dev_ioctl(struct aac_dev *dev, unsigned int cmd, void __user *arg); |
---|
2714 | 2711 | #ifndef shost_to_class |
---|
2715 | 2712 | #define shost_to_class(shost) &shost->shost_dev |
---|
2716 | 2713 | #endif |
---|
2717 | 2714 | ssize_t aac_get_serial_number(struct device *dev, char *buf); |
---|
2718 | | -int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); |
---|
| 2715 | +int aac_do_ioctl(struct aac_dev *dev, unsigned int cmd, void __user *arg); |
---|
2719 | 2716 | int aac_rx_init(struct aac_dev *dev); |
---|
2720 | 2717 | int aac_rkt_init(struct aac_dev *dev); |
---|
2721 | 2718 | int aac_nark_init(struct aac_dev *dev); |
---|
.. | .. |
---|
2741 | 2738 | int _aac_rx_init(struct aac_dev *dev); |
---|
2742 | 2739 | int aac_rx_select_comm(struct aac_dev *dev, int comm); |
---|
2743 | 2740 | int aac_rx_deliver_producer(struct fib * fib); |
---|
| 2741 | +void aac_reinit_aif(struct aac_dev *aac, unsigned int index); |
---|
2744 | 2742 | |
---|
2745 | 2743 | static inline int aac_is_src(struct aac_dev *dev) |
---|
2746 | 2744 | { |
---|