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