10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*11871SMarek.Pospisil@Sun.COM * Common Development and Distribution License (the "License"). 6*11871SMarek.Pospisil@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*11871SMarek.Pospisil@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SMSERVER_H_ 270Sstevel@tonic-gate #define _SMSERVER_H_ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <door.h> 340Sstevel@tonic-gate #include <thread.h> 350Sstevel@tonic-gate #include <synch.h> 360Sstevel@tonic-gate #include <sys/dkio.h> 370Sstevel@tonic-gate #include <bsm/audit.h> 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define RQ_LEN 18 400Sstevel@tonic-gate #define MAX_RQ_LEN 32 410Sstevel@tonic-gate #define MAX_CDB_LEN 32 420Sstevel@tonic-gate 430Sstevel@tonic-gate #define smedia_service "/var/run/smedia_svc" 440Sstevel@tonic-gate #define DEFAULT_SMEDIAD_DEVDIR "/usr/lib/smedia" 450Sstevel@tonic-gate 460Sstevel@tonic-gate #define INIT_NOT_DONE 0 470Sstevel@tonic-gate #define INIT_DONE 1 480Sstevel@tonic-gate #define INIT_IN_PROGRESS 2 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* SCSI FORMAT UNIT cdb[1] #defines */ 510Sstevel@tonic-gate #define FMTDATA 0x10 520Sstevel@tonic-gate #define CMPLIST 0x08 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* Defect list header data[1] #defines */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate #define VS 0x1 570Sstevel@tonic-gate #define IMMED 0x2 580Sstevel@tonic-gate #define DSP 0x4 590Sstevel@tonic-gate #define IP 0x8 600Sstevel@tonic-gate #define STPF 0x10 610Sstevel@tonic-gate #define DCRT 0x20 620Sstevel@tonic-gate #define DPRY 0x40 630Sstevel@tonic-gate #define FOV 0x80 640Sstevel@tonic-gate 650Sstevel@tonic-gate #define DEFERRED_ERROR 0x71 660Sstevel@tonic-gate #define AWRE 0x80 670Sstevel@tonic-gate 680Sstevel@tonic-gate #define MODE_SENSE_PARAM_HDR_LEN 4 690Sstevel@tonic-gate #define MODE_PARAM_BLOCK_LEN 8 700Sstevel@tonic-gate #define AWRE_OFFSET (MODE_SENSE_PARAM_HDR_LEN + MODE_PARAM_BLOCK_LEN + 2) 710Sstevel@tonic-gate #define BLOCK_LEN_OFFSET (MODE_SENSE_PARAM_HDR_LEN + 5) 720Sstevel@tonic-gate #define SKSV_FIELD 0x80 730Sstevel@tonic-gate #define SKSV_OFFSET 15 740Sstevel@tonic-gate #define FORMAT_PROGRESS_INDICATOR_OFFSET_0 16 750Sstevel@tonic-gate #define FORMAT_PROGRESS_INDICATOR_OFFSET_1 17 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* #defines for protect medode field */ 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define UNLOCK_MODE 0x0 800Sstevel@tonic-gate #define WRITE_PROTECT_MODE 0x2 810Sstevel@tonic-gate #define PASSWD_WRITE_PROTECT_MODE 0x3 820Sstevel@tonic-gate #define READ_WRITE_PROTECT_MODE 0x5 830Sstevel@tonic-gate #define TEMP_UNLOCK_MODE 0x8 840Sstevel@tonic-gate 850Sstevel@tonic-gate /* #defines for CARTRIDGE STATUS PAGE */ 860Sstevel@tonic-gate 870Sstevel@tonic-gate #define CARTRIDGE_STATUS_PAGE 2 880Sstevel@tonic-gate #define NON_SENSE_HDR_LEN 0x2 890Sstevel@tonic-gate #define PROTECT_MODE_OFFSET 19 900Sstevel@tonic-gate #define DISK_STATUS_OFFSET 1 910Sstevel@tonic-gate 920Sstevel@tonic-gate 930Sstevel@tonic-gate /* error reporting mechanism */ 940Sstevel@tonic-gate void fatal(const char *, ...); 950Sstevel@tonic-gate void info(const char *, ...); 960Sstevel@tonic-gate void warning(const char *, ...); 970Sstevel@tonic-gate void debug(uint_t, const char *, ...); 980Sstevel@tonic-gate void setlog(const char *); 990Sstevel@tonic-gate void flushlog(); 1000Sstevel@tonic-gate void quit(const char *, ...); 1010Sstevel@tonic-gate void noise(const char *, ...); 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate typedef struct server_data { 1040Sstevel@tonic-gate char sd_init_state; 1050Sstevel@tonic-gate mutex_t sd_init_lock; 1060Sstevel@tonic-gate cond_t sd_init_cv; 1070Sstevel@tonic-gate int sd_door; 1080Sstevel@tonic-gate int sd_fd; 1090Sstevel@tonic-gate } server_data_t; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate typedef enum { 1120Sstevel@tonic-gate SMEDIA_SUCCESS = 0x0, 1130Sstevel@tonic-gate SMEDIA_FAILURE /* general failure */ 1140Sstevel@tonic-gate } smedia_errno_t; 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate typedef struct door_data { 1170Sstevel@tonic-gate mutex_t dd_lock; /* lock to protect entire structure */ 1180Sstevel@tonic-gate mutex_t dd_threadlock; /* lock to protect dd_thread field */ 1190Sstevel@tonic-gate sigset_t dd_newset; /* signal set handled by the server */ 1200Sstevel@tonic-gate cond_t dd_cv; /* client_door_descriptor cv */ 1210Sstevel@tonic-gate cond_t dd_cv_bind; /* client door descriptor bind cv */ 1220Sstevel@tonic-gate int32_t dd_id; /* for future use. To store unique id */ 1231137Sarutz door_desc_t dd_desc[2]; /* [0] : Client Door descriptor */ 1241137Sarutz /* [1] : Death Door decriptor */ 1250Sstevel@tonic-gate thread_t dd_thread; /* thread bound to the client door */ 1260Sstevel@tonic-gate door_cred_t dd_cred; /* credentials of client */ 1270Sstevel@tonic-gate int32_t dd_fd; /* device file descriptor */ 1280Sstevel@tonic-gate void *dd_buf; /* mmapped buffer of client */ 1290Sstevel@tonic-gate int32_t dd_buf_len; /* size of the mmapped buffer */ 1300Sstevel@tonic-gate int32_t dd_buffd; /* mmapped file descriptor */ 1310Sstevel@tonic-gate int32_t dd_sector_size; /* sector size of the device */ 1320Sstevel@tonic-gate struct stat dd_stat; /* stat of the dd_fd */ 1330Sstevel@tonic-gate struct dk_cinfo dd_dkinfo; 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate au_id_t audit_auid; /* auid of user writing audit record */ 1360Sstevel@tonic-gate uid_t audit_uid; /* uid of user writing audit record */ 1370Sstevel@tonic-gate uid_t audit_euid; /* euid of user writing audit record */ 1380Sstevel@tonic-gate gid_t audit_gid; /* gid of user writing audit record */ 1390Sstevel@tonic-gate gid_t audit_egid; /* euid of user writing audit record */ 1400Sstevel@tonic-gate pid_t audit_pid; /* pid of user writing audit record */ 1410Sstevel@tonic-gate au_tid_addr_t audit_tid; /* tid of user writing audit record */ 1420Sstevel@tonic-gate int audit_na; /* 0 if event is attributable */ 1430Sstevel@tonic-gate au_mask_t audit_namask; /* not attributable flags */ 1440Sstevel@tonic-gate au_event_t audit_event; /* id of event being audited */ 1450Sstevel@tonic-gate int audit_sorf; /* success or failure of audit_event */ 1460Sstevel@tonic-gate char *audit_user; /* text version of audit_uid */ 1470Sstevel@tonic-gate au_asid_t audit_asid; /* asid of process writing record */ 1480Sstevel@tonic-gate char *audit_path; /* path token */ 149*11871SMarek.Pospisil@Sun.COM uint32_t audit_policy; /* kernel audit policy */ 1500Sstevel@tonic-gate struct auditpinfo_addr audit_ap; 1510Sstevel@tonic-gate char audit_text[128]; 1520Sstevel@tonic-gate char audit_text1[128]; 1530Sstevel@tonic-gate } door_data_t; 1540Sstevel@tonic-gate 1551137Sarutz /* Symbols to simplify access of door_data_t */ 1561137Sarutz #define dd_cdoor dd_desc[0] /* Client Door descriptor */ 1571137Sarutz #define dd_ddoor dd_desc[1] /* Death Door descriptor */ 1581137Sarutz #define dd_cdoor_descriptor dd_cdoor.d_data.d_desc.d_descriptor 1591137Sarutz #define dd_ddoor_descriptor dd_ddoor.d_data.d_desc.d_descriptor 1601137Sarutz 1610Sstevel@tonic-gate typedef enum { 1620Sstevel@tonic-gate SMEDIA_CNUM_OPEN_FD = 0x1, 1630Sstevel@tonic-gate SMEDIA_CNUM_GET_DEVICE_INFO, 1640Sstevel@tonic-gate SMEDIA_CNUM_GET_MEDIUM_PROPERTY, 1650Sstevel@tonic-gate SMEDIA_CNUM_GET_PROTECTION_STATUS, 1660Sstevel@tonic-gate SMEDIA_CNUM_SET_PROTECTION_STATUS, 1670Sstevel@tonic-gate SMEDIA_CNUM_RAW_READ, 1680Sstevel@tonic-gate SMEDIA_CNUM_RAW_WRITE, 1690Sstevel@tonic-gate SMEDIA_CNUM_FORMAT, 1700Sstevel@tonic-gate SMEDIA_CNUM_CHECK_FORMAT_STATUS, 1710Sstevel@tonic-gate SMEDIA_CNUM_EJECT, 1720Sstevel@tonic-gate SMEDIA_CNUM_REASSIGN_BLOCK, 1730Sstevel@tonic-gate SMEDIA_CNUM_ERROR, 1740Sstevel@tonic-gate SMEDIA_CNUM_CLOSE, 1750Sstevel@tonic-gate SMEDIA_CNUM_SET_SHFD, 1760Sstevel@tonic-gate SMEDIA_CNUM_PING, 1770Sstevel@tonic-gate SMEDIA_CNUM_USCSI_CMD 1780Sstevel@tonic-gate } smedia_callnumber_t; 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate typedef struct { 1810Sstevel@tonic-gate smedia_callnumber_t cnum; /* service call number */ 1820Sstevel@tonic-gate char buf[1]; /* buffer containing input arguments */ 1830Sstevel@tonic-gate } smedia_req_t; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate typedef struct { 1860Sstevel@tonic-gate smedia_callnumber_t cnum; /* service call number */ 1870Sstevel@tonic-gate char buf[1]; /* buffer containing the results */ 1880Sstevel@tonic-gate } smedia_ret_t; 1890Sstevel@tonic-gate 1900Sstevel@tonic-gate typedef struct smedia_reqping { 1910Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_PING */ 1920Sstevel@tonic-gate } smedia_reqping_t; 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate typedef struct smedia_retping { 1950Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_PING */ 1960Sstevel@tonic-gate } smedia_retping_t; 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate /* 1990Sstevel@tonic-gate * SMEDIA open device 2000Sstevel@tonic-gate */ 2010Sstevel@tonic-gate typedef struct smedia_reqopen { 2020Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_OPEN */ 2030Sstevel@tonic-gate int oflag; 2040Sstevel@tonic-gate int omode; 2050Sstevel@tonic-gate } smedia_reqopen_t; 2060Sstevel@tonic-gate 2070Sstevel@tonic-gate typedef struct smedia_retopen { 2080Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_OPEN */ 2090Sstevel@tonic-gate } smedia_retopen_t; 2100Sstevel@tonic-gate 2110Sstevel@tonic-gate typedef struct smedia_requscsi_cmd { 2120Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_USCSI_CMD */ 2130Sstevel@tonic-gate int32_t uscsi_flags; 2140Sstevel@tonic-gate short uscsi_timeout; 2150Sstevel@tonic-gate char uscsi_cdb[MAX_CDB_LEN]; 2160Sstevel@tonic-gate int32_t uscsi_buflen; 2170Sstevel@tonic-gate uchar_t uscsi_cdblen; 2180Sstevel@tonic-gate uchar_t uscsi_rqlen; 2190Sstevel@tonic-gate } smedia_requscsi_cmd_t; 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate typedef struct smedia_retuscsi_cmd { 2220Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_USCSI_CMD */ 2230Sstevel@tonic-gate int32_t uscsi_retval; 2240Sstevel@tonic-gate int32_t uscsi_errno; 2250Sstevel@tonic-gate short uscsi_status; 2260Sstevel@tonic-gate int32_t uscsi_resid; 2270Sstevel@tonic-gate uchar_t uscsi_rqstatus; 2280Sstevel@tonic-gate uchar_t uscsi_rqresid; 2290Sstevel@tonic-gate char uscsi_rqbuf[MAX_RQ_LEN]; 2300Sstevel@tonic-gate } smedia_retuscsi_cmd_t; 2310Sstevel@tonic-gate 2320Sstevel@tonic-gate typedef struct smedia_reqget_device_info { 2330Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_DEVICE_INFO */ 2340Sstevel@tonic-gate } smedia_reqget_device_info_t; 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate typedef struct smedia_reqset_shfd { 2370Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_SET_SHFD */ 2380Sstevel@tonic-gate int32_t fdbuf_len; 2390Sstevel@tonic-gate } smedia_reqset_shfd_t; 2400Sstevel@tonic-gate 2410Sstevel@tonic-gate typedef struct smedia_retget_device_info { 2420Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_DEVICE_INFO */ 2430Sstevel@tonic-gate smdevice_info_t smdevinfo; 2440Sstevel@tonic-gate uchar_t sm_version; 2450Sstevel@tonic-gate int32_t sm_interface_type; 2460Sstevel@tonic-gate char sm_vendor_name[32]; 2470Sstevel@tonic-gate char sm_product_name[32]; 2480Sstevel@tonic-gate char sm_firmware_version[32]; 2490Sstevel@tonic-gate } smedia_retget_device_info_t; 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate typedef struct smedia_reqget_medium_property { 2520Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_MEDIUM_PROPERTY */ 2530Sstevel@tonic-gate } smedia_reqget_medium_property_t; 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate typedef struct smedia_retget_medium_property { 2560Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_MEDIUM_PROPERTY */ 2570Sstevel@tonic-gate smmedium_prop_t smprop; 2580Sstevel@tonic-gate } smedia_retget_medium_property_t; 2590Sstevel@tonic-gate 2600Sstevel@tonic-gate typedef struct smedia_reqget_protection_status { 2610Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_PROTECTION_STATUS */ 2620Sstevel@tonic-gate } smedia_reqget_protection_status_t; 2630Sstevel@tonic-gate 2640Sstevel@tonic-gate typedef struct smedia_retget_protection_status { 2650Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_GET_PROTECTION_STATUS */ 2660Sstevel@tonic-gate smwp_state_t prot_state; 2670Sstevel@tonic-gate } smedia_retget_protection_status_t; 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate typedef struct smedia_reqset_protection_status { 2700Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_SET_PROTECTION_STATUS */ 2710Sstevel@tonic-gate smwp_state_t prot_state; 2720Sstevel@tonic-gate } smedia_reqset_protection_status_t; 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate typedef struct smedia_retset_protection_status { 2750Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_SET_PROTECTION_STATUS */ 2760Sstevel@tonic-gate } smedia_retset_protection_status_t; 2770Sstevel@tonic-gate 2780Sstevel@tonic-gate typedef struct smedia_reqraw_read { 2790Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_RAW_READ */ 2800Sstevel@tonic-gate diskaddr_t blockno; 2810Sstevel@tonic-gate int32_t nbytes; 2820Sstevel@tonic-gate } smedia_reqraw_read_t; 2830Sstevel@tonic-gate 2840Sstevel@tonic-gate typedef struct smedia_retraw_read { 2850Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_RAW_READ */ 2860Sstevel@tonic-gate int32_t nbytes; /* bytes read */ 2870Sstevel@tonic-gate char buf[1]; /* buffer size is nbytes long */ 2880Sstevel@tonic-gate } smedia_retraw_read_t; 2890Sstevel@tonic-gate 2900Sstevel@tonic-gate typedef struct smedia_reqraw_write { 2910Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_RAW_WRITE */ 2920Sstevel@tonic-gate diskaddr_t blockno; 2930Sstevel@tonic-gate int32_t nbytes; 2940Sstevel@tonic-gate char buf[1]; /* buffer size is nbytes long */ 2950Sstevel@tonic-gate } smedia_reqraw_write_t; 2960Sstevel@tonic-gate 2970Sstevel@tonic-gate typedef struct smedia_retraw_write { 2980Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_RAW_WRITE */ 2990Sstevel@tonic-gate int32_t nbytes; /* bytes written */ 3000Sstevel@tonic-gate } smedia_retraw_write_t; 3010Sstevel@tonic-gate 3020Sstevel@tonic-gate typedef struct smedia_reqformat { 3030Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_FORMAT */ 3040Sstevel@tonic-gate uint_t flavor; 3050Sstevel@tonic-gate uint_t mode; 3060Sstevel@tonic-gate } smedia_reqformat_t; 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate typedef struct smedia_retformat { 3090Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_FORMAT */ 3100Sstevel@tonic-gate } smedia_retformat_t; 3110Sstevel@tonic-gate 3120Sstevel@tonic-gate typedef struct smedia_reqcheck_format_status { 3130Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_CHECK_FORMAT_STATUS */ 3140Sstevel@tonic-gate } smedia_reqcheck_format_status_t; 3150Sstevel@tonic-gate 3160Sstevel@tonic-gate typedef struct smedia_retcheck_format_status { 3170Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_CHECK_FORMAT_STATUS */ 3180Sstevel@tonic-gate int percent_complete; 3190Sstevel@tonic-gate } smedia_retcheck_format_status_t; 3200Sstevel@tonic-gate 3210Sstevel@tonic-gate typedef struct smedia_reqreassign_block { 3220Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_REASSIGN_BLOCK */ 3230Sstevel@tonic-gate diskaddr_t blockno; 3240Sstevel@tonic-gate } smedia_reqreassign_block_t; 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate typedef struct smedia_retreassign_block { 3270Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_REASSIGN_BLOCK */ 3280Sstevel@tonic-gate } smedia_retreassign_block_t; 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate typedef struct { 3310Sstevel@tonic-gate smedia_callnumber_t cnum; /* SMEDIA_CNUM_ERROR */ 3320Sstevel@tonic-gate smedia_callnumber_t in_cnum; /* requested service number */ 3330Sstevel@tonic-gate smedia_errno_t errnum; 3340Sstevel@tonic-gate } smedia_reterror_t; 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate typedef union { 3370Sstevel@tonic-gate smedia_req_t in; /* req arguments */ 3380Sstevel@tonic-gate smedia_ret_t out; /* out results */ 3390Sstevel@tonic-gate smedia_reqping_t reqping; 3400Sstevel@tonic-gate smedia_retping_t retping; 3410Sstevel@tonic-gate smedia_reqopen_t reqopen; 3420Sstevel@tonic-gate smedia_retopen_t retopen; 3430Sstevel@tonic-gate smedia_reqget_device_info_t reqget_device_info; 3440Sstevel@tonic-gate smedia_retget_device_info_t retget_device_info; 3450Sstevel@tonic-gate smedia_reqget_medium_property_t reqget_medium_property; 3460Sstevel@tonic-gate smedia_retget_medium_property_t retget_medium_property; 3470Sstevel@tonic-gate smedia_reqget_protection_status_t reqget_protection_status; 3480Sstevel@tonic-gate smedia_retget_protection_status_t retget_protection_status; 3490Sstevel@tonic-gate smedia_reqset_protection_status_t reqset_protection_status; 3500Sstevel@tonic-gate smedia_retset_protection_status_t retset_protection_status; 3510Sstevel@tonic-gate smedia_reqraw_read_t reqraw_read; 3520Sstevel@tonic-gate smedia_retraw_read_t retraw_read; 3530Sstevel@tonic-gate smedia_reqraw_write_t reqraw_write; 3540Sstevel@tonic-gate smedia_retraw_write_t retraw_write; 3550Sstevel@tonic-gate smedia_reqformat_t reqformat; 3560Sstevel@tonic-gate smedia_retformat_t retformat; 3570Sstevel@tonic-gate smedia_reqcheck_format_status_t reqcheck_format_status; 3580Sstevel@tonic-gate smedia_retcheck_format_status_t retcheck_format_status; 3590Sstevel@tonic-gate smedia_reqreassign_block_t reqreassign_block; 3600Sstevel@tonic-gate smedia_retreassign_block_t retreassign_block; 3610Sstevel@tonic-gate smedia_reterror_t reterror; 3620Sstevel@tonic-gate smedia_reqset_shfd_t reqset_shfd; 3630Sstevel@tonic-gate smedia_requscsi_cmd_t requscsi_cmd; 3640Sstevel@tonic-gate smedia_retuscsi_cmd_t retuscsi_cmd; 3650Sstevel@tonic-gate } smedia_services_t; 3660Sstevel@tonic-gate 3670Sstevel@tonic-gate #define SCSI_GENERIC 1 3680Sstevel@tonic-gate #define SCSI_IOMEGA 2 3690Sstevel@tonic-gate #define SCSI_FLOPPY 3 3700Sstevel@tonic-gate 3710Sstevel@tonic-gate /* 3720Sstevel@tonic-gate * Crude algorithm for calculating format timeout. 3730Sstevel@tonic-gate * 30min + 5min/100MB => 3740Sstevel@tonic-gate * 35min for 100MB ZIP 3750Sstevel@tonic-gate * 42.5 min for 250MB ZIP 3760Sstevel@tonic-gate * 127 min for 2GB Jaz 3770Sstevel@tonic-gate * It is OK for now as this is just an upper limit by which the 3780Sstevel@tonic-gate * format should complete. 3790Sstevel@tonic-gate */ 3800Sstevel@tonic-gate 3810Sstevel@tonic-gate #define FORMAT_TIMEOUT(n) (1800 + ((n)/682)) 3820Sstevel@tonic-gate 3830Sstevel@tonic-gate #define WA_BIT 0x10 /* The word align bit for ATAPI devices */ 3840Sstevel@tonic-gate /* 3850Sstevel@tonic-gate * Non sense data length for catridge status page. 3860Sstevel@tonic-gate * Should be 63, but IDE driver panics with a non-aligned 3870Sstevel@tonic-gate * data transfer. 3880Sstevel@tonic-gate */ 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate #define ND_LENGTH 64 3910Sstevel@tonic-gate 3920Sstevel@tonic-gate /* 3930Sstevel@tonic-gate * Vendor specific commands from Iomega 3940Sstevel@tonic-gate */ 3950Sstevel@tonic-gate 3960Sstevel@tonic-gate #define IOMEGA_NONSENSE_CMD 0x6 3970Sstevel@tonic-gate #define IOMEGA_CATRIDGE_PROTECT 0xC 3980Sstevel@tonic-gate 3990Sstevel@tonic-gate #ifdef __cplusplus 4000Sstevel@tonic-gate } 4010Sstevel@tonic-gate #endif 4020Sstevel@tonic-gate 4030Sstevel@tonic-gate #endif /* _SMSERVER_H_ */ 404