/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright 2010 QLogic Corporation */
/*
*/
#ifndef _QL_API_H
#define _QL_API_H
/*
* ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
*
* ***********************************************************************
* * **
* * NOTICE **
* * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
* * ALL RIGHTS RESERVED **
* * **
* ***********************************************************************
*
*/
#ifdef __cplusplus
extern "C" {
#endif
/* OS include files. */
#include <sys/byteorder.h>
#include <ql_open.h>
#ifndef DDI_INTR_TYPE_FIXED
#endif
#ifndef DDI_INTR_TYPE_MSI
#endif
#ifndef DDI_INTR_TYPE_MSIX
#endif
#ifndef DDI_INTR_FLAG_BLOCK
#endif
#ifndef DDI_INTR_ALLOC_NORMAL
#define DDI_INTR_ALLOC_NORMAL 0
#endif
#ifndef DDI_INTR_ALLOC_STRICT
#endif
/*
* NPIV defines
*/
#ifndef FC_NPIV_FDISC_FAILED
#endif
#ifndef FC_NPIV_FDISC_WWN_INUSE
#endif
#ifndef FC_NPIV_NOT_SUPPORTED
#endif
#ifndef FC_NPIV_WRONG_TOPOLOGY
#endif
#ifndef FC_NPIV_NPIV_BOUND
#endif
extern int ddi_intr_get_supported_types();
extern int ddi_intr_get_nintrs();
extern int ddi_intr_alloc();
extern int ddi_intr_free();
extern int ddi_intr_get_pri();
extern int ddi_intr_add_handler();
extern int ddi_intr_dup_handler();
extern int ddi_intr_get_navail();
extern int ddi_intr_block_disable();
extern int ddi_intr_block_enable();
extern int ddi_intr_disable();
extern int ddi_intr_enable();
extern int ddi_intr_get_cap();
extern int ddi_intr_remove_handler();
#ifndef QL_DRV_HARDENING
#define ddi_devstate_t int
#define DDI_DEVSTATE_UP 0
#define ddi_dev_report_fault(a, b, c, d)
#define QL_CLEAR_DMA_HANDLE(x)
#else
((ddi_dma_impl_t *)x)->dmai_fault_check = 0; \
((ddi_dma_impl_t *)x)->dmai_fault = 0
#endif
#ifndef FC_STATE_1GBIT_SPEED
#endif
#ifndef FC_STATE_2GBIT_SPEED
#endif
#ifndef FC_STATE_4GBIT_SPEED
#endif
#ifndef FC_STATE_8GBIT_SPEED
#endif
#ifndef FC_STATE_10GBIT_SPEED
#endif
/*
* Data bit definitions.
*/
/*
* Local Macro Definitions.
*/
#ifndef TRUE
#endif
#ifndef FALSE
#endif
/*
* I/O register
*/
/*
* FCA definitions
*/
/* Following to be removed when defined by OS. */
/* ************************************************************************ */
typedef struct {
} ql_lpc_t;
typedef struct {
} ql_acc_rjt_t;
typedef struct {
typedef struct {
/* *********************************************************************** */
/*
* Fibre Channel device definitions.
*/
/*
* Fibre Channel 24xx device definitions.
*/
/* Loop ID's used as flags, must be higher than any valid Loop ID */
/* Fibre Channel Topoploy. */
/* Timeout timer counts in seconds (must greater than 1 second). */
#define LOOP_DOWN_TIMER_OFF 0
/* Maximum outstanding commands in ISP queues (1-4095) */
/* Maximum unsolicited buffers (1-65535) */
/* ISP request, response and receive buffer entry counts */
/*
* ISP request, response, mailbox and receive buffer queue sizes
*/
/*
* ISP DMA buffer definitions
*/
#define REQUEST_Q_BUFFER_OFFSET 0
/*
* DMA attributes definitions.
*/
#ifdef __sparc
#else
/*
* QL_FCIP_CMD_SGLLEN needs to be increased as we changed the max fcip packet
* size to about 64K. With this, we need to increase the maximum number of
* scatter-gather elements allowable from the existing 7. We want it to be more
* like 17 (max fragments for an fcip packet that is unaligned). (64K / 4K) + 1
* or whatever. Otherwise the DMA breakup routines will give bad results.
*/
#endif
#ifndef DDI_DMA_RELAXED_ORDERING
#endif
#define QL_DMA_XFER_FLAGS 0
typedef union {
} conv_num_t;
/*
* Device register offsets.
*/
typedef struct {
} reg_off_t;
/*
* Mbox-8 read maximum debounce count.
* Reading Mbox-8 could be debouncing, before getting stable value.
* This is the recommended driver fix from Qlogic along with firmware fix.
* During testing, maximum count did not cross 3.
*/
/*
* Control Status register definitions
*/
/*
* Control Status 24xx register definitions
*/
#define MWB_512_BYTES 0
/*
* Interrupt Control register definitions
*/
/*
* Interrupt Status register definitions
*/
/*
*/
/*
* NVRAM register definitions.
*/
#define NV_DESELECT 0
/*
*/
#define VPD_2400_FUNC0_ADDR 0
#define FLASH_2400_ERRLOG_START_ADDR_0 0
#define FLASH_2400_ERRLOG_START_ADDR_1 0
#define FLASH_2400_DESCRIPTOR_TABLE 0
#define FLASH_8021_DESCRIPTOR_TABLE 0
/*
* Flash Error Log Event Codes.
*/
/*
* RISC to Host Status register definitions.
*/
/*
* RISC to Host Status register status field definitions.
*/
/*
* HCCR commands.
*/
/* RISC pause. */
/*
* HCCR commands for 24xx and 25xx.
*/
/*
* ISP Initialization Control Blocks.
* Little endian except where noted.
*/
typedef struct ql_init_cb {
/*
* LSB BIT 0 = enable_hard_loop_id
* LSB BIT 1 = enable_fairness
* LSB BIT 2 = enable_full_duplex
* LSB BIT 3 = enable_fast_posting
* LSB BIT 4 = enable_target_mode
* LSB BIT 5 = disable_initiator_mode
* LSB BIT 6 = enable_adisc
* LSB BIT 7 = enable_target_inquiry_data
*
* MSB BIT 0 = enable_port_update_ae
* MSB BIT 1 = disable_initial_lip
* MSB BIT 2 = enable_decending_soft_assign
* MSB BIT 3 = previous_assigned_addressing
* MSB BIT 4 = enable_stop_q_on_full
* MSB BIT 5 = enable_full_login_on_lip
* MSB BIT 6 = enable_node_name
* MSB BIT 7 = extended_control_block
*/
/*
* LSB BIT 0 = Timer operation mode bit 0
* LSB BIT 1 = Timer operation mode bit 1
* LSB BIT 2 = Timer operation mode bit 2
* LSB BIT 3 = Timer operation mode bit 3
* LSB BIT 4 = P2P Connection option bit 0
* LSB BIT 5 = P2P Connection option bit 1
* LSB BIT 6 = P2P Connection option bit 2
* LSB BIT 7 = Enable Non part on LIHA failure
*
* MSB BIT 0 = Enable class 2
* MSB BIT 1 = Enable ACK0
* MSB BIT 2 =
* MSB BIT 3 =
* MSB BIT 4 = FC Tape Enable
* MSB BIT 5 = Enable FC Confirm
* MSB BIT 6 = Enable CRN
* MSB BIT 7 =
*/
/*
* LSB BIT 0 = Enable Read xfr_rdy
* LSB BIT 1 = Soft ID only
* LSB BIT 2 =
* LSB BIT 3 =
* LSB BIT 4 = FCP RSP Payload [0]
* LSB BIT 5 = FCP RSP Payload [1] / Sbus enable - 2200
* LSB BIT 6 =
* LSB BIT 7 =
*
* MSB BIT 0 = Sbus enable - 2300
* MSB BIT 1 =
* MSB BIT 2 =
* MSB BIT 3 =
* MSB BIT 4 =
* MSB BIT 5 = enable 50 ohm termination
* MSB BIT 6 = Data Rate (2300 only)
* MSB BIT 7 = Data Rate (2300 only)
*/
} ql_init_cb_t;
/*
* Virtual port definition.
*/
typedef struct ql_vp_cfg {
} ql_vp_cfg_t;
/*
* VP options.
*/
typedef struct ql_init_24xx_cb {
/*
* BIT 0 = Hard Assigned Loop ID
* BIT 1 = Enable Fairness
* BIT 2 = Enable Full-Duplex
* BIT 3 = Reserved
* BIT 4 = Target Mode Enable
* BIT 5 = Initiator Mode Disable
* BIT 6 = Reserved
* BIT 7 = Reserved
*
* BIT 8 = Reserved
* BIT 9 = Disable Initial LIP
* BIT 10 = Descending Loop ID Search
* BIT 11 = Previous Assigned Loop ID
* BIT 12 = Reserved
* BIT 13 = Full Login after LIP
* BIT 14 = Node Name Option
* BIT 15-31 = Reserved
*/
/*
* BIT 0 = Operation Mode bit 0
* BIT 1 = Operation Mode bit 1
* BIT 2 = Operation Mode bit 2
* BIT 3 = Operation Mode bit 3
* BIT 4 = Connection Options bit 0
* BIT 5 = Connection Options bit 1
* BIT 6 = Connection Options bit 2
* BIT 7 = Enable Non part on LIHA failure
*
* BIT 8 = Enable Class 2
* BIT 9 = Enable ACK0
* BIT 10 = Reserved
* BIT 11 = Enable FC-SP Security
* BIT 12 = FC Tape Enable
* BIT 13 = Reserved
* BIT 14 = Target PRLI Control
* BIT 15 = Reserved
*
* BIT 16 = Enable Emulated MSIX
* BIT 17 = Reserved
* BIT 18 = Enable Alternate Device Number
* BIT 19 = Enable Alternate Bus Number
* BIT 20 = Enable Translated Address
* BIT 21 = Enable VM Security
* BIT 22 = Enable Interrupt Handshake
* BIT 23 = Enable Multiple Queue
*
* BIT 24 = IOCB Security
* BIT 25 = qos
* BIT 26-31 = Reserved
*/
/*
* BIT 0 = Reserved
* BIT 1 = Soft ID only
* BIT 2 = Reserved
* BIT 3 = Reserved
* BIT 4 = FCP RSP Payload bit 0
* BIT 5 = FCP RSP Payload bit 1
* BIT 6 = Enable Rec Out-of-Order data frame handling
* BIT 7 = Disable Automatic PLOGI on Local Loop
*
* BIT 8 = Reserved
* BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative
* offset handling
* BIT 10 = Reserved
* BIT 11 = Reserved
* BIT 12 = Reserved
* BIT 13 = Data Rate bit 0
* BIT 14 = Data Rate bit 1
* BIT 15 = Data Rate bit 2
*
* BIT 16 = 75-ohm Termination Select
* BIT 17 = Enable Multiple FCFs
* BIT 18 = MAC Addressing Mode
* BIT 19 = MAC Addressing Mode
* BIT 20 = MAC Addressing Mode
* BIT 21 = Ethernet Data Rate
* BIT 22 = Ethernet Data Rate
* BIT 23 = Ethernet Data Rate
*
* BIT 24 = Ethernet Data Rate
* BIT 25 = Ethernet Data Rate
* BIT 26 = Enable Ethernet Header ATIO Queue
* BIT 27 = Enable Ethernet Header Response Queue
* BIT 28 = SPMA Selection
* BIT 29 = SPMA Selection
* BIT 30 = Reserved
* BIT 31 = Reserved
*/
/*
* Multi-ID firmware.
*/
/*
* BIT 1 = Allows mode 2 connection option
*/
/*
* Extended Initialization Control Block
*/
typedef union ql_comb_init_cb {
/*
* ISP IP Initialization Control Block.
* Little endian except where noted.
*/
typedef struct ql_ip_init_cb {
/*
* LSB BIT 0 = receive_buffer_address_length
* LSB BIT 1 = fast post broadcast received
* LSB BIT 2 = allow out of receive buffers AE
*/
typedef struct ql_ip_init_24xx_cb {
/*
* LSB BIT 2 = allow out of receive buffers AE
*/
typedef union ql_comb_ip_init_cb {
/*
* f/w module table
*/
struct fw_table {
};
/*
* aif function table
*/
typedef struct ql_ifunc {
} ql_ifunc_t;
/*
* DMA memory type.
*/
typedef enum mem_alloc_type {
/*
* DMA memory alignment type.
*/
typedef enum men_align_type {
/*
* DMA memory object.
*/
typedef struct dma_mem {
void *bp;
} dma_mem_t;
/*
* dma_mem_t memflags defines
*/
/*
* 24 bit port ID type definition.
*/
typedef union {
struct {
}r;
#if defined(_BIT_FIELDS_LTOH)
struct {
}b;
#elif defined(_BIT_FIELDS_HTOL)
struct {
}b;
#else
#endif
} port_id_t;
/*
* Link list definitions.
*/
typedef struct ql_link {
void *base_address;
} ql_link_t;
typedef struct ql_head {
} ql_head_t;
/*
* This is the per-command structure
*/
typedef struct ql_srb {
/* Command link. */
/* Watchdog link and timer. */
/* FCA and FC Transport data. */
/* unsolicited buffer context. */
/* FCP command. */
/* Request sense. */
/* Device queue pointer. */
/* Command IOCB context. */
struct ql_srb *, void *);
} ql_srb_t;
/*
* This byte will be used to define flags for the LUN on the target.
* Presently, we have untagged-command as one flag. Others can be
* added later, if needed.
*/
typedef struct tgt_lun_flags {
/*
* Fibre Channel LUN Queue structure
*/
typedef struct ql_lun {
/* Head command link. */
/* LUN execution throttle. */
} ql_lun_t;
/*
* LUN Queue flags
*/
/*
* Fibre Channel Device Queue structure
*/
typedef struct ql_target {
/* Device queue lock. */
/* Head target command link. */
/* Device link. */
/* Head watchdog link. */
/* Unsolicited buffer IP data. */
/* Port down retry counter. */
/* logout sent state */
/* Data from Port database matches machine type. */
/* LUN context. */
} ql_tgt_t;
/*
* Target Queue flags
*/
/*
* Tempoary N_Port information
*/
typedef struct ql_n_port_info {
/*
* iiDMA
*/
/*
* Kernel statistic structure definitions.
*/
typedef struct ql_device_stat {
int logouts_recvd;
int task_mgmt_failures;
int data_ro_mismatches;
int dl_len_mismatches;
typedef struct ql_adapter_24xx_stat {
/*
* Firmware code segment.
*/
typedef struct fw_code {
} ql_fw_code_t;
/* diagnostic els ECHO defines */
/* DUMP state flags. */
typedef struct el_trace_desc {
char *trace_buffer;
/*
* NVRAM cache descriptor.
*/
typedef struct nvram_cache_desc {
void *cache;
/*
* ql attach progress indication
*/
/* Device queue head list size (based on AL_PA address). */
struct legacy_intr_set {
};
/*
* Adapter state structure.
*/
typedef struct ql_adapter_state {
/* Task Daemon context. */
/* Interrupt context. */
/*
* ISP request queue, response queue, mailbox buffer and
* IP receive queue buffer.
*/
/* ISP request queue context. */
/* ISP response queue context. */
/* Mailbox context. */
/* ISP receive buffer queue context. */
/* Unsolicited buffer data. */
/* Head of device queue list. */
/* Kernel statistics. */
/* Solaris adapter configuration data */
/* Adapter context */
ql_srb_t *, void *);
ql_srb_t *, void *);
ql_srb_t *, void *);
/* NVRAM configuration data */
/* Power management context. */
/* sbus card data */
/* XIOCTL context pointer. */
/* AIF (Advanced Interrupt Framework) support */
/* PCI maximum read request override */
/* port manage mutex */
/* f/w dump mutex */
void *ql_dump_ptr;
/* Virtual port context. */
/* Tempoary N_Port information */
ql_srb_t *, void *);
/* VLAN ID and MAC address */
/* NetXen context */
/*
* adapter state flags
*/
/*
* task daemon flags
*/
/*
* Mailbox flags
*/
/*
* Configuration flags
*/
/*
* Interrupt configuration flags
*/
/*
* Macros to help code, maintain, etc.
*/
/* Little endian machine correction defines. */
#ifdef _LITTLE_ENDIAN
#define LITTLE_ENDIAN_16(x)
#define LITTLE_ENDIAN_24(x)
#define LITTLE_ENDIAN_32(x)
#define LITTLE_ENDIAN_64(x)
#endif /* _LITTLE_ENDIAN */
/* Big endian machine correction defines. */
#ifdef _BIG_ENDIAN
#define BIG_ENDIAN_16(x)
#define BIG_ENDIAN_24(x)
#define BIG_ENDIAN_32(x)
#define BIG_ENDIAN_64(x)
#endif /* _BIG_ENDIAN */
x <= SNS_LAST_LOOP_ID)
FABRIC_LOOP_ID(x) || BROADCAST_LOOP_ID(x))
(x >= SNS_24XX_HDL && x <= BROADCAST_24XX_HDL))
VALID_N_PORT_HDL(x) : VALID_LOOP_ID(x))
(x > LAST_N_PORT_HDL && x <= FL_PORT_24XX_HDL) : \
(x >= FL_PORT_LOOP_ID && x <= SIMPLE_NAME_SERVER_LOOP_ID))
/*
* Locking Macro Definitions
*/
/*
*/
/*
* ql component
*/
#define QL_POWER_COMPONENT 0
typedef struct ql_config_space {
#ifdef USE_DDI_INTERFACES
#else /* USE_DDI_INTERFACES */
#endif /* USE_DDI_INTERFACES */
#define QL_IS_SET(x, y) (((x) & (y)) == (y))
/*
* QL local function return status codes
*/
/*
* SBus card FPGA register offsets.
*/
#define QL_FCODE_OFFSET 0
/*
* Structure used to associate cmds with strings which describe them.
*/
typedef struct cmd_table_entry {
char *string;
} cmd_table_t;
/*
* ELS command table initializer
*/
#define ELS_CMD_TABLE() \
{ \
{LA_ELS_RJT, "LA_ELS_RJT"}, \
{LA_ELS_ACC, "LA_ELS_ACC"}, \
{LA_ELS_PLOGI, "LA_ELS_PLOGI"}, \
{LA_ELS_PDISC, "LA_ELS_PDISC"}, \
{LA_ELS_FLOGI, "LA_ELS_FLOGI"}, \
{LA_ELS_FDISC, "LA_ELS_FDISC"}, \
{LA_ELS_LOGO, "LA_ELS_LOGO"}, \
{LA_ELS_PRLI, "LA_ELS_PRLI"}, \
{LA_ELS_PRLO, "LA_ELS_PRLO"}, \
{LA_ELS_ADISC, "LA_ELS_ADISC"}, \
{LA_ELS_LINIT, "LA_ELS_LINIT"}, \
{LA_ELS_LPC, "LA_ELS_LPC"}, \
{LA_ELS_LSTS, "LA_ELS_LSTS"}, \
{LA_ELS_SCR, "LA_ELS_SCR"}, \
{LA_ELS_RSCN, "LA_ELS_RSCN"}, \
{LA_ELS_FARP_REQ, "LA_ELS_FARP_REQ"}, \
{LA_ELS_FARP_REPLY, "LA_ELS_FARP_REPLY"}, \
{LA_ELS_RLS, "LA_ELS_RLS"}, \
{LA_ELS_RNID, "LA_ELS_RNID"}, \
}
/*
* ELS Passthru IOCB data segment descriptor.
*/
typedef struct data_seg_desc {
/*
* ELS descriptor used to abstract the hosts fibre channel packet
* from the ISP ELS code.
*/
typedef struct els_desc {
typedef struct prli_svc_pram_resp_page {
/*
* PRLI accept Service Parameter Page Word 3
*/
typedef struct prli_acc_resp {
/*
* Global Data in ql_api.c source file.
*/
extern void *ql_state; /* for soft state routine */
extern uint32_t ql_os_release_level;
extern kmutex_t ql_global_mutex;
extern kmutex_t ql_global_hw_mutex;
extern kmutex_t ql_global_el_mutex;
extern uint8_t ql_ip_fast_post_count;
extern uint32_t ql_ip_buffer_count;
extern uint32_t ql_ip_low_water;
extern uint8_t ql_alpa_to_index[];
extern uint32_t ql_gfru_hba_index;
extern uint32_t ql_enable_ets;
extern uint16_t ql_osc_wait_count;
/*
* Global Function Prototypes in ql_api.c source file.
*/
void ql_setup_fruinfo(ql_adapter_state_t *);
uint32_t);
int ql_binary_fw_dump(ql_adapter_state_t *, int);
int ql_24xx_flash_id(ql_adapter_state_t *);
void ql_flash_disable(ql_adapter_state_t *);
void ql_flash_enable(ql_adapter_state_t *);
int ql_erase_flash(ql_adapter_state_t *, int);
void ql_cmd_wait(ql_adapter_state_t *);
void ql_loop_online(ql_adapter_state_t *);
void ql_restart_driver(ql_adapter_state_t *);
void ql_24xx_protect_flash(ql_adapter_state_t *);
char *els_cmd_text(int);
char *mbx_cmd_text(int);
char *cmd_text(cmd_table_t *, int);
#ifdef __cplusplus
}
#endif
#endif /* _QL_API_H */