1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
5 * Copyright (c) 2018 The FreeBSD Foundation
6 * All rights reserved.
7 *
8 * This software was developed by SRI International and the University of
9 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
10 * ("CTSRD"), as part of the DARPA CRASH research programme.
11 *
12 * Portions of this software were developed by Edward Tomasz Napierala
13 * under sponsorship from the FreeBSD Foundation.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36 /*
37 * USB template for CDC ACM (serial), CDC ECM (network), and CDC MSC (storage).
38 */
39
40 #ifdef USB_GLOBAL_INCLUDE_FILE
41 #include USB_GLOBAL_INCLUDE_FILE
42 #else
43 #include <sys/stdint.h>
44 #include <sys/stddef.h>
45 #include <sys/param.h>
46 #include <sys/queue.h>
47 #include <sys/types.h>
48 #include <sys/systm.h>
49 #include <sys/kernel.h>
50 #include <sys/bus.h>
51 #include <sys/module.h>
52 #include <sys/lock.h>
53 #include <sys/mutex.h>
54 #include <sys/condvar.h>
55 #include <sys/sysctl.h>
56 #include <sys/sx.h>
57 #include <sys/unistd.h>
58 #include <sys/callout.h>
59 #include <sys/malloc.h>
60 #include <sys/priv.h>
61
62 #include <dev/usb/usb.h>
63 #include <dev/usb/usbdi.h>
64 #include <dev/usb/usb_core.h>
65 #include <dev/usb/usb_cdc.h>
66 #include <dev/usb/usb_ioctl.h>
67 #include <dev/usb/usb_util.h>
68
69 #include <dev/usb/template/usb_template.h>
70 #endif /* USB_GLOBAL_INCLUDE_FILE */
71
72 #define MODEM_IFACE_0 0
73 #define MODEM_IFACE_1 1
74
75 enum {
76 MULTI_LANG_INDEX,
77 MULTI_MODEM_INDEX,
78 MULTI_ETH_MAC_INDEX,
79 MULTI_ETH_CONTROL_INDEX,
80 MULTI_ETH_DATA_INDEX,
81 MULTI_STORAGE_INDEX,
82 MULTI_CONFIGURATION_INDEX,
83 MULTI_MANUFACTURER_INDEX,
84 MULTI_PRODUCT_INDEX,
85 MULTI_SERIAL_NUMBER_INDEX,
86 MULTI_MAX_INDEX,
87 };
88
89 #define MULTI_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR
90 #define MULTI_DEFAULT_PRODUCT_ID 0x05dc
91 #define MULTI_DEFAULT_MODEM "Virtual serial port"
92 #define MULTI_DEFAULT_ETH_MAC "2A02030405060789AB"
93 #define MULTI_DEFAULT_ETH_CONTROL "Ethernet Comm Interface"
94 #define MULTI_DEFAULT_ETH_DATA "Ethernet Data Interface"
95 #define MULTI_DEFAULT_STORAGE "Mass Storage Interface"
96 #define MULTI_DEFAULT_CONFIGURATION "Default configuration"
97 #define MULTI_DEFAULT_MANUFACTURER USB_TEMPLATE_MANUFACTURER
98 #define MULTI_DEFAULT_PRODUCT "Multifunction Device"
99 /*
100 * The reason for this being called like this is that OSX
101 * derives the device node name from it, resulting in a somewhat
102 * user-friendly "/dev/cu.usbmodemFreeBSD1". And yes, the "1"
103 * needs to be there, otherwise OSX will mangle it.
104 */
105 #define MULTI_DEFAULT_SERIAL_NUMBER "FreeBSD1"
106
107 static struct usb_string_descriptor multi_modem;
108 static struct usb_string_descriptor multi_eth_mac;
109 static struct usb_string_descriptor multi_eth_control;
110 static struct usb_string_descriptor multi_eth_data;
111 static struct usb_string_descriptor multi_storage;
112 static struct usb_string_descriptor multi_configuration;
113 static struct usb_string_descriptor multi_manufacturer;
114 static struct usb_string_descriptor multi_product;
115 static struct usb_string_descriptor multi_serial_number;
116
117 static struct sysctl_ctx_list multi_ctx_list;
118
119 /* prototypes */
120
121 static usb_temp_get_string_desc_t multi_get_string_desc;
122
123 static const struct usb_cdc_union_descriptor eth_union_desc = {
124 .bLength = sizeof(eth_union_desc),
125 .bDescriptorType = UDESC_CS_INTERFACE,
126 .bDescriptorSubtype = UDESCSUB_CDC_UNION,
127 .bMasterInterface = 0, /* this is automatically updated */
128 .bSlaveInterface[0] = 1, /* this is automatically updated */
129 };
130
131 static const struct usb_cdc_header_descriptor eth_header_desc = {
132 .bLength = sizeof(eth_header_desc),
133 .bDescriptorType = UDESC_CS_INTERFACE,
134 .bDescriptorSubtype = UDESCSUB_CDC_HEADER,
135 .bcdCDC[0] = 0x10,
136 .bcdCDC[1] = 0x01,
137 };
138
139 static const struct usb_cdc_ethernet_descriptor eth_enf_desc = {
140 .bLength = sizeof(eth_enf_desc),
141 .bDescriptorType = UDESC_CS_INTERFACE,
142 .bDescriptorSubtype = UDESCSUB_CDC_ENF,
143 .iMacAddress = MULTI_ETH_MAC_INDEX,
144 .bmEthernetStatistics = {0, 0, 0, 0},
145 .wMaxSegmentSize = {0xEA, 0x05},/* 1514 bytes */
146 .wNumberMCFilters = {0, 0},
147 .bNumberPowerFilters = 0,
148 };
149
150 static const void *eth_control_if_desc[] = {
151 ð_union_desc,
152 ð_header_desc,
153 ð_enf_desc,
154 NULL,
155 };
156
157 static const struct usb_temp_packet_size bulk_mps = {
158 .mps[USB_SPEED_FULL] = 64,
159 .mps[USB_SPEED_HIGH] = 512,
160 };
161
162 static const struct usb_temp_packet_size intr_mps = {
163 .mps[USB_SPEED_FULL] = 8,
164 .mps[USB_SPEED_HIGH] = 8,
165 };
166
167 static const struct usb_temp_endpoint_desc bulk_in_ep = {
168 .pPacketSize = &bulk_mps,
169 #ifdef USB_HIP_IN_EP_0
170 .bEndpointAddress = USB_HIP_IN_EP_0,
171 #else
172 .bEndpointAddress = UE_DIR_IN,
173 #endif
174 .bmAttributes = UE_BULK,
175 };
176
177 static const struct usb_temp_endpoint_desc bulk_out_ep = {
178 .pPacketSize = &bulk_mps,
179 #ifdef USB_HIP_OUT_EP_0
180 .bEndpointAddress = USB_HIP_OUT_EP_0,
181 #else
182 .bEndpointAddress = UE_DIR_OUT,
183 #endif
184 .bmAttributes = UE_BULK,
185 };
186
187 static const struct usb_temp_endpoint_desc intr_in_ep = {
188 .pPacketSize = &intr_mps,
189 .bEndpointAddress = UE_DIR_IN,
190 .bmAttributes = UE_INTERRUPT,
191 };
192
193 static const struct usb_temp_endpoint_desc *eth_intr_endpoints[] = {
194 &intr_in_ep,
195 NULL,
196 };
197
198 static const struct usb_temp_interface_desc eth_control_interface = {
199 .ppEndpoints = eth_intr_endpoints,
200 .ppRawDesc = eth_control_if_desc,
201 .bInterfaceClass = UICLASS_CDC,
202 .bInterfaceSubClass = UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL,
203 .bInterfaceProtocol = UIPROTO_CDC_NONE,
204 .iInterface = MULTI_ETH_CONTROL_INDEX,
205 };
206
207 static const struct usb_temp_endpoint_desc *eth_data_endpoints[] = {
208 &bulk_in_ep,
209 &bulk_out_ep,
210 NULL,
211 };
212
213 static const struct usb_temp_interface_desc eth_data_null_interface = {
214 .ppEndpoints = NULL, /* no endpoints */
215 .bInterfaceClass = UICLASS_CDC_DATA,
216 .bInterfaceSubClass = UISUBCLASS_DATA,
217 .bInterfaceProtocol = 0,
218 .iInterface = MULTI_ETH_DATA_INDEX,
219 };
220
221 static const struct usb_temp_interface_desc eth_data_interface = {
222 .ppEndpoints = eth_data_endpoints,
223 .bInterfaceClass = UICLASS_CDC_DATA,
224 .bInterfaceSubClass = UISUBCLASS_DATA,
225 .bInterfaceProtocol = 0,
226 .iInterface = MULTI_ETH_DATA_INDEX,
227 .isAltInterface = 1, /* this is an alternate setting */
228 };
229
230 static const struct usb_temp_packet_size modem_bulk_mps = {
231 .mps[USB_SPEED_LOW] = 8,
232 .mps[USB_SPEED_FULL] = 64,
233 .mps[USB_SPEED_HIGH] = 512,
234 };
235
236 static const struct usb_temp_packet_size modem_intr_mps = {
237 .mps[USB_SPEED_LOW] = 8,
238 .mps[USB_SPEED_FULL] = 8,
239 .mps[USB_SPEED_HIGH] = 8,
240 };
241
242 static const struct usb_temp_interval modem_intr_interval = {
243 .bInterval[USB_SPEED_LOW] = 8, /* 8ms */
244 .bInterval[USB_SPEED_FULL] = 8, /* 8ms */
245 .bInterval[USB_SPEED_HIGH] = 7, /* 8ms */
246 };
247
248 static const struct usb_temp_endpoint_desc modem_ep_0 = {
249 .pPacketSize = &modem_intr_mps,
250 .pIntervals = &modem_intr_interval,
251 .bEndpointAddress = UE_DIR_IN,
252 .bmAttributes = UE_INTERRUPT,
253 };
254
255 static const struct usb_temp_endpoint_desc modem_ep_1 = {
256 .pPacketSize = &modem_bulk_mps,
257 .bEndpointAddress = UE_DIR_OUT,
258 .bmAttributes = UE_BULK,
259 };
260
261 static const struct usb_temp_endpoint_desc modem_ep_2 = {
262 .pPacketSize = &modem_bulk_mps,
263 .bEndpointAddress = UE_DIR_IN,
264 .bmAttributes = UE_BULK,
265 };
266
267 static const struct usb_temp_endpoint_desc *modem_iface_0_ep[] = {
268 &modem_ep_0,
269 NULL,
270 };
271
272 static const struct usb_temp_endpoint_desc *modem_iface_1_ep[] = {
273 &modem_ep_1,
274 &modem_ep_2,
275 NULL,
276 };
277
278 static const uint8_t modem_raw_desc_0[] = {
279 0x05, 0x24, 0x00, 0x10, 0x01
280 };
281
282 static const uint8_t modem_raw_desc_1[] = {
283 0x05, 0x24, 0x06, MODEM_IFACE_0, MODEM_IFACE_1
284 };
285
286 static const uint8_t modem_raw_desc_2[] = {
287 0x05, 0x24, 0x01, 0x03, MODEM_IFACE_1
288 };
289
290 static const uint8_t modem_raw_desc_3[] = {
291 0x04, 0x24, 0x02, 0x07
292 };
293
294 static const void *modem_iface_0_desc[] = {
295 &modem_raw_desc_0,
296 &modem_raw_desc_1,
297 &modem_raw_desc_2,
298 &modem_raw_desc_3,
299 NULL,
300 };
301
302 static const struct usb_temp_interface_desc modem_iface_0 = {
303 .ppRawDesc = modem_iface_0_desc,
304 .ppEndpoints = modem_iface_0_ep,
305 .bInterfaceClass = UICLASS_CDC,
306 .bInterfaceSubClass = UISUBCLASS_ABSTRACT_CONTROL_MODEL,
307 .bInterfaceProtocol = UIPROTO_CDC_NONE,
308 .iInterface = MULTI_MODEM_INDEX,
309 };
310
311 static const struct usb_temp_interface_desc modem_iface_1 = {
312 .ppEndpoints = modem_iface_1_ep,
313 .bInterfaceClass = UICLASS_CDC_DATA,
314 .bInterfaceSubClass = UISUBCLASS_DATA,
315 .bInterfaceProtocol = 0,
316 .iInterface = MULTI_MODEM_INDEX,
317 };
318
319 static const struct usb_temp_packet_size msc_bulk_mps = {
320 .mps[USB_SPEED_FULL] = 64,
321 .mps[USB_SPEED_HIGH] = 512,
322 };
323
324 static const struct usb_temp_endpoint_desc msc_bulk_in_ep = {
325 .pPacketSize = &msc_bulk_mps,
326 #ifdef USB_HIP_IN_EP_0
327 .bEndpointAddress = USB_HIP_IN_EP_0,
328 #else
329 .bEndpointAddress = UE_DIR_IN,
330 #endif
331 .bmAttributes = UE_BULK,
332 };
333
334 static const struct usb_temp_endpoint_desc msc_bulk_out_ep = {
335 .pPacketSize = &msc_bulk_mps,
336 #ifdef USB_HIP_OUT_EP_0
337 .bEndpointAddress = USB_HIP_OUT_EP_0,
338 #else
339 .bEndpointAddress = UE_DIR_OUT,
340 #endif
341 .bmAttributes = UE_BULK,
342 };
343
344 static const struct usb_temp_endpoint_desc *msc_data_endpoints[] = {
345 &msc_bulk_in_ep,
346 &msc_bulk_out_ep,
347 NULL,
348 };
349
350 static const struct usb_temp_interface_desc msc_data_interface = {
351 .ppEndpoints = msc_data_endpoints,
352 .bInterfaceClass = UICLASS_MASS,
353 .bInterfaceSubClass = UISUBCLASS_SCSI,
354 .bInterfaceProtocol = UIPROTO_MASS_BBB,
355 .iInterface = MULTI_STORAGE_INDEX,
356 };
357
358 static const struct usb_temp_interface_desc *multi_interfaces[] = {
359 &modem_iface_0,
360 &modem_iface_1,
361 ð_control_interface,
362 ð_data_null_interface,
363 ð_data_interface,
364 &msc_data_interface,
365 NULL,
366 };
367
368 static const struct usb_temp_config_desc multi_config_desc = {
369 .ppIfaceDesc = multi_interfaces,
370 .bmAttributes = 0,
371 .bMaxPower = 0,
372 .iConfiguration = MULTI_CONFIGURATION_INDEX,
373 };
374 static const struct usb_temp_config_desc *multi_configs[] = {
375 &multi_config_desc,
376 NULL,
377 };
378
379 struct usb_temp_device_desc usb_template_multi = {
380 .getStringDesc = &multi_get_string_desc,
381 .ppConfigDesc = multi_configs,
382 .idVendor = MULTI_DEFAULT_VENDOR_ID,
383 .idProduct = MULTI_DEFAULT_PRODUCT_ID,
384 .bcdDevice = 0x0100,
385 .bDeviceClass = UDCLASS_IN_INTERFACE,
386 .bDeviceSubClass = 0,
387 .bDeviceProtocol = 0,
388 .iManufacturer = MULTI_MANUFACTURER_INDEX,
389 .iProduct = MULTI_PRODUCT_INDEX,
390 .iSerialNumber = MULTI_SERIAL_NUMBER_INDEX,
391 };
392
393 /*------------------------------------------------------------------------*
394 * multi_get_string_desc
395 *
396 * Return values:
397 * NULL: Failure. No such string.
398 * Else: Success. Pointer to string descriptor is returned.
399 *------------------------------------------------------------------------*/
400 static const void *
multi_get_string_desc(uint16_t lang_id,uint8_t string_index)401 multi_get_string_desc(uint16_t lang_id, uint8_t string_index)
402 {
403 static const void *ptr[MULTI_MAX_INDEX] = {
404 [MULTI_LANG_INDEX] = &usb_string_lang_en,
405 [MULTI_MODEM_INDEX] = &multi_modem,
406 [MULTI_ETH_MAC_INDEX] = &multi_eth_mac,
407 [MULTI_ETH_CONTROL_INDEX] = &multi_eth_control,
408 [MULTI_ETH_DATA_INDEX] = &multi_eth_data,
409 [MULTI_STORAGE_INDEX] = &multi_storage,
410 [MULTI_CONFIGURATION_INDEX] = &multi_configuration,
411 [MULTI_MANUFACTURER_INDEX] = &multi_manufacturer,
412 [MULTI_PRODUCT_INDEX] = &multi_product,
413 [MULTI_SERIAL_NUMBER_INDEX] = &multi_serial_number,
414 };
415
416 if (string_index == 0) {
417 return (&usb_string_lang_en);
418 }
419 if (lang_id != 0x0409) {
420 return (NULL);
421 }
422 if (string_index < MULTI_MAX_INDEX) {
423 return (ptr[string_index]);
424 }
425 return (NULL);
426 }
427
428 static void
multi_init(void * arg __unused)429 multi_init(void *arg __unused)
430 {
431 struct sysctl_oid *parent;
432 char parent_name[3];
433
434 usb_make_str_desc(&multi_modem, sizeof(multi_modem),
435 MULTI_DEFAULT_MODEM);
436 usb_make_str_desc(&multi_eth_mac, sizeof(multi_eth_mac),
437 MULTI_DEFAULT_ETH_MAC);
438 usb_make_str_desc(&multi_eth_control, sizeof(multi_eth_control),
439 MULTI_DEFAULT_ETH_CONTROL);
440 usb_make_str_desc(&multi_eth_data, sizeof(multi_eth_data),
441 MULTI_DEFAULT_ETH_DATA);
442 usb_make_str_desc(&multi_storage, sizeof(multi_storage),
443 MULTI_DEFAULT_STORAGE);
444 usb_make_str_desc(&multi_configuration, sizeof(multi_configuration),
445 MULTI_DEFAULT_CONFIGURATION);
446 usb_make_str_desc(&multi_manufacturer, sizeof(multi_manufacturer),
447 MULTI_DEFAULT_MANUFACTURER);
448 usb_make_str_desc(&multi_product, sizeof(multi_product),
449 MULTI_DEFAULT_PRODUCT);
450 usb_make_str_desc(&multi_serial_number, sizeof(multi_serial_number),
451 MULTI_DEFAULT_SERIAL_NUMBER);
452
453 snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MULTI);
454 sysctl_ctx_init(&multi_ctx_list);
455
456 parent = SYSCTL_ADD_NODE(&multi_ctx_list,
457 SYSCTL_STATIC_CHILDREN(_hw_usb_templates), OID_AUTO,
458 parent_name, CTLFLAG_RW | CTLFLAG_MPSAFE,
459 0, "USB Multifunction device side template");
460 SYSCTL_ADD_U16(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
461 "vendor_id", CTLFLAG_RWTUN,
462 &usb_template_multi.idVendor, 1, "Vendor identifier");
463 SYSCTL_ADD_U16(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
464 "product_id", CTLFLAG_RWTUN,
465 &usb_template_multi.idProduct, 1, "Product identifier");
466 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
467 "eth_mac", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
468 &multi_eth_mac, sizeof(multi_eth_mac), usb_temp_sysctl,
469 "A", "Ethernet MAC address string");
470 #if 0
471 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
472 "modem", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
473 &multi_modem, sizeof(multi_modem), usb_temp_sysctl,
474 "A", "Modem interface string");
475 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
476 "eth_control", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
477 &multi_eth_control, sizeof(multi_eth_data), usb_temp_sysctl,
478 "A", "Ethernet control interface string");
479 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
480 "eth_data", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
481 &multi_eth_data, sizeof(multi_eth_data), usb_temp_sysctl,
482 "A", "Ethernet data interface string");
483 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
484 "interface", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
485 &multi_storage, sizeof(multi_storage), usb_temp_sysctl,
486 "A", "Storage interface string");
487 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
488 "configuration", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
489 &multi_configuration, sizeof(multi_configuration), usb_temp_sysctl,
490 "A", "Configuration string");
491 #endif
492 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
493 "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
494 &multi_manufacturer, sizeof(multi_manufacturer), usb_temp_sysctl,
495 "A", "Manufacturer string");
496 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
497 "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
498 &multi_product, sizeof(multi_product), usb_temp_sysctl,
499 "A", "Product string");
500 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
501 "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
502 &multi_serial_number, sizeof(multi_serial_number), usb_temp_sysctl,
503 "A", "Serial number string");
504 }
505
506 static void
multi_uninit(void * arg __unused)507 multi_uninit(void *arg __unused)
508 {
509
510 sysctl_ctx_free(&multi_ctx_list);
511 }
512
513 SYSINIT(multi_init, SI_SUB_LOCK, SI_ORDER_FIRST, multi_init, NULL);
514 SYSUNINIT(multi_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, multi_uninit, NULL);
515