xref: /titanic_50/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_dp.h (revision d00f0155af9a9a671eb08a0dc30f5ea0a379c36c)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _CMD_DATAPATH_H
28 #define	_CMD_DATAPATH_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <cmd_fmri.h>
33 
34 /*
35  * Member Name     Data Type          Comments
36  * -----------     ---------          -----------
37  * version         uint8              0
38  * class           string             "asic"
39  * ENA             uint64             ENA Format 1
40  * detector        fmri               aggregated ID data for SC-DE
41  *
42  * Datapath ereport subclasses and data payloads:
43  * There will be two types of ereports (error and fault) which will be
44  * identified by the "type" member.
45  *
46  * ereport.asic.*.cds.cds-dp
47  * ereport.asic.*.dx.dx-dp
48  * ereport.asic.*.sdi.sdi-dp
49  * ereport.asic.*.cp.cp-dp
50  * ereport.asic.*.rp.rp-dp
51  *
52  * Member Name     Data Type          Comments
53  * -----------     ---------          -----------
54  * erptype         uint16            derived from message type: error or
55  *                                   fault
56  * t-value         uint32            SC's datapath SERD timeout threshold
57  * dp-list-sz      uint8             number of dp-list array elements
58  * dp-list         array of uint16   Safari IDs of affected cpus
59  * sn-list         array of uint64   Serial numbers of affected cpus
60  */
61 
62 #define		DP_MAX_FRU	23	/* maximum char length of dp FRUs */
63 #define		DP_MAX_ASRUS	12	/* maximum number of dp ASRUs */
64 #define		DP_MAX_CLASS	32	/* max length of dp fault class */
65 #define		DP_MAX_BUF	16	/* max len for general purpose buffer */
66 #define		DP_MAX_NUM_CPUS	8	/* max number of CPUs in a DP ereport */
67 #define		DP_MAX_MCS	4	/* max # of MCs per memory page */
68 
69 #define	CMD_DP_VERSION_0	0
70 #define	CMD_DP_VERSION		CMD_DP_VERSION_0
71 
72 /* Portion of datapath structure to be persisted */
73 typedef struct cmd_dp_pers {
74 	cmd_header_t	dpp_header;	/* Nodetype must be CMD_NT_DP */
75 	uint_t		dpp_version;	/* struct version */
76 	uint16_t	dpp_erpt_type;	/* ereport type (fault or error) */
77 	uint8_t		dpp_err;	/* CDS, DX, EX, CP (xc), RP (sg) */
78 	uint32_t	dpp_t_value;	/* SERD timeout threshold (seconds) */
79 	uint32_t	dpp_ncpus;	/* number of associated CPUs */
80 	uint16_t	dpp_cpuid_list[DP_MAX_NUM_CPUS]; /* array of CPU ids */
81 	uint64_t	dpp_serid_list[DP_MAX_NUM_CPUS]; /* CPU serial #'s */
82 } cmd_dp_pers_t;
83 
84 typedef struct cmd_dp {
85 	cmd_dp_pers_t	dp_pers;
86 	fmd_case_t	*dp_case;	/* fmd case pointer */
87 	id_t		dp_id;		/* timer id */
88 } cmd_dp_t;
89 
90 #define	CMD_DP_MAXSIZE		sizeof (cmd_dp_pers_t)
91 #define	CMD_DP_MINSIZE		sizeof (cmd_dp_pers_t)
92 
93 #define	dp_header		dp_pers.dpp_header
94 #define	dp_nodetype		dp_pers.dpp_header.hdr_nodetype
95 #define	dp_bufname		dp_pers.dpp_header.hdr_bufname
96 #define	dp_version		dp_pers.dpp_version
97 #define	dp_erpt_type		dp_pers.dpp_erpt_type
98 #define	dp_err			dp_pers.dpp_err
99 #define	dp_cpuid		dp_pers.dpp_cpuid
100 #define	dp_ncpus		dp_pers.dpp_ncpus
101 #define	dp_t_value		dp_pers.dpp_t_value
102 #define	dp_cpuid_list		dp_pers.dpp_cpuid_list
103 #define	dp_serid_list		dp_pers.dpp_serid_list
104 
105 extern cmd_evdisp_t cmd_dp_cds(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
106     const char *, cmd_errcl_t);
107 
108 extern cmd_evdisp_t cmd_dp_dx(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
109     const char *, cmd_errcl_t);
110 
111 extern cmd_evdisp_t cmd_dp_ex(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
112     const char *, cmd_errcl_t);
113 
114 extern cmd_evdisp_t cmd_dp_cp(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
115     const char *, cmd_errcl_t);
116 
117 extern void cmd_dp_close(fmd_hdl_t *, void *);
118 extern void cmd_dp_timeout(fmd_hdl_t *, id_t);
119 extern cmd_dp_t *cmd_dp_lookup_fault(fmd_hdl_t *, uint32_t);
120 extern void *cmd_dp_restore(fmd_hdl_t *, fmd_case_t *, cmd_case_ptr_t *);
121 extern void cmd_dp_validate(fmd_hdl_t *);
122 extern void cmd_dp_destroy(fmd_hdl_t *, cmd_dp_t *);
123 extern nvlist_t *cmd_dp_setasru(fmd_hdl_t *, cmd_dp_t *);
124 extern cmd_dp_t *cmd_dp_lookup_error(cmd_dp_t *);
125 extern void dp_buf_write(fmd_hdl_t *, cmd_dp_t *);
126 extern int cmd_dp_error(fmd_hdl_t *);
127 extern int cmd_dp_fault(fmd_hdl_t *, uint64_t);
128 extern int cmd_dp_get_mcid(uint64_t, int *);
129 extern void cmd_dp_fini(fmd_hdl_t *);
130 
131 #endif /* _CMD_DATAPATH_H */
132