summaryrefslogtreecommitdiff
path: root/src/southbridge/via/vt8237r/acpi/irqlinks.asl
blob: 6c4c89a77fbd0d4e1aa2a34e1cb663f01ff43f4f (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
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2017 Lubomir Rintel <lkundrak@v3.sk>
 *
 * 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, either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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.
 */

#include <arch/x86/acpi/statdef.asl>

/* Possible PNP IRQs */
Name (PIRQ, ResourceTemplate () {
	IRQ (Level, ActiveLow, Shared) {3, 4, 6, 7, 10, 11, 12}
})

#define IRQ_LINK(reg)						\
	Name (_HID, EisaId ("PNP0C0F"))				\
	Name (_UID, 1)						\
								\
	Method (_STA, 0) {					\
		If (LEqual (reg, 0x00)) {			\
			Return (STA_DISABLED)			\
		}						\
		Return (STA_INVISIBLE)				\
	}							\
								\
	Method (_PRS, 0) {					\
		Return (PIRQ)					\
	}							\
								\
	Name (CRSA, ResourceTemplate () {			\
		IRQ (Level, ActiveLow, Shared) {}		\
	})							\
	Method (_CRS, 0) {					\
		CreateWordField (CRSA, 0x1, AINT)		\
		ShiftLeft (One, reg, AINT)			\
		Return (CRSA)					\
	}							\
								\
	Method (_SRS, 1) {					\
		CreateWordField (Arg0, 0x1, AINT)		\
		Store (Zero, Local0)				\
		Store (AINT, Local1)				\
		While (LNotEqual (Local1, One)) {		\
			ShiftRight (Local1, One, Local1)	\
			Increment (Local0)			\
		}						\
		Store (Local0, reg)				\
	}							\
								\
	Method (_DIS, 0) {					\
		Store (Zero, reg)				\
	}							\

Device (LNKA) { IRQ_LINK (INTA) }
Device (LNKB) { IRQ_LINK (INTB) }
Device (LNKC) { IRQ_LINK (INTC) }
Device (LNKD) { IRQ_LINK (INTD) }