xref: /onnv-gate/usr/src/uts/common/sys/usb/usba/hcdi_impl.h (revision 7492:2387323b838f)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7492SZhigang.Lu@Sun.COM  * Common Development and Distribution License (the "License").
6*7492SZhigang.Lu@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*7492SZhigang.Lu@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_USB_HCDI_IMPL_H
270Sstevel@tonic-gate #define	_SYS_USB_HCDI_IMPL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifdef	__cplusplus
310Sstevel@tonic-gate extern "C" {
320Sstevel@tonic-gate #endif
330Sstevel@tonic-gate 
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * Per HCD Data Structures
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate typedef  struct usba_hcdi {
380Sstevel@tonic-gate 	dev_info_t		*hcdi_dip;	/* ptr to devinfo struct */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate 	ddi_dma_attr_t		*hcdi_dma_attr;
410Sstevel@tonic-gate 
420Sstevel@tonic-gate 	/*
430Sstevel@tonic-gate 	 * list of HCD operations
440Sstevel@tonic-gate 	 */
450Sstevel@tonic-gate 	struct usba_hcdi_ops	*hcdi_ops;
460Sstevel@tonic-gate 
470Sstevel@tonic-gate 	int			hcdi_flags;	    /* flag options */
480Sstevel@tonic-gate 
490Sstevel@tonic-gate 	/* soft interrupt support */
500Sstevel@tonic-gate 	ddi_softint_handle_t	hcdi_softint_hdl;	/* soft intr handle */
510Sstevel@tonic-gate 	usba_list_entry_t	hcdi_cb_queue;
520Sstevel@tonic-gate 
530Sstevel@tonic-gate 	/*
540Sstevel@tonic-gate 	 * min xfer and min/max burstsizes for DDI_CTLOPS_IOMIN
550Sstevel@tonic-gate 	 */
560Sstevel@tonic-gate 	uint_t			hcdi_min_xfer;
570Sstevel@tonic-gate 	uchar_t			hcdi_min_burst_size;
580Sstevel@tonic-gate 	uchar_t			hcdi_max_burst_size;
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	/*
610Sstevel@tonic-gate 	 * usba_device ptr for root hub
620Sstevel@tonic-gate 	 */
630Sstevel@tonic-gate 	usba_device_t		*hcdi_usba_device;
640Sstevel@tonic-gate 
650Sstevel@tonic-gate 	/*
660Sstevel@tonic-gate 	 * usb bus address allocation
670Sstevel@tonic-gate 	 */
680Sstevel@tonic-gate 	char		hcdi_usb_address_in_use[USBA_ADDRESS_ARRAY_SIZE];
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	usb_log_handle_t	hcdi_log_handle;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 	kmutex_t		hcdi_mutex;
730Sstevel@tonic-gate 	ddi_iblock_cookie_t	hcdi_iblock_cookie;
740Sstevel@tonic-gate 	ddi_iblock_cookie_t	hcdi_soft_iblock_cookie;
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 	/*
770Sstevel@tonic-gate 	 * Hotplug event statistics since hcdi loaded.
780Sstevel@tonic-gate 	 */
790Sstevel@tonic-gate 	ulong_t			hcdi_total_hotplug_success;
800Sstevel@tonic-gate 	ulong_t			hcdi_total_hotplug_failure;
810Sstevel@tonic-gate 
820Sstevel@tonic-gate 	/*
830Sstevel@tonic-gate 	 * Resetable hotplug event statistics.
840Sstevel@tonic-gate 	 */
850Sstevel@tonic-gate 	ulong_t			hcdi_hotplug_success;
860Sstevel@tonic-gate 	ulong_t			hcdi_hotplug_failure;
870Sstevel@tonic-gate 
880Sstevel@tonic-gate 	/*
890Sstevel@tonic-gate 	 * Total number of devices currently enumerated.
900Sstevel@tonic-gate 	 */
910Sstevel@tonic-gate 	uchar_t			hcdi_device_count;
920Sstevel@tonic-gate 
930Sstevel@tonic-gate 	/*
940Sstevel@tonic-gate 	 * kstat structures
950Sstevel@tonic-gate 	 */
960Sstevel@tonic-gate 	kstat_t			*hcdi_hotplug_stats;
970Sstevel@tonic-gate 	kstat_t			*hcdi_error_stats;
980Sstevel@tonic-gate 
990Sstevel@tonic-gate 	/*
1000Sstevel@tonic-gate 	 * ugen default binding
1010Sstevel@tonic-gate 	 */
1020Sstevel@tonic-gate 	uint_t			hcdi_ugen_default_binding;
1030Sstevel@tonic-gate } usba_hcdi_t;
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_hcdi::hcdi_mutex,
1060Sstevel@tonic-gate 				usba_hcdi::hcdi_usb_address_in_use))
1070Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_usba_device))
1080Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_ugen_default_binding))
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate /*
1120Sstevel@tonic-gate  * retrieving the hcdi structure from dip
1130Sstevel@tonic-gate  */
1140Sstevel@tonic-gate void usba_hcdi_set_hcdi(dev_info_t *dip, usba_hcdi_t *hcdi);
1150Sstevel@tonic-gate usba_hcdi_t *usba_hcdi_get_hcdi(dev_info_t *dip);
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate /* initialize/destroy HCDI info */
1180Sstevel@tonic-gate void usba_hcdi_initialization();
1190Sstevel@tonic-gate void usba_hcdi_destroy();
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate #ifdef __cplusplus
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate #endif
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate #endif	/* _SYS_USB_HCDI_IMPL_H */
126