From patchwork Wed Feb 28 19:24:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130043 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121250lja; Wed, 28 Feb 2018 11:24:40 -0800 (PST) X-Google-Smtp-Source: AH8x227GAjPs75XzviP6aMVwNytCTG441SLwCILu3utRN0tFvlsnKc0i6X2+Qg2GBFUm97N9u/2H X-Received: by 2002:a17:902:aa8e:: with SMTP id d14-v6mr18409659plr.94.1519845880675; Wed, 28 Feb 2018 11:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845880; cv=none; d=google.com; s=arc-20160816; b=BNZRhBI1KQc/ogsvEDwFW3wnyRE3dwUEBCT3wWzt1XZeP7682x/n/hg1ipdQzegj5b 7VtjuXiw9SfUDjXjbDeoZ15d+uhiPIl5Wck0VGbf+DixEoCSc9HoCYLAcaW2R7lBDwuD 2dnvA6bHEzwdq07920GbYJODCSnqsxVff8vXbIl8PG/JWE+r/P6yMXRPiV9/McHKPd0S BSPfOZBvXmoFZiM/GWxMu4KxYWaA5A90fg8DLzV0WBK7G7E0KaLOKJ/tVqFsPOwDg1rS 10vPAvKW4ughzcGRWNEKzKYjPRVhd9HwvBSO+fbAcprWtZzZVlcmRoRA5wePdR29qJt/ wlCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=fJoQX2PX3DQndnklqsKHvWg4dIWLdrwT73mhuZGkjLM=; b=POE108kshP3bIuKlrW8AfjweNUnEEiaLy28dmmtN5LsjBrIg/IoCxL5oVyqX+VftNr jsHwePbe+5NwHHJFkSyaElX27gh7WQBFqs4+wxlah2QyP/sCuS6SU65Y58HpJlYQYUE5 JggOpgvMQx5wsGosbIpjRkhrqzix0K4miowsH/TI27gkRrGd421YK5ZcKSuGqRvBtz9p hm90ZjEyVBha/UoDGZTnsl8uBMJwDGIQpEdvBEZ9V9Jujjp3BMvf5Itqrb17uNZ45BHq P/zidQzYngi255yiwopsJzykwOOzANTl01lMyJKRhPBt5y+k5knMdxTyacV2Q90s6tWW oPSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ygz6TttS; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id t85si1667077pfj.296.2018.02.28.11.24.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ygz6TttS; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8533422352293; Wed, 28 Feb 2018 11:18:32 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7752722352288 for ; Wed, 28 Feb 2018 11:18:30 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id f14so3616645wre.8 for ; Wed, 28 Feb 2018 11:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zy0Ia3ygcecFtPlfGbwDqMjGGjAD1cQ4HvaBG4yB6gQ=; b=Ygz6TttS9u0NYnvvyxbHh1lvOXiaG3GNCFoJ/94x99Wr+fPwKL239WHAK6lQxeKd2V o/RQlB4UpFlIUgFX6dP+TDZJ4OqYAF+c3/8yWr6viDOsvFiLegDuywXPDSvfippLb3XK P6tlewVM3JINdNF6Sb0EOA9RzIz/oYA/Fbc24= 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=Zy0Ia3ygcecFtPlfGbwDqMjGGjAD1cQ4HvaBG4yB6gQ=; b=QlgWRW8vXgCkykuF7EWILFyzIEA9qtaUedNiVyqmRSVDo6A4yUKPnC3NIxF9xk3BOa Bjs+EYEpmUAplw1eHx0yawVOMXESPG/ElAlJFA7CDbqfKLgJDxzHXAwsvmsTQBQrSNbH ycp01jgZv0iUTm7wpVNG2AYcCh2Ugp72S8P6yCAcsdvKTajRzlvbuEfvKQjLwKYbOP/W sFrN1Vj4h+x+lEFdTa0/knmqFEECUpledF6c0U9JsdeQukvvCFBNnioAeKx4mQANxGaK lESM2Zf8xcPWOQZqrsX8WnrAzzqMbCIhal3kHzTeoQgHjY28lQwFe14CPeO/wFZjCdch oLog== X-Gm-Message-State: APf1xPCD1yTPhnbZ+NqSyZLW+nsGW1XFOoyrrMnvLXtPPRHRloiPrwTR Hd81JeQzDG2/zndt/bo1MsmNxcVJA0A= X-Received: by 10.223.182.2 with SMTP id f2mr10792611wre.117.1519845876465; Wed, 28 Feb 2018 11:24:36 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:35 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:15 +0000 Message-Id: <20180228192421.17684-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 1/7] Platform/Socionext/DeveloperBox: fix PCIe slot to B/D/F mapping X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Fix the static B/D/F specifiers that refer to the pair of x1 PCIe slots on the DeveloperBox PCB. The current configuration caused user-configurable settings for slots 1/2 to apply to the incorrect one. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h b/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h index ee2357be9a06..2d3d5cd91be0 100644 --- a/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h +++ b/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h @@ -62,7 +62,7 @@ #define SYNQUACER_PCI_LOCATION(s,b,d) (((s) << 16) | ((b) << 8) | (d)) #define SYNQUACER_PCI_SLOT0_LOCATION SYNQUACER_PCI_LOCATION(1, 0, 0) -#define SYNQUACER_PCI_SLOT1_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 7) -#define SYNQUACER_PCI_SLOT2_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 3) +#define SYNQUACER_PCI_SLOT1_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 3) +#define SYNQUACER_PCI_SLOT2_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 7) #endif From patchwork Wed Feb 28 19:24:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130044 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121291lja; Wed, 28 Feb 2018 11:24:43 -0800 (PST) X-Google-Smtp-Source: AH8x2253GPfepWjQL5aIlzx0rUG85NB04F7JrZwMRbNg+zDWrBgJTamyI3YYbuwUzJG/uhOqmYN3 X-Received: by 2002:a17:902:9a98:: with SMTP id w24-v6mr18597389plp.188.1519845883090; Wed, 28 Feb 2018 11:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845883; cv=none; d=google.com; s=arc-20160816; b=rKlYrwlWANNoouHUnzT4p5OGGysNcX9rYXMNLz24nhFZ2qznxgJkPOPZh7iY4GwhUq CZJksxTNDhaKNDK5qLds3d9JXZczxBaXCcBmih1RRrfoYC2kf92rsImO3u7hDwQF9S/s N052GG3kUvC8HGnnHMavUOPdrm2xTpED/8MMjkP1UWuVBAnhM1+m0XMcUhthur4O8pFd v5hQMnwgJQxrqHOC/b0w7AtSViL4uD40AAoR0XLCk2GEykqVxxBBIK9ctzXegAnk4Imf INdhwNLDCJ9U70F0Z+zcQzpeEUpzCkBhBpIkf+BazHgaVR96rA/DYIQ5YoEuXhdZ0/35 puHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Fo/eTxmS+HMi/uG9HiapVgHELCrv+3QNGu1ThGaQebQ=; b=WQNf6VKImXVKYCmItaWRPo0NAvx0b4EfzPlaxrv3KW9unDnhpcF0GNY0rGReabHXLB vljO6lkJOs2Cw/jrGOAv1i3GOGK17L8WXQJo6YRpz5QvW99QF8PAogykNGt3uStDQ8Ur WSB07PcZS37iSPnm9aIFinXBLzdWf4zgQ0BtbRHS+sbI+VUQfEo+SuCTwEjYbmQv/P4F xw65uMAUI08n9/kCb0H3gVTTf57fQp4kd2O6Myex4RIDDPKJnEgwd3E4VMYI4F871qcD fE4JUNemEFPST0AQquqcJgC37Oetvhh4oVtZVtxDadQKdd70qgPooQpSRQVTavxA7yTa x6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Gfn8s467; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id u8-v6si1713642plm.389.2018.02.28.11.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Gfn8s467; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EB72E22352296; Wed, 28 Feb 2018 11:18:34 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7D77E21F6A6FC for ; Wed, 28 Feb 2018 11:18:33 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id k9so3611191wre.9 for ; Wed, 28 Feb 2018 11:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qJ9DfMipfGVCXlezkU0W//NSkZQ+2+pmoIBb0s86zzE=; b=Gfn8s467ZXCjwMKQNAM/25zkCodQhlwWfJxpF/C0cT5unCZ2tXQYylbHxpHC7Qknaj B/HaEnTHDJcIux9S7Q4Fwqqm7ptgFIfqk6EZgKSndbuLaozId+cp7EXt8TeGKA6jRwkM Yq6SBMyJ/RNOa8Wo5+OCv7Kf50zYEc6ZIqtUk= 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=qJ9DfMipfGVCXlezkU0W//NSkZQ+2+pmoIBb0s86zzE=; b=b+svOW4G4Pjp3ztC2wSZ+CSDncu9t2D9iiwNukgUPUQgaAUIpVYYOtbpuNe9t44Mmf KSSVdviKtA9UaCV34W3pDzEI7Wp6ScvkL6aLWK/DJyoEhW/wld1O7fPo0IvQXcw/WHqx O5aT+fJ9qEJjWj1IoDF8sxNFtQzk2iyQxPgwD3jpLCnmiVE9JhnqiUDCT1VlLp8PYTaw gkJFHD/8tOMyPGMp2sab2Gq+BH5OyzTvBHj3tx3L8GKcLSIWrIIIUZt/yB8OFEBEpH6a scFfCxqQ72mXy+2hPGoX6HHRfd9cOTaszofJ7G5MV4lnlpAQV5qzEyErgB+id9nsq6Zx CwLg== X-Gm-Message-State: APf1xPAg5ImtP5cOQWSWZ5WT+nV8p2+mGSQKLFzE0qS/lwZi47+teS+p EzlPdzAPmNdCkEfxyFfJS1NjpIUO4jU= X-Received: by 10.223.177.138 with SMTP id q10mr15765137wra.132.1519845879182; Wed, 28 Feb 2018 11:24:39 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:38 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:16 +0000 Message-Id: <20180228192421.17684-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 2/7] Silicon/SynQuacer: tweak PCI I/O windows for ACPI/Linux support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The ACPI/Linux code does not cope very well with I/O BAR windows that involve type translation and address translation. In particular, the secondary I/O window we implement on SynQuacer: I/O 0x10000 ... 0x1ffff -> 0x77f00000 is misinterpreted by Linux, and results in the MMIO range starting at 0x77f10000 to be mapped for I/O port access to this range. This can be mitigated by using the same bus range for I/O port access on both RCs., i.e., [0x0 ... 0xffff]. This configuration can be represented using both DT and ACPI, and will work as expected in Linux. However, there is a downside: UEFI does not cope with I/O address translation in the generic PCI host bridge driver, and so it does not allow two regions [0x0 ... 0xffff] to be configured. Since we have plenty of I/O space, and given that nobody cares about port I/O anymore in the first place, let's shrink the UEFI view of the I/O windows until they no longer overlap. In our case, with two such windows, this means we divide the size by 2, and we end up with a window [0x0 ... 0x7fff] and one at [0x8000 ... 0xffff]. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi | 2 +- Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h | 18 +++++++++++------- Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLibConstructor.c | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi index 05d1673a5c2b..6eb5fd9430cb 100644 --- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi +++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi @@ -483,7 +483,7 @@ bus-range = <0x0 0x7e>; #address-cells = <3>; #size-cells = <2>; - ranges = <0x1000000 0x00 0x00010000 0x00 0x77f00000 0x0 0x00010000>, + ranges = <0x1000000 0x00 0x00000000 0x00 0x77f00000 0x0 0x00010000>, <0x2000000 0x00 0x78000000 0x00 0x78000000 0x0 0x08000000>, <0x3000000 0x3f 0x00000000 0x3f 0x00000000 0x1 0x00000000>; diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h b/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h index 2d3d5cd91be0..fea01c29088c 100644 --- a/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h +++ b/Silicon/Socionext/SynQuacer/Include/Platform/Pcie.h @@ -23,12 +23,12 @@ #define SYNQUACER_PCI_SEG0_BUSNUM_MIN 0x0 #define SYNQUACER_PCI_SEG0_BUSNUM_MAX 0x7e +#define SYNQUACER_PCI_SEG0_BUSNUM_RANGE 0x7f #define SYNQUACER_PCI_SEG0_PORTIO_MIN 0x0 -#define SYNQUACER_PCI_SEG0_PORTIO_MAX 0xffff -#define SYNQUACER_PCI_SEG0_PORTIO_SIZE 0x10000 +#define SYNQUACER_PCI_SEG0_PORTIO_MAX 0x7fff #define SYNQUACER_PCI_SEG0_PORTIO_MEMBASE 0x67f00000 -#define SYNQUACER_PCI_SEG0_PORTIO_MEMSIZE SYNQUACER_PCI_SEG0_PORTIO_SIZE +#define SYNQUACER_PCI_SEG0_PORTIO_MEMSIZE 0x10000 #define SYNQUACER_PCI_SEG0_MMIO32_MIN 0x68000000 #define SYNQUACER_PCI_SEG0_MMIO32_MAX 0x6fffffff @@ -45,12 +45,12 @@ #define SYNQUACER_PCI_SEG1_BUSNUM_MIN 0x0 #define SYNQUACER_PCI_SEG1_BUSNUM_MAX 0x7e +#define SYNQUACER_PCI_SEG1_BUSNUM_RANGE 0x7f -#define SYNQUACER_PCI_SEG1_PORTIO_MIN 0x10000 -#define SYNQUACER_PCI_SEG1_PORTIO_MAX 0x1ffff -#define SYNQUACER_PCI_SEG1_PORTIO_SIZE 0x10000 +#define SYNQUACER_PCI_SEG1_PORTIO_MIN 0x8000 +#define SYNQUACER_PCI_SEG1_PORTIO_MAX 0xffff #define SYNQUACER_PCI_SEG1_PORTIO_MEMBASE 0x77f00000 -#define SYNQUACER_PCI_SEG1_PORTIO_MEMSIZE SYNQUACER_PCI_SEG1_PORTIO_SIZE +#define SYNQUACER_PCI_SEG1_PORTIO_MEMSIZE 0x10000 #define SYNQUACER_PCI_SEG1_MMIO32_MIN 0x78000000 #define SYNQUACER_PCI_SEG1_MMIO32_MAX 0x7fffffff @@ -65,4 +65,8 @@ #define SYNQUACER_PCI_SLOT1_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 3) #define SYNQUACER_PCI_SLOT2_LOCATION SYNQUACER_PCI_LOCATION(0, 1, 7) +#define SYNQUACER_PCI_OS_IO_BASE SYNQUACER_PCI_SEG0_PORTIO_MIN +#define SYNQUACER_PCI_OS_IO_LIMIT SYNQUACER_PCI_SEG1_PORTIO_MAX +#define SYNQUACER_PCI_OS_IO_RANGE SYNQUACER_PCI_SEG1_PORTIO_MEMSIZE + #endif diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLibConstructor.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLibConstructor.c index e4679543cc66..6a3b32f6ca55 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLibConstructor.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLibConstructor.c @@ -348,8 +348,8 @@ PciInitControllerPost ( // Region 3: port I/O range ConfigureWindow (DbiBase, 3, IoMemBase, - RootBridge->Io.Base, - RootBridge->Io.Limit - RootBridge->Io.Base + 1, + SYNQUACER_PCI_OS_IO_BASE, + SYNQUACER_PCI_OS_IO_RANGE, IATU_REGION_CTRL_1_OFF_OUTBOUND_0_TYPE_IO, 0); From patchwork Wed Feb 28 19:24:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130045 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121337lja; Wed, 28 Feb 2018 11:24:46 -0800 (PST) X-Google-Smtp-Source: AH8x225PSvJ7Pa0iupkEYyFenm/1tNHqZaAlzzhp29G7c2ml8ZFW92F6wEEfF8Ang36ug18U73l/ X-Received: by 10.101.82.139 with SMTP id y11mr15082200pgp.68.1519845886536; Wed, 28 Feb 2018 11:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845886; cv=none; d=google.com; s=arc-20160816; b=B+KxudP2cJ6gQZvgII9prRyJp0MXW05UQ0PDEHBbKcROyx7WLm8YEB0kDwEvygpDRf M31AR889XqG3T/mKS7KD9/IRKmWhFnCTHaT9QAsuKW8/Wo+gGxp461+YeaM2QlAaNLYt NXxvBiJ7/lUvwwOdzLiwFsfbs07ZJNusrpWnaCHKkXAgB91nSkIaZJ8WOUwgKVHZJnfL L/FcCQ7QgwuQjhEVU2/rpxdyibY874uCDuk66ZwG9TBF/1LHs0HEEHrK/d1AVEuYdJaR qx81/Y4WbgJLztB9mdzXkuOuaSJ+2WJyEwJP3V2fTDkbky+LY4S9YL0pBztjR7+4EKaS W/bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=2U2cF+YdIMOIhc6e8l4pEH+FKHzFEvGvJ9WQU5qx9Jc=; b=fW3NJK/yXU60mQdEQK1Xue2qviKsz/VRXm+bEJDVPfhK+Qf2UZ4RLBmlizSdCggaS0 rTZK17Dky4ZxhFYdf1rOziSb3jP6n+VjEp28tjCkjPnJC6c2erPq6OapQTIbIUivwn30 kOftA0UCNLTUtI92kIhIlip8U86KGphqzSk2cTQZnB2jB3RtrEIGIDAU632uhQ5+rH6K irN5E08s9RDgrwih+mT097F3ZUrTm87b6MUyE35FjkBF4Ekxphd2P8ssXrUJYLS0OBxA 3w2RxDgrHYZ4dMWcPAukjoOigjvUBvOPAVUZrvOZrmUgOCS7PFHP99JIkc/wDa/NDyaY Qq1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=h2ru4qcc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id u8-v6si1713726plm.389.2018.02.28.11.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=h2ru4qcc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 642B8223522A4; Wed, 28 Feb 2018 11:18:38 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::234; helo=mail-wm0-x234.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D03F02235229F for ; Wed, 28 Feb 2018 11:18:36 -0800 (PST) Received: by mail-wm0-x234.google.com with SMTP id q83so7184093wme.5 for ; Wed, 28 Feb 2018 11:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Aeg/gllH/XIj0mTwt96V4MWKECbuwrGGgo9zxFspuXI=; b=h2ru4qcc4KHzOgojLgz5Sm3VLDFl5pk6bsm2/T1Z3zGE913hjAOZkD/Rf83o5iXmnI qAOYGciKMjM9XSXrU7j1ZlQyUTHWZ9A7DXKZRWJ4LpLm71F+IiPLczINY6eRYXtFKa2+ CchV5ASgGnlqS0A/wTfNRAIlbQmz88dgQvOIw= 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=Aeg/gllH/XIj0mTwt96V4MWKECbuwrGGgo9zxFspuXI=; b=CTVhnKkDeIXuMJuDPW+P0/gv7LuCW36BpnfSz0wuRh6GUdb5b3T0bzOneBeVMq17Ae 6kRHwQvqFQPkVQtTCl+VjrbMnYYdY4lEXI+HPwEXiGtK14HgfAd5UMBTHTaLK2mHWVe3 vkI2DrvbC0Xkz5TnAUp+59W2c1VhQD9iyjsjnde8nBg2GktLNjZ/MX2s6kqiVa1TErSB Z1PS/FpicLAgyfFaq4qvgEYBdyeDSXzNvYiz5Kn0psTX3Fg2aKclDgUt7xHkE9MVMlZI 5TuW0v7EEdbpCJPJz6g01g5vZnmQboRi051bWiAcPsghPSZDapq8kJbEjAjzn6pX9VKe CAHg== X-Gm-Message-State: AElRT7FBNJmKHnWi4j7oCchVYi5xnY+F/jrnWKSb8QJ7EPNsoM7Q2FNb S6jDRzPJ3c8fLTelvNuy71HtJuO8NKk= X-Received: by 10.28.182.139 with SMTP id g133mr2298847wmf.158.1519845881947; Wed, 28 Feb 2018 11:24:41 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:40 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:17 +0000 Message-Id: <20180228192421.17684-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 3/7] Silicon/SynQuacer: add ACPI drivers and tables X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add the ACPI tables describing various parts of the SynQuacer SoC and its peripherals, and the drivers to expose them to the EvalBoard and DeveloperBox platforms. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 2 + Platform/Socionext/DeveloperBox/DeveloperBox.fdf | 13 + Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 2 + Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf | 13 + Silicon/Socionext/SynQuacer/Acpi.dsc.inc | 48 ++++ Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl | 262 ++++++++++++++++++++ Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.h | 73 ++++++ Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf | 64 +++++ Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl | 187 ++++++++++++++ Silicon/Socionext/SynQuacer/AcpiTables/Fadt.aslc | 91 +++++++ Silicon/Socionext/SynQuacer/AcpiTables/Gtdt.aslc | 93 +++++++ Silicon/Socionext/SynQuacer/AcpiTables/Iort.aslc | 101 ++++++++ Silicon/Socionext/SynQuacer/AcpiTables/Madt.aslc | 182 ++++++++++++++ Silicon/Socionext/SynQuacer/AcpiTables/Mcfg.aslc | 63 +++++ Silicon/Socionext/SynQuacer/AcpiTables/Spcr.aslc | 128 ++++++++++ 15 files changed, 1322 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc index eb088524d2dd..9b5d5864116a 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc @@ -687,3 +687,5 @@ [Components.common] MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.inf Platform/Socionext/DeveloperBox/OsInstallerMenuDxe/OsInstallerMenuDxe.inf + +!include Silicon/Socionext/SynQuacer/Acpi.dsc.inc diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf index e4e4f13764cc..50e385b519d0 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf @@ -255,6 +255,13 @@ [FV.FvMain] INF Platform/Socionext/DeveloperBox/OsInstallerMenuDxe/OsInstallerMenuDxe.inf + # + # ACPI support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf + INF RuleOverride = ACPITABLE Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf + !if $(DO_X86EMU) == TRUE # # x86 emulator @@ -492,3 +499,9 @@ [Rule.Common.PEIM.FMP_IMAGE_DESC] UI STRING="$(MODULE_NAME)" Optional VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM = $(NAMED_GUID) { + RAW ACPI |.acpi + RAW ASL |.aml + } diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc index 2d5a94ed1dab..f2c6aa15fee4 100644 --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc @@ -638,3 +638,5 @@ [Components.common] MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf + +!include Silicon/Socionext/SynQuacer/Acpi.dsc.inc diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf index ba2f32328c2b..20d19120d1b7 100644 --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf @@ -233,6 +233,13 @@ [FV.FvMain] SECTION UI = "Pkcs7TestRoot" } + # + # ACPI support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf + INF RuleOverride = ACPITABLE Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf + [FV.FVMAIN_COMPACT] FvAlignment = 16 BlockSize = 0x10000 @@ -455,3 +462,9 @@ [Rule.Common.PEIM.FMP_IMAGE_DESC] UI STRING="$(MODULE_NAME)" Optional VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM = $(NAMED_GUID) { + RAW ACPI |.acpi + RAW ASL |.aml + } diff --git a/Silicon/Socionext/SynQuacer/Acpi.dsc.inc b/Silicon/Socionext/SynQuacer/Acpi.dsc.inc new file mode 100644 index 000000000000..73a5ea40e313 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/Acpi.dsc.inc @@ -0,0 +1,48 @@ +# +# Copyright (c) 2018, Linaro Limited. All rights reserved. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag] + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + +[PcdsFixedAtBuild.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId|"SNI " + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId|0x52434155514e5953 # SYNQUACR + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision|0x20180226 + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId|0x4f524e4c # LNRO + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision|1 + +################################################################################ +# +# Components Section - list of all EDK II Modules needed by this Platform +# +################################################################################ + +[Components.common] + # + # ACPI support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf { + + NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf + + + # support ACPI v5.0 or later + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20 + } + MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf + Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl new file mode 100644 index 000000000000..1735264f09a3 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl @@ -0,0 +1,262 @@ +/** @file + Secondary System Description Table (SSDT) for SynQuacer PCIe RCs + + Copyright (c) 2014-2016, ARM Ltd. All rights reserved.
+ Copyright (c) 2018, Linaro Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include + +#include "AcpiTables.h" + +DefinitionBlock ("SsdtPci.aml", "SSDT", 1, "SNI", "SYNQUACR", + EFI_ACPI_OEM_REVISION) +{ + Scope (_SB) + { + Device (PCI0) + { + Name (_HID, EISAID("PNP0A08")) // PCI Express Root Bridge + Name (_CID, EISAID("PNP0A03")) // Compatible PCI Root Bridge + Name (_SEG, 0) // PCI Segment Group number + Name (_BBN, Zero) // PCI Base Bus Number + Name (_CCA, 1) // Cache Coherency Attribute + + // PCI Routing Table + Name (_PRT, Package () { + Package () { 0xFFFF, 0, Zero, 222 }, // INTA + Package () { 0xFFFF, 1, Zero, 222 }, // INTB + Package () { 0xFFFF, 2, Zero, 222 }, // INTC + Package () { 0xFFFF, 3, Zero, 222 }, // INTD + }) + // Root complex resources + Method (_CRS, 0, Serialized) { + Name (RBUF, ResourceTemplate () { + WordBusNumber ( // Bus numbers assigned to this root + ResourceProducer, + MinFixed, MaxFixed, PosDecode, + 0, // AddressGranularity + SYNQUACER_PCI_SEG0_BUSNUM_MIN, // Minimum Bus Number + SYNQUACER_PCI_SEG0_BUSNUM_MAX, // Maximum Bus Number + 0, // AddressTranslation + SYNQUACER_PCI_SEG0_BUSNUM_RANGE // RangeLength - # of Busses + ) + + DWordMemory ( // 32-bit BAR Windows + ResourceProducer, PosDecode, + MinFixed, MaxFixed, + Cacheable, ReadWrite, + 0x00000000, // Granularity + SYNQUACER_PCI_SEG0_MMIO32_MIN, // Min Base Address + SYNQUACER_PCI_SEG0_MMIO32_MAX, // Max Base Address + 0x00000000, // Translate + SYNQUACER_PCI_SEG0_MMIO32_SIZE // Length + ) + + QWordMemory ( // 64-bit BAR Windows + ResourceProducer, PosDecode, + MinFixed, MaxFixed, + Cacheable, ReadWrite, + 0x00000000, // Granularity + SYNQUACER_PCI_SEG0_MMIO64_MIN, // Min Base Address + SYNQUACER_PCI_SEG0_MMIO64_MAX, // Max Base Address + 0x00000000, // Translate + SYNQUACER_PCI_SEG0_MMIO64_SIZE // Length + ) + + DWordIo ( // IO window + ResourceProducer, + MinFixed, + MaxFixed, + PosDecode, + EntireRange, + 0x00000000, // Granularity + SYNQUACER_PCI_OS_IO_BASE, // Min Base Address + SYNQUACER_PCI_OS_IO_LIMIT, // Max Base Address + SYNQUACER_PCI_SEG0_PORTIO_MEMBASE, // Translate + SYNQUACER_PCI_OS_IO_RANGE, // Length + , + , + , + TypeTranslation + ) + }) // Name (RBUF) + + Return (RBUF) + } // Method(_CRS) + + Device (RES0) + { + Name (_HID, "PNP0C02") + Name (_CRS, ResourceTemplate () + { + Memory32Fixed (ReadWrite, + SYNQUACER_PCI_SEG0_CONFIG_BASE, + SYNQUACER_PCI_SEG0_CONFIG_SIZE) + }) + } + + // + // OS Control Handoff + // + Name (SUPP, Zero) // PCI _OSC Support Field value + Name (CTRL, Zero) // PCI _OSC Control Field value + + Method(_OSC,4) + { + // Check for proper UUID + 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) + + // Disable PCIe and SHPC hotplug, AER and PME + And (CTRL, 0x10, 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 + } // PCI0 + + Device (PCI1) + { + Name (_HID, EISAID("PNP0A08")) // PCI Express Root Bridge + Name (_CID, EISAID("PNP0A03")) // Compatible PCI Root Bridge + Name (_SEG, 1) // PCI Segment Group number + Name (_BBN, Zero) // PCI Base Bus Number + Name (_CCA, 1) // Cache Coherency Attribute + + // PCI Routing Table + Name (_PRT, Package () { + Package () { 0xFFFF, 0, Zero, 214 }, // INTA + Package () { 0xFFFF, 1, Zero, 214 }, // INTB + Package () { 0xFFFF, 2, Zero, 214 }, // INTC + Package () { 0xFFFF, 3, Zero, 214 }, // INTD + }) + // Root complex resources + Method (_CRS, 0, Serialized) { + Name (RBUF, ResourceTemplate () { + WordBusNumber ( // Bus numbers assigned to this root + ResourceProducer, + MinFixed, MaxFixed, PosDecode, + 0, // AddressGranularity + SYNQUACER_PCI_SEG1_BUSNUM_MIN, // Minimum Bus Number + SYNQUACER_PCI_SEG1_BUSNUM_MAX, // Maximum Bus Number + 0, // AddressTranslation + SYNQUACER_PCI_SEG1_BUSNUM_RANGE // RangeLength - # of Busses + ) + + DWordMemory ( // 32-bit BAR Windows + ResourceProducer, PosDecode, + MinFixed, MaxFixed, + Cacheable, ReadWrite, + 0x00000000, // Granularity + SYNQUACER_PCI_SEG1_MMIO32_MIN, // Min Base Address + SYNQUACER_PCI_SEG1_MMIO32_MAX, // Max Base Address + 0x00000000, // Translate + SYNQUACER_PCI_SEG1_MMIO32_SIZE // Length + ) + + QWordMemory ( // 64-bit BAR Windows + ResourceProducer, PosDecode, + MinFixed, MaxFixed, + Cacheable, ReadWrite, + 0x00000000, // Granularity + SYNQUACER_PCI_SEG1_MMIO64_MIN, // Min Base Address + SYNQUACER_PCI_SEG1_MMIO64_MAX, // Max Base Address + 0x00000000, // Translate + SYNQUACER_PCI_SEG1_MMIO64_SIZE // Length + ) + + DWordIo ( // IO window + ResourceProducer, + MinFixed, + MaxFixed, + PosDecode, + EntireRange, + 0x00000000, // Granularity + SYNQUACER_PCI_OS_IO_BASE, // Min Base Address + SYNQUACER_PCI_OS_IO_LIMIT, // Max Base Address + SYNQUACER_PCI_SEG1_PORTIO_MEMBASE, // Translate + SYNQUACER_PCI_OS_IO_RANGE, // Length + , + , + , + TypeTranslation + ) + }) // Name (RBUF) + + Return (RBUF) + } // Method(_CRS) + + Device (RES0) + { + Name (_HID, "PNP0C02") + Name (_CRS, ResourceTemplate () + { + Memory32Fixed (ReadWrite, + SYNQUACER_PCI_SEG1_CONFIG_BASE, + SYNQUACER_PCI_SEG1_CONFIG_SIZE) + }) + } + + // + // OS Control Handoff + // + Name (SUPP, Zero) // PCI _OSC Support Field value + Name (CTRL, Zero) // PCI _OSC Control Field value + + Method(_OSC,4) + { + // Check for proper UUID + 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) + + // Disable PCIe and SHPC hotplug, AER and PME + And (CTRL, 0x10, 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 + } // PCI0 + } +} diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.h b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.h new file mode 100644 index 000000000000..734a60a5b098 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.h @@ -0,0 +1,73 @@ +/** @file +* +* Copyright (c) 2013-2014, ARM Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __ACPITABLES_H__ +#define __ACPITABLES_H__ + +// +// ACPI table information used to initialize tables. +// +#define EFI_ACPI_OEM_ID 'S','N','I',' ',' ',' ' +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('S','Y','N','Q','U','A','C','R') +#define EFI_ACPI_OEM_REVISION FixedPcdGet32 (PcdAcpiDefaultOemRevision) +#define EFI_ACPI_CREATOR_ID SIGNATURE_32('L','N','R','O') +#define EFI_ACPI_CREATOR_REVISION FixedPcdGet32 (PcdAcpiDefaultCreatorRevision) + +// A macro to initialise the common header part of EFI ACPI tables as defined by +// EFI_ACPI_DESCRIPTION_HEADER structure. +#define __ACPI_HEADER(Signature, Type, Revision) { \ + Signature, /* UINT32 Signature */ \ + sizeof (Type), /* UINT32 Length */ \ + Revision, /* UINT8 Revision */ \ + 0, /* UINT8 Checksum */ \ + { EFI_ACPI_OEM_ID }, /* UINT8 OemId[6] */ \ + EFI_ACPI_OEM_TABLE_ID, /* UINT64 OemTableId */ \ + EFI_ACPI_OEM_REVISION, /* UINT32 OemRevision */ \ + EFI_ACPI_CREATOR_ID, /* UINT32 CreatorId */ \ + EFI_ACPI_CREATOR_REVISION /* UINT32 CreatorRevision */ \ + } + +#define EFI_ACPI_6_0_GIC_REDISTRIBUTOR_INIT(RedisRegionAddr, RedisDiscLength) \ + { \ + EFI_ACPI_6_0_GICR, \ + sizeof (EFI_ACPI_6_0_GICR_STRUCTURE), \ + 0, \ + RedisRegionAddr, \ + RedisDiscLength \ + } + +#define EFI_ACPI_6_0_GIC_ITS_FRAME_INIT(Id, PhysAddress) \ + { \ + EFI_ACPI_6_0_GIC_ITS, \ + sizeof (EFI_ACPI_6_0_GIC_ITS_STRUCTURE), \ + 0, \ + Id, \ + PhysAddress, \ + 0 \ + } + +#define EFI_ACPI_6_0_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(RefreshFramePhys, \ + ControlFramePhys, WatchdogTimerGSIV, WatchdogTimerFlags) \ + { \ + EFI_ACPI_6_0_GTDT_SBSA_GENERIC_WATCHDOG, \ + sizeof(EFI_ACPI_6_0_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \ + EFI_ACPI_RESERVED_WORD, \ + RefreshFramePhys, \ + ControlFramePhys, \ + WatchdogTimerGSIV, \ + WatchdogTimerFlags \ + } + +#endif diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf new file mode 100644 index 000000000000..b1b6bbaa481d --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf @@ -0,0 +1,64 @@ +## @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (c) 2014-2016, ARM Ltd. All rights reserved. +# Copyright (c) 2018, Linaro Ltd. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +## + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = SynQuacerAcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE = USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiTables.h + AcpiSsdtRootPci.asl + Dsdt.asl + Fadt.aslc + Gtdt.aslc + Iort.aslc + Madt.aslc + Mcfg.aslc + Spcr.aslc + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.dec + Silicon/Socionext/SynQuacer/SynQuacer.dec + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdClusterCount + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + + gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase + gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl b/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl new file mode 100644 index 000000000000..b6f6c4360029 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Dsdt.asl @@ -0,0 +1,187 @@ +/** @file + Differentiated System Description Table Fields (DSDT) + + Copyright (c) 2014-2016, ARM Ltd. All rights reserved.
+ Copyright (c) 2018, Linaro Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "AcpiTables.h" + +#include + +DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "SNI", "SYNQUACR", + EFI_ACPI_OEM_REVISION) { + Scope (_SB) { + // + // A53x4 Processor declaration + // + Device (CP00) { // A53-0: Cluster 0, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 0) + } + Device (CP01) { // A53-0: Cluster 0, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 1) + } + + Device (CP04) { // A53-0: Cluster 1, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 2) + } + Device (CP05) { // A53-0: Cluster 1, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 3) + } + + Device (CP08) { // A53-0: Cluster 2, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 4) + } + Device (CP09) { // A53-0: Cluster 2, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 5) + } + + Device (CP12) { // A53-0: Cluster 3, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 6) + } + Device (CP13) { // A53-0: Cluster 3, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 7) + } + + Device (CP16) { // A53-0: Cluster 4, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 8) + } + Device (CP17) { // A53-0: Cluster 4, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 9) + } + + Device (CP20) { // A53-0: Cluster 5, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 10) + } + Device (CP21) { // A53-0: Cluster 5, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 11) + } + + Device (CP24) { // A53-0: Cluster 6, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 12) + } + Device (CP25) { // A53-0: Cluster 6, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 13) + } + + Device (CP28) { // A53-0: Cluster 7, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 14) + } + Device (CP29) { // A53-0: Cluster 7, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 15) + } + + Device (CP32) { // A53-0: Cluster 8, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 16) + } + Device (CP33) { // A53-0: Cluster 8, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 17) + } + + Device (CP36) { // A53-0: Cluster 9, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 18) + } + Device (CP37) { // A53-0: Cluster 9, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 19) + } + + Device (CP40) { // A53-0: Cluster 10, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 20) + } + Device (CP41) { // A53-0: Cluster 10, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 21) + } + + Device (CP44) { // A53-0: Cluster 11, Cpu 0 + Name (_HID, "ACPI0007") + Name (_UID, 22) + } + Device (CP45) { // A53-0: Cluster 11, Cpu 1 + Name (_HID, "ACPI0007") + Name (_UID, 23) + } + + // UART PL011 + Device (COM0) { + Name (_HID, "ARMH0011") + Name (_CID, "PL011") + Name (_UID, Zero) + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, FixedPcdGet32 (PcdSerialRegisterBase), 0x1000) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 95 } + }) + } + + Device (NET0) { + Name (_HID, "SCX0001") + Name (_UID, Zero) + Name (_CCA, 1) + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, SYNQUACER_NETSEC1_BASE, + SYNQUACER_NETSEC1_BASE_SZ) + Memory32Fixed (ReadWrite, FixedPcdGet32 (PcdNetsecEepromBase), 0x10000) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 208 } + }) + + Name (_DSD, Package () // _DSD: Device-Specific Data + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { "phy-mode", "rgmii" }, + Package (2) { "phy-channel", FixedPcdGet32 (PcdNetsecPhyAddress) }, + Package (2) { "max-speed", 1000 }, + Package (2) { "max-frame-size", 9000 }, + Package (2) { "socionext,phy-clock-frequency", 125000000 }, + } + }) + } + + Device (I2C0) { + Name (_HID, "SCX0003") + Name (_UID, Zero) + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, SYNQUACER_I2C1_BASE, SYNQUACER_I2C1_SIZE) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 } + }) + + Name (_DSD, Package () // _DSD: Device-Specific Data + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { "socionext,pclk-rate", 62500000 }, + } + }) + } + } // Scope (_SB) +} diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Fadt.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Fadt.aslc new file mode 100644 index 000000000000..0bc4c6a87b2c --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Fadt.aslc @@ -0,0 +1,91 @@ +/** @file +* Fixed ACPI Description Table (FADT) +* +* Copyright (c) 2012 - 2016, ARM Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include + +#include "AcpiTables.h" + +EFI_ACPI_6_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = { + __ACPI_HEADER ( + EFI_ACPI_6_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_0_FIXED_ACPI_DESCRIPTION_TABLE, + EFI_ACPI_6_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION + ), + 0, // UINT32 FirmwareCtrl + 0, // UINT32 Dsdt + EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved0 + EFI_ACPI_6_0_PM_PROFILE_ENTERPRISE_SERVER, // UINT8 PreferredPmProfile + 0, // UINT16 SciInt + 0, // UINT32 SmiCmd + 0, // UINT8 AcpiEnable + 0, // UINT8 AcpiDisable + 0, // UINT8 S4BiosReq + 0, // UINT8 PstateCnt + 0, // UINT32 Pm1aEvtBlk + 0, // UINT32 Pm1bEvtBlk + 0, // UINT32 Pm1aCntBlk + 0, // UINT32 Pm1bCntBlk + 0, // UINT32 Pm2CntBlk + 0, // UINT32 PmTmrBlk + 0, // UINT32 Gpe0Blk + 0, // UINT32 Gpe1Blk + 0, // UINT8 Pm1EvtLen + 0, // UINT8 Pm1CntLen + 0, // UINT8 Pm2CntLen + 0, // UINT8 PmTmrLen + 0, // UINT8 Gpe0BlkLen + 0, // UINT8 Gpe1BlkLen + 0, // UINT8 Gpe1Base + 0, // UINT8 CstCnt + 0, // UINT16 PLvl2Lat + 0, // UINT16 PLvl3Lat + 0, // UINT16 FlushSize + 0, // UINT16 FlushStride + 0, // UINT8 DutyOffset + 0, // UINT8 DutyWidth + 0, // UINT8 DayAlrm + 0, // UINT8 MonAlrm + 0, // UINT8 Century + 0, // UINT16 IaPcBootArch + 0, // UINT8 Reserved1 + EFI_ACPI_6_0_HW_REDUCED_ACPI | + EFI_ACPI_6_0_LOW_POWER_S0_IDLE_CAPABLE, // UINT32 Flags + NULL_GAS, // GAS ResetReg + 0, // UINT8 ResetValue + EFI_ACPI_6_0_ARM_PSCI_COMPLIANT, // UINT16 ArmBootArchFlags + EFI_ACPI_6_0_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, + // UINT8 MinorRevision + 0, // UINT64 XFirmwareCtrl + 0, // UINT64 XDsdt + NULL_GAS, // GAS XPm1aEvtBlk + NULL_GAS, // GAS XPm1bEvtBlk + NULL_GAS, // GAS XPm1aCntBlk + NULL_GAS, // GAS XPm1bCntBlk + NULL_GAS, // GAS XPm2CntBlk + NULL_GAS, // GAS XPmTmrBlk + NULL_GAS, // GAS XGpe0Blk + NULL_GAS, // GAS XGpe1Blk + NULL_GAS, // GAS SleepControlReg + NULL_GAS, // GAS SleepStatusReg + 0 // UINT64 HypervisorVendorId +}; + +// +// Reference the table being generated to prevent the optimizer +// from removing the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Fadt; diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Gtdt.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Gtdt.aslc new file mode 100644 index 000000000000..b7391990944f --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Gtdt.aslc @@ -0,0 +1,93 @@ +/** @file +* Generic Timer Description Table (GTDT) +* +* Copyright (c) 2012 - 2016, ARM Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include + +#include "AcpiTables.h" + +#define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF + +#define GTDT_GLOBAL_FLAGS 0 +#define GTDT_GTIMER_FLAGS EFI_ACPI_6_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY + +#pragma pack (1) + +typedef struct { + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; + EFI_ACPI_6_0_GTDT_GT_BLOCK_STRUCTURE TimerBase; + EFI_ACPI_6_0_GTDT_GT_BLOCK_TIMER_STRUCTURE TimerFrame; + EFI_ACPI_6_0_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Watchdog; +} EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES; + +#pragma pack () + +EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = { + { + __ACPI_HEADER( + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES, + EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION + ), + SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress + 0, // UINT32 Reserved + FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags + FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags + FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags + FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags + 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress + 2, // UINT32 PlatformTimerCount + sizeof (EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE) // UINT32 PlatfromTimerOffset + }, + { + EFI_ACPI_6_0_GTDT_GT_BLOCK, // UINT8 Type + sizeof (EFI_ACPI_6_0_GTDT_GT_BLOCK_STRUCTURE) + + sizeof (EFI_ACPI_6_0_GTDT_GT_BLOCK_TIMER_STRUCTURE), + // UINT16 Length + EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved + 0x2A810000, // UINT64 CntCtlBase + 1, // UINT32 GTBlockTimerCount + sizeof (EFI_ACPI_6_0_GTDT_GT_BLOCK_STRUCTURE) // UINT32 GTBlockTimerOffset + }, + { + 0, // UINT8 GTFrameNumber + {0, 0, 0}, // UINT8 Reserved[3] + 0x2A830000, // UINT64 CntBaseX + 0xFFFFFFFFFFFFFFFF, // UINT64 CntEL0BaseX + 92, // UINT32 GTxPhysicalTimerGSIV + 0, // UINT32 GTxPhysicalTimerFlags + 0, // UINT32 GTxVirtualTimerGSIV + 0, // UINT32 GTxVirtualTimerFlags + EFI_ACPI_6_0_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY + // UINT32 GTxCommonFlags + }, + EFI_ACPI_6_0_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT ( + FixedPcdGet32 (PcdGenericWatchdogRefreshBase), + FixedPcdGet32 (PcdGenericWatchdogControlBase), + 94, + 0), +}; + +// +// Reference the table being generated to prevent the optimizer +// from removing the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Gtdt; diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Iort.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Iort.aslc new file mode 100644 index 000000000000..a40dd9d1f053 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Iort.aslc @@ -0,0 +1,101 @@ +/** @file + + Copyright (c) 2018, Linaro Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include + +#include "AcpiTables.h" + +#define FIELD_OFFSET(type, name) __builtin_offsetof(type, name) + +#pragma pack(1) +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE Node; + UINT32 Identifiers[1]; +} SYNQUACER_ITS_NODE; + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_RC_NODE Node; + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE RcIdMapping; +} SYNQUACER_RC_NODE; + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort; + SYNQUACER_ITS_NODE ItsNode; + SYNQUACER_RC_NODE RcNode; +} SYNQUACER_IO_REMAPPING_STRUCTURE; + +#define __SYNQUACER_ID_MAPPING(In, Num, Out, Ref, Flags) \ + { \ + In, \ + Num, \ + Out, \ + FIELD_OFFSET(SYNQUACER_IO_REMAPPING_STRUCTURE, Ref), \ + Flags \ + } + +STATIC SYNQUACER_IO_REMAPPING_STRUCTURE Iort = { + { + __ACPI_HEADER(EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE, + SYNQUACER_IO_REMAPPING_STRUCTURE, + EFI_ACPI_IO_REMAPPING_TABLE_REVISION), + 2, // NumNodes + sizeof(EFI_ACPI_6_0_IO_REMAPPING_TABLE), // NodeOffset + 0 // Reserved + }, { + // ItsNode + { + { + EFI_ACPI_IORT_TYPE_ITS_GROUP, // Type + sizeof(SYNQUACER_ITS_NODE), // Length + 0x0, // Revision + 0x0, // Reserved + 0x0, // NumIdMappings + 0x0, // IdReference + }, + 1, + }, { + 0x0 + }, + }, { + // PciRcNode + { + { + EFI_ACPI_IORT_TYPE_ROOT_COMPLEX, // Type + sizeof(SYNQUACER_RC_NODE), // Length + 0x0, // Revision + 0x0, // Reserved + 0x1, // NumIdMappings + FIELD_OFFSET(SYNQUACER_RC_NODE, RcIdMapping), // IdReference + }, + EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA, // CacheCoherent + 0x0, // AllocationHints + 0x0, // Reserved + EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM | + EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS, // MemoryAccessFlags + EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED, // AtsAttribute + 0x1, // PciSegmentNumber + }, + // + // The SynQuacer pre-ITS cannot be modeled in ACPI, and all accesses to the + // GICv3 ITS doorbell register are reported as originating from device ID #0 + // So map all requester IDs to device ID #0 + // + __SYNQUACER_ID_MAPPING(0x0, 0x0, 0x0, ItsNode, + EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE), + } +}; + +#pragma pack() + +VOID* CONST ReferenceAcpiTable = &Iort; diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Madt.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Madt.aslc new file mode 100644 index 000000000000..6bbf216d80d2 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Madt.aslc @@ -0,0 +1,182 @@ +/** @file +* Multiple APIC Description Table (MADT) +* +* Copyright (c) 2012 - 2016, ARM Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include + +#include "AcpiTables.h" + +#define CORES (FixedPcdGet32 (PcdClusterCount) * \ + FixedPcdGet32 (PcdCoreCount)) +// +// Multiple APIC Description Table +// +#pragma pack (1) + +typedef struct { + EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; + EFI_ACPI_6_0_GIC_STRUCTURE GicInterfaces[CORES]; + EFI_ACPI_6_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor; + EFI_ACPI_6_0_GICR_STRUCTURE GicRedistributor; + EFI_ACPI_6_0_GIC_ITS_STRUCTURE GicIts; +} EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE; + +#pragma pack () + +EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { + { + __ACPI_HEADER ( + EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE, + EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION + ), + // + // MADT specific fields + // + 0, // LocalApicAddress + 0, // Flags + }, + { + // Format: EFI_ACPI_6_0_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, + // PmuIrq, GicBase, GicVBase, + // GicHBase, GsivId, GicRBase) + // Note: The GIC Structure of the primary CPU must be the first entry + // (see note in 5.2.12.14 GICC Structure of ACPI v6.0). + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-0 + 0, 0, GET_MPID(0, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-1 + 0, 1, GET_MPID(0, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-2 + 0, 2, GET_MPID(1, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-3 + 0, 3, GET_MPID(1, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-4 + 0, 4, GET_MPID(2, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-5 + 0, 5, GET_MPID(2, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-6 + 0, 6, GET_MPID(3, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-7 + 0, 7, GET_MPID(3, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-8 + 0, 8, GET_MPID(4, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-9 + 0, 9, GET_MPID(4, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-10 + 0, 10, GET_MPID(5, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-11 + 0, 11, GET_MPID(5, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-12 + 0, 12, GET_MPID(6, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-13 + 0, 13, GET_MPID(6, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-14 + 0, 14, GET_MPID(7, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-15 + 0, 15, GET_MPID(7, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-16 + 0, 16, GET_MPID(8, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-17 + 0, 17, GET_MPID(8, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-18 + 0, 18, GET_MPID(9, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-19 + 0, 19, GET_MPID(9, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-20 + 0, 20, GET_MPID(10, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-21 + 0, 21, GET_MPID(10, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-22 + 0, 22, GET_MPID(11, 0), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + EFI_ACPI_6_0_GICC_STRUCTURE_INIT( // A53-23 + 0, 23, GET_MPID(11, 1), EFI_ACPI_6_0_GIC_ENABLED, 23, + FixedPcdGet32 (PcdGicDistributorBase), + 0x2c020000, 0x2c010000, 25, 0 /* GicRBase */, 0 /* Efficiency */), + }, + // GIC Distributor Entry + EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT (0, FixedPcdGet32 (PcdGicDistributorBase), + 0, 3), + // GIC Redistributor + EFI_ACPI_6_0_GIC_REDISTRIBUTOR_INIT (FixedPcdGet32 (PcdGicRedistributorsBase), + 0x300000), + // GIC ITS + EFI_ACPI_6_0_GIC_ITS_FRAME_INIT(0, 0x30020000) +}; + +// +// Reference the table being generated to prevent the optimizer +// from removing the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Madt; diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Mcfg.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Mcfg.aslc new file mode 100644 index 000000000000..089b9e95aff2 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Mcfg.aslc @@ -0,0 +1,63 @@ +/** @file + + ACPI Memory mapped configuration space base address Description Table (MCFG). + Implementation based on PCI Firmware Specification Revision 3.0 final draft, + downloadable at http://www.pcisig.com/home + + Copyright (c) 2014 - 2016, AMD Inc. All rights reserved. + Copyright (c) 2018, Linaro Limited. All rights reserved. + + This program and the accompanying materials are licensed and + made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the + license may be found at http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include + +#include "AcpiTables.h" + +#pragma pack(push, 1) + +typedef struct { + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER Header; + EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE Structure[2]; +} EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE; + +EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE Mcfg = { + { + __ACPI_HEADER (EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE, + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION), + EFI_ACPI_RESERVED_QWORD + }, + { + { + SYNQUACER_PCI_SEG0_CONFIG_BASE, + 0, + SYNQUACER_PCI_SEG0_BUSNUM_MIN, + SYNQUACER_PCI_SEG0_BUSNUM_MAX, + EFI_ACPI_RESERVED_DWORD + }, { + SYNQUACER_PCI_SEG1_CONFIG_BASE, + 1, + SYNQUACER_PCI_SEG1_BUSNUM_MIN, + SYNQUACER_PCI_SEG1_BUSNUM_MAX, + EFI_ACPI_RESERVED_DWORD + } + } +}; + +#pragma pack(pop) + +// +// Reference the table being generated to prevent the optimizer +// from removing the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Mcfg; diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/Spcr.aslc b/Silicon/Socionext/SynQuacer/AcpiTables/Spcr.aslc new file mode 100644 index 000000000000..699e79e1bf59 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/AcpiTables/Spcr.aslc @@ -0,0 +1,128 @@ +/** @file + + Serial Port Console Redirection Table + (c) 2000 - 2014 Microsoft Corporation. All rights reserved. + http://go.microsoft.com/fwlink/?linkid=403368 + + Copyright (c) 2014 - 2016, AMD Inc. All rights reserved. + Copyright (c) 2018, Linaro Ltd. All rights reserved. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include + +#include "AcpiTables.h" + +#pragma pack(push, 1) + +STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr = { + // + // Header + // + __ACPI_HEADER (EFI_ACPI_5_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, + 2), /* New MS definition for PL011 support */ + // + // InterfaceType + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART, + // + // Reserved[3] + // + { EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE }, + // + // BaseAddress + // + { + EFI_ACPI_5_1_SYSTEM_MEMORY, + 32, + 0, + EFI_ACPI_5_1_DWORD, + FixedPcdGet32 (PcdSerialRegisterBase) + }, + // + // InterruptType + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + // + // Irq + // + 0, + // + // GlobalSystemInterrupt + // + 95, + // + // BaudRate + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200, + // + // Parity + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, + // + // StopBits + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + // + // FlowControl + // + 0, + // + // TerminalType + // + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI, + // + // Language + // + EFI_ACPI_RESERVED_BYTE, + // + // PciDeviceId + // + 0xFFFF, + // + // PciVendorId + // + 0xFFFF, + // + // PciBusNumber + // + 0x00, + // + // PciDeviceNumber + // + 0x00, + // + // PciFunctionNumber + // + 0x00, + // + // PciFlags + // + 0, + // + // PciSegment + // + 0, + // + // Reserved2 + // + EFI_ACPI_RESERVED_DWORD +}; + +#pragma pack(pop) + +// +// Reference the table being generated to prevent the optimizer from removing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Spcr; From patchwork Wed Feb 28 19:24:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130046 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121419lja; Wed, 28 Feb 2018 11:24:51 -0800 (PST) X-Google-Smtp-Source: AH8x224udSyAzNNi6hAk0z8Wh0zLjMzUlHaktPOF3kEI1OVaw1/K/7sHRB3QNQD18sk88o/WP1jZ X-Received: by 10.98.15.137 with SMTP id 9mr18728124pfp.216.1519845891278; Wed, 28 Feb 2018 11:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845891; cv=none; d=google.com; s=arc-20160816; b=X9UU/okBNeER1TNKgU5QhcDiILnzTQJIwOoSfpNjynOg96BXFwepZvn71hZgh3jd7p ZV8feUilc8B0tlk8GqTFhJs3kAO0zrhwZVIwEaU8nx7rIrXBW/+9r8dPYlcylmrFJQxW +qgp4OxvR8sHKzYyjATPbB7JY2gLzvOAdbwXtEASP7At1/94DsZxzuzwisO0jV42tRUx 4jDLNPv+5cgcYYsbQ3/3Eb26xD37uBXyAERbcD8T5Ca6MVj2IGkplTlJsFEEBK4/Tss3 LVi3XIJPRQLuGqy6k1sPdBcaX8+cFMECkgCk+4HJfE0+7HLB0eYABisnnzgxWX7qOG12 Vy3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=qaU4vJhyCu9SmOserkv+LAaWL52maA6UcFfROsxnup4=; b=b6EhBowlUbPfzFaTHgWBruLAp6F2XYnTapatbBnash1rVQW2pTMWiaLRl6cjNLNnxd MEUW2kDXlD2CGK3TSsTWjFjHSmYaUdZJLh8uk5cMiPN6qm72zSpDb//YmG06TS9gV0bS RAgz3B5j6/h7mWYqlCyu4kJTxdv4T2YTdy46n6ff2sMIPGjA9QD6y1+y83M6c/XKc/sZ 5ieXqm4P6KncNWL0tYGYXbK0bN3+FbQBjSCSi+spp0oR0v/5fm+3HgPcmsyYyK6Va0ip ddbdhb/o6YuWDotK73Iv4l9mmtrtTXWZNoPJvFpBXrP74GPN+kq59Lb1pWbI/8ULG502 rP7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Yq46vppd; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c1si1379031pgq.109.2018.02.28.11.24.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Yq46vppd; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 08A2C223522A7; Wed, 28 Feb 2018 11:18:40 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C886F21F6A6FC for ; Wed, 28 Feb 2018 11:18:38 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id l43so3640908wrc.2 for ; Wed, 28 Feb 2018 11:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WzbzPT5M+Dj7kcGJhUnyhr9UXfsw/51qiorokl8nR1g=; b=Yq46vppdiaTkhgeaPccPd1HEszPW3I+gERKNKDzTe8t0y5BLRwuzSRX59pVGDjieuB x1rW9+pLaZEWQ8+DT2Iz5ISM9GDq0TUjyCW9SgcszG9o0q3L/kuWwe0S/r5e8IReNW15 j4+SNauBljAyKvZEvnm9GIwnWdmp30mdq3Eu4= 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=WzbzPT5M+Dj7kcGJhUnyhr9UXfsw/51qiorokl8nR1g=; b=iU4dYW53qgZ9brWIbRyjQGQfioNI9nnfrbJm2OmBVTIgALTKQwqHQGvz87hHO5p36L j1YHxh4yYHky3UKHS1IBOODDbH40ep1um82xltvFCDCuXW2C8Jq15lR0atSot9a/+1nw OFSb2028FnEThWwjdICuXS5DOX23NITxYr/8TZ6JJVp30tp42MHUca2tynX9vNvRqtDj 3sunTNnWKDYKSuZeN8HKd0AfDead41o2/CTEL5Zq8PJy86wvmi8jFAjBKTolvm+L8u0w 51AasOozAUr7ZrzysLaYCb8Qp3GLG3sr9jI6SBkeLJu/2UyeCyqCmIhsiZEQeZ65wfrL c0wg== X-Gm-Message-State: APf1xPBtMsILl7D6QqPAdyKGuGIvpifU4gwUP2zVQNG+NlkcvvCe+gtE +B7luPlwdk2uGQP5M869H9D/lHPHwd0= X-Received: by 10.223.136.44 with SMTP id d41mr17978784wrd.127.1519845884604; Wed, 28 Feb 2018 11:24:44 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:42 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:18 +0000 Message-Id: <20180228192421.17684-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 4/7] Silicon/SynQuacer/PlatformDxe: add option to enable ACPI mode X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Create a HII menu option to choose between device tree and ACPI platform descriptions. Note that the option is only active if PCIe compatibility mode is enabled. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 32 ++++++++++++++------ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 1 + Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni | 8 ++++- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr | 10 +++++- Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h | 8 +++-- 5 files changed, 46 insertions(+), 13 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c index 8787aa6288a7..4ae1c5b0ff6f 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -277,15 +277,29 @@ PlatformDxeEntryPoint ( mHiiSettingsVal = PcdGet64 (PcdPlatformSettings); mHiiSettings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal; - Dtb = NULL; - Status = DtPlatformLoadDtb (&Dtb, &DtbSize); - if (!EFI_ERROR (Status)) { - Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb); - } - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, - "%a: failed to install FDT configuration table - %r\n", __FUNCTION__, - Status)); + if (mHiiSettings->AcpiPref == ACPIPREF_DT) { + Dtb = NULL; + Status = DtPlatformLoadDtb (&Dtb, &DtbSize); + if (!EFI_ERROR (Status)) { + Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb); + } + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: failed to install FDT configuration table - %r\n", __FUNCTION__, + Status)); + } + } else { + // + // ACPI was selected: install the gEdkiiPlatformHasAcpiGuid GUID as a + // NULL protocol to unlock dispatch of ACPI related drivers. + // + Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle, + &gEdkiiPlatformHasAcpiGuid, NULL, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n", + __FUNCTION__)); + } } Handle = NULL; diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index fca66799ebcb..bef7feccd8b8 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -58,6 +58,7 @@ [LibraryClasses] [Guids] g96BoardsI2c0MasterGuid + gEdkiiPlatformHasAcpiGuid gEfiHiiPlatformSetupFormsetGuid gFdtTableGuid gNetsecNonDiscoverableDeviceGuid diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni index 2eca8bbba8c3..836decc870f0 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved. * * This program and the accompanying materials are licensed and made available * under the terms and conditions of the BSD License which accompanies this @@ -33,3 +33,9 @@ #string STR_EMMC_DISABLED #language en-US "Disabled" #string STR_EMMC_ENABLED #language en-US "Enabled" + +#string STR_DT_ACPI_SELECT_PROMPT #language en-US "O/S Hardware Description" +#string STR_DT_ACPI_SELECT_HELP #language en-US "Select the hardware description that will be exposed to the O/S." + +#string STR_DT_ACPI_SELECT_DT #language en-US "Device Tree" +#string STR_DT_ACPI_SELECT_ACPI #language en-US "ACPI" diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr index ea35e902b2d7..8a395eac681b 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved. * * This program and the accompanying materials are licensed and made available * under the terms and conditions of the BSD License which accompanies this @@ -70,6 +70,14 @@ formset option text = STRING_TOKEN(STR_EMMC_ENABLED), value = EMMC_ENABLED, flags = 0; endoneof; + oneof varid = SynQuacerPlatformSettings.AcpiPref, + prompt = STRING_TOKEN(STR_DT_ACPI_SELECT_PROMPT), + help = STRING_TOKEN(STR_DT_ACPI_SELECT_HELP), + flags = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED, + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_DT), value = ACPIPREF_DT, flags = DEFAULT; + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_ACPI), value = ACPIPREF_ACPI, flags = 0; + endoneof; + subtitle text = STRING_TOKEN(STR_NULL_STRING); endform; diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h index fbbcbd7d3eec..bb0e476fc3f8 100644 --- a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h +++ b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+ Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this @@ -22,12 +22,16 @@ #define PCIE_MAX_SPEED_UNLIMITED 0x0 #define PCIE_MAX_SPEED_GEN1 0x1 +#define ACPIPREF_DT 0x0 +#define ACPIPREF_ACPI 0x1 + typedef struct { UINT8 EnableEmmc; UINT8 PcieSlot0MaxSpeed; UINT8 PcieSlot1MaxSpeed; UINT8 PcieSlot2MaxSpeed; - UINT8 Reserved[4]; + UINT8 AcpiPref; + UINT8 Reserved[3]; } SYNQUACER_PLATFORM_VARSTORE_DATA; #endif From patchwork Wed Feb 28 19:24:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130047 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121461lja; Wed, 28 Feb 2018 11:24:55 -0800 (PST) X-Google-Smtp-Source: AH8x225ZSZNcyXQjCTcTNG0AwW/q9pc0pjYfLtpYLYXoz1HqCyUdp0xvDoEea/lyCLMvIuOaLqrh X-Received: by 10.101.71.202 with SMTP id f10mr14834881pgs.91.1519845894925; Wed, 28 Feb 2018 11:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845894; cv=none; d=google.com; s=arc-20160816; b=gr7PH5dg1cGIx5BfhaMLzi+AC90exFnTl8AxpxWeAsNRDt0cCMyoWp6hKMTJG04LO/ okSh1AUem5Ws5Z4lB1zUG2kiHUyxeXyZeN0YWn3Z4A1bMHfB3YID4TudGTsJmrP5Y03F mC9I7vOkOrYCHRzkdnxDs+QtQ1QqqwnPTPV6cS+wbOZkXQzijocKEQ+8J2HVtj+w3sN1 KXIg/B6h7ZD+xDSCCKTKpBAKCCaAFS1AOl/TwoEg4otmJHLh3qXBK6IOBeWpvXDFrl3K nEIPPoLwPXqlemHZK3w2p7V186eh5iDRXpUmBOpXz4jRKlPWlv45WauzGpiFmkE9Hm3O 8A5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=+7XEiwd9T9/IjOBUJskwm6VY6hmoB5TPgXWWLXE1z7A=; b=IlRx4PP04PxX0IdhLmUoSoHAW/ZvzMk3DWpOz5lIKt13k3MqPGkeSmzJ35m+U/AqYc Ox7xgMShc2vQCvg6U0OuVp8tRLs8LNfyj4DHFGRpwKg858srCn2VYnSakd6sLJxOuf0x b75zfj2bj6ros1ipmwc9xogK1k/yeWLuR7kkjNYgQKYMz/MpcuZnhdlViYZsl19HQmJH 7Olw0XpiU4tZp44FciFJWhRy/XLLuTW5xqfuBf2jdv1pQbc0EoLUIu8Bo4QlNMdhFgH+ Sjqyibx6C89LMcLX9u8WqlI78mW/JIscktU+kjkp9UOEtxhhekWhqnhhJkPM4RKU7T+a Wdkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c9Ii9me5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id p1si103749pfp.213.2018.02.28.11.24.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c9Ii9me5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6A917223522A6; Wed, 28 Feb 2018 11:18:43 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 773B321F6A6FC for ; Wed, 28 Feb 2018 11:18:41 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id n7so3627947wrn.5 for ; Wed, 28 Feb 2018 11:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7vU5G1qwg4mk2Ag7BKxrJAUibofJcqVa5RjTuRpqzUI=; b=c9Ii9me5zsdpI3DFYUoXKfiJQ1MV3gdIK2VE3mR+WM5FElDwVeDaKWzjQrqMAvxZvv TeKWW7pQtmSCdvKwtSFd3zFqrMhLoCYDyYmDdDswm+v52uItF9dCpPmP7dUHHpgS55RS rh6KPTiTu8lkmvxNieIm+hf6onC+EETMwbK0E= 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=7vU5G1qwg4mk2Ag7BKxrJAUibofJcqVa5RjTuRpqzUI=; b=Ry9Z+sx6RFskmHe8Lch+NqlsLU1wF4gs1lbW7QXE1A6QAcV63jHucaEq4Xb6kOUbVv esRqT9WcAiiQvVoQ4NMUlrG7uJLSXWP17MA3KADwO9X1LvctrvskPWu7fepsT0soAn/z b37vObimUb25eLHfLUDzdjv2eqDBSFMum3Pguo7tWLhTKC2Uo/ara3MOOeDqdjE+3gQ3 nntynKaQ9y6tDoO53gOTeApoE96mor59wgcCSXEB4VCTaKv2EltBbUSF8zYxrSvgNydf S9k2IgMFnes8iHJFctuHkEQZx3yAWeaVkXzjLKovn6KmOsNAnCWqrBo5k8ZDDSxepRKL LHBQ== X-Gm-Message-State: APf1xPA1GB50KvZNPMIYk+L4YmH0utGxVSlz19tC9J1MKLpkd7C2Kjjs ToHp5rQP2ROazYfHUpmG6iWFhYEHdpE= X-Received: by 10.223.188.18 with SMTP id s18mr18097549wrg.211.1519845887381; Wed, 28 Feb 2018 11:24:47 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:46 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:19 +0000 Message-Id: <20180228192421.17684-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 5/7] Silicon/SynQuacer/PlatformDxe: add ACPI description of eMMC X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Expose a separate ACPI description of the SynQuacer eMMC controller when both ACPI and eMMC support have been enabled in the HII menu. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/Socionext/DeveloperBox/DeveloperBox.fdf | 1 + Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf | 1 + Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.asl | 41 +++++++++++++++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 55 ++++++++++++++++++++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h | 4 ++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 4 ++ 6 files changed, 106 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf index 50e385b519d0..7f8708d3a7a9 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf @@ -450,6 +450,7 @@ [Rule.Common.DXE_DRIVER] PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional RAW BIN Optional |.dtb + RAW ASL Optional |.aml } [Rule.Common.DXE_RUNTIME_DRIVER] diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf index 20d19120d1b7..3f47781fe979 100644 --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf @@ -419,6 +419,7 @@ [Rule.Common.DXE_DRIVER] DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional + RAW ASL Optional |.aml } [Rule.Common.DXE_RUNTIME_DRIVER] diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.asl b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.asl new file mode 100644 index 000000000000..4e371befc7b5 --- /dev/null +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.asl @@ -0,0 +1,41 @@ +/** @file + SSDT describing the SynQuacer eMMC controller + + Copyright (c) 2018, Linaro Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include + +DefinitionBlock ("SsdtEmmc.aml", "SSDT", 1, "SNI", "SynQeMMC", + FixedPcdGet32 (PcdAcpiDefaultOemRevision)) { + Scope (_SB) { + Device (MMC0) { + Name (_HID, "SCX0002") + Name (_UID, Zero) + Name (_CCA, 1) + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, SYNQUACER_EMMC_BASE, SYNQUACER_EMMC_BASE_SZ) + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 184 } + }) + + Name (_DSD, Package () // _DSD: Device-Specific Data + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { "bus-width", 8 }, + Package (2) { "cap-mmc-highspeed", 0x1 }, + Package (2) { "fujitsu,cmd-dat-delay-select", 0x1 }, + } + }) + } + } // Scope (_SB) +} diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c index 7284ea6a7cee..e0987c954c74 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c @@ -59,6 +59,10 @@ STATIC EFI_HANDLE mSdMmcControllerHandle; +STATIC EFI_ACPI_DESCRIPTION_HEADER *mSsdt; +STATIC UINTN mSsdtSize; +STATIC VOID *mEventRegistration; + /** Override function for SDHCI capability bits @@ -182,6 +186,31 @@ STATIC EDKII_SD_MMC_OVERRIDE mSdMmcOverride = { SynQuacerSdMmcNotifyPhase, }; +STATIC +VOID +EFIAPI +InstallAcpiTable ( + IN EFI_EVENT Event, + IN VOID* Context + ) +{ + UINTN TableKey; + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + + Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, + (VOID **)&AcpiTable); + if (EFI_ERROR (Status)) { + return; + } + + Status = AcpiTable->InstallAcpiTable (AcpiTable, mSsdt, mSsdtSize, &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for eMMC - %r\n", + __FUNCTION__, Status)); + } +} + EFI_STATUS EFIAPI RegisterEmmc ( @@ -190,6 +219,32 @@ RegisterEmmc ( { EFI_STATUS Status; EFI_HANDLE Handle; + UINTN Index; + + if (mHiiSettings->AcpiPref == ACPIPREF_ACPI) { + // + // Load the SSDT table from a raw section in this FFS file. + // + for (Index = 0;; Index++) { + Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, + (VOID **)&mSsdt, &mSsdtSize); + if (EFI_ERROR (Status)) { + break; + } + + if (mSsdt->OemTableId != EMMC_TABLE_ID) { + continue; + } + + // + // Register for the ACPI table protocol + // + EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, + InstallAcpiTable, NULL, &mEventRegistration); + + break; + } + } Status = RegisterNonDiscoverableMmioDevice ( NonDiscoverableDeviceTypeSdhci, diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h index a391d2f67c29..c25b7f168a37 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -35,10 +36,13 @@ #include #include #include +#include #include #include #include +#define EMMC_TABLE_ID SIGNATURE_64('S','y','n','Q','e','M','M','C') + extern UINT8 PlatformDxeHiiBin[]; extern UINT8 PlatformDxeStrings[]; diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index bef7feccd8b8..8df3073bf24b 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -23,6 +23,7 @@ [Defines] ENTRY_POINT = PlatformDxeEntryPoint [Sources] + Emmc.asl Emmc.c Pci.c PlatformDxe.c @@ -46,6 +47,7 @@ [LibraryClasses] DebugLib DevicePathLib DtPlatformDtbLoaderLib + DxeServicesLib HiiLib IoLib MemoryAllocationLib @@ -69,10 +71,12 @@ [Guids] [Protocols] gEdkiiNonDiscoverableDeviceProtocolGuid ## PRODUCES gEdkiiSdMmcOverrideProtocolGuid ## PRODUCES + gEfiAcpiTableProtocolGuid ## CONSUMES gEfiPciIoProtocolGuid ## CONSUMES gPcf8563RealTimeClockLibI2cMasterProtocolGuid ## PRODUCES [FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress From patchwork Wed Feb 28 19:24:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130048 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121511lja; Wed, 28 Feb 2018 11:24:58 -0800 (PST) X-Google-Smtp-Source: AH8x227tJBWNUcBfbLhFvRkbglvyyU//NREnMKZk/frzKwwdEIXahq03IK3vfCBI517d6UFP0Zpv X-Received: by 10.101.90.203 with SMTP id d11mr14874725pgt.366.1519845898064; Wed, 28 Feb 2018 11:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845898; cv=none; d=google.com; s=arc-20160816; b=wXgW0Cv+DumQeVZnO4lPtOzx5Kv1yQ2W01Ji/KIf9VGQYqkxXRpCpGXlVJL331tTjB 37UvVeR42kvFbPub9Oz2241vZSr5mY7S/ehrpa9GJFsCPNI+y5yaoDyjFhB7WuuM+Hnz DWzNJWFSm8RxC714NbYV/Dn/mLp5o4ntDaT7+OT7wtQktqgveTghW/JrRgU0u4hV5Xms 6Hj9VE9F1ju80vfTd+Az0cDI1ygN1/swpwUe9k5t8AtT12KsqQq49aLGup46p8dOKrxS Zu+W4o4ZAkXSzqtW1jD1o4XgwSb7dYf4lOxJkj94ite9TlDSICzQ4UXqWC8hXb2hsWGL ZJXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=LQSdmyZdZ8o72Qvi0pqDhC2cBr1WxW7HeRcpmTQLyVw=; b=k7xxqPgYSoaxHXW3lS0Gh5GWO14ysisAIHGs6i1oWqhIKhDMuomClEcBwCjiZW4MRo lxNYo/zLNve5nTU6wqIdvTaFDVBq/P+87I7V1UnLf2PGpw+M8NwEGyyNTVhsoNHCEmBQ Jg65hWeJTFwKlNPmSo+yjEgJTPuM1+0311uMveL92o6UK84xpvTKZnxJRYoFsipGZMrb KwBL2zuvDqngbbVndAcOAo5TZUSZ7GsK5YBpi4O0yXvfcq05//ivACvCB91GR24T6+/2 E37tX9gFwFXkoNcGPUmxkfW+7FS3tALmkX20J9lcz4/MEXpGqCxVhJZD/9He5vV7tvA2 lB6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=h/t7g4Y6; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id y5-v6si1740596pln.274.2018.02.28.11.24.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=h/t7g4Y6; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CA79C223522AF; Wed, 28 Feb 2018 11:18:45 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7560E223522AF for ; Wed, 28 Feb 2018 11:18:43 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id o76so3620896wrb.7 for ; Wed, 28 Feb 2018 11:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LgXotRULN8LPsO6R1PsyOQ4jK9sTOrkbE5dN7TkgYjI=; b=h/t7g4Y64L2zYlpfOSisAj9lWM6N7AKYPY8hZ8tnTv8lfaFp0A3H31RnkMe/1zsOXw JeyP5MRLcQsZVFf/BfC2bGZu8+KAQktpaOeWUCAcTcUir8j13yuz2Z3Olo31mWfvdSRJ jMW3X4PCx6a1gKUtoWbGCyOrsumRLtaEB5/+4= 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=LgXotRULN8LPsO6R1PsyOQ4jK9sTOrkbE5dN7TkgYjI=; b=KGJFDhAxUn+qUVnFYeYuB046rc61dvhxmNwYJTNEYlYKLF2w6kMGGzuBcdQyL7oRDZ 7mOjqmhdQxAygJsQa7mbRihd/wtDveFd8nlK1wDyRtqF12DZhlIgiYGHjk0M1bttHWRu zJgeXmLckoWUJFzX7d7dnsk3lRCrsVSrIhoWrvs3O8m59qzZ+SwNZOSOuHVU+FxKgKdf 4hKtGu+0NXKkQT2kwhwVHmgBpaQlleVpOzJKVhfhDDHyVlfWwDPgbz1R+v97p+o9s8/3 UNPcXpEBIOUtSkeoqp9X5JruL8BvgflVg6vToW9XdXhncE8Yz6bu3kqTQthg/zglf1kA Xafw== X-Gm-Message-State: APf1xPDo/L++sJCBphFenCiddyOum9nzbaHgK2LtBT3LEuTjSqLRTWGH 08E4fFfsNNj9CqFL+aaU/+41FMjegSs= X-Received: by 10.223.142.194 with SMTP id q60mr16403383wrb.113.1519845889458; Wed, 28 Feb 2018 11:24:49 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:48 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:20 +0000 Message-Id: <20180228192421.17684-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 6/7] Silicon/SynQuacer/AcpiTables: disable PCI RCs if ECAM ghosts are detected X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" We have a couple of workarounds available for the ECAM ghosting issue that affects the Synopsys Designware PCIe RCs. First of all, we can be optimistic and hope that the silicon gets fixed at some point. Then, there is a SCP firmware hack that hides these ghosts by remapping the ECAM region using the SMMU sitting between the CPU and the PCIe RC slave interface. Finally, we have a workaround involving stage 2 translation tables that may be enabled at will using a DIP switch on the board. Instead of adding elaborate logic to infer which of these situations we may find ourselves in, let's just test for the symptom directly in the _STA method implementation of the PNP0A08 devices, and deactivate the device if the ECAM space does not appear sane. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl index 1735264f09a3..5ffed663e17d 100644 --- a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl @@ -31,6 +31,26 @@ DefinitionBlock ("SsdtPci.aml", "SSDT", 1, "SNI", "SYNQUACR", Name (_BBN, Zero) // PCI Base Bus Number Name (_CCA, 1) // Cache Coherency Attribute + OperationRegion (BDF1, SystemMemory, SYNQUACER_PCI_SEG0_CONFIG_BASE, 0x10000) + Field (BDF1, DWordAcc, NoLock, Preserve) { + Offset (0x8000), + VPID, 16, + } + + Method (_STA, 0x0, Serialized) { + // + // Check whether the VID/PID of device #1 on bus #0 equals 0xffff. + // If this is not the case, we are dealing with a ghost device, + // which means we are running with outdated SCP firmware and we + // should keep this PCIe RC disabled. + // + Store (VPID, local1) + If (!LEqual (local1, 0xffff)) { + Return (0x0) + } + Return (0xf) + } + // PCI Routing Table Name (_PRT, Package () { Package () { 0xFFFF, 0, Zero, 222 }, // INTA @@ -149,6 +169,26 @@ DefinitionBlock ("SsdtPci.aml", "SSDT", 1, "SNI", "SYNQUACR", Name (_BBN, Zero) // PCI Base Bus Number Name (_CCA, 1) // Cache Coherency Attribute + OperationRegion (BDF1, SystemMemory, SYNQUACER_PCI_SEG1_CONFIG_BASE, 0x10000) + Field (BDF1, DWordAcc, NoLock, Preserve) { + Offset (0x8000), + VPID, 16, + } + + Method (_STA, 0x0, Serialized) { + // + // Check whether the VID/PID of device #1 on bus #0 equals 0xffff. + // If this is not the case, we are dealing with a ghost device, + // which means we are running with outdated SCP firmware and we + // should keep this PCIe RC disabled. + // + Store (VPID, local1) + If (!LEqual (local1, 0xffff)) { + Return (0x0) + } + Return (0xf) + } + // PCI Routing Table Name (_PRT, Package () { Package () { 0xFFFF, 0, Zero, 214 }, // INTA From patchwork Wed Feb 28 19:24:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130049 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp121566lja; Wed, 28 Feb 2018 11:25:01 -0800 (PST) X-Google-Smtp-Source: AH8x224iMFqvGqwM4jR4xktDJFp8ERbFScWa6pIqfqTyqshCGJW9s4efdkK6MD5SAo+AVbQA66WB X-Received: by 10.98.28.202 with SMTP id c193mr18801335pfc.109.1519845901241; Wed, 28 Feb 2018 11:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845901; cv=none; d=google.com; s=arc-20160816; b=Kwd1bEENihm88BULPHjonv5kvr605o1q6seLyCp84h4my0J4h8WzAVjcDN9JDINLSV e++pFhDanL3C3u9z1jCanlYKDq3taRuOCgHXRWsG6ugpmtf1SOFQ+1KRmVlFGioRryXP awEsdrq4ZNJ+HXjId7dvOR2SiwQSqXWmbychbrMQWjDp9KjXVlI9FQdsepHyHflQwjFq XLNKjpZt7/SyZxEMe0cHIKPHGI5hBGqmM2UFnl7yHZafZTpobSp+E+9S3XftdXTQduv1 EmGdSu6020LwyVRu2YnY5AHLmq47yCXuPHQl30vIw8T7KFSkECZveqVuJkeUiagDooZq fROw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=qIbqN4tJ+N+EEcWHbLdd/7eIoAkfvwLm7DpKjJjvSYE=; b=NuClH0OtLFngIRTfu/wIA/3Fr4XtHAX+/VfRZ7eEMRXJrPSYE947uAsQ+DCKV7hjvp ne8kn9VeuFYfVJnGxxjW4IdOLWAxOD6nAeaFoI2RgfGA7UvWFNBNZITxR0LxTwyEomAd CY/5Q5wbnbjqBQmKZqUbmtutOSPFb8jtMz94A5CqOA2KmPxpneU37KaRm/6R8cmRijco KkX5VuT2YwpbljIIoFaxysoGvKPr+clJIuKx3z4toYLdDzaDewdYZsu1K+gxHFEwFtA8 UKkDkssKwerb0kviB9nWNCWkTFAV4+z/mBTbBgNxzVARRIOWxbT47neaBa+1PjLNFchM cnUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eJfx7J2W; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id g13-v6si1768246plo.243.2018.02.28.11.25.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:25:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eJfx7J2W; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 38D9E223522B5; Wed, 28 Feb 2018 11:18:47 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2FDE9223522B5 for ; Wed, 28 Feb 2018 11:18:46 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id i3so5792164wmi.4 for ; Wed, 28 Feb 2018 11:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IpnR5CHMAnD9xNOsB3ZabaF/4F7z5Far0onb4lR0uCo=; b=eJfx7J2WuF4ANw+NBKlhyWdONmX6H76ULCEmhNlFDbcubW7QI4z/o92Fx5G3diP3yP kVF5C00Fh9RXH1K+/XjulAQD2zYK8eXV2IA3dklwlS+64Isw4JpYtc6Jc1Q8skJmnWzN cTyZpfj7lqkISQ9RH62aonzfs13gH46QYE3dg= 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=IpnR5CHMAnD9xNOsB3ZabaF/4F7z5Far0onb4lR0uCo=; b=OrWJaAJW06FFgK4cQpvmuy9PhdCW6AuEbLqM2ZQrJwiHX1xwCPaxAMQVgIlUj4xVF+ SIg3oUGaemc2+MPAXnIzPAYTV6aysJTNhxYo9Jp9ILX2MsvEWBqkl9acTYdGHGBsG5Jw OoxneBhqy1neqf0Wk55xFibELZZHdqSoEz3yy0WyadtJJmRAcPA+IKjuOwz8fflMZOV0 Kxh4RtF4nFSMKWiFaVVetH87N8ozL7iQUa5vhvrpXFeTgE43EiZTeazeHJs3KVA0cLKL LeWbEZ8ehgwjcRBL1fKdS6GCPf9OrBKjcQbDp36TV874MmLC4ShgbL0BGW+vUe8IcPXS GgRA== X-Gm-Message-State: APf1xPD/r5EkCtqYFjkqbCk7VGG/Kpr7J3QVwI9kfRonzHwhxcVhxn1S lqD2KVLXiurIE66faLvFt6jWKwqPXVY= X-Received: by 10.28.229.85 with SMTP id c82mr15885517wmh.76.1519845891910; Wed, 28 Feb 2018 11:24:51 -0800 (PST) Received: from localhost.localdomain ([160.163.57.8]) by smtp.gmail.com with ESMTPSA id 47sm2152312wrb.48.2018.02.28.11.24.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 11:24:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 28 Feb 2018 19:24:21 +0000 Message-Id: <20180228192421.17684-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228192421.17684-1-ard.biesheuvel@linaro.org> References: <20180228192421.17684-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 7/7] Silicon/SynQuacer/AcpiTables: take presence detect of PCI0 into account X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" On the SynQuacer Evalution Board, PCIe RC #0 is not clocked if no card is inserted into the PCIe slot, and so any attempt to access the device registers will lock up the system. So let's check the presence detect pin directly in the _STA implementation of PCI0. This needs to be done before the config space check, because that access itself will lock the system if no card is inserted. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl | 15 +++++++++++++++ Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf | 1 + 2 files changed, 16 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl index 5ffed663e17d..db529aa95220 100644 --- a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiSsdtRootPci.asl @@ -14,6 +14,7 @@ **/ +#include #include #include "AcpiTables.h" @@ -37,7 +38,21 @@ DefinitionBlock ("SsdtPci.aml", "SSDT", 1, "SNI", "SYNQUACR", VPID, 16, } + OperationRegion (GPIO, SystemMemory, SYNQUACER_GPIO_BASE, 8) + Field (GPIO, DWordAcc, NoLock, Preserve) { + , 39, + PRDT, 1, + , 24, + } + Method (_STA, 0x0, Serialized) { + If (!LEqual (FixedPcdGet8 (PcdPcie0PresenceDetectGpioPin), 0xff)) { + Store (PRDT, local0) + If (!LEqual (local0, 0x0)) { + Return (0x0) + } + } + // // Check whether the VID/PID of device #1 on bus #0 equals 0xffff. // If this is not the case, we are dealing with a ghost device, diff --git a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf index b1b6bbaa481d..bca8354d1184 100644 --- a/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf +++ b/Silicon/Socionext/SynQuacer/AcpiTables/AcpiTables.inf @@ -62,3 +62,4 @@ [FixedPcd] gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase gSynQuacerTokenSpaceGuid.PcdNetsecPhyAddress + gSynQuacerTokenSpaceGuid.PcdPcie0PresenceDetectGpioPin