Angel Pons | 80d9238 | 2020-04-05 15:47:00 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 3 | |
| 4 | #include "../include/soc/iomap.h" |
| 5 | |
| 6 | Name(_HID,EISAID("PNP0A08")) // PCIe |
| 7 | Name(_CID,EISAID("PNP0A03")) // PCI |
| 8 | |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 9 | Name(_BBN, 0) |
| 10 | |
| 11 | Device (MCHC) |
| 12 | { |
| 13 | Name(_ADR, 0x00000000) // 0:0.0 |
| 14 | |
| 15 | OperationRegion(MCHP, PCI_Config, 0x00, 0x100) |
| 16 | Field (MCHP, DWordAcc, NoLock, Preserve) |
| 17 | { |
| 18 | Offset (0x48), // MCHBAR |
| 19 | MHEN, 1, // Enable |
| 20 | , 13, // |
| 21 | MHBR, 22, // MCHBAR |
| 22 | |
| 23 | Offset (0x60), // PCIe BAR |
| 24 | PXEN, 1, // Enable |
| 25 | PXSZ, 2, // BAR size |
| 26 | , 23, // |
| 27 | PXBR, 10, // PCIe BAR |
| 28 | |
| 29 | Offset (0xa8), // Top of Upper Memory |
| 30 | TUUD, 64, |
| 31 | |
| 32 | Offset (0xb8), // TSEGMB |
| 33 | TSEG, 32, |
| 34 | |
| 35 | Offset (0xbc), // Top of Low Used Memory |
| 36 | TLUD, 32, |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | // Current Resource Settings |
| 41 | |
| 42 | Name (MCRS, ResourceTemplate() |
| 43 | { |
| 44 | // Bus Numbers |
| 45 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 46 | 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00) |
| 47 | |
| 48 | // IO Region 0 |
| 49 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 50 | 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00) |
| 51 | |
| 52 | // PCI Config Space |
| 53 | Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008) |
| 54 | |
| 55 | // IO Region 1 |
| 56 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 57 | 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01) |
| 58 | |
| 59 | // VGA memory (0xa0000-0xbffff) |
| 60 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 61 | Cacheable, ReadWrite, |
| 62 | 0x00000000, 0x000a0000, 0x000bffff, 0x00000000, |
| 63 | 0x00020000,,, ASEG) |
| 64 | |
| 65 | // RAM (0xc0000-0xdffff) |
| 66 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 67 | Cacheable, ReadWrite, |
| 68 | 0x00000000, 0x000c0000, 0x000dffff, 0x00000000, |
| 69 | 0x00020000,,, OPR0) |
| 70 | |
| 71 | // PCI Memory Region (Top of memory-PCIEXBAR) |
| 72 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 73 | NonCacheable, ReadWrite, |
| 74 | 0x00000000, 0x00000000, 0xfebfffff, 0x00000000, |
| 75 | 0xfec00000,,, PM01) |
| 76 | |
| 77 | #ifdef ENABLE_TPM |
| 78 | // TPM Area (0xfed40000-0xfed44fff) |
| 79 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 80 | Cacheable, ReadWrite, |
| 81 | 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000, |
| 82 | 0x00005000,,, TPMR) |
| 83 | #endif |
| 84 | |
| 85 | // PCI Memory Region (TOUUD - 64G) |
| 86 | QWORDMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 87 | NonCacheable, ReadWrite, |
| 88 | 0x00000000, 0x00000000, 0x1ffffffff, 0x00000000, |
| 89 | 0x200000000,,, PM02) |
| 90 | |
| 91 | }) // End MCRS |
| 92 | |
| 93 | Method (_CRS, 0, Serialized) |
| 94 | { |
| 95 | // Find PCI resource area in MCRS |
| 96 | CreateDwordField(MCRS, ^PM01._MIN, PMIN) |
| 97 | CreateDwordField(MCRS, ^PM01._MAX, PMAX) |
| 98 | CreateDwordField(MCRS, ^PM01._LEN, PLEN) |
| 99 | |
| 100 | // MMIO Low is saved in NVS |
| 101 | Store (\MMOB, PMIN) |
| 102 | Store (\MMOL, PMAX) |
| 103 | Add (Subtract (PMAX, PMIN), 1, PLEN) |
| 104 | |
| 105 | // Find PCI resource area in MCRS |
| 106 | CreateQWordField(MCRS, ^PM02._MIN, P2MN) |
| 107 | CreateQWordField(MCRS, ^PM02._MAX, P2MX) |
| 108 | CreateQWordField(MCRS, ^PM02._LEN, P2LN) |
| 109 | |
| 110 | // MMIO High is saved in NVS |
| 111 | Store(\MMHB, P2MN) |
| 112 | Store(\MMHL, P2MX) |
| 113 | Add(Subtract(P2MX,P2MN),1,P2LN) |
| 114 | |
| 115 | Return (MCRS) |
| 116 | } // End _CRS |
| 117 | |
| 118 | /* PCI Device Resource Consumption */ |
| 119 | Device (PDRC) |
| 120 | { |
| 121 | Name (_HID, EISAID("PNP0C02")) |
| 122 | Name (_UID, 1) |
| 123 | |
| 124 | Name (PDRS, ResourceTemplate() { |
| 125 | // PCIEXBAR memory range |
Kyösti Mälkki | 503d324 | 2019-03-05 07:54:28 +0200 | [diff] [blame] | 126 | Memory32Fixed(ReadOnly, CONFIG_MMCONF_BASE_ADDRESS, 0x10000000) |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 127 | // TSEG |
| 128 | Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, TSMB) |
| 129 | }) |
| 130 | |
| 131 | // Current Resource Settings |
| 132 | Method (_CRS, 0, Serialized) |
| 133 | { |
| 134 | // Fix up 32-bit TSEG |
| 135 | CreateDWordField(PDRS, ^TSMB._BAS, TSMN) |
| 136 | Store(\TSGB, TSMN) |
| 137 | CreateDWordField(PDRS, ^TSMB._LEN, TSLN) |
| 138 | Store(\TSSZ, TSLN) |
| 139 | Return(PDRS) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // Global Registers |
| 144 | Device (GREG) { |
| 145 | Name (_ADR, 0x00040000) |
| 146 | } |
| 147 | |
| 148 | // Root Complex Event Collector |
| 149 | Device (RCEC) { |
| 150 | Name (_ADR, 0x00050000) |
| 151 | } |
| 152 | |
| 153 | // Virtual root port 2 |
| 154 | Device (VRP2) { |
| 155 | Name (_ADR, 0x00060000) |
Stephen Douthit | ecb0e40 | 2019-08-05 11:53:35 -0400 | [diff] [blame] | 156 | |
| 157 | Method (_PRT) |
| 158 | { |
| 159 | Return (IRQM (6)) |
| 160 | } |
Mariusz Szafranski | a404133 | 2017-08-02 17:28:17 +0200 | [diff] [blame] | 161 | } |