[PATCH v4 2/9] snic:Add interrupt, resource firmware interfaces

2015-04-09 Thread Narsimhulu Musini
snic_fwint.h contains firmware interface structures.

snic_res.h contains firmware request initialization

snic_res.c contains retrieval of resource configuration, and allocation,
and initialization of HW Queues.

snic_isr.c contains interrupt request, release, and handling

Signed-off-by: Narsimhulu Musini 
Signed-off-by: Sesidhar Baddela 
---
* v4
- Updated comment on future changes when hardware supports multiple queues.

* v3
- Cleaned up unused structure definitions and functions.

 drivers/scsi/snic/snic_fwint.h | 525 +
 drivers/scsi/snic/snic_isr.c   | 209 
 drivers/scsi/snic/snic_res.c   | 297 +++
 drivers/scsi/snic/snic_res.h   |  96 
 4 files changed, 1127 insertions(+)
 create mode 100644 drivers/scsi/snic/snic_fwint.h
 create mode 100644 drivers/scsi/snic/snic_isr.c
 create mode 100644 drivers/scsi/snic/snic_res.c
 create mode 100644 drivers/scsi/snic/snic_res.h

diff --git a/drivers/scsi/snic/snic_fwint.h b/drivers/scsi/snic/snic_fwint.h
new file mode 100644
index 000..1142e52
--- /dev/null
+++ b/drivers/scsi/snic/snic_fwint.h
@@ -0,0 +1,525 @@
+/*
+ * Copyright 2014 Cisco Systems, Inc.  All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __SNIC_FWINT_H
+#define __SNIC_FWINT_H
+
+#define SNIC_CDB_LEN   32  /* SCSI CDB size 32, can be used for 16 bytes */
+#define LUN_ADDR_LEN   8
+
+/*
+ * Command entry type
+ */
+enum snic_io_type {
+   /*
+* Initiator request types
+*/
+   SNIC_REQ_REPORT_TGTS = 0x2, /* Report Targets */
+   SNIC_REQ_ICMND, /* Initiator command for SCSI IO */
+   SNIC_REQ_ITMF,  /* Initiator command for Task Mgmt */
+   SNIC_REQ_HBA_RESET, /* SNIC Reset */
+   SNIC_REQ_EXCH_VER,  /* Exchange Version Information */
+   SNIC_REQ_TGT_INFO,  /* Backend/Target Information */
+   SNIC_REQ_BOOT_LUNS,
+
+   /*
+* Response type
+*/
+   SNIC_RSP_REPORT_TGTS_CMPL = 0x12,/* Report Targets Completion */
+   SNIC_RSP_ICMND_CMPL,/* SCSI IO Completion */
+   SNIC_RSP_ITMF_CMPL, /* Task Management Completion */
+   SNIC_RSP_HBA_RESET_CMPL,/* SNIC Reset Completion */
+   SNIC_RSP_EXCH_VER_CMPL, /* Exchange Version Completion*/
+   SNIC_RSP_BOOT_LUNS_CMPL,
+
+   /*
+* Misc Request types
+*/
+   SNIC_MSG_ACK = 0x80,/* Ack: snic_notify_msg */
+   SNIC_MSG_ASYNC_EVNOTIFY,/* Asynchronous Event Notification */
+}; /* end of enum snic_io_type */
+
+
+/*
+ * Header status codes from firmware
+ */
+enum snic_io_status {
+   SNIC_STAT_IO_SUCCESS = 0,   /* request was successful */
+
+   /*
+* If a request to the fw is rejected, the original request header
+* will be returned with the status set to one of the following:
+*/
+   SNIC_STAT_INVALID_HDR,  /* header contains invalid data */
+   SNIC_STAT_OUT_OF_RES,   /* out of resources to complete request */
+   SNIC_STAT_INVALID_PARM, /* some parameter in request is not valid */
+   SNIC_STAT_REQ_NOT_SUP,  /* req type is not supported */
+   SNIC_STAT_IO_NOT_FOUND, /* requested IO was not found */
+
+   /*
+* Once a request is processed, the fw will usually return
+* a cmpl message type. In cases where errors occurred,
+* the header status would be filled in with one of the following:
+*/
+   SNIC_STAT_ABORTED,  /* req was aborted */
+   SNIC_STAT_TIMEOUT,  /* req was timed out */
+   SNIC_STAT_SGL_INVALID,  /* req was aborted due to sgl error */
+   SNIC_STAT_DATA_CNT_MISMATCH,/*recv/sent more/less data than expec */
+   SNIC_STAT_FW_ERR,   /* req was terminated due to fw error */
+   SNIC_STAT_ITMF_REJECT,  /* itmf req was rejected by target */
+   SNIC_STAT_ITMF_FAIL,/* itmf req was failed */
+   SNIC_STAT_ITMF_INCORRECT_LUN,   /* itmf req has incorrect LUN id*/
+   SNIC_STAT_CMND_REJECT,  /* req was invalid and rejected */
+   SNIC_STAT_DEV_OFFLINE,  /* req sent to offline device */
+   SNIC_STAT_NO_BOOTLUN,
+   SNI

Re: [PATCH v4 2/9] snic:Add interrupt, resource firmware interfaces

2015-04-09 Thread Hannes Reinecke
On 04/09/2015 01:49 PM, Narsimhulu Musini wrote:
> snic_fwint.h contains firmware interface structures.
> 
> snic_res.h contains firmware request initialization
> 
> snic_res.c contains retrieval of resource configuration, and allocation,
> and initialization of HW Queues.
> 
> snic_isr.c contains interrupt request, release, and handling
> 
> Signed-off-by: Narsimhulu Musini 
> Signed-off-by: Sesidhar Baddela 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html