Angel Pons | 5f1bf2f | 2020-04-03 01:21:16 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 3 | |
Elyes HAOUAS | 4ad1446 | 2018-06-16 18:29:33 +0200 | [diff] [blame] | 4 | #include <southbridge/intel/i82371eb/i82371eb.h> |
Tobias Diedrich | ca6d808 | 2010-11-29 20:40:33 +0000 | [diff] [blame] | 5 | |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 6 | #define SUPERIO_PNP_BASE 0x3F0 |
| 7 | #define SUPERIO_SHOW_UARTA |
| 8 | #define SUPERIO_SHOW_UARTB |
| 9 | #define SUPERIO_SHOW_FDC |
| 10 | #define SUPERIO_SHOW_LPT |
| 11 | |
Elyes HAOUAS | 6d19a20 | 2018-11-22 11:15:29 +0100 | [diff] [blame] | 12 | #include <arch/acpi.h> |
| 13 | DefinitionBlock ("DSDT.aml", "DSDT", 2, OEM_ID, ACPI_TABLE_CREATOR, 1) |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 14 | { |
Michał Żygowski | 9550e97 | 2020-03-20 13:56:46 +0100 | [diff] [blame] | 15 | /* \_SB scope defining the main processor is generated in SSDT. */ |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 16 | |
| 17 | OperationRegion(X80, SystemIO, 0x80, 1) |
| 18 | Field(X80, ByteAcc, NoLock, Preserve) |
| 19 | { |
| 20 | P80, 8 |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | * For now only define 2 power states: |
| 25 | * - S0 which is fully on |
| 26 | * - S5 which is soft off |
| 27 | * Any others would involve declaring the wake up methods. |
| 28 | */ |
| 29 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 30 | /* |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 31 | * Intel 82371EB (PIIX4E) datasheet, section 7.2.3, page 142 |
| 32 | * |
| 33 | * 0: soft off/suspend to disk S5 |
| 34 | * 1: suspend to ram S3 |
| 35 | * 2: powered on suspend, context lost S2 |
| 36 | * Note: 'context lost' means the CPU restarts at the reset |
| 37 | * vector |
| 38 | * 3: powered on suspend, CPU context lost S1 |
| 39 | * Note: Looks like 'CPU context lost' does _not_ mean the |
| 40 | * CPU restarts at the reset vector. Most likely only |
Elyes HAOUAS | 8ab989e | 2016-07-30 17:46:17 +0200 | [diff] [blame] | 41 | * caches are lost, so both 0x3 and 0x4 map to ACPI S1 |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 42 | * 4: powered on suspend, context maintained S1 |
| 43 | * 5: working (clock control) S0 |
| 44 | * 6: reserved |
| 45 | * 7: reserved |
| 46 | */ |
Keith Hui | d6d9a4e | 2020-02-02 18:33:52 -0500 | [diff] [blame] | 47 | /* Guard these entries for the purpose of variant validation. They will be aligned later. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 48 | Name (\_S0, Package () { 0x05, 0x05, 0x00, 0x00 }) |
Keith Hui | d6d9a4e | 2020-02-02 18:33:52 -0500 | [diff] [blame] | 49 | #if CONFIG(BOARD_ASUS_P2B) |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 50 | Name (\_S1, Package () { 0x03, 0x03, 0x00, 0x00 }) |
| 51 | Name (\_S5, Package () { 0x00, 0x00, 0x00, 0x00 }) |
Keith Hui | d6d9a4e | 2020-02-02 18:33:52 -0500 | [diff] [blame] | 52 | #endif |
| 53 | #if CONFIG(BOARD_ASUS_P2B_LS) |
| 54 | Name (\_S5, Package () { 0x00, 0x06, 0x00, 0x00 }) |
| 55 | #endif |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 56 | |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 57 | OperationRegion (GPOB, SystemIO, DEFAULT_PMBASE+DEVCTL, 0x10) |
| 58 | Field (GPOB, ByteAcc, NoLock, Preserve) |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 59 | { |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 60 | Offset (0x03), |
| 61 | TO12, 1, /* Device trap 12 */ |
| 62 | Offset (0x08), |
| 63 | FANM, 1, /* GPO0, meant for fan */ |
| 64 | Offset (0x09), |
| 65 | PLED, 1, /* GPO8, meant for power LED. Per PIIX4 datasheet */ |
| 66 | , 3, /* this goes low when power is cut from its core. */ |
| 67 | , 2, |
| 68 | , 16, |
| 69 | MSG0, 1 /* GPO30, message LED */ |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 70 | } |
| 71 | |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 72 | /* Prepare To Sleep, Arg0 is target S-state */ |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 73 | Method (\_PTS, 1, NotSerialized) |
| 74 | { |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 75 | /* Disable fan, blink power LED, if not turning off */ |
| 76 | If (LNotEqual (Arg0, 0x05)) |
| 77 | { |
| 78 | Store (Zero, FANM) |
| 79 | Store (Zero, PLED) |
| 80 | } |
| 81 | |
| 82 | /* Arms SMI for device 12 */ |
| 83 | Store (One, TO12) |
| 84 | /* Put out a POST code */ |
| 85 | Or (Arg0, 0xF0, P80) |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | Method (\_WAK, 1, NotSerialized) |
| 89 | { |
| 90 | /* Re-enable fan, stop power led blinking */ |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 91 | Store (One, FANM) |
Tobias Diedrich | 4e22a3b | 2010-12-13 22:39:46 +0100 | [diff] [blame] | 92 | Store (One, PLED) |
| 93 | /* wake OK */ |
| 94 | Return(Package(0x02){0x00, 0x00}) |
| 95 | } |
| 96 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 97 | /* Root of the bus hierarchy */ |
| 98 | Scope (\_SB) |
| 99 | { |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 100 | Device (PWRB) |
| 101 | { |
| 102 | /* Power Button Device */ |
| 103 | Name (_HID, EisaId ("PNP0C0C")) |
| 104 | Method (_STA, 0, NotSerialized) |
| 105 | { |
| 106 | Return (0x0B) |
| 107 | } |
| 108 | } |
Elyes HAOUAS | 65bb543 | 2018-07-03 14:59:50 +0200 | [diff] [blame] | 109 | #include <southbridge/intel/i82371eb/acpi/intx.asl> |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 110 | |
| 111 | PCI_INTX_DEV(LNKA, \_SB.PCI0.PX40.PIRA, 1) |
| 112 | PCI_INTX_DEV(LNKB, \_SB.PCI0.PX40.PIRB, 2) |
| 113 | PCI_INTX_DEV(LNKC, \_SB.PCI0.PX40.PIRC, 3) |
| 114 | PCI_INTX_DEV(LNKD, \_SB.PCI0.PX40.PIRD, 4) |
| 115 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 116 | /* Top PCI device */ |
| 117 | Device (PCI0) |
| 118 | { |
| 119 | Name (_HID, EisaId ("PNP0A03")) |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 120 | Name (_UID, 0x00) |
| 121 | Name (_BBN, 0x00) |
| 122 | |
| 123 | /* PCI Routing Table */ |
| 124 | Name (_PRT, Package () { |
| 125 | Package (0x04) { 0x0001FFFF, 0, LNKA, 0 }, |
| 126 | Package (0x04) { 0x0001FFFF, 1, LNKB, 0 }, |
| 127 | Package (0x04) { 0x0001FFFF, 2, LNKC, 0 }, |
| 128 | Package (0x04) { 0x0001FFFF, 3, LNKD, 0 }, |
| 129 | |
| 130 | Package (0x04) { 0x0004FFFF, 0, LNKA, 0 }, |
| 131 | Package (0x04) { 0x0004FFFF, 1, LNKB, 0 }, |
| 132 | Package (0x04) { 0x0004FFFF, 2, LNKC, 0 }, |
| 133 | Package (0x04) { 0x0004FFFF, 3, LNKD, 0 }, |
| 134 | |
Keith Hui | d6d9a4e | 2020-02-02 18:33:52 -0500 | [diff] [blame] | 135 | #if CONFIG(BOARD_ASUS_P2B_LS) |
| 136 | Package (0x04) { 0x0006FFFF, 0, LNKD, 0 }, |
| 137 | Package (0x04) { 0x0006FFFF, 1, LNKA, 0 }, |
| 138 | Package (0x04) { 0x0006FFFF, 2, LNKB, 0 }, |
| 139 | Package (0x04) { 0x0006FFFF, 3, LNKC, 0 }, |
| 140 | #endif |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 141 | Package (0x04) { 0x0009FFFF, 0, LNKD, 0 }, |
| 142 | Package (0x04) { 0x0009FFFF, 1, LNKA, 0 }, |
| 143 | Package (0x04) { 0x0009FFFF, 2, LNKB, 0 }, |
| 144 | Package (0x04) { 0x0009FFFF, 3, LNKC, 0 }, |
| 145 | |
| 146 | Package (0x04) { 0x000AFFFF, 0, LNKC, 0 }, |
| 147 | Package (0x04) { 0x000AFFFF, 1, LNKD, 0 }, |
| 148 | Package (0x04) { 0x000AFFFF, 2, LNKA, 0 }, |
| 149 | Package (0x04) { 0x000AFFFF, 3, LNKB, 0 }, |
| 150 | |
Keith Hui | d6d9a4e | 2020-02-02 18:33:52 -0500 | [diff] [blame] | 151 | #if CONFIG(BOARD_ASUS_P2B_LS) |
| 152 | Package (0x04) { 0x0007FFFF, 0, LNKC, 0 }, |
| 153 | Package (0x04) { 0x0007FFFF, 1, LNKD, 0 }, |
| 154 | Package (0x04) { 0x0007FFFF, 2, LNKA, 0 }, |
| 155 | Package (0x04) { 0x0007FFFF, 3, LNKB, 0 }, |
| 156 | #endif |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 157 | Package (0x04) { 0x000BFFFF, 0, LNKB, 0 }, |
| 158 | Package (0x04) { 0x000BFFFF, 1, LNKC, 0 }, |
| 159 | Package (0x04) { 0x000BFFFF, 2, LNKD, 0 }, |
| 160 | Package (0x04) { 0x000BFFFF, 3, LNKA, 0 }, |
| 161 | |
| 162 | Package (0x04) { 0x000CFFFF, 0, LNKA, 0 }, |
| 163 | Package (0x04) { 0x000CFFFF, 1, LNKB, 0 }, |
| 164 | Package (0x04) { 0x000CFFFF, 2, LNKC, 0 }, |
| 165 | Package (0x04) { 0x000CFFFF, 3, LNKD, 0 }, |
| 166 | |
| 167 | }) |
Elyes HAOUAS | 65bb543 | 2018-07-03 14:59:50 +0200 | [diff] [blame] | 168 | #include <northbridge/intel/i440bx/acpi/sb_pci0_crs.asl> |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 169 | |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 170 | /* Begin southbridge block */ |
| 171 | Device (PX40) |
| 172 | { |
| 173 | Name(_ADR, 0x00040000) |
| 174 | OperationRegion (PIRQ, PCI_Config, 0x60, 0x04) |
| 175 | Field (PIRQ, ByteAcc, NoLock, Preserve) |
| 176 | { |
| 177 | PIRA, 8, |
| 178 | PIRB, 8, |
| 179 | PIRC, 8, |
| 180 | PIRD, 8 |
| 181 | } |
| 182 | |
| 183 | /* PNP Motherboard Resources */ |
| 184 | Device (SYSR) |
| 185 | { |
| 186 | Name (_HID, EisaId ("PNP0C02")) |
| 187 | Method (_CRS, 0, NotSerialized) |
| 188 | { |
| 189 | Name (BUF1, ResourceTemplate () |
| 190 | { |
| 191 | /* PM register ports */ |
| 192 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x40, _Y06) |
| 193 | /* SMBus register ports */ |
| 194 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x10, _Y07) |
| 195 | /* PIIX4E ports */ |
| 196 | /* Aliased DMA ports */ |
| 197 | IO (Decode16, 0x0010, 0x0010, 0x01, 0x10, ) |
| 198 | /* Aliased PIC ports */ |
| 199 | IO (Decode16, 0x0022, 0x0022, 0x01, 0x1E, ) |
| 200 | /* Aliased timer ports */ |
| 201 | IO (Decode16, 0x0050, 0x0050, 0x01, 0x04, ) |
| 202 | IO (Decode16, 0x0062, 0x0062, 0x01, 0x02, ) |
| 203 | IO (Decode16, 0x0065, 0x0065, 0x01, 0x0B, ) |
| 204 | IO (Decode16, 0x0074, 0x0074, 0x01, 0x0C, ) |
| 205 | IO (Decode16, 0x0091, 0x0091, 0x01, 0x03, ) |
| 206 | IO (Decode16, 0x00A2, 0x00A2, 0x01, 0x1E, ) |
| 207 | IO (Decode16, 0x00E0, 0x00E0, 0x01, 0x10, ) |
| 208 | IO (Decode16, 0x0294, 0x0294, 0x01, 0x04, ) |
| 209 | IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x02, ) |
| 210 | IO (Decode16, 0x04D0, 0x04D0, 0x01, 0x02, ) |
| 211 | }) |
| 212 | CreateWordField (BUF1, _Y06._MIN, PMLO) |
| 213 | CreateWordField (BUF1, _Y06._MAX, PMRL) |
| 214 | CreateWordField (BUF1, _Y07._MIN, SBLO) |
| 215 | CreateWordField (BUF1, _Y07._MAX, SBRL) |
| 216 | |
| 217 | And (\_SB.PCI0.PX43.PM00, 0xFFFE, PMLO) |
| 218 | And (\_SB.PCI0.PX43.SB00, 0xFFFE, SBLO) |
| 219 | Store (PMLO, PMRL) |
| 220 | Store (SBLO, SBRL) |
| 221 | Return (BUF1) |
| 222 | } |
| 223 | } |
Elyes HAOUAS | 65bb543 | 2018-07-03 14:59:50 +0200 | [diff] [blame] | 224 | #include <southbridge/intel/i82371eb/acpi/i82371eb.asl> |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 225 | } |
| 226 | Device (PX43) |
| 227 | { |
| 228 | Name (_ADR, 0x00040003) // _ADR: Address |
| 229 | OperationRegion (IPMU, PCI_Config, PMBA, 0x02) |
| 230 | Field (IPMU, ByteAcc, NoLock, Preserve) |
| 231 | { |
| 232 | PM00, 16 |
| 233 | } |
| 234 | |
| 235 | OperationRegion (ISMB, PCI_Config, SMBBA, 0x02) |
| 236 | Field (ISMB, ByteAcc, NoLock, Preserve) |
| 237 | { |
| 238 | SB00, 16 |
| 239 | } |
| 240 | } |
| 241 | |
Elyes HAOUAS | 2c5652d | 2018-10-14 10:51:13 +0200 | [diff] [blame] | 242 | #include <superio/winbond/w83977tf/acpi/superio.asl> |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 243 | } |
Keith Hui | 819005f | 2017-11-14 23:31:20 -0500 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | /* ACPI Message */ |
| 247 | Scope (\_SI) |
| 248 | { |
| 249 | Method (_MSG, 1, NotSerialized) |
| 250 | { |
| 251 | If (LEqual (Arg0, Zero)) |
| 252 | { |
| 253 | Store (One, MSG0) |
| 254 | } |
| 255 | Else |
| 256 | { |
| 257 | Store (Zero, MSG0) |
| 258 | } |
| 259 | } |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 260 | } |
| 261 | } |