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