Print this page
7882 Add /dev/full , the always-full memory device
Reviewed by: Adam Stevko <adam.stevko@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/mem.h
+++ new/usr/src/uts/common/sys/mem.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * Copyright (c) 2015, Joyent, Inc. All rights reserved.
28 + * Copyright (c) 2017 James S Blachly, MD <james.blachly@gmail.com>
28 29 */
29 30
30 31 #ifndef _SYS_MEM_H
31 32 #define _SYS_MEM_H
32 33
33 34 #ifdef __cplusplus
34 35 extern "C" {
35 36 #endif
36 37
37 38 #include <sys/types.h>
38 39 #include <sys/uio.h>
39 40
40 41 /*
41 42 * Memory Device Minor Numbers
42 43 */
43 44 #define M_MEM 0 /* /dev/mem - physical main memory */
44 45 #define M_KMEM 1 /* /dev/kmem - virtual kernel memory */
45 46 #define M_NULL 2 /* /dev/null - EOF & Rathole */
46 47 #define M_ALLKMEM 3 /* /dev/allkmem - virtual kernel memory & I/O */
47 48 #define M_ZERO 12 /* /dev/zero - source of private memory */
49 +#define M_FULL 13 /* /dev/full - write always ret ENOSPC */
48 50
49 51 /*
50 52 * Private ioctl for libkvm: translate virtual address to physical address.
51 53 */
52 54 #define MEM_VTOP (('M' << 8) | 0x01)
53 55
54 56 typedef struct mem_vtop {
55 57 struct as *m_as;
56 58 void *m_va;
57 59 pfn_t m_pfn;
58 60 } mem_vtop_t;
59 61
60 62 #if defined(_SYSCALL32)
61 63 typedef struct mem_vtop32 {
62 64 uint32_t m_as;
63 65 uint32_t m_va;
64 66 uint32_t m_pfn;
65 67 } mem_vtop32_t;
66 68 #endif
67 69
68 70 /*
69 71 * Private ioctls for fmd(1M). These interfaces are Sun Private. Applications
70 72 * and drivers should not make use of these interfaces: they can change without
71 73 * notice and programs that consume them will fail to run on future releases.
72 74 */
73 75 #define MEM_NAME (('M' << 8) | 0x04)
74 76 #define MEM_INFO (('M' << 8) | 0x05)
75 77
76 78 #define MEM_PAGE_RETIRE (('M' << 8) | 0x02)
77 79 #define MEM_PAGE_ISRETIRED (('M' << 8) | 0x03)
78 80 #define MEM_PAGE_UNRETIRE (('M' << 8) | 0x06)
79 81 #define MEM_PAGE_GETERRORS (('M' << 8) | 0x07)
80 82 #define MEM_PAGE_RETIRE_MCE (('M' << 8) | 0x08)
81 83 #define MEM_PAGE_RETIRE_UE (('M' << 8) | 0x09)
82 84 #define MEM_PAGE_RETIRE_TEST (('M' << 8) | 0x0A)
83 85
84 86 #define MEM_SID (('M' << 8) | 0x0B)
85 87
86 88 /*
87 89 * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M).
88 90 */
89 91 #define MEM_PAGE_ERR_NONE 0x0
90 92 #define MEM_PAGE_ERR_MULTI_CE 0x1
91 93 #define MEM_PAGE_ERR_UE 0x2
92 94 #define MEM_PAGE_ERR_FMA_REQ 0x8
93 95
94 96 #define MEM_FMRI_MAX_BUFSIZE 8192 /* maximum allowed packed FMRI size */
95 97
96 98 typedef struct mem_name {
97 99 uint64_t m_addr; /* memory address */
98 100 uint64_t m_synd; /* architecture-specific syndrome */
99 101 uint64_t m_type[2]; /* architecture-specific type */
100 102 caddr_t m_name; /* memory name buffer */
101 103 size_t m_namelen; /* memory name buffer length */
102 104 caddr_t m_sid; /* memory serial id buffer */
103 105 size_t m_sidlen; /* memory serial id buffer length */
104 106 } mem_name_t;
105 107
106 108 #if defined(_SYSCALL32)
107 109 typedef struct mem_name32 {
108 110 uint64_t m_addr;
109 111 uint64_t m_synd;
110 112 uint64_t m_type[2];
111 113 caddr32_t m_name;
112 114 size32_t m_namelen;
113 115 caddr32_t m_sid;
114 116 size32_t m_sidlen;
115 117 } mem_name32_t;
116 118 #endif /* _SYSCALL32 */
117 119
118 120 typedef struct mem_info {
119 121 uint64_t m_addr; /* memory address */
120 122 uint64_t m_synd; /* architecture-specific syndrome */
121 123 uint64_t m_mem_size; /* total memory size */
122 124 uint64_t m_seg_size; /* segment size */
123 125 uint64_t m_bank_size; /* bank size */
124 126 int m_segments; /* # of segments */
125 127 int m_banks; /* # of banks in segment */
126 128 int m_mcid; /* associated memory controller id */
127 129 } mem_info_t;
128 130
129 131 #ifdef _KERNEL
130 132
131 133 extern pfn_t impl_obmem_pfnum(pfn_t);
132 134
133 135 extern int plat_mem_do_mmio(struct uio *, enum uio_rw);
134 136
135 137 typedef struct mm_logentry {
136 138 uintptr_t mle_vaddr; /* vaddr being written to */
137 139 size_t mle_len; /* length of write */
138 140 timespec_t mle_hrestime; /* hrestime at time of write */
139 141 hrtime_t mle_hrtime; /* hrtime at time of write */
140 142 pid_t mle_pid; /* pid of writing process */
141 143 char mle_psargs[80]; /* psargs of writing process */
142 144 } mm_logentry_t;
143 145
144 146 #endif /* _KERNEL */
145 147
146 148 #ifdef __cplusplus
147 149 }
148 150 #endif
149 151
150 152 #endif /* _SYS_MEM_H */
↓ open down ↓ |
93 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX