1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/* $OpenBSD: scsi_ses.h,v 1.2 2005/04/09 15:24:16 marco Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef _SCSI_SES_H_
#define _SCSI_SES_H_
/* FIXME add all other elements as well currently this only contains "device" */
struct ses_config_page {
/* diagnostic page header */
u_int8_t page_code;
u_int8_t nr_sub_enc;
u_int8_t length[2]; /* n - 3 */
u_int8_t gencode[4];
/* enclosure descriptor header */
u_int8_t rsvd;
u_int8_t sub_enc_id;
u_int8_t nr_elem_typ; /* = T */
u_int8_t enc_desc_len; /* = m */
/* enclosure descriptor */
u_int8_t enc_logical_id[8];
u_int8_t enc_vendor_id[8];
u_int8_t prod_id[16];
u_int8_t prod_rev[4];
u_int8_t vendor[0]; /* 48 - (11 + m) */
/* type descriptor header list */
/* ses_type_descr_hdr[T] */
/* type descriptor text */
/* variable, length n */
};
struct ses_type_desc_hdr {
u_int8_t elem_type;
u_int8_t nr_elem;
u_int8_t sub_enc_id;
u_int8_t type_desc_len;
};
/* control structures, control structs are uses when SENDING */
struct ses_dev_elmt_ctrl_diag {
u_int8_t common_ctrl;
u_int8_t reserved;
u_int8_t byte3;
#define SDECD_RQST_IDENT 0x02
#define SDECD_RQST_REMOVE 0x04
#define SDECD_RQST_INSERT 0x08
#define SDECD_DONT_REMOVE 0x40
#define SDECD_ACTIVE 0x80
u_int8_t byte4;
#define SDECD_ENABLE_BYP_B 0x04
#define SDECD_ENABLE_BYP_A 0x08
#define SDECD_DEVICE_OFF 0x10
#define SDECD_RQST_FAULT 0x20
};
struct ses_enc_ctrl_diag_page {
u_int8_t page_code;
u_int8_t byte2;
#define SECDP_UNREC 0x01
#define SECDP_CRIT 0x02
#define SECDP_NONCRIT 0x04
#define SECDP_INFO 0x08
u_int8_t length[2];
u_int8_t gencode[4];
u_int8_t overallctrl[4];
/* first element starts here */
struct ses_dev_elmt_ctrl_diag elmts[0];
};
/* status structures, status structs are uses when RECEIVING */
struct ses_dev_elmt_status_diag {
u_int8_t common_status;
u_int8_t slot_addr;
u_int8_t byte3;
#define SDESD_REPORT 0x01
#define SDESD_IDENT 0x02
#define SDESD_RMV 0x04
#define SDESD_RDY_INSRT 0x08
#define SDESD_ENC_BYP_B 0x10
#define SDESD_ENC_BYP_A 0x20
#define SDESD_DONT_REMV 0x40
#define SDESD_CLNT_BYP_A 0x80
u_int8_t byte4;
#define SDESD_DEV_BYP_B 0x01
#define SDESD_DEV_BYP_A 0x02
#define SDESD_BYP_B 0x04
#define SDESD_BYP_A 0x08
#define SDESD_DEV_OFF 0x10
#define SDESD_FLT_RQSTD 0x20
#define SDESD_FLT_SENSED 0x40
#define SDESD_CLNT_BYP_B 0x80
};
struct ses_enc_stat_diag_page {
u_int8_t page_code;
u_int8_t byte2;
#define SESDP_UNREC 0x01
#define SESDP_CRIT 0x02
#define SESDP_NONCRIT 0x04
#define SESDP_INFO 0x08
u_int8_t length[2];
u_int8_t gencode[4];
u_int8_t overallstat[4];
struct ses_dev_elmt_status_diag elmts[0];
};
#endif /* _SCSI_SES_H_ */
|