10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52191Sszhou * Common Development and Distribution License (the "License"). 62191Sszhou * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*7492SZhigang.Lu@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_USB_UHCI_POLLED_H 270Sstevel@tonic-gate #define _SYS_USB_UHCI_POLLED_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate /* 350Sstevel@tonic-gate * This header file describes the data structures required for the Host 360Sstevel@tonic-gate * Controller Driver (HCD) to work in POLLED mode which will be either 370Sstevel@tonic-gate * OBP mode for Sparc architecture or PC PROM mode for X86 architecture 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate #define POLLED_RAW_BUF_SIZE 8 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * These two flags are used to determine if this structure is already in 430Sstevel@tonic-gate * use. We should only save off the controller state information once, 440Sstevel@tonic-gate * and restore it once. These flags are used by the uhci_polled_flags below. 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate #define POLLED_INPUT_MODE 0x01 470Sstevel@tonic-gate #define POLLED_INPUT_MODE_INUSE 0x04 482191Sszhou #define POLLED_OUTPUT_MODE 0x10 492191Sszhou #define POLLED_OUTPUT_MODE_INUSE 0x40 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * For uhci bandwidth of low speed interrupt devices limits, 530Sstevel@tonic-gate * one host controller can support 7 keyboards only. 540Sstevel@tonic-gate */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate #define MAX_NUM_FOR_KEYBORAD 0x7 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* 590Sstevel@tonic-gate * State structure for the POLLED switch off 600Sstevel@tonic-gate */ 610Sstevel@tonic-gate typedef struct uhci_polled { 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * Pointer to the uhcip structure for the device that is to be 640Sstevel@tonic-gate * used as input in polled mode. 650Sstevel@tonic-gate */ 660Sstevel@tonic-gate uhci_state_t *uhci_polled_uhcip; 670Sstevel@tonic-gate 680Sstevel@tonic-gate /* 690Sstevel@tonic-gate * Pipe handle for the pipe that is to be used as input device 700Sstevel@tonic-gate * in POLLED mode. 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate usba_pipe_handle_data_t *uhci_polled_ph; 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* Interrupt Endpoint descriptor */ 750Sstevel@tonic-gate queue_head_t *uhci_polled_qh; 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* Transfer descriptor for polling the device */ 780Sstevel@tonic-gate uhci_td_t *uhci_polled_td; 790Sstevel@tonic-gate /* 800Sstevel@tonic-gate * The buffer that the usb scancodes are copied into. 810Sstevel@tonic-gate */ 820Sstevel@tonic-gate uchar_t *uhci_polled_buf; 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* 850Sstevel@tonic-gate * This flag is used to determine if the state of the controller 860Sstevel@tonic-gate * has already been saved (enter) or doesn't need to be restored 870Sstevel@tonic-gate * yet (exit). 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate uint_t uhci_polled_flags; 900Sstevel@tonic-gate ushort_t uhci_polled_entry; 910Sstevel@tonic-gate } uhci_polled_t; 920Sstevel@tonic-gate 930Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 940Sstevel@tonic-gate uhci_polled_t::uhci_polled_flags)) 950Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(uhci_polled_t::uhci_polled_uhcip)) 960Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode", 970Sstevel@tonic-gate uhci_polled_t::uhci_polled_entry)) 980Sstevel@tonic-gate 990Sstevel@tonic-gate /* 1000Sstevel@tonic-gate * POLLED entry points 1010Sstevel@tonic-gate * These functions are entry points into the POLLED code. 1020Sstevel@tonic-gate */ 1030Sstevel@tonic-gate int uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *, uchar_t **, 1040Sstevel@tonic-gate usb_console_info_impl_t *); 1050Sstevel@tonic-gate int uhci_hcdi_polled_input_fini(usb_console_info_impl_t *); 1060Sstevel@tonic-gate int uhci_hcdi_polled_input_enter(usb_console_info_impl_t *); 1070Sstevel@tonic-gate int uhci_hcdi_polled_input_exit(usb_console_info_impl_t *); 1080Sstevel@tonic-gate int uhci_hcdi_polled_read(usb_console_info_impl_t *, uint_t *); 1092191Sszhou int uhci_hcdi_polled_output_init(usba_pipe_handle_data_t *, 1102191Sszhou usb_console_info_impl_t *); 1112191Sszhou int uhci_hcdi_polled_output_fini(usb_console_info_impl_t *); 1122191Sszhou int uhci_hcdi_polled_output_enter(usb_console_info_impl_t *); 1132191Sszhou int uhci_hcdi_polled_output_exit(usb_console_info_impl_t *); 1142191Sszhou int uhci_hcdi_polled_write(usb_console_info_impl_t *, uchar_t *, 1152191Sszhou uint_t, uint_t *); 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* 1180Sstevel@tonic-gate * External Function Prototypes: 1190Sstevel@tonic-gate * These routines are only called from the init and fini functions. 1200Sstevel@tonic-gate * They are allowed to acquire locks. 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate extern uhci_state_t *uhci_obtain_state(dev_info_t *); 1230Sstevel@tonic-gate extern queue_head_t *uhci_alloc_queue_head(uhci_state_t *); 1240Sstevel@tonic-gate extern void uhci_free_tw(uhci_state_t *, uhci_trans_wrapper_t *); 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate #ifdef __cplusplus 1270Sstevel@tonic-gate } 1280Sstevel@tonic-gate #endif 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate #endif /* _SYS_USB_UHCI_POLLED_H */ 131