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