1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_UHCI_POLLED_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_USB_UHCI_POLLED_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * This header file describes the data structures required for the Host 38*7c478bd9Sstevel@tonic-gate * Controller Driver (HCD) to work in POLLED mode which will be either 39*7c478bd9Sstevel@tonic-gate * OBP mode for Sparc architecture or PC PROM mode for X86 architecture 40*7c478bd9Sstevel@tonic-gate */ 41*7c478bd9Sstevel@tonic-gate #define POLLED_RAW_BUF_SIZE 8 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * These two flags are used to determine if this structure is already in 45*7c478bd9Sstevel@tonic-gate * use. We should only save off the controller state information once, 46*7c478bd9Sstevel@tonic-gate * and restore it once. These flags are used by the uhci_polled_flags below. 47*7c478bd9Sstevel@tonic-gate */ 48*7c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE 0x01 49*7c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE_INUSE 0x04 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* 52*7c478bd9Sstevel@tonic-gate * For uhci bandwidth of low speed interrupt devices limits, 53*7c478bd9Sstevel@tonic-gate * one host controller can support 7 keyboards only. 54*7c478bd9Sstevel@tonic-gate */ 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #define MAX_NUM_FOR_KEYBORAD 0x7 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate /* 59*7c478bd9Sstevel@tonic-gate * State structure for the POLLED switch off 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate typedef struct uhci_polled { 62*7c478bd9Sstevel@tonic-gate /* 63*7c478bd9Sstevel@tonic-gate * Pointer to the uhcip structure for the device that is to be 64*7c478bd9Sstevel@tonic-gate * used as input in polled mode. 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate uhci_state_t *uhci_polled_uhcip; 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Pipe handle for the pipe that is to be used as input device 70*7c478bd9Sstevel@tonic-gate * in POLLED mode. 71*7c478bd9Sstevel@tonic-gate */ 72*7c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *uhci_polled_ph; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate /* Interrupt Endpoint descriptor */ 75*7c478bd9Sstevel@tonic-gate queue_head_t *uhci_polled_qh; 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* Transfer descriptor for polling the device */ 78*7c478bd9Sstevel@tonic-gate uhci_td_t *uhci_polled_td; 79*7c478bd9Sstevel@tonic-gate /* 80*7c478bd9Sstevel@tonic-gate * The buffer that the usb scancodes are copied into. 81*7c478bd9Sstevel@tonic-gate */ 82*7c478bd9Sstevel@tonic-gate uchar_t *uhci_polled_buf; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * This flag is used to determine if the state of the controller 86*7c478bd9Sstevel@tonic-gate * has already been saved (enter) or doesn't need to be restored 87*7c478bd9Sstevel@tonic-gate * yet (exit). 88*7c478bd9Sstevel@tonic-gate */ 89*7c478bd9Sstevel@tonic-gate uint_t uhci_polled_flags; 90*7c478bd9Sstevel@tonic-gate ushort_t uhci_polled_entry; 91*7c478bd9Sstevel@tonic-gate } uhci_polled_t; 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 94*7c478bd9Sstevel@tonic-gate uhci_polled_t::uhci_polled_flags)) 95*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(uhci_polled_t::uhci_polled_uhcip)) 96*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 97*7c478bd9Sstevel@tonic-gate uhci_polled_t::uhci_polled_entry)) 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* 100*7c478bd9Sstevel@tonic-gate * POLLED entry points 101*7c478bd9Sstevel@tonic-gate * These functions are entry points into the POLLED code. 102*7c478bd9Sstevel@tonic-gate */ 103*7c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *, uchar_t **, 104*7c478bd9Sstevel@tonic-gate usb_console_info_impl_t *); 105*7c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_fini(usb_console_info_impl_t *); 106*7c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_enter(usb_console_info_impl_t *); 107*7c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_exit(usb_console_info_impl_t *); 108*7c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_read(usb_console_info_impl_t *, uint_t *); 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate /* 111*7c478bd9Sstevel@tonic-gate * External Function Prototypes: 112*7c478bd9Sstevel@tonic-gate * These routines are only called from the init and fini functions. 113*7c478bd9Sstevel@tonic-gate * They are allowed to acquire locks. 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate extern uhci_state_t *uhci_obtain_state(dev_info_t *); 116*7c478bd9Sstevel@tonic-gate extern queue_head_t *uhci_alloc_queue_head(uhci_state_t *); 117*7c478bd9Sstevel@tonic-gate extern void uhci_free_tw(uhci_state_t *, uhci_trans_wrapper_t *); 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 120*7c478bd9Sstevel@tonic-gate } 121*7c478bd9Sstevel@tonic-gate #endif 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_UHCI_POLLED_H */ 124