xref: /onnv-gate/usr/src/uts/common/sys/mem.h (revision 917:a3d1e8247fa0)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*917Selowe  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_MEM_H
280Sstevel@tonic-gate #define	_SYS_MEM_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <sys/types.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * Memory Device Minor Numbers
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate #define	M_MEM		0	/* /dev/mem - physical main memory */
420Sstevel@tonic-gate #define	M_KMEM		1	/* /dev/kmem - virtual kernel memory */
430Sstevel@tonic-gate #define	M_NULL		2	/* /dev/null - EOF & Rathole */
440Sstevel@tonic-gate #define	M_ALLKMEM	3	/* /dev/allkmem - virtual kernel memory & I/O */
450Sstevel@tonic-gate #define	M_ZERO		12	/* /dev/zero - source of private memory */
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate  * Private ioctl for libkvm: translate virtual address to physical address.
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate #define	MEM_VTOP		(('M' << 8) | 0x01)
510Sstevel@tonic-gate 
520Sstevel@tonic-gate typedef struct mem_vtop {
530Sstevel@tonic-gate 	struct as	*m_as;
540Sstevel@tonic-gate 	void		*m_va;
550Sstevel@tonic-gate 	pfn_t		m_pfn;
560Sstevel@tonic-gate } mem_vtop_t;
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * Private ioctls for fmd(1M).  These interfaces are Sun Private.  Applications
600Sstevel@tonic-gate  * and drivers should not make use of these interfaces: they can change without
610Sstevel@tonic-gate  * notice and programs that consume them will fail to run on future releases.
620Sstevel@tonic-gate  */
63*917Selowe #define	MEM_NAME		(('M' << 8) | 0x04)
64*917Selowe #define	MEM_INFO		(('M' << 8) | 0x05)
65*917Selowe 
660Sstevel@tonic-gate #define	MEM_PAGE_RETIRE		(('M' << 8) | 0x02)
670Sstevel@tonic-gate #define	MEM_PAGE_ISRETIRED	(('M' << 8) | 0x03)
68*917Selowe #define	MEM_PAGE_UNRETIRE	(('M' << 8) | 0x06)
69*917Selowe #define	MEM_PAGE_GETERRORS	(('M' << 8) | 0x07)
70*917Selowe #define	MEM_PAGE_RETIRE_MCE	(('M' << 8) | 0x08)
71*917Selowe #define	MEM_PAGE_RETIRE_UE	(('M' << 8) | 0x09)
72*917Selowe #define	MEM_PAGE_RETIRE_TEST	(('M' << 8) | 0x0A)
73*917Selowe 
74*917Selowe /*
75*917Selowe  * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M).
76*917Selowe  */
77*917Selowe #define	MEM_PAGE_ERR_NONE	0x0
78*917Selowe #define	MEM_PAGE_ERR_MULTI_CE	0x1
79*917Selowe #define	MEM_PAGE_ERR_UE		0x2
80*917Selowe #define	MEM_PAGE_ERR_FMA_REQ	0x8
810Sstevel@tonic-gate 
820Sstevel@tonic-gate typedef struct mem_name {
830Sstevel@tonic-gate 	uint64_t	m_addr;		/* memory address */
840Sstevel@tonic-gate 	uint64_t	m_synd;		/* architecture-specific syndrome */
850Sstevel@tonic-gate 	uint64_t	m_type[2];	/* architecture-specific type */
860Sstevel@tonic-gate 	caddr_t		m_name;		/* memory name buffer */
870Sstevel@tonic-gate 	size_t		m_namelen;	/* memory name buffer length */
880Sstevel@tonic-gate } mem_name_t;
890Sstevel@tonic-gate 
900Sstevel@tonic-gate #if	defined(_SYSCALL32)
910Sstevel@tonic-gate typedef struct mem_name32 {
920Sstevel@tonic-gate 	uint64_t	m_addr;
930Sstevel@tonic-gate 	uint64_t	m_synd;
940Sstevel@tonic-gate 	uint64_t	m_type[2];
950Sstevel@tonic-gate 	caddr32_t	m_name;
960Sstevel@tonic-gate 	size32_t	m_namelen;
970Sstevel@tonic-gate } mem_name32_t;
980Sstevel@tonic-gate #endif	/* _SYSCALL32 */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate typedef struct mem_info {
1010Sstevel@tonic-gate 	uint64_t	m_addr;		/* memory address */
1020Sstevel@tonic-gate 	uint64_t	m_synd;		/* architecture-specific syndrome */
1030Sstevel@tonic-gate 	uint64_t	m_mem_size;	/* total memory size */
1040Sstevel@tonic-gate 	uint64_t	m_seg_size;	/* segment size */
1050Sstevel@tonic-gate 	uint64_t	m_bank_size;	/* bank size */
1060Sstevel@tonic-gate 	int		m_segments;	/* # of segments */
1070Sstevel@tonic-gate 	int		m_banks;	/* # of banks in segment */
1080Sstevel@tonic-gate 	int		m_mcid;		/* associated memory controller id */
1090Sstevel@tonic-gate } mem_info_t;
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate #ifdef	_KERNEL
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate extern pfn_t impl_obmem_pfnum(pfn_t);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #endif	/* _KERNEL */
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate #ifdef	__cplusplus
1180Sstevel@tonic-gate }
1190Sstevel@tonic-gate #endif
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate #endif	/* _SYS_MEM_H */
122