Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [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. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 18 | * Foundation, Inc. |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | /* South Bridge */ |
| 22 | /* _SB.PCI0 */ |
| 23 | |
| 24 | /* Operating System Capabilities Method */ |
| 25 | Method(_OSC,4) |
| 26 | { |
| 27 | // Create DWord-addressable fields from the Capabilities Buffer |
| 28 | CreateDWordField(Arg3,0,CDW1) |
| 29 | CreateDWordField(Arg3,4,CDW2) |
| 30 | CreateDWordField(Arg3,8,CDW3) |
| 31 | |
| 32 | /* Check for proper PCI/PCIe UUID */ |
| 33 | If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) |
| 34 | { |
| 35 | /* Let OS control everything */ |
| 36 | Return (Arg3) |
| 37 | } Else { |
| 38 | Or(CDW1,4,CDW1) // Unrecognized UUID |
| 39 | Return(Arg3) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /* Describe the Southbridge devices */ |
| 44 | |
| 45 | /* 0:11.0 - SATA */ |
| 46 | Device(STCR) { |
| 47 | Name(_ADR, 0x00110000) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 48 | } /* end STCR */ |
| 49 | |
| 50 | /* 0:14.0 - SMBUS */ |
| 51 | Device(SBUS) { |
| 52 | Name(_ADR, 0x00140000) |
| 53 | } /* end SBUS */ |
| 54 | |
| 55 | #include "usb.asl" |
| 56 | |
| 57 | /* 0:14.2 - HD Audio */ |
| 58 | #include "audio.asl" |
| 59 | |
| 60 | /* 0:14.3 - LPC */ |
| 61 | #include "lpc.asl" |
| 62 | |
| 63 | /* 0:14.7 - SD Controller */ |
| 64 | Device(SDCN) { |
| 65 | Name(_ADR, 0x00140007) |
| 66 | } /* end SDCN */ |
| 67 | |
| 68 | Name(CRES, ResourceTemplate() { |
| 69 | /* Set the Bus number and Secondary Bus number for the PCI0 device |
| 70 | * The Secondary bus range for PCI0 lets the system |
| 71 | * know what bus values are allowed on the downstream |
| 72 | * side of this PCI bus if there is a PCI-PCI bridge. |
| 73 | * PCI busses can have 256 secondary busses which |
| 74 | * range from [0-0xFF] but they do not need to be |
| 75 | * sequential. |
| 76 | */ |
| 77 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 78 | 0x0000, /* address granularity */ |
| 79 | 0x0000, /* range minimum */ |
| 80 | 0x00FF, /* range maximum */ |
| 81 | 0x0000, /* translation */ |
| 82 | 0x0100, /* length */ |
| 83 | ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */ |
| 84 | |
| 85 | IO(Decode16, 0x0CF8, 0x0CF8, 1, 8) |
| 86 | |
| 87 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 88 | 0x0000, /* address granularity */ |
| 89 | 0x0000, /* range minimum */ |
| 90 | 0x0CF7, /* range maximum */ |
| 91 | 0x0000, /* translation */ |
| 92 | 0x0CF8 /* length */ |
| 93 | ) |
| 94 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 95 | 0x0000, /* address granularity */ |
| 96 | 0x03B0, /* range minimum */ |
| 97 | 0x03DF, /* range maximum */ |
| 98 | 0x0000, /* translation */ |
| 99 | 0x0030 /* length */ |
| 100 | ) |
| 101 | |
| 102 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 103 | 0x0000, /* address granularity */ |
| 104 | 0x0D00, /* range minimum */ |
| 105 | 0xFFFF, /* range maximum */ |
| 106 | 0x0000, /* translation */ |
| 107 | 0xF300 /* length */ |
| 108 | ) |
| 109 | |
| 110 | Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM) /* VGA memory space */ |
| 111 | Memory32Fixed(READONLY, 0x000C0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */ |
| 112 | |
| 113 | /* memory space for PCI BARs below 4GB */ |
| 114 | Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO) |
| 115 | }) /* End Name(_SB.PCI0.CRES) */ |
| 116 | |
| 117 | Method(_CRS, 0) { |
| 118 | /* DBGO("\\_SB\\PCI0\\_CRS\n") */ |
| 119 | CreateDWordField(CRES, ^MMIO._BAS, MM1B) |
| 120 | CreateDWordField(CRES, ^MMIO._LEN, MM1L) |
| 121 | |
| 122 | /* |
| 123 | * Declare memory between TOM1 and 4GB as available |
| 124 | * for PCI MMIO. |
| 125 | * Use ShiftLeft to avoid 64bit constant (for XP). |
| 126 | * This will work even if the OS does 32bit arithmetic, as |
| 127 | * 32bit (0x00000000 - TOM1) will wrap and give the same |
| 128 | * result as 64bit (0x100000000 - TOM1). |
| 129 | */ |
| 130 | Store(TOM1, MM1B) |
| 131 | ShiftLeft(0x10000000, 4, Local0) |
| 132 | Subtract(Local0, TOM1, Local0) |
| 133 | Store(Local0, MM1L) |
| 134 | |
| 135 | Return(CRES) /* note to change the Name buffer */ |
| 136 | } /* end of Method(_SB.PCI0._CRS) */ |
| 137 | |
| 138 | /* |
| 139 | * |
| 140 | * FIRST METHOD CALLED UPON BOOT |
| 141 | * |
| 142 | * 1. If debugging, print current OS and ACPI interpreter. |
| 143 | * 2. Get PCI Interrupt routing from ACPI VSM, this |
| 144 | * value is based on user choice in BIOS setup. |
| 145 | */ |
| 146 | Method(_INI, 0) { |
| 147 | /* DBGO("\\_SB\\_INI\n") */ |
| 148 | /* DBGO(" DSDT.ASL code from ") */ |
| 149 | /* DBGO(__DATE__) */ |
| 150 | /* DBGO(" ") */ |
| 151 | /* DBGO(__TIME__) */ |
| 152 | /* DBGO("\n Sleep states supported: ") */ |
| 153 | /* DBGO("\n") */ |
| 154 | /* DBGO(" \\_OS=") */ |
| 155 | /* DBGO(\_OS) */ |
| 156 | /* DBGO("\n \\_REV=") */ |
| 157 | /* DBGO(\_REV) */ |
| 158 | /* DBGO("\n") */ |
| 159 | |
| 160 | /* Determine the OS we're running on */ |
| 161 | OSFL() |
| 162 | |
WANG Siyuan | c7667f0 | 2015-06-23 22:28:17 +0800 | [diff] [blame^] | 163 | #if IS_ENABLED(CONFIG_ACPI_ENABLE_THERMAL_ZONE) |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 164 | /* TODO: It is unstable. */ |
WANG Siyuan | c7667f0 | 2015-06-23 22:28:17 +0800 | [diff] [blame^] | 165 | #include "acpi/AmdImc.asl" /* Hudson IMC function */ |
| 166 | ITZE() /* enable IMC Fan Control*/ |
| 167 | #endif |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 168 | } /* End Method(_SB._INI) */ |
| 169 | |
| 170 | Method(OSFL, 0){ |
| 171 | |
| 172 | if(LNotEqual(OSVR, Ones)) {Return(OSVR)} /* OS version was already detected */ |
| 173 | |
| 174 | if(CondRefOf(\_OSI,Local1)) |
| 175 | { |
| 176 | Store(1, OSVR) /* Assume some form of XP */ |
| 177 | if (\_OSI("Windows 2006")) /* Vista */ |
| 178 | { |
| 179 | Store(2, OSVR) |
| 180 | } |
| 181 | } else { |
| 182 | If(WCMP(\_OS,"Linux")) { |
| 183 | Store(3, OSVR) /* Linux */ |
| 184 | } Else { |
| 185 | Store(4, OSVR) /* Gotta be WinCE */ |
| 186 | } |
| 187 | } |
| 188 | Return(OSVR) |
| 189 | } |