Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 2 | |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 3 | Name (_HID, EISAID ("PNP0A08")) // PCIe |
| 4 | Name (_CID, EISAID ("PNP0A03")) // PCI |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 5 | |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 6 | Name (_BBN, 0) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 7 | |
| 8 | Device (MCHC) |
| 9 | { |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 10 | Name (_ADR, 0x00000000) // 0:0.0 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 11 | |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 12 | OperationRegion (MCHP, PCI_Config, 0x00, 0x100) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 13 | Field (MCHP, DWordAcc, NoLock, Preserve) |
| 14 | { |
| 15 | Offset (0x40), // EPBAR |
| 16 | EPEN, 1, // Enable |
| 17 | , 11, // |
Angel Pons | 05f996d | 2020-07-06 22:10:37 +0200 | [diff] [blame] | 18 | EPBR, 27, // EPBAR |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 19 | |
| 20 | Offset (0x48), // MCHBAR |
| 21 | MHEN, 1, // Enable |
Angel Pons | 05f996d | 2020-07-06 22:10:37 +0200 | [diff] [blame] | 22 | , 14, // |
| 23 | MHBR, 24, // MCHBAR |
Chris Morgan | 5e5e789 | 2020-02-07 09:40:42 -0600 | [diff] [blame] | 24 | Offset (0x54), |
| 25 | DVEN, 32, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 26 | Offset (0x60), // PCIe BAR |
| 27 | PXEN, 1, // Enable |
| 28 | PXSZ, 2, // BAR size |
| 29 | , 23, // |
Angel Pons | 05f996d | 2020-07-06 22:10:37 +0200 | [diff] [blame] | 30 | PXBR, 13, // PCIe BAR |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 31 | |
| 32 | Offset (0x68), // DMIBAR |
| 33 | DMEN, 1, // Enable |
| 34 | , 11, // |
Angel Pons | 05f996d | 2020-07-06 22:10:37 +0200 | [diff] [blame] | 35 | DMBR, 27, // DMIBAR |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 36 | |
| 37 | Offset (0x70), // ME Base Address |
| 38 | MEBA, 64, |
| 39 | |
| 40 | // ... |
| 41 | |
| 42 | Offset (0x80), // PAM0 |
| 43 | , 4, |
| 44 | PM0H, 2, |
| 45 | , 2, |
| 46 | Offset (0x81), // PAM1 |
| 47 | PM1L, 2, |
| 48 | , 2, |
| 49 | PM1H, 2, |
| 50 | , 2, |
| 51 | Offset (0x82), // PAM2 |
| 52 | PM2L, 2, |
| 53 | , 2, |
| 54 | PM2H, 2, |
| 55 | , 2, |
| 56 | Offset (0x83), // PAM3 |
| 57 | PM3L, 2, |
| 58 | , 2, |
| 59 | PM3H, 2, |
| 60 | , 2, |
| 61 | Offset (0x84), // PAM4 |
| 62 | PM4L, 2, |
| 63 | , 2, |
| 64 | PM4H, 2, |
| 65 | , 2, |
| 66 | Offset (0x85), // PAM5 |
| 67 | PM5L, 2, |
| 68 | , 2, |
| 69 | PM5H, 2, |
| 70 | , 2, |
| 71 | Offset (0x86), // PAM6 |
| 72 | PM6L, 2, |
| 73 | , 2, |
| 74 | PM6H, 2, |
| 75 | , 2, |
| 76 | |
| 77 | Offset (0xa0), // Top of Used Memory |
| 78 | TOM, 64, |
| 79 | |
| 80 | Offset (0xbc), // Top of Low Used Memory |
| 81 | TLUD, 32, |
| 82 | } |
| 83 | |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 84 | #include "ctdp.asl" |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | // Current Resource Settings |
Martin Roth | fc70643 | 2015-08-18 16:56:05 -0600 | [diff] [blame] | 88 | Name (MCRS, ResourceTemplate() |
| 89 | { |
| 90 | // Bus Numbers |
| 91 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 92 | 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00) |
| 93 | |
| 94 | // IO Region 0 |
| 95 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 96 | 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00) |
| 97 | |
| 98 | // PCI Config Space |
| 99 | Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008) |
| 100 | |
| 101 | // IO Region 1 |
| 102 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 103 | 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01) |
| 104 | |
| 105 | // VGA memory (0xa0000-0xbffff) |
| 106 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 107 | Cacheable, ReadWrite, |
| 108 | 0x00000000, 0x000a0000, 0x000bffff, 0x00000000, |
| 109 | 0x00020000,,, ASEG) |
| 110 | |
| 111 | // OPROM reserved (0xc0000-0xc3fff) |
| 112 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 113 | Cacheable, ReadWrite, |
| 114 | 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000, |
| 115 | 0x00004000,,, OPR0) |
| 116 | |
| 117 | // OPROM reserved (0xc4000-0xc7fff) |
| 118 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 119 | Cacheable, ReadWrite, |
| 120 | 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000, |
| 121 | 0x00004000,,, OPR1) |
| 122 | |
| 123 | // OPROM reserved (0xc8000-0xcbfff) |
| 124 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 125 | Cacheable, ReadWrite, |
| 126 | 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000, |
| 127 | 0x00004000,,, OPR2) |
| 128 | |
| 129 | // OPROM reserved (0xcc000-0xcffff) |
| 130 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 131 | Cacheable, ReadWrite, |
| 132 | 0x00000000, 0x000cc000, 0x000cffff, 0x00000000, |
| 133 | 0x00004000,,, OPR3) |
| 134 | |
| 135 | // OPROM reserved (0xd0000-0xd3fff) |
| 136 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 137 | Cacheable, ReadWrite, |
| 138 | 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000, |
| 139 | 0x00004000,,, OPR4) |
| 140 | |
| 141 | // OPROM reserved (0xd4000-0xd7fff) |
| 142 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 143 | Cacheable, ReadWrite, |
| 144 | 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000, |
| 145 | 0x00004000,,, OPR5) |
| 146 | |
| 147 | // OPROM reserved (0xd8000-0xdbfff) |
| 148 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 149 | Cacheable, ReadWrite, |
| 150 | 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000, |
| 151 | 0x00004000,,, OPR6) |
| 152 | |
| 153 | // OPROM reserved (0xdc000-0xdffff) |
| 154 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 155 | Cacheable, ReadWrite, |
| 156 | 0x00000000, 0x000dc000, 0x000dffff, 0x00000000, |
| 157 | 0x00004000,,, OPR7) |
| 158 | |
| 159 | // BIOS Extension (0xe0000-0xe3fff) |
| 160 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 161 | Cacheable, ReadWrite, |
| 162 | 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000, |
| 163 | 0x00004000,,, ESG0) |
| 164 | |
| 165 | // BIOS Extension (0xe4000-0xe7fff) |
| 166 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 167 | Cacheable, ReadWrite, |
| 168 | 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000, |
| 169 | 0x00004000,,, ESG1) |
| 170 | |
| 171 | // BIOS Extension (0xe8000-0xebfff) |
| 172 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 173 | Cacheable, ReadWrite, |
| 174 | 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000, |
| 175 | 0x00004000,,, ESG2) |
| 176 | |
| 177 | // BIOS Extension (0xec000-0xeffff) |
| 178 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 179 | Cacheable, ReadWrite, |
| 180 | 0x00000000, 0x000ec000, 0x000effff, 0x00000000, |
| 181 | 0x00004000,,, ESG3) |
| 182 | |
| 183 | // System BIOS (0xf0000-0xfffff) |
| 184 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 185 | Cacheable, ReadWrite, |
| 186 | 0x00000000, 0x000f0000, 0x000fffff, 0x00000000, |
| 187 | 0x00010000,,, FSEG) |
| 188 | |
| 189 | // PCI Memory Region (Top of memory-CONFIG_MMCONF_BASE_ADDRESS) |
| 190 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 191 | Cacheable, ReadWrite, |
| 192 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
| 193 | 0x00000000,,, PM01) |
| 194 | |
| 195 | // TPM Area (0xfed40000-0xfed44fff) |
| 196 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 197 | Cacheable, ReadWrite, |
| 198 | 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000, |
| 199 | 0x00005000,,, TPMR) |
| 200 | }) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 201 | |
| 202 | Method (_CRS, 0, Serialized) |
| 203 | { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 204 | // Find PCI resource area in MCRS |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 205 | CreateDwordField (MCRS, ^PM01._MIN, PMIN) |
| 206 | CreateDwordField (MCRS, ^PM01._MAX, PMAX) |
| 207 | CreateDwordField (MCRS, ^PM01._LEN, PLEN) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 208 | |
| 209 | // Fix up PCI memory region |
| 210 | // Start with Top of Lower Usable DRAM |
Furquan Shaikh | 506479d | 2020-06-01 13:27:16 -0700 | [diff] [blame] | 211 | // Lower 20 bits of TOLUD register need to be masked since they contain lock and |
| 212 | // reserved bits. |
| 213 | Local0 = ^MCHC.TLUD & (0xfff << 20) |
Furquan Shaikh | 181e2d4 | 2020-06-01 13:03:45 -0700 | [diff] [blame] | 214 | Local1 = ^MCHC.MEBA |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 215 | |
| 216 | // Check if ME base is equal |
Furquan Shaikh | 181e2d4 | 2020-06-01 13:03:45 -0700 | [diff] [blame] | 217 | If (Local0 == Local1) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 218 | // Use Top Of Memory instead |
Furquan Shaikh | 506479d | 2020-06-01 13:27:16 -0700 | [diff] [blame] | 219 | // Lower 20 bits of TOM register need to be masked since they contain lock and |
| 220 | // reserved bits. |
| 221 | Local0 = ^MCHC.TOM & (0x7ffff << 20) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 222 | } |
| 223 | |
Furquan Shaikh | 181e2d4 | 2020-06-01 13:03:45 -0700 | [diff] [blame] | 224 | PMIN = Local0 |
| 225 | PMAX = CONFIG_MMCONF_BASE_ADDRESS - 1 |
Angel Pons | c5381e0 | 2020-10-25 12:56:29 +0100 | [diff] [blame^] | 226 | PLEN = (PMAX - PMIN) + 1 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 227 | |
| 228 | Return (MCRS) |
| 229 | } |