driver.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_DRIVER_H
#define _SYS_SBP2_DRIVER_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Serial Bus Protocol 2 (SBP-2) driver interfaces
*/
#include <sys/sysmacros.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Config ROM definitions
*
* bus info block
*/
typedef struct sbp2_cfgrom_bib {
int cb_len; /* info_length */
/* directory */
typedef struct sbp2_cfgrom_dir {
int cd_cnt; /* # of entries with data */
int cd_size; /* # of allocated entries */
/* directory entry */
typedef struct sbp2_cfgrom_ent {
union { /* data depends on key type: */
} ce_data;
/* entire Config ROM */
typedef struct sbp2_cfgrom {
/*
* SBP-2 definitions
*/
/* task states */
typedef enum {
SBP2_TASK_INIT, /* initial state */
SBP2_TASK_PEND, /* put on the list, pending completion */
SBP2_TASK_COMP, /* task completed */
SBP2_TASK_PROC /* status being processed */
/* task errors */
typedef enum {
SBP2_TASK_ERR_NONE, /* no error */
SBP2_TASK_ERR_DEAD, /* agent dead */
SBP2_TASK_ERR_BUS, /* bus error */
SBP2_TASK_ERR_TIMEOUT, /* timed out */
SBP2_TASK_ERR_ABORT, /* task aborted */
SBP2_TASK_ERR_LUN_RESET, /* lun reset */
SBP2_TASK_ERR_TGT_RESET /* target reset */
/*
* task
*/
typedef struct sbp2_task {
void *ts_drv_priv; /* driver private data */
int ts_timeout; /* task timeout in seconds */
int ts_bus_error; /* bus error */
} sbp2_task_t;
/* fetch agent */
typedef struct sbp2_agent {
/* commands */
void *a_cmd; /* fetch agent cmd */
/* register offsets */
/* UNSOLICITED_STATUS_ENABLE */
} sbp2_agent_t;
/* session is a period between login and logout */
typedef struct sbp2_ses {
/* task list (command ORB's) */
int s_task_cnt; /* # tasks */
void (*s_status_cb)(void *, sbp2_task_t *);
void *s_status_cb_arg;
} sbp2_ses_t;
s_status_cb_arg }))
/* buffer list */
typedef struct sbp2_buf_list {
int bl_len; /* number of elements */
/* logical unit */
typedef struct sbp2_lun {
} sbp2_lun_t;
enum {
};
/* per-target statistics */
typedef struct sbp2_tgt_stat {
/* target */
typedef struct sbp2_tgt {
void *t_bus_hdl; /* bus handle */
int t_nluns; /* # logical units */
int t_nluns_alloc; /* # luns allocated */
/* congif ROM */
int t_orb_size; /* ORB_size */
/* management agent */
int t_mot; /* mgt timeout, ms */
void *t_mgt_cmd; /* command */
} sbp2_tgt_t;
/* walker flags */
enum {
};
/* walker return codes */
enum {
};
void sbp2_tgt_fini(sbp2_tgt_t *);
void sbp2_tgt_disconnect(sbp2_tgt_t *);
int sbp2_tgt_reconnect(sbp2_tgt_t *);
int sbp2_tgt_reset(sbp2_tgt_t *, int *);
int sbp2_tgt_get_lun_cnt(sbp2_tgt_t *);
int sbp2_lun_reset(sbp2_lun_t *, int *);
void *, int *);
void sbp2_ses_nudge(sbp2_ses_t *);
int sbp2_ses_agent_reset(sbp2_ses_t *, int *);
int sbp2_ses_abort_task_set(sbp2_ses_t *, int *);
void *sbp2_task_orb_kaddr(sbp2_task_t *);
void sbp2_swap32_buf(uint32_t *, int);
void sbp2_cfgrom_walk(sbp2_cfgrom_ent_t *,
int (*)(void *, sbp2_cfgrom_ent_t *, int), void *);
int);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SBP2_DRIVER_H */