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 5d29f5a71Szhigang lu - Sun Microsystems - Beijing China * Common Development and Distribution License (the "License"). 6d29f5a71Szhigang lu - Sun Microsystems - Beijing China * 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*9b58c2adSzhigang lu - Sun Microsystems - Beijing China * Copyright 2009 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_EHCI_POLLED_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_EHCI_POLLED_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Enchanced Host Controller Driver (EHCI) 367c478bd9Sstevel@tonic-gate * 377c478bd9Sstevel@tonic-gate * The EHCI driver is a software driver which interfaces to the Universal 387c478bd9Sstevel@tonic-gate * Serial Bus layer (USBA) and the Host Controller (HC). The interface to 397c478bd9Sstevel@tonic-gate * the Host Controller is defined by the EHCI Host Controller Interface. 407c478bd9Sstevel@tonic-gate * 417c478bd9Sstevel@tonic-gate * This header file describes the data structures required for the EHCI 427c478bd9Sstevel@tonic-gate * Driver to work in POLLED mode which will be either OBP mode for Sparc 437c478bd9Sstevel@tonic-gate * architecture or PC PROM mode for X86 architecture 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #define POLLED_RAW_BUF_SIZE 8 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * These two flags are used to determine if this structure is already 507c478bd9Sstevel@tonic-gate * in use. 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE 0x01 53*9b58c2adSzhigang lu - Sun Microsystems - Beijing China #define POLLED_OUTPUT_MODE 0x10 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * These two flags are used to determine if this structure is already in 577c478bd9Sstevel@tonic-gate * use. We should only save off the controller state information once, 587c478bd9Sstevel@tonic-gate * restore it once. These flags are used for the ehci_polled_flags below. 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE_INUSE 0x04 61*9b58c2adSzhigang lu - Sun Microsystems - Beijing China #define POLLED_OUTPUT_MODE_INUSE 0x40 627c478bd9Sstevel@tonic-gate #define MAX_NUM_FOR_KEYBOARD 0x8 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * State structure for the POLLED switch off 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate typedef struct ehci_polled { 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * Pointer to the ehcip structure for the device that is to be 697c478bd9Sstevel@tonic-gate * used as input in polled mode. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate ehci_state_t *ehci_polled_ehcip; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 747c478bd9Sstevel@tonic-gate * Pipe handle for the pipe that is to be used as input device 757c478bd9Sstevel@tonic-gate * in POLLED mode. 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ehci_polled_input_pipe_handle; 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* Dummy endpoint descriptor */ 807c478bd9Sstevel@tonic-gate ehci_qh_t *ehci_polled_dummy_qh; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* Interrupt Endpoint descriptor */ 837c478bd9Sstevel@tonic-gate ehci_qh_t *ehci_polled_qh; /* Interrupt endpoint */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * The buffer that the usb scancodes are copied into. 877c478bd9Sstevel@tonic-gate */ 887c478bd9Sstevel@tonic-gate uchar_t *ehci_polled_buf; 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * This flag is used to determine if the state of the controller 927c478bd9Sstevel@tonic-gate * has already been saved (enter) or doesn't need to be restored 937c478bd9Sstevel@tonic-gate * yet (exit). 947c478bd9Sstevel@tonic-gate */ 957c478bd9Sstevel@tonic-gate uint_t ehci_polled_flags; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * List of QTD inserted into polled mode periodic schedule list. 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate ehci_qtd_t *ehci_polled_active_intr_qtd_list; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* 1037c478bd9Sstevel@tonic-gate * ehci_hcdi_polled_input_enter() may be called 1047c478bd9Sstevel@tonic-gate * multiple times before the ehci_hcdi_polled_input_exit() is called. 1057c478bd9Sstevel@tonic-gate * For example, the system may: 1067c478bd9Sstevel@tonic-gate * - go down to kmdb (ehci_hcdi_polled_input_enter()) 1077c478bd9Sstevel@tonic-gate * - down to the ok prompt, $q (ehci_hcdi_polled_input_enter()) 1087c478bd9Sstevel@tonic-gate * - back to kmdb, "go" (ehci_hcdi_polled_input_exit()) 1097c478bd9Sstevel@tonic-gate * - back to the OS, :c at kmdb (ehci_hcdi_polled_input_exit()) 1107c478bd9Sstevel@tonic-gate * 1117c478bd9Sstevel@tonic-gate * polled_entry keeps track of how many times 1127c478bd9Sstevel@tonic-gate * ehci_polled_input_enter/ehci_polled_input_exit have been 1137c478bd9Sstevel@tonic-gate * called so that the host controller isn't switched back to OS mode 1147c478bd9Sstevel@tonic-gate * prematurely. 1157c478bd9Sstevel@tonic-gate */ 1167c478bd9Sstevel@tonic-gate uint_t ehci_polled_entry; 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * Save the pointer usb device structure and the endpoint number 1207c478bd9Sstevel@tonic-gate * during the polled initilization. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate usba_device_t *ehci_polled_usb_dev; /* USB device */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate uint8_t ehci_polled_ep_addr; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate boolean_t ehci_polled_no_sync_flag; /* For schizo bug */ 1277c478bd9Sstevel@tonic-gate } ehci_polled_t; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 1307c478bd9Sstevel@tonic-gate ehci_polled_t::ehci_polled_flags)) 1317c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ehci_polled_t::ehci_polled_ehcip)) 1327c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 1337c478bd9Sstevel@tonic-gate ehci_polled_t::ehci_polled_entry)) 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* 1367c478bd9Sstevel@tonic-gate * Time waits for the different EHCI specific polled operations. 1377c478bd9Sstevel@tonic-gate * These timeout values are specified in terms of microseconds. 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate #define EHCI_POLLED_TIMEWAIT 2000 /* General polled time wait */ 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1437c478bd9Sstevel@tonic-gate } 1447c478bd9Sstevel@tonic-gate #endif 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_POLLED_H */ 147