All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Cc: David.Carroll@microsemi.com, Gana.Sridaran@microsemi.com,
	Scott.Benesh@microsemi.com
Subject: [PATCH V3 04/24] aacraid: Added sa firmware support
Date: Fri, 27 Jan 2017 11:28:33 -0800	[thread overview]
Message-ID: <20170127192853.10082-5-RaghavaAditya.Renukunta@microsemi.com> (raw)
In-Reply-To: <20170127192853.10082-1-RaghavaAditya.Renukunta@microsemi.com>

sa_firmware adds the capability to differentiate the new SmartIOC family
of adapters from the series 8 and below.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>

---
Changes in  V2:
None

Changes in V3:
Removed unnecessary brackets

 drivers/scsi/aacraid/aacraid.h  |  4 ++
 drivers/scsi/aacraid/comminit.c | 98 +++++++++++++++++------------------------
 drivers/scsi/aacraid/linit.c    |  2 +-
 3 files changed, 45 insertions(+), 59 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index f712d8d..1069c01 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1130,6 +1130,7 @@ struct aac_bus_info_response {
 #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO	cpu_to_le32(1<<16)
 #define AAC_OPT_NEW_COMM		cpu_to_le32(1<<17)
 #define AAC_OPT_NEW_COMM_64		cpu_to_le32(1<<18)
+#define AAC_OPT_EXTENDED		cpu_to_le32(1<<23)
 #define AAC_OPT_NEW_COMM_TYPE1		cpu_to_le32(1<<28)
 #define AAC_OPT_NEW_COMM_TYPE2		cpu_to_le32(1<<29)
 #define AAC_OPT_NEW_COMM_TYPE3		cpu_to_le32(1<<30)
@@ -1141,6 +1142,8 @@ struct aac_bus_info_response {
 #define AAC_COMM_MESSAGE_TYPE2		4
 #define AAC_COMM_MESSAGE_TYPE3		5
 
+#define AAC_EXTOPT_SA_FIRMWARE		cpu_to_le32(1<<1)
+
 /* MSIX context */
 struct aac_msix_ctx {
 	int		vector_no;
@@ -1272,6 +1275,7 @@ struct aac_dev
 	u8			printf_enabled;
 	u8			in_reset;
 	u8			msi;
+	u8			sa_firmware;
 	int			management_fib_count;
 	spinlock_t		manage_lock;
 	spinlock_t		sync_lock;
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 480ff01..5aad018 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -75,14 +75,22 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
 
 	if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) ||
 		(dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) ||
-		(dev->comm_interface == AAC_COMM_MESSAGE_TYPE3))
+		(dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 &&
+		!dev->sa_firmware)) {
 		host_rrq_size =
 			(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)
 				* sizeof(u32);
-	else
+		aac_init_size = sizeof(union aac_init);
+	} else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 &&
+		dev->sa_firmware) {
+		host_rrq_size = (dev->scsi_host_ptr->can_queue
+			+ AAC_NUM_MGT_FIB) * sizeof(u32)  * AAC_MAX_MSIX;
+		aac_init_size = sizeof(union aac_init) +
+			(AAC_MAX_HRRQ - 1) * sizeof(struct _rrq);
+	} else {
 		host_rrq_size = 0;
-
-	aac_init_size = sizeof(union aac_init);
+		aac_init_size = sizeof(union aac_init);
+	}
 	size = fibsize + aac_init_size + commsize + commalign +
 			printfbufsiz + host_rrq_size;
 
@@ -466,9 +474,13 @@ void aac_define_int_mode(struct aac_dev *dev)
 		if (dev->max_msix > msi_count)
 			dev->max_msix = msi_count;
 	}
-	dev->vector_cap =
-		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
-		msi_count;
+	if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3 && dev->sa_firmware)
+		dev->vector_cap = dev->scsi_host_ptr->can_queue +
+				AAC_NUM_MGT_FIB;
+	else
+		dev->vector_cap = (dev->scsi_host_ptr->can_queue +
+				AAC_NUM_MGT_FIB) / msi_count;
+
 }
 struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 {
@@ -527,6 +539,12 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 				dev->sync_mode = 1;
 			}
 		}
+		if ((status[1] & le32_to_cpu(AAC_OPT_EXTENDED)) &&
+			(status[4] & le32_to_cpu(AAC_EXTOPT_SA_FIRMWARE)))
+			dev->sa_firmware = 1;
+		else
+			dev->sa_firmware = 0;
+
 		if ((dev->comm_interface == AAC_COMM_MESSAGE) &&
 		    (status[2] > dev->base_size)) {
 			aac_adapter_ioremap(dev, 0);
@@ -563,61 +581,25 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 		dev->sg_tablesize = status[2] & 0xFFFF;
 		if (dev->pdev->device == PMC_DEVICE_S7 ||
 		    dev->pdev->device == PMC_DEVICE_S8 ||
-		    dev->pdev->device == PMC_DEVICE_S9)
-			host->can_queue = ((status[3] >> 16) ? (status[3] >> 16) :
-				(status[3] & 0xFFFF)) - AAC_NUM_MGT_FIB;
-		else
-			host->can_queue = (status[3] & 0xFFFF) - AAC_NUM_MGT_FIB;
+		    dev->pdev->device == PMC_DEVICE_S9) {
+			if (host->can_queue > (status[3] >> 16) -
+					AAC_NUM_MGT_FIB)
+				host->can_queue = (status[3] >> 16) -
+					AAC_NUM_MGT_FIB;
+		} else if (host->can_queue > (status[3] & 0xFFFF) -
+				AAC_NUM_MGT_FIB)
+			host->can_queue = (status[3] & 0xFFFF) -
+				AAC_NUM_MGT_FIB;
+
 		dev->max_num_aif = status[4] & 0xFFFF;
-		/*
-		 *	NOTE:
-		 *	All these overrides are based on a fixed internal
-		 *	knowledge and understanding of existing adapters,
-		 *	acbsize should be set with caution.
-		 */
-		if (acbsize == 512) {
-			host->max_sectors = AAC_MAX_32BIT_SGBCOUNT;
-			dev->max_fib_size = 512;
-			dev->sg_tablesize = host->sg_tablesize
-			  = (512 - sizeof(struct aac_fibhdr)
-			    - sizeof(struct aac_write) + sizeof(struct sgentry))
-			     / sizeof(struct sgentry);
-			host->can_queue = AAC_NUM_IO_FIB;
-		} else if (acbsize == 2048) {
-			host->max_sectors = 512;
-			dev->max_fib_size = 2048;
-			host->sg_tablesize = 65;
-			dev->sg_tablesize = 81;
-			host->can_queue = 512 - AAC_NUM_MGT_FIB;
-		} else if (acbsize == 4096) {
-			host->max_sectors = 1024;
-			dev->max_fib_size = 4096;
-			host->sg_tablesize = 129;
-			dev->sg_tablesize = 166;
-			host->can_queue = 256 - AAC_NUM_MGT_FIB;
-		} else if (acbsize == 8192) {
-			host->max_sectors = 2048;
-			dev->max_fib_size = 8192;
-			host->sg_tablesize = 257;
-			dev->sg_tablesize = 337;
-			host->can_queue = 128 - AAC_NUM_MGT_FIB;
-		} else if (acbsize > 0) {
-			printk("Illegal acbsize=%d ignored\n", acbsize);
-		}
 	}
-	{
-
-		if (numacb > 0) {
-			if (numacb < host->can_queue)
-				host->can_queue = numacb;
-			else
-				printk("numacb=%d ignored\n", numacb);
-		}
+	if (numacb > 0) {
+		if (numacb < host->can_queue)
+			host->can_queue = numacb;
+		else
+			pr_warn("numacb=%d ignored\n", numacb);
 	}
 
-	if (host->can_queue > AAC_NUM_IO_FIB)
-		host->can_queue = AAC_NUM_IO_FIB;
-
 	if (dev->pdev->device == PMC_DEVICE_S6 ||
 	    dev->pdev->device == PMC_DEVICE_S7 ||
 	    dev->pdev->device == PMC_DEVICE_S8 ||
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 0f3de1e..1912e7b 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1285,7 +1285,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	else
 		shost->this_id = shost->max_id;
 
-	if (aac_drivers[index].quirks & AAC_QUIRK_SRC)
+	if (!aac->sa_firmware && aac_drivers[index].quirks & AAC_QUIRK_SRC)
 		aac_intr_normal(aac, 0, 2, 0, NULL);
 
 	/*
-- 
2.7.4


  parent reply	other threads:[~2017-01-28  3:43 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 19:28 [PATCH V3 00/24] aacraid: Patchset for Smart Family Support Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 01/24] aacraid: Remove duplicate irq management code Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 02/24] aacraid: Added aacraid.h include guard Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 03/24] aacraid: added support for init_struct_8 Raghava Aditya Renukunta
2017-01-30  9:15   ` Johannes Thumshirn
2017-01-27 19:28 ` Raghava Aditya Renukunta [this message]
2017-01-30  9:23   ` [PATCH V3 04/24] aacraid: Added sa firmware support Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 05/24] aacraid: Retrieve and update the device types Raghava Aditya Renukunta
2017-01-30  9:35   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 06/24] aacraid: Reworked scsi command submission path Raghava Aditya Renukunta
2017-01-30  9:38   ` Johannes Thumshirn
2017-01-30 20:17     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 07/24] aacraid: Process Error for response I/O Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 08/24] aacraid: Added support for response path Raghava Aditya Renukunta
2017-01-30  9:50   ` Johannes Thumshirn
2017-01-30 20:16     ` Raghava Aditya Renukunta
2017-01-31  8:02       ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 09/24] aacraid: Added support for read medium error Raghava Aditya Renukunta
2017-01-30  9:55   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 10/24] aacraid: Reworked aac_command_thread Raghava Aditya Renukunta
2017-01-30 10:11   ` Johannes Thumshirn
2017-01-30 20:11     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 11/24] aacraid: Added support for periodic wellness sync Raghava Aditya Renukunta
2017-01-30 10:27   ` Johannes Thumshirn
2017-01-30 20:07     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 12/24] aacraid: Retrieve Queue Depth from Adapter FW Raghava Aditya Renukunta
2017-01-30 10:31   ` Johannes Thumshirn
2017-01-30 20:05     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 13/24] aacraid: Added support to set QD of attached drives Raghava Aditya Renukunta
2017-01-30 10:39   ` Johannes Thumshirn
2017-01-30 20:01     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 14/24] aacraid: Added support for hotplug Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 15/24] aacraid: Include HBA direct interface Raghava Aditya Renukunta
2017-01-30 11:02   ` Johannes Thumshirn
2017-01-30 20:00     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 16/24] aacraid: Add task management functionality Raghava Aditya Renukunta
2017-01-30 11:19   ` Johannes Thumshirn
2017-01-30 19:59     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 17/24] aacraid: Added support to abort cmd and reset lun Raghava Aditya Renukunta
2017-01-30 11:24   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 18/24] aacraid: VPD 83 type3 support Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 19/24] aacraid: Added new IWBR reset Raghava Aditya Renukunta
2017-01-30 11:39   ` Johannes Thumshirn
2017-01-30 19:56     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 20/24] aacraid: Added ioctl to trigger IOP/IWBR reset Raghava Aditya Renukunta
2017-01-30 11:41   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 21/24] aacraid: Retrieve HBA host information ioctl Raghava Aditya Renukunta
2017-01-30 11:43   ` Johannes Thumshirn
2017-01-30 19:53     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 22/24] aacraid: Update copyrights Raghava Aditya Renukunta
2017-01-30 11:43   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 23/24] aacraid: Change Driver Version Prefix Raghava Aditya Renukunta
2017-01-30 11:44   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 24/24] aacraid: update version Raghava Aditya Renukunta
2017-01-30 11:44   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170127192853.10082-5-RaghavaAditya.Renukunta@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=David.Carroll@microsemi.com \
    --cc=Gana.Sridaran@microsemi.com \
    --cc=Scott.Benesh@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.