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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NSC_MEM_H 27 #define _NSC_MEM_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #ifndef __NSC_GEN__ 34 Error: Illegal #include - private file. 35 #endif 36 37 38 /* 39 * Macro definitions. 40 */ 41 42 43 /* 44 * Definition of control structure. 45 */ 46 typedef struct nsc_mem_s { 47 struct nsc_mem_s *next; /* Link to next type */ 48 char *name; /* Description */ 49 int type; /* Memory type */ 50 int flag; /* Allocation flags */ 51 size_t used; /* Current usage */ 52 size_t hwm; /* High Water Mark */ 53 int pages; /* Usage in pages */ 54 int pagehwm; /* Page High Water Mark */ 55 caddr_t base; /* Base address of RM area */ 56 int nalloc; /* Number of allocates */ 57 int nfree; /* Number of frees */ 58 int pend; /* Operation pending */ 59 } nsc_mem_t; 60 61 62 /* 63 * Definition of global memory header 64 */ 65 66 #define _NSCTL_HDRMAGIC 0x5344474c /* Magic number for header */ 67 #define _NSCTL_HDRVER 2 /* Version number for header */ 68 #define _NSCTL_HDRVER3 3 /* Version number for header */ 69 #define _NSC_GLSLOT 125 /* Number of global slots */ 70 #define _NSC_GLALIGN 4095 /* Alignment between areas */ 71 72 73 typedef struct nsc_rmhdr_s { 74 uint32_t magic; /* Magic number */ 75 uint32_t ver; /* Version number of header */ 76 uint32_t size; /* Size of header section */ 77 int32_t rh_dirty; /* dirty bit for nvmem */ 78 int32_t maxdev; /* Configured nsc_max_devices */ 79 int32_t pad[14]; /* Future expansion */ 80 nsc_rmmap_t map[1]; /* Start of map array */ 81 } nsc_rmhdr_t; 82 83 extern nsc_rmmap_t *_nsc_global_nvmemmap_lookup(nsc_rmmap_t *); 84 85 extern int _nsc_get_global_sizes(void *, int *); 86 extern int _nsc_get_global_data(void *, int *); 87 extern int _nsc_clear_dirty(int); 88 extern int _nsc_check_mapinuse(void); 89 extern int _nsc_is_nsctl_map(char *); 90 91 extern caddr_t _nsc_rm_base; 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #endif /* _NSC_MEM_H */ 98