2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
51 OperationRegion(X80, SystemIO, 0x80, 1)
52 Field(X80, ByteAcc, NoLock, Preserve)
57 OperationRegion(CREG, SystemIO, 0x3F8, 8)
58 Field(CREG, ByteAcc, NoLock, Preserve)
61 CDLM, 8,, 8, DLCR, 8, CMCR, 8, CLSR, 8
66 * Initialize the COM port to 115,200 8-N-1
71 store(0x01, CDAT) /* 115200 baud (low) */
72 store(0x00, CDLM) /* 115200 baud (high) */
73 store(0x03, DLCR) /* word=8 stop=1 parity=none */
74 store(0x03, CMCR) /* DTR=1 RTS=1 Out2=Off Loop=Off */
75 store(0x00, CDLM) /* turn off interrupts */
80 * Wait for COM port transmitter holding register to go empty
84 and(CLSR, 0x20, local0)
85 while (Lequal(local0, Zero)) {
86 and(CLSR, 0x20, local0)
92 * Send a single raw character
102 * Send a single character, expanding LF into CR/LF
106 if (LEqual(Arg0, 0x0a)) {
114 * Send a single hex nibble
118 and(Arg0, 0x0f, Local0)
119 if (LLess(Local0, 10)) {
120 add(Local0, 0x30, Local0)
122 add(Local0, 0x37, Local0)
133 ShiftRight(Arg0, 4, Local0)
144 ShiftRight(Arg0, 8, Local0)
155 ShiftRight(Arg0, 16, Local0)
162 * Send either a string or an integer
167 if (LEqual(ObjectType(Arg0), 1)) {
168 if (LGreater(Arg0, 0xffff)) {
171 if (LGreater(Arg0, 0xff)) {
178 Name(BDBG, Buffer(80) {})
182 store(GETC(BDBG, Local1), Local0)
183 if (LEqual(Local0, 0)) {
193 /* Get a char from a string */
196 CreateByteField(Arg0, Arg1, DBGC)