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 528cdc3d7Sszhou * Common Development and Distribution License (the "License"). 628cdc3d7Sszhou * 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_UHCI_POLLED_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_UHCI_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 * This header file describes the data structures required for the Host 367c478bd9Sstevel@tonic-gate * Controller Driver (HCD) to work in POLLED mode which will be either 377c478bd9Sstevel@tonic-gate * OBP mode for Sparc architecture or PC PROM mode for X86 architecture 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate #define POLLED_RAW_BUF_SIZE 8 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * These two flags are used to determine if this structure is already in 437c478bd9Sstevel@tonic-gate * use. We should only save off the controller state information once, 447c478bd9Sstevel@tonic-gate * and restore it once. These flags are used by the uhci_polled_flags below. 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE 0x01 477c478bd9Sstevel@tonic-gate #define POLLED_INPUT_MODE_INUSE 0x04 4828cdc3d7Sszhou #define POLLED_OUTPUT_MODE 0x10 4928cdc3d7Sszhou #define POLLED_OUTPUT_MODE_INUSE 0x40 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * For uhci bandwidth of low speed interrupt devices limits, 537c478bd9Sstevel@tonic-gate * one host controller can support 7 keyboards only. 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate #define MAX_NUM_FOR_KEYBORAD 0x7 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * State structure for the POLLED switch off 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate typedef struct uhci_polled { 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * Pointer to the uhcip structure for the device that is to be 647c478bd9Sstevel@tonic-gate * used as input in polled mode. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate uhci_state_t *uhci_polled_uhcip; 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * Pipe handle for the pipe that is to be used as input device 707c478bd9Sstevel@tonic-gate * in POLLED mode. 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *uhci_polled_ph; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate /* Interrupt Endpoint descriptor */ 757c478bd9Sstevel@tonic-gate queue_head_t *uhci_polled_qh; 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate /* Transfer descriptor for polling the device */ 787c478bd9Sstevel@tonic-gate uhci_td_t *uhci_polled_td; 797c478bd9Sstevel@tonic-gate /* 807c478bd9Sstevel@tonic-gate * The buffer that the usb scancodes are copied into. 817c478bd9Sstevel@tonic-gate */ 827c478bd9Sstevel@tonic-gate uchar_t *uhci_polled_buf; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * This flag is used to determine if the state of the controller 867c478bd9Sstevel@tonic-gate * has already been saved (enter) or doesn't need to be restored 877c478bd9Sstevel@tonic-gate * yet (exit). 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate uint_t uhci_polled_flags; 907c478bd9Sstevel@tonic-gate ushort_t uhci_polled_entry; 917c478bd9Sstevel@tonic-gate } uhci_polled_t; 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 947c478bd9Sstevel@tonic-gate uhci_polled_t::uhci_polled_flags)) 957c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(uhci_polled_t::uhci_polled_uhcip)) 967c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 977c478bd9Sstevel@tonic-gate uhci_polled_t::uhci_polled_entry)) 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * POLLED entry points 1017c478bd9Sstevel@tonic-gate * These functions are entry points into the POLLED code. 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *, uchar_t **, 1047c478bd9Sstevel@tonic-gate usb_console_info_impl_t *); 1057c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_fini(usb_console_info_impl_t *); 1067c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_enter(usb_console_info_impl_t *); 1077c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_input_exit(usb_console_info_impl_t *); 1087c478bd9Sstevel@tonic-gate int uhci_hcdi_polled_read(usb_console_info_impl_t *, uint_t *); 10928cdc3d7Sszhou int uhci_hcdi_polled_output_init(usba_pipe_handle_data_t *, 11028cdc3d7Sszhou usb_console_info_impl_t *); 11128cdc3d7Sszhou int uhci_hcdi_polled_output_fini(usb_console_info_impl_t *); 11228cdc3d7Sszhou int uhci_hcdi_polled_output_enter(usb_console_info_impl_t *); 11328cdc3d7Sszhou int uhci_hcdi_polled_output_exit(usb_console_info_impl_t *); 11428cdc3d7Sszhou int uhci_hcdi_polled_write(usb_console_info_impl_t *, uchar_t *, 11528cdc3d7Sszhou uint_t, uint_t *); 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* 1187c478bd9Sstevel@tonic-gate * External Function Prototypes: 1197c478bd9Sstevel@tonic-gate * These routines are only called from the init and fini functions. 1207c478bd9Sstevel@tonic-gate * They are allowed to acquire locks. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate extern uhci_state_t *uhci_obtain_state(dev_info_t *); 1237c478bd9Sstevel@tonic-gate extern queue_head_t *uhci_alloc_queue_head(uhci_state_t *); 1247c478bd9Sstevel@tonic-gate extern void uhci_free_tw(uhci_state_t *, uhci_trans_wrapper_t *); 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1277c478bd9Sstevel@tonic-gate } 1287c478bd9Sstevel@tonic-gate #endif 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_UHCI_POLLED_H */ 131