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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* A5X00 Library definitions
*/
/*
* I18N message number ranges
* This file: 16000 - 16499
* Shared common messages: 1 - 1999
*/
#ifndef _A5K_H
#define _A5K_H
#ifdef __cplusplus
extern "C" {
#endif
/* Defines */
#define ENCLOSURE_PROD_ID "SENA"
#define ENCLOSURE_PROD_NAME "Network Array"
#define MAX_DRIVES_PER_BOX 22
#define MAX_DRIVES_DAK 12
#define L_WWN_LENGTH 16
#define BOX_ID_MASK 0x60
#define BOX_ID 0x0d
#define ALT_BOX_ID 0x10
#define MAX_IB_ELEMENTS 50
#define MAX_VEND_SPECIFIC_ENC 216
#define MAX_POSSIBLE_ELEMENTS 255
#define SET_RQST_INSRT 0
#define SET_RQST_RMV 1
#define OVERALL_STATUS 2
#define SET_FAULT 3
#define SET_DRV_ON 4
#define INSERT_DEVICE 106
#define REMOVE_DEVICE 114
/* device specific identification for display, etc */
#define DAK_OFF_NAME "Daktari official" /* inq response, prod ident */
#define DAK_PROD_STR "SUNWGS INT FCBPL"
#define UNDEF_ENC_TYPE 2
#define DAK_ENC_TYPE 1
#define SENA_ENC_TYPE 0
/* Page defines */
#define L_PAGE_PAGE_LIST 0x00 /* Supported pages page */
#define L_PAGE_CONFIG 0x01 /* Configuration page */
#define L_PAGE_1 L_PAGE_CONFIG
#define L_PAGE_ENCL_CTL 0x02 /* Enclosure Control page */
#define L_PAGE_ENCL_STATUS 0x02 /* Enclosure status page */
#define L_PAGE_2 L_PAGE_ENCL_STATUS
#define L_PAGE_STRING 0x04
#define L_PAGE_4 L_PAGE_STRING
#define L_PAGE_7 0x07 /* Element Descriptor Page */
#define L_MAX_POSSIBLE_PAGES 255
#define L_MAX_SENAIB_PAGES 8
/*
* FRU types internal and external (host SES type)
*/
#define ELM_TYP_NONE 0x0 /* Unspecified */
#define ELM_TYP_DD 0x01 /* Disk Drive - device */
#define ELM_TYP_PS 0x02 /* Power Supply */
#define ELM_TYP_FT 0x03 /* Fan Tray - cooling element */
#define ELM_TYP_TS 0x04 /* Temperature Sensors */
#define ELM_TYP_FP 0x0c /* FPM screen - display */
#define ELM_TYP_KP 0x0d /* keypad on FPM - keypad device */
#define ELM_TYP_FL 0x0f /* Fibre Link module - SCSI port/trancvr */
#define ELM_TYP_LN 0x10 /* Language */
#define ELM_TYP_SP 0x11 /* Serial Port - communicaion port */
#define ELM_TYP_MB 0x80 /* Motherboard/Centerplane */
#define ELM_TYP_IB 0x81 /* IB(ESI) - controller electronics */
#define ELM_TYP_BP 0x82 /* BackPlane */
#define ELM_TYP_LO 0xa0 /* Loop Configuration */
#define ELM_TYP_OR 0xa2 /* Orientation */
#define S_HI_SPEED 0x5
/* code (status code) definitions */
#define S_OK 0x01
#define S_CRITICAL 0x02
#define S_NONCRITICAL 0x03
#define S_NOT_INSTALLED 0x05
#define S_NOT_AVAILABLE 0x07
/* String codes. */
#define L_WWN 0x01
#define L_PASSWORD 0x02
#define L_ENCL_NAME 0x03
#define L_BOX_ID 0x04
#define L_AUTO_LIP 0x05
/* Loop states */
#define L_NO_LOOP 0x80 /* drive not accessable */
#define L_INVALID_WWN 0x100
#define L_INVALID_MAP 0x200
#define L_NO_PATH_FOUND 0x400
/* d_state_flags definitions */
#define L_OK 0x00 /* NOTE: Must be zero. */
#define L_NOT_READY 0x01
#define L_NOT_READABLE 0x02
#define L_SPUN_DWN_D 0x04
#define L_RESERVED 0x08
#define L_OPEN_FAIL 0x10
#define L_NO_LABEL 0x20
#define L_SCSI_ERR 0x40
/* Values used by the l_led function */
#define L_LED_STATUS 0x00
#define L_LED_RQST_IDENTIFY 0x01
#define L_LED_ON 0x02
#define L_LED_OFF 0x04
/* Structure definitions */
typedef struct box_list_struct {
uchar_t prod_id_s[17]; /* NULL terminated string */
uchar_t b_name[33]; /* NULL terminated string */
char logical_path[MAXNAMELEN];
char b_physical_path[MAXNAMELEN];
char b_node_wwn_s[17]; /* NULL terminated string */
uchar_t b_node_wwn[8];
char b_port_wwn_s[17]; /* NULL terminated string */
uchar_t b_port_wwn[8];
struct box_list_struct *box_prev;
struct box_list_struct *box_next;
} Box_list;
typedef struct path_struct {
char *p_physical_path;
char *argv;
int slot_valid; /* Slot valid flag. */
int slot;
int f_flag; /* Front/rear flag. 1 = front */
int ib_path_flag;
} Path_struct;
/*
* Page 0
*/
typedef struct ib_page_0 {
uchar_t page_code;
uchar_t sub_enclosures;
ushort_t page_len;
uchar_t sup_page_codes[0x100];
} IB_page_0;
/*
* Page 1
* Configuration page
*/
typedef struct type_desc_hdr {
uchar_t type;
uchar_t num;
uchar_t sub_id;
uchar_t text_len;
} Type_desc_hdr;
typedef struct type_desc_text {
uchar_t text_element[256];
} Type_desc_text;
typedef struct ib_page_config {
uchar_t page_code;
uchar_t sub_enclosures;
ushort_t page_len;
uint_t gen_code;
/* Enclosure descriptor header */
uchar_t enc_res;
uchar_t enc_sub_id;
uchar_t enc_num_elem;
uchar_t enc_len;
/* Enclosure descriptor */
uchar_t enc_node_wwn[8];
uchar_t vend_id[8];
uchar_t prod_id[16];
uchar_t prod_revision[4];
uchar_t res[MAX_VEND_SPECIFIC_ENC];
Type_desc_hdr type_hdr[MAX_IB_ELEMENTS];
Type_desc_text text[MAX_IB_ELEMENTS];
} IB_page_config;
/*
* Page 2
* Enclosure status/control page
*/
/*
* Loop Configuration.
*/
typedef struct loop_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
uchar_t : 7, /* reserved */
split : 1;
} Loop_elem_st;
/*
* Language
*/
typedef struct language_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
ushort_t language_code;
} Lang_elem_st;
/*
* Tranceiver status
*/
typedef struct trans_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 7,
report : 1;
uchar_t : 3, /* reserved */
disabled : 1,
: 2,
lol : 1,
lsr_fail : 1;
} Trans_elem_st;
/*
* ESI Controller status
*/
typedef struct ctlr_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 7, /* reserved */
report : 1;
uchar_t : 4, /* reserved */
overtemp_alart : 1,
: 1, /* reserved */
ib_loop_1_fail : 1,
ib_loop_0_fail : 1;
} Ctlr_elem_st;
/*
* Backplane status
*/
typedef struct bp_element_status {
uchar_t select : 1,
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
uchar_t : 3, /* reserved */
disabled : 1,
en_bypass_a : 1, /* Not in Spec. */
en_bypass_b : 1, /* Not in Spec. */
byp_a_enabled : 1,
byp_b_enabled : 1;
} Bp_elem_st;
/*
* Temperature sensor status
*/
typedef struct temp_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
char degrees;
uchar_t : 4, /* reserved */
ot_fail : 1,
ot_warn : 1,
ut_fail : 1,
ut_warn : 1;
} Temp_elem_st;
typedef struct fan_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 2, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
uchar_t : 1, /* reserved */
fail : 1,
rqsted_on : 1,
: 2,
speed : 3;
} Fan_elem_st;
typedef struct ps_element_status {
uchar_t : 1, /* reserved */
prd_fail : 1,
: 1, /* reserved */
swap : 1,
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 4, /* reserved */
dc_over : 1,
dc_under : 1,
dc_over_i : 1,
: 1; /* reserved */
uchar_t : 1, /* reserved */
fail : 1,
rqsted_on : 1,
: 1,
ovrtmp_fail : 1,
temp_warn : 1,
ac_fail : 1,
dc_fail : 1;
} Ps_elem_st;
typedef struct device_element {
uchar_t select : 1,
prd_fail : 1,
disable : 1,
swap : 1,
code : 4;
uchar_t sel_id; /* Hard address */
uchar_t : 1,
dont_remove : 1,
: 2,
rdy_to_ins : 1,
rmv : 1,
ident : 1,
report : 1;
uchar_t : 1, /* reserved */
fault : 1,
fault_req : 1,
dev_off : 1,
en_bypass_a : 1,
en_bypass_b : 1,
bypass_a_en : 1,
bypass_b_en : 1;
} Dev_elem_st;
typedef struct interconnect_assem_status {
uchar_t : 4, /* reserved */
code : 4;
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
uchar_t : 7, /* reserved */
eprom_fail : 1;
} Interconnect_st;
typedef struct ib_page_2 {
uchar_t page_code;
union {
uchar_t res : 3, /* Reserved */
invop : 1,
info : 1,
non_crit : 1,
crit : 1,
unrec : 1;
uchar_t ab_cond;
} ui;
ushort_t page_len;
uint_t gen_code;
uint_t element[MAX_POSSIBLE_ELEMENTS];
} IB_page_2;
/*
* Page 4
*
* String page.
*/
typedef struct page4_name {
uchar_t page_code;
uchar_t : 8; /* reserved */
ushort_t page_len;
uchar_t string_code;
uchar_t : 7,
enable : 1;
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
uchar_t name[32];
} Page4_name;
typedef struct element_descriptor {
uchar_t : 8; /* reserved */
uchar_t : 8; /* reserved */
ushort_t desc_len;
uchar_t desc_string[0xff];
} Elem_desc;
typedef struct ib_page_7 {
uchar_t page_code;
uchar_t : 8; /* reserved */
ushort_t page_len;
uint_t gen_code;
Elem_desc element_desc[MAX_POSSIBLE_ELEMENTS];
} IB_page_7;
/* structure for IB */
typedef struct ib_state_struct {
uchar_t enclosure_name[33]; /* extra character is NULL */
IB_page_0 p0;
IB_page_config config; /* Enclosure configuration page */
IB_page_2 p2_s; /* Enclosure status page */
IB_page_7 p7_s; /* Element descriptor page */
int res;
int box_id;
struct dlist *ib_multipath_list;
} Ib_state;
/* Individual SENA drive state */
typedef struct l_disk_state_struct {
Dev_elem_st ib_status;
int l_state_flag; /* Loop State */
struct g_disk_state_struct g_disk_state;
} L_disk_state;
/*
* State of the Photon
*/
typedef struct l_state_struct {
Ib_state ib_tbl; /* state of controller */
int total_num_drv;
struct l_disk_state_struct drv_front[MAX_DRIVES_PER_BOX/2];
struct l_disk_state_struct drv_rear[MAX_DRIVES_PER_BOX/2];
} L_state;
/*
* Function Prototypes for the functions defined in libg_fc
* These are the functions that will be visible to an end user
* They are all CONTRACT PRIVATE
*/
#if defined(__STDC__)
extern int l_chk_null_wwn(Path_struct *, char *, L_state *, int);
extern int l_convert_name(char *, char **, struct path_struct **, int);
extern int l_dev_pwr_up_down(char *, struct path_struct *, int, int, int);
extern int l_device_present(char *, int, gfc_map_t *, int, char **);
extern int l_download(char *, char *, int, int);
extern int l_duplicate_names(Box_list *, char *, char *, int);
extern int l_encl_status_page_funcs(int, char *, int, char *,
struct l_state_struct *, int, int, int);
extern int l_format_ifp_status_msg(char *, int, int);
extern int l_format_fc_status_msg(char *, int, int);
extern void l_free_box_list(struct box_list_struct **);
extern int l_free_lstate(L_state **);
extern int l_get_allses(char *, struct box_list_struct *, struct dlist **,
int);
extern int l_get_box_list(struct box_list_struct **, int);
extern int l_get_disk_element_index(struct l_state_struct *, int *, int *);
extern int l_get_disk_port_status(char *, struct l_disk_state_struct *,
int, int);
extern int l_get_disk_status(char *, struct l_disk_state_struct *,
WWN_list *, int);
extern void l_get_drive_name(char *, int, int, char *);
extern int l_get_envsen(char *, uchar_t *, int, int);
extern int l_get_envsen_page(int, uchar_t *, int, uchar_t, int);
extern int l_get_ib_status(char *, struct l_state_struct *, int);
extern int l_get_individual_state(char *, struct l_disk_state_struct *,
Ib_state *, int, struct box_list_struct *,
struct wwn_list_struct *, int);
extern int l_get_port(char *, int *, int);
extern int l_get_ses_path(char *, char *, gfc_map_t *, int);
extern int l_get_slot(struct path_struct *, L_state *, int);
extern int l_get_status(char *, struct l_state_struct *, int);
extern int l_led(struct path_struct *, int, struct device_element *, int);
extern int l_make_node(char *, int, char *, gfc_map_t *, int);
extern int l_new_name(char *, char *);
extern int l_offline_photon(struct hotplug_disk_list *,
struct wwn_list_struct *, int, int);
extern int l_get_enc_type(L_inquiry inq);
extern int l_pho_pwr_up_down(char *, char *, int, int, int);
#else /* __STDC__ */
extern int l_chk_null_wwn();
extern int l_convert_name();
extern int l_dev_pwr_up_down();
extern int l_device_present();
extern int l_download();
extern int l_duplicate_names();
extern int l_encl_status_page_funcs();
extern int l_format_fc_status_msg();
extern int l_format_ifp_status_msg();
extern void l_free_box_list();
extern int l_free_lstate();
extern int l_get_allses();
extern int l_get_box_list();
extern int l_get_disk_element_index();
extern int l_get_disk_port_status();
extern int l_get_disk_status();
extern void l_get_drive_name();
extern int l_get_envsen();
extern int l_get_envsen_page();
extern int l_get_ib_status();
extern int l_get_individual_state();
extern int l_get_port();
extern int l_get_ses_path();
extern int l_get_slot();
extern int l_get_status();
extern int l_led();
extern int l_make_node();
extern int l_new_name();
extern int l_offline_photon();
extern int l_pho_pwr_up_down();
extern int l_get_enc_type();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _A5K_H */
|