diff options
author | gc161489 <none@none> | 2006-12-27 22:00:25 -0800 |
---|---|---|
committer | gc161489 <none@none> | 2006-12-27 22:00:25 -0800 |
commit | d73ae94e59c019f5cc3221ee0a0012d02091b40e (patch) | |
tree | 193b1ba4909675d6fe1bb07678ab5a9970a230c3 /usr/src/uts/common/sys/usb | |
parent | b051ecf6ce2f5fb47d73df411b0b95fa2b53ab9f (diff) | |
download | illumos-joyent-d73ae94e59c019f5cc3221ee0a0012d02091b40e.tar.gz |
PSARC 2006/649 USB Interface Association support
6463853 USB IAD should be supported in solaris (updated usb bindings, FWARC 2006/671)
Diffstat (limited to 'usr/src/uts/common/sys/usb')
-rw-r--r-- | usr/src/uts/common/sys/usb/usb_ia/usb_iavar.h | 114 | ||||
-rw-r--r-- | usr/src/uts/common/sys/usb/usb_mid/usb_midvar.h | 43 | ||||
-rw-r--r-- | usr/src/uts/common/sys/usb/usba/usba_impl.h | 9 | ||||
-rw-r--r-- | usr/src/uts/common/sys/usb/usba/usba_private.h | 65 | ||||
-rw-r--r-- | usr/src/uts/common/sys/usb/usbai.h | 33 |
5 files changed, 223 insertions, 41 deletions
diff --git a/usr/src/uts/common/sys/usb/usb_ia/usb_iavar.h b/usr/src/uts/common/sys/usb/usb_ia/usb_iavar.h new file mode 100644 index 0000000000..bb7194dcf7 --- /dev/null +++ b/usr/src/uts/common/sys/usb/usb_ia/usb_iavar.h @@ -0,0 +1,114 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_USB_USB_IA_H +#define _SYS_USB_USB_IA_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/usb/usba/usbai_private.h> + +/* + * soft state information for this usb_ia + */ +typedef struct usb_ia { + int ia_instance; + + uint_t ia_init_state; + + kmutex_t ia_mutex; + + /* + * dev_info_t reference + */ + dev_info_t *ia_dip; + + /* pointer to usb_ia_power_t */ + usb_common_power_t *ia_pm; + + int ia_dev_state; + + int ia_first_if; + int ia_n_ifs; + + /* track event registration of children */ + uint8_t *ia_child_events; + /* + * ia_children_dips is a array for holding + * each child dip indexed by interface number + */ + dev_info_t **ia_children_dips; + + size_t ia_cd_list_length; + + /* logging of messages */ + usb_log_handle_t ia_log_handle; + + /* usb registration */ + usb_client_dev_data_t *ia_dev_data; + + /* event support */ + ndi_event_hdl_t ia_ndi_event_hdl; + +} usb_ia_t; + +_NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_ia)) +_NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_common_power_t)) +_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_ia::ia_instance + usb_ia::ia_ndi_event_hdl + usb_ia::ia_dev_data + usb_ia::ia_log_handle + usb_ia::ia_dip + usb_ia::ia_pm)) + +/* init state */ +#define USB_IA_LOCK_INIT 0x0001 +#define USB_IA_MINOR_NODE_CREATED 0x0002 +#define USB_IA_EVENTS_REGISTERED 0x0004 + +/* Tracking events registered by children */ +#define USB_IA_CHILD_EVENT_DISCONNECT 0x01 +#define USB_IA_CHILD_EVENT_PRESUSPEND 0x02 + +/* + * Debug printing + * Masks + */ +#define DPRINT_MASK_ATTA 0x00000001 +#define DPRINT_MASK_CBOPS 0x00000002 +#define DPRINT_MASK_EVENTS 0x00000004 +#define DPRINT_MASK_PM 0x00000010 +#define DPRINT_MASK_ALL 0xFFFFFFFF + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_USB_USB_IA_H */ diff --git a/usr/src/uts/common/sys/usb/usb_mid/usb_midvar.h b/usr/src/uts/common/sys/usb/usb_mid/usb_midvar.h index 3668fbcc5d..65409ee966 100644 --- a/usr/src/uts/common/sys/usb/usb_mid/usb_midvar.h +++ b/usr/src/uts/common/sys/usb/usb_mid/usb_midvar.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -18,8 +17,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -34,26 +34,6 @@ extern "C" { #include <sys/usb/usba/usbai_private.h> -typedef struct usb_mid_power_struct { - void *mip_usb_mid; /* points back to usb_mid_t */ - - uint8_t mip_wakeup_enabled; - - /* this is the bit mask of the power states that device has */ - uint8_t mip_pwr_states; - - /* wakeup and power transistion capabilites of an interface */ - uint8_t mip_pm_capabilities; - - uint8_t mip_current_power; /* current power level */ -} usb_mid_power_t; - -/* warlock directives, stable data */ -_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_usb_mid)) -_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_wakeup_enabled)) -_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_pwr_states)) -_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_pm_capabilities)) - /* * soft state information for this usb_mid @@ -71,8 +51,8 @@ typedef struct usb_mid { */ dev_info_t *mi_dip; - /* pointer to usb_mid_power_t */ - usb_mid_power_t *mi_pm; + /* pointer to usb_common_power_t */ + usb_common_power_t *mi_pm; /* * save the usba_device pointer @@ -87,11 +67,16 @@ typedef struct usb_mid { /* track event registration of children */ uint8_t *mi_child_events; + + /* record the interface num of each child node */ + uint_t *mi_children_ifs; + /* - * mi_children_dips is a array for holding + * mi_children_dips is an array for holding * each child dip indexed by interface number */ dev_info_t **mi_children_dips; + boolean_t mi_removed_children; size_t mi_cd_list_length; @@ -112,7 +97,7 @@ typedef struct usb_mid { } usb_mid_t; _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid)) -_NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid_power_t)) +_NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_common_power_t)) _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid::mi_instance usb_mid::mi_ndi_event_hdl usb_mid::mi_dev_data diff --git a/usr/src/uts/common/sys/usb/usba/usba_impl.h b/usr/src/uts/common/sys/usb/usba/usba_impl.h index 5a5e50516c..b0d29f6316 100644 --- a/usr/src/uts/common/sys/usb/usba/usba_impl.h +++ b/usr/src/uts/common/sys/usb/usba/usba_impl.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,6 +46,7 @@ extern "C" { */ #define USBA_UGEN_DEVICE_BINDING 1 #define USBA_UGEN_INTERFACE_BINDING 2 +#define USBA_UGEN_INTERFACE_ASSOCIATION_BINDING 3 /* * Allocating a USB address @@ -345,6 +345,7 @@ _NOTE(SCHEME_PROTECTS_DATA("USBA managed data", usba_log_handle_impl)) #define FLAG_INTERFACE_NODE 0 #define FLAG_DEVICE_NODE 1 #define FLAG_COMBINED_NODE 2 +#define FLAG_INTERFACE_ASSOCIATION_NODE 3 typedef struct node_name_entry { int16_t class; diff --git a/usr/src/uts/common/sys/usb/usba/usba_private.h b/usr/src/uts/common/sys/usb/usba/usba_private.h index b681e273d1..baeb84fb66 100644 --- a/usr/src/uts/common/sys/usb/usba/usba_private.h +++ b/usr/src/uts/common/sys/usb/usba/usba_private.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -71,9 +70,10 @@ extern "C" { * ret_descr buffer the data is to be returned in * ret_buf_len size of the buffer at ret_descr * - * if_index the index in the array of concurrent interfaces + * first_if the first interace associated with current iad + * if_index the index in the array of concurrent interfaces * supported by this configuration - * alt_if_setting alternate setting for the interface identified + * alt_if_setting alternate setting for the interface identified * by if_index * ep_index the index in the array of endpoints supported by * this configuration @@ -100,6 +100,14 @@ size_t usb_parse_cfg_descr( size_t ret_buf_len); +size_t usb_parse_ia_descr( + uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + size_t buflen, + size_t first_if, + usb_ia_descr_t *ret_descr, + size_t ret_buf_len); + + size_t usb_parse_if_descr( uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, @@ -281,10 +289,15 @@ ddi_dma_attr_t *usba_get_hc_dma_attr(dev_info_t *dip); */ int usba_bind_driver(dev_info_t *); +/* check whether the dip owns an interface-associaiton */ +boolean_t usba_owns_ia(dev_info_t *dip); + /* * Driver binding functions */ dev_info_t *usba_ready_device_node(dev_info_t *); +dev_info_t *usba_ready_interface_association_node(dev_info_t *, + uint_t, uint_t *); dev_info_t *usba_ready_interface_node(dev_info_t *, uint_t); /* Some Nexus driver functions. */ @@ -345,6 +358,7 @@ extern usb_ep_descr_t usba_default_ep_descr; #define USB_IF_DESCR_SIZE 9 /* interface descr size */ #define USBA_IF_PWR_DESCR_SIZE 15 /* interface pwr descr size */ #define USB_EP_DESCR_SIZE 7 /* endpoint descr size */ +#define USB_IA_DESCR_SIZE 8 /* interface association descr size */ /* * For compatibility with old code. @@ -410,6 +424,45 @@ size_t usba_parse_if_pwr_descr(uchar_t *, size_t buflen, uint_t, */ size_t usba_ascii_string_descr(uchar_t *, size_t, char *, size_t); + +/* + * usb common power management, for usb_mid, usb_ia and maybe other simple + * drivers. + */ +typedef struct usb_common_power_struct { + void *uc_usb_statep; /* points back to state structure */ + + uint8_t uc_wakeup_enabled; + + /* this is the bit mask of the power states that device has */ + uint8_t uc_pwr_states; + + /* wakeup and power transition capabilites of an interface */ + uint8_t uc_pm_capabilities; + + uint8_t uc_current_power; /* current power level */ +} usb_common_power_t; + +/* warlock directives, stable data */ +_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_common_power_t::uc_usb_statep)) +_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_common_power_t::uc_wakeup_enabled)) +_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_common_power_t::uc_pwr_states)) +_NOTE(DATA_READABLE_WITHOUT_LOCK(usb_common_power_t::uc_pm_capabilities)) + +/* power management */ +int usba_common_power(dev_info_t *, usb_common_power_t *, int *, int); + +/* + * usb common events handler for usb_mid, usb_ia and maybe other nexus + * drivers. + */ + +void usba_common_register_events(dev_info_t *, uint_t, + void (*)(dev_info_t *, ddi_eventcookie_t, void *, void *)); + +void usba_common_unregister_events(dev_info_t *, uint_t); + + #ifdef __cplusplus } #endif diff --git a/usr/src/uts/common/sys/usb/usbai.h b/usr/src/uts/common/sys/usb/usbai.h index 43958caef9..1bea82b9d1 100644 --- a/usr/src/uts/common/sys/usb/usbai.h +++ b/usr/src/uts/common/sys/usb/usbai.h @@ -317,6 +317,22 @@ typedef struct usb_other_speed_cfg_descr { /* + * usb_ia_descr: + * usb interface association descriptor, refer to USB 2.0 ECN(IAD) + */ +typedef struct usb_ia_descr { + uint8_t bLength; /* descriptor size */ + uint8_t bDescriptorType; /* INTERFACE_ASSOCIATION */ + uint8_t bFirstInterface; /* 1st interface number */ + uint8_t bInterfaceCount; /* number of interfaces */ + uint8_t bFunctionClass; /* class code */ + uint8_t bFunctionSubClass; /* sub class code */ + uint8_t bFunctionProtocol; /* protocol code */ + uint8_t iFunction; /* description string */ +} usb_ia_descr_t; + + +/* * usb_if_descr: * usb interface descriptor, refer to USB 2.0/9.6.5 */ @@ -1326,6 +1342,7 @@ typedef struct usb_ctrl_req { #define USB_DESCR_TYPE_DEV_QLF 0x06 #define USB_DESCR_TYPE_OTHER_SPEED_CFG 0x07 #define USB_DESCR_TYPE_IF_PWR 0x08 +#define USB_DESCR_TYPE_IA 0x0B /* * device request type @@ -2335,14 +2352,16 @@ void usb_unregister_hotplug_cbs(dev_info_t *dip); #define USB_CLASS_CDC_CTRL 2 /* CDC-control iface class, also 2 */ #define USB_CLASS_HID 3 #define USB_CLASS_PHYSICAL 5 +#define USB_CLASS_IMAGE 6 #define USB_CLASS_PRINTER 7 #define USB_CLASS_MASS_STORAGE 8 #define USB_CLASS_HUB 9 /* Device class */ #define USB_CLASS_CDC_DATA 10 #define USB_CLASS_CCID 11 #define USB_CLASS_SECURITY 13 +#define USB_CLASS_VIDEO 14 #define USB_CLASS_DIAG 220 /* Device class */ -#define USB_CLASS_WIRELESS 224 /* Device class */ +#define USB_CLASS_WIRELESS 224 #define USB_CLASS_MISC 239 /* Device class */ #define USB_CLASS_APP 254 #define USB_CLASS_VENDOR_SPEC 255 /* Device class */ @@ -2393,7 +2412,17 @@ void usb_unregister_hotplug_cbs(dev_info_t *dip); #define USB_SUBCLS_APP_IRDA 0x02 /* app spec IrDa subclass */ #define USB_SUBCLS_APP_TEST 0x03 /* app spec test subclass */ - +/* Video subclasses */ +#define USB_SUBCLS_VIDEO_CONTROL 0x01 /* video control */ +#define USB_SUBCLS_VIDEO_STREAM 0x02 /* video stream */ +#define USB_SUBCLS_VIDEO_COLLECTION 0x03 /* video interface collection */ + +/* Wireless controller subclasses and protocols */ +#define USB_SUBCLS_WUSB_1 0x01 +#define USB_SUBCLS_WUSB_2 0x02 +#define USB_PROTO_WUSB_HWA 0x01 /* host wire adapter */ +#define USB_PROTO_WUSB_DWA 0x02 /* device wire adapter */ +#define USB_PROTO_WUSB_DWA_ISO 0x03 /* device wire adapter isoc */ #ifdef __cplusplus } |