xref: /titanic_44/usr/src/uts/common/sys/mem.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 2004 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_PAGE_RETIRE		(('M' << 8) | 0x02)
64 #define	MEM_PAGE_ISRETIRED	(('M' << 8) | 0x03)
65 #define	MEM_NAME		(('M' << 8) | 0x04)
66 #define	MEM_INFO		(('M' << 8) | 0x05)
67 
68 typedef struct mem_name {
69 	uint64_t	m_addr;		/* memory address */
70 	uint64_t	m_synd;		/* architecture-specific syndrome */
71 	uint64_t	m_type[2];	/* architecture-specific type */
72 	caddr_t		m_name;		/* memory name buffer */
73 	size_t		m_namelen;	/* memory name buffer length */
74 } mem_name_t;
75 
76 #if	defined(_SYSCALL32)
77 typedef struct mem_name32 {
78 	uint64_t	m_addr;
79 	uint64_t	m_synd;
80 	uint64_t	m_type[2];
81 	caddr32_t	m_name;
82 	size32_t	m_namelen;
83 } mem_name32_t;
84 #endif	/* _SYSCALL32 */
85 
86 typedef struct mem_info {
87 	uint64_t	m_addr;		/* memory address */
88 	uint64_t	m_synd;		/* architecture-specific syndrome */
89 	uint64_t	m_mem_size;	/* total memory size */
90 	uint64_t	m_seg_size;	/* segment size */
91 	uint64_t	m_bank_size;	/* bank size */
92 	int		m_segments;	/* # of segments */
93 	int		m_banks;	/* # of banks in segment */
94 	int		m_mcid;		/* associated memory controller id */
95 } mem_info_t;
96 
97 #ifdef	_KERNEL
98 
99 extern pfn_t impl_obmem_pfnum(pfn_t);
100 
101 #endif	/* _KERNEL */
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 #endif	/* _SYS_MEM_H */
108