blob: 94e8f026ea19e18f2e066fa332272985996b63b1 (
plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SGCN_H
#define _SGCN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Console driver
*
* There is no hardware serial port is provided. A standalone
* co-processor SC acts as console device. The communication
* between SC and a domain is via SRAM on the choosen I/O board.
*
* This driver manipulates SRAM from domain Solaris side.
*/
/*
* Logically there are two sets of interfaces defined here.
* The first part describes IOSRAM structures and will be
* exposed to all relevant clients, like SC, OBP.
* The second part defines internal driver data structure
* used by sgcn dirver.
*/
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/tty.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
/*
* IOSRAM structure
*
* Solaris and OBP use separate console buffers. But they share
* the same console buffer structure.
*
* +---------------+ <- console buffer base address (BASE)
* | header |
* +---------------+ <- cnsram_in_begin + BASE
* | input |
* | buffer | <- cnsram_in_rdptr + BASE
* | | <- cnsram_in_wrptr + BASE
* | |
* +---------------+ <- cnsram_in_end + BASE
* |///////////////|
* |///////////////| <- reserved for future expansion
* |///////////////|
* +---------------+ <- cnsram_out_begin + BASE
* | output |
* | buffer | <- cnsram_out_rdptr + BASE
* | | <- cnsram_out_wrptr + BASE
* +---------------+ <- cnsram_out_end + BASE
* |///////////////|
* |///////////////| <- reserved for future expansion
* |///////////////|
* +---------------+ <- cnsram_size + BASE
*/
/*
* Console IOSRAM header structure
* The header size is fixed, despite of 32-bit or 64-bit Solaris
*/
typedef struct {
int32_t cnsram_magic; /* magic number, CNSRAM_MAGIC */
int32_t cnsram_version; /* verison number */
int32_t cnsram_size; /* console buffer size */
/*
* the followings are all relative to beginning of console buffer
*/
int32_t cnsram_in_begin;
int32_t cnsram_in_end;
int32_t cnsram_in_rdptr;
int32_t cnsram_in_wrptr;
int32_t cnsram_out_begin;
int32_t cnsram_out_end;
int32_t cnsram_out_rdptr;
int32_t cnsram_out_wrptr;
} cnsram_header;
#define CNSRAM_MAGIC 0x434F4E00 /* "CON" */
#define CNSRAM_VERSION_1 1
/*
* sgcn driver's soft state structure
*/
typedef struct sgcn {
/* mutexes */
kmutex_t sgcn_lock; /* protects sgcn_t (soft state) */
/* these are required by sbbc driver */
kmutex_t sgcn_sbbc_in_lock; /* input data lock */
kmutex_t sgcn_sbbc_outspace_lock; /* output data lock */
kmutex_t sgcn_sbbc_brk_lock; /* break sequence lock */
uint_t sgcn_sbbc_in_state; /* input data state */
uint_t sgcn_sbbc_outspace_state; /* output data state */
uint_t sgcn_sbbc_brk_state; /* break sequence state */
/* stream queues */
queue_t *sgcn_writeq; /* stream write queue */
queue_t *sgcn_readq; /* stream read queue */
/* pre-allocated console input buffer */
char *sgcn_inbuf; /* console input buffer */
uint_t sgcn_inbuf_size; /* buffer size */
/* dev info */
dev_info_t *sgcn_dip; /* dev_info */
/* for handling IOCTL messages */
bufcall_id_t sgcn_wbufcid; /* for console ioctl */
tty_common_t sgcn_tty; /* for console ioctl */
/* for console output timeout */
time_t sgcn_sc_active; /* last time (sec) SC was active */
} sgcn_t;
/* Constants used by promif routines */
#define SGCN_CLNT_STR "CON_CLNT"
#define SGCN_OBP_STR "CON_OBP"
/* alternate break sequence */
extern void (*abort_seq_handler)();
extern struct mod_ops mod_driverops;
#ifdef __cplusplus
}
#endif
#endif /* _SGCN_H */
|