xref: /illumos-gate/usr/src/uts/sun4u/sys/rmc_comm_hproto.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_RMC_COMM_HPROTO_H
28 #define	_SYS_RMC_COMM_HPROTO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * data types used in the data protocol fields
38  */
39 
40 typedef unsigned char rsci8;
41 typedef unsigned short rsci16;
42 
43 typedef short rscis16;
44 
45 #ifdef _LP64
46 typedef unsigned int rsci32;
47 typedef unsigned long rsci64;
48 #else
49 typedef unsigned long rsci32;
50 typedef unsigned long long rsci64;
51 #endif
52 
53 /*
54  * handle definition. Handles are used in the high-level data protocol
55  * to identify FRU, sensors (temperature, voltage), and so on.
56  */
57 
58 typedef rsci16 dp_handle_t;
59 
60 #define	DP_NULL_HANDLE		0xffff
61 
62 #define	DP_MAX_HANDLE_NAME	32
63 
64 #define	DP_NULL_MSG		0x00
65 
66 /*
67  * Supported message types and associated data types:
68  */
69 
70 #define	DP_RESET_RSC		0x7A
71 
72 #define	DP_RESET_RSC_R		0x5A
73 
74 #define	DP_UPDATE_FLASH		0x66
75 
76 #define	DP_UPDATE_FLASH_R	0x46
77 typedef struct dp_update_flash_r {
78 	rsci32	status;		/* completion code */
79 } dp_update_flash_r_t;
80 
81 #define	DP_RUN_TEST		0x74
82 typedef struct dp_run_test {
83 	rsci32	testno;		/* test number to run; see below. */
84 	rsci32	param_len;	/* # bytes in test parameter data. */
85 } dp_run_test_t;
86 /* followed by test parameters; see individual tests below. */
87 
88 #define	DP_RUN_TEST_R		0x54
89 typedef struct dp_run_test_r {
90 	rsci32	status;		/* 0 = test passed, otherwise see failure */
91 				/* codes below. */
92 	rsci32	idatalen;	/* # items in input data array */
93 	rsci32	odatalen;	/* # items in output data array */
94 #define	DP_MAX_RUN_TEST_DATALEN (DP_MAX_MSGLEN-32)/2
95 	rsci8	idata[DP_MAX_RUN_TEST_DATALEN];	/* input data array */
96 	rsci8	odata[DP_MAX_RUN_TEST_DATALEN];	/* output data array */
97 } dp_run_test_r_t;
98 
99 #define	RSC_TEST_PASSED		0
100 #define	RSC_TEST_SW_FAILURE	1
101 #define	RSC_TEST_BAD_DATA	2
102 #define	RSC_TEST_NO_RESPONSE	3
103 #define	RSC_TEST_BAD_CRC	4
104 #define	RSC_TEST_BAD_PARAMS	5
105 #define	RSC_TEST_NO_DEVICE	6
106 #define	RSC_TEST_DEV_SETUP_FAIL	7
107 #define	RSC_TEST_MEM_ALLOC_FAIL	8
108 #define	RSC_TEST_ENET_ADDR_FAIL	9
109 #define	RSC_TEST_DEV_INFO_FAIL	10
110 #define	RSC_TEST_NYI		255
111 
112 #define	DP_RSC_STATUS		0x73
113 
114 #define	DP_RSC_STATUS_R		0x53
115 typedef struct dp_rsc_status_r {
116 /* The first six fields here must not be changed to ensure that they  */
117 /* are the same in all versions of RSC, most notably when compared to */
118 /* 1.x. New fields must be added to the end of the structure. */
119 	rsci16	main_rev_major;
120 	rsci16	main_rev_minor;
121 	rsci16	bootmon_rev_major;
122 	rsci16	bootmon_rev_minor;
123 	rsci16	post_status;
124 	rsci16	nusers;		/* number of users currently logged in to */
125 				/* CLI.  */
126 /* Any new fields in the structure may be added after this point ONLY! */
127 	rsci16	release_rev_major;
128 	rsci16	release_rev_minor;
129 	rsci16	release_rev_micro;
130 	rsci16	main_rev_micro;
131 	rsci16	bootmon_rev_micro;
132 	rsci16	hardware_rev;
133 
134 	rsci32 bm_cksum;
135 	rsci8  rsc_build;
136 	char creationDate[256];
137 	rsci32 fw_cksum;
138 	rsci32 sys_mem;
139 	rsci32 nvram_version;
140 
141 } dp_rsc_status_r_t;
142 
143 #define	DP_SET_CFGVAR		0x76
144 typedef struct dp_set_cfgvar {
145 	rsci32	hidden;		/* boolean */
146 } dp_set_cfgvar_t;
147 
148 /* Data is variable name & new value as zero-terminated ascii strings. */
149 
150 #define	DP_SET_CFGVAR_R		0x56
151 typedef struct dp_set_cfgvar_r {
152 	rsci32	status;		/* completion code */
153 } dp_set_cfgvar_r_t;
154 
155 #define	DP_GET_CFGVAR		0x67
156 /* Data is variable name as zero-terminated ascii string. */
157 
158 #define	DP_GET_CFGVAR_R		0x47
159 typedef struct dp_get_cfgvar_r {
160 	rsci32	status;		/* completion code */
161 } dp_get_cfgvar_r_t;
162 /* followed by value of variable as a zero-terminated ascii string. */
163 
164 #define	DP_GET_CFGVAR_NAME	0x6E
165 /*
166  * Data is variable name as zero-terminated ascii string.  A zero-length
167  * string means 'return the name of the "first" variable.'
168  */
169 
170 #define	DP_GET_CFGVAR_NAME_R	0x4E
171 typedef struct dp_get_cfgvar_name_r {
172 	rsci32	status;		/* completion code */
173 } dp_get_cfgvar_name_r_t;
174 /* followed by name of "next" variable as a zero-terminated ascii string. */
175 
176 #define	DP_SET_DATE_TIME		0x64
177 #define	DP_SET_DATE_TIME_IGNORE_FIELD	0xFFFF
178 typedef struct dp_set_date_time {
179 	rsci32	year;		/* Full year, IE 1997 */
180 	rsci32	month;		/* 1 = Jan, 2 = Feb, etc. */
181 	rsci32	day;		/* Day of the month, 1 to 31. */
182 	rsci32	hour;		/* 0 to 23 */
183 	rsci32	minute;		/* 0 to 59 */
184 	rsci32	second;		/* 0 to 59 */
185 } dp_set_date_time_t;
186 
187 #define	DP_SET_DATE_TIME_R	0x44
188 typedef struct dp_set_date_time_r {
189 	rsci32	status;		/* 0 - succes, non-zero - fail. */
190 } dp_set_date_time_r_t;
191 
192 #define	DP_GET_DATE_TIME	0x65
193 #define	DP_GET_DATE_TIME_R	0x45
194 typedef struct dp_get_date_time_r {
195 	rsci32	status;		/* completion code */
196 	rsci32	current_datetime; /* in Unix format */
197 } dp_get_date_time_r_t;
198 /* followed by the date represented as a zero-terminated ascii string. */
199 
200 
201 #define	DP_SEND_ALERT		0x61
202 typedef struct dp_send_alert {
203 	rsci32	critical; /* boolean */
204 } dp_send_alert_t;
205 
206 #define	DP_SEND_ALERT_R		0x41
207 typedef struct dp_send_alert_r {
208 	rsci32	status;		/* completion code */
209 } dp_send_alert_r_t;
210 
211 #define	DP_GET_TEMP		0x78
212 
213 #define	DP_GET_TEMP_R		0x58
214 typedef struct dp_get_temp_r {
215 	rsci32	status;
216 	rsci32	current_temp;
217 } dp_get_temp_r_t;
218 
219 /*
220  * Implementations using this level of protocol or above,
221  * will generate a response to any supplied command code.
222  * This doesn't mean they will support a given command.
223  * It only means that they will generate a response to that
224  * command.
225  */
226 #define	SDP_RESPONDS_TO_ALL_CMDS	3
227 
228 #define	DP_GET_SDP_VERSION	0x7B
229 
230 #define	DP_GET_SDP_VERSION_R	0x5B
231 typedef struct dp_get_sdp_version_r {
232 	rsci32	version;
233 } dp_get_sdp_version_r_t;
234 
235 #define	DP_GET_TOD_CLOCK	0x7C
236 
237 #define	DP_GET_TOD_CLOCK_R	0x5C
238 typedef struct dp_get_tod_clock_r {
239 	rsci32	current_tod;
240 } dp_get_tod_clock_r_t;
241 
242 #define	DP_MAX_LOGSIZE		(DP_MAX_MSGLEN-24)
243 
244 #define	DP_GET_EVENT_LOG	0x7D
245 
246 /*
247  * NOTE: changing this or the dp_event_log_entry structure will almost
248  * certainly require changing the code that parses these structures
249  * in scadm.  See src/cmd/scadm/sparcv9/mpxu/common/eventlog.c.
250  */
251 #define	DP_GET_EVENT_LOG_R	0x5D
252 typedef struct dp_get_event_log_r {
253 	rsci32	entry_count;
254 	rsci8	data[DP_MAX_LOGSIZE];
255 } dp_get_event_log_r_t;
256 
257 typedef struct dp_event_log_entry {
258 	rsci32	eventTime;
259 	rsci32	eventId;
260 	rsci32	paramLen;
261 	char	param[256];
262 } dp_event_log_entry_t;
263 
264 #define	DP_GET_PCMCIA_INFO	0x7E
265 
266 #define	DP_GET_PCMCIA_INFO_R	0x5E
267 typedef struct dp_get_pcmcia_info_r {
268 	rsci32	card_present;	/* true=present, false=no card */
269 	rsci32	idInfoLen;
270 	rsci8	idInfo[256];
271 } dp_get_pcmcia_info_r_t;
272 
273 
274 #define	DP_USER_MAX		16
275 #define	DP_USER_NAME_SIZE	16
276 
277 /* User sub-commands */
278 #define	DP_USER_CMD_ADD		0x1
279 #define	DP_USER_CMD_DEL		0x2
280 #define	DP_USER_CMD_SHOW	0x3
281 #define	DP_USER_CMD_PASSWORD	0x4
282 #define	DP_USER_CMD_PERM	0x5
283 
284 /*
285  * The following fields are used to set the user permissions.
286  * Each must be represented as a single bit in the parm field.
287  */
288 #define	DP_USER_PERM_C		0x1
289 #define	DP_USER_PERM_U		0x2
290 #define	DP_USER_PERM_A		0x4
291 #define	DP_USER_PERM_R		0x8
292 
293 /*
294  * values for parm for CMD_SHOW.  Anything other than 0 will show
295  * the user # up to and including DP_USER_MAX
296  */
297 #define	DP_USER_SHOW_USERNAME	0x0
298 
299 /* Error values for status */
300 #define	DP_ERR_USER_FULL	0x1  /* No free user slots */
301 #define	DP_ERR_USER_NONE	0x2  /* User does not exist */
302 #define	DP_ERR_USER_BAD		0x3  /* Malformed username */
303 #define	DP_ERR_USER_NACT	0x4  /* user # not activated */
304 #define	DP_ERR_USER_THERE	0x5  /* user already registered */
305 #define	DP_ERR_USER_PASSWD	0x6  /* invalid password */
306 #define	DP_ERR_USER_WARNING	0x7  /* Malformed username warning */
307 #define	DP_ERR_USER_NYI		0xFD /* Not yet implemented */
308 #define	DP_ERR_USER_UNDEF	0xFE /* Undefine error */
309 #define	DP_ERR_USER_CMD		0xFF /* Invalid Command */
310 
311 #define	DP_USER_ADM		0x50
312 /*
313  * The parm field is used by the permission command to set specific
314  *  permissions.  The parm field is also used by the show command to
315  * indicate if the user name is specified or not.
316  */
317 typedef struct dp_user_adm {
318 	rsci32	command;
319 	rsci32	parm;
320 } dp_user_adm_t;
321 /*
322  * followed by zero-terminated ascii strings.  All user commands
323  * are followed by the username. The password command is also
324  * followed by the password.
325  */
326 
327 #define	DP_USER_ADM_R		0x51
328 /*
329  * the response field is used to return the user permissions
330  * for the user permissions command. The response is also used
331  * to echo back the user selection for the show command.
332  */
333 typedef struct dp_user_adm_r {
334 	rsci32	status;		/* completion code */
335 	rsci32  command;	/* echo back adm command */
336 	rsci32	response;
337 } dp_user_adm_r_t;
338 /* followed by a zero-terminated ascii string for the show command.  */
339 
340 
341 #define	DP_MODEM_PASS		0
342 #define	DP_MODEM_FAIL		-1
343 
344 /* Commands used for rscadm modem_setup */
345 #define	DP_MODEM_CONNECT	0x30
346 #define	DP_MODEM_CONNECT_R	0x31
347 typedef struct dp_modem_connect_r {
348 	rsci32	status;
349 } dp_modem_connect_r_t;
350 
351 /* There is no reponse to a modem_data command */
352 /* The modem data command goes in both directions */
353 #define	DP_MODEM_DATA		0x32
354 /* followed by a zero-terminated ascii string */
355 
356 #define	DP_MODEM_DISCONNECT	0x34
357 #define	DP_MODEM_DISCONNECT_R	0x35
358 typedef struct dp_modem_disconnect_r {
359 	rsci32	status;
360 } dp_modem_disconnect_r_t;
361 
362 
363 #define	DP_GET_TICKCNT		0x22
364 #define	DP_GET_TICKCNT_R	0x23
365 typedef struct dp_get_tickcnt_r {
366 	rsci32	upper;		/* MSW of 64 bit tick count */
367 	rsci32	lower;		/* LSW of 64 bit tick count */
368 } dp_get_tickcnt_r_t;
369 
370 
371 #define	DP_SET_DEFAULT_CFG	0x72
372 
373 #define	DP_SET_DEFAULT_CFG_R	0x52
374 typedef struct dp_set_default_cfg_r {
375 	rsci32	status;
376 } dp_set_default_cfg_r_t;
377 
378 
379 #define	DP_GET_NETWORK_CFG	0x59
380 
381 #define	DP_GET_NETWORK_CFG_R	0x79
382 typedef struct dp_get_network_cfg_r {
383 	rsci32	status;
384 	char	ipMode[7];
385 	char	ipAddr[16];
386 	char	ipMask[16];
387 	char	ipGateway[16];
388 	char	ethAddr[18];
389 	char	ipDHCPServer[16];
390 } dp_get_network_cfg_r_t;
391 
392 
393 /*
394  * Parameters for DP_RUN_TEST message:
395  */
396 
397 /*
398  * Test routines need to know what the low-level protocol sync
399  * character is.
400  */
401 
402 #define	RSC_TEST_SERIAL		0
403 typedef struct rsc_serial_test {
404 	rsci32	testtype;
405 #define	RSC_SERIAL_TTYC_LB	0
406 #define	RSC_SERIAL_TTYC_LB_OFF	1
407 #define	RSC_SERIAL_TTYD_LB	2
408 #define	RSC_SERIAL_TTYD_LB_OFF	3
409 #define	RSC_SERIAL_TTYCD_LB	4
410 #define	RSC_SERIAL_TTYCD_LB_OFF	5
411 #define	RSC_SERIAL_TTYU_INT_LB	6
412 #define	RSC_SERIAL_TTYU_EXT_LB	7
413 	rsci32	baud;
414 	rsci32	passes;
415 	rsci32	datalen;
416 	rsci8	data[DP_MAX_MSGLEN-32];
417 } rsc_serial_test_t;
418 
419 #define	RSC_TEST_ENET		1
420 typedef struct rsc_enet_test {
421 	rsci32	testtype;
422 #define	RSC_ENET_INT_LB		0
423 #define	RSC_ENET_EXT_LB		1
424 #define	RSC_ENET_PING		2
425 #define	RSC_ENET_INT_PHY_LB	3
426 	rsci8	ip_addr[4];
427 	rsci32	passes;
428 	rsci32	datalen;
429 	rsci8	data[DP_MAX_MSGLEN-32];
430 } rsc_enet_test_t;
431 
432 #define	RSC_TEST_FLASH_CRC	2
433 typedef struct rsc_flash_crcs_r {
434 	rsci32	boot_crc;
435 	rsci32	main_crc;
436 } rsc_flash_crcs_r_t;
437 
438 #define	RSC_TEST_SEEPROM_CRC	3
439 typedef struct rsc_seeprom_crcs_r {
440 	rsci32	hdr_crc;
441 	rsci32	main_crc;
442 } rsc_seeprom_crcs_r_t;
443 
444 #define	RSC_TEST_FRU_SEEPROM_CRC 4
445 typedef struct rsc_fru_crcs_r {
446 	rsci32	ro_hdr_crc;
447 	rsci32	seg_sd_crc;
448 } rsc_fru_crcs_r_t;
449 
450 
451 /*
452  * new commands definitions
453  */
454 
455 #define	DP_GET_SYSINFO		0x20
456 
457 #define	DP_GET_SYSINFO_R	0x21
458 typedef struct dp_get_sysinfo_r {
459 	rsci8 maxTemp;		/* max number of temperature sensors */
460 	rsci8 maxFan;		/* max number of FANs */
461 	rsci8 maxPSU;		/* max number of PSUs slot */
462 	rsci8 maxLED;		/* max number of LEDs */
463 	rsci8 maxVolt;		/* max number of voltage sensors */
464 	rsci8 maxFRU;		/* max number of FRUs (field replac. unit)  */
465 	rsci8 maxCircuitBrks;	/* max number of circuit breakers */
466 	rsci8 keyswitch;	/* key switch setting value */
467 } dp_get_sysinfo_r_t;
468 
469 
470 #define	DP_GET_TEMPERATURES	0x24
471 typedef struct dp_get_temperatures {
472 	dp_handle_t handle;	/* handle of a temperature sensor */
473 				/* or <null handle> (0xffff) */
474 } dp_get_temperatures_t;
475 
476 /* Data is variable name & new value as zero-terminated ascii strings. */
477 
478 #define	DP_GET_TEMPERATURES_R	0x25
479 typedef rscis16		dp_tempr_t;
480 
481 enum sensor_status {
482 	DP_SENSOR_DATA_AVAILABLE = 0,
483 	DP_SENSOR_DATA_UNAVAILABLE,
484 	DP_SENSOR_NOT_PRESENT
485 };
486 
487 typedef struct dp_tempr_status {
488 	dp_handle_t	handle;
489 	rsci8		sensor_status; 	/* tells whether the reading is */
490 					/* available or not */
491 	dp_tempr_t	value;	/* temperature value (celsius). */
492 
493 	dp_tempr_t 	low_warning;
494 	dp_tempr_t 	low_soft_shutdown;
495 	dp_tempr_t 	low_hard_shutdown;
496 	dp_tempr_t 	high_warning;
497 	dp_tempr_t 	high_soft_shutdown;
498 	dp_tempr_t 	high_hard_shutdown;
499 
500 } dp_tempr_status_t;
501 
502 typedef struct dp_get_temperatures_r {
503 	rsci8			num_temps;
504 	dp_tempr_status_t	temp_status[1];
505 
506 } dp_get_temperatures_r_t;
507 
508 
509 #define	DP_GET_FAN_STATUS	0x26
510 typedef struct dp_get_fan_status {
511 	dp_handle_t handle;	/* handle of a temperature sensor */
512 				/* or <null handle> (0xffff) */
513 } dp_get_fan_status_t;
514 
515 #define	DP_GET_FAN_STATUS_R	0x27
516 
517 typedef struct dp_fan_status {
518 	dp_handle_t	handle;
519 	rsci8		sensor_status; 	/* tells whether the reading is */
520 					/* available or not */
521 	rsci8 		flag;
522 
523 #define	DP_FAN_PRESENCE		0x01	/* FAN presence (bit set=FAN present) */
524 #define	DP_FAN_SPEED_VAL_UNIT	0x02	/* speed unit	(bit set=relative, */
525 					/*		bit clear=RPM) */
526 #define	DP_FAN_STATUS		0x04	/* FAN status (bit set=error) */
527 
528 	rsci16		speed;	/* FAN speed. */
529 	rsci16		minspeed; /* minimum FAN speed warning threshold */
530 
531 } dp_fan_status_t;
532 
533 typedef struct dp_get_fan_status_r {
534 	rsci8		num_fans;
535 	dp_fan_status_t	fan_status[1];
536 
537 } dp_get_fan_status_r_t;
538 
539 
540 #define	DP_GET_PSU_STATUS	0x28
541 typedef struct dp_get_psu_status {
542 	dp_handle_t handle;	/* handle of a temperature sensor */
543 				/* or <null handle> (0xffff) */
544 } dp_get_psu_status_t;
545 
546 #define	DP_GET_PSU_STATUS_R	0x29
547 typedef struct dp_psu_status {
548 	dp_handle_t	handle;
549 	rsci8		sensor_status; 	/* tells whether the reading is */
550 					/* available or not */
551 	rsci16 		mask;		/* flag bit mask (feature presence) */
552 	rsci16 		flag;		/* status bits */
553 
554 #define	DP_PSU_PRESENCE			0x0001	/* PSU presence  */
555 #define	DP_PSU_OUTPUT_STATUS		0x0002	/* output status */
556 #define	DP_PSU_INPUT_STATUS		0x0004	/* input status */
557 #define	DP_PSU_SEC_INPUT_STATUS		0x0008	/* secondary input status */
558 #define	DP_PSU_OVERTEMP_FAULT		0x0010	/* over temperature fault */
559 #define	DP_PSU_FAN_FAULT    		0x0020	/* FAN fault */
560 #define	DP_PSU_FAIL_STATUS		0x0040	/* PSU generic fault */
561 #define	DP_PSU_OUTPUT_VLO_STATUS	0x0080	/* output under voltage */
562 #define	DP_PSU_OUTPUT_VHI_STATUS	0x0100	/* output over voltage */
563 #define	DP_PSU_OUTPUT_AHI_STATUS	0x0200	/* output over current */
564 #define	DP_PSU_ALERT_STATUS		0x0400	/* PSU alert indication */
565 #define	DP_PSU_PDCT_FAN			0x0800	/* predicted fan fail */
566 #define	DP_PSU_NR_WARNING		0x1000	/* non-redundancy condition */
567 
568 			/* presence: 	bit clear=not present */
569 			/*		bit set=present */
570 			/* status:	bit clear=ok */
571 			/*		bit set=generic fault */
572 } dp_psu_status_t;
573 
574 typedef struct dp_get_psu_status_r {
575 
576 	rsci8		num_psus;
577 	dp_psu_status_t	psu_status[1];
578 
579 } dp_get_psu_status_r_t;
580 
581 #define	DP_GET_FRU_STATUS	0x2A
582 typedef struct dp_get_fru_status {
583 	dp_handle_t handle;	/* handle of a hot pluggable unit */
584 				/* or <null handle> (0xffff)	  */
585 } dp_get_fru_status_t;
586 
587 
588 #define	DP_GET_FRU_STATUS_R	0x2B
589 typedef struct dp_fru_status {
590 
591 	dp_handle_t	handle;
592 	rsci8		sensor_status; 	/* tells whether the reading is */
593 					/* available or not */
594 	rsci8		presence;	/* 1=FRU present */
595 	rsci8		status;
596 
597 } dp_fru_status_t;
598 
599 enum dp_fru_status_type {
600 	DP_FRU_STATUS_OK = 1,
601 	DP_FRU_STATUS_FAILED,
602 	DP_FRU_STATUS_BLACKLISTED,
603 	DP_FRU_STATUS_UNKNOWN
604 };
605 
606 typedef struct dp_get_fru_status_r {
607 	rsci8		num_frus;
608 	dp_fru_status_t	fru_status[1];
609 
610 } dp_get_fru_status_r_t;
611 
612 /*
613  * DP_GET_DEVICE(_R) command is used to discover I2C devices dynamically
614  * (used by SunVTS)
615  */
616 #define	DP_GET_DEVICE		0x2C
617 
618 typedef struct dp_get_device {
619 	dp_handle_t	handle;	/* handle of a device or */
620 				/* <null handle>(0xffff) */
621 } dp_get_device_t;
622 
623 #define	DP_GET_DEVICE_R		0x2D
624 
625 #define	DP_MAX_DEVICE_TYPE_NAME	32
626 
627 typedef struct dp_device {
628 	dp_handle_t	handle;
629 	rsci8		presence;	/* 0 is not present, 1 is present */
630 	char		device_type[DP_MAX_DEVICE_TYPE_NAME];
631 } dp_device_t;
632 
633 typedef struct dp_get_device_r {
634 	rsci8		num_devices;
635 	dp_device_t	device[1];
636 } dp_get_device_r_t;
637 
638 
639 #define	DP_SET_CPU_SIGNATURE	0x33
640 
641 typedef struct dp_set_cpu_signature {
642 	int		cpu_id;		/* see PSARC 2000/205 for more */
643 	ushort_t	sig; 		/* information on the value/meaning */
644 	uchar_t		states;		/* of these fields */
645 	uchar_t		sub_state;
646 
647 } dp_cpu_signature_t;
648 
649 
650 #define	DP_SET_CPU_NODENAME	0x38
651 
652 #define	DP_MAX_NODENAME		256
653 
654 typedef struct dp_set_nodename {
655 	char		nodename[DP_MAX_NODENAME];
656 } dp_set_nodename_t;
657 
658 
659 #define	DP_GET_LED_STATE	0x3C
660 
661 typedef struct dp_get_led_state {
662 	dp_handle_t handle;	/* handle of a hot pluggable unit */
663 				/* or <null handle> (0xffff) */
664 } dp_get_led_state_t;
665 
666 #define	DP_GET_LED_STATE_R	0x3D
667 
668 typedef struct dp_led_state {
669 	dp_handle_t	handle;
670 	rsci8		sensor_status; 	/* tells whether the reading is */
671 					/* available or not */
672 	rsci8		state;
673 	rsci8		colour;
674 } dp_led_state_t;
675 
676 typedef struct dp_get_led_state_r {
677 	rsci8		num_leds;
678 	dp_led_state_t	led_state[1];
679 } dp_get_led_state_r_t;
680 
681 /* LED states */
682 
683 enum dp_led_states {
684 	DP_LED_OFF = 0,
685 	DP_LED_ON,
686 	DP_LED_FLASHING,
687 	DP_LED_BLINKING
688 };
689 
690 enum dp_led_colours {
691 	DP_LED_COLOUR_NONE = -1,
692 	DP_LED_COLOUR_ANY,
693 	DP_LED_COLOUR_WHITE,
694 	DP_LED_COLOUR_BLUE,
695 	DP_LED_COLOUR_GREEN,
696 	DP_LED_COLOUR_AMBER
697 };
698 
699 
700 #define	DP_SET_LED_STATE	0x3E
701 
702 typedef struct dp_set_led_state {
703 	dp_handle_t	handle;		/* handle of a LED */
704 	rsci8		state;
705 } dp_set_led_state_t;
706 
707 #define	DP_SET_LED_STATE_R	0x3F
708 typedef struct dp_set_led_state_r {
709 	rsci8		status;
710 } dp_set_led_state_r_t;
711 
712 enum dp_set_led_status {
713 	DP_SET_LED_OK = 0,
714 	DP_SET_LED_INVALID_HANDLE,
715 	DP_SET_LED_ERROR
716 };
717 
718 
719 #define	DP_GET_ALARM_STATE	0x68
720 
721 typedef struct dp_get_alarm_state {
722 	dp_handle_t handle;	/* handle of an alarm relay */
723 				/* or <null handle> (0xffff) */
724 } dp_get_alarm_state_t;
725 
726 #define	DP_GET_ALARM_STATE_R	0x69
727 
728 typedef struct dp_alarm_state {
729 	dp_handle_t	handle;
730 	rsci8		sensor_status; 	/* tells whether the reading is */
731 					/* available or not */
732 	rsci8		state;
733 } dp_alarm_state_t;
734 
735 typedef struct dp_get_alarm_state_r {
736 	rsci8		num_alarms;
737 	dp_alarm_state_t	alarm_state[1];
738 } dp_get_alarm_state_r_t;
739 
740 /* ALARM states */
741 
742 enum dp_alarm_states {
743 	DP_ALARM_OFF = 0,
744 	DP_ALARM_ON
745 };
746 
747 #define	DP_SET_ALARM_STATE	0x6A
748 
749 typedef struct dp_set_alarm_state {
750 	dp_handle_t	handle;		/* handle of a ALARM */
751 	rsci8		state;
752 } dp_set_alarm_state_t;
753 
754 #define	DP_SET_ALARM_STATE_R	0x6B
755 typedef struct dp_set_alarm_state_r {
756 	rsci8		status;
757 } dp_set_alarm_state_r_t;
758 
759 enum dp_set_alarm_status {
760 	DP_SET_ALARM_OK = 0,
761 	DP_SET_ALARM_INVALID_HANDLE,
762 	DP_SET_ALARM_ERROR
763 };
764 
765 
766 #define	DP_SET_USER_WATCHDOG	0x60
767 #define	DP_SET_USER_WATCHDOG_R	0x6F
768 #define	DP_GET_USER_WATCHDOG	0x70
769 #define	DP_GET_USER_WATCHDOG_R	0x71
770 
771 #define	DP_USER_WATCHDOG_ENABLE		0x01
772 #define	DP_USER_WATCHDOG_DISABLE	0x00
773 
774 enum dp_user_watchdog_status {
775 	DP_USER_WDT_OK = 0,
776 	DP_USER_WDT_ERROR
777 };
778 
779 typedef struct dp_set_user_watchdog {
780 	rsci8 enable;	/* enable = 1 */
781 } dp_set_user_watchdog_t;
782 
783 typedef struct dp_set_user_watchdog_r {
784 	rsci8 status;
785 } dp_set_user_watchdog_r_t;
786 
787 typedef struct dp_get_user_watchdog_r {
788 	rsci8 enable;
789 } dp_get_user_watchdog_r_t;
790 
791 #define	DP_GET_VOLTS		0x42
792 
793 typedef struct dp_get_volts {
794 	dp_handle_t	handle;		/* handle of a voltage sensor */
795 } dp_get_volts_t;
796 
797 #define	DP_GET_VOLTS_R		0x43
798 
799 typedef rscis16		dp_volt_reading_t;	/* unit in mV */
800 
801 typedef struct dp_volt_status {
802 	dp_handle_t		handle;
803 	rsci8			sensor_status; 	/* tells whether the reading */
804 						/* is available or not */
805 	rsci8			status;		/* 0=ok, 1=error */
806 	dp_volt_reading_t	reading;	/* value in mV. */
807 	dp_volt_reading_t	low_warning;
808 	dp_volt_reading_t	low_soft_shutdown;
809 	dp_volt_reading_t	low_hard_shutdown;
810 	dp_volt_reading_t	high_warning;
811 	dp_volt_reading_t	high_soft_shutdown;
812 	dp_volt_reading_t	high_hard_shutdown;
813 
814 } dp_volt_status_t;
815 
816 typedef struct dp_get_volts_r {
817 	rsci8			num_volts;
818 	dp_volt_status_t	volt_status[1];
819 
820 } dp_get_volts_r_t;
821 
822 
823 #define	DP_GET_CIRCUIT_BRKS	0x62
824 
825 typedef struct dp_get_circuit_brks {
826 	dp_handle_t handle;	/* handle of a circuit breaker */
827 				/* or <null handle> (0xffff) */
828 } dp_get_circuit_brks_t;
829 
830 #define	DP_GET_CIRCUIT_BRKS_R	0x63
831 
832 typedef struct dp_circuit_brk_status {
833 	dp_handle_t	handle;
834 	rsci8		sensor_status; 	/* tells whether the reading is */
835 					/* available or not */
836 	rsci8		status;		/* 0=ok, 1=error */
837 
838 } dp_circuit_brk_status_t;
839 
840 typedef struct dp_get_circuit_brks_r {
841 	rsci8			num_circuit_brks;
842 	dp_circuit_brk_status_t	circuit_brk_status[1];
843 
844 } dp_get_circuit_brks_r_t;
845 
846 
847 #define	DP_SET_HOST_WATCHDOG	0x48
848 
849 typedef struct dp_set_host_watchdog {
850 	rsci8	enable;		/* 0=enable watchdog, 1=disable watchdog */
851 } dp_set_host_watchdog_t;
852 
853 
854 #define	DP_GET_HANDLE_NAME	0x4A
855 
856 typedef struct dp_get_handle_name {
857 	dp_handle_t	handle;
858 } dp_get_handle_name_t;
859 
860 #define	DP_GET_HANDLE_NAME_R	0x4B
861 
862 typedef struct dp_get_handle_name_r {
863 	dp_handle_t	handle;
864 	char 		name[DP_MAX_HANDLE_NAME];
865 } dp_get_handle_name_r_t;
866 
867 
868 #define	DP_GET_HANDLE		0x4C
869 
870 typedef struct dp_get_handle {
871 	char 		name[DP_MAX_HANDLE_NAME];
872 } dp_get_handle_t;
873 
874 #define	DP_GET_HANDLE_R		0x4D
875 
876 typedef struct dp_get_handle_r {
877 	dp_handle_t 	handle;
878 } dp_get_handle_r_t;
879 
880 
881 #define	DP_RMC_EVENTS		0x57
882 
883 typedef rsci16	dp_event_t;
884 
885 /*
886  * list of events
887  */
888 
889 enum rmc_events {
890 	RMC_INIT_EVENT	= 0x01,
891 	RMC_HPU_EVENT,
892 	RMC_ENV_EVENT,
893 	RMC_KEYSWITCH_EVENT,
894 	RMC_LOG_EVENT
895 };
896 
897 /*
898  * event data structures
899  */
900 enum rmc_hpu_events {
901 	RMC_HPU_INSERT_EVENT	= 0x20,
902 	RMC_HPU_REMOVE_EVENT,
903 	RMC_HPU_HWERROR_EVENT
904 };
905 
906 typedef struct dp_hpu_event {
907 	dp_handle_t	hpu_hdl;
908 	dp_event_t	sub_event;
909 
910 } dp_hpu_event_t;
911 
912 
913 enum rmc_env_events {
914 	RMC_ENV_WARNING_THRESHOLD_EVENT = 0x31,
915 	RMC_ENV_SHUTDOWN_THRESHOLD_EVENT,
916 	RMC_ENV_FAULT_EVENT,
917 	RMC_ENV_OK_EVENT
918 };
919 
920 typedef struct dp_env_event {
921 	dp_handle_t	env_hdl;
922 	dp_event_t	sub_event;
923 
924 } dp_env_event_t;
925 
926 
927 enum rmc_keyswitch_pos {
928 	RMC_KEYSWITCH_POS_UNKNOWN	= 0x00,
929 	RMC_KEYSWITCH_POS_NORMAL,
930 	RMC_KEYSWITCH_POS_DIAG,
931 	RMC_KEYSWITCH_POS_LOCKED,
932 	RMC_KEYSWITCH_POS_OFF
933 };
934 
935 typedef struct dp_keyswitch_event {
936 	rsci8	key_position;
937 } dp_keyswitch_event_t;
938 
939 
940 typedef struct dp_rmclog_event {
941 	int	log_record_size;
942 	rsci8	log_record[DP_MAX_LOGSIZE];
943 } dp_rmclog_event_t;
944 
945 typedef union dp_event_info {
946 	dp_hpu_event_t		ev_hpunot;
947 	dp_env_event_t		ev_envnot;
948 	dp_keyswitch_event_t	ev_keysw;
949 	dp_rmclog_event_t	ev_rmclog;
950 } dp_event_info_t;
951 
952 typedef struct dp_event_notification {
953 	dp_event_t	event;
954 	rsci32		event_seqno; 	/* event sequence number */
955 	rsci32		timestamp;	/* timestamp of the event */
956 	dp_event_info_t	event_info;	/* event information */
957 } dp_event_notification_t;
958 
959 #define	DP_RMC_EVENTS_R		0x5F
960 
961 typedef struct dp_event_notification_r {
962 	rsci32		event_seqno; 	/* event sequence number */
963 } dp_event_notification_r_t;
964 
965 #define	DP_GET_CHASSIS_SERIALNUM	0x2E
966 #define	DP_GET_CHASSIS_SERIALNUM_R	0x2F
967 typedef struct dp_get_serialnum_r {
968 	rsci8		chassis_serial_number[32];
969 } dp_get_serialnum_r_t;
970 
971 #define	DP_GET_CONSOLE_LOG	0x1A
972 typedef struct dp_get_console_log {
973 	rsci64		start_seq; 	/* sequence number of first log byte */
974 	rsci16		length;		/* expected size of retrieved data */
975 } dp_get_console_log_t;
976 
977 #define	DP_GET_CONSOLE_LOG_R	0x1B
978 typedef struct dp_get_console_log_r {
979 	rsci64		next_seq;	/* sequence number of next log byte */
980 	rsci64		remaining_log_bytes;	/* bytes left to retrieve */
981 	rsci16		length;		/* size of retrieved data */
982 	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
983 			    sizeof (rsci16))];
984 } dp_get_console_log_r_t;
985 
986 #define	DP_GET_CONFIG_LOG	0x1C
987 typedef struct dp_get_config_log {
988 	rsci64		start_seq;	/* sequence number of first log byte */
989 	rsci16		length;		/* size of retrieved data */
990 } dp_get_config_log_t;
991 
992 #define	DP_GET_CONFIG_LOG_R	0x1D
993 typedef struct dp_get_config_log_r {
994 	rsci64		next_seq;	/* sequence number of next log byte */
995 	rsci64		remaining_log_bytes;	/* bytes left to retrieve */
996 	rsci16		length;		/* size of retrieved data */
997 	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
998 			    sizeof (rsci16))];
999 } dp_get_config_log_r_t;
1000 
1001 #define	DP_GET_EVENT_LOG2	0x1E
1002 typedef struct dp_get_event_log2 {
1003 	rsci64		start_seq;	/* sequence number of first log event */
1004 	rsci16		length;		/* size of retrieved data */
1005 } dp_get_event_log2_t;
1006 
1007 #define	DP_GET_EVENT_LOG2_R	0x1F
1008 typedef struct dp_get_event_log2_r {
1009 	rsci64		next_seq;	/* sequence number of next log event */
1010 	rsci64		remaining_log_events;	/* events left to retrieve */
1011 	rsci16		num_events;		/* size of retrieved data */
1012 	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
1013 			    sizeof (rsci16))];
1014 } dp_get_event_log2_r_t;
1015 
1016 /*
1017  * This is ALOM's response to command codes it does not know.  It will
1018  * return the unknown command code in inv_type.  Note that this is
1019  * available starting with protocol version 3.  ALOM will not respond
1020  * to unknown commands in older versions of the protocol.
1021  */
1022 #define	DP_INVCMD	0x7F
1023 typedef struct dp_invcmd {
1024 	uint8_t inv_type;
1025 } dp_invcmd_t;
1026 
1027 #ifdef	__cplusplus
1028 }
1029 #endif
1030 
1031 #endif	/* _SYS_RMC_COMM_HPROTO_H */
1032