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