2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
3 * Copyright (C) 2016 Bin Meng <bmeng.cn@gmail.com>
5 * Modified from coreboot src/arch/x86/acpi/debug.asl
7 * SPDX-License-Identifier: GPL-2.0+
10 /* POST register region */
11 OperationRegion(X80, SystemIO, 0x80, 1)
12 Field(X80, ByteAcc, NoLock, Preserve)
17 /* Legacy serial port register region */
18 OperationRegion(CREG, SystemIO, 0x3F8, 8)
19 Field(CREG, ByteAcc, NoLock, Preserve)
29 /* DINI - Initialize the serial port to 115200 8-N-1 */
33 Store(0x01, CDAT) /* 115200 baud (low) */
34 Store(0x00, CDLM) /* 115200 baud (high) */
35 Store(0x03, CLCR) /* word=8 stop=1 parity=none */
36 Store(0x03, CMCR) /* DTR=1 RTS=1 out1/2=Off loop=Off */
37 Store(0x00, CDLM) /* turn off interrupts */
40 /* THRE - Wait for serial port transmitter holding register to go empty */
43 And(CLSR, 0x20, Local0)
44 While (LEqual(Local0, Zero)) {
45 And(CLSR, 0x20, Local0)
49 /* OUTX - Send a single raw character */
56 /* OUTC - Send a single character, expanding LF into CR/LF */
59 If (LEqual(Arg0, 0x0a)) {
65 /* DBGN - Send a single hex nibble */
68 And(Arg0, 0x0f, Local0)
69 If (LLess(Local0, 10)) {
70 Add(Local0, 0x30, Local0)
72 Add(Local0, 0x37, Local0)
77 /* DBGB - Send a hex byte */
80 ShiftRight(Arg0, 4, Local0)
85 /* DBGW - Send a hex word */
88 ShiftRight(Arg0, 8, Local0)
93 /* DBGD - Send a hex dword */
96 ShiftRight(Arg0, 16, Local0)
101 /* Get a char from a string */
104 CreateByteField(Arg0, Arg1, DBGC)
108 /* DBGO - Send either a string or an integer */
109 Method(DBGO, 1, Serialized)
111 If (LEqual(ObjectType(Arg0), 1)) {
112 If (LGreater(Arg0, 0xffff)) {
115 If (LGreater(Arg0, 0xff)) {
122 Name(BDBG, Buffer(80) {})
126 Store(GETC(BDBG, Local1), Local0)
127 If (LEqual(Local0, 0)) {