| MTRR(4) | Device Drivers Manual (amd64) | MTRR(4) |
mtrr — driver for
CPU memory range attributes
pseudo-device mtrr 1
The mtrr device provides access to the
memory range attributes supported by the MTRRs on AMD64 compatible CPUs.
Several architectures allow attributes to be associated with
ranges of physical memory. These attributes can be manipulated via
ioctl()
calls performed on /dev/mem or
/dev/xf86. Declarations and data types are to be
found in
<sys/memrange.h>.
The specific attributes, and number of programmable ranges may vary between architectures. The full set of supported attributes is:
MDF_UNCACHEABLEMDF_WRITECOMBINEMDF_WRITETHROUGHMDF_WRITEBACKMDF_WRITEPROTECTMemory ranges are described by
struct mem_range_desc {
u_int64_t mr_base; /∗ physical base address ∗/
u_int64_t mr_len; /∗ physical length of region ∗/
int mr_flags; /∗ attributes of region ∗/
char mr_owner[8];
};
In addition to the region attributes listed above, the following flags may also be set in the mr_flags field:
MDF_FIXBASEMDF_FIXLENMDF_FIRMWAREMDF_ACTIVEMDF_BOGUSMDF_FIXACTIVEOperations are performed using
struct mem_range_op {
struct mem_range_desc *mo_desc;
int mo_arg[2];
};
The MEMRANGE_GET ioctl is used to retrieve current memory range attributes. If mo_arg[0] is set to 0, it will be updated with the total number of memory range descriptors. If greater than 0, the array at mo_desc will be filled with a corresponding number of descriptor structures, or the maximum, whichever is less.
The MEMRANGE_SET ioctl is used to add, alter
and remove memory range attributes. A range with the
MDF_FIXACTIVE flag may not be removed.
mo_arg[0] should be set to MEMRANGE_SET_UPDATE to update an existing or establish a new range, or to MEMRANGE_SET_REMOVE to remove a range.
On ioctl(2) failure, errno(2) will be set as follows:
EOPNOTSUPP]ENXIO]EINVAL]EBUSY]ENOSPC]ENOENT]EPERM]mtrr support was originally included in
FreeBSD 3.3.
| February 15, 2014 | openbsd |