1 /* @(#)scsilog.h	1.5 06/09/13 Copyright 1998-2004 J. Schilling */
2 /*
3  *	Definitions for SCSI log structures
4  *
5  *	Copyright (c) 1998-2004 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_SCSILOG_H
22 #define	_SCSILOG_H
23 
24 #include <schily/utypes.h>
25 #include <schily/btorder.h>
26 
27 /*
28  * Definitions for the Page Control field
29  */
30 #define	LOG_TRESH	0		/* (Current) Treshold values	*/
31 #define	LOG_CUMUL	1		/* (Current) Cumulative values	*/
32 #define	LOG_DFL_TRESH	2		/* Default Treshold values	*/
33 #define	LOG_DFL_CUMUL	3		/* Default Cumulatice values	*/
34 
35 #if defined(_BIT_FIELDS_LTOH)	/* Intel bitorder */
36 
37 typedef struct scsi_log_header {	/* Log Page header		*/
38 	Ucbit	p_code	:6;		/* Page code			*/
39 	Ucbit	res	:2;		/* Reserved			*/
40 	Uchar	res1;			/* Reserved			*/
41 	Uchar	p_len[2];		/* Page len (n-3)		*/
42 } scsi_log_hdr;
43 
44 #else				/* Motorola bitorder */
45 
46 typedef struct scsi_log_header {	/* Log Page header		*/
47 	Ucbit	res	:2;		/* Reserved			*/
48 	Ucbit	p_code	:6;		/* Page code			*/
49 	Uchar	res1;			/* Reserved			*/
50 	Uchar	p_len[2];		/* Page len (n-3)		*/
51 } scsi_log_hdr;
52 
53 #endif
54 
55 #if defined(_BIT_FIELDS_LTOH)	/* Intel bitorder */
56 
57 typedef struct scsi_logp_header {	/* Log Parameter header		*/
58 	Uchar	p_code[2];		/* Parameter code		*/
59 	Ucbit	lp	:1;		/* List Parameter		*/
60 	Ucbit	res2_1	:1;		/* Reserved			*/
61 	Ucbit	tmc	:2;		/* Treshold met Criteria	*/
62 	Ucbit	etc	:1;		/* Enable Treshold Comarison	*/
63 	Ucbit	tds	:1;		/* Target Save Disable		*/
64 	Ucbit	ds	:1;		/* Disble Save			*/
65 	Ucbit	du	:1;		/* Disable Update		*/
66 	Uchar	p_len;			/* Parameter len (n-3)		*/
67 } scsi_logp_hdr;
68 
69 #else				/* Motorola bitorder */
70 
71 typedef struct scsi_logp_header {	/* Log Parameter header		*/
72 	Uchar	p_code[2];		/* Parameter code		*/
73 	Ucbit	du	:1;		/* Disable Update		*/
74 	Ucbit	ds	:1;		/* Disble Save			*/
75 	Ucbit	tds	:1;		/* Target Save Disable		*/
76 	Ucbit	etc	:1;		/* Enable Treshold Comarison	*/
77 	Ucbit	tmc	:2;		/* Treshold met Criteria	*/
78 	Ucbit	res2_1	:1;		/* Reserved			*/
79 	Ucbit	lp	:1;		/* List Parameter		*/
80 	Uchar	p_len;			/* Parameter len (n-3)		*/
81 } scsi_logp_hdr;
82 
83 #endif
84 
85 struct scsi_logpage_0 {
86 	scsi_log_hdr	hdr;		/* Log Page header		*/
87 	Uchar		p_code[1];	/* List of supported log pages	*/
88 };
89 
90 /*
91  * Log Pages of the Pioneer DVD-R S101
92  */
93 struct pioneer_logpage_30_0 {
94 	scsi_logp_hdr	hdr;		/* Log Page header		*/
95 	Uchar		total_poh[4];	/* Total time powered on (hours)*/
96 };
97 
98 struct pioneer_logpage_30_1 {
99 	scsi_logp_hdr	hdr;		/* Log Page header		*/
100 	Uchar		laser_poh[4];	/* Total time of laser turned on*/
101 };
102 
103 struct pioneer_logpage_30_2 {
104 	scsi_logp_hdr	hdr;		/* Log Page header		*/
105 	Uchar		record_poh[4];	/* Total time of recording	*/
106 };
107 
108 extern	int	log_sense		__PR((SCSI *scgp, caddr_t bp, int cnt, int page, int pc, int pp));
109 extern	BOOL	has_log_page		__PR((SCSI *scgp, int page, int pc));
110 extern	int	get_log			__PR((SCSI *scgp, caddr_t bp, int *lenp, int page, int pc, int pp));
111 extern	void	print_logpages		__PR((SCSI *scgp));
112 
113 #endif	/* _SCSILOG_H */
114