xref: /freebsd/sys/cam/ctl/ctl_error.h (revision 5608fd23c27fa1e8ee595d7b678cbfd35d657fbe)
1 /*-
2  * Copyright (c) 2003 Silicon Graphics International Corp.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions, and the following disclaimer,
10  *    without modification.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    substantially similar to the "NO WARRANTY" disclaimer below
13  *    ("Disclaimer") and any redistribution must be conditioned upon
14  *    including a substantially similar Disclaimer requirement for further
15  *    binary redistribution.
16  *
17  * NO WARRANTY
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGES.
29  *
30  * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_error.h#1 $
31  * $FreeBSD$
32  */
33 /*
34  * Function definitions for various error reporting routines used both
35  * within CTL and various CTL clients.
36  *
37  * Author: Ken Merry <ken@FreeBSD.org>
38  */
39 
40 #include <machine/stdarg.h>
41 
42 #ifndef	_CTL_ERROR_H_
43 #define	_CTL_ERROR_H_
44 
45 void ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lun,
46 			   scsi_sense_data_type sense_format, int current_error,
47 			   int sense_key, int asc, int ascq, va_list ap);
48 void ctl_set_sense_data(struct scsi_sense_data *sense_data, void *lun,
49 			scsi_sense_data_type sense_format, int current_error,
50 			int sense_key, int asc, int ascq, ...);
51 void ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key,
52 		   int asc, int ascq, ...);
53 void ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src,
54 		      struct scsi_sense_data_desc *sense_dest);
55 void ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
56 			struct scsi_sense_data_fixed *sense_dest);
57 void ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq);
58 ctl_ua_type ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense,
59 			 scsi_sense_data_type sense_format);
60 void ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio);
61 void ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag);
62 void ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
63 			   int field, int bit_valid, int bit);
64 void ctl_set_invalid_opcode(struct ctl_scsiio *ctsio);
65 void ctl_set_param_len_error(struct ctl_scsiio *ctsio);
66 void ctl_set_already_locked(struct ctl_scsiio *ctsio);
67 void ctl_set_unsupported_lun(struct ctl_scsiio *ctsio);
68 void ctl_set_lun_standby(struct ctl_scsiio *ctsio);
69 void ctl_set_internal_failure(struct ctl_scsiio *ctsio, int sks_valid,
70 			      uint16_t retry_count);
71 void ctl_set_medium_error(struct ctl_scsiio *ctsio);
72 void ctl_set_aborted(struct ctl_scsiio *ctsio);
73 void ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio);
74 void ctl_set_lun_stopped(struct ctl_scsiio *ctsio);
75 void ctl_set_lun_not_ready(struct ctl_scsiio *ctsio);
76 void ctl_set_illegal_pr_release(struct ctl_scsiio *ctsio);
77 void ctl_set_medium_format_corrupted(struct ctl_scsiio *ctsio);
78 void ctl_set_medium_magazine_inaccessible(struct ctl_scsiio *ctsio);
79 void ctl_set_data_phase_error(struct ctl_scsiio *ctsio);
80 void ctl_set_reservation_conflict(struct ctl_scsiio *ctsio);
81 void ctl_set_queue_full(struct ctl_scsiio *ctsio);
82 void ctl_set_busy(struct ctl_scsiio *ctsio);
83 void ctl_set_task_aborted(struct ctl_scsiio *ctsio);
84 void ctl_set_success(struct ctl_scsiio *ctsio);
85 
86 #endif	/* _CTL_ERROR_H_ */
87