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. 232191Sszhou * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_USB_CONSOLE_INPUT_H 270Sstevel@tonic-gate #define _SYS_USB_CONSOLE_INPUT_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 * Opaque handle which is used above the usba level. 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate typedef struct usb_console_info *usb_console_info_t; 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * Opaque handle which is used above the ohci level. 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate typedef struct usb_console_info_private *usb_console_info_private_t; 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * This is the structure definition for the console input handle. 460Sstevel@tonic-gate * This structure is passed down from hid and is used keep track 470Sstevel@tonic-gate * of state information for the USB OBP support. 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate typedef struct usb_console_info_impl { 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * The dip for the device that is going to be used as input. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate dev_info_t *uci_dip; 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* 560Sstevel@tonic-gate * Private data that ohci uses for state information. 570Sstevel@tonic-gate */ 580Sstevel@tonic-gate usb_console_info_private_t uci_private; 590Sstevel@tonic-gate } usb_console_info_impl_t; 600Sstevel@tonic-gate 610Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Data only written during attach", 620Sstevel@tonic-gate usb_console_info_impl_t::uci_private)) 630Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Data only written during attach", 640Sstevel@tonic-gate usb_console_info_impl_t::uci_dip)) 650Sstevel@tonic-gate 660Sstevel@tonic-gate /* 670Sstevel@tonic-gate * The initialization routine for handling the USB keyboard in OBP mode. 680Sstevel@tonic-gate * This routine saves off state information and calls down to the lower 690Sstevel@tonic-gate * layers to initialize any state information. 700Sstevel@tonic-gate */ 710Sstevel@tonic-gate int usb_console_input_init( 720Sstevel@tonic-gate dev_info_t *dip, 730Sstevel@tonic-gate usb_pipe_handle_t pipe_handle, 740Sstevel@tonic-gate uchar_t **obp_buf, 750Sstevel@tonic-gate usb_console_info_t *console_info_handle 760Sstevel@tonic-gate ); 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* 790Sstevel@tonic-gate * Free up any resources that we allocated in the above initialization 800Sstevel@tonic-gate * routine. 810Sstevel@tonic-gate */ 820Sstevel@tonic-gate int usb_console_input_fini( 830Sstevel@tonic-gate usb_console_info_t console_input_info 840Sstevel@tonic-gate ); 850Sstevel@tonic-gate 860Sstevel@tonic-gate /* 870Sstevel@tonic-gate * This is the routine that OBP calls to save the USB state information 880Sstevel@tonic-gate * before using the USB keyboard as an input device. This routine, 890Sstevel@tonic-gate * and all of the routines that it calls, are responsible for saving 900Sstevel@tonic-gate * any state information so that it can be restored when OBP mode is 910Sstevel@tonic-gate * over. 920Sstevel@tonic-gate */ 930Sstevel@tonic-gate int usb_console_input_enter( 940Sstevel@tonic-gate usb_console_info_t console_info_handle 950Sstevel@tonic-gate ); 960Sstevel@tonic-gate 970Sstevel@tonic-gate /* 980Sstevel@tonic-gate * This is the routine that OBP calls when it wants to read a character. 990Sstevel@tonic-gate * We will call to the lower layers to see if there is any input data 1000Sstevel@tonic-gate * available. 1010Sstevel@tonic-gate */ 1020Sstevel@tonic-gate int usb_console_read( 1030Sstevel@tonic-gate usb_console_info_t console_info_handle, 1040Sstevel@tonic-gate uint_t *num_characters 1050Sstevel@tonic-gate ); 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate /* 1080Sstevel@tonic-gate * This is the routine that OBP calls when it is giving up control of the 1090Sstevel@tonic-gate * USB keyboard. This routine, and the lower layer routines that it calls, 1100Sstevel@tonic-gate * are responsible for restoring the controller state to the state it was 1110Sstevel@tonic-gate * in before OBP took control. 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate int usb_console_input_exit( 1140Sstevel@tonic-gate usb_console_info_t console_info_handle 1150Sstevel@tonic-gate ); 1160Sstevel@tonic-gate 1172191Sszhou int usb_console_output_init( 1182191Sszhou dev_info_t *dip, 1192191Sszhou usb_pipe_handle_t pipe_handle, 1202191Sszhou usb_console_info_t *console_info_handle 1212191Sszhou ); 1222191Sszhou 1232191Sszhou int usb_console_output_fini( 1242191Sszhou usb_console_info_t console_output_info 1252191Sszhou ); 1262191Sszhou 1272191Sszhou int usb_console_output_enter( 1282191Sszhou usb_console_info_t console_info_handle 1292191Sszhou ); 1302191Sszhou 1312191Sszhou int usb_console_write( 1322191Sszhou usb_console_info_t console_info_handle, 1332191Sszhou uchar_t *buf, 1342191Sszhou uint_t num_characters, 1352191Sszhou uint_t *num_characters_written 1362191Sszhou ); 1372191Sszhou 1382191Sszhou int usb_console_output_exit( 1392191Sszhou usb_console_info_t console_info_handle 1402191Sszhou ); 1412191Sszhou 1420Sstevel@tonic-gate #ifdef __cplusplus 1430Sstevel@tonic-gate } 1440Sstevel@tonic-gate #endif 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate #endif /* _SYS_USB_CONSOLE_INPUT_H */ 147