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