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