1*ae115bc7Smrj /*
2*ae115bc7Smrj  * CDDL HEADER START
3*ae115bc7Smrj  *
4*ae115bc7Smrj  * The contents of this file are subject to the terms of the
5*ae115bc7Smrj  * Common Development and Distribution License (the "License").
6*ae115bc7Smrj  * You may not use this file except in compliance with the License.
7*ae115bc7Smrj  *
8*ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10*ae115bc7Smrj  * See the License for the specific language governing permissions
11*ae115bc7Smrj  * and limitations under the License.
12*ae115bc7Smrj  *
13*ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14*ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16*ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17*ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ae115bc7Smrj  *
19*ae115bc7Smrj  * CDDL HEADER END
20*ae115bc7Smrj  */
21*ae115bc7Smrj /*
22*ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*ae115bc7Smrj  * Use is subject to license terms.
24*ae115bc7Smrj  */
25*ae115bc7Smrj 
26*ae115bc7Smrj #ifndef	_BOOT_SERIAL_H
27*ae115bc7Smrj #define	_BOOT_SERIAL_H
28*ae115bc7Smrj 
29*ae115bc7Smrj #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*ae115bc7Smrj 
31*ae115bc7Smrj #ifdef __cplusplus
32*ae115bc7Smrj extern "C" {
33*ae115bc7Smrj #endif
34*ae115bc7Smrj 
35*ae115bc7Smrj /* ---- ports on 16550 serial chips ---- */
36*ae115bc7Smrj #define	DAT	0	/* ... data */
37*ae115bc7Smrj #define	ICR	1	/* ... intr control reg */
38*ae115bc7Smrj #define	ISR	2	/* ... intr status reg */
39*ae115bc7Smrj #define	LCR	3	/* ... line control reg */
40*ae115bc7Smrj #define	MCR	4	/* ... modem control reg */
41*ae115bc7Smrj #define	LSR	5	/* ... line status reg */
42*ae115bc7Smrj #define	MSR	6	/* ... modem status reg */
43*ae115bc7Smrj #define	DLL	0	/* ... data latch low (used for baud rate) */
44*ae115bc7Smrj #define	DLH	1	/* ... data latch high (ditto) */
45*ae115bc7Smrj #define	FIFOR	ISR	/* ... fifo write reg */
46*ae115bc7Smrj 
47*ae115bc7Smrj /* ---- LSR bits ---- */
48*ae115bc7Smrj #define	RCA		0x01	/* ... receive char avail */
49*ae115bc7Smrj #define	XHRE		0x20	/* ... xmit hold buffer empty */
50*ae115bc7Smrj 
51*ae115bc7Smrj /* ---- Modem bits ---- */
52*ae115bc7Smrj #define	DTR		0x01
53*ae115bc7Smrj #define	RTS		0x02
54*ae115bc7Smrj #define	OUT2		0x08
55*ae115bc7Smrj 
56*ae115bc7Smrj #define	FIFO_ON		0x01
57*ae115bc7Smrj #define	FIFO_OFF	0x00
58*ae115bc7Smrj #define	FIFORXFLSH	0x02
59*ae115bc7Smrj #define	FIFOTXFLSH	0x04
60*ae115bc7Smrj #define	FIFODMA		0x08
61*ae115bc7Smrj 
62*ae115bc7Smrj /* ---- LCR bits ---- */
63*ae115bc7Smrj #define	STOP1		00
64*ae115bc7Smrj #define	STOP2   	0x04
65*ae115bc7Smrj #define	BITS5		0x00	/* 5 bits per char */
66*ae115bc7Smrj #define	BITS6		0x01	/* 6 bits per char */
67*ae115bc7Smrj #define	BITS7		0x02	/* 7 bits per char */
68*ae115bc7Smrj #define	BITS8		0x03	/* 8 bits per char */
69*ae115bc7Smrj 
70*ae115bc7Smrj /* baud rate definitions */
71*ae115bc7Smrj #define	DLAB		0x80	/* divisor latch access bit */
72*ae115bc7Smrj #define	ASY110		1047	/* 110 baud rate for serial console */
73*ae115bc7Smrj #define	ASY150		768	/* 150 baud rate for serial console */
74*ae115bc7Smrj #define	ASY300		384	/* 300 baud rate for serial console */
75*ae115bc7Smrj #define	ASY600		192	/* 600 baud rate for serial console */
76*ae115bc7Smrj #define	ASY1200		96	/* 1200 baud rate for serial console */
77*ae115bc7Smrj #define	ASY2400		48	/* 2400 baud rate for serial console */
78*ae115bc7Smrj #define	ASY4800		24	/* 4800 baud rate for serial console */
79*ae115bc7Smrj #define	ASY9600		12	/* 9600 baud rate for serial console */
80*ae115bc7Smrj #define	ASY19200	6	/* 19200 baud rate for serial console */
81*ae115bc7Smrj #define	ASY38400	3	/* 38400 baud rate for serial console */
82*ae115bc7Smrj #define	ASY57600	2	/* 57600 baud rate for serial console */
83*ae115bc7Smrj #define	ASY115200	1	/* 115200 baud rate for serial console */
84*ae115bc7Smrj 
85*ae115bc7Smrj 
86*ae115bc7Smrj /*
87*ae115bc7Smrj  *  Defines for the serial port
88*ae115bc7Smrj  */
89*ae115bc7Smrj 
90*ae115bc7Smrj #define	SERIAL_FIFO_FLUSH	16	/* maximum number of chars to flush */
91*ae115bc7Smrj 
92*ae115bc7Smrj /* ---- Bit 11 defines direct serial port ---- */
93*ae115bc7Smrj #define	SDIRECT		0x1000
94*ae115bc7Smrj 
95*ae115bc7Smrj /* ---- Bits 9-10 define flow control ---- */
96*ae115bc7Smrj #define	SSOFT		0x800
97*ae115bc7Smrj #define	SHARD		0x400
98*ae115bc7Smrj 
99*ae115bc7Smrj /* ---- Bits 5-8 define baud rate ---- */
100*ae115bc7Smrj #define	S110		0x00
101*ae115bc7Smrj #define	S150		0x20
102*ae115bc7Smrj #define	S300		0x40
103*ae115bc7Smrj #define	S600		0x60
104*ae115bc7Smrj #define	S1200		0x80
105*ae115bc7Smrj #define	S2400		0xa0
106*ae115bc7Smrj #define	S4800		0xc0
107*ae115bc7Smrj #define	S9600		0xe0
108*ae115bc7Smrj #define	S19200		0x100
109*ae115bc7Smrj #define	S38400		0x120
110*ae115bc7Smrj #define	S57600		0x140
111*ae115bc7Smrj #define	S76800		0x160
112*ae115bc7Smrj #define	S115200		0x180
113*ae115bc7Smrj #define	S153600		0x1a0
114*ae115bc7Smrj #define	S230400		0x1c0
115*ae115bc7Smrj #define	S307200		0x1e0
116*ae115bc7Smrj #define	S460800		0x200
117*ae115bc7Smrj 
118*ae115bc7Smrj /* ---- Bits 3 & 4 are parity ---- */
119*ae115bc7Smrj #define	PARITY_NONE	0x10
120*ae115bc7Smrj #define	PARITY_ODD	0x08
121*ae115bc7Smrj #define	PARITY_EVEN	0x18
122*ae115bc7Smrj 
123*ae115bc7Smrj /* ---- Bit 2 is stop bit ---- */
124*ae115bc7Smrj #define	STOP_1		0x00
125*ae115bc7Smrj #define	STOP_2		0x04
126*ae115bc7Smrj 
127*ae115bc7Smrj /* ---- Bits 0 & 1 are data bits ---- */
128*ae115bc7Smrj #define	DATA_8		0x03
129*ae115bc7Smrj #define	DATA_7		0x02
130*ae115bc7Smrj #define	DATA_6		0x01
131*ae115bc7Smrj #define	DATA_5		0x00
132*ae115bc7Smrj 
133*ae115bc7Smrj /* ---- Line Status ---- */
134*ae115bc7Smrj #define	SERIAL_TIMEOUT	0x80
135*ae115bc7Smrj #define	SERIAL_XMITSHFT	0x40
136*ae115bc7Smrj #define	SERIAL_XMITHOLD	0x20
137*ae115bc7Smrj #define	SERIAL_BREAK	0x10
138*ae115bc7Smrj #define	SERIAL_FRAME	0x08
139*ae115bc7Smrj #define	SERIAL_PARITY	0x04
140*ae115bc7Smrj #define	SERIAL_OVERRUN	0x02
141*ae115bc7Smrj #define	SERIAL_DATA	0x01
142*ae115bc7Smrj 
143*ae115bc7Smrj 
144*ae115bc7Smrj #ifdef __cplusplus
145*ae115bc7Smrj }
146*ae115bc7Smrj #endif
147*ae115bc7Smrj 
148*ae115bc7Smrj #endif	/* _BOOT_SERIAL_H */
149