Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | /* TODO: Update for Glinda */ |
| 4 | |
| 5 | #include <soc/amd/common/acpi/aoac.asl> |
| 6 | #include <soc/aoac_defs.h> |
| 7 | #include <soc/gpio.h> |
| 8 | #include <soc/iomap.h> |
| 9 | #include <amdblocks/acpimmio_map.h> |
| 10 | |
| 11 | Device (AAHB) |
| 12 | { |
| 13 | Name (_HID, "AAHB0000") |
| 14 | Name (_UID, 0x0) |
| 15 | Name (_CRS, ResourceTemplate() |
| 16 | { |
| 17 | Memory32Fixed (ReadWrite, ALINK_AHB_ADDRESS, 0x2000) |
| 18 | }) |
Felix Held | 39a9826 | 2023-05-12 18:51:24 +0200 | [diff] [blame] | 19 | Method (_STA, 0x0, NotSerialized) |
| 20 | { |
| 21 | Return (0x0b) |
| 22 | } |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | Device (GPIO) |
| 26 | { |
| 27 | Name (_HID, GPIO_DEVICE_NAME) |
| 28 | Name (_CID, GPIO_DEVICE_NAME) |
| 29 | Name (_UID, 0) |
| 30 | Name (_DDN, GPIO_DEVICE_DESC) |
| 31 | |
| 32 | Method (_CRS, 0) { |
| 33 | Local0 = ResourceTemplate() { |
| 34 | Interrupt ( |
| 35 | ResourceConsumer, |
| 36 | Level, |
| 37 | ActiveLow, |
| 38 | Shared, , , IRQR) |
| 39 | { 0 } |
| 40 | Memory32Fixed (ReadWrite, ACPIMMIO_GPIO0_BASE, 0x400) |
| 41 | } |
| 42 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 43 | If (PICM) { |
| 44 | IRQN = IGPI |
| 45 | } Else { |
| 46 | IRQN = PGPI |
| 47 | } |
| 48 | If (IRQN == 0x1f) { |
| 49 | Return (ResourceTemplate() { |
| 50 | Memory32Fixed (ReadWrite, ACPIMMIO_GPIO0_BASE, 0x400) |
| 51 | }) |
| 52 | } Else { |
| 53 | Return (Local0) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | Method (_STA, 0x0, NotSerialized) |
| 58 | { |
| 59 | Return (0x0F) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | Device (FUR0) |
| 64 | { |
| 65 | Name (_HID, "AMDI0020") |
| 66 | Name (_UID, 0x0) |
| 67 | Method (_CRS, 0) { |
| 68 | Local0 = ResourceTemplate() { |
| 69 | Interrupt ( |
| 70 | ResourceConsumer, |
| 71 | Edge, |
| 72 | ActiveHigh, |
| 73 | Exclusive, , , IRQR) |
| 74 | { 0 } |
| 75 | Memory32Fixed (ReadWrite, APU_UART0_BASE, 0x1000) |
| 76 | } |
| 77 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 78 | If (PICM) { |
| 79 | IRQN = IUA0 |
| 80 | } Else { |
| 81 | IRQN = PUA0 |
| 82 | } |
| 83 | If (IRQN == 0x1f) { |
| 84 | Return (ResourceTemplate() { |
| 85 | Memory32Fixed (ReadWrite, APU_UART0_BASE, 0x1000) |
| 86 | }) |
| 87 | } Else { |
| 88 | Return (Local0) |
| 89 | } |
| 90 | } |
| 91 | |
Matt DeVillier | 7cf9c74 | 2023-08-08 11:37:03 -0500 | [diff] [blame^] | 92 | Name (STAT, 0x0) |
| 93 | Method (_STA, 0x0, NotSerialized) |
| 94 | { |
| 95 | Return (STAT) |
| 96 | } |
| 97 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 98 | AOAC_DEVICE(FCH_AOAC_DEV_UART0, 0) |
| 99 | } |
| 100 | |
| 101 | Device (FUR1) { |
| 102 | Name (_HID, "AMDI0020") |
| 103 | Name (_UID, 0x1) |
| 104 | Method (_CRS, 0) { |
| 105 | Local0 = ResourceTemplate() { |
| 106 | Interrupt ( |
| 107 | ResourceConsumer, |
| 108 | Edge, |
| 109 | ActiveHigh, |
| 110 | Exclusive, , , IRQR) |
| 111 | { 0 } |
| 112 | Memory32Fixed (ReadWrite, APU_UART1_BASE, 0x1000) |
| 113 | } |
| 114 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 115 | If (PICM) { |
| 116 | IRQN = IUA1 |
| 117 | } Else { |
| 118 | IRQN = PUA1 |
| 119 | } |
| 120 | If (IRQN == 0x1f) { |
| 121 | Return (ResourceTemplate() { |
| 122 | Memory32Fixed (ReadWrite, APU_UART1_BASE, 0x1000) |
| 123 | }) |
| 124 | } Else { |
| 125 | Return (Local0) |
| 126 | } |
| 127 | } |
| 128 | |
Matt DeVillier | 7cf9c74 | 2023-08-08 11:37:03 -0500 | [diff] [blame^] | 129 | Name (STAT, 0x0) |
| 130 | Method (_STA, 0x0, NotSerialized) |
| 131 | { |
| 132 | Return (STAT) |
| 133 | } |
| 134 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 135 | AOAC_DEVICE(FCH_AOAC_DEV_UART1, 0) |
| 136 | } |
| 137 | |
| 138 | Device (FUR2) { |
| 139 | Name (_HID, "AMDI0020") |
| 140 | Name (_UID, 0x2) |
| 141 | Method (_CRS, 0) { |
| 142 | Local0 = ResourceTemplate() { |
| 143 | Interrupt ( |
| 144 | ResourceConsumer, |
| 145 | Edge, |
| 146 | ActiveHigh, |
| 147 | Exclusive, , , IRQR) |
| 148 | { 0 } |
| 149 | Memory32Fixed (ReadWrite, APU_UART2_BASE, 0x1000) |
| 150 | } |
| 151 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 152 | If (PICM) { |
| 153 | IRQN = IUA2 |
| 154 | } Else { |
| 155 | IRQN = PUA2 |
| 156 | } |
| 157 | If (IRQN == 0x1f) { |
| 158 | Return (ResourceTemplate() { |
| 159 | Memory32Fixed (ReadWrite, APU_UART2_BASE, 0x1000) |
| 160 | }) |
| 161 | } Else { |
| 162 | Return (Local0) |
| 163 | } |
| 164 | } |
| 165 | |
Matt DeVillier | 7cf9c74 | 2023-08-08 11:37:03 -0500 | [diff] [blame^] | 166 | Name (STAT, 0x0) |
| 167 | Method (_STA, 0x0, NotSerialized) |
| 168 | { |
| 169 | Return (STAT) |
| 170 | } |
| 171 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 172 | AOAC_DEVICE(FCH_AOAC_DEV_UART2, 0) |
| 173 | } |
| 174 | |
| 175 | Device (FUR3) { |
| 176 | Name (_HID, "AMDI0020") |
| 177 | Name (_UID, 0x3) |
| 178 | Method (_CRS, 0) { |
| 179 | Local0 = ResourceTemplate() { |
| 180 | Interrupt ( |
| 181 | ResourceConsumer, |
| 182 | Edge, |
| 183 | ActiveHigh, |
| 184 | Exclusive, , , IRQR) |
| 185 | { 0 } |
| 186 | Memory32Fixed (ReadWrite, APU_UART3_BASE, 0x1000) |
| 187 | } |
| 188 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 189 | If (PICM) { |
| 190 | IRQN = IUA3 |
| 191 | } Else { |
| 192 | IRQN = PUA3 |
| 193 | } |
| 194 | If (IRQN == 0x1f) { |
| 195 | Return (ResourceTemplate() { |
| 196 | Memory32Fixed (ReadWrite, APU_UART3_BASE, 0x1000) |
| 197 | }) |
| 198 | } Else { |
| 199 | Return (Local0) |
| 200 | } |
| 201 | } |
| 202 | |
Matt DeVillier | 7cf9c74 | 2023-08-08 11:37:03 -0500 | [diff] [blame^] | 203 | Name (STAT, 0x0) |
| 204 | Method (_STA, 0x0, NotSerialized) |
| 205 | { |
| 206 | Return (STAT) |
| 207 | } |
| 208 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 209 | AOAC_DEVICE(FCH_AOAC_DEV_UART3, 0) |
| 210 | } |
| 211 | |
| 212 | Device (FUR4) { |
| 213 | Name (_HID, "AMDI0020") |
| 214 | Name (_UID, 0x4) |
| 215 | Method (_CRS, 0) { |
| 216 | Local0 = ResourceTemplate() { |
| 217 | Interrupt ( |
| 218 | ResourceConsumer, |
| 219 | Edge, |
| 220 | ActiveHigh, |
| 221 | Exclusive, , , IRQR) |
| 222 | { 0 } |
| 223 | Memory32Fixed (ReadWrite, APU_UART4_BASE, 0x1000) |
| 224 | } |
| 225 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 226 | If (PICM) { |
| 227 | IRQN = IUA4 |
| 228 | } Else { |
| 229 | IRQN = PUA4 |
| 230 | } |
| 231 | If (IRQN == 0x1f) { |
| 232 | Return (ResourceTemplate() { |
| 233 | Memory32Fixed (ReadWrite, APU_UART4_BASE, 0x1000) |
| 234 | }) |
| 235 | } Else { |
| 236 | Return (Local0) |
| 237 | } |
| 238 | } |
| 239 | |
Matt DeVillier | 7cf9c74 | 2023-08-08 11:37:03 -0500 | [diff] [blame^] | 240 | Name (STAT, 0x0) |
| 241 | Method (_STA, 0x0, NotSerialized) |
| 242 | { |
| 243 | Return (STAT) |
| 244 | } |
| 245 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 246 | AOAC_DEVICE(FCH_AOAC_DEV_UART4, 0) |
| 247 | } |
| 248 | |
| 249 | Device (I2C0) { |
| 250 | Name (_HID, "AMDI0010") |
| 251 | Name (_UID, 0x0) |
| 252 | Method (_CRS, 0) { |
| 253 | Local0 = ResourceTemplate() { |
| 254 | Interrupt ( |
| 255 | ResourceConsumer, |
| 256 | Edge, |
| 257 | ActiveHigh, |
| 258 | Exclusive, , , IRQR) |
| 259 | { 0 } |
| 260 | Memory32Fixed (ReadWrite, APU_I2C0_BASE, 0x1000) |
| 261 | } |
| 262 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 263 | If (PICM) { |
| 264 | IRQN = II20 |
| 265 | } Else { |
| 266 | IRQN = PI20 |
| 267 | } |
| 268 | If (IRQN == 0x1f) { |
| 269 | Return (ResourceTemplate() { |
| 270 | Memory32Fixed (ReadWrite, APU_I2C0_BASE, 0x1000) |
| 271 | }) |
| 272 | } Else { |
| 273 | Return (Local0) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | Method (_STA, 0x0, NotSerialized) |
| 278 | { |
| 279 | Return (0x0F) |
| 280 | } |
| 281 | |
| 282 | AOAC_DEVICE(FCH_AOAC_DEV_I2C0, 0) |
| 283 | } |
| 284 | |
| 285 | Device (I2C1) { |
| 286 | Name (_HID, "AMDI0010") |
| 287 | Name (_UID, 0x1) |
| 288 | Method (_CRS, 0) { |
| 289 | Local0 = ResourceTemplate() { |
| 290 | Interrupt ( |
| 291 | ResourceConsumer, |
| 292 | Edge, |
| 293 | ActiveHigh, |
| 294 | Exclusive, , , IRQR) |
| 295 | { 0 } |
| 296 | Memory32Fixed (ReadWrite, APU_I2C1_BASE, 0x1000) |
| 297 | } |
| 298 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 299 | If (PICM) { |
| 300 | IRQN = II21 |
| 301 | } Else { |
| 302 | IRQN = PI21 |
| 303 | } |
| 304 | If (IRQN == 0x1f) { |
| 305 | Return (ResourceTemplate() { |
| 306 | Memory32Fixed (ReadWrite, APU_I2C1_BASE, 0x1000) |
| 307 | }) |
| 308 | } Else { |
| 309 | Return (Local0) |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | Method (_STA, 0x0, NotSerialized) |
| 314 | { |
| 315 | Return (0x0F) |
| 316 | } |
| 317 | |
| 318 | AOAC_DEVICE(FCH_AOAC_DEV_I2C1, 0) |
| 319 | } |
| 320 | |
| 321 | Device (I2C2) { |
| 322 | Name (_HID, "AMDI0010") |
| 323 | Name (_UID, 0x2) |
| 324 | Method (_CRS, 0) { |
| 325 | Local0 = ResourceTemplate() { |
| 326 | Interrupt ( |
| 327 | ResourceConsumer, |
| 328 | Edge, |
| 329 | ActiveHigh, |
| 330 | Exclusive, , , IRQR) |
| 331 | { 0 } |
| 332 | Memory32Fixed (ReadWrite, APU_I2C2_BASE, 0x1000) |
| 333 | } |
| 334 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 335 | If (PICM) { |
| 336 | IRQN = II22 |
| 337 | } Else { |
| 338 | IRQN = PI22 |
| 339 | } |
| 340 | If (IRQN == 0x1f) { |
| 341 | Return (ResourceTemplate() { |
| 342 | Memory32Fixed (ReadWrite, APU_I2C2_BASE, 0x1000) |
| 343 | }) |
| 344 | } Else { |
| 345 | Return (Local0) |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | Method (_STA, 0x0, NotSerialized) |
| 350 | { |
| 351 | Return (0x0F) |
| 352 | } |
| 353 | |
| 354 | AOAC_DEVICE(FCH_AOAC_DEV_I2C2, 0) |
| 355 | } |
| 356 | |
| 357 | Device (I2C3) |
| 358 | { |
| 359 | #if CONFIG(SOC_AMD_COMMON_BLOCK_I2C3_TPM_SHARED_WITH_PSP) |
| 360 | Name (_HID, "AMDI0019") |
| 361 | #else |
| 362 | Name (_HID, "AMDI0010") |
| 363 | #endif |
| 364 | Name (_UID, 0x3) |
| 365 | Method (_CRS, 0) { |
| 366 | Local0 = ResourceTemplate() { |
| 367 | Interrupt ( |
| 368 | ResourceConsumer, |
| 369 | Edge, |
| 370 | ActiveHigh, |
| 371 | Exclusive, , , IRQR) |
| 372 | { 0 } |
| 373 | Memory32Fixed (ReadWrite, APU_I2C3_BASE, 0x1000) |
| 374 | } |
| 375 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 376 | If (PICM) { |
| 377 | IRQN = II23 |
| 378 | } Else { |
| 379 | IRQN = PI23 |
| 380 | } |
| 381 | If (IRQN == 0x1f) { |
| 382 | Return (ResourceTemplate() { |
| 383 | Memory32Fixed (ReadWrite, APU_I2C3_BASE, 0x1000) |
| 384 | }) |
| 385 | } Else { |
| 386 | Return (Local0) |
| 387 | } |
| 388 | } |
| 389 | Method (_STA, 0x0, NotSerialized) |
| 390 | { |
| 391 | Return (0x0F) |
| 392 | } |
| 393 | |
| 394 | /* If this device is shared with PSP, then PSP takes care of power management */ |
| 395 | #if !CONFIG(SOC_AMD_COMMON_BLOCK_I2C3_TPM_SHARED_WITH_PSP) |
| 396 | AOAC_DEVICE(FCH_AOAC_DEV_I2C3, 0) |
| 397 | #endif |
| 398 | } |
| 399 | |
| 400 | Device (MISC) |
| 401 | { |
| 402 | Name (_HID, "AMD0040") |
| 403 | Name (_UID, 0x3) |
| 404 | Name (_CRS, ResourceTemplate() { |
| 405 | Memory32Fixed (ReadWrite, ACPIMMIO_MISC_BASE, 0x100) |
| 406 | }) |
| 407 | Name (_DSD, Package () |
| 408 | { |
| 409 | ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
| 410 | Package () |
| 411 | { |
| 412 | Package () { "is-rv", 1 }, |
| 413 | }, |
| 414 | }) |
| 415 | Method (_STA, 0x0, NotSerialized) |
| 416 | { |
Felix Held | 3d19aa9 | 2022-10-28 19:58:09 +0200 | [diff] [blame] | 417 | Return (0x0b) |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 418 | } |
| 419 | } |