Date: Sun, 9 Aug 2009 15:48:58 GMT From: Sylvestre Gallon <syl@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 167136 for review Message-ID: <200908091548.n79Fmwam026524@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167136 Change 167136 by syl@syl_twoflowers on 2009/08/09 15:48:56 Implement the generic_roothub_exec demultiplex. Implement stalled and nop answers. Affected files ... .. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/usb_roothub_exec.c#4 edit Differences ... ==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/usb_roothub_exec.c#4 (text+ko) ==== @@ -99,4 +99,184 @@ uint16_t index; usb_error_t err; + USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + + /* buffer reset */ + ptr = (const void*)&sc->sc_hub_temp; + len = 0; + err = 0; + + value = UGETW(req->wValue); + index = UGETW(req->wIndex); + + /* demultiplex the control request */ + switch (req->bmRequestType) { + case UT_READ_DEVICE: + switch (req->bRequest) { + case UR_GET_DESCRIPTOR: + /* handle_get_descriptor */ + case UR_GET_CONFIG: + /* handle_get_config */ + case UR_GET_STATUS: + /* handle_get_status */ + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_WRITE_DEVICE: + switch (req->bRequest) { + case UR_SET_ADDRESS: + /* handle_set_address */ + case UR_SET_CONFIG: + /* handle_set_config */ + case UR_CLEAR_FEATURE: + break; + case UR_SET_DESCRIPTOR: + break; + case UR_SET_FEATURE: + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_WRITE_ENDPOINT: + switch (req->bRequest) { + case UR_CLEAR_FEATURE: + switch (UGETW(req->wValue)) { + case UF_ENDPOINT_HALT: + /* handle_clear_halt */ + case UF_DEVICE_REMOTE_WAKEUP: + /* handle_clear_wakeup */ + default: + err = USB_ERR_STALLED; + break; + } + break; + case UR_SET_FEATURE: + switch (UGETW(req->wValue)) { + case UF_ENDPOINT_HALT: + /* handle_set_halt */ + case UF_DEVICE_REMOTE_WAKEUP: + /* handle_set_wakeup */ + default: + err = USB_ERR_STALLED; + break; + } + break; + case UR_SYNCH_FRAME: + break; + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_READ_ENDPOINT: + switch (req->bRequest) { + case UR_GET_STATUS: + /* handle_get_ep_status */ + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_WRITE_INTERFACE: + switch (req->bRequest) { + case UR_SET_INTERFACE: + /* handle_set_interface */ + case UR_CLEAR_FEATURE: + break; + case UR_SET_FEATURE: + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_READ_INTERFACE: + switch (req->bRequest) { + case UR_GET_INTERFACE: + /* handle_get_interfac */ + case UR_GET_STATUS: + /* handle_get_iface_status */ + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_WRITE_CLASS_INTERFACE: + case UT_WRITE_VENDOR_INTERFACE: + /* XXX forward */ + break; + + case UT_READ_CLASS_INTERFACE: + case UT_READ_VENDOR_INTERFACE: + /* XXX forward */ + break; + + case UT_WRITE_CLASS_DEVICE: + switch (req->bRequest) { + case UR_CLEAR_FEATURE: + break; + case UR_SET_DESCRIPTOR: + case UR_SET_FEATURE: + break; + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_WRITE_CLASS_OTHER: + switch (req->bRequest) { + case UR_CLEAR_FEATURE: + /* handle_clear_port_feature */ + case UR_SET_FEATURE: + /* handle_set_port_feature */ + case UR_CLEAR_TT_BUFFER: + case UR_RESET_TT: + case UR_STOP_TT: + break; + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_READ_CLASS_OTHER: + switch (req->bRequest) { + case UR_GET_TT_STATE: + /* handle_get_tt_state */ + case UR_GET_STATUS: + /* handle_get_port_status */ + default: + err = USB_ERR_STALLED; + break; + } + break; + + case UT_READ_CLASS_DEVICE: + switch (req->bRequest) { + case UR_GET_DESCRIPTOR: + /* handle_get_class_descriptor */ + case UR_GET_STATUS: + /* handle_get_class_status */ + + default: + err = USB_ERR_STALLED; + break ; + } + break; + default: + goto tr_stalled; + } + + *plength = len; + *pptr = ptr; + return (err); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908091548.n79Fmwam026524>