1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_UHCI_POLLED_H
#define _SYS_USB_UHCI_POLLED_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* This header file describes the data structures required for the Host
* Controller Driver (HCD) to work in POLLED mode which will be either
* OBP mode for Sparc architecture or PC PROM mode for X86 architecture
*/
#define POLLED_RAW_BUF_SIZE 8
/*
* These two flags are used to determine if this structure is already in
* use. We should only save off the controller state information once,
* and restore it once. These flags are used by the uhci_polled_flags below.
*/
#define POLLED_INPUT_MODE 0x01
#define POLLED_INPUT_MODE_INUSE 0x04
#define POLLED_OUTPUT_MODE 0x10
#define POLLED_OUTPUT_MODE_INUSE 0x40
/*
* For uhci bandwidth of low speed interrupt devices limits,
* one host controller can support 7 keyboards only.
*/
#define MAX_NUM_FOR_KEYBORAD 0x7
/*
* State structure for the POLLED switch off
*/
typedef struct uhci_polled {
/*
* Pointer to the uhcip structure for the device that is to be
* used as input in polled mode.
*/
uhci_state_t *uhci_polled_uhcip;
/*
* Pipe handle for the pipe that is to be used as input device
* in POLLED mode.
*/
usba_pipe_handle_data_t *uhci_polled_ph;
/* Interrupt Endpoint descriptor */
queue_head_t *uhci_polled_qh;
/* Transfer descriptor for polling the device */
uhci_td_t *uhci_polled_td;
/*
* The buffer that the usb scancodes are copied into.
*/
uchar_t *uhci_polled_buf;
/*
* This flag is used to determine if the state of the controller
* has already been saved (enter) or doesn't need to be restored
* yet (exit).
*/
uint_t uhci_polled_flags;
ushort_t uhci_polled_entry;
} uhci_polled_t;
_NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
uhci_polled_t::uhci_polled_flags))
_NOTE(DATA_READABLE_WITHOUT_LOCK(uhci_polled_t::uhci_polled_uhcip))
_NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
uhci_polled_t::uhci_polled_entry))
/*
* POLLED entry points
* These functions are entry points into the POLLED code.
*/
int uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *, uchar_t **,
usb_console_info_impl_t *);
int uhci_hcdi_polled_input_fini(usb_console_info_impl_t *);
int uhci_hcdi_polled_input_enter(usb_console_info_impl_t *);
int uhci_hcdi_polled_input_exit(usb_console_info_impl_t *);
int uhci_hcdi_polled_read(usb_console_info_impl_t *, uint_t *);
int uhci_hcdi_polled_output_init(usba_pipe_handle_data_t *,
usb_console_info_impl_t *);
int uhci_hcdi_polled_output_fini(usb_console_info_impl_t *);
int uhci_hcdi_polled_output_enter(usb_console_info_impl_t *);
int uhci_hcdi_polled_output_exit(usb_console_info_impl_t *);
int uhci_hcdi_polled_write(usb_console_info_impl_t *, uchar_t *,
uint_t, uint_t *);
/*
* External Function Prototypes:
* These routines are only called from the init and fini functions.
* They are allowed to acquire locks.
*/
extern uhci_state_t *uhci_obtain_state(dev_info_t *);
extern queue_head_t *uhci_alloc_queue_head(uhci_state_t *);
extern void uhci_free_tw(uhci_state_t *, uhci_trans_wrapper_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_UHCI_POLLED_H */
|