Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 3 | /* TODO: Update for Phoenix */ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 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 | 1a3de8e | 2022-10-06 15:57:21 -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 | |
| 92 | AOAC_DEVICE(FCH_AOAC_DEV_UART0, 0) |
| 93 | } |
| 94 | |
| 95 | Device (FUR1) { |
| 96 | Name (_HID, "AMDI0020") |
| 97 | Name (_UID, 0x1) |
| 98 | Method (_CRS, 0) { |
| 99 | Local0 = ResourceTemplate() { |
| 100 | Interrupt ( |
| 101 | ResourceConsumer, |
| 102 | Edge, |
| 103 | ActiveHigh, |
| 104 | Exclusive, , , IRQR) |
| 105 | { 0 } |
| 106 | Memory32Fixed (ReadWrite, APU_UART1_BASE, 0x1000) |
| 107 | } |
| 108 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 109 | If (PICM) { |
| 110 | IRQN = IUA1 |
| 111 | } Else { |
| 112 | IRQN = PUA1 |
| 113 | } |
| 114 | If (IRQN == 0x1f) { |
| 115 | Return (ResourceTemplate() { |
| 116 | Memory32Fixed (ReadWrite, APU_UART1_BASE, 0x1000) |
| 117 | }) |
| 118 | } Else { |
| 119 | Return (Local0) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | AOAC_DEVICE(FCH_AOAC_DEV_UART1, 0) |
| 124 | } |
| 125 | |
| 126 | Device (FUR2) { |
| 127 | Name (_HID, "AMDI0020") |
| 128 | Name (_UID, 0x2) |
| 129 | Method (_CRS, 0) { |
| 130 | Local0 = ResourceTemplate() { |
| 131 | Interrupt ( |
| 132 | ResourceConsumer, |
| 133 | Edge, |
| 134 | ActiveHigh, |
| 135 | Exclusive, , , IRQR) |
| 136 | { 0 } |
| 137 | Memory32Fixed (ReadWrite, APU_UART2_BASE, 0x1000) |
| 138 | } |
| 139 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 140 | If (PICM) { |
| 141 | IRQN = IUA2 |
| 142 | } Else { |
| 143 | IRQN = PUA2 |
| 144 | } |
| 145 | If (IRQN == 0x1f) { |
| 146 | Return (ResourceTemplate() { |
| 147 | Memory32Fixed (ReadWrite, APU_UART2_BASE, 0x1000) |
| 148 | }) |
| 149 | } Else { |
| 150 | Return (Local0) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | AOAC_DEVICE(FCH_AOAC_DEV_UART2, 0) |
| 155 | } |
| 156 | |
| 157 | Device (FUR3) { |
| 158 | Name (_HID, "AMDI0020") |
| 159 | Name (_UID, 0x3) |
| 160 | Method (_CRS, 0) { |
| 161 | Local0 = ResourceTemplate() { |
| 162 | Interrupt ( |
| 163 | ResourceConsumer, |
| 164 | Edge, |
| 165 | ActiveHigh, |
| 166 | Exclusive, , , IRQR) |
| 167 | { 0 } |
| 168 | Memory32Fixed (ReadWrite, APU_UART3_BASE, 0x1000) |
| 169 | } |
| 170 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 171 | If (PICM) { |
| 172 | IRQN = IUA3 |
| 173 | } Else { |
| 174 | IRQN = PUA3 |
| 175 | } |
| 176 | If (IRQN == 0x1f) { |
| 177 | Return (ResourceTemplate() { |
| 178 | Memory32Fixed (ReadWrite, APU_UART3_BASE, 0x1000) |
| 179 | }) |
| 180 | } Else { |
| 181 | Return (Local0) |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | AOAC_DEVICE(FCH_AOAC_DEV_UART3, 0) |
| 186 | } |
| 187 | |
| 188 | Device (FUR4) { |
| 189 | Name (_HID, "AMDI0020") |
| 190 | Name (_UID, 0x4) |
| 191 | Method (_CRS, 0) { |
| 192 | Local0 = ResourceTemplate() { |
| 193 | Interrupt ( |
| 194 | ResourceConsumer, |
| 195 | Edge, |
| 196 | ActiveHigh, |
| 197 | Exclusive, , , IRQR) |
| 198 | { 0 } |
| 199 | Memory32Fixed (ReadWrite, APU_UART4_BASE, 0x1000) |
| 200 | } |
| 201 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 202 | If (PICM) { |
| 203 | IRQN = IUA4 |
| 204 | } Else { |
| 205 | IRQN = PUA4 |
| 206 | } |
| 207 | If (IRQN == 0x1f) { |
| 208 | Return (ResourceTemplate() { |
| 209 | Memory32Fixed (ReadWrite, APU_UART4_BASE, 0x1000) |
| 210 | }) |
| 211 | } Else { |
| 212 | Return (Local0) |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | AOAC_DEVICE(FCH_AOAC_DEV_UART4, 0) |
| 217 | } |
| 218 | |
| 219 | Device (I2C0) { |
| 220 | Name (_HID, "AMDI0010") |
| 221 | Name (_UID, 0x0) |
| 222 | Method (_CRS, 0) { |
| 223 | Local0 = ResourceTemplate() { |
| 224 | Interrupt ( |
| 225 | ResourceConsumer, |
| 226 | Edge, |
| 227 | ActiveHigh, |
| 228 | Exclusive, , , IRQR) |
| 229 | { 0 } |
| 230 | Memory32Fixed (ReadWrite, APU_I2C0_BASE, 0x1000) |
| 231 | } |
| 232 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 233 | If (PICM) { |
| 234 | IRQN = II20 |
| 235 | } Else { |
| 236 | IRQN = PI20 |
| 237 | } |
| 238 | If (IRQN == 0x1f) { |
| 239 | Return (ResourceTemplate() { |
| 240 | Memory32Fixed (ReadWrite, APU_I2C0_BASE, 0x1000) |
| 241 | }) |
| 242 | } Else { |
| 243 | Return (Local0) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | Method (_STA, 0x0, NotSerialized) |
| 248 | { |
| 249 | Return (0x0F) |
| 250 | } |
| 251 | |
| 252 | AOAC_DEVICE(FCH_AOAC_DEV_I2C0, 0) |
| 253 | } |
| 254 | |
| 255 | Device (I2C1) { |
| 256 | Name (_HID, "AMDI0010") |
| 257 | Name (_UID, 0x1) |
| 258 | Method (_CRS, 0) { |
| 259 | Local0 = ResourceTemplate() { |
| 260 | Interrupt ( |
| 261 | ResourceConsumer, |
| 262 | Edge, |
| 263 | ActiveHigh, |
| 264 | Exclusive, , , IRQR) |
| 265 | { 0 } |
| 266 | Memory32Fixed (ReadWrite, APU_I2C1_BASE, 0x1000) |
| 267 | } |
| 268 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 269 | If (PICM) { |
| 270 | IRQN = II21 |
| 271 | } Else { |
| 272 | IRQN = PI21 |
| 273 | } |
| 274 | If (IRQN == 0x1f) { |
| 275 | Return (ResourceTemplate() { |
| 276 | Memory32Fixed (ReadWrite, APU_I2C1_BASE, 0x1000) |
| 277 | }) |
| 278 | } Else { |
| 279 | Return (Local0) |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | Method (_STA, 0x0, NotSerialized) |
| 284 | { |
| 285 | Return (0x0F) |
| 286 | } |
| 287 | |
| 288 | AOAC_DEVICE(FCH_AOAC_DEV_I2C1, 0) |
| 289 | } |
| 290 | |
| 291 | Device (I2C2) { |
| 292 | Name (_HID, "AMDI0010") |
| 293 | Name (_UID, 0x2) |
| 294 | Method (_CRS, 0) { |
| 295 | Local0 = ResourceTemplate() { |
| 296 | Interrupt ( |
| 297 | ResourceConsumer, |
| 298 | Edge, |
| 299 | ActiveHigh, |
| 300 | Exclusive, , , IRQR) |
| 301 | { 0 } |
| 302 | Memory32Fixed (ReadWrite, APU_I2C2_BASE, 0x1000) |
| 303 | } |
| 304 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 305 | If (PICM) { |
| 306 | IRQN = II22 |
| 307 | } Else { |
| 308 | IRQN = PI22 |
| 309 | } |
| 310 | If (IRQN == 0x1f) { |
| 311 | Return (ResourceTemplate() { |
| 312 | Memory32Fixed (ReadWrite, APU_I2C2_BASE, 0x1000) |
| 313 | }) |
| 314 | } Else { |
| 315 | Return (Local0) |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | Method (_STA, 0x0, NotSerialized) |
| 320 | { |
| 321 | Return (0x0F) |
| 322 | } |
| 323 | |
| 324 | AOAC_DEVICE(FCH_AOAC_DEV_I2C2, 0) |
| 325 | } |
| 326 | |
| 327 | Device (I2C3) |
| 328 | { |
| 329 | #if CONFIG(SOC_AMD_COMMON_BLOCK_I2C3_TPM_SHARED_WITH_PSP) |
| 330 | Name (_HID, "AMDI0019") |
| 331 | #else |
| 332 | Name (_HID, "AMDI0010") |
| 333 | #endif |
| 334 | Name (_UID, 0x3) |
| 335 | Method (_CRS, 0) { |
| 336 | Local0 = ResourceTemplate() { |
| 337 | Interrupt ( |
| 338 | ResourceConsumer, |
| 339 | Edge, |
| 340 | ActiveHigh, |
| 341 | Exclusive, , , IRQR) |
| 342 | { 0 } |
| 343 | Memory32Fixed (ReadWrite, APU_I2C3_BASE, 0x1000) |
| 344 | } |
| 345 | CreateDWordField (Local0, IRQR._INT, IRQN) |
| 346 | If (PICM) { |
| 347 | IRQN = II23 |
| 348 | } Else { |
| 349 | IRQN = PI23 |
| 350 | } |
| 351 | If (IRQN == 0x1f) { |
| 352 | Return (ResourceTemplate() { |
| 353 | Memory32Fixed (ReadWrite, APU_I2C3_BASE, 0x1000) |
| 354 | }) |
| 355 | } Else { |
| 356 | Return (Local0) |
| 357 | } |
| 358 | } |
| 359 | Method (_STA, 0x0, NotSerialized) |
| 360 | { |
| 361 | Return (0x0F) |
| 362 | } |
| 363 | |
| 364 | /* If this device is shared with PSP, then PSP takes care of power management */ |
| 365 | #if !CONFIG(SOC_AMD_COMMON_BLOCK_I2C3_TPM_SHARED_WITH_PSP) |
| 366 | AOAC_DEVICE(FCH_AOAC_DEV_I2C3, 0) |
| 367 | #endif |
| 368 | } |
| 369 | |
| 370 | Device (MISC) |
| 371 | { |
| 372 | Name (_HID, "AMD0040") |
| 373 | Name (_UID, 0x3) |
| 374 | Name (_CRS, ResourceTemplate() { |
| 375 | Memory32Fixed (ReadWrite, ACPIMMIO_MISC_BASE, 0x100) |
| 376 | }) |
| 377 | Name (_DSD, Package () |
| 378 | { |
| 379 | ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
| 380 | Package () |
| 381 | { |
| 382 | Package () { "is-rv", 1 }, |
| 383 | }, |
| 384 | }) |
| 385 | Method (_STA, 0x0, NotSerialized) |
| 386 | { |
Felix Held | 3d19aa9 | 2022-10-28 19:58:09 +0200 | [diff] [blame^] | 387 | Return (0x0b) |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 388 | } |
| 389 | } |