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.
47 OperationRegion(X80, SystemIO, 0x80, 1)
48 Field(X80, ByteAcc, NoLock, Preserve)
53 OperationRegion(CREG, SystemIO, 0x3F8, 8)
54 Field(CREG, ByteAcc, NoLock, Preserve)
57 CDLM, 8,, 8, DLCR, 8, CMCR, 8, CLSR, 8
62 * Initialize the COM port to 115,200 8-N-1
67 store(0x01, CDAT) /* 115200 baud (low) */
68 store(0x00, CDLM) /* 115200 baud (high) */
69 store(0x03, DLCR) /* word=8 stop=1 parity=none */
70 store(0x03, CMCR) /* DTR=1 RTS=1 Out2=Off Loop=Off */
71 store(0x00, CDLM) /* turn off interrupts */
76 * Wait for COM port transmitter holding register to go empty
80 and(CLSR, 0x20, local0)
81 while (Lequal(local0, Zero)) {
82 and(CLSR, 0x20, local0)
88 * Send a single raw character
98 * Send a single character, expanding LF into CR/LF
102 if (LEqual(Arg0, 0x0a)) {
110 * Send a single hex nibble
114 and(Arg0, 0x0f, Local0)
115 if (LLess(Local0, 10)) {
116 add(Local0, 0x30, Local0)
118 add(Local0, 0x37, Local0)
129 ShiftRight(Arg0, 4, Local0)
140 ShiftRight(Arg0, 8, Local0)
151 ShiftRight(Arg0, 16, Local0)
158 * Send either a string or an integer
163 if (LEqual(ObjectType(Arg0), 1)) {
164 if (LGreater(Arg0, 0xffff)) {
167 if (LGreater(Arg0, 0xff)) {
174 Name(BDBG, Buffer(80) {})
178 store(GETC(BDBG, Local1), Local0)
179 if (LEqual(Local0, 0)) {
189 /* Get a char from a string */
192 CreateByteField(Arg0, Arg1, DBGC)