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