xref: /titanic_52/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_branch.h (revision 13faa91230bde46da937bf33010b9accc5bdeb59)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _CMD_BRANCH_H
27 #define	_CMD_BRANCH_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Memory modules are described by the cmd_branch general-purpose state
33  * structure.  This structure is used to track FBR errors
34  *
35  * Data structures:
36  *
37  *     ,--------.       ,--------.
38  *     |branch  | <---- |case_ptr| (CMD_PTR_BRANCH_CASE)
39  *     |        |       `--------'
40  *     |,-------|       ,-------------.
41  *  ,->||asru_t | ----> |packed nvlist|
42  *  |  |`-------|       `-------------'
43  *  `--|        |
44  *     | dimms  | ----> cmd_branch_memb_t -----> cmd_branch_memb_t -----> ...
45  *     `--------'            |                        |
46  *                      cmd_dimm_t                cmd_dimm_t
47  *
48  * Data structure	P?  Case? Notes
49  * ----------------	--- ----- ----------------------------------------------
50  * cmd_branch_pers_t	Yes No    Name is derived from the unum ("branch_%s")
51  * cmd_case_ptr_t	Yes Yes   Name is case's UUID
52  * branch_asru		Yes No    Name is derived from the unum
53  *                                ("branch_asru_%d")
54  * branch_unum		No  No    Pointer into ASRU - relinked during restore
55  * branch_dimms		No  No    Recreated during restore
56  */
57 
58 #include <cmd_mem.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 #define	MAX_CHANNELS_ON_CHIP	4
65 #define	MAX_DIMMS_IN_CHANNEL	4
66 #define	BTK_MAX_CHANNEL		2
67 #define	CMD_BOARDS_CERT		30
68 
69 typedef struct cmd_branch_memb {
70 	cmd_list_t bm_list;
71 	cmd_dimm_t *dimm;
72 } cmd_branch_memb_t;
73 
74 #define	CMD_BRANCH_VERSION_0	0
75 #define	CMD_BRANCH_VERSION	CMD_BRANCH_VERSION_0
76 
77 typedef struct cmd_branch_pers {
78 	cmd_header_t branchp_header;	/* Nodetype must be CMD_NT_BRANCH */
79 	uint_t branchp_version;
80 	cmd_fmri_t branchp_asru;	/* ASRU for this BRANCH */
81 	uint_t branchp_flags;		/* CMD_MEM_F_* */
82 } cmd_branch_pers_t;
83 
84 struct cmd_branch {
85 	cmd_branch_pers_t branch_pers;
86 	const char *branch_unum;	/* This BRANCH's name */
87 	cmd_case_t branch_case;		/* Open link errors case against */
88 					/* this BRANCH */
89 	cmd_list_t branch_dimms;	/* This BRANCH's dimms */
90 };
91 
92 #define	CMD_BRANCH_MAXSIZE	sizeof (cmd_branch_pers_t)
93 #define	CMD_BRANCH_MINSIZE	sizeof (cmd_branch_pers_t)
94 
95 #define	branch_header		branch_pers.branchp_header
96 #define	branch_nodetype		branch_pers.branchp_header.hdr_nodetype
97 #define	branch_bufname		branch_pers.branchp_header.hdr_bufname
98 #define	branch_version		branch_pers.branchp_version
99 #define	branch_asru		branch_pers.branchp_asru
100 #define	branch_asru_nvl		branch_pers.branchp_asru.fmri_nvl
101 #define	branch_flags		branch_pers.branchp_flags
102 
103 extern cmd_branch_t *cmd_branch_lookup(fmd_hdl_t *, nvlist_t *);
104 extern cmd_branch_t *cmd_branch_create(fmd_hdl_t *, nvlist_t *);
105 extern cmd_branch_t *cmd_branch_lookup_by_unum(fmd_hdl_t *, const char *);
106 
107 extern void cmd_branch_create_fault(fmd_hdl_t *, cmd_branch_t *,
108     const char *, nvlist_t *);
109 extern void cmd_branch_add_dimm(fmd_hdl_t *, cmd_branch_t *, cmd_dimm_t *);
110 extern void cmd_branch_remove_dimm(fmd_hdl_t *, cmd_branch_t *, cmd_dimm_t *);
111 
112 
113 extern void *cmd_branch_restore(fmd_hdl_t *, fmd_case_t *, cmd_case_ptr_t *);
114 extern void cmd_branch_destroy(fmd_hdl_t *, cmd_branch_t *);
115 extern void cmd_branch_validate(fmd_hdl_t *);
116 extern void cmd_branch_gc(fmd_hdl_t *);
117 extern void cmd_branch_fini(fmd_hdl_t *);
118 extern void cmd_branch_dirty(fmd_hdl_t *, cmd_branch_t *);
119 
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* _CMD_BRANCH_H */
126