Debian Codegraph @

src/soc/intel/apollolake/acpi/northbridge.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3
4 Name (_HID, EisaId("PNP0A08")) /* PCI Express Bus */
5 Name (_CID, EisaId("PNP0A03")) /* PCI Bus */
6
7 Device (MCHC)
8 {
9 Name (_ADR, 0x00000000) /* Device 0 Function 0 */
10
11 OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
12 Field (MCHP, DWordAcc, NoLock, Preserve)
13 {
14 Offset (0x60), /* PCIEXBAR (0:0:0:60) */
15 PXEN, 1, /* Enable */
16 PXSZ, 2, /* PCI Express Size */
17 , 25,
18 PXBR, 11, /* PCI Express Base Address */
19
20 Offset (0xbc), /* TOLUD (0:0:0:bc) */
21 , 20,
22 TLUD, 12, /* Top of Lower Usable DRAM */
23 }
24 }
25
26 External (A4GS, IntObj)
27 External (A4GB, IntObj)
28
29 /* Current Resource Settings */
30 Method (_CRS, 0, Serialized)
31 {
32 Name (MCRS, ResourceTemplate ()
33 {
34 /* Bus Numbers */
35 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
36 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100)
37
38 /* IO Region 0: 0x0000 - 0x0cf7 */
39 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
40 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8)
41
42 /* PCI Config Space */
43 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
44
45 /* IO Region 1: 0x1000 - 0xffff */
46 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
47 0x0000, 0x01000, 0xffff, 0x0000, 0xf000)
48
49 /*
50 * Descriptor: Legacy VGA video RAM
51 * Start: 0xa0000
52 * End: 0xbffff
53 */
54 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
55 Cacheable, ReadWrite,
56 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
57 0x00020000,,,)
58
59 /*
60 * PCI MMIO Region (TOLUD - PCI extended base MMCONF)
61 * This assumes that MMCONF is placed after PCI config space,
62 * and that no resources are allocated after the MMCONF region.
63 * This works, since MMCONF is hardcoded to 0xe00000000.
64 */
65 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
66 NonCacheable, ReadWrite,
67 0x00000000, 0x00000000, 0x00000000, 0x00000000,
68 0x00000000,,, PM01)
69
70 /*
71 * PCI Memory Region above 4 GiB
72 * (TOUUD - (TOUUD + ABOVE_4G_MMIO_SIZE))
73 */
74 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
75 NonCacheable, ReadWrite,
76 0x00000000, 0x00010000, 0x0001ffff, 0x00000000,
77 0x00010000,,, PM02)
78 })
79
80 /* Find PCI resource area in MCRS */
81 CreateDwordField (MCRS, PM01._MIN, PMIN)
82 CreateDwordField (MCRS, PM01._MAX, PMAX)
83 CreateDwordField (MCRS, PM01._LEN, PLEN)
84
85 /* Read C-Unit PCI CFG Reg. 0xBC for TOLUD (shadow from B-Unit) */
86 PMIN = ^MCHC.TLUD << 20
87 /* Use PCR base to ensure PMAX below GPIO controllers attached to _SB */
88 PMAX = CONFIG_PCR_BASE_ADDRESS & 0xF0000000
89
90 /* Calculate PCI MMIO Length */
91 PLEN = PMAX - PMIN + 1
92
93 /* Patch PM02 range based on Memory Size */
94 If (A4GS == 0) {
95 CreateQwordField (MCRS, PM02._LEN, MSEN)
96 MSEN = 0
97 } Else {
98 CreateQwordField (MCRS, PM02._MIN, MMIN)
99 CreateQwordField (MCRS, PM02._MAX, MMAX)
100 CreateQwordField (MCRS, PM02._LEN, MLEN)
101 /* Set 64bit MMIO resource base and length */
102 MLEN = A4GS
103 MMIN = A4GB
104 MMAX = MMIN + MLEN - 1
105 }
106
107 Return (MCRS)
108 }
109
110 Device (PDRC) /* PCI Device Resource Consumption */
111 {
112 Name (_HID, EisaId("PNP0C02"))
113 Name (_UID, 1)
114
115 Method (_CRS, 0, Serialized)
116 {
117 Name (BUF0, ResourceTemplate ()
118 {
119 /* Local APIC range (0xfee0_0000 to 0xfeef_ffff) */
120 Memory32Fixed (ReadOnly, 0x0fee00000, 0x00010000, LIOH)
121 })
122
123 Return (BUF0)
124 }
125 }
126
127 /* Get PCIe BAR */
128 Method (GPCB, 0, Serialized)
129 {
130 Local0 = \_SB.PCI0.MCHC.PXBR << 28
131 Return (Local0)
132 }
133
134 /* Device base address */
135 Method (BASE, 1)
136 {
137 Local0 = Arg0 & 0x7 /* Function number */
138 Local1 = (Arg0 >> 16) & 0x1F /* Device number */
139 Local2 = (Local0 << 12) + (Local1 << 15)
140 Local3 = \_SB.PCI0.GPCB() + Local2
141 Return (Local3)
142 }
143
144 /* GFX 00:02.0 */
145 #include <drivers/intel/gma/acpi/gfx.asl>