sas_transport.h revision 4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_IMPL_SAS_TRANSPORT_H
#define _SYS_SCSI_IMPL_SAS_TRANSPORT_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_KERNEL)
/*
* Properties for smp device
*/
#define SMP_PROP "smp-device"
#define SMP_WWN "smp-wwn"
/*
* Common Capability Strings Array for SAS
*/
/*
* SAS_CAP_SMP_CRC represent if the HBA has the
* capability to generate CRC for SMP frame and
* check the CRC of the reply frame
*/
#define SAS_CAP_SMP_CRC 1
#define SAS_CAP_ASCII { \
"smp-crc", NULL }
typedef struct sas_hba_tran sas_hba_tran_t;
typedef struct sas_addr {
} sas_addr_t;
typedef struct smp_pkt {
int pkt_timeout;
} smp_pkt_t;
typedef struct smp_device {
} smp_device_t;
struct sas_hba_tran {
void *tran_hba_private;
int (*tran_sas_getcap)(
sas_addr_t *ap,
char *cap);
int (*tran_smp_start)(
int (*tran_smp_init)(
smp_device_t *smp);
void (*tran_smp_free)(
smp_device_t *smp);
};
extern int smp_hba_bus_config_taddr(dev_info_t *, char *);
extern int sas_hba_lookup_capstr(char *capstr);
/*
* Phymap support
*/
typedef struct __sas_phymap sas_phymap_t;
typedef enum { PHYMAP_MODE_SIMPLE } sas_phymap_mode_t;
typedef void (*sas_phymap_activate_cb_t)
typedef void (*sas_phymap_deactivate_cb_t)
void *mode_argument,
void *phymap_priv,
sas_phymap_t **phymapp);
int phy,
int phy);
char *ua);
char *ua);
typedef struct __sas_phymap_phys sas_phymap_phys_t;
extern int sas_phymap_phys_next(sas_phymap_phys_t *);
void sas_phymap_phys_free(sas_phymap_phys_t *);
extern char *sas_phymap_phy2ua(sas_phymap_t *, int);
void sas_phymap_ua_free(char *);
#endif /* defined(_KERNEL) */
#define KSTAT_SAS_PHY_CLASS "SAS_phy_stat"
/*
* Format of the ks_name field for SAS Phy Stat
*
* driver_name.initiator_port_SAS_address.initiator_port_instance_number.phyid
* Example: pmcs.5000c50000d756aa.2.0
*
* driver_name:
* driver name from di_driver_name() on SAS initiator port devinfo node.
* initiator_port_SAS_address:
* SAS address of the initiator port that phy stat is reported for.
* initiator_port_instance_number:
* instance number of the initiator port that phy stat is reported for.
* phyid:
* prop phyIdentifier under initiator port node.
*/
/* Port Protocol - kstat structure definition */
typedef struct sas_port_protocol_stats {
/* Port - kstat structure definition */
typedef struct sas_port_stats {
/* PHY - kstat structure definition */
typedef struct sas_phy_stats {
/*
* Supported Protocol property
*/
#define SAS_PROTOCOL_SSP 0x00000001
#define SAS_PROTOCOL_STP 0x00000010
#define SAS_PROTOCOL_SMP 0x00000100
#define SAS_PROTOCOL_SATA 0x00001000
/*
* Definition - Negotiated Physical Link Rate
* Based on Table 288 (Section 10.4.3.10) of the spec (SAS-2 r-15), these
* constants represent "Negotiated physical link rate"
* (and implicitly the State of the phy).
*/
/* Speed is unknown */
/* Speed is undefined */
/* Failed speed negotiation. */
/* Detected a SATA device and */
/* entered the SATA Spinup hold */
/* state */
/* The phy is attached to a */
/* Port Selector (SATA-2.6). */
/* Expander is performing SMP */
/* Unsupported phy settings */
/*
* Definition - "phy-info" property
*
* The property is an nvlist_array that represents an array of the
* nvlists on a per HBA basis. The individual elements of the array
* (the nvlists) represent the following properties for each phy of the HBA
*/
/*
* Event definitions
*/
/* Event Class */
#define EC_HBA "EC_hba"
/* Event Sub-Class */
#define ESC_SAS_HBA_PORT_BROADCAST "ESC_sas_hba_port_broadcast"
/* Event Types for above Subclass */
#define SAS_PORT_BROADCAST_CHANGE "port_broadcast_change"
#define SAS_PORT_BROADCAST_SES "port_broadcast_ses"
#define SAS_PORT_BROADCAST_D24_0 "port_broadcast_d24_0"
#define SAS_PORT_BROADCAST_D27_4 "port_broadcast_d27_4"
#define SAS_PORT_BROADCAST_D01_4 "port_broadcast_d01_4"
#define SAS_PORT_BROADCAST_D04_7 "port_broadcast_d04_7"
#define SAS_PORT_BROADCAST_D16_7 "port_broadcast_d16_7"
#define SAS_PORT_BROADCAST_D29_7 "port_broadcast_d29_7"
/* Event Sub-Class */
#define ESC_SAS_PHY_EVENT "ESC_sas_phy_event"
/* Event Types for above Subclass */
#define SAS_PHY_ONLINE "port_online"
#define SAS_PHY_OFFLINE "port_offline"
#define SAS_PHY_REMOVE "port_remove"
/* Event Payload Names */
#define SAS_DRV_INST "driver_instance"
#define SAS_PORT_ADDR "port_address"
#define SAS_DEVFS_PATH "devfs_path"
#define SAS_EVENT_TYPE "event_type"
#define SAS_LINK_RATE "link_rate"
/* SAS_PHY_ID - Defined Above */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_IMPL_SAS_TRANSPORT_H */