transport.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_TRANSPORT_H
#define _SYS_SCSI_IMPL_TRANSPORT_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Include the loadable module wrapper.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/*
* SCSI transport structures
*
* As each Host Adapter makes itself known to the system,
* it will create and register with the library the structure
* described below. This is so that the library knows how to route
* packets, resource control requests, and capability requests
* for any particular host adapter. The 'a_hba_tran' field of a
* scsi_address structure made known to a Target driver will
* point to one of these transport structures.
*/
typedef struct scsi_hba_tran scsi_hba_tran_t;
struct scsi_hba_tran {
/*
* Ptr to the device info structure for this particular HBA.
*/
/*
* Private fields for use by the HBA itself.
*/
void *tran_hba_private; /* HBA softstate */
void *tran_tgt_private; /* target-specific info */
/*
* Only used to refer to a particular scsi device
* if the entire scsi_hba_tran structure is "cloned"
* per target device, otherwise NULL.
*/
struct scsi_device *tran_sd;
/*
* Vectors to point to specific HBA entry points
*/
int (*tran_tgt_init)(
struct scsi_device *sd);
int (*tran_tgt_probe)(
struct scsi_device *sd,
int (*callback)(
void));
void (*tran_tgt_free)(
struct scsi_device *sd);
int (*tran_start)(
struct scsi_address *ap,
int (*tran_reset)(
struct scsi_address *ap,
int level);
int (*tran_abort)(
struct scsi_address *ap,
int (*tran_getcap)(
struct scsi_address *ap,
char *cap,
int whom);
int (*tran_setcap)(
struct scsi_address *ap,
char *cap,
int value,
int whom);
struct scsi_pkt *(*tran_init_pkt)(
struct scsi_address *ap,
int cmdlen,
int statuslen,
int tgtlen,
int flags,
int (*callback)(
void (*tran_destroy_pkt)(
struct scsi_address *ap,
void (*tran_dmafree)(
struct scsi_address *ap,
void (*tran_sync_pkt)(
struct scsi_address *ap,
int (*tran_reset_notify)(
struct scsi_address *ap,
int flag,
int (*tran_get_bus_addr)(
struct scsi_device *devp,
char *name,
int len);
int (*tran_get_name)(
struct scsi_device *devp,
char *name,
int len);
int (*tran_clear_aca)(
struct scsi_address *ap);
int (*tran_clear_task_set)(
struct scsi_address *ap);
int (*tran_terminate_task)(
struct scsi_address *ap,
int (*tran_get_eventcookie)(
char *name,
int (*tran_add_eventcall)(
void (*callback)(
void *arg,
void *bus_impldata),
void *arg,
int (*tran_post_event)(
void *bus_impldata);
int (*tran_quiesce)(
int (*tran_unquiesce)(
int (*tran_bus_reset)(
int level);
/*
* Implementation-private specifics.
* No HBA should refer to any of the fields below.
* This information can and will change.
*/
int tran_hba_flags; /* flag options */
/*
*/
/*
* open_lock: protect tran_minor_isopen
* open_flag: bit field indicating which minor nodes are open.
* 0 = closed, 1 = shared open, all bits 1 = excl open.
*
* XXX Unused if hba driver chooses to implement own
* xxopen(9e) entry point
*/
/*
* bus_config vectors - ON Consolidation Private
* These interfaces are subject to change.
*/
int (*tran_bus_config)(
void *arg,
dev_info_t **tgt_dipp);
int (*tran_bus_unconfig)(
void *arg);
int (*tran_bus_power)(
void *impl_arg,
void *arg,
void *result);
};
#ifdef __lock_lint
#endif
/*
* Prototypes for SCSI HBA interface functions
*
* All these functions are public interfaces, with the
* exception of scsi_initialize_hba_interface() and
* scsi_uninitialize_hba_interface(), called by the
* scsi module _init() and _fini(), respectively.
*/
extern void scsi_initialize_hba_interface(void);
#ifdef NO_SCSI_FINI_YET
extern void scsi_uninitialize_hba_interface(void);
#endif /* NO_SCSI_FINI_YET */
extern int scsi_hba_init(
struct modlinkage *modlp);
extern void scsi_hba_fini(
struct modlinkage *modlp);
extern int scsi_hba_attach(
int flags,
void *hba_options);
extern int scsi_hba_attach_setup(
int flags);
extern int scsi_hba_detach(
extern scsi_hba_tran_t *scsi_hba_tran_alloc(
int flags);
extern void scsi_hba_tran_free(
extern int scsi_hba_probe(
struct scsi_device *sd,
int (*callback)(void));
extern int scsi_get_device_type_scsi_options(
struct scsi_device *devp,
int default_scsi_options);
extern struct scsi_pkt *scsi_hba_pkt_alloc(
struct scsi_address *ap,
int cmdlen,
int statuslen,
int tgtlen,
int hbalen,
extern void scsi_hba_pkt_free(
struct scsi_address *ap,
extern int scsi_hba_lookup_capstr(
char *capstr);
extern int scsi_hba_in_panic(void);
extern int scsi_hba_open(
int flags,
int otyp,
extern int scsi_hba_close(
int flag,
int otyp,
extern int scsi_hba_ioctl(
int cmd,
int mode,
int *rvalp);
extern void scsi_hba_nodename_compatible_get(
struct scsi_inquiry *inq,
char *binding_set,
int dtype_node,
char *compat0,
char **nodenamep,
char ***compatiblep,
int *ncompatiblep);
extern void scsi_hba_nodename_compatible_free(
char *nodename,
char **compatible);
/*
* Flags for scsi_hba_attach
*/
/* structure per target */
/*
* Flags for scsi_hba allocation functions
*/
/*
* For minor nodes created by the SCSA framework, minor numbers are
* formed by left-shifting instance by INST_MINOR_SHIFT and OR in a
* number less than 64.
*
* - Numbers 0 - 31 are reserved by the framework, part of the range are
* in use, as defined below.
*
* - Numbers 32 - 63 are available for HBA driver use.
*/
#define INST_MINOR_SHIFT 6
#define DEVCTL_MINOR 0
#define SCSI_MINOR 1
#define MINOR2INST(x) ((x) >> INST_MINOR_SHIFT)
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_IMPL_TRANSPORT_H */