summaryrefslogtreecommitdiff
path: root/static/netbsd/man4/drvctl.4 4.html
blob: 3f8deb0401e6d4d4e3fe3a039aebba1cb58ca6f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<table class="head">
  <tr>
    <td class="head-ltitle">DRVCTL(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">DRVCTL(4)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">drvctl</code> &#x2014; <span class="Nd">driver
    control device</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">pseudo-device drvctl</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">drvctl</code> driver allows to control some
    <a class="Xr">autoconf(9)</a> operations from userland through the
    <span class="Pa">/dev/drvctl</span> device and the
    <a class="Xr">drvctl(8)</a> command.</p>
<p class="Pp">The driver supports the following <a class="Xr">ioctl(2)</a>
    operations.</p>
<p class="Pp"></p>
<div class="Bd-indent">
<dl class="Bl-tag Bl-compact">
  <dt>DRVSUSPENDDEV</dt>
  <dd style="width: auto;">&#x00A0;</dd>
  <dt>DRVRESUMEDEV</dt>
  <dd>Invoke power management functions for a named driver that has registered
      itself with the <a class="Xr">pmf(9)</a> framework. The ioctl argument
      specifies the driver name as:
    <div class="Bd Pp Bd-indent Li">
    <pre>struct devpmargs {
        char devname[16];
        uint32_t flags;
};</pre>
    </div>
    <p class="Pp">The flag <code class="Dv">DEVPM_F_SUBTREE</code> lets the
        function recurse over all children of that driver.</p>
    <p class="Pp"></p>
  </dd>
  <dt>DRVLISTDEV</dt>
  <dd>Return a list of child devices attached to the named driver. The ioctl
      argument specifies the driver name as:
    <div class="Bd Pp Bd-indent Li">
    <pre>struct devlistargs {
        char l_devname[16];
        char (*l_childname)[16];
        size_t l_children;
};</pre>
    </div>
    The names for up to <code class="Dv">l_children</code> child devices are
      copied to the <code class="Dv">l_childname</code> array. If there is no
      error, the ioctl returns the total number of children. Normally you would
      call <code class="Dv">DRVLISTDEV</code> once with
      <code class="Dv">l_children</code> set to zero, allocate a buffer for
      enough 16-character strings and call <code class="Dv">DRVLISTDEV</code>
      again to fill the buffer.
    <p class="Pp"></p>
  </dd>
  <dt>DRVDETACHDEV</dt>
  <dd>Detach the named driver and all its autoconfigured children. The ioctl
      argument specifies the driver name as:
    <div class="Bd Pp Bd-indent Li">
    <pre>struct devdetachargs {
        char devname[16];
};</pre>
    </div>
    <p class="Pp"></p>
  </dd>
  <dt>DRVSCANBUS</dt>
  <dd>Invoke the rescan method of the named driver to locate child devices. The
      ioctl argument specifies the driver name as:
    <div class="Bd Pp Bd-indent Li">
    <pre>struct devrescanargs {
        char busname[16];
        char ifattr[16];
        unsigned int numlocators;
        int *locators;
};</pre>
    </div>
    <p class="Pp">Some device drivers attach children to specific interface
        attributes, a zero length <code class="Dv">ifattr</code> represents that
        no interface attribute should be used. The rescan can also be limited to
        driver-specific locators.</p>
    <p class="Pp"></p>
  </dd>
  <dt>DRVCTLCOMMAND</dt>
  <dd>Send a command formatted as a property list. The property list includes
      all arguments like the driver name, the result is again a property list.
      Currently the only supported command is &quot;get-properties&quot;, the
      property list is constructed like:
    <div class="Bd Pp Bd-indent Li">
    <pre>const char *device = &quot;sd0&quot;;
const char *command = &quot;get-properties&quot;;

prop_string_t s;
prop_dictionary_t c, a;

c = prop_dictionary_create();
a = prop_dictionary_create();

s = prop_string_create_cstring_nocopy(command);
prop_dictionary_set(c, &quot;drvctl-command&quot;, s);
prop_object_release(s);

s = prop_string_create_cstring(device);
prop_dictionary_set(a, &quot;device-name&quot;, s);
prop_object_release(s);

prop_dictionary_set(c, &quot;drvctl-arguments&quot;, a);
prop_object_release(a);</pre>
    </div>
    <p class="Pp">The command must be sent with
        <a class="Xr">prop_dictionary_sendrecv_ioctl(3)</a>. The resulting
        property list contains the numeric attribute
        <code class="Dv">drvctl-error</code>, which corresponds to an
        <code class="Dv">errno</code> value, and the dictionary
        <code class="Dv">drvctl-result-data</code>. The contents of the
        dictionary depends on the queried driver.</p>
    <p class="Pp"></p>
  </dd>
  <dt>DRVGETEVENT</dt>
  <dd>Return the next queued autoconfig event formatted as a property list. The
      request needs to be sent with
      <a class="Xr">prop_dictionary_recv_ioctl(3)</a>. The resulting property
      list contains the string attributes <code class="Dv">event, device</code>
      and <code class="Dv">parent</code>. Currently the events
      &quot;device-attach&quot; and &quot;device-detach&quot; are generated by
      the <a class="Xr">autoconf(9)</a> framework.
    <p class="Pp">If <span class="Pa">/dev/drvctl</span> was opened with
        <code class="Dv">O_NONBLOCK</code> and there is no event queued, the
        call returns immediately with <code class="Dv">EWOULDBLOCK</code>,
        otherwise it waits for the next event.</p>
  </dd>
</dl>
</div>
<p class="Pp">All names used in the ioctl arguments are zero-terminated strings.
    A driver name is the name of a driver instance with the appended unit number
    like <code class="Dv">sd0</code>, <code class="Dv">atabus3</code>,
    <code class="Dv">...</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag">
  <dt><span class="Pa">/dev/drvctl</span></dt>
  <dd><code class="Nm">drvctl</code> access device</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">ioctl(2)</a>, <a class="Xr">prop_send_ioctl(3)</a>,
    <a class="Xr">proplib(3)</a>, <a class="Xr">devpubd(8)</a>,
    <a class="Xr">drvctl(8)</a>, <a class="Xr">autoconf(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <span class="Pa">/dev/drvctl</span> device appeared in
    <span class="Ux">NetBSD 3.0</span> but was only added to the GENERIC
    configuration in <span class="Ux">NetBSD 5.0</span>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">May 13, 2015</td>
    <td class="foot-os">NetBSD 10.1</td>
  </tr>
</table>