xref: /xnu-10002.41.9/osfmk/man/device_map.html (revision 699cd48037512bf4380799317ca44ca453c82f57)
1*699cd480SApple OSS Distributions<h2>device_map</h2>
2*699cd480SApple OSS Distributions<hr>
3*699cd480SApple OSS Distributions<p>
4*699cd480SApple OSS Distributions<strong>Function</strong> - Establish the specified device's memory manager.
5*699cd480SApple OSS Distributions<h3>SYNOPSIS</h3>
6*699cd480SApple OSS Distributions<pre>
7*699cd480SApple OSS Distributions<strong>#include&lt device/device.h&gt</strong>
8*699cd480SApple OSS Distributions
9*699cd480SApple OSS Distributions<strong>kern_return_t   device_map</strong>
10*699cd480SApple OSS Distributions                <strong>(mach_port_t</strong>                             <var>device</var>,
11*699cd480SApple OSS Distributions                 <strong>vm_prot_t</strong>                                 <var>prot</var>,
12*699cd480SApple OSS Distributions                 <strong>vm_offset_t</strong>                             <var>offset</var>,
13*699cd480SApple OSS Distributions                 <strong>vm_size_t</strong>                                 <var>size</var>,
14*699cd480SApple OSS Distributions                 <strong>mach_port_t</strong>                          <var>mem_obj_t</var>,
15*699cd480SApple OSS Distributions                 <strong>boolean_t</strong>                                <var>unmap</var><strong>);</strong>
16*699cd480SApple OSS Distributions</pre>
17*699cd480SApple OSS Distributions<h3>PARAMETERS</h3>
18*699cd480SApple OSS Distributions<dl>
19*699cd480SApple OSS Distributions<p>
20*699cd480SApple OSS Distributions<dt> <var>device</var>
21*699cd480SApple OSS Distributions<dd>
22*699cd480SApple OSS Distributions[in device send right]
23*699cd480SApple OSS DistributionsA device port to the device to be mapped.
24*699cd480SApple OSS Distributions<p>
25*699cd480SApple OSS Distributions<dt> <var>prot</var>
26*699cd480SApple OSS Distributions<dd>
27*699cd480SApple OSS Distributions[in scalar]
28*699cd480SApple OSS DistributionsProtection for the device memory.
29*699cd480SApple OSS Distributions<p>
30*699cd480SApple OSS Distributions<dt> <var>offset</var>
31*699cd480SApple OSS Distributions<dd>
32*699cd480SApple OSS Distributions[in scalar]
33*699cd480SApple OSS Distributions15~Offset in memory object.
34*699cd480SApple OSS Distributions<p>
35*699cd480SApple OSS Distributions<dt> <var>size</var>
36*699cd480SApple OSS Distributions<dd>
37*699cd480SApple OSS Distributions[in scalar]
38*699cd480SApple OSS DistributionsThe size of the device memory object.
39*699cd480SApple OSS Distributions<p>
40*699cd480SApple OSS Distributions<dt> <var>pager</var>
41*699cd480SApple OSS Distributions<dd>
42*699cd480SApple OSS Distributions[out memory-object send right]
43*699cd480SApple OSS DistributionsThe returned memory
44*699cd480SApple OSS Distributionsobject representative port to a memory manager that represents the
45*699cd480SApple OSS Distributionsdevice.
46*699cd480SApple OSS Distributions<p>
47*699cd480SApple OSS Distributions<dt> <var>unmap</var>
48*699cd480SApple OSS Distributions<dd>
49*699cd480SApple OSS DistributionsUnused.
50*699cd480SApple OSS Distributions</dl>
51*699cd480SApple OSS Distributions<h3>DESCRIPTION</h3>
52*699cd480SApple OSS Distributions<p>
53*699cd480SApple OSS DistributionsThe <strong>device_map</strong> function establishes a memory manager that presents a
54*699cd480SApple OSS Distributionsmemory object representing a device.  The resulting port is suitable
55*699cd480SApple OSS Distributionsfor use as the
56*699cd480SApple OSS Distributionsmemory manager port in a <strong>vm_map</strong> call.  This call is device dependent.
57*699cd480SApple OSS Distributions<h3>NOTES</h3>
58*699cd480SApple OSS Distributions<p>
59*699cd480SApple OSS DistributionsPort rights are maintained as follows:
60*699cd480SApple OSS Distributions<ul>
61*699cd480SApple OSS Distributions<li>
62*699cd480SApple OSS DistributionsMemory object port: the
63*699cd480SApple OSS Distributionsdevice memory manager has all rights.
64*699cd480SApple OSS Distributions<li>
65*699cd480SApple OSS DistributionsMemory cache control port: the device memory manager has only send rights.
66*699cd480SApple OSS Distributions</ul>
67*699cd480SApple OSS Distributions<p>
68*699cd480SApple OSS DistributionsRegardless of how the object is created, the control port is created by
69*699cd480SApple OSS Distributionsthe kernel and passed through the memory management interface.
70*699cd480SApple OSS Distributions<p>
71*699cd480SApple OSS DistributionsIf the device port used is restricted to use by a single identity,
72*699cd480SApple OSS Distributionsthe generated
73*699cd480SApple OSS Distributionsrepresentative port will be likewise restricted.
74*699cd480SApple OSS Distributions<h3>CAUTIONS</h3>
75*699cd480SApple OSS Distributions<p>
76*699cd480SApple OSS DistributionsThe device memory manager assumes that access to its memory objects will not
77*699cd480SApple OSS Distributionsbe propagated to more that one host, and therefore provides no consistency
78*699cd480SApple OSS Distributionsguarantees beyond those made by the kernel.
79*699cd480SApple OSS Distributions<p>
80*699cd480SApple OSS DistributionsIn the event that more than one host attempts to use a device
81*699cd480SApple OSS Distributionsmemory object, the
82*699cd480SApple OSS Distributionsdevice memory manager will only record the last set of port names.  Currently,
83*699cd480SApple OSS Distributionsthe device memory manager assumes that its clients adhere to
84*699cd480SApple OSS Distributionsthe initialization
85*699cd480SApple OSS Distributionsand termination protocols in the memory management interface; otherwise, port
86*699cd480SApple OSS Distributionsrights or out-of-line memory from erroneous messages may be allowed to
87*699cd480SApple OSS Distributionsaccumulate.
88*699cd480SApple OSS Distributions<h3>RETURN VALUES</h3>
89*699cd480SApple OSS Distributions<dl>
90*699cd480SApple OSS Distributions<p>
91*699cd480SApple OSS Distributions<dt> <strong>D_DEVICE_DOWN</strong>
92*699cd480SApple OSS Distributions<dd>
93*699cd480SApple OSS DistributionsDevice has been shut down
94*699cd480SApple OSS Distributions<p>
95*699cd480SApple OSS Distributions<dt> <strong>D_NO_SUCH_DEVICE</strong>
96*699cd480SApple OSS Distributions<dd>
97*699cd480SApple OSS DistributionsNo device with that name, or the device is not operational.
98*699cd480SApple OSS Distributions<p>
99*699cd480SApple OSS Distributions<dt> <strong>D_READ_ONLY</strong>
100*699cd480SApple OSS Distributions<dd>
101*699cd480SApple OSS DistributionsData cannot be written to this device.
102*699cd480SApple OSS Distributions</dl>
103*699cd480SApple OSS Distributions<h3>RELATED INFORMATION</h3>
104*699cd480SApple OSS Distributions<p>
105*699cd480SApple OSS DistributionsFunctions:
106*699cd480SApple OSS Distributions<a href="vm_map.html"><strong>vm_map</strong></a>.
107