xref: /titanic_51/usr/src/uts/common/sys/mem.h (revision 35551380472894a564e057962b701af78f719377)
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 _SYS_MEM_H
28 #define	_SYS_MEM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 
38 /*
39  * Memory Device Minor Numbers
40  */
41 #define	M_MEM		0	/* /dev/mem - physical main memory */
42 #define	M_KMEM		1	/* /dev/kmem - virtual kernel memory */
43 #define	M_NULL		2	/* /dev/null - EOF & Rathole */
44 #define	M_ALLKMEM	3	/* /dev/allkmem - virtual kernel memory & I/O */
45 #define	M_ZERO		12	/* /dev/zero - source of private memory */
46 
47 /*
48  * Private ioctl for libkvm: translate virtual address to physical address.
49  */
50 #define	MEM_VTOP		(('M' << 8) | 0x01)
51 
52 typedef struct mem_vtop {
53 	struct as	*m_as;
54 	void		*m_va;
55 	pfn_t		m_pfn;
56 } mem_vtop_t;
57 
58 /*
59  * Private ioctls for fmd(1M).  These interfaces are Sun Private.  Applications
60  * and drivers should not make use of these interfaces: they can change without
61  * notice and programs that consume them will fail to run on future releases.
62  */
63 #define	MEM_NAME		(('M' << 8) | 0x04)
64 #define	MEM_INFO		(('M' << 8) | 0x05)
65 
66 #define	MEM_PAGE_RETIRE		(('M' << 8) | 0x02)
67 #define	MEM_PAGE_ISRETIRED	(('M' << 8) | 0x03)
68 #define	MEM_PAGE_UNRETIRE	(('M' << 8) | 0x06)
69 #define	MEM_PAGE_GETERRORS	(('M' << 8) | 0x07)
70 #define	MEM_PAGE_RETIRE_MCE	(('M' << 8) | 0x08)
71 #define	MEM_PAGE_RETIRE_UE	(('M' << 8) | 0x09)
72 #define	MEM_PAGE_RETIRE_TEST	(('M' << 8) | 0x0A)
73 
74 /*
75  * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M).
76  */
77 #define	MEM_PAGE_ERR_NONE	0x0
78 #define	MEM_PAGE_ERR_MULTI_CE	0x1
79 #define	MEM_PAGE_ERR_UE		0x2
80 #define	MEM_PAGE_ERR_FMA_REQ	0x8
81 
82 typedef struct mem_name {
83 	uint64_t	m_addr;		/* memory address */
84 	uint64_t	m_synd;		/* architecture-specific syndrome */
85 	uint64_t	m_type[2];	/* architecture-specific type */
86 	caddr_t		m_name;		/* memory name buffer */
87 	size_t		m_namelen;	/* memory name buffer length */
88 } mem_name_t;
89 
90 #if	defined(_SYSCALL32)
91 typedef struct mem_name32 {
92 	uint64_t	m_addr;
93 	uint64_t	m_synd;
94 	uint64_t	m_type[2];
95 	caddr32_t	m_name;
96 	size32_t	m_namelen;
97 } mem_name32_t;
98 #endif	/* _SYSCALL32 */
99 
100 typedef struct mem_info {
101 	uint64_t	m_addr;		/* memory address */
102 	uint64_t	m_synd;		/* architecture-specific syndrome */
103 	uint64_t	m_mem_size;	/* total memory size */
104 	uint64_t	m_seg_size;	/* segment size */
105 	uint64_t	m_bank_size;	/* bank size */
106 	int		m_segments;	/* # of segments */
107 	int		m_banks;	/* # of banks in segment */
108 	int		m_mcid;		/* associated memory controller id */
109 } mem_info_t;
110 
111 #ifdef	_KERNEL
112 
113 extern pfn_t impl_obmem_pfnum(pfn_t);
114 
115 #endif	/* _KERNEL */
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _SYS_MEM_H */
122