17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
5d29f5a7zhigang lu - Sun Microsystems - Beijing China * Common Development and Distribution License (the "License").
6d29f5a7zhigang lu - Sun Microsystems - Beijing China * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate/*
22d29f5a7zhigang lu - Sun Microsystems - Beijing China * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate * Use is subject to license terms.
247c478bdstevel@tonic-gate */
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate#ifndef	_SYS_USB_HCDI_IMPL_H
277c478bdstevel@tonic-gate#define	_SYS_USB_HCDI_IMPL_H
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gate#ifdef	__cplusplus
317c478bdstevel@tonic-gateextern "C" {
327c478bdstevel@tonic-gate#endif
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate/*
357c478bdstevel@tonic-gate * Per HCD Data Structures
367c478bdstevel@tonic-gate */
377c478bdstevel@tonic-gatetypedef  struct usba_hcdi {
387c478bdstevel@tonic-gate	dev_info_t		*hcdi_dip;	/* ptr to devinfo struct */
397c478bdstevel@tonic-gate
407c478bdstevel@tonic-gate	ddi_dma_attr_t		*hcdi_dma_attr;
417c478bdstevel@tonic-gate
427c478bdstevel@tonic-gate	/*
437c478bdstevel@tonic-gate	 * list of HCD operations
447c478bdstevel@tonic-gate	 */
457c478bdstevel@tonic-gate	struct usba_hcdi_ops	*hcdi_ops;
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate	int			hcdi_flags;	    /* flag options */
487c478bdstevel@tonic-gate
497c478bdstevel@tonic-gate	/* soft interrupt support */
507c478bdstevel@tonic-gate	ddi_softint_handle_t	hcdi_softint_hdl;	/* soft intr handle */
517c478bdstevel@tonic-gate	usba_list_entry_t	hcdi_cb_queue;
527c478bdstevel@tonic-gate
537c478bdstevel@tonic-gate	/*
547c478bdstevel@tonic-gate	 * min xfer and min/max burstsizes for DDI_CTLOPS_IOMIN
557c478bdstevel@tonic-gate	 */
567c478bdstevel@tonic-gate	uint_t			hcdi_min_xfer;
577c478bdstevel@tonic-gate	uchar_t			hcdi_min_burst_size;
587c478bdstevel@tonic-gate	uchar_t			hcdi_max_burst_size;
597c478bdstevel@tonic-gate
607c478bdstevel@tonic-gate	/*
617c478bdstevel@tonic-gate	 * usba_device ptr for root hub
627c478bdstevel@tonic-gate	 */
637c478bdstevel@tonic-gate	usba_device_t		*hcdi_usba_device;
647c478bdstevel@tonic-gate
657c478bdstevel@tonic-gate	/*
667c478bdstevel@tonic-gate	 * usb bus address allocation
677c478bdstevel@tonic-gate	 */
687c478bdstevel@tonic-gate	char		hcdi_usb_address_in_use[USBA_ADDRESS_ARRAY_SIZE];
697c478bdstevel@tonic-gate
707c478bdstevel@tonic-gate	usb_log_handle_t	hcdi_log_handle;
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate	kmutex_t		hcdi_mutex;
737c478bdstevel@tonic-gate	ddi_iblock_cookie_t	hcdi_iblock_cookie;
747c478bdstevel@tonic-gate	ddi_iblock_cookie_t	hcdi_soft_iblock_cookie;
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gate	/*
777c478bdstevel@tonic-gate	 * Hotplug event statistics since hcdi loaded.
787c478bdstevel@tonic-gate	 */
797c478bdstevel@tonic-gate	ulong_t			hcdi_total_hotplug_success;
807c478bdstevel@tonic-gate	ulong_t			hcdi_total_hotplug_failure;
817c478bdstevel@tonic-gate
827c478bdstevel@tonic-gate	/*
837c478bdstevel@tonic-gate	 * Resetable hotplug event statistics.
847c478bdstevel@tonic-gate	 */
857c478bdstevel@tonic-gate	ulong_t			hcdi_hotplug_success;
867c478bdstevel@tonic-gate	ulong_t			hcdi_hotplug_failure;
877c478bdstevel@tonic-gate
887c478bdstevel@tonic-gate	/*
897c478bdstevel@tonic-gate	 * Total number of devices currently enumerated.
907c478bdstevel@tonic-gate	 */
917c478bdstevel@tonic-gate	uchar_t			hcdi_device_count;
927c478bdstevel@tonic-gate
937c478bdstevel@tonic-gate	/*
947c478bdstevel@tonic-gate	 * kstat structures
957c478bdstevel@tonic-gate	 */
967c478bdstevel@tonic-gate	kstat_t			*hcdi_hotplug_stats;
977c478bdstevel@tonic-gate	kstat_t			*hcdi_error_stats;
987c478bdstevel@tonic-gate
997c478bdstevel@tonic-gate	/*
1007c478bdstevel@tonic-gate	 * ugen default binding
1017c478bdstevel@tonic-gate	 */
1027c478bdstevel@tonic-gate	uint_t			hcdi_ugen_default_binding;
1037c478bdstevel@tonic-gate} usba_hcdi_t;
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gate_NOTE(MUTEX_PROTECTS_DATA(usba_hcdi::hcdi_mutex,
1067c478bdstevel@tonic-gate				usba_hcdi::hcdi_usb_address_in_use))
1077c478bdstevel@tonic-gate_NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_usba_device))
1087c478bdstevel@tonic-gate_NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_ugen_default_binding))
1097c478bdstevel@tonic-gate
1107c478bdstevel@tonic-gate
1117c478bdstevel@tonic-gate/*
1127c478bdstevel@tonic-gate * retrieving the hcdi structure from dip
1137c478bdstevel@tonic-gate */
1147c478bdstevel@tonic-gatevoid usba_hcdi_set_hcdi(dev_info_t *dip, usba_hcdi_t *hcdi);
1157c478bdstevel@tonic-gateusba_hcdi_t *usba_hcdi_get_hcdi(dev_info_t *dip);
1167c478bdstevel@tonic-gate
1177c478bdstevel@tonic-gate/* initialize/destroy HCDI info */
1187c478bdstevel@tonic-gatevoid usba_hcdi_initialization();
1197c478bdstevel@tonic-gatevoid usba_hcdi_destroy();
1207c478bdstevel@tonic-gate
1217c478bdstevel@tonic-gate#ifdef __cplusplus
1227c478bdstevel@tonic-gate}
1237c478bdstevel@tonic-gate#endif
1247c478bdstevel@tonic-gate
1257c478bdstevel@tonic-gate#endif	/* _SYS_USB_HCDI_IMPL_H */
126