/*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2005 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
#include "qla_def.h"
#include <scsi/scsi_transport_fc.h>
/**
* IO descriptor handle definitions.
*
* Signature form:
*
* |31------28|27-------------------12|11-------0|
* | Type | Rolling Signature | Index |
* |----------|-----------------------|----------|
*
**/
#define HDL_TYPE_SCSI 0
#define HDL_TYPE_ASYNC_IOCB 0x0A
#define HDL_INDEX_BITS 12
#define HDL_ITER_BITS 16
#define HDL_TYPE_BITS 4
#define HDL_INDEX_MASK ((1UL << HDL_INDEX_BITS) - 1)
#define HDL_ITER_MASK ((1UL << HDL_ITER_BITS) - 1)
#define HDL_TYPE_MASK ((1UL << HDL_TYPE_BITS) - 1)
#define HDL_INDEX_SHIFT 0
#define HDL_ITER_SHIFT (HDL_INDEX_SHIFT + HDL_INDEX_BITS)
#define HDL_TYPE_SHIFT (HDL_ITER_SHIFT + HDL_ITER_BITS)
/* Local Prototypes. */
static inline uint32_t qla2x00_to_handle(uint16_t, uint16_t, uint16_t);
static inline uint16_t qla2x00_handle_to_idx(uint32_t);
static inline uint32_t qla2x00_iodesc_to_handle(struct io_descriptor *);
static inline struct io_descriptor *qla2x00_handle_to_iodesc(scsi_qla_host_t *,
uint32_t);
static inline struct io_descriptor *qla2x00_alloc_iodesc(scsi_qla_host_t *);
static inline void qla2x00_free_iodesc(struct io_descriptor *);
static inline void qla2x00_init_io_descriptors(scsi_qla_host_t *);
static void qla2x00_iodesc_timeout(unsigned long);
static inline void qla2x00_add_iodesc_timer(struct io_descriptor *);
static inline void qla2x00_remove_iodesc_timer(struct io_descriptor *);
static inline void qla2x00_update_login_fcport(scsi_qla_host_t *,
struct mbx_entry *, fc_port_t *);
static int qla2x00_send_abort_iocb(scsi_qla_host_t *, struct io_descriptor *,
uint32_t, int);
static int qla2x00_send_abort_iocb_cb(scsi_qla_host_t *,