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 53446Smrj * Common Development and Distribution License (the "License"). 63446Smrj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*6111Scy152378 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_MEM_H 270Sstevel@tonic-gate #define _SYS_MEM_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 343446Smrj #include <sys/uio.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * Memory Device Minor Numbers 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate #define M_MEM 0 /* /dev/mem - physical main memory */ 400Sstevel@tonic-gate #define M_KMEM 1 /* /dev/kmem - virtual kernel memory */ 410Sstevel@tonic-gate #define M_NULL 2 /* /dev/null - EOF & Rathole */ 420Sstevel@tonic-gate #define M_ALLKMEM 3 /* /dev/allkmem - virtual kernel memory & I/O */ 430Sstevel@tonic-gate #define M_ZERO 12 /* /dev/zero - source of private memory */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate /* 460Sstevel@tonic-gate * Private ioctl for libkvm: translate virtual address to physical address. 470Sstevel@tonic-gate */ 480Sstevel@tonic-gate #define MEM_VTOP (('M' << 8) | 0x01) 490Sstevel@tonic-gate 500Sstevel@tonic-gate typedef struct mem_vtop { 510Sstevel@tonic-gate struct as *m_as; 520Sstevel@tonic-gate void *m_va; 530Sstevel@tonic-gate pfn_t m_pfn; 540Sstevel@tonic-gate } mem_vtop_t; 550Sstevel@tonic-gate 561414Scindi #if defined(_SYSCALL32) 571414Scindi typedef struct mem_vtop32 { 581414Scindi uint32_t m_as; 591414Scindi uint32_t m_va; 601414Scindi uint32_t m_pfn; 611414Scindi } mem_vtop32_t; 621414Scindi #endif 631414Scindi 640Sstevel@tonic-gate /* 650Sstevel@tonic-gate * Private ioctls for fmd(1M). These interfaces are Sun Private. Applications 660Sstevel@tonic-gate * and drivers should not make use of these interfaces: they can change without 670Sstevel@tonic-gate * notice and programs that consume them will fail to run on future releases. 680Sstevel@tonic-gate */ 69917Selowe #define MEM_NAME (('M' << 8) | 0x04) 70917Selowe #define MEM_INFO (('M' << 8) | 0x05) 71917Selowe 720Sstevel@tonic-gate #define MEM_PAGE_RETIRE (('M' << 8) | 0x02) 730Sstevel@tonic-gate #define MEM_PAGE_ISRETIRED (('M' << 8) | 0x03) 74917Selowe #define MEM_PAGE_UNRETIRE (('M' << 8) | 0x06) 75917Selowe #define MEM_PAGE_GETERRORS (('M' << 8) | 0x07) 76917Selowe #define MEM_PAGE_RETIRE_MCE (('M' << 8) | 0x08) 77917Selowe #define MEM_PAGE_RETIRE_UE (('M' << 8) | 0x09) 78917Selowe #define MEM_PAGE_RETIRE_TEST (('M' << 8) | 0x0A) 79917Selowe 801186Sayznaga #define MEM_SID (('M' << 8) | 0x0B) 811186Sayznaga 82917Selowe /* 83917Selowe * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M). 84917Selowe */ 85917Selowe #define MEM_PAGE_ERR_NONE 0x0 86917Selowe #define MEM_PAGE_ERR_MULTI_CE 0x1 87917Selowe #define MEM_PAGE_ERR_UE 0x2 88917Selowe #define MEM_PAGE_ERR_FMA_REQ 0x8 890Sstevel@tonic-gate 901186Sayznaga #define MEM_FMRI_MAX_BUFSIZE 8192 /* maximum allowed packed FMRI size */ 911186Sayznaga 920Sstevel@tonic-gate typedef struct mem_name { 930Sstevel@tonic-gate uint64_t m_addr; /* memory address */ 940Sstevel@tonic-gate uint64_t m_synd; /* architecture-specific syndrome */ 950Sstevel@tonic-gate uint64_t m_type[2]; /* architecture-specific type */ 960Sstevel@tonic-gate caddr_t m_name; /* memory name buffer */ 970Sstevel@tonic-gate size_t m_namelen; /* memory name buffer length */ 981186Sayznaga caddr_t m_sid; /* memory serial id buffer */ 991186Sayznaga size_t m_sidlen; /* memory serial id buffer length */ 1000Sstevel@tonic-gate } mem_name_t; 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #if defined(_SYSCALL32) 1030Sstevel@tonic-gate typedef struct mem_name32 { 1040Sstevel@tonic-gate uint64_t m_addr; 1050Sstevel@tonic-gate uint64_t m_synd; 1060Sstevel@tonic-gate uint64_t m_type[2]; 1070Sstevel@tonic-gate caddr32_t m_name; 1080Sstevel@tonic-gate size32_t m_namelen; 1091186Sayznaga caddr32_t m_sid; 1101186Sayznaga size32_t m_sidlen; 1110Sstevel@tonic-gate } mem_name32_t; 1120Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate typedef struct mem_info { 1150Sstevel@tonic-gate uint64_t m_addr; /* memory address */ 1160Sstevel@tonic-gate uint64_t m_synd; /* architecture-specific syndrome */ 1170Sstevel@tonic-gate uint64_t m_mem_size; /* total memory size */ 1180Sstevel@tonic-gate uint64_t m_seg_size; /* segment size */ 1190Sstevel@tonic-gate uint64_t m_bank_size; /* bank size */ 1200Sstevel@tonic-gate int m_segments; /* # of segments */ 1210Sstevel@tonic-gate int m_banks; /* # of banks in segment */ 1220Sstevel@tonic-gate int m_mcid; /* associated memory controller id */ 1230Sstevel@tonic-gate } mem_info_t; 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #ifdef _KERNEL 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate extern pfn_t impl_obmem_pfnum(pfn_t); 1280Sstevel@tonic-gate 1295084Sjohnlev extern int plat_mem_do_mmio(struct uio *, enum uio_rw); 1303446Smrj 1310Sstevel@tonic-gate #endif /* _KERNEL */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #ifdef __cplusplus 1340Sstevel@tonic-gate } 1350Sstevel@tonic-gate #endif 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate #endif /* _SYS_MEM_H */ 138