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 #ifdef __cplusplus
30*ae115bc7Smrj extern "C" {
31*ae115bc7Smrj #endif
32*ae115bc7Smrj 
33*ae115bc7Smrj /* ---- ports on 16550 serial chips ---- */
34*ae115bc7Smrj #define	DAT	0	/* ... data */
35*ae115bc7Smrj #define	ICR	1	/* ... intr control reg */
36*ae115bc7Smrj #define	ISR	2	/* ... intr status reg */
37*ae115bc7Smrj #define	LCR	3	/* ... line control reg */
38*ae115bc7Smrj #define	MCR	4	/* ... modem control reg */
39*ae115bc7Smrj #define	LSR	5	/* ... line status reg */
40*ae115bc7Smrj #define	MSR	6	/* ... modem status reg */
41*ae115bc7Smrj #define	DLL	0	/* ... data latch low (used for baud rate) */
42*ae115bc7Smrj #define	DLH	1	/* ... data latch high (ditto) */
43*ae115bc7Smrj #define	FIFOR	ISR	/* ... fifo write reg */
44*ae115bc7Smrj 
45*ae115bc7Smrj /* ---- LSR bits ---- */
46*ae115bc7Smrj #define	RCA		0x01	/* ... receive char avail */
47*ae115bc7Smrj #define	XHRE		0x20	/* ... xmit hold buffer empty */
48*ae115bc7Smrj 
49*ae115bc7Smrj /* ---- Modem bits ---- */
50*ae115bc7Smrj #define	DTR		0x01
51*ae115bc7Smrj #define	RTS		0x02
52*ae115bc7Smrj #define	OUT2		0x08
53*ae115bc7Smrj 
54*ae115bc7Smrj #define	FIFO_ON		0x01
55*ae115bc7Smrj #define	FIFO_OFF	0x00
56*ae115bc7Smrj #define	FIFORXFLSH	0x02
57*ae115bc7Smrj #define	FIFOTXFLSH	0x04
58*ae115bc7Smrj #define	FIFODMA		0x08
59*ae115bc7Smrj 
60*ae115bc7Smrj /* ---- LCR bits ---- */
61*ae115bc7Smrj #define	STOP1		00
62*ae115bc7Smrj #define	STOP2   	0x04
63*ae115bc7Smrj #define	BITS5		0x00	/* 5 bits per char */
64*ae115bc7Smrj #define	BITS6		0x01	/* 6 bits per char */
65*ae115bc7Smrj #define	BITS7		0x02	/* 7 bits per char */
66*ae115bc7Smrj #define	BITS8		0x03	/* 8 bits per char */
67*ae115bc7Smrj 
68*ae115bc7Smrj /* baud rate definitions */
69*ae115bc7Smrj #define	DLAB		0x80	/* divisor latch access bit */
70*ae115bc7Smrj #define	ASY110		1047	/* 110 baud rate for serial console */
71*ae115bc7Smrj #define	ASY150		768	/* 150 baud rate for serial console */
72*ae115bc7Smrj #define	ASY300		384	/* 300 baud rate for serial console */
73*ae115bc7Smrj #define	ASY600		192	/* 600 baud rate for serial console */
74*ae115bc7Smrj #define	ASY1200		96	/* 1200 baud rate for serial console */
75*ae115bc7Smrj #define	ASY2400		48	/* 2400 baud rate for serial console */
76*ae115bc7Smrj #define	ASY4800		24	/* 4800 baud rate for serial console */
77*ae115bc7Smrj #define	ASY9600		12	/* 9600 baud rate for serial console */
78*ae115bc7Smrj #define	ASY19200	6	/* 19200 baud rate for serial console */
79*ae115bc7Smrj #define	ASY38400	3	/* 38400 baud rate for serial console */
80*ae115bc7Smrj #define	ASY57600	2	/* 57600 baud rate for serial console */
81*ae115bc7Smrj #define	ASY115200	1	/* 115200 baud rate for serial console */
82*ae115bc7Smrj 
83*ae115bc7Smrj 
84*ae115bc7Smrj /*
85*ae115bc7Smrj  *  Defines for the serial port
86*ae115bc7Smrj  */
87*ae115bc7Smrj 
88*ae115bc7Smrj #define	SERIAL_FIFO_FLUSH	16	/* maximum number of chars to flush */
89*ae115bc7Smrj 
90*ae115bc7Smrj /* ---- Bit 11 defines direct serial port ---- */
91*ae115bc7Smrj #define	SDIRECT		0x1000
92*ae115bc7Smrj 
93*ae115bc7Smrj /* ---- Bits 9-10 define flow control ---- */
94*ae115bc7Smrj #define	SSOFT		0x800
95*ae115bc7Smrj #define	SHARD		0x400
96*ae115bc7Smrj 
97*ae115bc7Smrj /* ---- Bits 5-8 define baud rate ---- */
98*ae115bc7Smrj #define	S110		0x00
99*ae115bc7Smrj #define	S150		0x20
100*ae115bc7Smrj #define	S300		0x40
101*ae115bc7Smrj #define	S600		0x60
102*ae115bc7Smrj #define	S1200		0x80
103*ae115bc7Smrj #define	S2400		0xa0
104*ae115bc7Smrj #define	S4800		0xc0
105*ae115bc7Smrj #define	S9600		0xe0
106*ae115bc7Smrj #define	S19200		0x100
107*ae115bc7Smrj #define	S38400		0x120
108*ae115bc7Smrj #define	S57600		0x140
109*ae115bc7Smrj #define	S76800		0x160
110*ae115bc7Smrj #define	S115200		0x180
111*ae115bc7Smrj #define	S153600		0x1a0
112*ae115bc7Smrj #define	S230400		0x1c0
113*ae115bc7Smrj #define	S307200		0x1e0
114*ae115bc7Smrj #define	S460800		0x200
115*ae115bc7Smrj 
116*ae115bc7Smrj /* ---- Bits 3 & 4 are parity ---- */
117*ae115bc7Smrj #define	PARITY_NONE	0x10
118*ae115bc7Smrj #define	PARITY_ODD	0x08
119*ae115bc7Smrj #define	PARITY_EVEN	0x18
120*ae115bc7Smrj 
121*ae115bc7Smrj /* ---- Bit 2 is stop bit ---- */
122*ae115bc7Smrj #define	STOP_1		0x00
123*ae115bc7Smrj #define	STOP_2		0x04
124*ae115bc7Smrj 
125*ae115bc7Smrj /* ---- Bits 0 & 1 are data bits ---- */
126*ae115bc7Smrj #define	DATA_8		0x03
127*ae115bc7Smrj #define	DATA_7		0x02
128*ae115bc7Smrj #define	DATA_6		0x01
129*ae115bc7Smrj #define	DATA_5		0x00
130*ae115bc7Smrj 
131*ae115bc7Smrj /* ---- Line Status ---- */
132*ae115bc7Smrj #define	SERIAL_TIMEOUT	0x80
133*ae115bc7Smrj #define	SERIAL_XMITSHFT	0x40
134*ae115bc7Smrj #define	SERIAL_XMITHOLD	0x20
135*ae115bc7Smrj #define	SERIAL_BREAK	0x10
136*ae115bc7Smrj #define	SERIAL_FRAME	0x08
137*ae115bc7Smrj #define	SERIAL_PARITY	0x04
138*ae115bc7Smrj #define	SERIAL_OVERRUN	0x02
139*ae115bc7Smrj #define	SERIAL_DATA	0x01
140*ae115bc7Smrj 
141*ae115bc7Smrj 
142*ae115bc7Smrj #ifdef __cplusplus
143*ae115bc7Smrj }
144*ae115bc7Smrj #endif
145*ae115bc7Smrj 
146*ae115bc7Smrj #endif	/* _BOOT_SERIAL_H */
147