xref: /titanic_51/usr/src/uts/intel/sys/mc.h (revision 24db46411fd54f70c35b94bb952eb7ba040e43b4)
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  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
22  * Use is subject to license terms.
23  */
24 
25 #ifndef _SYS_MC_H
26 #define	_SYS_MC_H
27 
28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 /*
31  * Public interfaces exposed by the memory controller driver
32  */
33 
34 #include <sys/cpuvar.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define	MC_UNUM_NAMLEN		192
41 #define	MC_UNUM_NDIMM		2
42 
43 typedef struct mc_unum {
44 	int unum_board;
45 	int unum_chip;
46 	int unum_mc;
47 	int unum_cs;
48 	int unum_rank;
49 	uint64_t unum_offset;
50 	int unum_dimms[MC_UNUM_NDIMM];
51 } mc_unum_t;
52 
53 /*
54  * Invalid marker used in some numeric properties
55  */
56 #define	MC_INVALNUM		((uint32_t)-1)
57 
58 #define	MC_AMD_DEV_OFFSET	24	/* node ID + offset == PCI dev num */
59 
60 /*
61  * /dev/mc/mc* ioctl cmds
62  */
63 #define	MC_IOC			(0x4d43 << 16)
64 #define	MC_IOC_SNAPSHOT_INFO	(MC_IOC | 1)
65 #define	MC_IOC_SNAPSHOT		(MC_IOC | 2)
66 #define	MC_IOC_ONLINESPARE_EN	(MC_IOC | 4)
67 
68 /*
69  * Prior to requesting a copy of the snapshot, consumers are advised to request
70  * information regarding the snapshot.  An mc_snapshot_info_t will be returned,
71  * containing the snapshot size as well as the snapshot generation number.  Note
72  * that, due to the potentially dynamic nature of the system, the snapshot may
73  * change at any time.  As such, the information in the mc_snapshot_info_t may
74  * be out of date by the time it is used.  The generation number is used to
75  * track snapshot changes.  That is, the generation number will be updated each
76  * time the source data for the snapshot is updated.  The consumer should not
77  * attach any meaning to the magnitude of a generation number change, and pay
78  * attention only to the fact that the number has changed.
79  */
80 typedef struct mc_snapshot_info {
81 	uint32_t mcs_size;	/* snapshot size */
82 	uint_t mcs_gen;		/* snapshot generation number */
83 } mc_snapshot_info_t;
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* _SYS_MC_H */
90