impl.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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* scsa1394 definitions
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* each lun uses a worker thread for various deferred processing
*/
typedef enum {
SCSA1394_THR_INIT, /* initial state */
SCSA1394_THR_RUN, /* thread is running */
SCSA1394_THR_EXIT /* thread exited */
/* thread requests */
enum {
SCSA1394_THREQ_BUS_RESET = 0x8,
SCSA1394_THREQ_DISCONNECT = 0x10,
SCSA1394_THREQ_RECONNECT = 0x20
};
typedef struct scsa1394_thread {
void (*thr_func)(void *); /* function to be run */
void *thr_arg; /* function argument */
int thr_req; /* request mask */
/* 1394 device state */
typedef enum {
SCSA1394_DEV_INIT = 0,
enum { SCSA1394_STAT_NCMD_LAST = 8 };
/* per-lun statistics */
typedef struct scsa1394_lun_stat {
/*
* ring buffer of the last N failed commands. stat_cmd_fail_last_idx
* is an index into stat_cmd_fail_last the array and points to the
* entry to be written next. The first 16 bytes are CDB bytes,
* the last 8 bytes are a timestamp (lbolt).
*/
/*
* errors
*/
/* logical unit */
typedef struct scsa1394_lun {
int l_softintr_req; /* soft intr request mask */
/* workarounds */
int l_lba_size; /* LBA size */
int l_dtype_orig; /* original DTYPE value */
int l_rmb_orig; /* original RMB value */
int l_start_stop_fail_cnt; /* start/stop failures */
int l_mode_sense_fail_cnt; /* mode sense failures */
struct scsi_inquiry l_fake_inq;
/* l_softintr_req */
enum {
};
/* per-instance statistics */
typedef struct scsa1394_inst_stat {
/*
* errors
*/
/* per-instance soft state structure */
typedef struct scsa1394_state {
int s_instance; /* instance number */
int s_nluns; /* # of logical units */
/* for sbp2_bus_buf.bb_hdl */
typedef struct scsa1394_bus_buf {
/* various translation macros */
/* macros to calculate LBA for 6/10/12-byte commands */
#define SCSA1394_LBA_6BYTE(pkt) \
#define SCSA1394_LEN_6BYTE(pkt) \
#define SCSA1394_LEN_10BYTE(pkt) \
#define SCSA1394_LBA_10BYTE(pkt) \
#define SCSA1394_LEN_12BYTE(pkt) \
#define SCSA1394_LBA_12BYTE(pkt) \
/* macro to calculate LEN for SCMD_READ_CD command */
#define SCSA1394_LEN_READ_CD(pkt) \
/* calculate block size for CD-RW writes */
#define SCSA1394_VALID_CDRW_BLKSZ(blksz) \
typedef struct scsa1394_bw_list {
int vid_match;
int vid;
/* match type */
enum {
};
#define NELEM(a) (sizeof (a) / sizeof (*(a)))
/* misc constants */
enum {
SCSA1394_CLEANUP_LEVEL_MAX = 256,
SCSA1394_MAPIN_SIZE_MAX = 512,
SCSA1394_DTYPE_RBC = 0x0E
};
/* SBP-2 routines */
int scsa1394_sbp2_attach(scsa1394_state_t *);
void scsa1394_sbp2_detach(scsa1394_state_t *);
int scsa1394_sbp2_login(scsa1394_state_t *, int);
void scsa1394_sbp2_req(scsa1394_state_t *, int, int);
void scsa1394_sbp2_disconnect(scsa1394_state_t *);
void scsa1394_sbp2_nudge(scsa1394_lun_t *);
void scsa1394_sbp2_flush_cmds(scsa1394_lun_t *, int, int, int);
/* HBA public routines */
void scsa1394_thr_cancel(scsa1394_thread_t *);
void scsa1394_thr_wake(scsa1394_thread_t *, int);
void scsa1394_thr_clear_req(scsa1394_thread_t *, int);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_1394_TARGETS_SCSA1394_IMPL_H */