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