Patrick Georgi | afd4c87 | 2020-05-05 23:43:18 +0200 | [diff] [blame] | 1 | /* Bochs/QEMU ACPI DSDT ASL definition */ |
Elyes HAOUAS | 674ad92 | 2020-05-09 13:21:47 +0200 | [diff] [blame] | 2 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 3 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 4 | #include <acpi/acpi.h> |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 5 | DefinitionBlock ( |
Elyes HAOUAS | 37509d7 | 2020-10-01 17:11:56 +0200 | [diff] [blame] | 6 | "dsdt.aml", |
| 7 | "DSDT", |
Elyes HAOUAS | 90d00de | 2020-10-05 16:38:53 +0200 | [diff] [blame] | 8 | ACPI_DSDT_REV_1, |
Elyes HAOUAS | 6d19a20 | 2018-11-22 11:15:29 +0100 | [diff] [blame] | 9 | OEM_ID, |
| 10 | ACPI_TABLE_CREATOR, |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 11 | 0x1 // OEM Revision |
| 12 | ) |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 13 | { |
Kyösti Mälkki | cf246d5 | 2021-01-21 08:17:00 +0200 | [diff] [blame] | 14 | #include <acpi/dsdt_top.asl> |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 15 | |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 16 | #include "acpi/dbug.asl" |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 17 | |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 18 | |
| 19 | /**************************************************************** |
| 20 | * PCI Bus definition |
| 21 | ****************************************************************/ |
| 22 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 23 | Scope(\_SB) { |
| 24 | Device(PCI0) { |
| 25 | Name(_HID, EisaId("PNP0A03")) |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 26 | Name(_UID, 1) |
| 27 | } |
| 28 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 29 | |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 30 | #include "acpi/pci-crs.asl" |
| 31 | #include "acpi/hpet.asl" |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 32 | |
| 33 | |
| 34 | /**************************************************************** |
| 35 | * VGA |
| 36 | ****************************************************************/ |
| 37 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 38 | Scope(\_SB.PCI0) { |
| 39 | Device(VGA) { |
| 40 | Name(_ADR, 0x00020000) |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 41 | OperationRegion(PCIC, PCI_Config, 0, 0x4) |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 42 | Field(PCIC, DWordAcc, NoLock, Preserve) { |
| 43 | VEND, 32 |
| 44 | } |
| 45 | Method(_S1D, 0, NotSerialized) { |
| 46 | Return (0x00) |
| 47 | } |
| 48 | Method(_S2D, 0, NotSerialized) { |
| 49 | Return (0x00) |
| 50 | } |
| 51 | Method(_S3D, 0, NotSerialized) { |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 52 | If (VEND == 0x1001b36) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 53 | Return (0x03) // QXL |
| 54 | } Else { |
| 55 | Return (0x00) |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 60 | |
| 61 | |
| 62 | /**************************************************************** |
| 63 | * PIIX4 PM |
| 64 | ****************************************************************/ |
| 65 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 66 | Scope(\_SB.PCI0) { |
| 67 | Device(PX13) { |
| 68 | Name(_ADR, 0x00010003) |
| 69 | OperationRegion(P13C, PCI_Config, 0x00, 0xff) |
| 70 | } |
| 71 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 72 | |
| 73 | |
| 74 | /**************************************************************** |
| 75 | * PIIX3 ISA bridge |
| 76 | ****************************************************************/ |
| 77 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 78 | Scope(\_SB.PCI0) { |
| 79 | Device(ISA) { |
| 80 | Name(_ADR, 0x00010000) |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 81 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 82 | /* PIIX PCI to ISA irq remapping */ |
| 83 | OperationRegion(P40C, PCI_Config, 0x60, 0x04) |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 84 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 85 | /* enable bits */ |
| 86 | Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) { |
| 87 | Offset(0x5f), |
| 88 | , 7, |
| 89 | LPEN, 1, // LPT |
| 90 | Offset(0x67), |
| 91 | , 3, |
| 92 | CAEN, 1, // COM1 |
| 93 | , 3, |
| 94 | CBEN, 1, // COM2 |
| 95 | } |
| 96 | Name(FDEN, 1) |
| 97 | } |
| 98 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 99 | |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 100 | #include "acpi/isa.asl" |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 101 | |
| 102 | |
| 103 | /**************************************************************** |
| 104 | * PCI hotplug |
| 105 | ****************************************************************/ |
| 106 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 107 | Scope(\_SB.PCI0) { |
| 108 | OperationRegion(PCST, SystemIO, 0xae00, 0x08) |
| 109 | Field(PCST, DWordAcc, NoLock, WriteAsZeros) { |
| 110 | PCIU, 32, |
| 111 | PCID, 32, |
| 112 | } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 113 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 114 | OperationRegion(SEJ, SystemIO, 0xae08, 0x04) |
| 115 | Field(SEJ, DWordAcc, NoLock, WriteAsZeros) { |
| 116 | B0EJ, 32, |
| 117 | } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 118 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 119 | /* Methods called by bulk generated PCI devices below */ |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 120 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 121 | /* Methods called by hotplug devices */ |
| 122 | Method(PCEJ, 1, NotSerialized) { |
| 123 | // _EJ0 method - eject callback |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 124 | B0EJ = 1 << Arg0 |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 125 | Return (0x0) |
| 126 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 127 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 128 | /* Hotplug notification method supplied by SSDT */ |
| 129 | External(\_SB.PCI0.PCNT, MethodObj) |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 130 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 131 | /* PCI hotplug notify method */ |
| 132 | Method(PCNF, 0) { |
| 133 | // Local0 = iterator |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 134 | Local0 = 0 |
| 135 | While (Local0 < 31) { |
| 136 | Local0++ |
| 137 | If (PCIU & (1 << Local0)) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 138 | PCNT(Local0, 1) |
| 139 | } |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 140 | If (PCID & (1 << Local0)) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 141 | PCNT(Local0, 3) |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 146 | |
| 147 | |
| 148 | /**************************************************************** |
| 149 | * PCI IRQs |
| 150 | ****************************************************************/ |
| 151 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 152 | Scope(\_SB) { |
| 153 | Scope(PCI0) { |
| 154 | Name(_PRT, Package() { |
| 155 | /* PCI IRQ routing table, example from ACPI 2.0a specification, |
| 156 | section 6.2.8.1 */ |
| 157 | /* Note: we provide the same info as the PCI routing |
| 158 | table of the Bochs BIOS */ |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 159 | |
| 160 | #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \ |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 161 | Package() { nr##ffff, 0, lnk0, 0 }, \ |
| 162 | Package() { nr##ffff, 1, lnk1, 0 }, \ |
| 163 | Package() { nr##ffff, 2, lnk2, 0 }, \ |
| 164 | Package() { nr##ffff, 3, lnk3, 0 } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 165 | |
| 166 | #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC) |
| 167 | #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD) |
| 168 | #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA) |
| 169 | #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB) |
| 170 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 171 | prt_slot0(0x0000), |
| 172 | /* Device 1 is power mgmt device, and can only use irq 9 */ |
| 173 | prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD), |
| 174 | prt_slot2(0x0002), |
| 175 | prt_slot3(0x0003), |
| 176 | prt_slot0(0x0004), |
| 177 | prt_slot1(0x0005), |
| 178 | prt_slot2(0x0006), |
| 179 | prt_slot3(0x0007), |
| 180 | prt_slot0(0x0008), |
| 181 | prt_slot1(0x0009), |
| 182 | prt_slot2(0x000a), |
| 183 | prt_slot3(0x000b), |
| 184 | prt_slot0(0x000c), |
| 185 | prt_slot1(0x000d), |
| 186 | prt_slot2(0x000e), |
| 187 | prt_slot3(0x000f), |
| 188 | prt_slot0(0x0010), |
| 189 | prt_slot1(0x0011), |
| 190 | prt_slot2(0x0012), |
| 191 | prt_slot3(0x0013), |
| 192 | prt_slot0(0x0014), |
| 193 | prt_slot1(0x0015), |
| 194 | prt_slot2(0x0016), |
| 195 | prt_slot3(0x0017), |
| 196 | prt_slot0(0x0018), |
| 197 | prt_slot1(0x0019), |
| 198 | prt_slot2(0x001a), |
| 199 | prt_slot3(0x001b), |
| 200 | prt_slot0(0x001c), |
| 201 | prt_slot1(0x001d), |
| 202 | prt_slot2(0x001e), |
| 203 | prt_slot3(0x001f), |
| 204 | }) |
| 205 | } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 206 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 207 | Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) { |
| 208 | PRQ0, 8, |
| 209 | PRQ1, 8, |
| 210 | PRQ2, 8, |
| 211 | PRQ3, 8 |
| 212 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 213 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 214 | Method(IQST, 1, NotSerialized) { |
| 215 | // _STA method - get status |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 216 | If (0x80 & Arg0) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 217 | Return (0x09) |
| 218 | } |
| 219 | Return (0x0B) |
| 220 | } |
| 221 | Method(IQCR, 1, Serialized) { |
| 222 | // _CRS method - get current settings |
| 223 | Name(PRR0, ResourceTemplate() { |
| 224 | Interrupt(, Level, ActiveHigh, Shared) { 0 } |
| 225 | }) |
| 226 | CreateDWordField(PRR0, 0x05, PRRI) |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 227 | If (Arg0 < 0x80) { |
| 228 | PRRI = Arg0 |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 229 | } |
| 230 | Return (PRR0) |
| 231 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 232 | |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 233 | #define define_link(link, uid, reg) \ |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 234 | Device(link) { \ |
| 235 | Name(_HID, EISAID("PNP0C0F")) \ |
| 236 | Name(_UID, uid) \ |
| 237 | Name(_PRS, ResourceTemplate() { \ |
| 238 | Interrupt(, Level, ActiveHigh, Shared) { \ |
| 239 | 5, 10, 11 \ |
| 240 | } \ |
| 241 | }) \ |
| 242 | Method(_STA, 0, NotSerialized) { \ |
| 243 | Return (IQST(reg)) \ |
| 244 | } \ |
| 245 | Method(_DIS, 0, NotSerialized) { \ |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 246 | reg |= 0x80 \ |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 247 | } \ |
| 248 | Method(_CRS, 0, NotSerialized) { \ |
| 249 | Return (IQCR(reg)) \ |
| 250 | } \ |
| 251 | Method(_SRS, 1, NotSerialized) { \ |
| 252 | CreateDWordField(Arg0, 0x05, PRRI) \ |
Elyes HAOUAS | a2c4cd7 | 2020-10-08 09:20:14 +0200 | [diff] [blame] | 253 | reg = PRRI \ |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 254 | } \ |
| 255 | } |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 256 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 257 | define_link(LNKA, 0, PRQ0) |
| 258 | define_link(LNKB, 1, PRQ1) |
| 259 | define_link(LNKC, 2, PRQ2) |
| 260 | define_link(LNKD, 3, PRQ3) |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 261 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 262 | Device(LNKS) { |
| 263 | Name(_HID, EISAID("PNP0C0F")) |
| 264 | Name(_UID, 4) |
| 265 | Name(_PRS, ResourceTemplate() { |
| 266 | Interrupt(, Level, ActiveHigh, Shared) { 9 } |
| 267 | }) |
Gerd Hoffmann | 8130b1e | 2013-05-30 10:58:06 +0200 | [diff] [blame] | 268 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 269 | // The SCI cannot be disabled and is always attached to GSI 9, |
| 270 | // so these are no-ops. We only need this link to override the |
| 271 | // polarity to active high and match the content of the MADT. |
| 272 | Method(_STA, 0, NotSerialized) { Return (0x0b) } |
| 273 | Method(_DIS, 0, NotSerialized) { } |
| 274 | Method(_CRS, 0, NotSerialized) { Return (_PRS) } |
| 275 | Method(_SRS, 1, NotSerialized) { } |
| 276 | } |
| 277 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 278 | |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 279 | /**************************************************************** |
| 280 | * General purpose events |
| 281 | ****************************************************************/ |
| 282 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 283 | Scope(\_GPE) { |
| 284 | Name(_HID, "ACPI0006") |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 285 | |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 286 | Method(_L00) { |
| 287 | } |
| 288 | Method(_E01) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 289 | } |
| 290 | Method(_E02) { |
Elyes HAOUAS | b87a734 | 2016-09-24 08:53:34 +0200 | [diff] [blame] | 291 | } |
| 292 | Method(_L03) { |
| 293 | } |
| 294 | Method(_L04) { |
| 295 | } |
| 296 | Method(_L05) { |
| 297 | } |
| 298 | Method(_L06) { |
| 299 | } |
| 300 | Method(_L07) { |
| 301 | } |
| 302 | Method(_L08) { |
| 303 | } |
| 304 | Method(_L09) { |
| 305 | } |
| 306 | Method(_L0A) { |
| 307 | } |
| 308 | Method(_L0B) { |
| 309 | } |
| 310 | Method(_L0C) { |
| 311 | } |
| 312 | Method(_L0D) { |
| 313 | } |
| 314 | Method(_L0E) { |
| 315 | } |
| 316 | Method(_L0F) { |
| 317 | } |
| 318 | } |
Stefan Reinauer | 597ff87 | 2013-01-07 13:21:22 -0800 | [diff] [blame] | 319 | } |