102ac6454SAndrew Thompson /* $FreeBSD$ */ 202ac6454SAndrew Thompson /*- 3718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4718cf2ccSPedro F. Giffuni * 502ac6454SAndrew Thompson * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 602ac6454SAndrew Thompson * 702ac6454SAndrew Thompson * Redistribution and use in source and binary forms, with or without 802ac6454SAndrew Thompson * modification, are permitted provided that the following conditions 902ac6454SAndrew Thompson * are met: 1002ac6454SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 1102ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1202ac6454SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1302ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1402ac6454SAndrew Thompson * documentation and/or other materials provided with the distribution. 1502ac6454SAndrew Thompson * 1602ac6454SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1702ac6454SAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1802ac6454SAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1902ac6454SAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2002ac6454SAndrew Thompson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2102ac6454SAndrew Thompson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2202ac6454SAndrew Thompson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2302ac6454SAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2402ac6454SAndrew Thompson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2502ac6454SAndrew Thompson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2602ac6454SAndrew Thompson * SUCH DAMAGE. 2702ac6454SAndrew Thompson */ 2802ac6454SAndrew Thompson 29d2b99310SHans Petter Selasky #ifdef USB_GLOBAL_INCLUDE_FILE 30d2b99310SHans Petter Selasky #include USB_GLOBAL_INCLUDE_FILE 31d2b99310SHans Petter Selasky #else 32ed6d949aSAndrew Thompson #include <sys/stdint.h> 33ed6d949aSAndrew Thompson #include <sys/stddef.h> 34ed6d949aSAndrew Thompson #include <sys/param.h> 35ed6d949aSAndrew Thompson #include <sys/queue.h> 36ed6d949aSAndrew Thompson #include <sys/types.h> 37ed6d949aSAndrew Thompson #include <sys/systm.h> 38ed6d949aSAndrew Thompson #include <sys/kernel.h> 39ed6d949aSAndrew Thompson #include <sys/bus.h> 40ed6d949aSAndrew Thompson #include <sys/module.h> 41ed6d949aSAndrew Thompson #include <sys/lock.h> 42ed6d949aSAndrew Thompson #include <sys/mutex.h> 43ed6d949aSAndrew Thompson #include <sys/condvar.h> 44ed6d949aSAndrew Thompson #include <sys/sysctl.h> 45ed6d949aSAndrew Thompson #include <sys/sx.h> 46ed6d949aSAndrew Thompson #include <sys/unistd.h> 47ed6d949aSAndrew Thompson #include <sys/callout.h> 48ed6d949aSAndrew Thompson #include <sys/malloc.h> 49ed6d949aSAndrew Thompson #include <sys/priv.h> 50ed6d949aSAndrew Thompson 5102ac6454SAndrew Thompson #include <dev/usb/usb.h> 52ed6d949aSAndrew Thompson #include <dev/usb/usbdi.h> 5302ac6454SAndrew Thompson 5402ac6454SAndrew Thompson #include <dev/usb/usb_core.h> 5502ac6454SAndrew Thompson #include <dev/usb/usb_debug.h> 5602ac6454SAndrew Thompson #include <dev/usb/usb_process.h> 5702ac6454SAndrew Thompson #include <dev/usb/usb_device.h> 5802ac6454SAndrew Thompson #include <dev/usb/usb_busdma.h> 5902ac6454SAndrew Thompson #include <dev/usb/usb_transfer.h> 6002ac6454SAndrew Thompson 61ed6d949aSAndrew Thompson #include <ddb/ddb.h> 62ed6d949aSAndrew Thompson #include <ddb/db_sym.h> 63d2b99310SHans Petter Selasky #endif /* USB_GLOBAL_INCLUDE_FILE */ 64ed6d949aSAndrew Thompson 6502ac6454SAndrew Thompson /* 6602ac6454SAndrew Thompson * Define this unconditionally in case a kernel module is loaded that 6702ac6454SAndrew Thompson * has been compiled with debugging options. 6802ac6454SAndrew Thompson */ 69a593f6b8SAndrew Thompson int usb_debug = 0; 7002ac6454SAndrew Thompson 71*f8d2b1f3SPawel Biernacki SYSCTL_NODE(_hw, OID_AUTO, usb, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 72*f8d2b1f3SPawel Biernacki "USB debugging"); 73af3b2549SHans Petter Selasky SYSCTL_INT(_hw_usb, OID_AUTO, debug, CTLFLAG_RWTUN, 74a593f6b8SAndrew Thompson &usb_debug, 0, "Debug level"); 75c13fd8d4SAndrew Thompson 7637506412SHans Petter Selasky #ifdef USB_DEBUG 7737506412SHans Petter Selasky /* 7837506412SHans Petter Selasky * Sysctls to modify timings/delays 7937506412SHans Petter Selasky */ 80*f8d2b1f3SPawel Biernacki static SYSCTL_NODE(_hw_usb, OID_AUTO, timings, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 81*f8d2b1f3SPawel Biernacki "Timings"); 8237506412SHans Petter Selasky static int usb_timings_sysctl_handler(SYSCTL_HANDLER_ARGS); 8337506412SHans Petter Selasky 84*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, port_reset_delay, 85*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_port_reset_delay, 86*f8d2b1f3SPawel Biernacki sizeof(usb_port_reset_delay), usb_timings_sysctl_handler, "IU", 87*f8d2b1f3SPawel Biernacki "Port Reset Delay"); 88*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, port_root_reset_delay, 89*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 9037506412SHans Petter Selasky &usb_port_root_reset_delay, sizeof(usb_port_root_reset_delay), 91*f8d2b1f3SPawel Biernacki usb_timings_sysctl_handler, "IU", 92*f8d2b1f3SPawel Biernacki "Root Port Reset Delay"); 93*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, port_reset_recovery, 94*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 9537506412SHans Petter Selasky &usb_port_reset_recovery, sizeof(usb_port_reset_recovery), 96*f8d2b1f3SPawel Biernacki usb_timings_sysctl_handler, "IU", 97*f8d2b1f3SPawel Biernacki "Port Reset Recovery"); 98*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, port_powerup_delay, 99*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_port_powerup_delay, 100*f8d2b1f3SPawel Biernacki sizeof(usb_port_powerup_delay), usb_timings_sysctl_handler, "IU", 101*f8d2b1f3SPawel Biernacki "Port PowerUp Delay"); 102*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, port_resume_delay, 103*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_port_resume_delay, 104*f8d2b1f3SPawel Biernacki sizeof(usb_port_resume_delay), usb_timings_sysctl_handler, "IU", 105*f8d2b1f3SPawel Biernacki "Port Resume Delay"); 106*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, set_address_settle, 107*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_set_address_settle, 108*f8d2b1f3SPawel Biernacki sizeof(usb_set_address_settle), usb_timings_sysctl_handler, "IU", 109*f8d2b1f3SPawel Biernacki "Set Address Settle"); 110*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, resume_delay, 111*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_resume_delay, 112*f8d2b1f3SPawel Biernacki sizeof(usb_resume_delay), usb_timings_sysctl_handler, "IU", 113*f8d2b1f3SPawel Biernacki "Resume Delay"); 114*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, resume_wait, 115*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_resume_wait, 116*f8d2b1f3SPawel Biernacki sizeof(usb_resume_wait), usb_timings_sysctl_handler, "IU", 117*f8d2b1f3SPawel Biernacki "Resume Wait"); 118*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, resume_recovery, 119*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_resume_recovery, 120*f8d2b1f3SPawel Biernacki sizeof(usb_resume_recovery), usb_timings_sysctl_handler, "IU", 121*f8d2b1f3SPawel Biernacki "Resume Recovery"); 122*f8d2b1f3SPawel Biernacki SYSCTL_PROC(_hw_usb_timings, OID_AUTO, extra_power_up_time, 123*f8d2b1f3SPawel Biernacki CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_extra_power_up_time, 124*f8d2b1f3SPawel Biernacki sizeof(usb_extra_power_up_time), usb_timings_sysctl_handler, "IU", 125*f8d2b1f3SPawel Biernacki "Extra PowerUp Time"); 12637506412SHans Petter Selasky #endif 12737506412SHans Petter Selasky 12802ac6454SAndrew Thompson /*------------------------------------------------------------------------* 129a593f6b8SAndrew Thompson * usb_dump_iface 13002ac6454SAndrew Thompson * 13102ac6454SAndrew Thompson * This function dumps information about an USB interface. 13202ac6454SAndrew Thompson *------------------------------------------------------------------------*/ 13302ac6454SAndrew Thompson void 134a593f6b8SAndrew Thompson usb_dump_iface(struct usb_interface *iface) 13502ac6454SAndrew Thompson { 136a593f6b8SAndrew Thompson printf("usb_dump_iface: iface=%p\n", iface); 13702ac6454SAndrew Thompson if (iface == NULL) { 13802ac6454SAndrew Thompson return; 13902ac6454SAndrew Thompson } 14002ac6454SAndrew Thompson printf(" iface=%p idesc=%p altindex=%d\n", 14102ac6454SAndrew Thompson iface, iface->idesc, iface->alt_index); 14202ac6454SAndrew Thompson } 14302ac6454SAndrew Thompson 14402ac6454SAndrew Thompson /*------------------------------------------------------------------------* 145a593f6b8SAndrew Thompson * usb_dump_device 14602ac6454SAndrew Thompson * 14702ac6454SAndrew Thompson * This function dumps information about an USB device. 14802ac6454SAndrew Thompson *------------------------------------------------------------------------*/ 14902ac6454SAndrew Thompson void 150a593f6b8SAndrew Thompson usb_dump_device(struct usb_device *udev) 15102ac6454SAndrew Thompson { 152a593f6b8SAndrew Thompson printf("usb_dump_device: dev=%p\n", udev); 15302ac6454SAndrew Thompson if (udev == NULL) { 15402ac6454SAndrew Thompson return; 15502ac6454SAndrew Thompson } 15602ac6454SAndrew Thompson printf(" bus=%p \n" 15702ac6454SAndrew Thompson " address=%d config=%d depth=%d speed=%d self_powered=%d\n" 15802ac6454SAndrew Thompson " power=%d langid=%d\n", 15902ac6454SAndrew Thompson udev->bus, 16002ac6454SAndrew Thompson udev->address, udev->curr_config_no, udev->depth, udev->speed, 16102ac6454SAndrew Thompson udev->flags.self_powered, udev->power, udev->langid); 16202ac6454SAndrew Thompson } 16302ac6454SAndrew Thompson 16402ac6454SAndrew Thompson /*------------------------------------------------------------------------* 165a593f6b8SAndrew Thompson * usb_dump_queue 16602ac6454SAndrew Thompson * 167ae60fdfbSAndrew Thompson * This function dumps the USB transfer that are queued up on an USB endpoint. 16802ac6454SAndrew Thompson *------------------------------------------------------------------------*/ 16902ac6454SAndrew Thompson void 170a593f6b8SAndrew Thompson usb_dump_queue(struct usb_endpoint *ep) 17102ac6454SAndrew Thompson { 172760bc48eSAndrew Thompson struct usb_xfer *xfer; 173a5cf1aaaSHans Petter Selasky usb_stream_t x; 17402ac6454SAndrew Thompson 175a593f6b8SAndrew Thompson printf("usb_dump_queue: endpoint=%p xfer: ", ep); 176a5cf1aaaSHans Petter Selasky for (x = 0; x != USB_MAX_EP_STREAMS; x++) { 177a5cf1aaaSHans Petter Selasky TAILQ_FOREACH(xfer, &ep->endpoint_q[x].head, wait_entry) 17802ac6454SAndrew Thompson printf(" %p", xfer); 17902ac6454SAndrew Thompson } 18002ac6454SAndrew Thompson printf("\n"); 18102ac6454SAndrew Thompson } 18202ac6454SAndrew Thompson 18302ac6454SAndrew Thompson /*------------------------------------------------------------------------* 184a593f6b8SAndrew Thompson * usb_dump_endpoint 18502ac6454SAndrew Thompson * 186ae60fdfbSAndrew Thompson * This function dumps information about an USB endpoint. 18702ac6454SAndrew Thompson *------------------------------------------------------------------------*/ 18802ac6454SAndrew Thompson void 189a593f6b8SAndrew Thompson usb_dump_endpoint(struct usb_endpoint *ep) 19002ac6454SAndrew Thompson { 191ae60fdfbSAndrew Thompson if (ep) { 192a593f6b8SAndrew Thompson printf("usb_dump_endpoint: endpoint=%p", ep); 19302ac6454SAndrew Thompson 19402ac6454SAndrew Thompson printf(" edesc=%p isoc_next=%d toggle_next=%d", 195ae60fdfbSAndrew Thompson ep->edesc, ep->isoc_next, ep->toggle_next); 19602ac6454SAndrew Thompson 197ae60fdfbSAndrew Thompson if (ep->edesc) { 19802ac6454SAndrew Thompson printf(" bEndpointAddress=0x%02x", 199ae60fdfbSAndrew Thompson ep->edesc->bEndpointAddress); 20002ac6454SAndrew Thompson } 20102ac6454SAndrew Thompson printf("\n"); 202a593f6b8SAndrew Thompson usb_dump_queue(ep); 20302ac6454SAndrew Thompson } else { 204a593f6b8SAndrew Thompson printf("usb_dump_endpoint: endpoint=NULL\n"); 20502ac6454SAndrew Thompson } 20602ac6454SAndrew Thompson } 20702ac6454SAndrew Thompson 20802ac6454SAndrew Thompson /*------------------------------------------------------------------------* 209a593f6b8SAndrew Thompson * usb_dump_xfer 21002ac6454SAndrew Thompson * 21102ac6454SAndrew Thompson * This function dumps information about an USB transfer. 21202ac6454SAndrew Thompson *------------------------------------------------------------------------*/ 21302ac6454SAndrew Thompson void 214a593f6b8SAndrew Thompson usb_dump_xfer(struct usb_xfer *xfer) 21502ac6454SAndrew Thompson { 216760bc48eSAndrew Thompson struct usb_device *udev; 217a593f6b8SAndrew Thompson printf("usb_dump_xfer: xfer=%p\n", xfer); 21802ac6454SAndrew Thompson if (xfer == NULL) { 21902ac6454SAndrew Thompson return; 22002ac6454SAndrew Thompson } 221ae60fdfbSAndrew Thompson if (xfer->endpoint == NULL) { 222ae60fdfbSAndrew Thompson printf("xfer %p: endpoint=NULL\n", 22302ac6454SAndrew Thompson xfer); 22402ac6454SAndrew Thompson return; 22502ac6454SAndrew Thompson } 22602ac6454SAndrew Thompson udev = xfer->xroot->udev; 22702ac6454SAndrew Thompson printf("xfer %p: udev=%p vid=0x%04x pid=0x%04x addr=%d " 228ae60fdfbSAndrew Thompson "endpoint=%p ep=0x%02x attr=0x%02x\n", 22902ac6454SAndrew Thompson xfer, udev, 23002ac6454SAndrew Thompson UGETW(udev->ddesc.idVendor), 23102ac6454SAndrew Thompson UGETW(udev->ddesc.idProduct), 232ae60fdfbSAndrew Thompson udev->address, xfer->endpoint, 233ae60fdfbSAndrew Thompson xfer->endpoint->edesc->bEndpointAddress, 234ae60fdfbSAndrew Thompson xfer->endpoint->edesc->bmAttributes); 23502ac6454SAndrew Thompson } 23637506412SHans Petter Selasky 23737506412SHans Petter Selasky #ifdef USB_DEBUG 23837506412SHans Petter Selasky unsigned int usb_port_reset_delay = USB_PORT_RESET_DELAY; 23937506412SHans Petter Selasky unsigned int usb_port_root_reset_delay = USB_PORT_ROOT_RESET_DELAY; 24037506412SHans Petter Selasky unsigned int usb_port_reset_recovery = USB_PORT_RESET_RECOVERY; 24137506412SHans Petter Selasky unsigned int usb_port_powerup_delay = USB_PORT_POWERUP_DELAY; 24237506412SHans Petter Selasky unsigned int usb_port_resume_delay = USB_PORT_RESUME_DELAY; 24337506412SHans Petter Selasky unsigned int usb_set_address_settle = USB_SET_ADDRESS_SETTLE; 24437506412SHans Petter Selasky unsigned int usb_resume_delay = USB_RESUME_DELAY; 24537506412SHans Petter Selasky unsigned int usb_resume_wait = USB_RESUME_WAIT; 24637506412SHans Petter Selasky unsigned int usb_resume_recovery = USB_RESUME_RECOVERY; 24737506412SHans Petter Selasky unsigned int usb_extra_power_up_time = USB_EXTRA_POWER_UP_TIME; 24837506412SHans Petter Selasky 24937506412SHans Petter Selasky /*------------------------------------------------------------------------* 25037506412SHans Petter Selasky * usb_timings_sysctl_handler 25137506412SHans Petter Selasky * 25237506412SHans Petter Selasky * This function updates timings variables, adjusting them where necessary. 25337506412SHans Petter Selasky *------------------------------------------------------------------------*/ 25437506412SHans Petter Selasky static int usb_timings_sysctl_handler(SYSCTL_HANDLER_ARGS) 25537506412SHans Petter Selasky { 25637506412SHans Petter Selasky int error = 0; 25737506412SHans Petter Selasky unsigned int val; 25837506412SHans Petter Selasky 25937506412SHans Petter Selasky /* 26037506412SHans Petter Selasky * Attempt to get a coherent snapshot by making a copy of the data. 26137506412SHans Petter Selasky */ 26237506412SHans Petter Selasky if (arg1) 26337506412SHans Petter Selasky val = *(unsigned int *)arg1; 26437506412SHans Petter Selasky else 26537506412SHans Petter Selasky val = arg2; 26637506412SHans Petter Selasky error = SYSCTL_OUT(req, &val, sizeof(int)); 26737506412SHans Petter Selasky if (error || !req->newptr) 26837506412SHans Petter Selasky return (error); 26937506412SHans Petter Selasky 27037506412SHans Petter Selasky if (!arg1) 27137506412SHans Petter Selasky return EPERM; 27237506412SHans Petter Selasky 27337506412SHans Petter Selasky error = SYSCTL_IN(req, &val, sizeof(unsigned int)); 27437506412SHans Petter Selasky if (error) 27537506412SHans Petter Selasky return (error); 27637506412SHans Petter Selasky 27737506412SHans Petter Selasky /* 27837506412SHans Petter Selasky * Now make sure the values are decent, and certainly no lower than 27937506412SHans Petter Selasky * what the USB spec prescribes. 28037506412SHans Petter Selasky */ 28137506412SHans Petter Selasky unsigned int *p = (unsigned int *)arg1; 28237506412SHans Petter Selasky if (p == &usb_port_reset_delay) { 28337506412SHans Petter Selasky if (val < USB_PORT_RESET_DELAY_SPEC) 28437506412SHans Petter Selasky return (EINVAL); 28537506412SHans Petter Selasky } else if (p == &usb_port_root_reset_delay) { 28637506412SHans Petter Selasky if (val < USB_PORT_ROOT_RESET_DELAY_SPEC) 28737506412SHans Petter Selasky return (EINVAL); 28837506412SHans Petter Selasky } else if (p == &usb_port_reset_recovery) { 28937506412SHans Petter Selasky if (val < USB_PORT_RESET_RECOVERY_SPEC) 29037506412SHans Petter Selasky return (EINVAL); 29137506412SHans Petter Selasky } else if (p == &usb_port_powerup_delay) { 29237506412SHans Petter Selasky if (val < USB_PORT_POWERUP_DELAY_SPEC) 29337506412SHans Petter Selasky return (EINVAL); 29437506412SHans Petter Selasky } else if (p == &usb_port_resume_delay) { 29537506412SHans Petter Selasky if (val < USB_PORT_RESUME_DELAY_SPEC) 29637506412SHans Petter Selasky return (EINVAL); 29737506412SHans Petter Selasky } else if (p == &usb_set_address_settle) { 29837506412SHans Petter Selasky if (val < USB_SET_ADDRESS_SETTLE_SPEC) 29937506412SHans Petter Selasky return (EINVAL); 30037506412SHans Petter Selasky } else if (p == &usb_resume_delay) { 30137506412SHans Petter Selasky if (val < USB_RESUME_DELAY_SPEC) 30237506412SHans Petter Selasky return (EINVAL); 30337506412SHans Petter Selasky } else if (p == &usb_resume_wait) { 30437506412SHans Petter Selasky if (val < USB_RESUME_WAIT_SPEC) 30537506412SHans Petter Selasky return (EINVAL); 30637506412SHans Petter Selasky } else if (p == &usb_resume_recovery) { 30737506412SHans Petter Selasky if (val < USB_RESUME_RECOVERY_SPEC) 30837506412SHans Petter Selasky return (EINVAL); 30937506412SHans Petter Selasky } else if (p == &usb_extra_power_up_time) { 31037506412SHans Petter Selasky if (val < USB_EXTRA_POWER_UP_TIME_SPEC) 31137506412SHans Petter Selasky return (EINVAL); 31237506412SHans Petter Selasky } else { 31337506412SHans Petter Selasky /* noop */ 31437506412SHans Petter Selasky } 31537506412SHans Petter Selasky 31637506412SHans Petter Selasky *p = val; 31737506412SHans Petter Selasky return 0; 31837506412SHans Petter Selasky } 31937506412SHans Petter Selasky #endif 320