uts: make emu10k non-verbose
[unleashed.git] / include / sys / mem_config.h
blob31ea4059d1b2ad7c700aa742eac059b7415619ca
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_MEM_CONFIG_H
27 #define _SYS_MEM_CONFIG_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
32 * Memory add/delete interfaces.
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 #ifdef _KERNEL
42 * Memory add/delete client interface.
45 extern int kphysm_add_memory_dynamic(pfn_t base, pgcnt_t npgs);
47 typedef void *memhandle_t;
50 * Managed pages have associated page structures ('page_t's).
51 * The difference between phys_pages and managed is accounted for by
52 * boot time memory allocation for the kernel text and data, and also
53 * for page structures.
55 typedef struct {
56 pgcnt_t phys_pages; /* total physical pages */
57 pgcnt_t managed; /* providing this many managed pages */
58 pgcnt_t nonrelocatable; /* of which this many non-relocatable */
59 pfn_t first_nonrelocatable;
60 pfn_t last_nonrelocatable;
61 } memquery_t;
63 typedef struct {
64 pgcnt_t phys_pages; /* total physical pages */
65 pgcnt_t managed; /* providing this many managed pages */
66 pgcnt_t collected; /* done when == managed */
67 } memdelstat_t;
69 extern int kphysm_del_gethandle(memhandle_t *);
71 extern int kphysm_del_span(memhandle_t, pfn_t base, pgcnt_t npgs);
73 extern int kphysm_del_span_query(pfn_t base, pgcnt_t npgs, memquery_t *);
75 extern int kphysm_del_start(memhandle_t,
76 void (*complete)(void *, int error), void *arg);
78 extern int kphysm_del_release(memhandle_t);
80 extern int kphysm_del_cancel(memhandle_t);
82 extern int kphysm_del_status(memhandle_t, memdelstat_t *);
85 * Error returns.
88 #define KPHYSM_OK 0 /* Success */
89 #define KPHYSM_ESPAN 1 /* Memory already in use (add) */
90 #define KPHYSM_EFAULT 2 /* Memory access test failed (add) */
91 #define KPHYSM_ERESOURCE 3 /* Some resource was not available */
92 #define KPHYSM_ENOTSUP 4 /* Operation not supported */
93 #define KPHYSM_ENOHANDLES 5 /* Cannot allocate any more handles */
94 #define KPHYSM_ENONRELOC 6 /* Non-relocatable pages in span */
95 #define KPHYSM_EHANDLE 7 /* Bad handle supplied */
96 #define KPHYSM_EBUSY 8 /* Memory in span is being deleted */
97 #define KPHYSM_ENOTVIABLE 9 /* VM viability test failed */
98 #define KPHYSM_ESEQUENCE 10 /* Function called out of sequence */
99 #define KPHYSM_ENOWORK 11 /* No pages to delete */
100 #define KPHYSM_ECANCELLED 12 /* kphysm_del_cancel (for complete) */
101 #define KPHYSM_EREFUSED 13 /* kphysm_pre_del fail (for complete) */
102 #define KPHYSM_ENOTFINISHED 14 /* Thread not finished */
103 #define KPHYSM_ENOTRUNNING 15 /* Thread not running */
104 #define KPHYSM_EDUP 16 /* Memory span duplicate (delete) */
107 * Memory system change call-back interface.
110 #define KPHYSM_SETUP_VECTOR_VERSION 1
111 typedef struct {
112 uint_t version;
113 void (*post_add)(void *arg, pgcnt_t delta_pages);
114 int (*pre_del)(void *arg, pgcnt_t delta_pages);
115 void (*post_del)(void *arg, pgcnt_t delta_pages,
116 int cancelled);
117 } kphysm_setup_vector_t;
120 * The register function returns 0 if the vector/arg pair is recorded
121 * successfully.
122 * The error returns are:
123 * EEXIST if the vector/arg pair is already registered.
124 * EINVAL if the vector version is not supported.
125 * ENOMEM if the registration could not be stored.
127 * A return of EEXIST should be considered a program logic error by
128 * the caller.
130 extern int kphysm_setup_func_register(kphysm_setup_vector_t *, void *arg);
132 extern void kphysm_setup_func_unregister(kphysm_setup_vector_t *, void *arg);
136 * Memory add/delete architecture (lower) interfaces.
137 * These interfaces should not be used by drivers.
140 extern int arch_kphysm_del_span_ok(pfn_t, pgcnt_t);
141 extern int arch_kphysm_relocate(pfn_t, pgcnt_t);
142 extern int arch_kphysm_del_supported(void);
144 extern int pfn_is_being_deleted(pfn_t);
146 #endif /* _KERNEL */
148 #ifdef __cplusplus
150 #endif
152 #endif /* _SYS_MEM_CONFIG_H */