sense.h revision 3a27445b7bb9d714bc575b48634a50f1f599fdab
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "%Z%%M% %I% %E% SMI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Implementation Variant defines
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for SCSI Sense Information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * These are 'pseudo' sense keys for common Sun implementation driver
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * detected errors. Note that they start out as being higher than the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * legal key numbers for standard SCSI.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SUN_KEY_FATAL 0x10 /* driver, scsi handshake failure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SUN_KEY_TIMEOUT 0x11 /* driver, command timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SUN_KEY_LENGTH 0x14 /* driver, length error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SUN_KEY_WRONGMEDIA 0x16 /* driver, wrong tape media */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_IMPL_SENSE_KEYS 7 /* seven extra keys */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common sense length allocation sufficient for this implementation.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (roundup(sizeof (struct scsi_extended_sense), sizeof (int)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Minimum useful Sense Length value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Specific variants to the Extended Sense structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Defines for:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Emulex MD21 SCSI/ESDI Controller
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Emulex MT02 SCSI/QIC-36 Controller.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1) The Emulex controllers put error class and error code into the byte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * right after the 'additional sense length' field in Extended Sense.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) Except that some people state that this isn't so for the MD21- only
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) These are valid on Extended Sense for the MD21, FORMAT command only:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function prototypes for descriptor-format sense data functions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint8_t *scsi_find_sense_descr(uint8_t *sense_buffer, int sense_buf_len,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function prototypes for format-neutral sense data functions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t scsi_sense_info_uint64(uint8_t *sense_buffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t scsi_sense_cmdspecific_uint64(uint8_t *sense_buffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid scsi_ext_sense_fields(uint8_t *sense_buffer, int sense_buf_len,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t **information, uint8_t **cmd_spec_info, uint8_t **fru_code,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint scsi_validate_sense(uint8_t *sense_buffer, int sense_buf_len, int *flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return codes for scsi_validate_sense
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flags from scsi_validate_sense
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SNS_BUF_OVERFLOW 1 /* Sense buffer too small */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SNS_BUF_DEFERRED 2 /* Sense data is for prior operation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SYS_SCSI_IMPL_SENSE_H */