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
5*d29f5a71Szhigang lu - Sun Microsystems - Beijing China  * Common Development and Distribution License (the "License").
6*d29f5a71Szhigang lu - Sun Microsystems - Beijing China  * 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*d29f5a71Szhigang lu - Sun Microsystems - Beijing China  * Copyright 2008 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_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_SYS_USB_HCDI_IMPL_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 /*
357c478bd9Sstevel@tonic-gate  * Per HCD Data Structures
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate typedef  struct usba_hcdi {
387c478bd9Sstevel@tonic-gate 	dev_info_t		*hcdi_dip;	/* ptr to devinfo struct */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate 	ddi_dma_attr_t		*hcdi_dma_attr;
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate 	/*
437c478bd9Sstevel@tonic-gate 	 * list of HCD operations
447c478bd9Sstevel@tonic-gate 	 */
457c478bd9Sstevel@tonic-gate 	struct usba_hcdi_ops	*hcdi_ops;
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate 	int			hcdi_flags;	    /* flag options */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate 	/* soft interrupt support */
507c478bd9Sstevel@tonic-gate 	ddi_softint_handle_t	hcdi_softint_hdl;	/* soft intr handle */
517c478bd9Sstevel@tonic-gate 	usba_list_entry_t	hcdi_cb_queue;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 	/*
547c478bd9Sstevel@tonic-gate 	 * min xfer and min/max burstsizes for DDI_CTLOPS_IOMIN
557c478bd9Sstevel@tonic-gate 	 */
567c478bd9Sstevel@tonic-gate 	uint_t			hcdi_min_xfer;
577c478bd9Sstevel@tonic-gate 	uchar_t			hcdi_min_burst_size;
587c478bd9Sstevel@tonic-gate 	uchar_t			hcdi_max_burst_size;
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate 	/*
617c478bd9Sstevel@tonic-gate 	 * usba_device ptr for root hub
627c478bd9Sstevel@tonic-gate 	 */
637c478bd9Sstevel@tonic-gate 	usba_device_t		*hcdi_usba_device;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate 	/*
667c478bd9Sstevel@tonic-gate 	 * usb bus address allocation
677c478bd9Sstevel@tonic-gate 	 */
687c478bd9Sstevel@tonic-gate 	char		hcdi_usb_address_in_use[USBA_ADDRESS_ARRAY_SIZE];
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate 	usb_log_handle_t	hcdi_log_handle;
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate 	kmutex_t		hcdi_mutex;
737c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	hcdi_iblock_cookie;
747c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	hcdi_soft_iblock_cookie;
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate 	/*
777c478bd9Sstevel@tonic-gate 	 * Hotplug event statistics since hcdi loaded.
787c478bd9Sstevel@tonic-gate 	 */
797c478bd9Sstevel@tonic-gate 	ulong_t			hcdi_total_hotplug_success;
807c478bd9Sstevel@tonic-gate 	ulong_t			hcdi_total_hotplug_failure;
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate 	/*
837c478bd9Sstevel@tonic-gate 	 * Resetable hotplug event statistics.
847c478bd9Sstevel@tonic-gate 	 */
857c478bd9Sstevel@tonic-gate 	ulong_t			hcdi_hotplug_success;
867c478bd9Sstevel@tonic-gate 	ulong_t			hcdi_hotplug_failure;
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate 	/*
897c478bd9Sstevel@tonic-gate 	 * Total number of devices currently enumerated.
907c478bd9Sstevel@tonic-gate 	 */
917c478bd9Sstevel@tonic-gate 	uchar_t			hcdi_device_count;
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 	/*
947c478bd9Sstevel@tonic-gate 	 * kstat structures
957c478bd9Sstevel@tonic-gate 	 */
967c478bd9Sstevel@tonic-gate 	kstat_t			*hcdi_hotplug_stats;
977c478bd9Sstevel@tonic-gate 	kstat_t			*hcdi_error_stats;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate 	/*
1007c478bd9Sstevel@tonic-gate 	 * ugen default binding
1017c478bd9Sstevel@tonic-gate 	 */
1027c478bd9Sstevel@tonic-gate 	uint_t			hcdi_ugen_default_binding;
1037c478bd9Sstevel@tonic-gate } usba_hcdi_t;
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_hcdi::hcdi_mutex,
1067c478bd9Sstevel@tonic-gate 				usba_hcdi::hcdi_usb_address_in_use))
1077c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_usba_device))
1087c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_ugen_default_binding))
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * retrieving the hcdi structure from dip
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate void usba_hcdi_set_hcdi(dev_info_t *dip, usba_hcdi_t *hcdi);
1157c478bd9Sstevel@tonic-gate usba_hcdi_t *usba_hcdi_get_hcdi(dev_info_t *dip);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /* initialize/destroy HCDI info */
1187c478bd9Sstevel@tonic-gate void usba_hcdi_initialization();
1197c478bd9Sstevel@tonic-gate void usba_hcdi_destroy();
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #endif	/* _SYS_USB_HCDI_IMPL_H */
126