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