Debian Codegraph @

src/soc/intel/common/acpi/acpi_debug.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #if CONFIG(ACPI_CONSOLE)
4
5 #include <soc/iomap.h>
6
7 Name (UFLG, CONFIG(CONSOLE_SERIAL))
8
9 Method (LURT, 1, Serialized)
10 {
11 If (Arg0 == 0) { /* 0 = 0x3f8 */
12 Local0 = 0x3f8
13 } ElseIf (Arg0 == 1) { /* 1 = 0x2f8 */
14 Local0 = 0x2f8
15 } ElseIf (Arg0 == 2) { /* 2 = 0x3e8 */
16 Local0 = 0x3e8
17 } ElseIf (Arg0 == 3) { /* 3 = 0x2e8 */
18 Local0 = 0x2e8
19 }
20 Return (Local0)
21 }
22
23 #if CONFIG(DRIVERS_UART_8250MEM_32)
24 OperationRegion (UBAR, SystemMemory,
25 CONFIG_CONSOLE_UART_BASE_ADDRESS, 24)
26 Field (UBAR, AnyAcc, NoLock, Preserve)
27 {
28 TDR, 8, /* Transmit Data Register BAR + 0x000 */
29 , 24,
30 IER, 8, /* Interrupt Enable Register BAR + 0x004 */
31 , 24,
32 IIR, 8, /* Interrupt Identification Register BAR + 0x008 */
33 , 24,
34 LCR, 8, /* Line Control Register BAR + 0x00C */
35 , 24,
36 MCR, 8, /* Modem Control Register BAR + 0x010 */
37 , 24,
38 LSR, 8, /* Line Status Register BAR + 0x014 */
39 , 24
40 }
41 #else
42 OperationRegion (UBAR, SystemIO, LURT (CONFIG_UART_FOR_CONSOLE), 6)
43 Field (UBAR, ByteAcc, NoLock, Preserve)
44 {
45 TDR, 8, /* Transmit Data Register IO Port + 0x0 */
46 IER, 8, /* Interrupt Enable Register IO Port + 0x1 */
47 IIR, 8, /* Interrupt Identification Register IO Port + 0x2 */
48 LCR, 8, /* Line Control Register IO Port + 0x3 */
49 MCR, 8, /* Modem Control Register IO Port + 0x4 */
50 LSR, 8 /* Line Status Register IO Port + 0x5 */
51 }
52 #endif
53
54 Method (APRT, 1, Serialized)
55 {
56 Name(OPDT, 0)
57 Name(INDX, 0)
58 Name(LENG, 0)
59 Name(ADBG, Buffer(256) {0})
60
61 If (ObjectType(Arg0) == 1) { /* Integer */
62 ToHexString(Arg0, Local0)
63 ADBG = Local0
64 } ElseIf (ObjectType(Arg0) == 2) { /* String */
65 ADBG = Arg0
66 } ElseIf (ObjectType(Arg0) == 3) { /* Buffer */
67 ToHexString(Arg0, ADBG)
68 } Else {
69 ADBG = "This type of object is not supported"
70 }
71
72 While (DeRefOf(ADBG[INDX]) != 0)
73 {
74 INDX++
75 }
76 LENG = INDX /* Length of the String */
77
78 If (UFLG == 0) {
79 /* Enable Baud Rate Divisor Latch, Set Word length to 8 bit*/
80 LCR = 0x83
81 IIR = 0x01
82 MCR = 0x03
83
84 /* Configure baud rate to 115200 */
85 TDR = 0x01
86 IER = 0x00
87 LCR = 0x03 /* Disable Baud Rate Divisor Latch */
88
89 UFLG++
90 }
91 INDX = 0x00
92 While (INDX < LENG)
93 {
94 /* Wait for the transmitter t to be ready */
95 While (1)
96 {
97 OPDT = LSR & 0x20
98 If (OPDT != 0)
99 {
100 Break
101 }
102 }
103 TDR = DeRefOf (ADBG[INDX])
104 INDX++
105 }
106 } /* End of APRT */
107
108 #endif