17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56567eb0aSlh195018 * Common Development and Distribution License (the "License"). 66567eb0aSlh195018 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 227c478bd9Sstevel@tonic-gate * Enclosure Services Device target driver 237c478bd9Sstevel@tonic-gate * 2424f1a99aSjmcp * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _SYS_SCSI_TARGETS_SES_H 297c478bd9Sstevel@tonic-gate #define _SYS_SCSI_TARGETS_SES_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/note.h> 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifdef __cplusplus 347c478bd9Sstevel@tonic-gate extern "C" { 357c478bd9Sstevel@tonic-gate #endif 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * Useful defines and typedefs 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate #define EOK 0 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #define INVOP 0x10 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define BP_PKT(bp) ((struct scsi_pkt *)(bp)->av_back) 467c478bd9Sstevel@tonic-gate #define SET_BP_PKT(bp, s) (bp)->av_back = (struct buf *)(s) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #define SCBP(pkt) ((struct scsi_status *)(pkt)->pkt_scbp) 497c478bd9Sstevel@tonic-gate #define SCBP_C(pkt) ((*(pkt)->pkt_scbp) & STATUS_MASK) 507c478bd9Sstevel@tonic-gate #define Scsidevp struct scsi_device * 517c478bd9Sstevel@tonic-gate #define Scsipktp struct scsi_pkt * 527c478bd9Sstevel@tonic-gate #define Uscmd struct uscsi_cmd 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #define SES_SCSI_DEVP (un->ses_scsi_devp) 557c478bd9Sstevel@tonic-gate #define SES_DEVP(softc) ((softc)->ses_devp) 567c478bd9Sstevel@tonic-gate #define SES_DEVINFO(softc) (SES_DEVP(softc)->sd_dev) 577c478bd9Sstevel@tonic-gate #define SES_RQSENSE(softc) (SES_DEVP(softc)->sd_sense) 587c478bd9Sstevel@tonic-gate #define SES_ROUTE(softc) (&SES_DEVP(softc)->sd_address) 597c478bd9Sstevel@tonic-gate #define SES_MUTEX (&ssc->ses_devp->sd_mutex) 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #define ISOPEN(softc) ((softc)->ses_lyropen || (softc)->ses_oflag) 627c478bd9Sstevel@tonic-gate #define UNUSED_PARAMETER(x) x = x 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * SAF-TE specific defines- Mandatory ones only... 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * READ BUFFER ('get' commands) IDs- placed in offset 2 of cdb 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate #define SAFTE_RD_RDCFG 0x00 /* read enclosure configuration */ 737c478bd9Sstevel@tonic-gate #define SAFTE_RD_RDESTS 0x01 /* read enclosure status */ 747c478bd9Sstevel@tonic-gate #define SAFTE_RD_RDDSTS 0x04 /* read drive slot status */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * WRITE BUFFER ('set' commands) IDs- placed in offset 0 of databuf 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate #define SAFTE_WT_DSTAT 0x10 /* write device slot status */ 807c478bd9Sstevel@tonic-gate #define SAFTE_WT_SLTOP 0x12 /* perform slot operation */ 817c478bd9Sstevel@tonic-gate #define SAFTE_WT_FANSPD 0x13 /* set fan speed */ 827c478bd9Sstevel@tonic-gate #define SAFTE_WT_ACTPWS 0x14 /* turn on/off power supply */ 837c478bd9Sstevel@tonic-gate #define SAFTE_WT_GLOBAL 0x15 /* send global command */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* 877c478bd9Sstevel@tonic-gate * Includes 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate #include <sys/scsi/targets/sesio.h> 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* 937c478bd9Sstevel@tonic-gate * Private info (Device Info. Private) 947c478bd9Sstevel@tonic-gate * 957c478bd9Sstevel@tonic-gate * Pointed to by the un_private pointer 967c478bd9Sstevel@tonic-gate * of one of the SCSI_DEVICE structures. 977c478bd9Sstevel@tonic-gate */ 987c478bd9Sstevel@tonic-gate typedef struct ses_softc ses_softc_t; 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate typedef struct { 1017c478bd9Sstevel@tonic-gate int (*softc_init)(ses_softc_t *, int); 1027c478bd9Sstevel@tonic-gate int (*init_enc)(ses_softc_t *); 1037c478bd9Sstevel@tonic-gate int (*get_encstat)(ses_softc_t *, int); 1047c478bd9Sstevel@tonic-gate int (*set_encstat)(ses_softc_t *, uchar_t, int); 1057c478bd9Sstevel@tonic-gate int (*get_objstat)(ses_softc_t *, ses_objarg *, int); 1067c478bd9Sstevel@tonic-gate int (*set_objstat)(ses_softc_t *, ses_objarg *, int); 1077c478bd9Sstevel@tonic-gate } encvec; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate typedef enum { SES_TYPE, SAFT_TYPE, SEN_TYPE } enctyp; 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate typedef struct { 1127c478bd9Sstevel@tonic-gate uchar_t enctype; /* enclosure type */ 1137c478bd9Sstevel@tonic-gate uchar_t subenclosure; /* subenclosure id */ 1147c478bd9Sstevel@tonic-gate ushort_t svalid : 1, /* enclosure information valid */ 1157c478bd9Sstevel@tonic-gate priv : 15; /* private data, per object */ 1167c478bd9Sstevel@tonic-gate uchar_t encstat[4]; /* state && stats */ 1177c478bd9Sstevel@tonic-gate } encobj; 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate #ifndef __lint /* no warlock for X86 */ 1207c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1217c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(scsi_device::sd_mutex, encobj)) 1227c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(encobj::priv)) 1237c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(encobj::svalid)) 1247c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(encobj::enctype)) 1257c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(encobj::encstat)) 1267c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(encobj::subenclosure)) 1277c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1287c478bd9Sstevel@tonic-gate #endif /* __lint */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * Overall Status is bits 0..3- status validity reserved at bit 7 1337c478bd9Sstevel@tonic-gate */ 1347c478bd9Sstevel@tonic-gate #define ENCI_SVALID 0x80 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate struct ses_softc { 1377c478bd9Sstevel@tonic-gate enctyp ses_type; /* type of enclosure */ 1387c478bd9Sstevel@tonic-gate encvec ses_vec; /* vector to handlers */ 1397c478bd9Sstevel@tonic-gate uint_t ses_nobjects; /* number of objects */ 1407c478bd9Sstevel@tonic-gate void * ses_private; /* private data */ 1417c478bd9Sstevel@tonic-gate encobj * ses_objmap; /* objects */ 1427c478bd9Sstevel@tonic-gate uchar_t ses_encstat; /* overall status */ 1437c478bd9Sstevel@tonic-gate Scsidevp ses_devp; /* backpointer to owning SCSI device */ 1447c478bd9Sstevel@tonic-gate struct buf *ses_rqbp; /* request sense buf pointer */ 1457c478bd9Sstevel@tonic-gate Scsipktp ses_rqpkt; /* SCSI Request Sense Packet */ 1467c478bd9Sstevel@tonic-gate struct buf *ses_sbufp; /* for use in internal io */ 1477c478bd9Sstevel@tonic-gate timeout_id_t ses_restart_id; /* restart timeout id */ 1487c478bd9Sstevel@tonic-gate kcondvar_t ses_sbufcv; /* cv on sbuf */ 1497c478bd9Sstevel@tonic-gate uchar_t ses_sbufbsy; /* sbuf busy flag */ 1507c478bd9Sstevel@tonic-gate uchar_t ses_oflag; /* nonzero if opened (nonlayered) */ 1517c478bd9Sstevel@tonic-gate uchar_t ses_present; /* device present */ 1527c478bd9Sstevel@tonic-gate uchar_t ses_suspended; /* nonzero if suspended */ 1537c478bd9Sstevel@tonic-gate uchar_t ses_arq; /* auto request sense enabled */ 1547c478bd9Sstevel@tonic-gate uint_t ses_lyropen; /* layered open count */ 1557c478bd9Sstevel@tonic-gate int ses_retries; /* retry count */ 1567c478bd9Sstevel@tonic-gate /* 1577c478bd9Sstevel@tonic-gate * Associated storage for the special buf. 1587c478bd9Sstevel@tonic-gate * Since we're single threaded on sbuf anyway, 1597c478bd9Sstevel@tonic-gate * we might as well save ourselves a pile of 1607c478bd9Sstevel@tonic-gate * grief and allocate local uscsicmd and 1617c478bd9Sstevel@tonic-gate * ancillary storage here. 1627c478bd9Sstevel@tonic-gate */ 1637c478bd9Sstevel@tonic-gate Uscmd ses_uscsicmd; 1647c478bd9Sstevel@tonic-gate uchar_t ses_srqcdb[CDB_SIZE]; 165*0a2f1c3aSNikko He uchar_t ses_srqsbuf[MAX_SENSE_LENGTH]; 1667c478bd9Sstevel@tonic-gate }; 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate #ifndef __lint /* no warlock for X86 */ 1697c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1707c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(scsi_device::sd_mutex, ses_softc)) 1717c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(scsi_device::sd_mutex, ses_softc::ses_lyropen)) 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("not shared", scsi_arq_status)) 1747c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("not shared", ses_softc::ses_restart_id)) 1757c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("not shared", ses_softc::ses_retries)) 1767c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("not shared", ses_softc::ses_present)) 1777c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("not shared", ses_softc::ses_suspended)) 1787c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", 1797c478bd9Sstevel@tonic-gate ses_softc::ses_type 1807c478bd9Sstevel@tonic-gate ses_softc::ses_vec 1817c478bd9Sstevel@tonic-gate ses_softc::ses_nobjects 1827c478bd9Sstevel@tonic-gate ses_softc::ses_devp 1837c478bd9Sstevel@tonic-gate ses_softc::ses_arq)) 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("sbufp cv", 1867c478bd9Sstevel@tonic-gate ses_softc::ses_sbufp 1877c478bd9Sstevel@tonic-gate ses_softc::ses_rqpkt 1887c478bd9Sstevel@tonic-gate ses_softc::ses_rqbp 1897c478bd9Sstevel@tonic-gate ses_softc::ses_sbufbsy 1907c478bd9Sstevel@tonic-gate ses_softc::ses_uscsicmd 1917c478bd9Sstevel@tonic-gate ses_softc::ses_srqcdb 1927c478bd9Sstevel@tonic-gate ses_softc::ses_srqsbuf 1937c478bd9Sstevel@tonic-gate ses_softc::ses_uscsicmd)) 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", scsi_pkt buf uio scsi_cdb)) 1967c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", scsi_extended_sense scsi_status)) 1977c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", uscsi_cmd)) 1987c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_device)) 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ses_softc::ses_encstat)) 2017c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ses_softc::ses_objmap)) 2027c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ses_softc::ses_private)) 2037c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ses_softc::ses_lyropen)) 2047c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ses_softc::ses_oflag)) 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("absurdities", ses_objarg)) 2077c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 2087c478bd9Sstevel@tonic-gate #endif /* __lint */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * Compile options to turn on debugging code 2137c478bd9Sstevel@tonic-gate */ 2147c478bd9Sstevel@tonic-gate #ifdef DEBUG 2157c478bd9Sstevel@tonic-gate #define SES_DEBUG 2167c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_KMEMUSER) 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG ((1 << 8) | CE_CONT) 2217c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG1 ((2 << 8) | CE_CONT) 2227c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG2 ((3 << 8) | CE_CONT) 2237c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG3 ((4 << 8) | CE_CONT) 2247c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG4 ((5 << 8) | CE_CONT) 2257c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG5 ((6 << 8) | CE_CONT) 2267c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG6 ((7 << 8) | CE_CONT) 2277c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG7 ((8 << 8) | CE_CONT) 2287c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG8 ((9 << 8) | CE_CONT) 2297c478bd9Sstevel@tonic-gate #define SES_CE_DEBUG9 ((10 << 8) | CE_CONT) 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate #ifndef SES_DEBUG 2327c478bd9Sstevel@tonic-gate #define ses_debug 0 2337c478bd9Sstevel@tonic-gate #endif /* SES_DEBUG */ 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate #define SES_LOG if (ses_debug) ses_log 2367c478bd9Sstevel@tonic-gate #define SES_DEBUG_ENTER if (ses_debug) debug_enter 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate /* 2407c478bd9Sstevel@tonic-gate * Various I/O timeouts. 2417c478bd9Sstevel@tonic-gate * 2427c478bd9Sstevel@tonic-gate * These are hard-coded and not adjustable. The restart macro 2437c478bd9Sstevel@tonic-gate * time input is in milliseconds with 1 msec. the minimum setting. 2447c478bd9Sstevel@tonic-gate * 2457c478bd9Sstevel@tonic-gate */ 2467c478bd9Sstevel@tonic-gate #define SES_IO_TIME 60 /* standard I/O time (sec.) */ 2477c478bd9Sstevel@tonic-gate #define SES_RESTART_TIME 100 /* I/O restart time (ms.) */ 24824f1a99aSjmcp #define SES_BUSY_TIME 500 /* I/O busy restart time (ms.) */ 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate #define SES_ENABLE_RESTART(ms_time, pkt) { \ 2517c478bd9Sstevel@tonic-gate ssc->ses_restart_id = timeout(ses_restart, (void *) pkt, \ 25224f1a99aSjmcp (ms_time)? (drv_usectohz(ms_time * 1000)) : \ 25324f1a99aSjmcp drv_usectohz(1000)); \ 2547c478bd9Sstevel@tonic-gate } 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate /* 2587c478bd9Sstevel@tonic-gate * Number of times we'll retry a normal operation. 2597c478bd9Sstevel@tonic-gate * 2607c478bd9Sstevel@tonic-gate * Note, retries have differnt weights to max retries. 2617c478bd9Sstevel@tonic-gate * Unit Attention and request sense have the most retries. 2627c478bd9Sstevel@tonic-gate * Command retries have the least. 2637c478bd9Sstevel@tonic-gate * 2647c478bd9Sstevel@tonic-gate * For no auto-request sense operation, the SES_RETRY_MULTIPLIER 2657c478bd9Sstevel@tonic-gate * must be greater than the command RETRY_COUNT. Then the request 2667c478bd9Sstevel@tonic-gate * sense commands won't impact the command retries. 2677c478bd9Sstevel@tonic-gate */ 2687c478bd9Sstevel@tonic-gate #define SES_RETRY_COUNT 4 2697c478bd9Sstevel@tonic-gate #define SES_RETRY_MULTIPLIER 8 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate #define SES_CMD_RETRY SES_RETRY_MULTIPLIER 2727c478bd9Sstevel@tonic-gate #define SES_NO_RETRY 0 2737c478bd9Sstevel@tonic-gate #define SES_SENSE_RETRY 1 27424f1a99aSjmcp #define SES_BUSY_RETRY 4 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate /* Retry weight is 1 */ 2777c478bd9Sstevel@tonic-gate #define SES_CMD_RETRY1(retry) \ 2787c478bd9Sstevel@tonic-gate retry += (retry > 0)? (SES_RETRY_MULTIPLIER -1) : 0; 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate /* Retry weight is 2 */ 2817c478bd9Sstevel@tonic-gate #define SES_CMD_RETRY2(retry) \ 2827c478bd9Sstevel@tonic-gate retry += (retry > 0)? (SES_RETRY_MULTIPLIER -2) : 0; 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate /* Retry weight is 4 */ 2857c478bd9Sstevel@tonic-gate #define SES_CMD_RETRY4(retry) \ 2867c478bd9Sstevel@tonic-gate retry += (retry > 0)? (SES_RETRY_MULTIPLIER -4) : 0; 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate /* 2907c478bd9Sstevel@tonic-gate * ses_present definitions 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate #define SES_CLOSED 0 2937c478bd9Sstevel@tonic-gate #define SES_OPENING 1 2947c478bd9Sstevel@tonic-gate #define SES_OPEN 2 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate /* 2987c478bd9Sstevel@tonic-gate * ses_callback action codes 2997c478bd9Sstevel@tonic-gate */ 3007c478bd9Sstevel@tonic-gate #define COMMAND_DONE 0 3017c478bd9Sstevel@tonic-gate #define COMMAND_DONE_ERROR 1 3027c478bd9Sstevel@tonic-gate #define QUE_COMMAND_NOW 3 3037c478bd9Sstevel@tonic-gate #define QUE_COMMAND 4 3047c478bd9Sstevel@tonic-gate #define QUE_SENSE 5 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate /* 3087c478bd9Sstevel@tonic-gate * PF bit for RECEIVE DIAG command; 3097c478bd9Sstevel@tonic-gate * needed for RSM first release hw. 3107c478bd9Sstevel@tonic-gate */ 3117c478bd9Sstevel@tonic-gate #define SCSI_ESI_PF 0x10 3127c478bd9Sstevel@tonic-gate #define SEN_ID "UNISYS SUN_SEN" 3137c478bd9Sstevel@tonic-gate #define SEN_ID_LEN 24 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate #define SET_BP_ERROR(bp, err) bioerror(bp, err); 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate /* 3187c478bd9Sstevel@tonic-gate * Common Driver Functions 3197c478bd9Sstevel@tonic-gate */ 3207c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 3217c478bd9Sstevel@tonic-gate extern void ses_log(ses_softc_t *, int, const char *, ...); 3227c478bd9Sstevel@tonic-gate extern int ses_runcmd(ses_softc_t *, Uscmd *); 3236567eb0aSlh195018 extern int ses_uscsi_cmd(ses_softc_t *, Uscmd *, int); 3247c478bd9Sstevel@tonic-gate extern int ses_io_time; 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate #ifdef DEBUG 3277c478bd9Sstevel@tonic-gate extern int ses_debug; 3287c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) */ 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) || defined(_KMEMUSER) */ 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3367c478bd9Sstevel@tonic-gate } 3377c478bd9Sstevel@tonic-gate #endif 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate #endif /* _SYS_SCSI_TARGETS_SES_H */ 340