xref: /titanic_41/usr/src/uts/intel/sys/mc.h (revision 20c794b39650d115e17a15983b6b82e46238cf45)
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 2007 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;			/* system board */
45 	int unum_chip;			/* chip/socket */
46 	int unum_mc;			/* memory-controller or branch */
47 	int unum_chan;			/* DRAM channel */
48 	int unum_cs;			/* chip-select */
49 	int unum_rank;			/* rank */
50 	uint64_t unum_offset;		/* row, column, bank-select etc */
51 	int unum_dimms[MC_UNUM_NDIMM];
52 } mc_unum_t;
53 
54 /*
55  * Invalid marker used in some numeric properties
56  */
57 #define	MC_INVALNUM		((uint32_t)-1)
58 
59 /*
60  * /dev/mc/mc* ioctl cmds
61  */
62 #define	MC_IOC			(0x4d43 << 16)
63 #define	MC_IOC_SNAPSHOT_INFO	(MC_IOC | 1)
64 #define	MC_IOC_SNAPSHOT		(MC_IOC | 2)
65 #define	MC_IOC_ONLINESPARE_EN	(MC_IOC | 4)
66 
67 /*
68  * Prior to requesting a copy of the snapshot, consumers are advised to request
69  * information regarding the snapshot.  An mc_snapshot_info_t will be returned,
70  * containing the snapshot size as well as the snapshot generation number.  Note
71  * that, due to the potentially dynamic nature of the system, the snapshot may
72  * change at any time.  As such, the information in the mc_snapshot_info_t may
73  * be out of date by the time it is used.  The generation number is used to
74  * track snapshot changes.  That is, the generation number will be updated each
75  * time the source data for the snapshot is updated.  The consumer should not
76  * attach any meaning to the magnitude of a generation number change, and pay
77  * attention only to the fact that the number has changed.
78  */
79 typedef struct mc_snapshot_info {
80 	uint32_t mcs_size;	/* snapshot size */
81 	uint_t mcs_gen;		/* snapshot generation number */
82 } mc_snapshot_info_t;
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* _SYS_MC_H */
89