1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2008 Advanced Micro Devices, Inc.
4 * Copyright (C) 2016 Bin Meng <bmeng.cn@gmail.com>
6 * Modified from coreboot src/arch/x86/acpi/debug.asl
9 /* POST register region */
10 OperationRegion(X80, SystemIO, 0x80, 1)
11 Field(X80, ByteAcc, NoLock, Preserve)
16 /* Legacy serial port register region */
17 OperationRegion(CREG, SystemIO, 0x3F8, 8)
18 Field(CREG, ByteAcc, NoLock, Preserve)
28 /* DINI - Initialize the serial port to 115200 8-N-1 */
32 Store(0x01, CDAT) /* 115200 baud (low) */
33 Store(0x00, CDLM) /* 115200 baud (high) */
34 Store(0x03, CLCR) /* word=8 stop=1 parity=none */
35 Store(0x03, CMCR) /* DTR=1 RTS=1 out1/2=Off loop=Off */
36 Store(0x00, CDLM) /* turn off interrupts */
39 /* THRE - Wait for serial port transmitter holding register to go empty */
42 And(CLSR, 0x20, Local0)
43 While (LEqual(Local0, Zero)) {
44 And(CLSR, 0x20, Local0)
48 /* OUTX - Send a single raw character */
55 /* OUTC - Send a single character, expanding LF into CR/LF */
58 If (LEqual(Arg0, 0x0a)) {
64 /* DBGN - Send a single hex nibble */
67 And(Arg0, 0x0f, Local0)
68 If (LLess(Local0, 10)) {
69 Add(Local0, 0x30, Local0)
71 Add(Local0, 0x37, Local0)
76 /* DBGB - Send a hex byte */
79 ShiftRight(Arg0, 4, Local0)
84 /* DBGW - Send a hex word */
87 ShiftRight(Arg0, 8, Local0)
92 /* DBGD - Send a hex dword */
95 ShiftRight(Arg0, 16, Local0)
100 /* Get a char from a string */
103 CreateByteField(Arg0, Arg1, DBGC)
107 /* DBGO - Send either a string or an integer */
108 Method(DBGO, 1, Serialized)
110 If (LEqual(ObjectType(Arg0), 1)) {
111 If (LGreater(Arg0, 0xffff)) {
114 If (LGreater(Arg0, 0xff)) {
121 Name(BDBG, Buffer(80) {})
125 Store(GETC(BDBG, Local1), Local0)
126 If (LEqual(Local0, 0)) {