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