1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_USB_EHCI_POLLED_H 28 #define _SYS_USB_EHCI_POLLED_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * Enchanced Host Controller Driver (EHCI) 38 * 39 * The EHCI driver is a software driver which interfaces to the Universal 40 * Serial Bus layer (USBA) and the Host Controller (HC). The interface to 41 * the Host Controller is defined by the EHCI Host Controller Interface. 42 * 43 * This header file describes the data structures required for the EHCI 44 * Driver to work in POLLED mode which will be either OBP mode for Sparc 45 * architecture or PC PROM mode for X86 architecture 46 */ 47 48 #define POLLED_RAW_BUF_SIZE 8 49 50 /* 51 * These two flags are used to determine if this structure is already 52 * in use. 53 */ 54 #define POLLED_INPUT_MODE 0x01 55 56 /* 57 * These two flags are used to determine if this structure is already in 58 * use. We should only save off the controller state information once, 59 * restore it once. These flags are used for the ehci_polled_flags below. 60 */ 61 #define POLLED_INPUT_MODE_INUSE 0x04 62 #define MAX_NUM_FOR_KEYBOARD 0x8 63 /* 64 * State structure for the POLLED switch off 65 */ 66 typedef struct ehci_polled { 67 /* 68 * Pointer to the ehcip structure for the device that is to be 69 * used as input in polled mode. 70 */ 71 ehci_state_t *ehci_polled_ehcip; 72 73 /* 74 * Pipe handle for the pipe that is to be used as input device 75 * in POLLED mode. 76 */ 77 usba_pipe_handle_data_t *ehci_polled_input_pipe_handle; 78 79 /* Dummy endpoint descriptor */ 80 ehci_qh_t *ehci_polled_dummy_qh; 81 82 /* Interrupt Endpoint descriptor */ 83 ehci_qh_t *ehci_polled_qh; /* Interrupt endpoint */ 84 85 /* 86 * The buffer that the usb scancodes are copied into. 87 */ 88 uchar_t *ehci_polled_buf; 89 90 /* 91 * This flag is used to determine if the state of the controller 92 * has already been saved (enter) or doesn't need to be restored 93 * yet (exit). 94 */ 95 uint_t ehci_polled_flags; 96 97 /* 98 * List of QTD inserted into polled mode periodic schedule list. 99 */ 100 ehci_qtd_t *ehci_polled_active_intr_qtd_list; 101 102 /* 103 * ehci_hcdi_polled_input_enter() may be called 104 * multiple times before the ehci_hcdi_polled_input_exit() is called. 105 * For example, the system may: 106 * - go down to kmdb (ehci_hcdi_polled_input_enter()) 107 * - down to the ok prompt, $q (ehci_hcdi_polled_input_enter()) 108 * - back to kmdb, "go" (ehci_hcdi_polled_input_exit()) 109 * - back to the OS, :c at kmdb (ehci_hcdi_polled_input_exit()) 110 * 111 * polled_entry keeps track of how many times 112 * ehci_polled_input_enter/ehci_polled_input_exit have been 113 * called so that the host controller isn't switched back to OS mode 114 * prematurely. 115 */ 116 uint_t ehci_polled_entry; 117 118 /* 119 * Save the pointer usb device structure and the endpoint number 120 * during the polled initilization. 121 */ 122 usba_device_t *ehci_polled_usb_dev; /* USB device */ 123 124 uint8_t ehci_polled_ep_addr; 125 126 boolean_t ehci_polled_no_sync_flag; /* For schizo bug */ 127 } ehci_polled_t; 128 129 _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 130 ehci_polled_t::ehci_polled_flags)) 131 _NOTE(DATA_READABLE_WITHOUT_LOCK(ehci_polled_t::ehci_polled_ehcip)) 132 _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 133 ehci_polled_t::ehci_polled_entry)) 134 135 /* 136 * Time waits for the different EHCI specific polled operations. 137 * These timeout values are specified in terms of microseconds. 138 */ 139 #define EHCI_POLLED_TIMEWAIT 2000 /* General polled time wait */ 140 141 142 #ifdef __cplusplus 143 } 144 #endif 145 146 #endif /* _SYS_USB_EHCI_POLLED_H */ 147