]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/qla2xxx/qla_def.h
[SCSI] qla2xxx: Drop noisy 'UNDERRUN' status message.
[linux-2.6-omap-h63xx.git] / drivers / scsi / qla2xxx / qla_def.h
index 1c6d366f4fad8e716bd2c464bdfc197768497c3a..79d8a914f9d0f4ddb213fd1bd9d5b63f68c39138 100644 (file)
@@ -1,22 +1,9 @@
-/********************************************************************************
-*                  QLOGIC LINUX SOFTWARE
-*
-* QLogic ISP2x00 device driver for Linux 2.6.x
-* Copyright (C) 2003-2005 QLogic Corporation
-* (www.qlogic.com)
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2, or (at your option) any
-* later version.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-**
-******************************************************************************/
-
+/*
+ * QLogic Fibre Channel HBA Driver
+ * Copyright (c)  2003-2005 QLogic Corporation
+ *
+ * See LICENSE.qla2xxx for copyright and licensing details.
+ */
 #ifndef __QLA_DEF_H
 #define __QLA_DEF_H
 
@@ -34,6 +21,8 @@
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/interrupt.h>
+#include <linux/workqueue.h>
+#include <linux/firmware.h>
 #include <asm/semaphore.h>
 
 #include <scsi/scsi.h>
@@ -41,6 +30,7 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_cmnd.h>
 
+#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE)
 #if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE)
 #define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100)
 #else
 #define IS_QLA2522(ha) 0
 #endif
 
+#else  /* !defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) */
+
+#define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100)
+#define IS_QLA2200(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2200)
+#define IS_QLA2300(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300)
+#define IS_QLA2312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312)
+#define IS_QLA2322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322)
+#define IS_QLA6312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312)
+#define IS_QLA6322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6322)
+#define IS_QLA2422(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422)
+#define IS_QLA2432(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432)
+#define IS_QLA2512(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2512)
+#define IS_QLA2522(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2522)
+#endif
+
 #define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
                         IS_QLA6312(ha) || IS_QLA6322(ha))
-
 #define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
 #define IS_QLA25XX(ha) (IS_QLA2512(ha) || IS_QLA2522(ha))
 
  * valid range of an N-PORT id is 0 through 0x7ef.
  */
 #define NPH_LAST_HANDLE                0x7ef
+#define NPH_MGMT_SERVER                0x7fa           /*  FFFFFA */
 #define NPH_SNS                        0x7fc           /*  FFFFFC */
 #define NPH_FABRIC_CONTROLLER  0x7fd           /*  FFFFFD */
 #define NPH_F_PORT             0x7fe           /*  FFFFFE */
@@ -630,6 +635,7 @@ typedef struct {
 #define MBC_WRITE_RAM_WORD_EXTENDED    0xd     /* Write RAM word extended */
 #define MBC_READ_RAM_EXTENDED          0xf     /* Read RAM extended. */
 #define MBC_IOCB_COMMAND               0x12    /* Execute IOCB command. */
+#define MBC_STOP_FIRMWARE              0x14    /* Stop firmware. */
 #define MBC_ABORT_COMMAND              0x15    /* Abort IOCB command. */
 #define MBC_ABORT_DEVICE               0x16    /* Abort device (ID/LUN). */
 #define MBC_ABORT_TARGET               0x17    /* Abort target (ID). */
@@ -821,6 +827,11 @@ typedef struct {
 #define PD_STATE_WAIT_PORT_LOGOUT_ACK          11
 
 
+#define QLA_ZIO_MODE_5         (BIT_2 | BIT_0)
+#define QLA_ZIO_MODE_6         (BIT_2 | BIT_1)
+#define QLA_ZIO_DISABLED       0
+#define QLA_ZIO_DEFAULT_TIMER  2
+
 /*
  * ISP Initialization Control Block.
  * Little endian except where noted.
@@ -913,7 +924,7 @@ typedef struct {
         * MSB BIT 1 =
         * MSB BIT 2 =
         * MSB BIT 3 =
-        * MSB BIT 4 =
+        * MSB BIT 4 = LED mode
         * MSB BIT 5 = enable 50 ohm termination
         * MSB BIT 6 = Data Rate (2300 only)
         * MSB BIT 7 = Data Rate (2300 only)
@@ -1035,7 +1046,7 @@ typedef struct {
         * MSB BIT 1 =
         * MSB BIT 2 =
         * MSB BIT 3 =
-        * MSB BIT 4 =
+        * MSB BIT 4 = LED mode
         * MSB BIT 5 = enable 50 ohm termination
         * MSB BIT 6 = Data Rate (2300 only)
         * MSB BIT 7 = Data Rate (2300 only)
@@ -1131,10 +1142,7 @@ typedef struct {
 
        uint8_t link_down_timeout;
 
-       uint8_t adapter_id_0[4];
-       uint8_t adapter_id_1[4];
-       uint8_t adapter_id_2[4];
-       uint8_t adapter_id_3[4];
+       uint8_t adapter_id[16];
 
        uint8_t alt1_boot_node_name[WWN_SIZE];
        uint16_t alt1_boot_lun_number;
@@ -1673,6 +1681,9 @@ typedef struct fc_port {
        uint8_t cur_path;               /* current path id */
 
        struct fc_rport *rport;
+       u32 supported_classes;
+       struct work_struct rport_add_work;
+       struct work_struct rport_del_work;
 } fc_port_t;
 
 /*
@@ -1727,6 +1738,8 @@ typedef struct fc_port {
 
 #define CT_REJECT_RESPONSE     0x8001
 #define CT_ACCEPT_RESPONSE     0x8002
+#define CT_REASON_CANNOT_PERFORM       0x09
+#define CT_EXPL_ALREADY_REGISTERED     0x10
 
 #define NS_N_PORT_TYPE 0x01
 #define NS_NL_PORT_TYPE        0x02
@@ -1768,6 +1781,100 @@ typedef struct fc_port {
 #define        RSNN_NN_REQ_SIZE (16 + 8 + 1 + 255)
 #define        RSNN_NN_RSP_SIZE 16
 
+/*
+ * HBA attribute types.
+ */
+#define FDMI_HBA_ATTR_COUNT                    9
+#define FDMI_HBA_NODE_NAME                     1
+#define FDMI_HBA_MANUFACTURER                  2
+#define FDMI_HBA_SERIAL_NUMBER                 3
+#define FDMI_HBA_MODEL                         4
+#define FDMI_HBA_MODEL_DESCRIPTION             5
+#define FDMI_HBA_HARDWARE_VERSION              6
+#define FDMI_HBA_DRIVER_VERSION                        7
+#define FDMI_HBA_OPTION_ROM_VERSION            8
+#define FDMI_HBA_FIRMWARE_VERSION              9
+#define FDMI_HBA_OS_NAME_AND_VERSION           0xa
+#define FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH     0xb
+
+struct ct_fdmi_hba_attr {
+       uint16_t type;
+       uint16_t len;
+       union {
+               uint8_t node_name[WWN_SIZE];
+               uint8_t manufacturer[32];
+               uint8_t serial_num[8];
+               uint8_t model[16];
+               uint8_t model_desc[80];
+               uint8_t hw_version[16];
+               uint8_t driver_version[32];
+               uint8_t orom_version[16];
+               uint8_t fw_version[16];
+               uint8_t os_version[128];
+               uint8_t max_ct_len[4];
+       } a;
+};
+
+struct ct_fdmi_hba_attributes {
+       uint32_t count;
+       struct ct_fdmi_hba_attr entry[FDMI_HBA_ATTR_COUNT];
+};
+
+/*
+ * Port attribute types.
+ */
+#define FDMI_PORT_ATTR_COUNT           5
+#define FDMI_PORT_FC4_TYPES            1
+#define FDMI_PORT_SUPPORT_SPEED                2
+#define FDMI_PORT_CURRENT_SPEED                3
+#define FDMI_PORT_MAX_FRAME_SIZE       4
+#define FDMI_PORT_OS_DEVICE_NAME       5
+#define FDMI_PORT_HOST_NAME            6
+
+struct ct_fdmi_port_attr {
+       uint16_t type;
+       uint16_t len;
+       union {
+               uint8_t fc4_types[32];
+               uint32_t sup_speed;
+               uint32_t cur_speed;
+               uint32_t max_frame_size;
+               uint8_t os_dev_name[32];
+               uint8_t host_name[32];
+       } a;
+};
+
+/*
+ * Port Attribute Block.
+ */
+struct ct_fdmi_port_attributes {
+       uint32_t count;
+       struct ct_fdmi_port_attr entry[FDMI_PORT_ATTR_COUNT];
+};
+
+/* FDMI definitions. */
+#define GRHL_CMD       0x100
+#define GHAT_CMD       0x101
+#define GRPL_CMD       0x102
+#define GPAT_CMD       0x110
+
+#define RHBA_CMD       0x200
+#define RHBA_RSP_SIZE  16
+
+#define RHAT_CMD       0x201
+#define RPRT_CMD       0x210
+
+#define RPA_CMD                0x211
+#define RPA_RSP_SIZE   16
+
+#define DHBA_CMD       0x300
+#define DHBA_REQ_SIZE  (16 + 8)
+#define DHBA_RSP_SIZE  16
+
+#define DHAT_CMD       0x301
+#define DPRT_CMD       0x310
+#define DPA_CMD                0x311
+
 /* CT command header -- request/response common fields */
 struct ct_cmd_hdr {
        uint8_t revision;
@@ -1825,6 +1932,43 @@ struct ct_sns_req {
                        uint8_t name_len;
                        uint8_t sym_node_name[255];
                } rsnn_nn;
+
+               struct {
+                       uint8_t hba_indentifier[8];
+               } ghat;
+
+               struct {
+                       uint8_t hba_identifier[8];
+                       uint32_t entry_count;
+                       uint8_t port_name[8];
+                       struct ct_fdmi_hba_attributes attrs;
+               } rhba;
+
+               struct {
+                       uint8_t hba_identifier[8];
+                       struct ct_fdmi_hba_attributes attrs;
+               } rhat;
+
+               struct {
+                       uint8_t port_name[8];
+                       struct ct_fdmi_port_attributes attrs;
+               } rpa;
+
+               struct {
+                       uint8_t port_name[8];
+               } dhba;
+
+               struct {
+                       uint8_t port_name[8];
+               } dhat;
+
+               struct {
+                       uint8_t port_name[8];
+               } dprt;
+
+               struct {
+                       uint8_t port_name[8];
+               } dpa;
        } req;
 };
 
@@ -1882,6 +2026,12 @@ struct ct_sns_rsp {
                struct {
                        uint8_t fc4_types[32];
                } gft_id;
+
+               struct {
+                       uint32_t entry_count;
+                       uint8_t port_name[8];
+                       struct ct_fdmi_hba_attributes attrs;
+               } ghat;
        } rsp;
 };
 
@@ -1990,6 +2140,12 @@ struct qla_board_info {
        struct scsi_host_template *sht;
 };
 
+struct fw_blob {
+       char *name;
+       uint32_t segs[4];
+       const struct firmware *fw;
+};
+
 /* Return data from MBC_GET_ID_LIST call. */
 struct gid_list_info {
        uint8_t al_pa;
@@ -2032,6 +2188,8 @@ struct isp_operations {
        uint16_t (*calc_req_entries) (uint16_t);
        void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t);
        void * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t, uint32_t);
+       void * (*prep_ms_fdmi_iocb) (struct scsi_qla_host *, uint32_t,
+           uint32_t);
 
        uint8_t * (*read_nvram) (struct scsi_qla_host *, uint8_t *,
                uint32_t, uint32_t);
@@ -2111,6 +2269,7 @@ typedef struct scsi_qla_host {
 #define IOCTL_ERROR_RECOVERY   23
 #define LOOP_RESET_NEEDED      24
 #define BEACON_BLINK_NEEDED    25
+#define REGISTER_FDMI_NEEDED   26
 
        uint32_t        device_flags;
 #define DFLG_LOCAL_DEVICES             BIT_0
@@ -2204,6 +2363,7 @@ typedef struct scsi_qla_host {
        int             port_down_retry_count;
        uint8_t         mbx_count;
        uint16_t        last_loop_id;
+       uint16_t        mgmt_svr_loop_id;
 
         uint32_t       login_retry_count;
 
@@ -2318,6 +2478,7 @@ typedef struct scsi_qla_host {
        uint8_t         model_number[16+1];
 #define BINZERO                "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
        char            *model_desc;
+       uint8_t         adapter_id[16+1];
 
        uint8_t         *node_name;
        uint8_t         *port_name;
@@ -2326,6 +2487,9 @@ typedef struct scsi_qla_host {
        /* Needed for BEACON */
        uint16_t        beacon_blink_led;
        uint16_t        beacon_green_on;
+
+       uint16_t        zio_mode;
+       uint16_t        zio_timer;
 } scsi_qla_host_t;
 
 
@@ -2334,17 +2498,9 @@ typedef struct scsi_qla_host {
  */
 #define LOOP_TRANSITION(ha) \
        (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
-        test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
-
-#define LOOP_NOT_READY(ha) \
-       ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
-         test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
-         test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
-         test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
+        test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
         atomic_read(&ha->loop_state) == LOOP_DOWN)
 
-#define LOOP_RDY(ha)   (!LOOP_NOT_READY(ha))
-
 #define TGT_Q(ha, t) (ha->otgt[t])
 
 #define to_qla_host(x)         ((scsi_qla_host_t *) (x)->hostdata)
@@ -2377,6 +2533,7 @@ typedef struct scsi_qla_host {
 #define QLA_SUSPENDED                  0x106
 #define QLA_BUSY                       0x107
 #define QLA_RSCNS_HANDLED              0x108
+#define QLA_ALREADY_REGISTERED         0x109
 
 /*
 * Stat info for all adpaters