From patchwork Sat Apr 1 11:29:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 96570 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1124604qgd; Sat, 1 Apr 2017 04:36:42 -0700 (PDT) X-Received: by 10.55.192.79 with SMTP id o76mr6594428qki.272.1491046602813; Sat, 01 Apr 2017 04:36:42 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n5si7131989qkl.240.2017.04.01.04.36.42; Sat, 01 Apr 2017 04:36:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 72DF763671; Sat, 1 Apr 2017 11:36:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9ABED63677; Sat, 1 Apr 2017 11:35:02 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 49D0D63678; Sat, 1 Apr 2017 11:34:56 +0000 (UTC) Received: from mail-pg0-f49.google.com (mail-pg0-f49.google.com [74.125.83.49]) by lists.linaro.org (Postfix) with ESMTPS id 5009662C8C for ; Sat, 1 Apr 2017 11:34:11 +0000 (UTC) Received: by mail-pg0-f49.google.com with SMTP id 21so89675120pgg.1 for ; Sat, 01 Apr 2017 04:34:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fDvVYOw/zWkln1ucNvyBel751QN16x+vcB1S2VWQYXs=; b=ZMxBDLmP/PeGw1dHK3Zlv/iup5ixR14dvxjmJDbruT0lFinMgruRlo/IbBQxA+D2+O v9s4ocZSzQuI55hnT8FZtXhpCSPlC7OL/2G+VF6+sj8xVYX417q39atvjhqPJ4reo1ex Xogl8Gq5pjnqwTik5oBjQ6xccOx85fAM7akG6XaGoc7a58CpJF0zxo8oBeK46Tiw4gZZ Frb7NuXowHpAhrqRoHqfU2mHu9LBrK2T/UVGFxpXJSdxkyrngQLLRHPflwq8mTU0v3lJ pF1ugXUp1tBsdfv/BI7/l14nVn4Xc3xf9Z33nOkiZiky2wtewzKtFUrbPeroYvESBsRN yvew== X-Gm-Message-State: AFeK/H0vVZKt+UCWy3S1nwKyZJS1zv1hMvByk9TbASol4gZS/IlT/+ZXI0Qj8iUmOaGCkaUyeAs= X-Received: by 10.98.202.195 with SMTP id y64mr7004710pfk.225.1491046450463; Sat, 01 Apr 2017 04:34:10 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id a62sm15704868pgc.60.2017.04.01.04.34.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Apr 2017 04:34:10 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Sat, 1 Apr 2017 19:29:16 +0800 Message-Id: <1491046162-53797-12-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491046162-53797-1-git-send-email-chenhui.sun@linaro.org> References: <1491046162-53797-1-git-send-email-chenhui.sun@linaro.org> Cc: Yi Li , Chenhui Sun , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [Linaro-uefi v2 11/17] Hisilicon/D05: support the compatibility of kernel PCIe driver X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" As the PCIe driver is updated in kernel 4.10, and it will read the PCIe resource in the PCIe device, so the resource description should also be put into the Device(PCIx). 1. add _OSC support 2. put the pcie resource description into the Device(PCIx), in order to compatible with kernel 4.10 PCIe driver. 3. add reserved ecam resource Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hensonwang Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Chenhui Sun Reviewed-by: Graeme Gregory Reviewed-by: Leif Lindholm --- .../Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Pci.asl | 399 ++++++++++++++++++++- 1 file changed, 384 insertions(+), 15 deletions(-) diff --git a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Pci.asl b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Pci.asl index f9b4722..79267e5 100644 --- a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Pci.asl +++ b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/D05Pci.asl @@ -40,6 +40,49 @@ Scope(_SB) } } +/* + See ACPI 6.1 Spec, 6.2.11, PCI Firmware Spec 3.0, 4.5 +*/ +#define PCI_OSC_SUPPORT() \ + Name(SUPP, Zero) /* PCI _OSC Support Field value */ \ + Name(CTRL, Zero) /* PCI _OSC Control Field value */ \ + Method(_OSC,4) { \ + If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { \ + /* Create DWord-adressable fields from the Capabilities Buffer */ \ + CreateDWordField(Arg3,0,CDW1) \ + CreateDWordField(Arg3,4,CDW2) \ + CreateDWordField(Arg3,8,CDW3) \ + /* Save Capabilities DWord2 & 3 */ \ + Store(CDW2,SUPP) \ + Store(CDW3,CTRL) \ + /* Only allow native hot plug control if OS supports: */ \ + /* ASPM */ \ + /* Clock PM */ \ + /* MSI/MSI-X */ \ + If(LNotEqual(And(SUPP, 0x16), 0x16)) { \ + And(CTRL,0x1E,CTRL) \ + }\ + \ + /* Do not allow native PME, AER */ \ + /* Never allow SHPC (no SHPC controller in this system)*/ \ + And(CTRL,0x10,CTRL) \ + If(LNotEqual(Arg1,One)) { /* Unknown revision */ \ + Or(CDW1,0x08,CDW1) \ + } \ + \ + If(LNotEqual(CDW3,CTRL)) { /* Capabilities bits were masked */ \ + Or(CDW1,0x10,CDW1) \ + } \ + \ + /* Update DWORD3 in the buffer */ \ + Store(CTRL,CDW3) \ + Return(Arg3) \ + } Else { \ + Or(CDW1,4,CDW1) /* Unrecognized UUID */ \ + Return(Arg3) \ + } \ + } // End _OSC + // 1P NA PCIe2 Device (PCI2) { @@ -89,17 +132,44 @@ Scope(_SB) Device (RES2) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ Memory32Fixed (ReadWrite, 0xa00a0000 , 0x10000) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (0xf) } } // Device(PCI2) + + Device (RES2) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0x2) // Unique ID + Name (_CRS, ResourceTemplate (){ + Memory32Fixed (ReadWrite, 0xa00a0000 , 0x10000) //host bridge register space + }) + Method (_STA, 0x0, NotSerialized) + { + Return (0xf) + } + } + + Device (R1NA) // reserve 1p NA ECAM resource + { + Name (_HID, "PNP0C02") // Motherboard reserved resource + Name (_CRS, ResourceTemplate (){ + Memory32Fixed (ReadWrite, 0xa8000000 , 0x800000) //ECAM space for [bus 80-87] + }) + Method (_STA, 0x0, NotSerialized) + { + Return (0xf) + } + } + // 1p NB PCIe0 Device (PCI4) { @@ -149,10 +219,9 @@ Scope(_SB) Device (RES4) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -166,12 +235,38 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCI4) + Device (RES4) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0x4) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8a0090000, // Min Base Address + 0x8a009ffff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } // 1P NB PCI1 Device (PCI5) @@ -222,10 +317,9 @@ Scope(_SB) Device (RES5) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -239,11 +333,37 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCI5) + Device (RES5) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0x5) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8a0200000, // Min Base Address + 0x8a020ffff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } // 1P NB PCIe2 Device (PCI6) @@ -294,10 +414,9 @@ Scope(_SB) Device (RES6) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -311,11 +430,37 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCI6) + Device (RES6) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0x6) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8a00a0000, // Min Base Address + 0x8a00affff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } // 1P NB PCIe3 Device (PCI7) { @@ -365,10 +510,9 @@ Scope(_SB) Device (RES7) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -382,11 +526,100 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCI7) + Device (RES7) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0x7) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8a00b0000, // Min Base Address + 0x8a00bffff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } + + Device (R1NB) // reserve 1p NB ECAM resource + { + Name (_HID, "PNP0C02") // Motherboard reserved resource + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //ECAM space for [bus 88-8f] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8a8800000, // Min Base Address + 0x8a8ffffff, // Max Base Address + 0x0, // Translate + 0x800000 // Length + ) + QwordMemory ( //ECAM space for [bus 0-7] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8b0000000, // Min Base Address + 0x8b07fffff, // Max Base Address + 0x0, // Translate + 0x800000 // Length + ) + QwordMemory ( //ECAM space for [bus c0-c7] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8ac000000, // Min Base Address + 0x8ac7fffff, // Max Base Address + 0x0, // Translate + 0x800000 // Length + ) + QwordMemory ( //ECAM space for [bus 90-97] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x8b9000000, // Min Base Address + 0x8b97fffff, // Max Base Address + 0x0, // Translate + 0x800000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } // 2P NA PCIe2 Device (PCIa) { @@ -436,10 +669,9 @@ Scope(_SB) Device (RESa) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -453,11 +685,61 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (0xf) } } // Device(PCIa) + Device (RESa) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0xa) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x600a00a0000, // Min Base Address + 0x600a00affff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (0xf) + } + } + + Device (R2NA) //reserve for 2p NA ecam resource + { + Name (_HID, "PNP0C02") // Motherboard reserved resource + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //ECAM space for [bus 10-1f] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x64001000000, // Min Base Address + 0x64001ffffff, // Max Base Address + 0x0, // Translate + 0x1000000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (0xf) + } + } // 2P NB PCIe0 Device (PCIc) { @@ -507,10 +789,9 @@ Scope(_SB) Device (RESc) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -524,12 +805,38 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCIc) + Device (RESc) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0xc) // Unique ID + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //host bridge register space + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x700a0090000, // Min Base Address + 0x700a009ffff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } //2P NB PCIe1 Device (PCId) { @@ -579,10 +886,9 @@ Scope(_SB) Device (RESd) { Name (_HID, "HISI0081") // HiSi PCIe RC config base address - Name (_CID, "PNP0C02") // Motherboard reserved resource Name (_CRS, ResourceTemplate (){ QwordMemory ( - ResourceProducer, + ResourceConsumer, PosDecode, MinFixed, MaxFixed, @@ -596,10 +902,73 @@ Scope(_SB) ) }) } + PCI_OSC_SUPPORT() Method (_STA, 0x0, NotSerialized) { Return (RBYV()) } } // Device(PCId) + Device (RESd) + { + Name (_HID, "HISI0081") // HiSi PCIe RC config base address + Name (_CID, "PNP0C02") // Motherboard reserved resource + Name (_UID, 0xd) // Unique ID + Name (_CRS, ResourceTemplate (){ //host bridge register space + QwordMemory ( + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x700a0200000, // Min Base Address + 0x700a020ffff, // Max Base Address + 0x0, // Translate + 0x10000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } + + Device (R2NB) //reserve for 2p NB ecam resource + { + Name (_HID, "PNP0C02") // Motherboard reserved resource + Name (_CRS, ResourceTemplate (){ + QwordMemory ( //ECAM space for [bus 20-2f] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x74002000000, // Min Base Address + 0x74002ffffff, // Max Base Address + 0x0, // Translate + 0x1000000 // Length + ) + QwordMemory ( //ECAM space for [bus 30-3f] + ResourceConsumer, + PosDecode, + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, // Granularity + 0x78003000000, // Min Base Address + 0x78003ffffff, // Max Base Address + 0x0, // Translate + 0x1000000 // Length + ) + }) + Method (_STA, 0x0, NotSerialized) + { + Return (RBYV()) + } + } }