scsi_pkt.h revision 30ab6db6f19a1f9cb466e0b45b221f6d19ca557c
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_SCSI_PKT_H
#define _SYS_SCSI_SCSI_PKT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/*
* SCSI packet definition.
*
* This structure defines the packet which is allocated by a library
* function and handed to a target driver. The target driver fills
* in some information, and passes it to the library for transport
* to an addressed SCSI device. The host adapter found by
* the library fills in some other information as the command is
* processed. When the command completes (or can be taken no further)
* the function specified in the packet is called with a pointer to
* the packet as it argument. From fields within the packet, the target
* driver can determine the success or failure of the command.
*/
struct scsi_pkt {
int pkt_time; /* time allotted to complete command */
};
#endif /* _KERNEL */
/*
* Definitions for the pkt_flags field.
*/
/*
* Following defines are generic.
*/
/* of the HBA driver's queue */
/* callback; command has been completed */
/* upon return from scsi_transport(9F) */
/*
* Following defines are appropriate for SCSI parallel bus.
*/
#define FLAG_RENEGOTIATE_WIDE_SYNC \
0x1000000 /* Do wide and sync renegotiation before */
/* transporting this command to target */
/*
* Following defines are internal i.e. not part of DDI.
*/
#define FLAG_IMMEDIATE_CB \
0x0800 /* Immediate callback on command */
/* completion, ie. do not defer */
/*
* Following defines are for USCSI options.
*/
#define FLAG_SILENT 0x00010000
#define FLAG_DIAGNOSE 0x00020000
#define FLAG_ISOLATE 0x00040000
/*
* Following define is for scsi_vhci.
* If pHCI cannot transport the command to the device, do not queue the pkt
* in pHCI. Return immediately with TRAN_BUSY.
*/
#define FLAG_NOQUEUE 0x80000000
/*
* Definitions for the pkt_reason field.
*/
/*
* Following defines are generic.
*/
#define CMD_CMPLT 0 /* no transport errors- normal completion */
/*
* Following defines are appropriate for SCSI parallel bus.
*/
/* Used by scsi_rname(9F) */
#define CMD_REASON_ASCII { \
"cmplt", "incomplete", "dma_derr", "tran_err", "reset", \
"aborted", "timeout", "data_ovr", "cmd_ovr", "sts_ovr", \
"badmsg", "nomsgout", "xid_fail", "ide_fail", "abort_fail", \
"reject_fail", "nop_fail", "per_fail", "bdr_fail", "id_fail", \
"unexpected_bus_free", "tag reject", "terminated", "", "gone", \
NULL }
/*
* Definitions for the pkt_state field
*/
/*
* Definitions for the pkt_statistics field
*/
/*
* Following defines are generic.
*/
/*
* Following defines are appropriate for SCSI parallel bus.
*/
/*
* Definitions for what scsi_transport returns
*/
#define TRAN_ACCEPT 1
#define TRAN_BUSY 0
#define TRAN_BADPKT -1
#ifdef _KERNEL
/*
* Kernel function declarations
*/
#define pkt_transport scsi_transport
#define SCSI_POLL_TIMEOUT 60
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_SCSI_PKT_H */