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