hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/scsi/aacraid/comminit.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Adaptec AAC series RAID controller driver
34 * (c) Copyright 2001 Red Hat Inc.
....@@ -9,26 +10,11 @@
910 * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
1011 * 2016-2017 Microsemi Corp. (aacraid@microsemi.com)
1112 *
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
- *
2613 * Module Name:
2714 * comminit.c
2815 *
2916 * Abstract: This supports the initialization of the host adapter commuication interface.
3017 * This is a platform dependent module for the pci cyclone board.
31
- *
3218 */
3319
3420 #include <linux/kernel.h>
....@@ -286,36 +272,35 @@
286272 q->entries = qsize;
287273 }
288274
275
+static bool wait_for_io_iter(struct scsi_cmnd *cmd, void *data, bool rsvd)
276
+{
277
+ int *active = data;
278
+
279
+ if (cmd->SCp.phase == AAC_OWNER_FIRMWARE)
280
+ *active = *active + 1;
281
+ return true;
282
+}
289283 static void aac_wait_for_io_completion(struct aac_dev *aac)
290284 {
291
- unsigned long flagv = 0;
292
- int i = 0;
285
+ int i = 0, active;
293286
294287 for (i = 60; i; --i) {
295
- struct scsi_device *dev;
296
- struct scsi_cmnd *command;
297
- int active = 0;
298288
299
- __shost_for_each_device(dev, aac->scsi_host_ptr) {
300
- spin_lock_irqsave(&dev->list_lock, flagv);
301
- list_for_each_entry(command, &dev->cmd_list, list) {
302
- if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
303
- active++;
304
- break;
305
- }
306
- }
307
- spin_unlock_irqrestore(&dev->list_lock, flagv);
308
- if (active)
309
- break;
310
-
311
- }
289
+ active = 0;
290
+ scsi_host_busy_iter(aac->scsi_host_ptr,
291
+ wait_for_io_iter, &active);
312292 /*
313293 * We can exit If all the commands are complete
314294 */
315295 if (active == 0)
316296 break;
297
+ dev_info(&aac->pdev->dev,
298
+ "Wait for %d commands to complete\n", active);
317299 ssleep(1);
318300 }
301
+ if (active)
302
+ dev_err(&aac->pdev->dev,
303
+ "%d outstanding commands during shutdown\n", active);
319304 }
320305
321306 /**
....@@ -585,6 +570,11 @@
585570 else
586571 dev->sa_firmware = 0;
587572
573
+ if (status[4] & le32_to_cpu(AAC_EXTOPT_SOFT_RESET))
574
+ dev->soft_reset_support = 1;
575
+ else
576
+ dev->soft_reset_support = 0;
577
+
588578 if ((dev->comm_interface == AAC_COMM_MESSAGE) &&
589579 (status[2] > dev->base_size)) {
590580 aac_adapter_ioremap(dev, 0);