/*
* 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 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
*/
/*
* Copyright (c) 2000 to 2010, LSI Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms of all code within
* this file that is exclusively owned by LSI, with or without
* modification, is permitted provided that, in addition to the CDDL 1.0
* License requirements, the following conditions are met:
*
* Neither the name of the author nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#ifndef _SYS_SCSI_ADAPTERS_MPTVAR_H
#define _SYS_SCSI_ADAPTERS_MPTVAR_H
#include <sys/byteorder.h>
#include <sys/isa_defs.h>
#include <sys/mdi_impldefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Compile options
*/
#ifdef DEBUG
#endif /* DEBUG */
/*
* Note below macro definition and data type definition
* are used for phy mask handling, it should be changed
* simultaneously.
*/
/*
* targets. There's no need to go overboard here, as the ordinary paths for
* I/O do not normally require hashed target lookups. These should be good
* enough and then some for any fabric within the hardware's capabilities.
*/
/*
* MPT HW defines
*/
/*
* 64-bit SAS WWN is displayed as 16 characters as HEX characters,
* plus two means the prefix 'w' and end of the string '\0'.
*/
/*
* DMA routine flags
*/
/*
* If the HBA supports DMA or bus-mastering, you may have your own
* scatter-gather list for physically non-contiguous memory in one
* I/O operation; if so, there's probably a size for that list.
* It must be placed in the ddi_dma_lim_t structure, so that the system
* DMA-support routines can use it to break up the I/O request, so we
* define it here.
*/
#if defined(__sparc)
#else
#endif
sizeof (MPI2_SGE_SIMPLE64))
/*
* Calculating how many 64-bit DMA simple elements can be stored in the first
* frame. Note that msg_scsi_io_request contains 2 double-words (8 bytes) for
* element storage. And 64-bit dma element is 3 double-words (12 bytes) in
* size. IEEE 64-bit dma element used for SAS3 controllers is 4 double-words
* (16 bytes).
*/
((mpt->m_req_frame_size - \
sizeof (MPI2_SCSI_IO_REQUEST) + sizeof (MPI2_SGE_IO_UNION)) / \
/*
* Scatter-gather list structure defined by HBA hardware
*/
union {
struct {
} addr;
} mptti_t;
/*
* preferred pkt_private length in 64-bit quantities
*/
#ifdef _LP64
#else /* _ILP32 */
#endif
/*
* get offset of item in structure
*/
/*
* WWID provided by LSI firmware is generated by firmware but the WWID is not
* IEEE NAA standard format, OBP has no chance to distinguish format of unit
* address. According LSI's confirmation, the top nibble of RAID WWID is
* meanless, so the consensus between Solaris and OBP is to replace top nibble
* of WWID provided by LSI to "3" always to hint OBP that this is a RAID WWID
* format unit address.
*/
typedef struct mptsas_target_addr {
typedef struct mptsas_target {
/*
* If you change this structure, be sure that mptsas_smp_target_copy()
* does the right thing.
*/
typedef struct mptsas_smp {
} mptsas_smp_t;
typedef struct mptsas_cache_frames {
typedef struct mptsas_cmd {
int cmd_pkt_flags;
/* pending expiration time for command in active slot */
} mptsas_cmd_t;
/*
* These are the defined cmd_flags for this structure.
*/
/*
* hash table definition
*/
typedef struct mptsas_dma_alloc_state
{
/*
* passthrough request structure
*/
typedef struct mptsas_pt_request {
/*
* config page request structure
*/
typedef struct mptsas_config_request {
typedef struct mptsas_fw_diagnostic_buffer {
/*
* FW diag request structure
*/
typedef struct mptsas_diag_request {
typedef struct mptsas_hash_node {
void *data;
typedef struct mptsas_hash_table {
/*
* last position in traverse
*/
/*
* RAID volume information
*/
typedef struct mptsas_raidvol {
int m_raidlevel;
int m_ndisks;
/*
* RAID configurations
*/
typedef struct mptsas_raidconfig {
/*
* Track outstanding commands. The index into the m_slot array is the SMID
* (system message ID) of the outstanding command. SMID 0 is reserved by the
* as such, the assertion m_slot[0] == NULL is universally true. The last
* entry in the array is slot number MPTSAS_TM_SLOT(mpt) and is used ONLY for
* task management commands. No normal SCSI or ATA command will ever occupy
* that slot. Finally, the relationship m_slot[X]->cmd_slot == X holds at any
* time that a consistent view of the target array is obtainable.
*
* As such, m_n_normal is the maximum number of slots available to ordinary
* commands, and the relationship:
* mpt->m_active->m_n_normal == mpt->m_max_requests - 2
* always holds after initialisation.
*/
typedef struct mptsas_slots {
/*
* Structure to hold command and packets for event ack
* and task management commands.
*/
typedef struct m_event_struct {
/*
* event member record the failure event and eventcntx
* event member would be used in send ack pending process
*/
/* ... scsi_pkt_size() */
sizeof (struct scsi_pkt) + scsi_pkt_size())
/*
* A pool of MAX_IOC_COMMANDS is maintained for event ack commands.
* A new event ack command requests mptsas_cmd and scsi_pkt structures
* from this pool, and returns it back when done.
*/
typedef struct m_replyh_arg {
void *mpt;
/*
* Flags for DR handler topology change
*/
typedef struct mptsas_topo_change_list {
void *mpt;
union {
} un;
void *object;
/*
* Status types when calling mptsas_get_target_device_info
*/
/*
* mpt hotplug event defines
*/
/*
* SMP target hotplug events
*/
/*
* mpt hotplug status definition for m_dr_flag
*/
/*
* MPTSAS_DR_INACTIVE
*
* The target is in a normal operating state.
* No dynamic reconfiguration operation is in progress.
*/
/*
* MPTSAS_DR_INTRANSITION
*
* The target is in a transition mode since
* hotplug event happens and offline procedure has not
* been finished
*/
typedef struct mptsas_tgt_private {
int t_lun;
/*
* The following defines are used in mptsas_set_init_mode to track the current
* state as we progress through reprogramming the HBA from target mode into
* initiator mode.
*/
/*
* Last allocated slot is used for TM requests. Since only m_max_requests
* frames are allocated, the last SMID will be m_max_requests - 1.
*/
(sizeof (struct mptsas_slots) + (sizeof (struct mptsas_cmd *) * \
/*
* Macro for phy_flags
*/
typedef struct smhba_info {
void *mpt;
} smhba_info_t;
typedef struct mptsas_phy_info {
typedef struct mptsas_doneq_thread_arg {
void *mpt;
uint64_t t;
typedef struct mptsas_doneq_thread_list {
typedef struct mptsas {
int m_instance;
/*
* soft state flags
*/
/*
* variables for helper threads (fan-out interrupts)
*/
/*
* list of reset notification requests
*/
/*
* qfull handling
*/
/*
* scsi reset delay per bus
*/
int m_pm_idle_delay;
/*
* hba options.
*/
int m_in_callback;
/*
*/
/*
* Max frames per request reprted in IOC Facts
*/
/*
* Max frames per request which is used in reality. It's adjusted
* according DMA SG length attribute, and shall not exceed the
* m_max_chain_depth.
*/
/*
* indicates if the firmware was upload by the driver
* at boot time
*/
/*
* per instance data structures for dma memory resources for
* MPI handshake protocol. only one handshake cmd can run at a time.
*/
/* Firmware version on the card at boot time */
/* MSI specific fields */
/* SAS specific information */
union {
struct {
#ifdef _BIG_ENDIAN
#else
#endif
} sasaddr;
} un;
/* FMA Capabilities */
int m_fm_capabilities;
int m_mpxio_enable;
/*
* Event recording
*/
/*
* FW diag Buffer List
*/
/* GEN3 support */
/*
* Event Replay flag (MUR support)
*/
/*
* IR Capable flag
*/
/*
* Is HBA processing a diag reset?
*/
/*
* per instance cmd data structures for task management cmds
*/
/* ... scsi_pkt_size */
} mptsas_t;
sizeof (struct scsi_pkt) + scsi_pkt_size())
/*
* Only one of below two conditions is satisfied, we
* think the target is associated to the iport and
* allow call into mptsas_probe_lun().
* 1. physicalsport == physport
* 2. (phymask & (1 << physport)) == 0
* The condition #2 is because LSI uses lowest PHY
* number as the value of physical port when auto port
* configuration.
*/
(1 << physport))))
/*
* These should eventually migrate into the mpt header files
*/
/*
* m_options flags
*/
/*
* m_softstate flags
*/
/*
* regspec defines.
*/
/*
* Handy constants
*/
#define FALSE 0
/*
* power management.
*/
PCI_PMCSR_D0); \
}
PCI_PMCSR_D3HOT); \
}
/*
* inq_dtype:
* Bits 5 through 7 are the Peripheral Device Qualifier
* 001b: device not connected to the LUN
* Bits 0 through 4 are the Peripheral Device Type
* 1fh: Unknown or no device type
*
* Although the inquiry may return success, the following value
* means no valid LUN connected.
*/
/*
* Default is to have 10 retries on receiving QFULL status and
* each retry to be after 100 ms.
*/
/*
* Handy macros
*/
((n) >= 'a' && (n) <= 'f') || ((n) >= 'A' && (n) <= 'F'))
/*
* poll time for mptsas_pollret() and mptsas_wait_intr()
*/
/*
* default time for mptsas_do_passthru
*/
/*
* macro to return the effective address of a given per-target field
*/
#define MPTSAS_SET_SIGP(P) \
req_desc & 0xffffffffu); \
/*
* Mask all interrupts to disable
*/
/*
* Mask Doorbell and Reset interrupts to enable reply desc int.
*/
/* If the queue is now empty fix the tail pointer */ \
}
/* If the queue is now empty fix the tail pointer */ \
}
/*
* defaults for the global properties
*/
/*
* invalid hostid.
*/
/*
*/
/*
* Config space.
*/
/*
* Offset to firmware version
*/
/*
* Offset and masks to get at the ProductId field
*/
/*
* Subsystem ID for HBAs.
*/
/*
* reset delay tick
*/
/*
* Ioc reset return values
*/
#define MPTSAS_NO_RESET 0
/*
* throttle support.
*/
#define HOLD_THROTTLE 0
/*
* Passthrough/config request flags
*/
/*
* response code tlr flag
*/
/*
* System Events
*/
#ifndef DDI_VENDOR_LSI
#endif /* DDI_VENDOR_LSI */
/*
* Shared functions
*/
int mptsas_download_firmware();
int mptsas_can_download_firmware();
/*
* impl functions
*/
int mode);
/*
* init functions
*/
/*
* configuration pages operation
*/
mptsas_smp_t *info);
int
smhba_info_t *info);
int
smhba_info_t *info);
int
void
/*
* RAID functions
*/
/*
* debugging.
* MPTSAS_DBGLOG_LINECNT must be a power of 2.
*/
#if defined(MPTSAS_DEBUG)
extern uint32_t mptsas_debugprt_flags;
extern uint32_t mptsas_debuglog_flags;
void mptsas_printf(char *fmt, ...);
void mptsas_debug_log(char *fmt, ...);
if (mptsas_debugprt_flags & (m)) \
if (mptsas_debuglog_flags & (m)) \
#else /* ! defined(MPTSAS_DEBUG) */
#endif /* defined(MPTSAS_DEBUG) */
/*
* auto request sense
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_ADAPTERS_MPTVAR_H */