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