1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 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 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD$"); 42 43 #ifdef USB_GLOBAL_INCLUDE_FILE 44 #include USB_GLOBAL_INCLUDE_FILE 45 #else 46 #include <sys/stdint.h> 47 #include <sys/stddef.h> 48 #include <sys/param.h> 49 #include <sys/queue.h> 50 #include <sys/types.h> 51 #include <sys/systm.h> 52 #include <sys/kernel.h> 53 #include <sys/bus.h> 54 #include <sys/module.h> 55 #include <sys/lock.h> 56 #include <sys/mutex.h> 57 #include <sys/condvar.h> 58 #include <sys/sysctl.h> 59 #include <sys/sx.h> 60 #include <sys/unistd.h> 61 #include <sys/callout.h> 62 #include <sys/malloc.h> 63 #include <sys/priv.h> 64 65 #include <dev/usb/usb.h> 66 #include <dev/usb/usbdi.h> 67 #include <dev/usb/usb_core.h> 68 #include <dev/usb/usb_cdc.h> 69 #include <dev/usb/usb_ioctl.h> 70 #include <dev/usb/usb_util.h> 71 72 #include <dev/usb/template/usb_template.h> 73 #endif /* USB_GLOBAL_INCLUDE_FILE */ 74 75 #define MODEM_IFACE_0 0 76 #define MODEM_IFACE_1 1 77 78 enum { 79 MULTI_LANG_INDEX, 80 MULTI_MODEM_INDEX, 81 MULTI_ETH_MAC_INDEX, 82 MULTI_ETH_CONTROL_INDEX, 83 MULTI_ETH_DATA_INDEX, 84 MULTI_STORAGE_INDEX, 85 MULTI_CONFIGURATION_INDEX, 86 MULTI_MANUFACTURER_INDEX, 87 MULTI_PRODUCT_INDEX, 88 MULTI_SERIAL_NUMBER_INDEX, 89 MULTI_MAX_INDEX, 90 }; 91 92 #define MULTI_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR 93 #define MULTI_DEFAULT_PRODUCT_ID 0x0001 94 #define MULTI_DEFAULT_MODEM "Virtual serial console" 95 #define MULTI_DEFAULT_ETH_MAC "2A02030405060789AB" 96 #define MULTI_DEFAULT_ETH_CONTROL "Ethernet Comm Interface" 97 #define MULTI_DEFAULT_ETH_DATA "Ethernet Data Interface" 98 #define MULTI_DEFAULT_STORAGE "Mass Storage Interface" 99 #define MULTI_DEFAULT_CONFIGURATION "Default configuration" 100 #define MULTI_DEFAULT_MANUFACTURER "The FreeBSD Project" 101 #define MULTI_DEFAULT_PRODUCT "Multifunction Device" 102 #define MULTI_DEFAULT_SERIAL_NUMBER "May 2018" 103 104 static struct usb_string_descriptor multi_modem; 105 static struct usb_string_descriptor multi_eth_mac; 106 static struct usb_string_descriptor multi_eth_control; 107 static struct usb_string_descriptor multi_eth_data; 108 static struct usb_string_descriptor multi_storage; 109 static struct usb_string_descriptor multi_configuration; 110 static struct usb_string_descriptor multi_manufacturer; 111 static struct usb_string_descriptor multi_product; 112 static struct usb_string_descriptor multi_serial_number; 113 114 static struct sysctl_ctx_list multi_ctx_list; 115 116 /* prototypes */ 117 118 static usb_temp_get_string_desc_t multi_get_string_desc; 119 120 static const struct usb_cdc_union_descriptor eth_union_desc = { 121 .bLength = sizeof(eth_union_desc), 122 .bDescriptorType = UDESC_CS_INTERFACE, 123 .bDescriptorSubtype = UDESCSUB_CDC_UNION, 124 .bMasterInterface = 0, /* this is automatically updated */ 125 .bSlaveInterface[0] = 1, /* this is automatically updated */ 126 }; 127 128 static const struct usb_cdc_header_descriptor eth_header_desc = { 129 .bLength = sizeof(eth_header_desc), 130 .bDescriptorType = UDESC_CS_INTERFACE, 131 .bDescriptorSubtype = UDESCSUB_CDC_HEADER, 132 .bcdCDC[0] = 0x10, 133 .bcdCDC[1] = 0x01, 134 }; 135 136 static const struct usb_cdc_ethernet_descriptor eth_enf_desc = { 137 .bLength = sizeof(eth_enf_desc), 138 .bDescriptorType = UDESC_CS_INTERFACE, 139 .bDescriptorSubtype = UDESCSUB_CDC_ENF, 140 .iMacAddress = MULTI_ETH_MAC_INDEX, 141 .bmEthernetStatistics = {0, 0, 0, 0}, 142 .wMaxSegmentSize = {0xEA, 0x05},/* 1514 bytes */ 143 .wNumberMCFilters = {0, 0}, 144 .bNumberPowerFilters = 0, 145 }; 146 147 static const void *eth_control_if_desc[] = { 148 ð_union_desc, 149 ð_header_desc, 150 ð_enf_desc, 151 NULL, 152 }; 153 154 static const struct usb_temp_packet_size bulk_mps = { 155 .mps[USB_SPEED_FULL] = 64, 156 .mps[USB_SPEED_HIGH] = 512, 157 }; 158 159 static const struct usb_temp_packet_size intr_mps = { 160 .mps[USB_SPEED_FULL] = 8, 161 .mps[USB_SPEED_HIGH] = 8, 162 }; 163 164 static const struct usb_temp_endpoint_desc bulk_in_ep = { 165 .pPacketSize = &bulk_mps, 166 #ifdef USB_HIP_IN_EP_0 167 .bEndpointAddress = USB_HIP_IN_EP_0, 168 #else 169 .bEndpointAddress = UE_DIR_IN, 170 #endif 171 .bmAttributes = UE_BULK, 172 }; 173 174 static const struct usb_temp_endpoint_desc bulk_out_ep = { 175 .pPacketSize = &bulk_mps, 176 #ifdef USB_HIP_OUT_EP_0 177 .bEndpointAddress = USB_HIP_OUT_EP_0, 178 #else 179 .bEndpointAddress = UE_DIR_OUT, 180 #endif 181 .bmAttributes = UE_BULK, 182 }; 183 184 static const struct usb_temp_endpoint_desc intr_in_ep = { 185 .pPacketSize = &intr_mps, 186 .bEndpointAddress = UE_DIR_IN, 187 .bmAttributes = UE_INTERRUPT, 188 }; 189 190 static const struct usb_temp_endpoint_desc *eth_intr_endpoints[] = { 191 &intr_in_ep, 192 NULL, 193 }; 194 195 static const struct usb_temp_interface_desc eth_control_interface = { 196 .ppEndpoints = eth_intr_endpoints, 197 .ppRawDesc = eth_control_if_desc, 198 .bInterfaceClass = UICLASS_CDC, 199 .bInterfaceSubClass = UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 200 .bInterfaceProtocol = UIPROTO_CDC_NONE, 201 .iInterface = MULTI_ETH_CONTROL_INDEX, 202 }; 203 204 static const struct usb_temp_endpoint_desc *eth_data_endpoints[] = { 205 &bulk_in_ep, 206 &bulk_out_ep, 207 NULL, 208 }; 209 210 static const struct usb_temp_interface_desc eth_data_null_interface = { 211 .ppEndpoints = NULL, /* no endpoints */ 212 .bInterfaceClass = UICLASS_CDC_DATA, 213 .bInterfaceSubClass = UISUBCLASS_DATA, 214 .bInterfaceProtocol = 0, 215 .iInterface = MULTI_ETH_DATA_INDEX, 216 }; 217 218 static const struct usb_temp_interface_desc eth_data_interface = { 219 .ppEndpoints = eth_data_endpoints, 220 .bInterfaceClass = UICLASS_CDC_DATA, 221 .bInterfaceSubClass = UISUBCLASS_DATA, 222 .bInterfaceProtocol = 0, 223 .iInterface = MULTI_ETH_DATA_INDEX, 224 .isAltInterface = 1, /* this is an alternate setting */ 225 }; 226 227 static const struct usb_temp_packet_size modem_bulk_mps = { 228 .mps[USB_SPEED_LOW] = 8, 229 .mps[USB_SPEED_FULL] = 64, 230 .mps[USB_SPEED_HIGH] = 512, 231 }; 232 233 static const struct usb_temp_packet_size modem_intr_mps = { 234 .mps[USB_SPEED_LOW] = 8, 235 .mps[USB_SPEED_FULL] = 8, 236 .mps[USB_SPEED_HIGH] = 8, 237 }; 238 239 static const struct usb_temp_interval modem_intr_interval = { 240 .bInterval[USB_SPEED_LOW] = 8, /* 8ms */ 241 .bInterval[USB_SPEED_FULL] = 8, /* 8ms */ 242 .bInterval[USB_SPEED_HIGH] = 7, /* 8ms */ 243 }; 244 245 static const struct usb_temp_endpoint_desc modem_ep_0 = { 246 .pPacketSize = &modem_intr_mps, 247 .pIntervals = &modem_intr_interval, 248 .bEndpointAddress = UE_DIR_IN, 249 .bmAttributes = UE_INTERRUPT, 250 }; 251 252 static const struct usb_temp_endpoint_desc modem_ep_1 = { 253 .pPacketSize = &modem_bulk_mps, 254 .bEndpointAddress = UE_DIR_OUT, 255 .bmAttributes = UE_BULK, 256 }; 257 258 static const struct usb_temp_endpoint_desc modem_ep_2 = { 259 .pPacketSize = &modem_bulk_mps, 260 .bEndpointAddress = UE_DIR_IN, 261 .bmAttributes = UE_BULK, 262 }; 263 264 static const struct usb_temp_endpoint_desc *modem_iface_0_ep[] = { 265 &modem_ep_0, 266 NULL, 267 }; 268 269 static const struct usb_temp_endpoint_desc *modem_iface_1_ep[] = { 270 &modem_ep_1, 271 &modem_ep_2, 272 NULL, 273 }; 274 275 static const uint8_t modem_raw_desc_0[] = { 276 0x05, 0x24, 0x00, 0x10, 0x01 277 }; 278 279 static const uint8_t modem_raw_desc_1[] = { 280 0x05, 0x24, 0x06, MODEM_IFACE_0, MODEM_IFACE_1 281 }; 282 283 static const uint8_t modem_raw_desc_2[] = { 284 0x05, 0x24, 0x01, 0x03, MODEM_IFACE_1 285 }; 286 287 static const uint8_t modem_raw_desc_3[] = { 288 0x04, 0x24, 0x02, 0x07 289 }; 290 291 static const void *modem_iface_0_desc[] = { 292 &modem_raw_desc_0, 293 &modem_raw_desc_1, 294 &modem_raw_desc_2, 295 &modem_raw_desc_3, 296 NULL, 297 }; 298 299 static const struct usb_temp_interface_desc modem_iface_0 = { 300 .ppRawDesc = modem_iface_0_desc, 301 .ppEndpoints = modem_iface_0_ep, 302 .bInterfaceClass = UICLASS_CDC, 303 .bInterfaceSubClass = UISUBCLASS_ABSTRACT_CONTROL_MODEL, 304 .bInterfaceProtocol = UIPROTO_CDC_NONE, 305 .iInterface = MULTI_MODEM_INDEX, 306 }; 307 308 static const struct usb_temp_interface_desc modem_iface_1 = { 309 .ppEndpoints = modem_iface_1_ep, 310 .bInterfaceClass = UICLASS_CDC_DATA, 311 .bInterfaceSubClass = UISUBCLASS_DATA, 312 .bInterfaceProtocol = 0, 313 .iInterface = MULTI_MODEM_INDEX, 314 }; 315 316 static const struct usb_temp_packet_size msc_bulk_mps = { 317 .mps[USB_SPEED_FULL] = 64, 318 .mps[USB_SPEED_HIGH] = 512, 319 }; 320 321 static const struct usb_temp_endpoint_desc msc_bulk_in_ep = { 322 .pPacketSize = &msc_bulk_mps, 323 #ifdef USB_HIP_IN_EP_0 324 .bEndpointAddress = USB_HIP_IN_EP_0, 325 #else 326 .bEndpointAddress = UE_DIR_IN, 327 #endif 328 .bmAttributes = UE_BULK, 329 }; 330 331 static const struct usb_temp_endpoint_desc msc_bulk_out_ep = { 332 .pPacketSize = &msc_bulk_mps, 333 #ifdef USB_HIP_OUT_EP_0 334 .bEndpointAddress = USB_HIP_OUT_EP_0, 335 #else 336 .bEndpointAddress = UE_DIR_OUT, 337 #endif 338 .bmAttributes = UE_BULK, 339 }; 340 341 static const struct usb_temp_endpoint_desc *msc_data_endpoints[] = { 342 &msc_bulk_in_ep, 343 &msc_bulk_out_ep, 344 NULL, 345 }; 346 347 static const struct usb_temp_interface_desc msc_data_interface = { 348 .ppEndpoints = msc_data_endpoints, 349 .bInterfaceClass = UICLASS_MASS, 350 .bInterfaceSubClass = UISUBCLASS_SCSI, 351 .bInterfaceProtocol = UIPROTO_MASS_BBB, 352 .iInterface = MULTI_STORAGE_INDEX, 353 }; 354 355 static const struct usb_temp_interface_desc *multi_interfaces[] = { 356 &modem_iface_0, 357 &modem_iface_1, 358 ð_control_interface, 359 ð_data_null_interface, 360 ð_data_interface, 361 &msc_data_interface, 362 NULL, 363 }; 364 365 static const struct usb_temp_config_desc multi_config_desc = { 366 .ppIfaceDesc = multi_interfaces, 367 .bmAttributes = UC_BUS_POWERED, 368 .bMaxPower = 25, /* 50 mA */ 369 .iConfiguration = MULTI_CONFIGURATION_INDEX, 370 }; 371 static const struct usb_temp_config_desc *multi_configs[] = { 372 &multi_config_desc, 373 NULL, 374 }; 375 376 struct usb_temp_device_desc usb_template_multi = { 377 .getStringDesc = &multi_get_string_desc, 378 .ppConfigDesc = multi_configs, 379 .idVendor = MULTI_DEFAULT_VENDOR_ID, 380 .idProduct = MULTI_DEFAULT_PRODUCT_ID, 381 .bcdDevice = 0x0100, 382 .bDeviceClass = UDCLASS_IN_INTERFACE, 383 .bDeviceSubClass = 0, 384 .bDeviceProtocol = 0, 385 .iManufacturer = MULTI_MANUFACTURER_INDEX, 386 .iProduct = MULTI_PRODUCT_INDEX, 387 .iSerialNumber = MULTI_SERIAL_NUMBER_INDEX, 388 }; 389 390 /*------------------------------------------------------------------------* 391 * multi_get_string_desc 392 * 393 * Return values: 394 * NULL: Failure. No such string. 395 * Else: Success. Pointer to string descriptor is returned. 396 *------------------------------------------------------------------------*/ 397 static const void * 398 multi_get_string_desc(uint16_t lang_id, uint8_t string_index) 399 { 400 static const void *ptr[MULTI_MAX_INDEX] = { 401 [MULTI_LANG_INDEX] = &usb_string_lang_en, 402 [MULTI_MODEM_INDEX] = &multi_modem, 403 [MULTI_ETH_MAC_INDEX] = &multi_eth_mac, 404 [MULTI_ETH_CONTROL_INDEX] = &multi_eth_control, 405 [MULTI_ETH_DATA_INDEX] = &multi_eth_data, 406 [MULTI_STORAGE_INDEX] = &multi_storage, 407 [MULTI_CONFIGURATION_INDEX] = &multi_configuration, 408 [MULTI_MANUFACTURER_INDEX] = &multi_manufacturer, 409 [MULTI_PRODUCT_INDEX] = &multi_product, 410 [MULTI_SERIAL_NUMBER_INDEX] = &multi_serial_number, 411 }; 412 413 if (string_index == 0) { 414 return (&usb_string_lang_en); 415 } 416 if (lang_id != 0x0409) { 417 return (NULL); 418 } 419 if (string_index < MULTI_MAX_INDEX) { 420 return (ptr[string_index]); 421 } 422 return (NULL); 423 } 424 425 static void 426 multi_init(void *arg __unused) 427 { 428 struct sysctl_oid *parent; 429 char parent_name[3]; 430 431 usb_make_str_desc(&multi_modem, sizeof(multi_modem), 432 MULTI_DEFAULT_MODEM); 433 usb_make_str_desc(&multi_eth_mac, sizeof(multi_eth_mac), 434 MULTI_DEFAULT_ETH_MAC); 435 usb_make_str_desc(&multi_eth_control, sizeof(multi_eth_control), 436 MULTI_DEFAULT_ETH_CONTROL); 437 usb_make_str_desc(&multi_eth_data, sizeof(multi_eth_data), 438 MULTI_DEFAULT_ETH_DATA); 439 usb_make_str_desc(&multi_storage, sizeof(multi_storage), 440 MULTI_DEFAULT_STORAGE); 441 usb_make_str_desc(&multi_configuration, sizeof(multi_configuration), 442 MULTI_DEFAULT_CONFIGURATION); 443 usb_make_str_desc(&multi_manufacturer, sizeof(multi_manufacturer), 444 MULTI_DEFAULT_MANUFACTURER); 445 usb_make_str_desc(&multi_product, sizeof(multi_product), 446 MULTI_DEFAULT_PRODUCT); 447 usb_make_str_desc(&multi_serial_number, sizeof(multi_serial_number), 448 MULTI_DEFAULT_SERIAL_NUMBER); 449 450 snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MULTI); 451 sysctl_ctx_init(&multi_ctx_list); 452 453 parent = SYSCTL_ADD_NODE(&multi_ctx_list, 454 SYSCTL_STATIC_CHILDREN(_hw_usb_templates), OID_AUTO, 455 parent_name, CTLFLAG_RW, 456 0, "USB Multifunction device side template"); 457 SYSCTL_ADD_U16(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 458 "vendor_id", CTLFLAG_RWTUN, 459 &usb_template_multi.idVendor, 1, "Vendor identifier"); 460 SYSCTL_ADD_U16(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 461 "product_id", CTLFLAG_RWTUN, 462 &usb_template_multi.idProduct, 1, "Product identifier"); 463 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 464 "eth_mac", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 465 &multi_eth_mac, sizeof(multi_eth_mac), usb_temp_sysctl, 466 "A", "Ethernet MAC address string"); 467 #if 0 468 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 469 "modem", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 470 &multi_modem, sizeof(multi_modem), usb_temp_sysctl, 471 "A", "Modem interface string"); 472 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 473 "eth_control", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 474 &multi_eth_control, sizeof(multi_eth_data), usb_temp_sysctl, 475 "A", "Ethernet control interface string"); 476 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 477 "eth_data", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 478 &multi_eth_data, sizeof(multi_eth_data), usb_temp_sysctl, 479 "A", "Ethernet data interface string"); 480 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 481 "interface", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 482 &multi_storage, sizeof(multi_storage), usb_temp_sysctl, 483 "A", "Storage interface string"); 484 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 485 "configuration", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 486 &multi_configuration, sizeof(multi_configuration), usb_temp_sysctl, 487 "A", "Configuration string"); 488 #endif 489 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 490 "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 491 &multi_manufacturer, sizeof(multi_manufacturer), usb_temp_sysctl, 492 "A", "Manufacturer string"); 493 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 494 "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 495 &multi_product, sizeof(multi_product), usb_temp_sysctl, 496 "A", "Product string"); 497 SYSCTL_ADD_PROC(&multi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, 498 "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 499 &multi_serial_number, sizeof(multi_serial_number), usb_temp_sysctl, 500 "A", "Serial number string"); 501 } 502 503 static void 504 multi_uninit(void *arg __unused) 505 { 506 507 sysctl_ctx_free(&multi_ctx_list); 508 } 509 510 SYSINIT(multi_init, SI_SUB_LOCK, SI_ORDER_FIRST, multi_init, NULL); 511 SYSUNINIT(multi_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, multi_uninit, NULL); 512