17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 528cdc3d7Sszhou * Common Development and Distribution License (the "License"). 628cdc3d7Sszhou * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*269552cdSguoqing zhu - Sun Microsystems - Beijing China * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HCDI_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_HCDI_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/usb/usba/genconsole.h> 357c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usba_types.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate /* 387c478bd9Sstevel@tonic-gate * HCD ops structure 397c478bd9Sstevel@tonic-gate * 407c478bd9Sstevel@tonic-gate * - this structure defines all entry points into HCD 417c478bd9Sstevel@tonic-gate * 427c478bd9Sstevel@tonic-gate * - all client driver USBAI functions that require HCD 437c478bd9Sstevel@tonic-gate * involvement go through this ops table 447c478bd9Sstevel@tonic-gate * 457c478bd9Sstevel@tonic-gate * - at HCD attach time, the HCD ops are passed to 467c478bd9Sstevel@tonic-gate * to the USBA through usba_hcdi_attach() 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * some of these ops implement the semantics of the corresponding 497c478bd9Sstevel@tonic-gate * USBAI interfaces. Refer to usbai.h for detailed description 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate #define HCDI_OPS_VERSION_0 0 5228cdc3d7Sszhou #define HCDI_OPS_VERSION_1 1 5328cdc3d7Sszhou #define HCDI_OPS_VERSION HCDI_OPS_VERSION_1 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate typedef struct usba_hcdi_ops { 567c478bd9Sstevel@tonic-gate int usba_hcdi_ops_version; /* implementation version */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate dev_info_t *usba_hcdi_dip; /* HCD's devinfo ptr */ 597c478bd9Sstevel@tonic-gate 604610e4a0Sfrits /* can this hcd support pm? */ 614610e4a0Sfrits int (*usba_hcdi_pm_support)(dev_info_t *dip); 624610e4a0Sfrits 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * usba_hcdi_pipe_open: 657c478bd9Sstevel@tonic-gate * implements the semantics of usb_pipe_open() 667c478bd9Sstevel@tonic-gate * USBA allocate the pipe_handle which contains 677c478bd9Sstevel@tonic-gate * pipe_policy and endpoint pointers 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_open)( 707c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 717c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 747c478bd9Sstevel@tonic-gate * close a pipe 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_close)( 777c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 787c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate /* 817c478bd9Sstevel@tonic-gate * pipe management 827c478bd9Sstevel@tonic-gate */ 837c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_reset)( 847c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 857c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* 88*269552cdSguoqing zhu - Sun Microsystems - Beijing China * pipe management 89*269552cdSguoqing zhu - Sun Microsystems - Beijing China */ 90*269552cdSguoqing zhu - Sun Microsystems - Beijing China void (*usba_hcdi_pipe_reset_data_toggle)( 91*269552cdSguoqing zhu - Sun Microsystems - Beijing China usba_pipe_handle_data_t *pipe_handle); 92*269552cdSguoqing zhu - Sun Microsystems - Beijing China 93*269552cdSguoqing zhu - Sun Microsystems - Beijing China /* 947c478bd9Sstevel@tonic-gate * data transfer management 957c478bd9Sstevel@tonic-gate */ 967c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_ctrl_xfer)( 977c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 987c478bd9Sstevel@tonic-gate usb_ctrl_req_t *usb_ctrl_req, 997c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate /* 1027c478bd9Sstevel@tonic-gate * get HCD limitation on bulk xfer at a time? 1037c478bd9Sstevel@tonic-gate */ 1047c478bd9Sstevel@tonic-gate int (*usba_hcdi_bulk_transfer_size)( 1057c478bd9Sstevel@tonic-gate usba_device_t *usba_device, 1067c478bd9Sstevel@tonic-gate size_t *size); 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * do bulk read/write 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_bulk_xfer)( 1127c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1137c478bd9Sstevel@tonic-gate usb_bulk_req_t *usb_bulk_req, 1147c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * do interrupt pipe read/write 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_intr_xfer)( 1207c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1217c478bd9Sstevel@tonic-gate usb_intr_req_t *usb_intr_req, 1227c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* 1257c478bd9Sstevel@tonic-gate * stop interrupt pipe polling 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_stop_intr_polling)( 1287c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1297c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * do isoch pipe read/write 1337c478bd9Sstevel@tonic-gate */ 1347c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_isoc_xfer)( 1357c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1367c478bd9Sstevel@tonic-gate usb_isoc_req_t *usb_isoc_req, 1377c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate /* 1407c478bd9Sstevel@tonic-gate * stop isoc pipe polling 1417c478bd9Sstevel@tonic-gate */ 1427c478bd9Sstevel@tonic-gate int (*usba_hcdi_pipe_stop_isoc_polling)( 1437c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1447c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate /* utility isoc functions */ 147fffe0b30Sqz150045 int (*usba_hcdi_get_current_frame_number)( 148fffe0b30Sqz150045 usba_device_t *usba_device, 149fffe0b30Sqz150045 usb_frame_number_t *frame_number); 1507c478bd9Sstevel@tonic-gate 151fffe0b30Sqz150045 int (*usba_hcdi_get_max_isoc_pkts)( 152fffe0b30Sqz150045 usba_device_t *usba_device, 153fffe0b30Sqz150045 uint_t *max_isoc_pkts_per_request); 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Initialize OBP support for input 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate int (*usba_hcdi_console_input_init)( 1597c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *pipe_handle, 1607c478bd9Sstevel@tonic-gate uchar_t **obp_buf, 1617c478bd9Sstevel@tonic-gate usb_console_info_impl_t *console_input_info); 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate /* 1647c478bd9Sstevel@tonic-gate * Free resources allocated by usba_hcdi_console_input_init 1657c478bd9Sstevel@tonic-gate */ 1667c478bd9Sstevel@tonic-gate int (*usba_hcdi_console_input_fini)( 1677c478bd9Sstevel@tonic-gate usb_console_info_impl_t *console_input_info); 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /* 1707c478bd9Sstevel@tonic-gate * Save controller state information 1717c478bd9Sstevel@tonic-gate */ 1727c478bd9Sstevel@tonic-gate int (*usba_hcdi_console_input_enter)( 1737c478bd9Sstevel@tonic-gate usb_console_info_impl_t *console_input_info); 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate /* 1767c478bd9Sstevel@tonic-gate * Read character from controller 1777c478bd9Sstevel@tonic-gate */ 1787c478bd9Sstevel@tonic-gate int (*usba_hcdi_console_read)( 1797c478bd9Sstevel@tonic-gate usb_console_info_impl_t *console_input_info, 1807c478bd9Sstevel@tonic-gate uint_t *num_characters); 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * Restore controller state information 1847c478bd9Sstevel@tonic-gate */ 1857c478bd9Sstevel@tonic-gate int (*usba_hcdi_console_input_exit)( 1867c478bd9Sstevel@tonic-gate usb_console_info_impl_t *console_input_info); 18728cdc3d7Sszhou 18828cdc3d7Sszhou 18928cdc3d7Sszhou /* 19028cdc3d7Sszhou * VERSION 1 ops: support for polled output 19128cdc3d7Sszhou */ 19228cdc3d7Sszhou int (*usba_hcdi_console_output_init)( 19328cdc3d7Sszhou usba_pipe_handle_data_t *pipe_handle, 19428cdc3d7Sszhou usb_console_info_impl_t *console_output_info); 19528cdc3d7Sszhou 19628cdc3d7Sszhou int (*usba_hcdi_console_output_fini)( 19728cdc3d7Sszhou usb_console_info_impl_t *console_output_info); 19828cdc3d7Sszhou 19928cdc3d7Sszhou int (*usba_hcdi_console_output_enter)( 20028cdc3d7Sszhou usb_console_info_impl_t *console_output_info); 20128cdc3d7Sszhou 20228cdc3d7Sszhou int (*usba_hcdi_console_write)( 20328cdc3d7Sszhou usb_console_info_impl_t *console_output_info, 20428cdc3d7Sszhou uchar_t *buf, 20528cdc3d7Sszhou uint_t num_characters, 20628cdc3d7Sszhou uint_t *num_characters_written); 20728cdc3d7Sszhou 20828cdc3d7Sszhou int (*usba_hcdi_console_output_exit)( 20928cdc3d7Sszhou usb_console_info_impl_t *console_output_info); 2107c478bd9Sstevel@tonic-gate } usba_hcdi_ops_t; 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate /* 2147c478bd9Sstevel@tonic-gate * callback support: 2157c478bd9Sstevel@tonic-gate * this function handles all HCD callbacks as follows: 2167c478bd9Sstevel@tonic-gate * - USB_FLAGS_SLEEP determines whether the client driver made 2177c478bd9Sstevel@tonic-gate * a synchronous or asynchronous USBAI call 2187c478bd9Sstevel@tonic-gate * - for synchronous calls, the args are copied into the pipe handle 2197c478bd9Sstevel@tonic-gate * and the sync cv of the pipe handle is signalled 2207c478bd9Sstevel@tonic-gate * - for async calls and completion_reason = 0, the normal callback 2217c478bd9Sstevel@tonic-gate * is invoked 2227c478bd9Sstevel@tonic-gate * - for async calls and completion_reason != 0, the exception 2237c478bd9Sstevel@tonic-gate * callback is invoked 2247c478bd9Sstevel@tonic-gate */ 2257c478bd9Sstevel@tonic-gate void 2267c478bd9Sstevel@tonic-gate usba_hcdi_cb(usba_pipe_handle_data_t *ph, 2277c478bd9Sstevel@tonic-gate usb_opaque_t req, 2287c478bd9Sstevel@tonic-gate usb_cr_t completion_reason); 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* 2317c478bd9Sstevel@tonic-gate * function to duplicate a interrupt/isoc request (for HCD) 2327c478bd9Sstevel@tonic-gate */ 2337c478bd9Sstevel@tonic-gate usb_intr_req_t *usba_hcdi_dup_intr_req(dev_info_t *, 2347c478bd9Sstevel@tonic-gate usb_intr_req_t *, size_t, usb_flags_t); 2357c478bd9Sstevel@tonic-gate usb_isoc_req_t *usba_hcdi_dup_isoc_req(dev_info_t *, 2367c478bd9Sstevel@tonic-gate usb_isoc_req_t *, usb_flags_t); 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate /* access to private member of requests */ 2397c478bd9Sstevel@tonic-gate usb_opaque_t usba_hcdi_get_req_private(usb_opaque_t); 2407c478bd9Sstevel@tonic-gate void usba_hcdi_set_req_private(usb_opaque_t, usb_opaque_t); 2417c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t * 2427c478bd9Sstevel@tonic-gate usba_hcdi_get_ph_data(usba_device_t *, uint8_t); 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate /* data toggle get and set */ 2457c478bd9Sstevel@tonic-gate uchar_t usba_hcdi_get_data_toggle(usba_device_t *, uint8_t); 2467c478bd9Sstevel@tonic-gate void usba_hcdi_set_data_toggle(usba_device_t *, uint8_t, uchar_t); 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate /* 2497c478bd9Sstevel@tonic-gate * HCD Nexus driver support: 2507c478bd9Sstevel@tonic-gate */ 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate /* 2537c478bd9Sstevel@tonic-gate * hcd_ops allocator/deallocator 2547c478bd9Sstevel@tonic-gate * USBA allocates the usba_hcdi_ops so we can easily handle 2557c478bd9Sstevel@tonic-gate * versioning 2567c478bd9Sstevel@tonic-gate */ 2577c478bd9Sstevel@tonic-gate usba_hcdi_ops_t *usba_alloc_hcdi_ops(); 2587c478bd9Sstevel@tonic-gate void usba_free_hcdi_ops(usba_hcdi_ops_t *); 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate /* 2617c478bd9Sstevel@tonic-gate * Argument structure for usba_hcdi_register 2627c478bd9Sstevel@tonic-gate */ 2637c478bd9Sstevel@tonic-gate typedef struct usba_hcdi_register_args { 2647c478bd9Sstevel@tonic-gate uint_t usba_hcdi_register_version; 2657c478bd9Sstevel@tonic-gate dev_info_t *usba_hcdi_register_dip; 2667c478bd9Sstevel@tonic-gate usba_hcdi_ops_t *usba_hcdi_register_ops; 2677c478bd9Sstevel@tonic-gate ddi_dma_attr_t *usba_hcdi_register_dma_attr; 2687c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t usba_hcdi_register_iblock_cookie; 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate } usba_hcdi_register_args_t; 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate #define HCDI_REGISTER_VERS_0 0 2737c478bd9Sstevel@tonic-gate #define HCDI_REGISTER_VERSION HCDI_REGISTER_VERS_0 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate /* 2777c478bd9Sstevel@tonic-gate * make this instance known to USBA 2787c478bd9Sstevel@tonic-gate * 2797c478bd9Sstevel@tonic-gate * the HCD must initialize the hcdi_ops before calling this function 2807c478bd9Sstevel@tonic-gate */ 2817c478bd9Sstevel@tonic-gate int usba_hcdi_register(usba_hcdi_register_args_t *, uint_t); 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gate /* 2847c478bd9Sstevel@tonic-gate * detach support 2857c478bd9Sstevel@tonic-gate */ 2867c478bd9Sstevel@tonic-gate void usba_hcdi_unregister(dev_info_t *); 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate /* 2897c478bd9Sstevel@tonic-gate * Hotplug kstats named structure 2907c478bd9Sstevel@tonic-gate * 2917c478bd9Sstevel@tonic-gate * Number of types of USB transfers 2927c478bd9Sstevel@tonic-gate */ 2937c478bd9Sstevel@tonic-gate #define USB_N_COUNT_KSTATS 4 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate typedef struct hcdi_hotplug_stats { 2967c478bd9Sstevel@tonic-gate struct kstat_named hcdi_hotplug_total_success; 2977c478bd9Sstevel@tonic-gate struct kstat_named hcdi_hotplug_success; 2987c478bd9Sstevel@tonic-gate struct kstat_named hcdi_hotplug_total_failure; 2997c478bd9Sstevel@tonic-gate struct kstat_named hcdi_hotplug_failure; 3007c478bd9Sstevel@tonic-gate struct kstat_named hcdi_device_count; 3017c478bd9Sstevel@tonic-gate } hcdi_hotplug_stats_t; 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* 3047c478bd9Sstevel@tonic-gate * USB error kstats named structure 3057c478bd9Sstevel@tonic-gate */ 3067c478bd9Sstevel@tonic-gate typedef struct hcdi_error_stats { 3077c478bd9Sstevel@tonic-gate /* transport completion codes */ 3087c478bd9Sstevel@tonic-gate struct kstat_named cc_crc; 3097c478bd9Sstevel@tonic-gate struct kstat_named cc_bitstuffing; 3107c478bd9Sstevel@tonic-gate struct kstat_named cc_data_toggle_mm; 3117c478bd9Sstevel@tonic-gate struct kstat_named cc_stall; 3127c478bd9Sstevel@tonic-gate struct kstat_named cc_dev_not_resp; 3137c478bd9Sstevel@tonic-gate struct kstat_named cc_pid_checkfailure; 3147c478bd9Sstevel@tonic-gate struct kstat_named cc_unexp_pid; 3157c478bd9Sstevel@tonic-gate struct kstat_named cc_data_overrun; 3167c478bd9Sstevel@tonic-gate struct kstat_named cc_data_underrun; 3177c478bd9Sstevel@tonic-gate struct kstat_named cc_buffer_overrun; 3187c478bd9Sstevel@tonic-gate struct kstat_named cc_buffer_underrun; 3197c478bd9Sstevel@tonic-gate struct kstat_named cc_timeout; 3207c478bd9Sstevel@tonic-gate struct kstat_named cc_not_accessed; 3217c478bd9Sstevel@tonic-gate struct kstat_named cc_no_resources; 3227c478bd9Sstevel@tonic-gate struct kstat_named cc_unspecified_err; 3237c478bd9Sstevel@tonic-gate struct kstat_named cc_stopped_polling; 3247c478bd9Sstevel@tonic-gate struct kstat_named cc_pipe_closing; 3257c478bd9Sstevel@tonic-gate struct kstat_named cc_pipe_reset; 3267c478bd9Sstevel@tonic-gate struct kstat_named cc_not_supported; 3277c478bd9Sstevel@tonic-gate struct kstat_named cc_flushed; 3287c478bd9Sstevel@tonic-gate } hcdi_error_stats_t; 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate /* 3317c478bd9Sstevel@tonic-gate * hcdi kstat defines 3327c478bd9Sstevel@tonic-gate * XXX this needs to be a function 3337c478bd9Sstevel@tonic-gate */ 3347c478bd9Sstevel@tonic-gate #define HCDI_HOTPLUG_STATS(hcdi) ((hcdi)->hcdi_hotplug_stats) 3357c478bd9Sstevel@tonic-gate #define HCDI_HOTPLUG_STATS_DATA(hcdi) \ 3367c478bd9Sstevel@tonic-gate ((hcdi_hotplug_stats_t *)HCDI_HOTPLUG_STATS((hcdi))->ks_data) 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate #define HCDI_ERROR_STATS(hcdi) ((hcdi)->hcdi_error_stats) 3397c478bd9Sstevel@tonic-gate #define HCDI_ERROR_STATS_DATA(hcdi) \ 3407c478bd9Sstevel@tonic-gate ((hcdi_error_stats_t *)HCDI_ERROR_STATS((hcdi))->ks_data) 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3447c478bd9Sstevel@tonic-gate } 3457c478bd9Sstevel@tonic-gate #endif 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_HCDI_H */ 348