Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Advanced Micro Devices, Inc. |
| 5 | * Copyright (C) 2013 Sage Electronic Engineering, LLC |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 15 | */ |
| 16 | |
Martin Roth | ec23f04 | 2017-11-22 19:21:55 -0700 | [diff] [blame] | 17 | /* System Bus */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 18 | /* _SB.PCI0 */ |
| 19 | |
Mike Loptien | 9e8690b | 2013-07-18 10:30:47 -0600 | [diff] [blame] | 20 | /* Operating System Capabilities Method */ |
| 21 | Method(_OSC,4) |
| 22 | { |
Mike Loptien | 9e8690b | 2013-07-18 10:30:47 -0600 | [diff] [blame] | 23 | /* Check for proper PCI/PCIe UUID */ |
| 24 | If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) |
| 25 | { |
| 26 | /* Let OS control everything */ |
| 27 | Return (Arg3) |
| 28 | } Else { |
Marc Jones | 1faa11e | 2018-08-15 22:17:45 -0600 | [diff] [blame] | 29 | CreateDWordField(Arg3,0,CDW1) |
Mike Loptien | 9e8690b | 2013-07-18 10:30:47 -0600 | [diff] [blame] | 30 | Or(CDW1,4,CDW1) // Unrecognized UUID |
| 31 | Return(Arg3) |
| 32 | } |
| 33 | } |
| 34 | |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 35 | /* Describe the Southbridge devices */ |
| 36 | |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 37 | /* 0:11.0 - SATA */ |
| 38 | Device(STCR) { |
| 39 | Name(_ADR, 0x00110000) |
| 40 | #include "acpi/sata.asl" |
| 41 | } /* end STCR */ |
| 42 | |
| 43 | /* 0:14.0 - SMBUS */ |
| 44 | Device(SBUS) { |
| 45 | Name(_ADR, 0x00140000) |
| 46 | } /* end SBUS */ |
| 47 | |
| 48 | #include "usb.asl" |
| 49 | |
| 50 | /* 0:14.2 - HD Audio */ |
| 51 | #include "audio.asl" |
| 52 | |
| 53 | /* 0:14.3 - LPC */ |
| 54 | #include "lpc.asl" |
| 55 | |
| 56 | /* 0:14.7 - SD Controller */ |
| 57 | Device(SDCN) { |
| 58 | Name(_ADR, 0x00140007) |
| 59 | } /* end SDCN */ |
| 60 | |
Martin Roth | 083504b | 2017-06-24 21:30:14 -0600 | [diff] [blame] | 61 | #if !IS_ENABLED(CONFIG_SOUTHBRIDGE_AMD_AGESA_YANGTZE) |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 62 | |
| 63 | /* 0:14.4 - PCI slot 1, 2, 3 */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 64 | Device(PIBR) { |
| 65 | Name(_ADR, 0x00140004) |
| 66 | Name(_PRW, Package() {0x18, 4}) |
| 67 | |
| 68 | Method(_PRT, 0) { |
| 69 | Return (PCIB) |
| 70 | } |
| 71 | } |
| 72 | |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 73 | /* 0:14.6 - GEC Controller */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 74 | Device(ACMD) { |
| 75 | Name(_ADR, 0x00140006) |
| 76 | } /* end Ac97modem */ |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 77 | #endif |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 78 | |
| 79 | Name(CRES, ResourceTemplate() { |
Mike Loptien | 6cf5c8e | 2013-07-18 10:16:31 -0600 | [diff] [blame] | 80 | /* Set the Bus number and Secondary Bus number for the PCI0 device |
| 81 | * The Secondary bus range for PCI0 lets the system |
| 82 | * know what bus values are allowed on the downstream |
| 83 | * side of this PCI bus if there is a PCI-PCI bridge. |
| 84 | * PCI busses can have 256 secondary busses which |
| 85 | * range from [0-0xFF] but they do not need to be |
| 86 | * sequential. |
| 87 | */ |
| 88 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 89 | 0x0000, /* address granularity */ |
| 90 | 0x0000, /* range minimum */ |
| 91 | 0x00FF, /* range maximum */ |
| 92 | 0x0000, /* translation */ |
| 93 | 0x0100, /* length */ |
| 94 | ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */ |
| 95 | |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 96 | IO(Decode16, 0x0CF8, 0x0CF8, 1, 8) |
| 97 | |
| 98 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 99 | 0x0000, /* address granularity */ |
| 100 | 0x0000, /* range minimum */ |
| 101 | 0x0CF7, /* range maximum */ |
| 102 | 0x0000, /* translation */ |
| 103 | 0x0CF8 /* length */ |
| 104 | ) |
| 105 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 106 | 0x0000, /* address granularity */ |
| 107 | 0x03B0, /* range minimum */ |
| 108 | 0x03DF, /* range maximum */ |
| 109 | 0x0000, /* translation */ |
| 110 | 0x0030 /* length */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 111 | ) |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 112 | |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 113 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 114 | 0x0000, /* address granularity */ |
| 115 | 0x0D00, /* range minimum */ |
| 116 | 0xFFFF, /* range maximum */ |
| 117 | 0x0000, /* translation */ |
| 118 | 0xF300 /* length */ |
| 119 | ) |
| 120 | |
| 121 | Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM) /* VGA memory space */ |
| 122 | Memory32Fixed(READONLY, 0x000C0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */ |
| 123 | |
| 124 | /* memory space for PCI BARs below 4GB */ |
| 125 | Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO) |
| 126 | }) /* End Name(_SB.PCI0.CRES) */ |
| 127 | |
| 128 | Method(_CRS, 0) { |
| 129 | /* DBGO("\\_SB\\PCI0\\_CRS\n") */ |
| 130 | CreateDWordField(CRES, ^MMIO._BAS, MM1B) |
| 131 | CreateDWordField(CRES, ^MMIO._LEN, MM1L) |
| 132 | |
| 133 | /* |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 134 | * Declare memory between TOM1 and 4GB as available |
| 135 | * for PCI MMIO. |
| 136 | * Use ShiftLeft to avoid 64bit constant (for XP). |
| 137 | * This will work even if the OS does 32bit arithmetic, as |
| 138 | * 32bit (0x00000000 - TOM1) will wrap and give the same |
| 139 | * result as 64bit (0x100000000 - TOM1). |
| 140 | */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 141 | Store(TOM1, MM1B) |
| 142 | ShiftLeft(0x10000000, 4, Local0) |
| 143 | Subtract(Local0, TOM1, Local0) |
| 144 | Store(Local0, MM1L) |
| 145 | |
| 146 | Return(CRES) /* note to change the Name buffer */ |
| 147 | } /* end of Method(_SB.PCI0._CRS) */ |
| 148 | |
Elyes HAOUAS | 9985060 | 2019-02-21 16:38:43 +0100 | [diff] [blame] | 149 | #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) |
| 150 | #include "acpi/AmdImc.asl" /* Hudson IMC function */ |
| 151 | #endif |
| 152 | |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 153 | /* |
Mike Loptien | ac90d80 | 2013-07-17 15:14:59 -0600 | [diff] [blame] | 154 | * |
| 155 | * FIRST METHOD CALLED UPON BOOT |
| 156 | * |
| 157 | * 1. If debugging, print current OS and ACPI interpreter. |
| 158 | * 2. Get PCI Interrupt routing from ACPI VSM, this |
| 159 | * value is based on user choice in BIOS setup. |
| 160 | */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 161 | Method(_INI, 0) { |
| 162 | /* DBGO("\\_SB\\_INI\n") */ |
| 163 | /* DBGO(" DSDT.ASL code from ") */ |
| 164 | /* DBGO(__DATE__) */ |
| 165 | /* DBGO(" ") */ |
| 166 | /* DBGO(__TIME__) */ |
| 167 | /* DBGO("\n Sleep states supported: ") */ |
| 168 | /* DBGO("\n") */ |
| 169 | /* DBGO(" \\_OS=") */ |
| 170 | /* DBGO(\_OS) */ |
| 171 | /* DBGO("\n \\_REV=") */ |
| 172 | /* DBGO(\_REV) */ |
| 173 | /* DBGO("\n") */ |
| 174 | |
| 175 | /* Determine the OS we're running on */ |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 176 | OSFL() |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 177 | |
Martin Roth | 083504b | 2017-06-24 21:30:14 -0600 | [diff] [blame] | 178 | #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) |
Kyösti Mälkki | 51769b2 | 2017-01-28 09:48:29 +0200 | [diff] [blame] | 179 | #if IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE) |
WANG Siyuan | b640fd3 | 2014-10-22 13:47:18 +0800 | [diff] [blame] | 180 | ITZE() /* enable IMC Fan Control*/ |
| 181 | #endif |
Kyösti Mälkki | 51769b2 | 2017-01-28 09:48:29 +0200 | [diff] [blame] | 182 | #endif |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 183 | } /* End Method(_SB._INI) */ |
| 184 | |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 185 | Method(OSFL, 0){ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 186 | |
Elyes HAOUAS | ba28e8d | 2016-08-31 19:22:16 +0200 | [diff] [blame] | 187 | if (LNotEqual(OSVR, Ones)) {Return(OSVR)} /* OS version was already detected */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 188 | |
Elyes HAOUAS | ba28e8d | 2016-08-31 19:22:16 +0200 | [diff] [blame] | 189 | if (CondRefOf(\_OSI)) |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 190 | { |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 191 | Store(1, OSVR) /* Assume some form of XP */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 192 | if (\_OSI("Windows 2006")) /* Vista */ |
| 193 | { |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 194 | Store(2, OSVR) |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 195 | } |
| 196 | } else { |
| 197 | If(WCMP(\_OS,"Linux")) { |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 198 | Store(3, OSVR) /* Linux */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 199 | } Else { |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 200 | Store(4, OSVR) /* Gotta be WinCE */ |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 201 | } |
| 202 | } |
Edward O'Callaghan | f7d8f09 | 2014-05-31 13:57:52 +1000 | [diff] [blame] | 203 | Return(OSVR) |
Steve Goodrich | bf0988b | 2013-07-10 11:59:11 -0600 | [diff] [blame] | 204 | } |