summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/sys/rmc_comm_hproto.h
blob: ac1695a44fd1c60f3de24400b1df13e65881fb69 (plain)
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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
/*
 * 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 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_RMC_COMM_HPROTO_H
#define	_SYS_RMC_COMM_HPROTO_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * data types used in the data protocol fields
 */

typedef unsigned char rsci8;
typedef unsigned short rsci16;

typedef short rscis16;

#ifdef _LP64
typedef unsigned int rsci32;
typedef unsigned long rsci64;
#else
typedef unsigned long rsci32;
typedef unsigned long long rsci64;
#endif

/*
 * handle definition. Handles are used in the high-level data protocol
 * to identify FRU, sensors (temperature, voltage), and so on.
 */

typedef rsci16 dp_handle_t;

#define	DP_NULL_HANDLE		0xffff

#define	DP_MAX_HANDLE_NAME	32

#define	DP_NULL_MSG		0x00

/*
 * Supported message types and associated data types:
 */

#define	DP_RESET_RSC		0x7A

#define	DP_RESET_RSC_R		0x5A

#define	DP_UPDATE_FLASH		0x66

#define	DP_UPDATE_FLASH_R	0x46
typedef struct dp_update_flash_r {
	rsci32	status;		/* completion code */
} dp_update_flash_r_t;

#define	DP_RUN_TEST		0x74
typedef struct dp_run_test {
	rsci32	testno;		/* test number to run; see below. */
	rsci32	param_len;	/* # bytes in test parameter data. */
} dp_run_test_t;
/* followed by test parameters; see individual tests below. */

#define	DP_RUN_TEST_R		0x54
typedef struct dp_run_test_r {
	rsci32	status;		/* 0 = test passed, otherwise see failure */
				/* codes below. */
	rsci32	idatalen;	/* # items in input data array */
	rsci32	odatalen;	/* # items in output data array */
#define	DP_MAX_RUN_TEST_DATALEN (DP_MAX_MSGLEN-32)/2
	rsci8	idata[DP_MAX_RUN_TEST_DATALEN];	/* input data array */
	rsci8	odata[DP_MAX_RUN_TEST_DATALEN];	/* output data array */
} dp_run_test_r_t;

#define	RSC_TEST_PASSED		0
#define	RSC_TEST_SW_FAILURE	1
#define	RSC_TEST_BAD_DATA	2
#define	RSC_TEST_NO_RESPONSE	3
#define	RSC_TEST_BAD_CRC	4
#define	RSC_TEST_BAD_PARAMS	5
#define	RSC_TEST_NO_DEVICE	6
#define	RSC_TEST_DEV_SETUP_FAIL	7
#define	RSC_TEST_MEM_ALLOC_FAIL	8
#define	RSC_TEST_ENET_ADDR_FAIL	9
#define	RSC_TEST_DEV_INFO_FAIL	10
#define	RSC_TEST_NYI		255

#define	DP_RSC_STATUS		0x73

#define	DP_RSC_STATUS_R		0x53
typedef struct dp_rsc_status_r {
/* The first six fields here must not be changed to ensure that they  */
/* are the same in all versions of RSC, most notably when compared to */
/* 1.x. New fields must be added to the end of the structure. */
	rsci16	main_rev_major;
	rsci16	main_rev_minor;
	rsci16	bootmon_rev_major;
	rsci16	bootmon_rev_minor;
	rsci16	post_status;
	rsci16	nusers;		/* number of users currently logged in to */
				/* CLI.  */
/* Any new fields in the structure may be added after this point ONLY! */
	rsci16	release_rev_major;
	rsci16	release_rev_minor;
	rsci16	release_rev_micro;
	rsci16	main_rev_micro;
	rsci16	bootmon_rev_micro;
	rsci16	hardware_rev;

	rsci32 bm_cksum;
	rsci8  rsc_build;
	char creationDate[256];
	rsci32 fw_cksum;
	rsci32 sys_mem;
	rsci32 nvram_version;

} dp_rsc_status_r_t;

#define	DP_SET_CFGVAR		0x76
typedef struct dp_set_cfgvar {
	rsci32	hidden;		/* boolean */
} dp_set_cfgvar_t;

/* Data is variable name & new value as zero-terminated ascii strings. */

#define	DP_SET_CFGVAR_R		0x56
typedef struct dp_set_cfgvar_r {
	rsci32	status;		/* completion code */
} dp_set_cfgvar_r_t;

#define	DP_GET_CFGVAR		0x67
/* Data is variable name as zero-terminated ascii string. */

#define	DP_GET_CFGVAR_R		0x47
typedef struct dp_get_cfgvar_r {
	rsci32	status;		/* completion code */
} dp_get_cfgvar_r_t;
/* followed by value of variable as a zero-terminated ascii string. */

#define	DP_GET_CFGVAR_NAME	0x6E
/*
 * Data is variable name as zero-terminated ascii string.  A zero-length
 * string means 'return the name of the "first" variable.'
 */

#define	DP_GET_CFGVAR_NAME_R	0x4E
typedef struct dp_get_cfgvar_name_r {
	rsci32	status;		/* completion code */
} dp_get_cfgvar_name_r_t;
/* followed by name of "next" variable as a zero-terminated ascii string. */

#define	DP_SET_DATE_TIME		0x64
#define	DP_SET_DATE_TIME_IGNORE_FIELD	0xFFFF
typedef struct dp_set_date_time {
	rsci32	year;		/* Full year, IE 1997 */
	rsci32	month;		/* 1 = Jan, 2 = Feb, etc. */
	rsci32	day;		/* Day of the month, 1 to 31. */
	rsci32	hour;		/* 0 to 23 */
	rsci32	minute;		/* 0 to 59 */
	rsci32	second;		/* 0 to 59 */
} dp_set_date_time_t;

#define	DP_SET_DATE_TIME_R	0x44
typedef struct dp_set_date_time_r {
	rsci32	status;		/* 0 - succes, non-zero - fail. */
} dp_set_date_time_r_t;

#define	DP_GET_DATE_TIME	0x65
#define	DP_GET_DATE_TIME_R	0x45
typedef struct dp_get_date_time_r {
	rsci32	status;		/* completion code */
	rsci32	current_datetime; /* in Unix format */
} dp_get_date_time_r_t;
/* followed by the date represented as a zero-terminated ascii string. */


#define	DP_SEND_ALERT		0x61
typedef struct dp_send_alert {
	rsci32	critical; /* boolean */
} dp_send_alert_t;

#define	DP_SEND_ALERT_R		0x41
typedef struct dp_send_alert_r {
	rsci32	status;		/* completion code */
} dp_send_alert_r_t;

#define	DP_GET_TEMP		0x78

#define	DP_GET_TEMP_R		0x58
typedef struct dp_get_temp_r {
	rsci32	status;
	rsci32	current_temp;
} dp_get_temp_r_t;

/*
 * Implementations using this level of protocol or above,
 * will generate a response to any supplied command code.
 * This doesn't mean they will support a given command.
 * It only means that they will generate a response to that
 * command.
 */
#define	SDP_RESPONDS_TO_ALL_CMDS	3

#define	DP_GET_SDP_VERSION	0x7B

#define	DP_GET_SDP_VERSION_R	0x5B
typedef struct dp_get_sdp_version_r {
	rsci32	version;
} dp_get_sdp_version_r_t;

#define	DP_GET_TOD_CLOCK	0x7C

#define	DP_GET_TOD_CLOCK_R	0x5C
typedef struct dp_get_tod_clock_r {
	rsci32	current_tod;
} dp_get_tod_clock_r_t;

#define	DP_MAX_LOGSIZE		(DP_MAX_MSGLEN-24)

#define	DP_GET_EVENT_LOG	0x7D

/*
 * NOTE: changing this or the dp_event_log_entry structure will almost
 * certainly require changing the code that parses these structures
 * in scadm.  See src/cmd/scadm/sparcv9/mpxu/common/eventlog.c.
 */
#define	DP_GET_EVENT_LOG_R	0x5D
typedef struct dp_get_event_log_r {
	rsci32	entry_count;
	rsci8	data[DP_MAX_LOGSIZE];
} dp_get_event_log_r_t;

typedef struct dp_event_log_entry {
	rsci32	eventTime;
	rsci32	eventId;
	rsci32	paramLen;
	char	param[256];
} dp_event_log_entry_t;

#define	DP_GET_PCMCIA_INFO	0x7E

#define	DP_GET_PCMCIA_INFO_R	0x5E
typedef struct dp_get_pcmcia_info_r {
	rsci32	card_present;	/* true=present, false=no card */
	rsci32	idInfoLen;
	rsci8	idInfo[256];
} dp_get_pcmcia_info_r_t;


#define	DP_USER_MAX		16
#define	DP_USER_NAME_SIZE	16

/* User sub-commands */
#define	DP_USER_CMD_ADD		0x1
#define	DP_USER_CMD_DEL		0x2
#define	DP_USER_CMD_SHOW	0x3
#define	DP_USER_CMD_PASSWORD	0x4
#define	DP_USER_CMD_PERM	0x5

/*
 * The following fields are used to set the user permissions.
 * Each must be represented as a single bit in the parm field.
 */
#define	DP_USER_PERM_C		0x1
#define	DP_USER_PERM_U		0x2
#define	DP_USER_PERM_A		0x4
#define	DP_USER_PERM_R		0x8

/*
 * values for parm for CMD_SHOW.  Anything other than 0 will show
 * the user # up to and including DP_USER_MAX
 */
#define	DP_USER_SHOW_USERNAME	0x0

/* Error values for status */
#define	DP_ERR_USER_FULL	0x1  /* No free user slots */
#define	DP_ERR_USER_NONE	0x2  /* User does not exist */
#define	DP_ERR_USER_BAD		0x3  /* Malformed username */
#define	DP_ERR_USER_NACT	0x4  /* user # not activated */
#define	DP_ERR_USER_THERE	0x5  /* user already registered */
#define	DP_ERR_USER_PASSWD	0x6  /* invalid password */
#define	DP_ERR_USER_WARNING	0x7  /* Malformed username warning */
#define	DP_ERR_USER_NYI		0xFD /* Not yet implemented */
#define	DP_ERR_USER_UNDEF	0xFE /* Undefine error */
#define	DP_ERR_USER_CMD		0xFF /* Invalid Command */

#define	DP_USER_ADM		0x50
/*
 * The parm field is used by the permission command to set specific
 *  permissions.  The parm field is also used by the show command to
 * indicate if the user name is specified or not.
 */
typedef struct dp_user_adm {
	rsci32	command;
	rsci32	parm;
} dp_user_adm_t;
/*
 * followed by zero-terminated ascii strings.  All user commands
 * are followed by the username. The password command is also
 * followed by the password.
 */

#define	DP_USER_ADM_R		0x51
/*
 * the response field is used to return the user permissions
 * for the user permissions command. The response is also used
 * to echo back the user selection for the show command.
 */
typedef struct dp_user_adm_r {
	rsci32	status;		/* completion code */
	rsci32  command;	/* echo back adm command */
	rsci32	response;
} dp_user_adm_r_t;
/* followed by a zero-terminated ascii string for the show command.  */


#define	DP_MODEM_PASS		0
#define	DP_MODEM_FAIL		-1

/* Commands used for rscadm modem_setup */
#define	DP_MODEM_CONNECT	0x30
#define	DP_MODEM_CONNECT_R	0x31
typedef struct dp_modem_connect_r {
	rsci32	status;
} dp_modem_connect_r_t;

/* There is no reponse to a modem_data command */
/* The modem data command goes in both directions */
#define	DP_MODEM_DATA		0x32
/* followed by a zero-terminated ascii string */

#define	DP_MODEM_DISCONNECT	0x34
#define	DP_MODEM_DISCONNECT_R	0x35
typedef struct dp_modem_disconnect_r {
	rsci32	status;
} dp_modem_disconnect_r_t;


#define	DP_GET_TICKCNT		0x22
#define	DP_GET_TICKCNT_R	0x23
typedef struct dp_get_tickcnt_r {
	rsci32	upper;		/* MSW of 64 bit tick count */
	rsci32	lower;		/* LSW of 64 bit tick count */
} dp_get_tickcnt_r_t;


#define	DP_SET_DEFAULT_CFG	0x72

#define	DP_SET_DEFAULT_CFG_R	0x52
typedef struct dp_set_default_cfg_r {
	rsci32	status;
} dp_set_default_cfg_r_t;


#define	DP_GET_NETWORK_CFG	0x59

#define	DP_GET_NETWORK_CFG_R	0x79
typedef struct dp_get_network_cfg_r {
	rsci32	status;
	char	ipMode[7];
	char	ipAddr[16];
	char	ipMask[16];
	char	ipGateway[16];
	char	ethAddr[18];
	char	ipDHCPServer[16];
} dp_get_network_cfg_r_t;


/*
 * Parameters for DP_RUN_TEST message:
 */

/*
 * Test routines need to know what the low-level protocol sync
 * character is.
 */

#define	RSC_TEST_SERIAL		0
typedef struct rsc_serial_test {
	rsci32	testtype;
#define	RSC_SERIAL_TTYC_LB	0
#define	RSC_SERIAL_TTYC_LB_OFF	1
#define	RSC_SERIAL_TTYD_LB	2
#define	RSC_SERIAL_TTYD_LB_OFF	3
#define	RSC_SERIAL_TTYCD_LB	4
#define	RSC_SERIAL_TTYCD_LB_OFF	5
#define	RSC_SERIAL_TTYU_INT_LB	6
#define	RSC_SERIAL_TTYU_EXT_LB	7
	rsci32	baud;
	rsci32	passes;
	rsci32	datalen;
	rsci8	data[DP_MAX_MSGLEN-32];
} rsc_serial_test_t;

#define	RSC_TEST_ENET		1
typedef struct rsc_enet_test {
	rsci32	testtype;
#define	RSC_ENET_INT_LB		0
#define	RSC_ENET_EXT_LB		1
#define	RSC_ENET_PING		2
#define	RSC_ENET_INT_PHY_LB	3
	rsci8	ip_addr[4];
	rsci32	passes;
	rsci32	datalen;
	rsci8	data[DP_MAX_MSGLEN-32];
} rsc_enet_test_t;

#define	RSC_TEST_FLASH_CRC	2
typedef struct rsc_flash_crcs_r {
	rsci32	boot_crc;
	rsci32	main_crc;
} rsc_flash_crcs_r_t;

#define	RSC_TEST_SEEPROM_CRC	3
typedef struct rsc_seeprom_crcs_r {
	rsci32	hdr_crc;
	rsci32	main_crc;
} rsc_seeprom_crcs_r_t;

#define	RSC_TEST_FRU_SEEPROM_CRC 4
typedef struct rsc_fru_crcs_r {
	rsci32	ro_hdr_crc;
	rsci32	seg_sd_crc;
} rsc_fru_crcs_r_t;


/*
 * new commands definitions
 */

#define	DP_GET_SYSINFO		0x20

#define	DP_GET_SYSINFO_R	0x21
typedef struct dp_get_sysinfo_r {
	rsci8 maxTemp;		/* max number of temperature sensors */
	rsci8 maxFan;		/* max number of FANs */
	rsci8 maxPSU;		/* max number of PSUs slot */
	rsci8 maxLED;		/* max number of LEDs */
	rsci8 maxVolt;		/* max number of voltage sensors */
	rsci8 maxFRU;		/* max number of FRUs (field replac. unit)  */
	rsci8 maxCircuitBrks;	/* max number of circuit breakers */
	rsci8 keyswitch;	/* key switch setting value */
} dp_get_sysinfo_r_t;


#define	DP_GET_TEMPERATURES	0x24
typedef struct dp_get_temperatures {
	dp_handle_t handle;	/* handle of a temperature sensor */
				/* or <null handle> (0xffff) */
} dp_get_temperatures_t;

/* Data is variable name & new value as zero-terminated ascii strings. */

#define	DP_GET_TEMPERATURES_R	0x25
typedef rscis16		dp_tempr_t;

enum sensor_status {
	DP_SENSOR_DATA_AVAILABLE = 0,
	DP_SENSOR_DATA_UNAVAILABLE,
	DP_SENSOR_NOT_PRESENT
};

typedef struct dp_tempr_status {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	dp_tempr_t	value;	/* temperature value (celsius). */

	dp_tempr_t 	low_warning;
	dp_tempr_t 	low_soft_shutdown;
	dp_tempr_t 	low_hard_shutdown;
	dp_tempr_t 	high_warning;
	dp_tempr_t 	high_soft_shutdown;
	dp_tempr_t 	high_hard_shutdown;

} dp_tempr_status_t;

typedef struct dp_get_temperatures_r {
	rsci8			num_temps;
	dp_tempr_status_t	temp_status[1];

} dp_get_temperatures_r_t;


#define	DP_GET_FAN_STATUS	0x26
typedef struct dp_get_fan_status {
	dp_handle_t handle;	/* handle of a temperature sensor */
				/* or <null handle> (0xffff) */
} dp_get_fan_status_t;

#define	DP_GET_FAN_STATUS_R	0x27

typedef struct dp_fan_status {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci8 		flag;

#define	DP_FAN_PRESENCE		0x01	/* FAN presence (bit set=FAN present) */
#define	DP_FAN_SPEED_VAL_UNIT	0x02	/* speed unit	(bit set=relative, */
					/*		bit clear=RPM) */
#define	DP_FAN_STATUS		0x04	/* FAN status (bit set=error) */

	rsci16		speed;	/* FAN speed. */
	rsci16		minspeed; /* minimum FAN speed warning threshold */

} dp_fan_status_t;

typedef struct dp_get_fan_status_r {
	rsci8		num_fans;
	dp_fan_status_t	fan_status[1];

} dp_get_fan_status_r_t;


#define	DP_GET_PSU_STATUS	0x28
typedef struct dp_get_psu_status {
	dp_handle_t handle;	/* handle of a temperature sensor */
				/* or <null handle> (0xffff) */
} dp_get_psu_status_t;

#define	DP_GET_PSU_STATUS_R	0x29
typedef struct dp_psu_status {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci16 		mask;		/* flag bit mask (feature presence) */
	rsci16 		flag;		/* status bits */

#define	DP_PSU_PRESENCE			0x0001	/* PSU presence  */
#define	DP_PSU_OUTPUT_STATUS		0x0002	/* output status */
#define	DP_PSU_INPUT_STATUS		0x0004	/* input status */
#define	DP_PSU_SEC_INPUT_STATUS		0x0008	/* secondary input status */
#define	DP_PSU_OVERTEMP_FAULT		0x0010	/* over temperature fault */
#define	DP_PSU_FAN_FAULT    		0x0020	/* FAN fault */
#define	DP_PSU_FAIL_STATUS		0x0040	/* PSU generic fault */
#define	DP_PSU_OUTPUT_VLO_STATUS	0x0080	/* output under voltage */
#define	DP_PSU_OUTPUT_VHI_STATUS	0x0100	/* output over voltage */
#define	DP_PSU_OUTPUT_AHI_STATUS	0x0200	/* output over current */
#define	DP_PSU_ALERT_STATUS		0x0400	/* PSU alert indication */
#define	DP_PSU_PDCT_FAN			0x0800	/* predicted fan fail */
#define	DP_PSU_NR_WARNING		0x1000	/* non-redundancy condition */

			/* presence: 	bit clear=not present */
			/*		bit set=present */
			/* status:	bit clear=ok */
			/*		bit set=generic fault */
} dp_psu_status_t;

typedef struct dp_get_psu_status_r {

	rsci8		num_psus;
	dp_psu_status_t	psu_status[1];

} dp_get_psu_status_r_t;

#define	DP_GET_FRU_STATUS	0x2A
typedef struct dp_get_fru_status {
	dp_handle_t handle;	/* handle of a hot pluggable unit */
				/* or <null handle> (0xffff)	  */
} dp_get_fru_status_t;


#define	DP_GET_FRU_STATUS_R	0x2B
typedef struct dp_fru_status {

	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci8		presence;	/* 1=FRU present */
	rsci8		status;

} dp_fru_status_t;

enum dp_fru_status_type {
	DP_FRU_STATUS_OK = 1,
	DP_FRU_STATUS_FAILED,
	DP_FRU_STATUS_BLACKLISTED,
	DP_FRU_STATUS_UNKNOWN
};

typedef struct dp_get_fru_status_r {
	rsci8		num_frus;
	dp_fru_status_t	fru_status[1];

} dp_get_fru_status_r_t;

/*
 * DP_GET_DEVICE(_R) command is used to discover I2C devices dynamically
 * (used by SunVTS)
 */
#define	DP_GET_DEVICE		0x2C

typedef struct dp_get_device {
	dp_handle_t	handle;	/* handle of a device or */
				/* <null handle>(0xffff) */
} dp_get_device_t;

#define	DP_GET_DEVICE_R		0x2D

#define	DP_MAX_DEVICE_TYPE_NAME	32

typedef struct dp_device {
	dp_handle_t	handle;
	rsci8		presence;	/* 0 is not present, 1 is present */
	char		device_type[DP_MAX_DEVICE_TYPE_NAME];
} dp_device_t;

typedef struct dp_get_device_r {
	rsci8		num_devices;
	dp_device_t	device[1];
} dp_get_device_r_t;


#define	DP_SET_CPU_SIGNATURE	0x33

typedef struct dp_set_cpu_signature {
	int		cpu_id;		/* see PSARC 2000/205 for more */
	ushort_t	sig; 		/* information on the value/meaning */
	uchar_t		states;		/* of these fields */
	uchar_t		sub_state;

} dp_cpu_signature_t;


#define	DP_SET_CPU_NODENAME	0x38

#define	DP_MAX_NODENAME		256

typedef struct dp_set_nodename {
	char		nodename[DP_MAX_NODENAME];
} dp_set_nodename_t;


#define	DP_GET_LED_STATE	0x3C

typedef struct dp_get_led_state {
	dp_handle_t handle;	/* handle of a hot pluggable unit */
				/* or <null handle> (0xffff) */
} dp_get_led_state_t;

#define	DP_GET_LED_STATE_R	0x3D

typedef struct dp_led_state {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci8		state;
	rsci8		colour;
} dp_led_state_t;

typedef struct dp_get_led_state_r {
	rsci8		num_leds;
	dp_led_state_t	led_state[1];
} dp_get_led_state_r_t;

/* LED states */

enum dp_led_states {
	DP_LED_OFF = 0,
	DP_LED_ON,
	DP_LED_FLASHING,
	DP_LED_BLINKING
};

enum dp_led_colours {
	DP_LED_COLOUR_NONE = -1,
	DP_LED_COLOUR_ANY,
	DP_LED_COLOUR_WHITE,
	DP_LED_COLOUR_BLUE,
	DP_LED_COLOUR_GREEN,
	DP_LED_COLOUR_AMBER
};


#define	DP_SET_LED_STATE	0x3E

typedef struct dp_set_led_state {
	dp_handle_t	handle;		/* handle of a LED */
	rsci8		state;
} dp_set_led_state_t;

#define	DP_SET_LED_STATE_R	0x3F
typedef struct dp_set_led_state_r {
	rsci8		status;
} dp_set_led_state_r_t;

enum dp_set_led_status {
	DP_SET_LED_OK = 0,
	DP_SET_LED_INVALID_HANDLE,
	DP_SET_LED_ERROR
};


#define	DP_GET_ALARM_STATE	0x68

typedef struct dp_get_alarm_state {
	dp_handle_t handle;	/* handle of an alarm relay */
				/* or <null handle> (0xffff) */
} dp_get_alarm_state_t;

#define	DP_GET_ALARM_STATE_R	0x69

typedef struct dp_alarm_state {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci8		state;
} dp_alarm_state_t;

typedef struct dp_get_alarm_state_r {
	rsci8		num_alarms;
	dp_alarm_state_t	alarm_state[1];
} dp_get_alarm_state_r_t;

/* ALARM states */

enum dp_alarm_states {
	DP_ALARM_OFF = 0,
	DP_ALARM_ON
};

#define	DP_SET_ALARM_STATE	0x6A

typedef struct dp_set_alarm_state {
	dp_handle_t	handle;		/* handle of a ALARM */
	rsci8		state;
} dp_set_alarm_state_t;

#define	DP_SET_ALARM_STATE_R	0x6B
typedef struct dp_set_alarm_state_r {
	rsci8		status;
} dp_set_alarm_state_r_t;

enum dp_set_alarm_status {
	DP_SET_ALARM_OK = 0,
	DP_SET_ALARM_INVALID_HANDLE,
	DP_SET_ALARM_ERROR
};


#define	DP_SET_USER_WATCHDOG	0x60
#define	DP_SET_USER_WATCHDOG_R	0x6F
#define	DP_GET_USER_WATCHDOG	0x70
#define	DP_GET_USER_WATCHDOG_R	0x71

#define	DP_USER_WATCHDOG_ENABLE		0x01
#define	DP_USER_WATCHDOG_DISABLE	0x00

enum dp_user_watchdog_status {
	DP_USER_WDT_OK = 0,
	DP_USER_WDT_ERROR
};

typedef struct dp_set_user_watchdog {
	rsci8 enable;	/* enable = 1 */
} dp_set_user_watchdog_t;

typedef struct dp_set_user_watchdog_r {
	rsci8 status;
} dp_set_user_watchdog_r_t;

typedef struct dp_get_user_watchdog_r {
	rsci8 enable;
} dp_get_user_watchdog_r_t;

#define	DP_GET_VOLTS		0x42

typedef struct dp_get_volts {
	dp_handle_t	handle;		/* handle of a voltage sensor */
} dp_get_volts_t;

#define	DP_GET_VOLTS_R		0x43

typedef rscis16		dp_volt_reading_t;	/* unit in mV */

typedef struct dp_volt_status {
	dp_handle_t		handle;
	rsci8			sensor_status; 	/* tells whether the reading */
						/* is available or not */
	rsci8			status;		/* 0=ok, 1=error */
	dp_volt_reading_t	reading;	/* value in mV. */
	dp_volt_reading_t	low_warning;
	dp_volt_reading_t	low_soft_shutdown;
	dp_volt_reading_t	low_hard_shutdown;
	dp_volt_reading_t	high_warning;
	dp_volt_reading_t	high_soft_shutdown;
	dp_volt_reading_t	high_hard_shutdown;

} dp_volt_status_t;

typedef struct dp_get_volts_r {
	rsci8			num_volts;
	dp_volt_status_t	volt_status[1];

} dp_get_volts_r_t;


#define	DP_GET_CIRCUIT_BRKS	0x62

typedef struct dp_get_circuit_brks {
	dp_handle_t handle;	/* handle of a circuit breaker */
				/* or <null handle> (0xffff) */
} dp_get_circuit_brks_t;

#define	DP_GET_CIRCUIT_BRKS_R	0x63

typedef struct dp_circuit_brk_status {
	dp_handle_t	handle;
	rsci8		sensor_status; 	/* tells whether the reading is */
					/* available or not */
	rsci8		status;		/* 0=ok, 1=error */

} dp_circuit_brk_status_t;

typedef struct dp_get_circuit_brks_r {
	rsci8			num_circuit_brks;
	dp_circuit_brk_status_t	circuit_brk_status[1];

} dp_get_circuit_brks_r_t;


#define	DP_SET_HOST_WATCHDOG	0x48

typedef struct dp_set_host_watchdog {
	rsci8	enable;		/* 0=enable watchdog, 1=disable watchdog */
} dp_set_host_watchdog_t;


#define	DP_GET_HANDLE_NAME	0x4A

typedef struct dp_get_handle_name {
	dp_handle_t	handle;
} dp_get_handle_name_t;

#define	DP_GET_HANDLE_NAME_R	0x4B

typedef struct dp_get_handle_name_r {
	dp_handle_t	handle;
	char 		name[DP_MAX_HANDLE_NAME];
} dp_get_handle_name_r_t;


#define	DP_GET_HANDLE		0x4C

typedef struct dp_get_handle {
	char 		name[DP_MAX_HANDLE_NAME];
} dp_get_handle_t;

#define	DP_GET_HANDLE_R		0x4D

typedef struct dp_get_handle_r {
	dp_handle_t 	handle;
} dp_get_handle_r_t;


#define	DP_RMC_EVENTS		0x57

typedef rsci16	dp_event_t;

/*
 * list of events
 */

enum rmc_events {
	RMC_INIT_EVENT	= 0x01,
	RMC_HPU_EVENT,
	RMC_ENV_EVENT,
	RMC_KEYSWITCH_EVENT,
	RMC_LOG_EVENT
};

/*
 * event data structures
 */
enum rmc_hpu_events {
	RMC_HPU_INSERT_EVENT	= 0x20,
	RMC_HPU_REMOVE_EVENT,
	RMC_HPU_HWERROR_EVENT
};

typedef struct dp_hpu_event {
	dp_handle_t	hpu_hdl;
	dp_event_t	sub_event;

} dp_hpu_event_t;


enum rmc_env_events {
	RMC_ENV_WARNING_THRESHOLD_EVENT = 0x31,
	RMC_ENV_SHUTDOWN_THRESHOLD_EVENT,
	RMC_ENV_FAULT_EVENT,
	RMC_ENV_OK_EVENT
};

typedef struct dp_env_event {
	dp_handle_t	env_hdl;
	dp_event_t	sub_event;

} dp_env_event_t;


enum rmc_keyswitch_pos {
	RMC_KEYSWITCH_POS_UNKNOWN	= 0x00,
	RMC_KEYSWITCH_POS_NORMAL,
	RMC_KEYSWITCH_POS_DIAG,
	RMC_KEYSWITCH_POS_LOCKED,
	RMC_KEYSWITCH_POS_OFF
};

typedef struct dp_keyswitch_event {
	rsci8	key_position;
} dp_keyswitch_event_t;


typedef struct dp_rmclog_event {
	int	log_record_size;
	rsci8	log_record[DP_MAX_LOGSIZE];
} dp_rmclog_event_t;

typedef union dp_event_info {
	dp_hpu_event_t		ev_hpunot;
	dp_env_event_t		ev_envnot;
	dp_keyswitch_event_t	ev_keysw;
	dp_rmclog_event_t	ev_rmclog;
} dp_event_info_t;

typedef struct dp_event_notification {
	dp_event_t	event;
	rsci32		event_seqno; 	/* event sequence number */
	rsci32		timestamp;	/* timestamp of the event */
	dp_event_info_t	event_info;	/* event information */
} dp_event_notification_t;

#define	DP_RMC_EVENTS_R		0x5F

typedef struct dp_event_notification_r {
	rsci32		event_seqno; 	/* event sequence number */
} dp_event_notification_r_t;

#define	DP_GET_CHASSIS_SERIALNUM	0x2E
#define	DP_GET_CHASSIS_SERIALNUM_R	0x2F
typedef struct dp_get_serialnum_r {
	rsci8		chassis_serial_number[32];
} dp_get_serialnum_r_t;

#define	DP_GET_CONSOLE_LOG	0x1A
typedef struct dp_get_console_log {
	rsci64		start_seq; 	/* sequence number of first log byte */
	rsci16		length;		/* expected size of retrieved data */
} dp_get_console_log_t;

#define	DP_GET_CONSOLE_LOG_R	0x1B
typedef struct dp_get_console_log_r {
	rsci64		next_seq;	/* sequence number of next log byte */
	rsci64		remaining_log_bytes;	/* bytes left to retrieve */
	rsci16		length;		/* size of retrieved data */
	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
			    sizeof (rsci16))];
} dp_get_console_log_r_t;

#define	DP_GET_CONFIG_LOG	0x1C
typedef struct dp_get_config_log {
	rsci64		start_seq;	/* sequence number of first log byte */
	rsci16		length;		/* size of retrieved data */
} dp_get_config_log_t;

#define	DP_GET_CONFIG_LOG_R	0x1D
typedef struct dp_get_config_log_r {
	rsci64		next_seq;	/* sequence number of next log byte */
	rsci64		remaining_log_bytes;	/* bytes left to retrieve */
	rsci16		length;		/* size of retrieved data */
	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
			    sizeof (rsci16))];
} dp_get_config_log_r_t;

#define	DP_GET_EVENT_LOG2	0x1E
typedef struct dp_get_event_log2 {
	rsci64		start_seq;	/* sequence number of first log event */
	rsci16		length;		/* size of retrieved data */
} dp_get_event_log2_t;

#define	DP_GET_EVENT_LOG2_R	0x1F
typedef struct dp_get_event_log2_r {
	rsci64		next_seq;	/* sequence number of next log event */
	rsci64		remaining_log_events;	/* events left to retrieve */
	rsci16		num_events;		/* size of retrieved data */
	char		buffer[DP_MAX_MSGLEN - (sizeof (rsci64) * 2 +
			    sizeof (rsci16))];
} dp_get_event_log2_r_t;

/*
 * This is ALOM's response to command codes it does not know.  It will
 * return the unknown command code in inv_type.  Note that this is
 * available starting with protocol version 3.  ALOM will not respond
 * to unknown commands in older versions of the protocol.
 */
#define	DP_INVCMD	0x7F
typedef struct dp_invcmd {
	uint8_t inv_type;
} dp_invcmd_t;

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_RMC_COMM_HPROTO_H */