summaryrefslogtreecommitdiff
path: root/src/superio/acpi/pnp_uart.asl
blob: f42cc42039b656ae38ad1854d25454a21c87604c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2011 Christoph Grenz <christophg+cb@grenz-bonn.de>
 * Copyright (C) 2013 secunet Security Networks AG
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/* ========================== UART ========================== */

/*
 * Generic setup for 16550A compatible UARTs.
 *
 * Controlled by the following preprocessor defines:
 *
 * SUPERIO_CHIP_NAME	The name of the super i/o chip (unique, required)
 * SUPERIO_UART_LDN	The logical device number on the super i/o
 *			chip for this UART (required)
 * SUPERIO_UART_DDN	A string literal that identifies the dos device
 *                      name (DDN) of this uart (e.g. "COM1", optional)
 * SUPERIO_UART_PM_REG	Identifier of a 1-bit register to power down
 *			the UART (optional)
 * SUPERIO_UART_PM_VAL	The value for SUPERIO_UART_PM_REG to power the logical
 *			device down (required if SUPERIO_UART_PM_REG is defined)
 * SUPERIO_UART_PM_LDN	The logical device number to access the PM_REG
 *			bit (required if SUPERIO_UART_PM_REG is defined)
 */

#include "pnp.asl"

#ifndef SUPERIO_CHIP_NAME
# error "SUPERIO_CHIP_NAME is not defined."
#endif

#ifndef SUPERIO_UART_LDN
# error "SUPERIO_UART_LDN is not defined."
#endif

Device (SUPERIO_ID(SER, SUPERIO_UART_LDN)) {
	Name (_HID, EisaId ("PNP0501"))
	Name (_UID, SUPERIO_UID(SER, SUPERIO_UART_LDN))
	#ifdef SUPERIO_UART_DDN
	Name (_DDN, SUPERIO_UART_DDN)
	#endif

	Method (_STA)
	{
		PNP_GENERIC_STA(SUPERIO_UART_LDN)
	}

	Method (_DIS)
	{
		PNP_GENERIC_DIS(SUPERIO_UART_LDN)
	}

#ifdef SUPERIO_UART_PM_REG
	Method (_PSC) {
		PNP_GENERIC_PSC(SUPERIO_UART_PM_REG, SUPERIO_UART_PM_VAL, SUPERIO_UART_PM_LDN)
	}

	Method (_PS0) {
		PNP_GENERIC_PS0(SUPERIO_UART_PM_REG, SUPERIO_UART_PM_VAL, SUPERIO_UART_PM_LDN)
	}

	Method (_PS1) {
		PNP_GENERIC_PS1(SUPERIO_UART_PM_REG, SUPERIO_UART_PM_VAL, SUPERIO_UART_PM_LDN)
	}
#else
	Method (_PSC) {
		PNP_DEFAULT_PSC
	}
#endif

	Method (_CRS, 0, Serialized)
	{
		Name (CRS, ResourceTemplate () {
			IO (Decode16, 0x0000, 0x0000, 0x08, 0x08, IO0)
			IRQNoFlags (IR0) {}
		})
		ENTER_CONFIG_MODE (SUPERIO_UART_LDN)
		  PNP_READ_IO(PNP_IO0, CRS, IO0)
		  PNP_READ_IRQ(PNP_IRQ0, CRS, IR0)
		EXIT_CONFIG_MODE ()
		Return (CRS)
	}

	Name (_PRS, ResourceTemplate ()
	{
		StartDependentFn (0,0) {
			IO (Decode16, 0x03f8, 0x03f8, 0x08, 0x08)
			IRQNoFlags () {3,4,5,7,9,10,11,12}
		}
		StartDependentFn (0,0) {
			IO (Decode16, 0x02f8, 0x02f8, 0x08, 0x08)
			IRQNoFlags () {3,4,5,7,9,10,11,12}
		}
		StartDependentFn (1,0) {
			IO (Decode16, 0x03e8, 0x03e8, 0x08, 0x08)
			IRQNoFlags () {3,4,5,7,9,10,11,12}
		}
		StartDependentFn (1,0) {
			IO (Decode16, 0x02e8, 0x02e8, 0x08, 0x08)
			IRQNoFlags () {3,4,5,7,9,10,11,12}
		}
		StartDependentFn (2,0) {
			IO (Decode16, 0x0100, 0x0ff8, 0x08, 0x08)
			IRQNoFlags () {3,4,5,7,9,10,11,12}
		}
		EndDependentFn()
	})

	Method (_SRS, 1, Serialized)
	{
		Name (TMPL, ResourceTemplate () {
			IO (Decode16, 0x0000, 0x0000, 0x00, 0x00, IO0)
			IRQNoFlags (IR0) {}
		})
		ENTER_CONFIG_MODE (SUPERIO_UART_LDN)
		  PNP_WRITE_IO(PNP_IO0, Arg0, IO0)
		  PNP_WRITE_IRQ(PNP_IRQ0, Arg0, IR0)
		  Store (One, PNP_DEVICE_ACTIVE)
		EXIT_CONFIG_MODE ()
	}
}