pkt_wrapper.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_IMPL_PKT_WRAPPER_H
#define _SYS_SCSI_IMPL_PKT_WRAPPER_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The information in this file should be private to each
* particular Host Bus Adapter implementation, and should
* not be relied upon in any way. This file will be removed
* in a future release.
*/
/*
* Implementation specific SCSI definitions for wrapping around
* the generic scsi command packet. The transport layer (host adapter)
* intimately understands and uses the definitions here.
*/
#ifdef __cplusplus
extern "C" {
#endif
struct target_private {
union {
} targ;
int x_seccnt; /* sector count */
int x_byteleft; /* bytes left to do */
int x_bytexfer; /* bytes xfered for this ops */
int x_tot_bytexfer; /* total bytes xfered per cmd */
short x_retry; /* retry count */
int x_flags; /* flags */
void (*x_callback)(); /* target drv internal cb func */
};
#if defined(__sparc)
/*
* Managing possibly discontiguous data segments
*
* It is theoretically possible for a SCSI target to
* transfer data in a discontiguous fashion. In order
* to manage this possibility in an efficient manner,
* we'll define a bunch of structures for recording,
* in various ways, the history of data transfers.
*
* The only time that this can get complicated is
* when the target sends a MODIFY DATA POINTER message
* that moves the active data pointer completely out
* of bounds from a segment of data already transferred.
*
* The SAVE DATA POINTER and RESTORE POINTERS messages
* typically only cause moving around within an already
* defined segment.
*/
/*
* An arbitrary structure that describes a data segment.
* This simply has a zero based offset and a count. In
* the case of a set of truly discontiguous transfers,
* a list of these things will be constructed as the
* transfer progresses. At the end of such a transfer
* some sorting and merging will then be done to then
* figure out how much data was actually moved.
*
* Please note that this is purely to do with counting
* how much data was moved and must bear absolutely no
* relationship whatsoever to pointer or DMA addresses.
*/
struct sd_seg {
};
#endif /* defined(__sparc) */
/*
* The transport layer deals with things in terms of the following structure.
* Note that the target driver's view of things is the scsi_pkt that is
* enfolded as the first element of the following structure.
*/
#define PKT_PRIV_LEN (sizeof (struct target_private))
struct scsi_cmd {
union {
} cm;
long cmd_totxfer; /* total transfer for cmd */
/* keep target private at the end for allocation */
};
#else
struct scsi_cmd {
long cmd_timeout; /* command timeout */
};
#endif /* __i386 || __amd64 */
/*
* A note about the data 'pointers':
*
* XXXXXX
*
* A note about the cmd_cdb && cmd_scb structures:
*
* If the command allocation requested exceeds the size of CDB_SIZE,
* the cdb will be allocated outside this structure (via kmem_alloc)
* The same applies to cmd_scb.
*
*/
#if defined(__sparc)
/*
* define size of extended scsi cmd pkt (ie. includes ARQ)
*/
#define EXTCMDS_STATUS_SIZE (sizeof (struct scsi_arq_status))
#endif /* defined(__sparc) */
/*
* These are the defined flags for this structure.
*
* The host adapter may not change the state of any
* flags that fall within the CFLAG_RESERVED area.
* The rest of the flag area can be used by the host
* adapter to get its job done, and the defines made
* here for that area are just suggested usages.
*/
/* been fast alloc'ed */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_IMPL_PKT_WRAPPER_H */