1 .\" $NetBSD: x86_64_get_mtrr.2,v 1.7 2004/03/13 23:46:37 wiz Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
31 .Dt X86_64_GET_MTRR 2 x86_64
36 .Nd access Memory Type Range Registers
44 .Fn x86_64_get_mtrr "struct mtrr *mtrrp" "int *n"
46 .Fn x86_64_set_mtrr "struct mtrr *mtrrp" "int *n"
48 These functions provide an interface to the MTRR registers found on
49 686-class processors for controlling processor access to memory ranges.
50 This is most useful for accessing devices such as video accelerators on
55 For example, enabling write-combining allows bus-write transfers
56 to be combined into a larger transfer before bursting over the bus.
57 This can increase performance of write operations 2.5 times or more.
60 is a pointer to one or more mtrr structures, as described below.
63 argument is a pointer to an integer containing the number of structures
68 the integer pointed to by
70 will be updated to reflect the actual number of MTRRs successfully set.
75 structures will be copied out, and the integer value pointed to by
77 will be updated to reflect the actual number of valid structures retrieved.
82 will result in just the number of MTRRs available being returned
83 in the integer pointed to by
88 has the following structure:
99 The location of the mapping is described by its physical base address
107 .Bl -tag -offset indent -width MTRR_TYPE_UNDEF1 -compact
113 use write-through caching
115 write-protected memory
117 use write-back caching
124 .Bl -tag -offset indent -width MTRR_PRIVATE -compact
126 own range, reset the MTRR when the current process exits
135 member is the PID of the user process which claims the mapping.
136 It is only valid if MTRR_PRIVATE is set in
138 To clear/reset MTRRs, use a
140 field without MTRR_VALID set.
142 Upon successful completion zero is returned, otherwise \-1 is returned
143 on failure, and the global variable
145 is set to indicate the error.
146 The integer value pointed to by
148 will contain the number of successfully processed mtrr structures
151 .Bl -tag -width [EINVAL]
153 The currently running kernel or CPU has no MTRR support.
155 The currently running kernel has no MTRR support, or one of the mtrr
156 structures pointed to by
160 No unused MTRRs are available.
167 were derived from their i386 counterparts, which appeared in