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*28cdc3d7Sszhou  * Common Development and Distribution License (the "License").
6*28cdc3d7Sszhou  * 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*28cdc3d7Sszhou  * Copyright 2006 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_UHCI_POLLED_H
277c478bd9Sstevel@tonic-gate #define	_SYS_USB_UHCI_POLLED_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * This header file describes the data structures required for the Host
377c478bd9Sstevel@tonic-gate  * Controller Driver (HCD) to work in POLLED mode which will be  either
387c478bd9Sstevel@tonic-gate  * OBP mode for Sparc architecture or PC PROM mode for X86 architecture
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate #define	POLLED_RAW_BUF_SIZE	8
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * These two flags are used to determine if this structure is already in
447c478bd9Sstevel@tonic-gate  * use. We should only save off the controller state information once,
457c478bd9Sstevel@tonic-gate  * and restore it once. These flags are used by the uhci_polled_flags below.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #define	POLLED_INPUT_MODE		0x01
487c478bd9Sstevel@tonic-gate #define	POLLED_INPUT_MODE_INUSE		0x04
49*28cdc3d7Sszhou #define	POLLED_OUTPUT_MODE		0x10
50*28cdc3d7Sszhou #define	POLLED_OUTPUT_MODE_INUSE	0x40
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * For uhci bandwidth of low speed interrupt devices limits,
547c478bd9Sstevel@tonic-gate  * one host controller can support 7 keyboards only.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #define	MAX_NUM_FOR_KEYBORAD		0x7
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * State structure for the POLLED switch off
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate typedef struct uhci_polled {
637c478bd9Sstevel@tonic-gate 	/*
647c478bd9Sstevel@tonic-gate 	 * Pointer to the uhcip structure for the device that is to  be
657c478bd9Sstevel@tonic-gate 	 * used as input in polled mode.
667c478bd9Sstevel@tonic-gate 	 */
677c478bd9Sstevel@tonic-gate 	uhci_state_t *uhci_polled_uhcip;
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 	/*
707c478bd9Sstevel@tonic-gate 	 * Pipe handle for the pipe that is to be used as input device
717c478bd9Sstevel@tonic-gate 	 * in POLLED mode.
727c478bd9Sstevel@tonic-gate 	 */
737c478bd9Sstevel@tonic-gate 	usba_pipe_handle_data_t  *uhci_polled_ph;
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 	/* Interrupt Endpoint descriptor */
767c478bd9Sstevel@tonic-gate 	queue_head_t		*uhci_polled_qh;
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate 	/* Transfer descriptor for polling the device */
797c478bd9Sstevel@tonic-gate 	uhci_td_t		*uhci_polled_td;
807c478bd9Sstevel@tonic-gate 	/*
817c478bd9Sstevel@tonic-gate 	 * The buffer that the usb scancodes are copied into.
827c478bd9Sstevel@tonic-gate 	 */
837c478bd9Sstevel@tonic-gate 	uchar_t			*uhci_polled_buf;
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate 	/*
867c478bd9Sstevel@tonic-gate 	 * This flag is used to determine if the state of the controller
877c478bd9Sstevel@tonic-gate 	 * has already been saved (enter) or doesn't need to be restored
887c478bd9Sstevel@tonic-gate 	 * yet (exit).
897c478bd9Sstevel@tonic-gate 	 */
907c478bd9Sstevel@tonic-gate 	uint_t			uhci_polled_flags;
917c478bd9Sstevel@tonic-gate 	ushort_t		uhci_polled_entry;
927c478bd9Sstevel@tonic-gate } uhci_polled_t;
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
957c478bd9Sstevel@tonic-gate 	uhci_polled_t::uhci_polled_flags))
967c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(uhci_polled_t::uhci_polled_uhcip))
977c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
987c478bd9Sstevel@tonic-gate 	uhci_polled_t::uhci_polled_entry))
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * POLLED entry points
1027c478bd9Sstevel@tonic-gate  *	These functions are entry points into the POLLED code.
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate int	uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *, uchar_t **,
1057c478bd9Sstevel@tonic-gate 	    usb_console_info_impl_t *);
1067c478bd9Sstevel@tonic-gate int	uhci_hcdi_polled_input_fini(usb_console_info_impl_t *);
1077c478bd9Sstevel@tonic-gate int	uhci_hcdi_polled_input_enter(usb_console_info_impl_t *);
1087c478bd9Sstevel@tonic-gate int	uhci_hcdi_polled_input_exit(usb_console_info_impl_t *);
1097c478bd9Sstevel@tonic-gate int	uhci_hcdi_polled_read(usb_console_info_impl_t *, uint_t *);
110*28cdc3d7Sszhou int	uhci_hcdi_polled_output_init(usba_pipe_handle_data_t *,
111*28cdc3d7Sszhou 	    usb_console_info_impl_t *);
112*28cdc3d7Sszhou int	uhci_hcdi_polled_output_fini(usb_console_info_impl_t *);
113*28cdc3d7Sszhou int	uhci_hcdi_polled_output_enter(usb_console_info_impl_t *);
114*28cdc3d7Sszhou int	uhci_hcdi_polled_output_exit(usb_console_info_impl_t *);
115*28cdc3d7Sszhou int	uhci_hcdi_polled_write(usb_console_info_impl_t *, uchar_t *,
116*28cdc3d7Sszhou 	    uint_t, uint_t *);
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate /*
1197c478bd9Sstevel@tonic-gate  * External Function Prototypes:
1207c478bd9Sstevel@tonic-gate  * These routines are only called from the init and fini functions.
1217c478bd9Sstevel@tonic-gate  * They are allowed to acquire locks.
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate extern uhci_state_t	*uhci_obtain_state(dev_info_t *);
1247c478bd9Sstevel@tonic-gate extern queue_head_t	*uhci_alloc_queue_head(uhci_state_t *);
1257c478bd9Sstevel@tonic-gate extern void		uhci_free_tw(uhci_state_t *, uhci_trans_wrapper_t *);
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #endif	/* _SYS_USB_UHCI_POLLED_H */
132