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_OHCI_POLLED_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_OHCI_POLLED_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Open Host Controller Driver (OHCI) 357c478bd9Sstevel@tonic-gate * 367c478bd9Sstevel@tonic-gate * The USB Open Host Controller driver is a software driver which interfaces 377c478bd9Sstevel@tonic-gate * to the Universal Serial Bus layer (USBA) and the USB Open Host Controller. 387c478bd9Sstevel@tonic-gate * The interface to USB Open Host Controller is defined by the OpenHCI Host 397c478bd9Sstevel@tonic-gate * Controller Interface. 407c478bd9Sstevel@tonic-gate * 417c478bd9Sstevel@tonic-gate * This header file describes the data structures required for the USB Open 427c478bd9Sstevel@tonic-gate * Host Controller Driver to work in POLLED mode which will be either OBP 437c478bd9Sstevel@tonic-gate * mode for Sparc 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 ohci_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 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * For ohci bandwidth of low speed interrupt devices limits, 657c478bd9Sstevel@tonic-gate * one host controller can support 6 keyboards only. 667c478bd9Sstevel@tonic-gate */ 677c478bd9Sstevel@tonic-gate #define MAX_NUM_FOR_KEYBOARD 0x6 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * State structure for the POLLED switch off 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate typedef struct ohci_polled { 727c478bd9Sstevel@tonic-gate /* 737c478bd9Sstevel@tonic-gate * Pointer to the ohcip structure for the device that is to be 747c478bd9Sstevel@tonic-gate * used as input in polled mode. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate ohci_state_t *ohci_polled_ohcip; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate /* 797c478bd9Sstevel@tonic-gate * Pipe handle for the pipe that is to be used as input device 807c478bd9Sstevel@tonic-gate * in POLLED mode. 817c478bd9Sstevel@tonic-gate */ 827c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ohci_polled_input_pipe_handle; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* Dummy endpoint descriptor */ 857c478bd9Sstevel@tonic-gate ohci_ed_t *ohci_polled_dummy_ed; 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* Interrupt Endpoint descriptor */ 887c478bd9Sstevel@tonic-gate ohci_ed_t *ohci_polled_ed; /* Interrupt endpoint */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * The buffer that the usb scancodes are copied into. 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate uchar_t *ohci_polled_buf; 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * This flag is used to determine if the state of the controller 977c478bd9Sstevel@tonic-gate * has already been saved (enter) or doesn't need to be restored 987c478bd9Sstevel@tonic-gate * yet (exit). 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate uint_t ohci_polled_flags; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* 1037c478bd9Sstevel@tonic-gate * The read or write routines may take TD's of the done head that 1047c478bd9Sstevel@tonic-gate * are not intended for them. 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate ohci_td_t *ohci_polled_input_done_head; 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * This is the tail for the above ohci_polled_input_done_head; 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate ohci_td_t *ohci_polled_input_done_tail; 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate /* 1147c478bd9Sstevel@tonic-gate * ohci_hcdi_polled_input_enter() may be called 1157c478bd9Sstevel@tonic-gate * multiple times before the ohci_hcdi_polled_input_exit() is called. 1167c478bd9Sstevel@tonic-gate * For example, the system may: 1177c478bd9Sstevel@tonic-gate * - go down to kmdb (ohci_hcdi_polled_input_enter()) 1187c478bd9Sstevel@tonic-gate * - down to the ok prompt, $q (ohci_hcdi_polled_input_enter()) 1197c478bd9Sstevel@tonic-gate * - back to kmdb, "go" (ohci_hcdi_polled_input_exit()) 1207c478bd9Sstevel@tonic-gate * - back to the OS, :c at kmdb (ohci_hcdi_polled_input_exit()) 1217c478bd9Sstevel@tonic-gate * 1227c478bd9Sstevel@tonic-gate * polled_entry keeps track of how many times 1237c478bd9Sstevel@tonic-gate * ohci_polled_input_enter/ohci_polled_input_exit have been 1247c478bd9Sstevel@tonic-gate * called so that the host controller isn't switched back to OS mode 1257c478bd9Sstevel@tonic-gate * prematurely. 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate uint_t ohci_polled_entry; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * Save the pointer usb device structure and the endpoint number 1317c478bd9Sstevel@tonic-gate * during the polled initilization. 1327c478bd9Sstevel@tonic-gate */ 1337c478bd9Sstevel@tonic-gate usba_device_t *ohci_polled_usb_dev; /* USB device */ 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate uint8_t ohci_polled_ep_addr; 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate boolean_t ohci_polled_no_sync_flag; /* For schizo bug */ 1387c478bd9Sstevel@tonic-gate } ohci_polled_t; 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 1417c478bd9Sstevel@tonic-gate ohci_polled_t::ohci_polled_flags)) 1427c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ohci_polled_t::ohci_polled_ohcip)) 1437c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 1447c478bd9Sstevel@tonic-gate ohci_polled_t::ohci_polled_entry)) 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1487c478bd9Sstevel@tonic-gate } 1497c478bd9Sstevel@tonic-gate #endif 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_OHCI_POLLED_H */ 152