19430SRaymond.Chen@Sun.COM /* 29430SRaymond.Chen@Sun.COM * CDDL HEADER START 39430SRaymond.Chen@Sun.COM * 49430SRaymond.Chen@Sun.COM * The contents of this file are subject to the terms of the 59430SRaymond.Chen@Sun.COM * Common Development and Distribution License (the "License"). 69430SRaymond.Chen@Sun.COM * You may not use this file except in compliance with the License. 79430SRaymond.Chen@Sun.COM * 89430SRaymond.Chen@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99430SRaymond.Chen@Sun.COM * or http://www.opensolaris.org/os/licensing. 109430SRaymond.Chen@Sun.COM * See the License for the specific language governing permissions 119430SRaymond.Chen@Sun.COM * and limitations under the License. 129430SRaymond.Chen@Sun.COM * 139430SRaymond.Chen@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 149430SRaymond.Chen@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159430SRaymond.Chen@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 169430SRaymond.Chen@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 179430SRaymond.Chen@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 189430SRaymond.Chen@Sun.COM * 199430SRaymond.Chen@Sun.COM * CDDL HEADER END 209430SRaymond.Chen@Sun.COM */ 219430SRaymond.Chen@Sun.COM /* 229430SRaymond.Chen@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 239430SRaymond.Chen@Sun.COM * Use is subject to license terms. 249430SRaymond.Chen@Sun.COM */ 259430SRaymond.Chen@Sun.COM 269430SRaymond.Chen@Sun.COM #ifndef _SYS_USB_WHCDI_H 279430SRaymond.Chen@Sun.COM #define _SYS_USB_WHCDI_H 289430SRaymond.Chen@Sun.COM 299430SRaymond.Chen@Sun.COM #ifdef __cplusplus 309430SRaymond.Chen@Sun.COM extern "C" { 319430SRaymond.Chen@Sun.COM #endif 329430SRaymond.Chen@Sun.COM 339430SRaymond.Chen@Sun.COM #include <sys/usb/usba/usba_types.h> 349430SRaymond.Chen@Sun.COM #include <sys/usb/usba/wusba.h> 359430SRaymond.Chen@Sun.COM #include <sys/usb/usba/wusba_io.h> 369430SRaymond.Chen@Sun.COM #include <sys/usb/usba/wa.h> /* for wusb_secrt_data_t */ 379430SRaymond.Chen@Sun.COM 389430SRaymond.Chen@Sun.COM 399430SRaymond.Chen@Sun.COM /* 409430SRaymond.Chen@Sun.COM * This file contains data structures and functions that might be 419430SRaymond.Chen@Sun.COM * shared by HWA and WHCI drivers. 429430SRaymond.Chen@Sun.COM */ 439430SRaymond.Chen@Sun.COM 449430SRaymond.Chen@Sun.COM typedef struct wusb_hc_cc_list { 459430SRaymond.Chen@Sun.COM wusb_cc_t cc; 469430SRaymond.Chen@Sun.COM struct wusb_hc_cc_list *next; 479430SRaymond.Chen@Sun.COM } wusb_hc_cc_list_t; 489430SRaymond.Chen@Sun.COM 499430SRaymond.Chen@Sun.COM struct wusb_hc_data; 509430SRaymond.Chen@Sun.COM 519430SRaymond.Chen@Sun.COM typedef struct wusb_dev_info { 529430SRaymond.Chen@Sun.COM struct wusb_hc_data *wdev_hc; /* the HC this device attaches */ 539430SRaymond.Chen@Sun.COM uint8_t wdev_cdid[16]; 549430SRaymond.Chen@Sun.COM uint16_t wdev_addr; 559430SRaymond.Chen@Sun.COM uint16_t wdev_state; 569430SRaymond.Chen@Sun.COM uint8_t wdev_is_newconn; 579430SRaymond.Chen@Sun.COM uint8_t wdev_beacon_attr; 589430SRaymond.Chen@Sun.COM usb_pipe_handle_t wdev_ph; /* used before authenticated */ 599430SRaymond.Chen@Sun.COM wusb_secrt_data_t wdev_secrt_data; 609430SRaymond.Chen@Sun.COM usb_uwb_cap_descr_t *wdev_uwb_descr; 619430SRaymond.Chen@Sun.COM wusb_cc_t *wdev_cc; 629430SRaymond.Chen@Sun.COM uint8_t wdev_ptk[16]; 639430SRaymond.Chen@Sun.COM uint8_t wdev_tkid[3]; 649430SRaymond.Chen@Sun.COM timeout_id_t wdev_trust_timer; /* TrustTimeout timer */ 659430SRaymond.Chen@Sun.COM uint8_t wdev_active; 669430SRaymond.Chen@Sun.COM } wusb_dev_info_t; 679430SRaymond.Chen@Sun.COM 689430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_dev_info::wdev_addr)) 699430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_dev_info::wdev_uwb_descr)) 709430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_dev_info::wdev_hc)) 71*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_dev_info::wdev_secrt_data)) 729430SRaymond.Chen@Sun.COM 739430SRaymond.Chen@Sun.COM /* 749430SRaymond.Chen@Sun.COM * According to WUSB 1.0 spec, WUSB hosts can support up to 127 devices. 759430SRaymond.Chen@Sun.COM * To comply with USB bus convention that bus address 1 is assigned 769430SRaymond.Chen@Sun.COM * to the host controller device, the addresses assigned to WUSB devices 779430SRaymond.Chen@Sun.COM * would start from 2. So the max device number is reduced to 126. 789430SRaymond.Chen@Sun.COM */ 799430SRaymond.Chen@Sun.COM #define WUSB_MAX_PORTS 126 809430SRaymond.Chen@Sun.COM 819430SRaymond.Chen@Sun.COM #define WUSB_CHILD_ZAP 0x1 829430SRaymond.Chen@Sun.COM 839430SRaymond.Chen@Sun.COM typedef struct wusb_hc_data { 849430SRaymond.Chen@Sun.COM dev_info_t *hc_dip; 859430SRaymond.Chen@Sun.COM void *hc_private_data; 869430SRaymond.Chen@Sun.COM uint8_t hc_chid[16]; 879430SRaymond.Chen@Sun.COM uint8_t hc_cluster_id; 889430SRaymond.Chen@Sun.COM uint8_t hc_num_mmcies; 899430SRaymond.Chen@Sun.COM kmutex_t hc_mutex; 909430SRaymond.Chen@Sun.COM wusb_ie_header_t **hc_mmcie_list; 919430SRaymond.Chen@Sun.COM 929430SRaymond.Chen@Sun.COM boolean_t hc_newcon_enabled; 939430SRaymond.Chen@Sun.COM 949430SRaymond.Chen@Sun.COM /* save the often used IEs so as not to allocate them each time */ 959430SRaymond.Chen@Sun.COM wusb_ie_keepalive_t hc_alive_ie; 969430SRaymond.Chen@Sun.COM 979430SRaymond.Chen@Sun.COM /* children info structures */ 989430SRaymond.Chen@Sun.COM uint8_t hc_num_ports; 999430SRaymond.Chen@Sun.COM wusb_dev_info_t **hc_dev_infos; 1009430SRaymond.Chen@Sun.COM dev_info_t **hc_children_dips; 1019430SRaymond.Chen@Sun.COM size_t hc_cd_list_length; 1029430SRaymond.Chen@Sun.COM usba_device_t **hc_usba_devices; 1039430SRaymond.Chen@Sun.COM 1049430SRaymond.Chen@Sun.COM /* for bus unconfig */ 1059430SRaymond.Chen@Sun.COM uint8_t hc_children_state[WUSB_MAX_PORTS + 1]; 1069430SRaymond.Chen@Sun.COM 1079430SRaymond.Chen@Sun.COM /* child connection functions */ 1089430SRaymond.Chen@Sun.COM void (*disconnect_dev)(dev_info_t *, usb_port_t); 1099430SRaymond.Chen@Sun.COM void (*reconnect_dev)(dev_info_t *, usb_port_t); 1109430SRaymond.Chen@Sun.COM int (*create_child)(dev_info_t *, usb_port_t); 1119430SRaymond.Chen@Sun.COM int (*destroy_child)(dev_info_t *, usb_port_t); 1129430SRaymond.Chen@Sun.COM 1139430SRaymond.Chen@Sun.COM /* 1149430SRaymond.Chen@Sun.COM * some necessary host functions: 1159430SRaymond.Chen@Sun.COM * Both HWA and HCI must implement these entries to support basic 1169430SRaymond.Chen@Sun.COM * host controller operations. 1179430SRaymond.Chen@Sun.COM */ 1189430SRaymond.Chen@Sun.COM int (*set_encrypt)(dev_info_t *, usb_port_t, uint8_t); 1199430SRaymond.Chen@Sun.COM int (*set_ptk)(dev_info_t *, usb_key_descr_t *, size_t, usb_port_t); 1209430SRaymond.Chen@Sun.COM int (*set_gtk)(dev_info_t *, usb_key_descr_t *, size_t); 1219430SRaymond.Chen@Sun.COM int (*set_device_info)(dev_info_t *, wusb_dev_info_t *, usb_port_t); 1229430SRaymond.Chen@Sun.COM int (*set_cluster_id) (dev_info_t *, uint8_t id); 1239430SRaymond.Chen@Sun.COM int (*set_stream_idx) (dev_info_t *, uint8_t idx); 1249430SRaymond.Chen@Sun.COM int (*set_wusb_mas) (dev_info_t *, uint8_t *data); 1259430SRaymond.Chen@Sun.COM int (*add_mmc_ie) (dev_info_t *, uint8_t interval, uint8_t rcnt, 1269430SRaymond.Chen@Sun.COM uint8_t iehdl, uint16_t len, uint8_t *data); 1279430SRaymond.Chen@Sun.COM int (*rem_mmc_ie) (dev_info_t *, uint8_t iehdl); 1289430SRaymond.Chen@Sun.COM int (*stop_ch) (dev_info_t *, uint32_t time); 1299430SRaymond.Chen@Sun.COM int (*set_num_dnts) (dev_info_t *, uint8_t interval, uint8_t nslot); 1309430SRaymond.Chen@Sun.COM int (*get_time) (dev_info_t *, uint8_t timetype, 1319430SRaymond.Chen@Sun.COM uint16_t timelen, uint32_t *time); 1329430SRaymond.Chen@Sun.COM 1339430SRaymond.Chen@Sun.COM /* host addr in MAC layer */ 1349430SRaymond.Chen@Sun.COM uint16_t hc_addr; 1359430SRaymond.Chen@Sun.COM 1369430SRaymond.Chen@Sun.COM /* beaconing channel */ 1379430SRaymond.Chen@Sun.COM uint8_t hc_channel; 1389430SRaymond.Chen@Sun.COM 1399430SRaymond.Chen@Sun.COM /* reserved MASes. bitmaps */ 1409430SRaymond.Chen@Sun.COM uint8_t hc_mas[WUSB_SET_WUSB_MAS_LEN]; 1419430SRaymond.Chen@Sun.COM 1429430SRaymond.Chen@Sun.COM /* connection context list for the host */ 1439430SRaymond.Chen@Sun.COM wusb_hc_cc_list_t *hc_cc_list; 1449430SRaymond.Chen@Sun.COM 1459430SRaymond.Chen@Sun.COM /* group temporal key */ 1469430SRaymond.Chen@Sun.COM usb_key_descr_t hc_gtk; 1479430SRaymond.Chen@Sun.COM uint8_t hc_gtk_padding[15]; 1489430SRaymond.Chen@Sun.COM } wusb_hc_data_t; 1499430SRaymond.Chen@Sun.COM 1509430SRaymond.Chen@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(wusb_hc_data_t::hc_mutex, wusb_dev_info_t)) 1519430SRaymond.Chen@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(wusb_hc_data_t::hc_mutex, wusb_hc_data_t)) 1529430SRaymond.Chen@Sun.COM 1539430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::hc_num_ports)) 154*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::hc_num_mmcies)) 1559430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::hc_dip)) 156*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::hc_gtk)) 157*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::add_mmc_ie)) 158*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::rem_mmc_ie)) 159*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_cluster_id)) 160*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_encrypt)) 161*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_gtk)) 162*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_ptk)) 163*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_num_dnts)) 164*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_stream_idx)) 165*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::set_wusb_mas)) 166*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::stop_ch)) 167*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::create_child)) 168*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::destroy_child)) 169*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::disconnect_dev)) 170*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::reconnect_dev)) 171*9797SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_hc_data_t::get_time)) 1729430SRaymond.Chen@Sun.COM 173*9797SRaymond.Chen@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("local use only", 174*9797SRaymond.Chen@Sun.COM wusb_ie_host_disconnect::bLength)) 175*9797SRaymond.Chen@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("local use only", 176*9797SRaymond.Chen@Sun.COM wusb_ie_host_disconnect::bIEIdentifier)) 177*9797SRaymond.Chen@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("local use only", 178*9797SRaymond.Chen@Sun.COM wusb_ccm_nonce::sfn)) 1799430SRaymond.Chen@Sun.COM /* 1809430SRaymond.Chen@Sun.COM * WUSB 1.0 4.3.8.5 says the range of cluster id is in 0x80-0xfe, 1819430SRaymond.Chen@Sun.COM * we limit the maximum WUSB host controller numbers to 31 now, 1829430SRaymond.Chen@Sun.COM * and take the upper portion of this range as the broadcast 1839430SRaymond.Chen@Sun.COM * cluster id 1849430SRaymond.Chen@Sun.COM */ 1859430SRaymond.Chen@Sun.COM #define WUSB_CLUSTER_ID_COUNT 31 1869430SRaymond.Chen@Sun.COM #define WUSB_MIN_CLUSTER_ID 0xe0 1879430SRaymond.Chen@Sun.COM 1889430SRaymond.Chen@Sun.COM #define WUSB_TRUST_TIMEOUT 4 /* WUSB 4.15.1 TrustTimeout = 4s */ 1899430SRaymond.Chen@Sun.COM #define WUSB_TRUST_TIMEOUT_US WUSB_TRUST_TIMEOUT * MICROSEC 1909430SRaymond.Chen@Sun.COM 1919430SRaymond.Chen@Sun.COM #define WUSB_PERIODIC_ENDPOINT(endpoint) (((endpoint->bmAttributes & \ 1929430SRaymond.Chen@Sun.COM USB_EP_ATTR_MASK) == USB_EP_ATTR_INTR) ||\ 1939430SRaymond.Chen@Sun.COM ((endpoint->bmAttributes &\ 1949430SRaymond.Chen@Sun.COM USB_EP_ATTR_MASK) == USB_EP_ATTR_ISOCH)) 1959430SRaymond.Chen@Sun.COM 1969430SRaymond.Chen@Sun.COM #define WUSB_ISOC_ENDPOINT(endpoint) (((endpoint->bmAttributes &\ 1979430SRaymond.Chen@Sun.COM USB_EP_ATTR_MASK) == USB_EP_ATTR_ISOCH)) 1989430SRaymond.Chen@Sun.COM 1999430SRaymond.Chen@Sun.COM #define WUSB_INTR_ENDPOINT(endpoint) (((endpoint->bmAttributes &\ 2009430SRaymond.Chen@Sun.COM USB_EP_ATTR_MASK) == USB_EP_ATTR_INTR)) 2019430SRaymond.Chen@Sun.COM 2029430SRaymond.Chen@Sun.COM /* helper functions */ 2039430SRaymond.Chen@Sun.COM uint8_t wusb_hc_get_cluster_id(); 2049430SRaymond.Chen@Sun.COM void wusb_hc_free_cluster_id(uint8_t id); 2059430SRaymond.Chen@Sun.COM int wusb_hc_get_iehdl(wusb_hc_data_t *hc_data, wusb_ie_header_t *hdr, 2069430SRaymond.Chen@Sun.COM uint8_t *iehdl); 2079430SRaymond.Chen@Sun.COM void wusb_hc_free_iehdl(wusb_hc_data_t *hc_data, uint8_t iehdl); 2089430SRaymond.Chen@Sun.COM 2099430SRaymond.Chen@Sun.COM uint_t wusb_hc_is_dev_connected(wusb_hc_data_t *hc_data, uint8_t *cdid, 2109430SRaymond.Chen@Sun.COM usb_port_t *port); 2119430SRaymond.Chen@Sun.COM uint_t wusb_hc_is_addr_valid(wusb_hc_data_t *hc_data, uint8_t addr, 2129430SRaymond.Chen@Sun.COM usb_port_t *port); 2139430SRaymond.Chen@Sun.COM usb_port_t wusb_hc_get_free_port(wusb_hc_data_t *hc_data); 2149430SRaymond.Chen@Sun.COM 2159430SRaymond.Chen@Sun.COM /* device notification support */ 2169430SRaymond.Chen@Sun.COM int wusb_hc_ack_conn(wusb_hc_data_t *hc_data, usb_port_t port); 2179430SRaymond.Chen@Sun.COM int wusb_hc_ack_disconn(wusb_hc_data_t *hc_data, uint8_t addr); 2189430SRaymond.Chen@Sun.COM void wusb_hc_rm_ack(wusb_hc_data_t *hc_data); 2199430SRaymond.Chen@Sun.COM int wusb_hc_send_keepalive_ie(wusb_hc_data_t *hc_data, uint8_t addr); 2209430SRaymond.Chen@Sun.COM int wusb_hc_auth_dev(wusb_hc_data_t *hc_data, usb_port_t port, 2219430SRaymond.Chen@Sun.COM usb_pipe_handle_t ph, uint8_t ifc, wusb_secrt_data_t *secrt_data); 2229430SRaymond.Chen@Sun.COM int wusb_hc_handle_port_connect(wusb_hc_data_t *hc_data, usb_port_t port, 2239430SRaymond.Chen@Sun.COM usb_pipe_handle_t ph, uint8_t ifc, wusb_secrt_data_t *secrt_data); 2249430SRaymond.Chen@Sun.COM void wusb_hc_handle_dn_connect(wusb_hc_data_t *hc_data, 2259430SRaymond.Chen@Sun.COM usb_pipe_handle_t ph, uint8_t ifc, uint8_t *data, size_t len, 2269430SRaymond.Chen@Sun.COM wusb_secrt_data_t *secrt_data); 2279430SRaymond.Chen@Sun.COM void wusb_hc_handle_dn_disconnect(wusb_hc_data_t *hc_data, uint8_t addr, 2289430SRaymond.Chen@Sun.COM uint8_t *data, size_t len); 2299430SRaymond.Chen@Sun.COM 2309430SRaymond.Chen@Sun.COM /* wusb common device function */ 2319430SRaymond.Chen@Sun.COM int wusb_create_child_devi(dev_info_t *dip, char *node_name, 2329430SRaymond.Chen@Sun.COM usba_hcdi_ops_t *usba_hcdi_ops, dev_info_t *usb_root_hub_dip, 2339430SRaymond.Chen@Sun.COM usb_port_status_t port_status, usba_device_t *usba_device, 2349430SRaymond.Chen@Sun.COM dev_info_t **child_dip); 2359430SRaymond.Chen@Sun.COM int wusb_get_dev_security_descr(usb_pipe_handle_t ph, 2369430SRaymond.Chen@Sun.COM wusb_secrt_data_t *secrt_data); 2379430SRaymond.Chen@Sun.COM int wusb_get_bos_cloud(dev_info_t *child_dip, usba_device_t *child_ud); 2389430SRaymond.Chen@Sun.COM int wusb_get_rc_dev_by_hc(dev_info_t *dip, dev_t *dev); 2399430SRaymond.Chen@Sun.COM 2409430SRaymond.Chen@Sun.COM int16_t wusb_get_ccm_encryption_value(wusb_secrt_data_t *secrt_data); 2419430SRaymond.Chen@Sun.COM 2429430SRaymond.Chen@Sun.COM /* device dynamical configuration functions */ 2439430SRaymond.Chen@Sun.COM void wusb_hc_disconnect_dev(wusb_hc_data_t *hc_data, usb_port_t port); 2449430SRaymond.Chen@Sun.COM void wusb_hc_reconnect_dev(wusb_hc_data_t *hc_data, usb_port_t port); 2459430SRaymond.Chen@Sun.COM int wusb_hc_create_child(wusb_hc_data_t *hc_data, usb_port_t port); 2469430SRaymond.Chen@Sun.COM int wusb_hc_destroy_child(wusb_hc_data_t *hc_data, usb_port_t port); 2479430SRaymond.Chen@Sun.COM 2489430SRaymond.Chen@Sun.COM /* WUSB HC common requests */ 2499430SRaymond.Chen@Sun.COM int wusb_hc_set_cluster_id(wusb_hc_data_t *hc_data, uint8_t cluster_id); 2509430SRaymond.Chen@Sun.COM 2519430SRaymond.Chen@Sun.COM int wusb_hc_set_stream_idx(wusb_hc_data_t *hc_data, uint8_t stream_idx); 2529430SRaymond.Chen@Sun.COM 2539430SRaymond.Chen@Sun.COM int wusb_hc_set_wusb_mas(wusb_hc_data_t *hc_data, uint8_t *data); 2549430SRaymond.Chen@Sun.COM 2559430SRaymond.Chen@Sun.COM int wusb_hc_add_mmc_ie(wusb_hc_data_t *hc_data, uint8_t interval, 2569430SRaymond.Chen@Sun.COM uint8_t rcnt, uint8_t iehdl, uint16_t len, uint8_t *data); 2579430SRaymond.Chen@Sun.COM 2589430SRaymond.Chen@Sun.COM int wusb_hc_remove_mmc_ie(wusb_hc_data_t *hc_data, uint8_t iehdl); 2599430SRaymond.Chen@Sun.COM void wusb_hc_rem_ie(wusb_hc_data_t *hc_data, wusb_ie_header_t *ieh); 2609430SRaymond.Chen@Sun.COM 2619430SRaymond.Chen@Sun.COM int wusb_hc_stop_ch(wusb_hc_data_t *hc_data, uint32_t timeoff); 2629430SRaymond.Chen@Sun.COM 2639430SRaymond.Chen@Sun.COM int wusb_hc_set_num_dnts(wusb_hc_data_t *hc_data, uint8_t interval, 2649430SRaymond.Chen@Sun.COM uint8_t nslots); 2659430SRaymond.Chen@Sun.COM 2669430SRaymond.Chen@Sun.COM int wusb_hc_get_time(wusb_hc_data_t *hc_data, uint8_t time_type, 2679430SRaymond.Chen@Sun.COM uint16_t len, uint32_t *time); 2689430SRaymond.Chen@Sun.COM 2699430SRaymond.Chen@Sun.COM int wusb_hc_add_host_info(wusb_hc_data_t *hc_data, uint8_t stream_idx); 2709430SRaymond.Chen@Sun.COM 2719430SRaymond.Chen@Sun.COM void wusb_hc_rem_host_info(wusb_hc_data_t *hc_data); 2729430SRaymond.Chen@Sun.COM 2739430SRaymond.Chen@Sun.COM int wusb_hc_send_host_disconnect(wusb_hc_data_t *hc_data); 2749430SRaymond.Chen@Sun.COM 2759430SRaymond.Chen@Sun.COM int wusb_hc_set_device_info(wusb_hc_data_t *hc_data, usb_port_t port); 2769430SRaymond.Chen@Sun.COM 2779430SRaymond.Chen@Sun.COM /* WUSB HC connection context list operations */ 2789430SRaymond.Chen@Sun.COM void wusb_hc_add_cc(wusb_hc_cc_list_t **cc_list, wusb_hc_cc_list_t *new_cc); 2799430SRaymond.Chen@Sun.COM void wusb_hc_rem_cc(wusb_hc_cc_list_t **cc_list, wusb_cc_t *old_cc); 2809430SRaymond.Chen@Sun.COM void wusb_hc_free_cc_list(wusb_hc_cc_list_t *cc_list); 2819430SRaymond.Chen@Sun.COM wusb_cc_t *wusb_hc_cc_matched(wusb_hc_cc_list_t *cc_list, uint8_t *cdid); 2829430SRaymond.Chen@Sun.COM 2839430SRaymond.Chen@Sun.COM /* security functions */ 2849430SRaymond.Chen@Sun.COM int wusb_dev_set_encrypt(usb_pipe_handle_t ph, uint8_t value); 285*9797SRaymond.Chen@Sun.COM int wusb_enable_dev_encrypt(wusb_hc_data_t *hc, wusb_dev_info_t *dev_info); 2869430SRaymond.Chen@Sun.COM int wusb_dev_set_key(usb_pipe_handle_t ph, uint8_t key_index, 2879430SRaymond.Chen@Sun.COM usb_key_descr_t *key, size_t klen); 2889430SRaymond.Chen@Sun.COM int wusb_hc_set_encrypt(wusb_hc_data_t *hc_data, usb_port_t port, 2899430SRaymond.Chen@Sun.COM uint8_t type); 2909430SRaymond.Chen@Sun.COM int wusb_hc_set_ptk(wusb_hc_data_t *hc_data, uint8_t *key_data, 2919430SRaymond.Chen@Sun.COM usb_port_t port); 2929430SRaymond.Chen@Sun.COM int wusb_hc_set_gtk(wusb_hc_data_t *hc_data, uint8_t *key_data, 2939430SRaymond.Chen@Sun.COM uint8_t *tkid); 2949430SRaymond.Chen@Sun.COM 2959430SRaymond.Chen@Sun.COM /* crypto functions */ 2969430SRaymond.Chen@Sun.COM int PRF(const uchar_t *key, size_t klen, wusb_ccm_nonce_t *nonce, 2979430SRaymond.Chen@Sun.COM const uchar_t *adata, size_t alen, 2989430SRaymond.Chen@Sun.COM const uchar_t *bdata, size_t blen, 2999430SRaymond.Chen@Sun.COM uchar_t *out, size_t bitlen); 3009430SRaymond.Chen@Sun.COM 3019430SRaymond.Chen@Sun.COM #define PRF_64(key, klen, nonce, adata, alen, bdata, blen, out) \ 3029430SRaymond.Chen@Sun.COM PRF(key, klen, nonce, adata, alen, bdata, blen, out, 64) 3039430SRaymond.Chen@Sun.COM 3049430SRaymond.Chen@Sun.COM #define PRF_128(key, klen, nonce, adata, alen, bdata, blen, out) \ 3059430SRaymond.Chen@Sun.COM PRF(key, klen, nonce, adata, alen, bdata, blen, out, 128) 3069430SRaymond.Chen@Sun.COM 3079430SRaymond.Chen@Sun.COM #define PRF_256(key, klen, nonce, adata, alen, bdata, blen, out) \ 3089430SRaymond.Chen@Sun.COM PRF(key, klen, nonce, adata, alen, bdata, blen, out, 256) 3099430SRaymond.Chen@Sun.COM 3109430SRaymond.Chen@Sun.COM int wusb_gen_random_nonce(wusb_hc_data_t *hc_data, 3119430SRaymond.Chen@Sun.COM wusb_dev_info_t *dev_info, uchar_t *rbuf); 3129430SRaymond.Chen@Sun.COM 3139430SRaymond.Chen@Sun.COM int wusb_4way_handshake(wusb_hc_data_t *hc_data, usb_port_t port, 3149430SRaymond.Chen@Sun.COM usb_pipe_handle_t ph, uint8_t ifc); 3159430SRaymond.Chen@Sun.COM 3169430SRaymond.Chen@Sun.COM #ifdef __cplusplus 3179430SRaymond.Chen@Sun.COM } 3189430SRaymond.Chen@Sun.COM #endif 3199430SRaymond.Chen@Sun.COM 3209430SRaymond.Chen@Sun.COM #endif /* _SYS_USB_WHCDI_H */ 321