1 .\" Copyright (c) 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)mem.4 5.3 (Berkeley) 5/2/91
47 is an interface to the physical memory of the computer.
48 Byte offsets in this file are interpreted as physical memory addresses.
49 Reading and writing this file is equivalent to reading and writing
51 Only offsets within the bounds of
55 Kernel virtual memory is accessed through the interface
59 Only kernel virtual addresses that are currently mapped to memory are allowed.
65 memory space begins at physical address 0x000a0000
66 and runs to 0x00100000.
70 for the current process
73 long, and ends at virtual
76 Several architectures allow attributes to be associated with ranges of physical
78 These attributes can be manipulated via
82 Declarations and data types are to be found in
85 The specific attributes, and number of programmable ranges may vary between
87 The full set of supported attributes is:
88 .Bl -tag -width indent
89 .It Dv MDF_UNCACHEABLE
90 The region is not cached.
91 .It Dv MDF_WRITECOMBINE
92 Writes to the region may be combined or performed out of order.
93 .It Dv MDF_WRITETHROUGH
94 Writes to the region are committed synchronously.
96 Writes to the region are committed asynchronously.
97 .It Dv MDF_WRITEPROTECT
98 The region cannot be written to.
101 Memory ranges are described by
102 .Vt struct mem_range_desc :
103 .Bd -literal -offset indent
104 u_int64_t mr_base; /\(** physical base address \(**/
105 u_int64_t mr_len; /\(** physical length of region \(**/
106 int mr_flags; /\(** attributes of region \(**/
110 In addition to the region attributes listed above, the following flags
111 may also be set in the
114 .Bl -tag -width indent
116 The region's base address cannot be changed.
118 The region's length cannot be changed.
120 The region is believed to have been established by the system firmware.
122 The region is currently active.
124 We believe the region to be invalid or otherwise erroneous.
126 The region cannot be disabled.
128 The region is currently owned by another process and may not be
132 Operations are performed using
133 .Fa struct mem_range_op :
134 .Bd -literal -offset indent
135 struct mem_range_desc *mo_desc;
141 ioctl is used to retrieve current memory range attributes.
144 is set to 0, it will be updated with the total number of memory range
146 If greater than 0, the array at
148 will be filled with a corresponding number of descriptor structures,
149 or the maximum, whichever is less.
153 ioctl is used to add, alter and remove memory range attributes.
157 flag may not be removed; a range with the
159 flag may not be removed or updated.
163 .Dv MEMRANGE_SET_UPDATE
164 to update an existing or establish a new range, or to
165 .Dv MEMRANGE_SET_REMOVE
170 Memory range operations are not supported on this architecture.
172 No memory range descriptors are available (e.g.\& firmware has not enabled
175 The memory range supplied as an argument is invalid or overlaps another
176 range in a fashion not supported by this architecture.
178 An attempt to remove or update a range failed because the range is busy.
180 An attempt to create a new range failed due to a shortage of hardware
181 resources (e.g.\& descriptor slots).
183 An attempt to remove a range failed because no range matches the descriptor
184 base/length supplied.
186 An attempt to remove a range failed because the range is permanently
190 Busy range attributes are not yet managed correctly.
192 .Bl -tag -width /dev/kmem -compact
205 The ioctl interface for memory range attributes was added in