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