xref: /illumos-gate/usr/src/uts/common/sys/mem.h (revision db874c57)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*db874c57Selowe  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_MEM_H
287c478bd9Sstevel@tonic-gate #define	_SYS_MEM_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * Memory Device Minor Numbers
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate #define	M_MEM		0	/* /dev/mem - physical main memory */
427c478bd9Sstevel@tonic-gate #define	M_KMEM		1	/* /dev/kmem - virtual kernel memory */
437c478bd9Sstevel@tonic-gate #define	M_NULL		2	/* /dev/null - EOF & Rathole */
447c478bd9Sstevel@tonic-gate #define	M_ALLKMEM	3	/* /dev/allkmem - virtual kernel memory & I/O */
457c478bd9Sstevel@tonic-gate #define	M_ZERO		12	/* /dev/zero - source of private memory */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Private ioctl for libkvm: translate virtual address to physical address.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate #define	MEM_VTOP		(('M' << 8) | 0x01)
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate typedef struct mem_vtop {
537c478bd9Sstevel@tonic-gate 	struct as	*m_as;
547c478bd9Sstevel@tonic-gate 	void		*m_va;
557c478bd9Sstevel@tonic-gate 	pfn_t		m_pfn;
567c478bd9Sstevel@tonic-gate } mem_vtop_t;
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Private ioctls for fmd(1M).  These interfaces are Sun Private.  Applications
607c478bd9Sstevel@tonic-gate  * and drivers should not make use of these interfaces: they can change without
617c478bd9Sstevel@tonic-gate  * notice and programs that consume them will fail to run on future releases.
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate #define	MEM_NAME		(('M' << 8) | 0x04)
647c478bd9Sstevel@tonic-gate #define	MEM_INFO		(('M' << 8) | 0x05)
657c478bd9Sstevel@tonic-gate 
66*db874c57Selowe #define	MEM_PAGE_RETIRE		(('M' << 8) | 0x02)
67*db874c57Selowe #define	MEM_PAGE_ISRETIRED	(('M' << 8) | 0x03)
68*db874c57Selowe #define	MEM_PAGE_UNRETIRE	(('M' << 8) | 0x06)
69*db874c57Selowe #define	MEM_PAGE_GETERRORS	(('M' << 8) | 0x07)
70*db874c57Selowe #define	MEM_PAGE_RETIRE_MCE	(('M' << 8) | 0x08)
71*db874c57Selowe #define	MEM_PAGE_RETIRE_UE	(('M' << 8) | 0x09)
72*db874c57Selowe #define	MEM_PAGE_RETIRE_TEST	(('M' << 8) | 0x0A)
73*db874c57Selowe 
74*db874c57Selowe /*
75*db874c57Selowe  * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M).
76*db874c57Selowe  */
77*db874c57Selowe #define	MEM_PAGE_ERR_NONE	0x0
78*db874c57Selowe #define	MEM_PAGE_ERR_MULTI_CE	0x1
79*db874c57Selowe #define	MEM_PAGE_ERR_UE		0x2
80*db874c57Selowe #define	MEM_PAGE_ERR_FMA_REQ	0x8
81*db874c57Selowe 
827c478bd9Sstevel@tonic-gate typedef struct mem_name {
837c478bd9Sstevel@tonic-gate 	uint64_t	m_addr;		/* memory address */
847c478bd9Sstevel@tonic-gate 	uint64_t	m_synd;		/* architecture-specific syndrome */
857c478bd9Sstevel@tonic-gate 	uint64_t	m_type[2];	/* architecture-specific type */
867c478bd9Sstevel@tonic-gate 	caddr_t		m_name;		/* memory name buffer */
877c478bd9Sstevel@tonic-gate 	size_t		m_namelen;	/* memory name buffer length */
887c478bd9Sstevel@tonic-gate } mem_name_t;
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #if	defined(_SYSCALL32)
917c478bd9Sstevel@tonic-gate typedef struct mem_name32 {
927c478bd9Sstevel@tonic-gate 	uint64_t	m_addr;
937c478bd9Sstevel@tonic-gate 	uint64_t	m_synd;
947c478bd9Sstevel@tonic-gate 	uint64_t	m_type[2];
957c478bd9Sstevel@tonic-gate 	caddr32_t	m_name;
967c478bd9Sstevel@tonic-gate 	size32_t	m_namelen;
977c478bd9Sstevel@tonic-gate } mem_name32_t;
987c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate typedef struct mem_info {
1017c478bd9Sstevel@tonic-gate 	uint64_t	m_addr;		/* memory address */
1027c478bd9Sstevel@tonic-gate 	uint64_t	m_synd;		/* architecture-specific syndrome */
1037c478bd9Sstevel@tonic-gate 	uint64_t	m_mem_size;	/* total memory size */
1047c478bd9Sstevel@tonic-gate 	uint64_t	m_seg_size;	/* segment size */
1057c478bd9Sstevel@tonic-gate 	uint64_t	m_bank_size;	/* bank size */
1067c478bd9Sstevel@tonic-gate 	int		m_segments;	/* # of segments */
1077c478bd9Sstevel@tonic-gate 	int		m_banks;	/* # of banks in segment */
1087c478bd9Sstevel@tonic-gate 	int		m_mcid;		/* associated memory controller id */
1097c478bd9Sstevel@tonic-gate } mem_info_t;
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate extern pfn_t impl_obmem_pfnum(pfn_t);
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1187c478bd9Sstevel@tonic-gate }
1197c478bd9Sstevel@tonic-gate #endif
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #endif	/* _SYS_MEM_H */
122