Angel Pons | ba38f37 | 2020-04-05 15:46:45 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 3 | |
| 4 | #include <soc/iomap.h> |
| 5 | #include <soc/irq.h> |
| 6 | |
| 7 | Scope(\) |
| 8 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 9 | /* IO-Trap at 0x800. This is the ACPI->SMI communication interface. */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 10 | |
| 11 | OperationRegion(IO_T, SystemIO, 0x800, 0x10) |
| 12 | Field(IO_T, ByteAcc, NoLock, Preserve) |
| 13 | { |
| 14 | Offset(0x8), |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 15 | TRP0, 8 /* IO-Trap at 0x808 */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 16 | } |
| 17 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 18 | /* Intel Legacy Block */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 19 | OperationRegion(ILBS, SystemMemory, ILB_BASE_ADDRESS, ILB_BASE_SIZE) |
| 20 | Field (ILBS, AnyAcc, NoLock, Preserve) |
| 21 | { |
| 22 | Offset (0x8), |
| 23 | PRTA, 8, |
| 24 | PRTB, 8, |
| 25 | PRTC, 8, |
| 26 | PRTD, 8, |
| 27 | PRTE, 8, |
| 28 | PRTF, 8, |
| 29 | PRTG, 8, |
| 30 | PRTH, 8, |
| 31 | } |
| 32 | } |
| 33 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 34 | Name(_HID,EISAID("PNP0A08")) /* PCIe */ |
| 35 | Name(_CID,EISAID("PNP0A03")) /* PCI */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 36 | |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 37 | Name(_BBN, 0) |
| 38 | |
| 39 | Method (_CRS, 0, Serialized) |
| 40 | { |
| 41 | Name (MCRS, ResourceTemplate() |
| 42 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 43 | /* Bus Numbers */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 44 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 45 | 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00) |
| 46 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 47 | /* IO Region 0 */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 48 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 49 | 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00) |
| 50 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 51 | /* PCI Config Space */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 52 | Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008) |
| 53 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 54 | /* IO Region 1 */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 55 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 56 | 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01) |
| 57 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 58 | /* VGA memory (0xa0000-0xbffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 59 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 60 | Cacheable, ReadWrite, |
| 61 | 0x00000000, 0x000a0000, 0x000bffff, 0x00000000, |
| 62 | 0x00020000,,, ASEG) |
| 63 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 64 | /* OPROM reserved (0xc0000-0xc3fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 65 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 66 | Cacheable, ReadWrite, |
| 67 | 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000, |
| 68 | 0x00004000,,, OPR0) |
| 69 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 70 | /* OPROM reserved (0xc4000-0xc7fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 71 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 72 | Cacheable, ReadWrite, |
| 73 | 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000, |
| 74 | 0x00004000,,, OPR1) |
| 75 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 76 | /* OPROM reserved (0xc8000-0xcbfff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 77 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 78 | Cacheable, ReadWrite, |
| 79 | 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000, |
| 80 | 0x00004000,,, OPR2) |
| 81 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 82 | /* OPROM reserved (0xcc000-0xcffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 83 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 84 | Cacheable, ReadWrite, |
| 85 | 0x00000000, 0x000cc000, 0x000cffff, 0x00000000, |
| 86 | 0x00004000,,, OPR3) |
| 87 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 88 | /* OPROM reserved (0xd0000-0xd3fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 89 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 90 | Cacheable, ReadWrite, |
| 91 | 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000, |
| 92 | 0x00004000,,, OPR4) |
| 93 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 94 | /* OPROM reserved (0xd4000-0xd7fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 95 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 96 | Cacheable, ReadWrite, |
| 97 | 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000, |
| 98 | 0x00004000,,, OPR5) |
| 99 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 100 | /* OPROM reserved (0xd8000-0xdbfff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 101 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 102 | Cacheable, ReadWrite, |
| 103 | 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000, |
| 104 | 0x00004000,,, OPR6) |
| 105 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 106 | /* OPROM reserved (0xdc000-0xdffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 107 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 108 | Cacheable, ReadWrite, |
| 109 | 0x00000000, 0x000dc000, 0x000dffff, 0x00000000, |
| 110 | 0x00004000,,, OPR7) |
| 111 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 112 | /* BIOS Extension (0xe0000-0xe3fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 113 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 114 | Cacheable, ReadWrite, |
| 115 | 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000, |
| 116 | 0x00004000,,, ESG0) |
| 117 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 118 | /* BIOS Extension (0xe4000-0xe7fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 119 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 120 | Cacheable, ReadWrite, |
| 121 | 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000, |
| 122 | 0x00004000,,, ESG1) |
| 123 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 124 | /* BIOS Extension (0xe8000-0xebfff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 125 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 126 | Cacheable, ReadWrite, |
| 127 | 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000, |
| 128 | 0x00004000,,, ESG2) |
| 129 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 130 | /* BIOS Extension (0xec000-0xeffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 131 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 132 | Cacheable, ReadWrite, |
| 133 | 0x00000000, 0x000ec000, 0x000effff, 0x00000000, |
| 134 | 0x00004000,,, ESG3) |
| 135 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 136 | /* System BIOS (0xf0000-0xfffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 137 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 138 | Cacheable, ReadWrite, |
| 139 | 0x00000000, 0x000f0000, 0x000fffff, 0x00000000, |
| 140 | 0x00010000,,, FSEG) |
| 141 | |
Matt DeVillier | 687eb30 | 2017-06-04 14:39:18 -0500 | [diff] [blame] | 142 | /* LPEA Memory Region (0x20000000-0x201FFFFF) */ |
| 143 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 144 | Cacheable, ReadWrite, |
| 145 | 0x00000000, 0x20000000, 0x201FFFFF, 0x00000000, |
| 146 | 0x00200000,,, LMEM) |
| 147 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 148 | /* PCI Memory Region (Top of memory-0xfeafffff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 149 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 150 | Cacheable, ReadWrite, |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 151 | 0x00000000, 0xfea00000, 0xfeafffff, 0x00000000, |
| 152 | 0x00100000,,, PMEM) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 153 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 154 | /* TPM Area (0xfed40000-0xfed44fff) */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 155 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 156 | Cacheable, ReadWrite, |
| 157 | 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000, |
| 158 | 0x00005000,,, TPMR) |
| 159 | }) |
| 160 | |
Matt DeVillier | 687eb30 | 2017-06-04 14:39:18 -0500 | [diff] [blame] | 161 | /* Update LPEA resource area */ |
| 162 | CreateDWordField (MCRS, LMEM._MIN, LMIN) |
| 163 | CreateDWordField (MCRS, LMEM._MAX, LMAX) |
| 164 | CreateDWordField (MCRS, LMEM._LEN, LLEN) |
| 165 | If (LAnd (LNotEqual (LPFW, Zero), LEqual (LPEN, One))) |
| 166 | { |
| 167 | Store (LPFW, LMIN) |
| 168 | Store (Add (LMIN, 0x001FFFFF), LMAX) |
| 169 | Store (0x00200000, LLEN) |
| 170 | } |
| 171 | Else |
| 172 | { |
| 173 | Store (Zero, LMIN) |
| 174 | Store (Zero, LMAX) |
| 175 | Store (Zero, LLEN) |
| 176 | } |
| 177 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 178 | /* Update PCI resource area */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 179 | CreateDwordField(MCRS, PMEM._MIN, PMIN) |
| 180 | CreateDwordField(MCRS, PMEM._MAX, PMAX) |
| 181 | CreateDwordField(MCRS, PMEM._LEN, PLEN) |
| 182 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 183 | /* TOLM is BMBOUND accessible from IOSF so is saved in NVS */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 184 | Store (\TOLM, PMIN) |
Matt DeVillier | 7440cc8 | 2017-06-04 14:37:09 -0500 | [diff] [blame] | 185 | Store (Subtract(CONFIG_MMCONF_BASE_ADDRESS, 1), PMAX) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 186 | Add (Subtract (PMAX, PMIN), 1, PLEN) |
| 187 | |
| 188 | Return (MCRS) |
| 189 | } |
| 190 | |
| 191 | /* Device Resource Consumption */ |
| 192 | Device (PDRC) |
| 193 | { |
| 194 | Name (_HID, EISAID("PNP0C02")) |
| 195 | Name (_UID, 1) |
| 196 | |
| 197 | Name (PDRS, ResourceTemplate() { |
| 198 | Memory32Fixed(ReadWrite, ABORT_BASE_ADDRESS, ABORT_BASE_SIZE) |
| 199 | Memory32Fixed(ReadWrite, MCFG_BASE_ADDRESS, MCFG_BASE_SIZE) |
| 200 | Memory32Fixed(ReadWrite, PMC_BASE_ADDRESS, PMC_BASE_SIZE) |
| 201 | Memory32Fixed(ReadWrite, ILB_BASE_ADDRESS, ILB_BASE_SIZE) |
| 202 | Memory32Fixed(ReadWrite, SPI_BASE_ADDRESS, SPI_BASE_SIZE) |
| 203 | Memory32Fixed(ReadWrite, MPHY_BASE_ADDRESS, MPHY_BASE_SIZE) |
| 204 | Memory32Fixed(ReadWrite, PUNIT_BASE_ADDRESS, PUNIT_BASE_SIZE) |
| 205 | Memory32Fixed(ReadWrite, RCBA_BASE_ADDRESS, RCBA_BASE_SIZE) |
| 206 | }) |
| 207 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 208 | /* Current Resource Settings */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 209 | Method (_CRS, 0, Serialized) |
| 210 | { |
| 211 | Return(PDRS) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | Method (_OSC, 4) |
| 216 | { |
| 217 | /* Check for proper GUID */ |
| 218 | If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) |
| 219 | { |
| 220 | /* Let OS control everything */ |
| 221 | Return (Arg3) |
| 222 | } |
| 223 | Else |
| 224 | { |
| 225 | /* Unrecognized UUID */ |
| 226 | CreateDWordField (Arg3, 0, CDW1) |
| 227 | Or (CDW1, 4, CDW1) |
| 228 | Return (Arg3) |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /* IOSF MBI Interface for kernel access */ |
| 233 | Device (IOSF) |
| 234 | { |
| 235 | Name (_HID, "INT33BD") |
| 236 | Name (_CID, "INT33BD") |
| 237 | Name (_UID, 1) |
| 238 | |
| 239 | Name (RBUF, ResourceTemplate () |
| 240 | { |
| 241 | /* MCR / MDR / MCRX */ |
| 242 | Memory32Fixed (ReadWrite, 0, 12, RBAR) |
| 243 | }) |
| 244 | |
| 245 | Method (_CRS) |
| 246 | { |
| 247 | CreateDwordField (^RBUF, ^RBAR._BAS, RBAS) |
| 248 | Store (Add (MCFG_BASE_ADDRESS, 0xD0), RBAS) |
| 249 | Return (^RBUF) |
| 250 | } |
| 251 | } |
| 252 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 253 | /* LPC Bridge 0:1f.0 */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 254 | #include "lpc.asl" |
| 255 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 256 | /* USB XHCI 0:14.0 */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 257 | #include "xhci.asl" |
| 258 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 259 | /* IRQ routing for each PCI device */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 260 | #include "irqroute.asl" |
| 261 | |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 262 | Scope (\_SB) |
| 263 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 264 | /* GPIO Devices */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 265 | #include "gpio.asl" |
Matt DeVillier | 6a67ffb | 2017-06-02 12:30:07 -0500 | [diff] [blame] | 266 | } |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 267 | |
Matt DeVillier | 6a67ffb | 2017-06-02 12:30:07 -0500 | [diff] [blame] | 268 | Scope (\_SB.PCI0) |
| 269 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 270 | /* LPSS Devices */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 271 | #include "lpss.asl" |
| 272 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 273 | /* SCC Devices */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 274 | #include "scc.asl" |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 275 | } |