1*83d290c5STom Rini/* SPDX-License-Identifier: GPL-2.0+ */ 248cf8b83SBin Meng/* 348cf8b83SBin Meng * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com> 448cf8b83SBin Meng */ 548cf8b83SBin Meng 648cf8b83SBin MengDevice (PCI0) 748cf8b83SBin Meng{ 848cf8b83SBin Meng Name(_HID, EISAID("PNP0A08")) /* PCIe */ 948cf8b83SBin Meng Name(_CID, EISAID("PNP0A03")) /* PCI */ 1048cf8b83SBin Meng 1148cf8b83SBin Meng Name(_ADR, 0) 1248cf8b83SBin Meng Name(_BBN, 0) 1348cf8b83SBin Meng 1448cf8b83SBin Meng Name(MCRS, ResourceTemplate() 1548cf8b83SBin Meng { 1648cf8b83SBin Meng /* Bus Numbers */ 1748cf8b83SBin Meng WordBusNumber(ResourceProducer, MinFixed, MaxFixed, PosDecode, 1848cf8b83SBin Meng 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100, , , PB00) 1948cf8b83SBin Meng 2048cf8b83SBin Meng /* IO Region 0 */ 2148cf8b83SBin Meng WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, 2248cf8b83SBin Meng 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8, , , PI00) 2348cf8b83SBin Meng 2448cf8b83SBin Meng /* PCI Config Space */ 2548cf8b83SBin Meng IO(Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008) 2648cf8b83SBin Meng 2748cf8b83SBin Meng /* IO Region 1 */ 2848cf8b83SBin Meng WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, 2948cf8b83SBin Meng 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300, , , PI01) 3048cf8b83SBin Meng 3148cf8b83SBin Meng /* VGA memory (0xa0000-0xbffff) */ 3248cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 3348cf8b83SBin Meng Cacheable, ReadWrite, 3448cf8b83SBin Meng 0x00000000, 0x000a0000, 0x000bffff, 0x00000000, 3548cf8b83SBin Meng 0x00020000, , , ASEG) 3648cf8b83SBin Meng 3748cf8b83SBin Meng /* OPROM reserved (0xc0000-0xc3fff) */ 3848cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 3948cf8b83SBin Meng Cacheable, ReadWrite, 4048cf8b83SBin Meng 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000, 4148cf8b83SBin Meng 0x00004000, , , OPR0) 4248cf8b83SBin Meng 4348cf8b83SBin Meng /* OPROM reserved (0xc4000-0xc7fff) */ 4448cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 4548cf8b83SBin Meng Cacheable, ReadWrite, 4648cf8b83SBin Meng 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000, 4748cf8b83SBin Meng 0x00004000, , , OPR1) 4848cf8b83SBin Meng 4948cf8b83SBin Meng /* OPROM reserved (0xc8000-0xcbfff) */ 5048cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 5148cf8b83SBin Meng Cacheable, ReadWrite, 5248cf8b83SBin Meng 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000, 5348cf8b83SBin Meng 0x00004000, , , OPR2) 5448cf8b83SBin Meng 5548cf8b83SBin Meng /* OPROM reserved (0xcc000-0xcffff) */ 5648cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 5748cf8b83SBin Meng Cacheable, ReadWrite, 5848cf8b83SBin Meng 0x00000000, 0x000cc000, 0x000cffff, 0x00000000, 5948cf8b83SBin Meng 0x00004000, , , OPR3) 6048cf8b83SBin Meng 6148cf8b83SBin Meng /* OPROM reserved (0xd0000-0xd3fff) */ 6248cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 6348cf8b83SBin Meng Cacheable, ReadWrite, 6448cf8b83SBin Meng 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000, 6548cf8b83SBin Meng 0x00004000, , , OPR4) 6648cf8b83SBin Meng 6748cf8b83SBin Meng /* OPROM reserved (0xd4000-0xd7fff) */ 6848cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 6948cf8b83SBin Meng Cacheable, ReadWrite, 7048cf8b83SBin Meng 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000, 7148cf8b83SBin Meng 0x00004000, , , OPR5) 7248cf8b83SBin Meng 7348cf8b83SBin Meng /* OPROM reserved (0xd8000-0xdbfff) */ 7448cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 7548cf8b83SBin Meng Cacheable, ReadWrite, 7648cf8b83SBin Meng 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000, 7748cf8b83SBin Meng 0x00004000, , , OPR6) 7848cf8b83SBin Meng 7948cf8b83SBin Meng /* OPROM reserved (0xdc000-0xdffff) */ 8048cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 8148cf8b83SBin Meng Cacheable, ReadWrite, 8248cf8b83SBin Meng 0x00000000, 0x000dc000, 0x000dffff, 0x00000000, 8348cf8b83SBin Meng 0x00004000, , , OPR7) 8448cf8b83SBin Meng 8548cf8b83SBin Meng /* BIOS Extension (0xe0000-0xe3fff) */ 8648cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 8748cf8b83SBin Meng Cacheable, ReadWrite, 8848cf8b83SBin Meng 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000, 8948cf8b83SBin Meng 0x00004000, , , ESG0) 9048cf8b83SBin Meng 9148cf8b83SBin Meng /* BIOS Extension (0xe4000-0xe7fff) */ 9248cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 9348cf8b83SBin Meng Cacheable, ReadWrite, 9448cf8b83SBin Meng 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000, 9548cf8b83SBin Meng 0x00004000, , , ESG1) 9648cf8b83SBin Meng 9748cf8b83SBin Meng /* BIOS Extension (0xe8000-0xebfff) */ 9848cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 9948cf8b83SBin Meng Cacheable, ReadWrite, 10048cf8b83SBin Meng 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000, 10148cf8b83SBin Meng 0x00004000, , , ESG2) 10248cf8b83SBin Meng 10348cf8b83SBin Meng /* BIOS Extension (0xec000-0xeffff) */ 10448cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 10548cf8b83SBin Meng Cacheable, ReadWrite, 10648cf8b83SBin Meng 0x00000000, 0x000ec000, 0x000effff, 0x00000000, 10748cf8b83SBin Meng 0x00004000, , , ESG3) 10848cf8b83SBin Meng 10948cf8b83SBin Meng /* System BIOS (0xf0000-0xfffff) */ 11048cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 11148cf8b83SBin Meng Cacheable, ReadWrite, 11248cf8b83SBin Meng 0x00000000, 0x000f0000, 0x000fffff, 0x00000000, 11348cf8b83SBin Meng 0x00010000, , , FSEG) 11448cf8b83SBin Meng 11548cf8b83SBin Meng /* PCI Memory Region (TOLM-CONFIG_MMCONF_BASE_ADDRESS) */ 11648cf8b83SBin Meng DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, 11748cf8b83SBin Meng Cacheable, ReadWrite, 11848cf8b83SBin Meng 0x00000000, 0x00000000, 0x00000000, 0x00000000, 11948cf8b83SBin Meng 0x00000000, , , PMEM) 12048cf8b83SBin Meng }) 12148cf8b83SBin Meng 12248cf8b83SBin Meng Method(_CRS, 0, Serialized) 12348cf8b83SBin Meng { 12448cf8b83SBin Meng /* Update PCI resource area */ 12548cf8b83SBin Meng CreateDwordField(MCRS, ^PMEM._MIN, PMIN) 12648cf8b83SBin Meng CreateDwordField(MCRS, ^PMEM._MAX, PMAX) 12748cf8b83SBin Meng CreateDwordField(MCRS, ^PMEM._LEN, PLEN) 12848cf8b83SBin Meng 12948cf8b83SBin Meng /* 13048cf8b83SBin Meng * Hardcode TOLM to 2GB for now (see DRAM_MAX_SIZE in quark.h) 13148cf8b83SBin Meng * 13248cf8b83SBin Meng * TODO: for generic usage, read TOLM value from register, or 13348cf8b83SBin Meng * from global NVS (not implemented by U-Boot yet). 13448cf8b83SBin Meng */ 13548cf8b83SBin Meng Store(0x80000000, PMIN) 13648cf8b83SBin Meng Store(Subtract(MCFG_BASE_ADDRESS, 1), PMAX) 13748cf8b83SBin Meng Add(Subtract(PMAX, PMIN), 1, PLEN) 13848cf8b83SBin Meng 13948cf8b83SBin Meng Return (MCRS) 14048cf8b83SBin Meng } 14148cf8b83SBin Meng 14248cf8b83SBin Meng /* Device Resource Consumption */ 14348cf8b83SBin Meng Device (PDRC) 14448cf8b83SBin Meng { 14548cf8b83SBin Meng Name(_HID, EISAID("PNP0C02")) 14648cf8b83SBin Meng Name(_UID, 1) 14748cf8b83SBin Meng 14848cf8b83SBin Meng Name(PDRS, ResourceTemplate() { 14948cf8b83SBin Meng Memory32Fixed(ReadWrite, CONFIG_ESRAM_BASE, 0x80000) 15048cf8b83SBin Meng Memory32Fixed(ReadWrite, MCFG_BASE_ADDRESS, MCFG_BASE_SIZE) 15148cf8b83SBin Meng Memory32Fixed(ReadWrite, RCBA_BASE_ADDRESS, RCBA_BASE_SIZE) 15248cf8b83SBin Meng IO(Decode16, SPI_DMA_BASE_ADDRESS, SPI_DMA_BASE_ADDRESS, 0x0010, SPI_DMA_BASE_SIZE) 15348cf8b83SBin Meng IO(Decode16, GPIO_BASE_ADDRESS, GPIO_BASE_ADDRESS, 0x0080, GPIO_BASE_SIZE) 15448cf8b83SBin Meng IO(Decode16, WDT_BASE_ADDRESS, WDT_BASE_ADDRESS, 0x0040, WDT_BASE_SIZE) 15548cf8b83SBin Meng }) 15648cf8b83SBin Meng 15748cf8b83SBin Meng /* Current Resource Settings */ 15848cf8b83SBin Meng Method(_CRS, 0, Serialized) 15948cf8b83SBin Meng { 16048cf8b83SBin Meng Return (PDRS) 16148cf8b83SBin Meng } 16248cf8b83SBin Meng } 16348cf8b83SBin Meng 16448cf8b83SBin Meng Method(_OSC, 4) 16548cf8b83SBin Meng { 16648cf8b83SBin Meng /* Check for proper GUID */ 16748cf8b83SBin Meng If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { 16848cf8b83SBin Meng /* Let OS control everything */ 16948cf8b83SBin Meng Return (Arg3) 17048cf8b83SBin Meng } Else { 17148cf8b83SBin Meng /* Unrecognized UUID */ 17248cf8b83SBin Meng CreateDWordField(Arg3, 0, CDW1) 17348cf8b83SBin Meng Or(CDW1, 4, CDW1) 17448cf8b83SBin Meng Return (Arg3) 17548cf8b83SBin Meng } 17648cf8b83SBin Meng } 17748cf8b83SBin Meng 17848cf8b83SBin Meng /* LPC Bridge 0:1f.0 */ 17948cf8b83SBin Meng #include "lpc.asl" 18048cf8b83SBin Meng 18148cf8b83SBin Meng /* IRQ routing for each PCI device */ 18248cf8b83SBin Meng #include <asm/acpi/irqroute.asl> 18348cf8b83SBin Meng} 184