1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/alib.h>
6 External(\_SB.ALIB, MethodObj)
11 /* Describe the Southbridge devices */
15 Name(_ADR, 0x00140000)
20 /* 0:14.2 - I2S Audio */
23 #include <soc/amd/common/acpi/lpc.asl>
25 /* 0:14.7 - SD Controller */
27 Name(_ADR, 0x00140007)
40 Name(CRES, ResourceTemplate() {
41 /* Set the Bus number and Secondary Bus number for the PCI0 device
42 * The Secondary bus range for PCI0 lets the system
43 * know what bus values are allowed on the downstream
44 * side of this PCI bus if there is a PCI-PCI bridge.
45 * PCI buses can have 256 secondary buses which
46 * range from [0-0xFF] but they do not need to be
49 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
50 0x0000, /* address granularity */
51 0x0000, /* range minimum */
52 0x00ff, /* range maximum */
53 0x0000, /* translation */
55 ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */
57 IO(Decode16, 0x0cf8, 0x0cf8, 1, 8)
59 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
60 0x0000, /* address granularity */
61 0x0000, /* range minimum */
62 0x0cf7, /* range maximum */
63 0x0000, /* translation */
67 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
68 0x0000, /* address granularity */
69 0x0d00, /* range minimum */
70 0xffff, /* range maximum */
71 0x0000, /* translation */
75 Memory32Fixed(READONLY, VGA_MMIO_BASE, VGA_MMIO_SIZE, VGAM) /* VGA memory space */
76 Memory32Fixed(READONLY, 0x000c0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */
78 /* memory space for PCI BARs below 4GB */
79 Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO)
80 }) /* End Name(_SB.PCI0.CRES) */
83 /* DBGO("\\_SB\\PCI0\\_CRS\n") */
84 CreateDWordField(CRES, ^MMIO._BAS, MM1B)
85 CreateDWordField(CRES, ^MMIO._LEN, MM1L)
87 /* Declare memory between TOM1 and MMCONF as available for PCI MMIO. */
89 Local0 = CONFIG_ECAM_MMCONF_BASE_ADDRESS
93 CreateWordField(CRES, ^PSB0._MAX, BMAX)
94 CreateWordField(CRES, ^PSB0._LEN, BLEN)
95 BMAX = CONFIG_ECAM_MMCONF_BUS_NUMBER - 1
96 BLEN = CONFIG_ECAM_MMCONF_BUS_NUMBER
98 Return (CRES) /* note to change the Name buffer */
99 } /* end of Method(_SB.PCI0._CRS) */
103 * FIRST METHOD CALLED UPON BOOT
105 * 1. If debugging, print current OS and ACPI interpreter.
106 * 2. Get PCI Interrupt routing from ACPI VSM, this
107 * value is based on user choice in BIOS setup.
109 Method(_INI, 0, Serialized) {
110 /* DBGO("\\_SB\\_INI\n") */
111 /* DBGO(" DSDT.ASL code from ") */
115 /* DBGO("\n Sleep states supported: ") */
117 /* DBGO(" \\_OS=") */
119 /* DBGO("\n \\_REV=") */
123 /* Send ALIB Function 1 the AC/DC state */
124 Name(F1BF, Buffer(0x03){})
125 CreateWordField(F1BF, 0, F1SZ)
126 CreateByteField(F1BF, 2, F1DA)
131 \_SB.ALIB(ALIB_FUNCTION_REPORT_AC_DC_STATE, F1BF)
133 } /* End Method(_SB._INI) */
135 OperationRegion(SMIC, SystemMemory, 0xfed80000, 0x80000)
136 Field( SMIC, ByteAcc, NoLock, Preserve) {
139 U3PS, 2, /* Usb3PowerSel */
143 SARP, 1, /* Sata Ref Clock Powerdown */
144 U2RP, 1, /* Usb2 Ref Clock Powerdown */
145 U3RP, 1, /* Usb3 Ref Clock Powerdown */
147 /* XHCI_PM registers */
153 UD3P, 1, /* bit 15 */
154 U3PR, 1, /* bit 16 */
156 FWLM, 1, /* FirmWare Load Mode */
157 FPLS, 1, /* Fw PreLoad Start */
158 FPLC, 1, /* Fw PreLoad Complete */
163 ROAM, 1, /* 1= ROM 0=RAM */
169 offset (0x1e4a), /* I2C0 D3 Control */
173 offset (0x1e4b), /* I2C0 D3 State */
176 offset (0x1e4c), /* I2C1 D3 Control */
180 offset (0x1e4d), /* I2C1 D3 State */
183 offset (0x1e4e), /* I2C2 D3 Control */
187 offset (0x1e4f), /* I2C2 D3 State */
190 offset (0x1e50), /* I2C3 D3 Control */
194 offset (0x1e51), /* I2C3 D3 State */
197 offset (0x1e56), /* UART0 D3 Control */
201 offset (0x1e57), /* UART0 D3 State */
204 offset (0x1e58), /* UART1 D3 Control */
208 offset (0x1e59), /* UART1 D3 State */
211 offset (0x1e5e), /* SATA D3 Control */
215 offset (0x1e5f), /* SATA D3 State */
218 offset (0x1e64), /* USB2 D3 Control */
222 offset (0x1e65), /* USB2 D3 State */
225 offset (0x1e6e), /* USB3 D3 Control */
229 offset (0x1e6f), /* USB3 D3 State */
232 offset (0x1e70), /* SD D3 Control */
241 offset (0x1e71), /* SD D3 State */
244 offset (0x1e80), /* Shadow Register Request */
254 offset (0x1e84), /* Shadow Register Status */
256 SASR, 1, /* SATA 15 Shadow Reg Request Status Register */
258 U2SR, 1, /* USB2 18 Shadow Reg Request Status Register */
260 U3SR, 1, /* USB3 23 Shadow Reg Request Status Register */
261 SDSR, 1, /* SD 24 Shadow Reg Request Status Register */
263 offset (0x1ea0), /* PwrGood Control */
267 U3PG, 1, /* Usb3 Power Good BIT3 */
269 offset (0x1ea3), /* PwrGood Control b[31:24] */
273 Field(PCFG, DwordAcc, NoLock, Preserve)
276 Offset(0x00080010), /* Base address */
278 Offset(0x0008002c), /* Subsystem ID / Vendor ID */
281 Offset(0x00080048), /* Indirect PCI Index Register */
284 Offset(0x00080054), /* PME Control / Status */
288 Offset(0x00090004), /* Control */
291 Offset(0x00090010), /* Base address */
293 Offset(0x0009002c), /* Subsystem ID / Vendor ID */
295 Offset(0x00090054), /* EHCI Spare 1 */
297 Offset(0x00090064), /* Misc Control 2 */
300 Offset(0x000900c4), /* PME Control / Status */
304 Offset(0x000a30cb), /* ClientRomProtect[31:24] */
306 AUSS, 1, /* AutoSizeStart */
311 * 5=I2C0, 6=I2C1, 7=I2C2, 8=I2C3, 11=UART0, 12=UART1,
312 * 15=SATA, 18=EHCI, 23=xHCI, 24=SD
315 Mutex (FDAS, 0) /* FCH Device AOAC Semophore */
316 Method(FDDC, 2, Serialized)
318 Acquire(FDAS, 0xffff)
321 Switch(ToInteger(Arg0)) {
322 Case(Package() {5, 15, 24}) {
325 Case(Package() {6, 7, 8, 11, 12, 18}) {
329 /* put device into D0 */
330 Switch(ToInteger(Arg0))
336 while(Local0 != 0x7) {
344 while(Local0 != 0x7) {
352 while(Local0 != 0x7) {
360 while(Local0 != 0x7) {
368 while(Local0 != 0x7) {
376 while(Local0 != 0x7) {
380 /* todo Case(15) { STD0()} */ /* SATA */
381 Case(18) { U2D0()} /* EHCI */
382 Case(23) { U3D0()} /* XHCI */
387 while(Local0 != 0x7) {
393 /* put device into D3cold */
394 Switch(ToInteger(Arg0))
399 while(Local0 != 0x0) {
407 while(Local0 != 0x0) {
415 while(Local0 != 0x0) {
423 while(Local0 != 0x0) {
431 while(Local0 != 0x0) {
439 while(Local0 != 0x0) {
444 /* todo Case(15) { STD3()} */ /* SATA */
445 Case(18) { U2D3()} /* EHCI */
446 Case(23) { U3D3()} /* XHCI */
450 while(Local0 != 0x0) {
459 if (SDTD == 3) { PG1A = 0 }
479 Method(FPTS,0, Serialized) /* FCH _PTS */
491 Method(FWAK,0, Serialized) /* FCH _WAK */
534 * Helper for setting a bit in AOACxA0 PwrGood Control
535 * Arg0: bit to set or clear
536 * Arg1: 0 = clear bit[Arg0], non-zero = set bit[Arg0]
538 Method(PWGC,2, Serialized)
540 Local0 = PGA3 & 0xdf /* do SwUsb3SlpShutdown below */
548 if (Arg0 == 0x20) { /* if SwUsb3SlpShutdown */
551 while(!Local0) { /* wait SwUsb3SlpShutdown to complete */