tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / arch / x86 / acpi / debug.asl
blob44c37bb9a0c70b8719b5a6c46371d5e4d1de973d
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008 Advanced Micro Devices, Inc.
5  *
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.
9  *
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.
14  */
17         DefinitionBlock (
18                 "DSDT.AML",
19                 "DSDT",
20                 0x01,
21                 "XXXXXX",
22                 "XXXXXXXX",
23                 0x00010001
24                 )
25         {
26                 #include "debug.asl"
27         }
31 * 0x80: POST_BASE
32 * 0x3F8: DEBCOM_BASE
33 * X80: POST_REGION
34 * P80: PORT80
36 * CREG: DEBCOM_REGION
37 * CUAR: DEBCOM_UART
38 * CDAT: DEBCOM_DATA
39 * CDLM: DEBCOM_DLM
40 * DLCR: DEBCOM_LCR
41 * CMCR: DEBCOM_MCR
42 * CLSR: DEBCOM_LSR
44 * DEBUG_INIT    DINI
47 OperationRegion(X80, SystemIO, 0x80, 1)
48         Field(X80, ByteAcc, NoLock, Preserve)
50         P80, 8
53 OperationRegion(CREG, SystemIO, 0x3F8, 8)
54         Field(CREG, ByteAcc, NoLock, Preserve)
56         CDAT, 8,
57         CDLM, 8,, 8, DLCR, 8, CMCR, 8, CLSR, 8
61 * DINI
62 * Initialize the COM port to 115,200 8-N-1
64 Method(DINI)
66         store(0x83, DLCR)
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 */
75 * THRE
76 * Wait for COM port transmitter holding register to go empty
78 Method(THRE)
80         and(CLSR, 0x20, local0)
81         while (Lequal(local0, Zero)) {
82                 and(CLSR, 0x20, local0)
83         }
87 * OUTX
88 * Send a single raw character
90 Method(OUTX, 1)
92         THRE()
93         store(Arg0, CDAT)
97 * OUTC
98 * Send a single character, expanding LF into CR/LF
100 Method(OUTC, 1)
102         if (LEqual(Arg0, 0x0a)) {
103                 OUTX(0x0d)
104         }
105         OUTX(Arg0)
109 * DBGN
110 * Send a single hex nibble
112 Method(DBGN, 1)
114         and(Arg0, 0x0f, Local0)
115         if (LLess(Local0, 10)) {
116                 add(Local0, 0x30, Local0)
117         } else {
118                 add(Local0, 0x37, Local0)
119         }
120         OUTC(Local0)
124 * DBGB
125 * Send a hex byte
127 Method(DBGB, 1)
129         ShiftRight(Arg0, 4, Local0)
130         DBGN(Local0)
131         DBGN(Arg0)
135 * DBGW
136 * Send a hex word
138 Method(DBGW, 1)
140         ShiftRight(Arg0, 8, Local0)
141         DBGB(Local0)
142         DBGB(Arg0)
146 * DBGD
147 * Send a hex Dword
149 Method(DBGD, 1)
151         ShiftRight(Arg0, 16, Local0)
152         DBGW(Local0)
153         DBGW(Arg0)
157 * DBGO
158 * Send either a string or an integer
160 Method(DBGO, 1)
162         /* DINI() */
163         if (LEqual(ObjectType(Arg0), 1)) {
164                 if (LGreater(Arg0, 0xffff)) {
165                         DBGD(Arg0)
166                 } else {
167                         if (LGreater(Arg0, 0xff)) {
168                                 DBGW(Arg0)
169                         } else {
170                                 DBGB(Arg0)
171                         }
172                 }
173         } else {
174                 Name(BDBG, Buffer(80) {})
175                 store(Arg0, BDBG)
176                 store(0, Local1)
177                 while (One) {
178                         store(GETC(BDBG, Local1), Local0)
179                         if (LEqual(Local0, 0)) {
180                                 return (0)
181                         }
182                         OUTC(Local0)
183                         Increment(Local1)
184                 }
185         }
186         return (0)
189 /* Get a char from a string */
190 Method(GETC, 2)
192         CreateByteField(Arg0, Arg1, DBGC)
193         return (DBGC)