defs.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SBP2_DEFS_H
#define _SYS_SBP2_DEFS_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Serial Bus Protocol 2 (SBP-2) definitions
*
* References are to ANSI NCITS 325-1998 unless specified otherwise
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Operation request blocks (ORB's)
* Note that the targets specify the minimum ORB size (ref: 7.8.4)
*
* dummy ORB (ref: 5.1.1)
*/
typedef struct sbp2_dummy_orb {
/* parameters */
/* ORB formats */
/* command block ORB (ref: 5.1.2) */
typedef struct sbp2_cmd_orb {
/* request */
#define SBP2_ORB_CMD_DIR 0x0800
#define SBP2_ORB_CMD_SPD 0x0700
#define SBP2_ORB_CMD_SPD_SHIFT 8
#define SBP2_ORB_CMD_MAX_PAYLOAD 0x00F0
#define SBP2_ORB_CMD_MAX_PAYLOAD_SHIFT 4
#define SBP2_ORB_CMD_PT 0x0008
#define SBP2_ORB_CMD_PSZ 0x0007
/* speeds */
#define SBP2_ORB_CMD_SPD_S100 0x0000
#define SBP2_ORB_CMD_SPD_S200 0x0100
#define SBP2_ORB_CMD_SPD_S400 0x0200
#define SBP2_ORB_CMD_SPD_S800 0x0300
#define SBP2_ORB_CMD_SPD_S1600 0x0400
#define SBP2_ORB_CMD_SPD_S3200 0x0500
/* management ORB (ref: 5.1.3) */
typedef struct sbp2_mgt_orb {
/* parameters */
/* mgt functions */
#define SBP2_ORB_MGT_FUNC_LOGIN 0x0000
#define SBP2_ORB_MGT_FUNC_QUERY_LOGINS 0x0001
#define SBP2_ORB_MGT_FUNC_RECONNECT 0x0003
#define SBP2_ORB_MGT_FUNC_SET_PASSWORD 0x0004
#define SBP2_ORB_MGT_FUNC_LOGOUT 0x0007
#define SBP2_ORB_MGT_FUNC_ABORT_TASK 0x000B
#define SBP2_ORB_MGT_FUNC_ABORT_TASK_SET 0x000C
#define SBP2_ORB_MGT_FUNC_LUN_RESET 0x000E
#define SBP2_ORB_MGT_FUNC_TARGET_RESET 0x000F
/* login ORB (ref: 5.1.3.1) */
typedef struct sbp2_login_orb {
/* parameters */
#define SBP2_ORB_LOGIN_EXCL 0x1000
#define SBP2_ORB_LOGIN_RECONNECT 0x00F0
#define SBP2_ORB_LOGIN_RECONNECT_SHIFT 4
/* login response */
typedef struct sbp2_login_resp {
/* query logins ORB (ref: 5.1.3.2) */
typedef struct sbp2_qlogins_orb {
/* reconnect ORB (ref: 5.1.3.3) */
typedef struct sbp2_reconnect_orb {
/* logout ORB (ref: 5.1.3.4) */
typedef struct sbp2_logout_orb {
/* task management ORB (ref: 5.1.3.5) */
typedef struct sbp2_task_mgt_orb {
/* status block (ref: 5.3) */
typedef struct sbp2_status {
/* parameters */
#define SBP2_ST_SRC 0xC0
#define SBP2_ST_SRC_SHIFT 6
#define SBP2_ST_RESP 0x30
#define SBP2_ST_RESP_SHIFT 4
#define SBP2_ST_DEAD 0x08
#define SBP2_ST_LEN 0x07
/* status origins */
#define SBP2_ST_SRC_ORB 0x00
#define SBP2_ST_SRC_ORB_NULL 0x40
#define SBP2_ST_SRC_UNSOLICITED 0x80
/* response status */
/* SBP status, when response status is REQUEST COMPLETE */
/* SBP status, when response status is TRANSPORT FAILURE */
/* objects */
/* serial bus errors */
/* command block agent registers (ref: 6.4) */
#define SBP2_AGENT_STATE_OFFSET 0x00
#define SBP2_AGENT_RESET_OFFSET 0x04
#define SBP2_ORB_POINTER_OFFSET 0x08
#define SBP2_DOORBELL_OFFSET 0x10
#define SBP2_UNSOLICITED_STATUS_ENABLE_OFFSET 0x14
/* agent states */
#define SBP2_AGENT_STATE_RESET 0
#define SBP2_AGENT_STATE_ACTIVE 1
#define SBP2_AGENT_STATE_SUSPENDED 2
#define SBP2_AGENT_STATE_DEAD 3
/* page table parameters */
/* page table element for unrestricted page table (ref: 5.2.1) */
typedef struct sbp2_pt_unrestricted {
/*
* Configuration ROM
*
* key types & values
*/
#define SBP2_KT_MGT_AGENT 1
#define SBP2_KV_MGT_AGENT 0x14
#define SBP2_KT_LUN 0
#define SBP2_KV_LUN 0x14
#define SBP2_KT_UNCHAR 0
#define SBP2_KV_UNCHAR 0x3A
/* Logical_Unit_Number */
#define SBP2_LUN_TYPE_SHIFT 16
/* Unit_Characteristics */
#define SBP2_UNCHAR_MOT_SHIFT 8
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SBP2_DEFS_H */