From patchwork Thu Apr 6 10:29:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96920 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp663907qgd; Thu, 6 Apr 2017 03:31:11 -0700 (PDT) X-Received: by 10.55.5.17 with SMTP id 17mr14984628qkf.279.1491474671682; Thu, 06 Apr 2017 03:31:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d79si1001629qkb.326.2017.04.06.03.31.11; Thu, 06 Apr 2017 03:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5F19760C05; Thu, 6 Apr 2017 10:30:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8337D6433C; Thu, 6 Apr 2017 10:30:22 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 23B2464337; Thu, 6 Apr 2017 10:29:56 +0000 (UTC) Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by lists.linaro.org (Postfix) with ESMTPS id A88B764336 for ; Thu, 6 Apr 2017 10:29:54 +0000 (UTC) Received: by mail-wr0-f172.google.com with SMTP id t20so54642379wra.1 for ; Thu, 06 Apr 2017 03:29:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LszyJgs57ehLqVa+eAULdmKfP8Sfoavs6/SECRajdfI=; b=e9hQjOaPZuJ7Sj7XwDOKIcLs0i47R2eFZ8+3gzO2l6h0LgOATHgISH5w3u2B2WAH/d BrRpvNcfyQUYMzXGLQC2D9ncCQWkwJooWiFvxUyr6cGg7MD0HK3wrxZHal99aE01GVio Z1S2iY17Rx5AHdaD2xJgjQIJB3y4np8tIAwTUTcMZzR+7qJYwRg69SqFhL1WnyEHs5t8 H+6iBaPCMu4j/A85Zg2e+auM2cldXRTnIhSAcmic/Tm+8FUfCpGzvz+311bJIVc4669N 4MHOjjDA36O/axoQrcQZMOwQY6ucsdATFjRbLu1nla7MUofdeqIubF+yJVClVNdUCrHO eeoQ== X-Gm-Message-State: AFeK/H2g23lqhCeCKVSfZC/yQcc0rayzui8sqWqOltpL1zQbkHaG7CKHZEr+PViBbB9SHwmaFOs= X-Received: by 10.28.14.138 with SMTP id 132mr17922043wmo.141.1491474593831; Thu, 06 Apr 2017 03:29:53 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.29.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:29:53 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:34 +0100 Message-Id: <20170406102941.14802-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 1/8] Platforms/AMD: remove /pmu node from Overdrive 1000 DTS X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" The /pmu node is removed and regenerated by the firmware, so there is no need to have it in the template. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dtb | Bin 8117 -> 7969 bytes Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts | 12 ------------ 2 files changed, 12 deletions(-) diff --git a/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dtb b/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dtb index b792b2a47ca0a4482db005f2956c3e01bab098a7..ba5d494f9f815ccb9760cd99a2bdaadf6bd49eab 100644 GIT binary patch delta 36 scmdmLztB$L0`I@K3=Hy$3=9kw3=A?N69vSWr0;ChxWTk}3bUdN0LYOFJ^%m! delta 176 zcmZ2zx7A+Y0`I@K3=HyH85kHW7#L($OcW4fk|~(1C@8$q`Y01~L2l{f`Ap*VK)TEr zsD^; }; - pmu { - compatible = "arm,armv8-pmuv3"; - interrupts = <0x0 0x7 0x4>, - <0x0 0x8 0x4>, - <0x0 0x9 0x4>, - <0x0 0xa 0x4>, - <0x0 0xb 0x4>, - <0x0 0xc 0x4>, - <0x0 0xd 0x4>, - <0x0 0xe 0x4>; - }; - smb { compatible = "simple-bus"; #address-cells = <0x2>; From patchwork Thu Apr 6 10:29:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96921 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp663911qgd; Thu, 6 Apr 2017 03:31:12 -0700 (PDT) X-Received: by 10.237.34.76 with SMTP id o12mr36721773qtc.261.1491474671999; Thu, 06 Apr 2017 03:31:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i23si1025055qta.103.2017.04.06.03.31.11; Thu, 06 Apr 2017 03:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 35D886435F; Thu, 6 Apr 2017 10:30:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A55C164340; Thu, 6 Apr 2017 10:30:22 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 799546433A; Thu, 6 Apr 2017 10:29:59 +0000 (UTC) Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by lists.linaro.org (Postfix) with ESMTPS id DA1A764334 for ; Thu, 6 Apr 2017 10:29:56 +0000 (UTC) Received: by mail-wr0-f172.google.com with SMTP id t20so54643728wra.1 for ; Thu, 06 Apr 2017 03:29:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hTBJVyns07vevZhHndkVaLYljKhMy4q4LesKlun6hVo=; b=lj5LaIcT4ehlLekoSD1+SsA7s+o+GMNQIgZobTSG0OGiUp2OYYVrCO5Wu8pw7e1egF cyr636uqUByddUykHhaeWKWuou/GY5lo4zjDsh90rvJe3kzFz9PVPy+xEIsiWu7w3dfw 7MSQk0R0UwB4ZRZAiPXOVvTdTkv6ln0HGvmmhIiI++g8qejGM6Re5C0tzIaU66iN6P5c L58P4lkBaLTryDt28c3nnzRxEclWQEpnA7tjZLgaHjEGB01nzvagQtWwOIW6WI5BsFn/ rR6wkuTNRB19zwFiuzzZ53Yi42AG+DIqgkIk7rdgejZRDF0Aeqo+vDxGop/x41CfHj5y Sqxg== X-Gm-Message-State: AFeK/H38BtGWJPcQsKPPW8OU1lvVi7QMdonAy/vJw9/f3U89M20L+dGw H5RkdZZO4fPgnzhNKGQ= X-Received: by 10.28.215.18 with SMTP id o18mr23746125wmg.98.1491474595902; Thu, 06 Apr 2017 03:29:55 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.29.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:29:55 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:35 +0100 Message-Id: <20170406102941.14802-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 2/8] Platforms/AMD: clean up whitespace in Overdrive 1000 DTS file X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Use tabs consistently throughout the Overdrive 1000 DTS file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts b/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts index 3290f65aae6a..d99b48d08479 100644 --- a/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts +++ b/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dts @@ -30,9 +30,9 @@ #address-cells = <0x2>; #size-cells = <0x2>; reg = <0x0 0xe1110000 0x0 0x1000>, - <0x0 0xe112f000 0x0 0x2000>, - <0x0 0xe1140000 0x0 0x10000>, - <0x0 0xe1160000 0x0 0x10000>; + <0x0 0xe112f000 0x0 0x2000>, + <0x0 0xe1140000 0x0 0x10000>, + <0x0 0xe1160000 0x0 0x10000>; interrupts = <0x1 0x9 0xf04>; ranges = <0x0 0x0 0x0 0xe1100000 0x0 0x100000>; linux,phandle = <0x1>; @@ -50,9 +50,9 @@ timer { compatible = "arm,armv8-timer"; interrupts = <0x1 0xd 0xff04>, - <0x1 0xe 0xff04>, - <0x1 0xb 0xff04>, - <0x1 0xa 0xff04>; + <0x1 0xe 0xff04>, + <0x1 0xb 0xff04>, + <0x1 0xa 0xff04>; }; smb { @@ -263,14 +263,14 @@ reg = <0x0 0xf0000000 0x0 0x10000000>; interrupt-map-mask = <0xf800 0x0 0x0 0x7>; interrupt-map = <0x1000 0x0 0x0 0x1 0x1 0x0 0x0 0x0 0x120 0x1>, - <0x1000 0x0 0x0 0x2 0x1 0x0 0x0 0x0 0x121 0x1>, - <0x1000 0x0 0x0 0x3 0x1 0x0 0x0 0x0 0x122 0x1>, - <0x1000 0x0 0x0 0x4 0x1 0x0 0x0 0x0 0x123 0x1>; + <0x1000 0x0 0x0 0x2 0x1 0x0 0x0 0x0 0x121 0x1>, + <0x1000 0x0 0x0 0x3 0x1 0x0 0x0 0x0 0x122 0x1>, + <0x1000 0x0 0x0 0x4 0x1 0x0 0x0 0x0 0x123 0x1>; dma-coherent; dma-ranges = <0x43000000 0x0 0x0 0x0 0x0 0x100 0x0>; ranges = <0x1000000 0x0 0x00000000 0x0 0xefff0000 0x00 0x00010000>, /* I/O Memory (size=64K) */ - <0x2000000 0x0 0x40000000 0x0 0x40000000 0x00 0x80000000>, /* 32-bit MMIO (size=2G) */ - <0x3000000 0x1 0x00000000 0x1 0x00000000 0x7f 0x00000000>; /* 64-bit MMIO (size= 124G) */ + <0x2000000 0x0 0x40000000 0x0 0x40000000 0x00 0x80000000>, /* 32-bit MMIO (size=2G) */ + <0x3000000 0x1 0x00000000 0x1 0x00000000 0x7f 0x00000000>; /* 64-bit MMIO (size= 124G) */ }; ccn@0xe8000000 { @@ -279,15 +279,15 @@ interrupts = <0x0 0x17c 0x4>; }; - gwdt@e0bb0000 { + gwdt@e0bb0000 { status = "disabled"; - compatible = "arm,sbsa-gwdt"; - reg = <0x0 0xe0bb0000 0x0 0x10000 + compatible = "arm,sbsa-gwdt"; + reg = <0x0 0xe0bb0000 0x0 0x10000 0x0 0xe0bc0000 0x0 0x10000>; - reg-names = "refresh", "control"; - interrupts = <0x0 0x151 0x4>; - interrupt-names = "ws0"; - }; + reg-names = "refresh", "control"; + interrupts = <0x0 0x151 0x4>; + interrupt-names = "ws0"; + }; kcs@e0010000 { status = "disabled"; @@ -340,8 +340,8 @@ status = "disabled"; compatible = "amd,xgbe-phy-seattle-v1a"; reg = <0x0 0xe1240800 0x0 0x0400>, /* SERDES RX/TX0 */ - <0x0 0xe1250000 0x0 0x0060>, /* SERDES IR 1/2 */ - <0x0 0xe12500f8 0x0 0x0004>; /* SERDES IR 2/2 */ + <0x0 0xe1250000 0x0 0x0060>, /* SERDES IR 1/2 */ + <0x0 0xe12500f8 0x0 0x0004>; /* SERDES IR 2/2 */ interrupts = <0x0 0x143 0x4>; amd,speed-set = <0x0>; amd,serdes-blwc = <0x1 0x1 0x0>; @@ -358,8 +358,8 @@ status = "disabled"; compatible = "amd,xgbe-phy-seattle-v1a"; reg = <0x0 0xe1240c00 0x0 0x0400>, /* SERDES RX/TX0 */ - <0x0 0xe1250080 0x0 0x0060>, /* SERDES IR 1/2 */ - <0x0 0xe12500fc 0x0 0x0004>; /* SERDES IR 2/2 */ + <0x0 0xe1250080 0x0 0x0060>, /* SERDES IR 1/2 */ + <0x0 0xe12500fc 0x0 0x0004>; /* SERDES IR 2/2 */ interrupts = <0x0 0x142 0x4>; amd,speed-set = <0x0>; amd,serdes-blwc = <0x1 0x1 0x0>; @@ -377,10 +377,10 @@ compatible = "amd,xgbe-seattle-v1a"; reg = <0x0 0xe0700000 0x0 0x80000 0x0 0xe0780000 0x0 0x80000>; interrupts = <0x0 0x145 0x4>, - <0x0 0x15a 0x1>, - <0x0 0x15b 0x1>, - <0x0 0x15c 0x1>, - <0x0 0x15d 0x1>; + <0x0 0x15a 0x1>, + <0x0 0x15b 0x1>, + <0x0 0x15c 0x1>, + <0x0 0x15d 0x1>; amd,per-channel-interrupt; mac-address = [02 a1 a2 a3 a4 a5]; clocks = <0x5 0x6>; @@ -398,10 +398,10 @@ compatible = "amd,xgbe-seattle-v1a"; reg = <0x0 0xe0900000 0x0 0x80000 0x0 0xe0980000 0x0 0x80000>; interrupts = <0x0 0x144 0x4>, - <0x0 0x155 0x1>, - <0x0 0x156 0x1>, - <0x0 0x157 0x1>, - <0x0 0x158 0x1>; + <0x0 0x155 0x1>, + <0x0 0x156 0x1>, + <0x0 0x157 0x1>, + <0x0 0x158 0x1>; amd,per-channel-interrupt; mac-address = [02 b1 b2 b3 b4 b5]; clocks = <0x7 0x8>; From patchwork Thu Apr 6 10:29:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96922 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp663942qgd; Thu, 6 Apr 2017 03:31:17 -0700 (PDT) X-Received: by 10.237.41.100 with SMTP id s91mr36350948qtd.143.1491474677509; Thu, 06 Apr 2017 03:31:17 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j14si1030306qtj.57.2017.04.06.03.31.17; Thu, 06 Apr 2017 03:31:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3B9086097D; Thu, 6 Apr 2017 10:31:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E478464344; Thu, 6 Apr 2017 10:30:22 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 438D764337; Thu, 6 Apr 2017 10:30:01 +0000 (UTC) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by lists.linaro.org (Postfix) with ESMTPS id 3A67764336 for ; Thu, 6 Apr 2017 10:29:59 +0000 (UTC) Received: by mail-wr0-f175.google.com with SMTP id g19so10687756wrb.0 for ; Thu, 06 Apr 2017 03:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o8mfnrpWf0ONv+Smsm4ZKtON9flDWM50y04SA696I3Y=; b=gVXCloij/CMGQn3olo0hJMMjO398Q61ga63QQvoab4DJUHnNQlNko9yvTkxxyLnxIz oHEmxaWySaAf4dJEoPd09ertdjdVqE2rBdj8u/EoEiSVnirKASAWSq01MgvK0DDNWtdZ sozei8oZTQ3iveeWajziD/FmKiUS+4mPfvtKpbwLFILgOB2QlgGJocgw7Bh/cnK7oEVO wLXapXkvhJjD77Q8fNJsL+h86T9XbV/qG9PmGVuYQmtrDWS//LzCI0nbQDy4Xdbd4Gwt YNsKh4+2uOa1atGuCa5J20PUAeG4T8AUeAmFTCL7fytGlhnv5fhGmw8AWWTbkApbppx9 fFjg== X-Gm-Message-State: AFeK/H2Tzl+FcTOe/MGRdrA5Hw1bNBVlKfEK3RUDl7QN21OL3yTvXI0jDHBGkVn9n52wQL5gdlY= X-Received: by 10.223.161.134 with SMTP id u6mr25920714wru.108.1491474598337; Thu, 06 Apr 2017 03:29:58 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:29:57 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:36 +0100 Message-Id: <20170406102941.14802-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 3/8] Platforms/AMD: remove /pmu node from Overdrive DTS X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" The /pmu node is removed and regenerated by the firmware, so there is no need to have it in the template. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb | Bin 8089 -> 7973 bytes Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts | 12 ------------ 2 files changed, 12 deletions(-) diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb index 0c0468d89d60faf6c461b0e2e1c67098b063c7a9..ba4de560d279d79fde086c6e3f79626bd17a108f 100644 GIT binary patch delta 89 zcmbPfztm3P0`I@K3=HzB3=9kw3=A?769vSWr5`X%e#0!a(fJ_L<{8YtnPi!PvMfMc g3B_?suNsWUP1PTs*$&B(jigfmqP0JFdnn*aa+ delta 195 zcmZ2#H`89=0`I@K3=Hx!85kHW7#L)FCJKl#$%JgwxWiOmkXs5AWnczk0U%~eEXvgZ z;xY?epiG%DOfCV)NC$C%fE|cgz$^v^4kR`w5}ON&&5gw7L1Oa)**q|V_<)?vznNH= XH_NlBFflSucHyXIWZry$BUKClaGw{; diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts index dab3c2c56ee5..3cb9a3128737 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts @@ -55,18 +55,6 @@ <0x1 0xa 0xff04>; }; - pmu { - compatible = "arm,armv8-pmuv3"; - interrupts = <0x0 0x7 0x4>, - <0x0 0x8 0x4>, - <0x0 0x9 0x4>, - <0x0 0xa 0x4>, - <0x0 0xb 0x4>, - <0x0 0xc 0x4>, - <0x0 0xd 0x4>, - <0x0 0xe 0x4>; - }; - smb { compatible = "simple-bus"; #address-cells = <0x2>; From patchwork Thu Apr 6 10:29:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96923 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp664124qgd; Thu, 6 Apr 2017 03:31:47 -0700 (PDT) X-Received: by 10.200.49.129 with SMTP id h1mr33111989qte.277.1491474707319; Thu, 06 Apr 2017 03:31:47 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e1si1001438qkf.232.2017.04.06.03.31.46; Thu, 06 Apr 2017 03:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4595E642C8; Thu, 6 Apr 2017 10:31:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 64B936434B; Thu, 6 Apr 2017 10:30:23 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5ED0F64334; Thu, 6 Apr 2017 10:30:06 +0000 (UTC) Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by lists.linaro.org (Postfix) with ESMTPS id 53A9E64334 for ; Thu, 6 Apr 2017 10:30:02 +0000 (UTC) Received: by mail-wr0-f172.google.com with SMTP id o21so26825486wrb.2 for ; Thu, 06 Apr 2017 03:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pIleHCrR7UazYN+SKmPI88m5Kj7UoqF9gdFTcUkkghY=; b=DT9g6/Tlmbm3JMdgDcs85wcD4Lx8H0CTRO0O69sQYGoGmZ+zPIAVQx2ywwCc8x8+68 3rSKoFs1xlmFc64B10KquXnFXdOHD8zoe/i2487YibZorqsZrFxTUQw0HGTqM3+8SclZ 5MhhYu8olkl4l++Iz8kXQwVh09cy+jQ6jpZSgupwo7v5unlks2mAY/v3Ujj54Kr/RSgV NcyQs/SLMm9/VWcJYNGZH8ngxwSGTMqwH12nz2VTPDRlzac6DPmjry1mGPHQx3t3IEaq YgAIF8DeTosC+FccP+3TdRkWsrw+6X0A93qT+OkoIL6hIXgJ9MDhTrL2zPigtJl7jojG y3oA== X-Gm-Message-State: AFeK/H2IEJga+EqYtt0DVkazBsZOIJpOTstpx4qlzkNFvJFzFVfqdEHxMy99SDyT59ISywBL+Rc= X-Received: by 10.223.143.36 with SMTP id p33mr27446362wrb.120.1491474600904; Thu, 06 Apr 2017 03:30:00 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.29.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:30:00 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:37 +0100 Message-Id: <20170406102941.14802-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 4/8] Platforms/AMD: clean up whitespace in Overdrive DTS file X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Use tabs consistently throughout the Overdrive DTS file, and use CR-LF line endings just like every other file in EDK2. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts | 866 ++++++++++---------- 1 file changed, 432 insertions(+), 434 deletions(-) diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts index 3cb9a3128737..36474a26c9c6 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts @@ -1,434 +1,432 @@ -/* - * DTS file for AMD Seattle (Rev.B) Overdrive Development Board - * - * Copyright 2015 - 2016 ADVANCED MICRO DEVICES, INC. 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. - * - */ - -/dts-v1/; - -/ { - model = "AMD Seattle (Rev.B) Development Board (Overdrive)"; - compatible = "amd,seattle-overdrive", "amd,seattle"; - interrupt-parent = <0x1>; - #address-cells = <0x2>; - #size-cells = <0x2>; - - interrupt-controller@e1101000 { - compatible = "arm,gic-400", "arm,cortex-a15-gic"; - interrupt-controller; - #interrupt-cells = <0x3>; - #address-cells = <0x2>; - #size-cells = <0x2>; - reg = <0x0 0xe1110000 0x0 0x1000>, - <0x0 0xe112f000 0x0 0x2000>, - <0x0 0xe1140000 0x0 0x10000>, - <0x0 0xe1160000 0x0 0x10000>; - interrupts = <0x1 0x9 0xf04>; - ranges = <0x0 0x0 0x0 0xe1100000 0x0 0x100000>; - linux,phandle = <0x1>; - phandle = <0x1>; - - v2m@e0080000 { - compatible = "arm,gic-v2m-frame"; - msi-controller; - reg = <0x0 0x80000 0x0 0x1000>; - linux,phandle = <0x4>; - phandle = <0x4>; - }; - }; - - timer { - compatible = "arm,armv8-timer"; - interrupts = <0x1 0xd 0xff04>, - <0x1 0xe 0xff04>, - <0x1 0xb 0xff04>, - <0x1 0xa 0xff04>; - }; - - smb { - compatible = "simple-bus"; - #address-cells = <0x2>; - #size-cells = <0x2>; - ranges; - /* - * dma-ranges is 40-bit address space containing: - * - GICv2m MSI register is at 0xe0080000 - * - DRAM range [0x8000000000 to 0xffffffffff] - */ - dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>; - - clk100mhz_0 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <100000000>; - clock-output-names = "adl3clk_100mhz"; - }; - - clk375mhz { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <375000000>; - clock-output-names = "ccpclk_375mhz"; - }; - - clk333mhz { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <333000000>; - clock-output-names = "sataclk_333mhz"; - linux,phandle = <0x2>; - phandle = <0x2>; - }; - - clk500mhz_0 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <500000000>; - clock-output-names = "pcieclk_500mhz"; - }; - - clk500mhz_1 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <500000000>; - clock-output-names = "dmaclk_500mhz"; - }; - - clk250mhz_4 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <250000000>; - clock-output-names = "miscclk_250mhz"; - linux,phandle = <0xd>; - phandle = <0xd>; - }; - - clk100mhz_1 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <100000000>; - clock-output-names = "uartspiclk_100mhz"; - linux,phandle = <0x3>; - phandle = <0x3>; - }; - - sata@e0300000 { - compatible = "snps,dwc-ahci"; - reg = <0x0 0xe0300000 0x0 0xf0000>; - interrupts = <0x0 0x163 0x4>; - clocks = <0x2>; - dma-coherent; - }; - - sata@e0d00000 { - status = "disabled"; - compatible = "snps,dwc-ahci"; - reg = <0x0 0xe0d00000 0x0 0xf0000>; - interrupts = <0x0 0x162 0x4>; - clocks = <0x2>; - dma-coherent; - }; - - i2c@e1000000 { - compatible = "snps,designware-i2c"; - reg = <0x0 0xe1000000 0x0 0x1000>; - interrupts = <0x0 0x165 0x4>; - clocks = <0xd>; - }; - - i2c@e0050000 { - compatible = "snps,designware-i2c"; - reg = <0x0 0xe0050000 0x0 0x1000>; - interrupts = <0x0 0x154 0x4>; - clocks = <0xd>; - }; - - serial@e1010000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x0 0xe1010000 0x0 0x1000>; - interrupts = <0x0 0x148 0x4>; - clocks = <0x3 0x3>; - clock-names = "uartclk", "apb_pclk"; - }; - - ssp@e1020000 { - compatible = "arm,pl022", "arm,primecell"; - reg = <0x0 0xe1020000 0x0 0x1000>; - spi-controller; - interrupts = <0x0 0x14a 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - }; - - ssp@e1030000 { - compatible = "arm,pl022", "arm,primecell"; - reg = <0x0 0xe1030000 0x0 0x1000>; - spi-controller; - interrupts = <0x0 0x149 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - num-cs = <0x1>; - #address-cells = <0x1>; - #size-cells = <0x0>; - - sdcard@0 { - compatible = "mmc-spi-slot"; - reg = <0x0>; - spi-max-frequency = <20000000>; - voltage-ranges = <3200 3400>; - pl022,hierarchy = <0x0>; - pl022,interface = <0x0>; - pl022,com-mode = <0x0>; - pl022,rx-level-trig = <0x0>; - pl022,tx-level-trig = <0x0>; - }; - }; - - gpio@e1050000 { /* [0 : 7] */ - compatible = "arm,pl061", "arm,primecell"; - #gpio-cells = <0x2>; - reg = <0x0 0xe1050000 0x0 0x1000>; - gpio-controller; - interrupt-controller; - #interrupt-cells = <0x2>; - interrupts = <0x0 0x166 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - }; - - gpio@e0020000 { /* [8 : 15] */ - status = "disabled"; - compatible = "arm,pl061", "arm,primecell"; - #gpio-cells = <0x2>; - reg = <0x0 0xe0020000 0x0 0x1000>; - gpio-controller; - interrupt-controller; - #interrupt-cells = <0x2>; - interrupts = <0x0 0x16e 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - }; - - gpio@e0030000 { /* [16 : 23] */ - status = "disabled"; - compatible = "arm,pl061", "arm,primecell"; - #gpio-cells = <0x2>; - reg = <0x0 0xe0030000 0x0 0x1000>; - gpio-controller; - interrupt-controller; - #interrupt-cells = <0x2>; - interrupts = <0x0 0x16d 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - }; - - gpio@e0080000 { /* [24] */ - compatible = "arm,pl061", "arm,primecell"; - #gpio-cells = <0x2>; - reg = <0x0 0xe0080000 0x0 0x1000>; - gpio-controller; - interrupt-controller; - #interrupt-cells = <0x2>; - interrupts = <0x0 0x169 0x4>; - clocks = <0x3>; - clock-names = "apb_pclk"; - }; - - ccp: ccp@e0100000 { - compatible = "amd,ccp-seattle-v1a"; - reg = <0x0 0xe0100000 0x0 0x10000>; - interrupts = <0x0 0x3 0x4>; - dma-coherent; - amd,zlib-support = <0x1>; - }; - - pcie: pcie@f0000000 { - compatible = "pci-host-ecam-generic"; - #address-cells = <0x3>; - #size-cells = <0x2>; - #interrupt-cells = <0x1>; - device_type = "pci"; - bus-range = <0x0 0x7f>; - msi-parent = <0x4>; - reg = <0x0 0xf0000000 0x0 0x10000000>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; - interrupt-map = <0x1000 0x0 0x0 0x1 0x1 0x0 0x0 0x0 0x120 0x1>, - <0x1000 0x0 0x0 0x2 0x1 0x0 0x0 0x0 0x121 0x1>, - <0x1000 0x0 0x0 0x3 0x1 0x0 0x0 0x0 0x122 0x1>, - <0x1000 0x0 0x0 0x4 0x1 0x0 0x0 0x0 0x123 0x1>; - dma-coherent; - dma-ranges = <0x43000000 0x0 0x0 0x0 0x0 0x100 0x0>; - ranges = <0x1000000 0x0 0x00000000 0x0 0xefff0000 0x00 0x00010000>, /* I/O Memory (size=64K) */ - <0x2000000 0x0 0x40000000 0x0 0x40000000 0x00 0x80000000>, /* 32-bit MMIO (size=2G) */ - <0x3000000 0x1 0x00000000 0x1 0x00000000 0x7f 0x00000000>; /* 64-bit MMIO (size= 124G) */ - }; - - ccn@0xe8000000 { - compatible = "arm,ccn-504"; - reg = <0x0 0xe8000000 0x0 0x1000000>; - interrupts = <0x0 0x17c 0x4>; - }; - - gwdt@e0bb0000 { - status = "disabled"; - compatible = "arm,sbsa-gwdt"; - reg = <0x0 0xe0bb0000 0x0 0x10000 - 0x0 0xe0bc0000 0x0 0x10000>; - reg-names = "refresh", "control"; - interrupts = <0x0 0x151 0x4>; - interrupt-names = "ws0"; - }; - - kcs@e0010000 { - status = "disabled"; - compatible = "ipmi-kcs"; - device_type = "ipmi"; - reg = <0x0 0xe0010000 0 0x8>; - interrupts = <0 389 4>; - interrupt-names = "ipmi_kcs"; - reg-size = <1>; - reg-spacing = <4>; - }; - - clk250mhz_0 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <250000000>; - clock-output-names = "xgmacclk0_dma_250mhz"; - linux,phandle = <0x5>; - phandle = <0x5>; - }; - - clk250mhz_1 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <250000000>; - clock-output-names = "xgmacclk0_ptp_250mhz"; - linux,phandle = <0x6>; - phandle = <0x6>; - }; - - clk250mhz_2 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <250000000>; - clock-output-names = "xgmacclk1_dma_250mhz"; - linux,phandle = <0x7>; - phandle = <0x7>; - }; - - clk250mhz_3 { - compatible = "fixed-clock"; - #clock-cells = <0x0>; - clock-frequency = <250000000>; - clock-output-names = "xgmacclk1_ptp_250mhz"; - linux,phandle = <0x8>; - phandle = <0x8>; - }; - - phy@e1240800 { - status = "disabled"; - compatible = "amd,xgbe-phy-seattle-v1a"; - reg = <0x0 0xe1240800 0x0 0x0400>, /* SERDES RX/TX0 */ - <0x0 0xe1250000 0x0 0x0060>, /* SERDES IR 1/2 */ - <0x0 0xe12500f8 0x0 0x0004>; /* SERDES IR 2/2 */ - interrupts = <0x0 0x143 0x4>; - amd,speed-set = <0x0>; - amd,serdes-blwc = <0x1 0x1 0x0>; - amd,serdes-cdr-rate = <0x2 0x2 0x7>; - amd,serdes-pq-skew = <0xa 0xa 0x12>; - amd,serdes-tx-amp = <0xf 0xf 0xa>; - amd,serdes-dfe-tap-config = <0x3 0x3 0x1>; - amd,serdes-dfe-tap-enable = <0x0 0x0 0x7f>; - linux,phandle = <0x9>; - phandle = <0x9>; - }; - - phy@e1240c00 { - status = "disabled"; - compatible = "amd,xgbe-phy-seattle-v1a"; - reg = <0x0 0xe1240c00 0x0 0x0400>, /* SERDES RX/TX0 */ - <0x0 0xe1250080 0x0 0x0060>, /* SERDES IR 1/2 */ - <0x0 0xe12500fc 0x0 0x0004>; /* SERDES IR 2/2 */ - interrupts = <0x0 0x142 0x4>; - amd,speed-set = <0x0>; - amd,serdes-blwc = <0x1 0x1 0x0>; - amd,serdes-cdr-rate = <0x2 0x2 0x7>; - amd,serdes-pq-skew = <0xa 0xa 0x12>; - amd,serdes-tx-amp = <0xf 0xf 0xa>; - amd,serdes-dfe-tap-config = <0x3 0x3 0x1>; - amd,serdes-dfe-tap-enable = <0x0 0x0 0x7f>; - linux,phandle = <0xa>; - phandle = <0xa>; - }; - - xgmac@e0700000 { - status = "disabled"; - compatible = "amd,xgbe-seattle-v1a"; - reg = <0x0 0xe0700000 0x0 0x80000 0x0 0xe0780000 0x0 0x80000>; - interrupts = <0x0 0x145 0x4>, - <0x0 0x15a 0x1>, - <0x0 0x15b 0x1>, - <0x0 0x15c 0x1>, - <0x0 0x15d 0x1>; - amd,per-channel-interrupt; - mac-address = [02 a1 a2 a3 a4 a5]; - clocks = <0x5 0x6>; - clock-names = "dma_clk", "ptp_clk"; - phy-handle = <0x9>; - phy-mode = "xgmii"; - #stream-id-cells = <0x18>; - dma-coherent; - linux,phandle = <0xb>; - phandle = <0xb>; - }; - - xgmac@e0900000 { - status = "disabled"; - compatible = "amd,xgbe-seattle-v1a"; - reg = <0x0 0xe0900000 0x0 0x80000 0x0 0xe0980000 0x0 0x80000>; - interrupts = <0x0 0x144 0x4>, - <0x0 0x155 0x1>, - <0x0 0x156 0x1>, - <0x0 0x157 0x1>, - <0x0 0x158 0x1>; - amd,per-channel-interrupt; - mac-address = [02 b1 b2 b3 b4 b5]; - clocks = <0x7 0x8>; - clock-names = "dma_clk", "ptp_clk"; - phy-handle = <0xa>; - phy-mode = "xgmii"; - #stream-id-cells = <0x18>; - dma-coherent; - linux,phandle = <0xc>; - phandle = <0xc>; - }; - }; - - chosen { - stdout-path = "/smb/serial@e1010000"; - /* Note: - * Linux support for pci-probe-only DT is not - * stable. Disable this for now and let Linux - * take care of the resource assignment. - */ - // linux,pci-probe-only; - }; - - psci { - compatible = "arm,psci-0.2", "arm,psci"; - method = "smc"; - }; -}; - - +/* + * DTS file for AMD Seattle (Rev.B) Overdrive Development Board + * + * Copyright 2015 - 2016 ADVANCED MICRO DEVICES, INC. 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. + * + */ + +/dts-v1/; + +/ { + model = "AMD Seattle (Rev.B) Development Board (Overdrive)"; + compatible = "amd,seattle-overdrive", "amd,seattle"; + interrupt-parent = <0x1>; + #address-cells = <0x2>; + #size-cells = <0x2>; + + interrupt-controller@e1101000 { + compatible = "arm,gic-400", "arm,cortex-a15-gic"; + interrupt-controller; + #interrupt-cells = <0x3>; + #address-cells = <0x2>; + #size-cells = <0x2>; + reg = <0x0 0xe1110000 0x0 0x1000>, + <0x0 0xe112f000 0x0 0x2000>, + <0x0 0xe1140000 0x0 0x10000>, + <0x0 0xe1160000 0x0 0x10000>; + interrupts = <0x1 0x9 0xf04>; + ranges = <0x0 0x0 0x0 0xe1100000 0x0 0x100000>; + linux,phandle = <0x1>; + phandle = <0x1>; + + v2m@e0080000 { + compatible = "arm,gic-v2m-frame"; + msi-controller; + reg = <0x0 0x80000 0x0 0x1000>; + linux,phandle = <0x4>; + phandle = <0x4>; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <0x1 0xd 0xff04>, + <0x1 0xe 0xff04>, + <0x1 0xb 0xff04>, + <0x1 0xa 0xff04>; + }; + + smb { + compatible = "simple-bus"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + /* + * dma-ranges is 40-bit address space containing: + * - GICv2m MSI register is at 0xe0080000 + * - DRAM range [0x8000000000 to 0xffffffffff] + */ + dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>; + + clk100mhz_0 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <100000000>; + clock-output-names = "adl3clk_100mhz"; + }; + + clk375mhz { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <375000000>; + clock-output-names = "ccpclk_375mhz"; + }; + + clk333mhz { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <333000000>; + clock-output-names = "sataclk_333mhz"; + linux,phandle = <0x2>; + phandle = <0x2>; + }; + + clk500mhz_0 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <500000000>; + clock-output-names = "pcieclk_500mhz"; + }; + + clk500mhz_1 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <500000000>; + clock-output-names = "dmaclk_500mhz"; + }; + + clk250mhz_4 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <250000000>; + clock-output-names = "miscclk_250mhz"; + linux,phandle = <0xd>; + phandle = <0xd>; + }; + + clk100mhz_1 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <100000000>; + clock-output-names = "uartspiclk_100mhz"; + linux,phandle = <0x3>; + phandle = <0x3>; + }; + + sata@e0300000 { + compatible = "snps,dwc-ahci"; + reg = <0x0 0xe0300000 0x0 0xf0000>; + interrupts = <0x0 0x163 0x4>; + clocks = <0x2>; + dma-coherent; + }; + + sata@e0d00000 { + status = "disabled"; + compatible = "snps,dwc-ahci"; + reg = <0x0 0xe0d00000 0x0 0xf0000>; + interrupts = <0x0 0x162 0x4>; + clocks = <0x2>; + dma-coherent; + }; + + i2c@e1000000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0xe1000000 0x0 0x1000>; + interrupts = <0x0 0x165 0x4>; + clocks = <0xd>; + }; + + i2c@e0050000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0xe0050000 0x0 0x1000>; + interrupts = <0x0 0x154 0x4>; + clocks = <0xd>; + }; + + serial@e1010000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0 0xe1010000 0x0 0x1000>; + interrupts = <0x0 0x148 0x4>; + clocks = <0x3 0x3>; + clock-names = "uartclk", "apb_pclk"; + }; + + ssp@e1020000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xe1020000 0x0 0x1000>; + spi-controller; + interrupts = <0x0 0x14a 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + }; + + ssp@e1030000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xe1030000 0x0 0x1000>; + spi-controller; + interrupts = <0x0 0x149 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + num-cs = <0x1>; + #address-cells = <0x1>; + #size-cells = <0x0>; + + sdcard@0 { + compatible = "mmc-spi-slot"; + reg = <0x0>; + spi-max-frequency = <20000000>; + voltage-ranges = <3200 3400>; + pl022,hierarchy = <0x0>; + pl022,interface = <0x0>; + pl022,com-mode = <0x0>; + pl022,rx-level-trig = <0x0>; + pl022,tx-level-trig = <0x0>; + }; + }; + + gpio@e1050000 { /* [0 : 7] */ + compatible = "arm,pl061", "arm,primecell"; + #gpio-cells = <0x2>; + reg = <0x0 0xe1050000 0x0 0x1000>; + gpio-controller; + interrupt-controller; + #interrupt-cells = <0x2>; + interrupts = <0x0 0x166 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + }; + + gpio@e0020000 { /* [8 : 15] */ + status = "disabled"; + compatible = "arm,pl061", "arm,primecell"; + #gpio-cells = <0x2>; + reg = <0x0 0xe0020000 0x0 0x1000>; + gpio-controller; + interrupt-controller; + #interrupt-cells = <0x2>; + interrupts = <0x0 0x16e 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + }; + + gpio@e0030000 { /* [16 : 23] */ + status = "disabled"; + compatible = "arm,pl061", "arm,primecell"; + #gpio-cells = <0x2>; + reg = <0x0 0xe0030000 0x0 0x1000>; + gpio-controller; + interrupt-controller; + #interrupt-cells = <0x2>; + interrupts = <0x0 0x16d 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + }; + + gpio@e0080000 { /* [24] */ + compatible = "arm,pl061", "arm,primecell"; + #gpio-cells = <0x2>; + reg = <0x0 0xe0080000 0x0 0x1000>; + gpio-controller; + interrupt-controller; + #interrupt-cells = <0x2>; + interrupts = <0x0 0x169 0x4>; + clocks = <0x3>; + clock-names = "apb_pclk"; + }; + + ccp: ccp@e0100000 { + compatible = "amd,ccp-seattle-v1a"; + reg = <0x0 0xe0100000 0x0 0x10000>; + interrupts = <0x0 0x3 0x4>; + dma-coherent; + amd,zlib-support = <0x1>; + }; + + pcie: pcie@f0000000 { + compatible = "pci-host-ecam-generic"; + #address-cells = <0x3>; + #size-cells = <0x2>; + #interrupt-cells = <0x1>; + device_type = "pci"; + bus-range = <0x0 0x7f>; + msi-parent = <0x4>; + reg = <0x0 0xf0000000 0x0 0x10000000>; + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map = <0x1000 0x0 0x0 0x1 0x1 0x0 0x0 0x0 0x120 0x1>, + <0x1000 0x0 0x0 0x2 0x1 0x0 0x0 0x0 0x121 0x1>, + <0x1000 0x0 0x0 0x3 0x1 0x0 0x0 0x0 0x122 0x1>, + <0x1000 0x0 0x0 0x4 0x1 0x0 0x0 0x0 0x123 0x1>; + dma-coherent; + dma-ranges = <0x43000000 0x0 0x0 0x0 0x0 0x100 0x0>; + ranges = <0x1000000 0x0 0x00000000 0x0 0xefff0000 0x00 0x00010000>, /* I/O Memory (size=64K) */ + <0x2000000 0x0 0x40000000 0x0 0x40000000 0x00 0x80000000>, /* 32-bit MMIO (size=2G) */ + <0x3000000 0x1 0x00000000 0x1 0x00000000 0x7f 0x00000000>; /* 64-bit MMIO (size= 124G) */ + }; + + ccn@0xe8000000 { + compatible = "arm,ccn-504"; + reg = <0x0 0xe8000000 0x0 0x1000000>; + interrupts = <0x0 0x17c 0x4>; + }; + + gwdt@e0bb0000 { + status = "disabled"; + compatible = "arm,sbsa-gwdt"; + reg = <0x0 0xe0bb0000 0x0 0x10000 + 0x0 0xe0bc0000 0x0 0x10000>; + reg-names = "refresh", "control"; + interrupts = <0x0 0x151 0x4>; + interrupt-names = "ws0"; + }; + + kcs@e0010000 { + status = "disabled"; + compatible = "ipmi-kcs"; + device_type = "ipmi"; + reg = <0x0 0xe0010000 0 0x8>; + interrupts = <0 389 4>; + interrupt-names = "ipmi_kcs"; + reg-size = <1>; + reg-spacing = <4>; + }; + + clk250mhz_0 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <250000000>; + clock-output-names = "xgmacclk0_dma_250mhz"; + linux,phandle = <0x5>; + phandle = <0x5>; + }; + + clk250mhz_1 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <250000000>; + clock-output-names = "xgmacclk0_ptp_250mhz"; + linux,phandle = <0x6>; + phandle = <0x6>; + }; + + clk250mhz_2 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <250000000>; + clock-output-names = "xgmacclk1_dma_250mhz"; + linux,phandle = <0x7>; + phandle = <0x7>; + }; + + clk250mhz_3 { + compatible = "fixed-clock"; + #clock-cells = <0x0>; + clock-frequency = <250000000>; + clock-output-names = "xgmacclk1_ptp_250mhz"; + linux,phandle = <0x8>; + phandle = <0x8>; + }; + + phy@e1240800 { + status = "disabled"; + compatible = "amd,xgbe-phy-seattle-v1a"; + reg = <0x0 0xe1240800 0x0 0x0400>, /* SERDES RX/TX0 */ + <0x0 0xe1250000 0x0 0x0060>, /* SERDES IR 1/2 */ + <0x0 0xe12500f8 0x0 0x0004>; /* SERDES IR 2/2 */ + interrupts = <0x0 0x143 0x4>; + amd,speed-set = <0x0>; + amd,serdes-blwc = <0x1 0x1 0x0>; + amd,serdes-cdr-rate = <0x2 0x2 0x7>; + amd,serdes-pq-skew = <0xa 0xa 0x12>; + amd,serdes-tx-amp = <0xf 0xf 0xa>; + amd,serdes-dfe-tap-config = <0x3 0x3 0x1>; + amd,serdes-dfe-tap-enable = <0x0 0x0 0x7f>; + linux,phandle = <0x9>; + phandle = <0x9>; + }; + + phy@e1240c00 { + status = "disabled"; + compatible = "amd,xgbe-phy-seattle-v1a"; + reg = <0x0 0xe1240c00 0x0 0x0400>, /* SERDES RX/TX0 */ + <0x0 0xe1250080 0x0 0x0060>, /* SERDES IR 1/2 */ + <0x0 0xe12500fc 0x0 0x0004>; /* SERDES IR 2/2 */ + interrupts = <0x0 0x142 0x4>; + amd,speed-set = <0x0>; + amd,serdes-blwc = <0x1 0x1 0x0>; + amd,serdes-cdr-rate = <0x2 0x2 0x7>; + amd,serdes-pq-skew = <0xa 0xa 0x12>; + amd,serdes-tx-amp = <0xf 0xf 0xa>; + amd,serdes-dfe-tap-config = <0x3 0x3 0x1>; + amd,serdes-dfe-tap-enable = <0x0 0x0 0x7f>; + linux,phandle = <0xa>; + phandle = <0xa>; + }; + + xgmac@e0700000 { + status = "disabled"; + compatible = "amd,xgbe-seattle-v1a"; + reg = <0x0 0xe0700000 0x0 0x80000 0x0 0xe0780000 0x0 0x80000>; + interrupts = <0x0 0x145 0x4>, + <0x0 0x15a 0x1>, + <0x0 0x15b 0x1>, + <0x0 0x15c 0x1>, + <0x0 0x15d 0x1>; + amd,per-channel-interrupt; + mac-address = [02 a1 a2 a3 a4 a5]; + clocks = <0x5 0x6>; + clock-names = "dma_clk", "ptp_clk"; + phy-handle = <0x9>; + phy-mode = "xgmii"; + #stream-id-cells = <0x18>; + dma-coherent; + linux,phandle = <0xb>; + phandle = <0xb>; + }; + + xgmac@e0900000 { + status = "disabled"; + compatible = "amd,xgbe-seattle-v1a"; + reg = <0x0 0xe0900000 0x0 0x80000 0x0 0xe0980000 0x0 0x80000>; + interrupts = <0x0 0x144 0x4>, + <0x0 0x155 0x1>, + <0x0 0x156 0x1>, + <0x0 0x157 0x1>, + <0x0 0x158 0x1>; + amd,per-channel-interrupt; + mac-address = [02 b1 b2 b3 b4 b5]; + clocks = <0x7 0x8>; + clock-names = "dma_clk", "ptp_clk"; + phy-handle = <0xa>; + phy-mode = "xgmii"; + #stream-id-cells = <0x18>; + dma-coherent; + linux,phandle = <0xc>; + phandle = <0xc>; + }; + }; + + chosen { + stdout-path = "/smb/serial@e1010000"; + /* Note: + * Linux support for pci-probe-only DT is not + * stable. Disable this for now and let Linux + * take care of the resource assignment. + */ + // linux,pci-probe-only; + }; + + psci { + compatible = "arm,psci-0.2", "arm,psci"; + method = "smc"; + }; +}; From patchwork Thu Apr 6 10:29:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96924 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp664441qgd; Thu, 6 Apr 2017 03:32:34 -0700 (PDT) X-Received: by 10.55.151.3 with SMTP id z3mr32261222qkd.79.1491474754795; Thu, 06 Apr 2017 03:32:34 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n78si1012257qke.269.2017.04.06.03.32.34; Thu, 06 Apr 2017 03:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6930F60D83; Thu, 6 Apr 2017 10:32:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B0E426434F; Thu, 6 Apr 2017 10:30:23 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 908336433A; Thu, 6 Apr 2017 10:30:08 +0000 (UTC) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by lists.linaro.org (Postfix) with ESMTPS id 41EB864336 for ; Thu, 6 Apr 2017 10:30:05 +0000 (UTC) Received: by mail-wr0-f170.google.com with SMTP id w11so51197356wrc.3 for ; Thu, 06 Apr 2017 03:30:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wPsLi5KWEkNSxnl1tT45AQtYVdLZZKWt18gHEd58F5Q=; b=lBWLuq1feghJZT9IUsSMJ1KmLRk9PR71lWJLwnvJVyPu3hJ6gOSR0jKgn5BCoDnHO6 e62h5HbNoTe9pW497bg7HNxybf1nf8zJDC59c7jk2yATSFQ8lo5C8gFykiAmsFELKct9 MSTJ0tUQj0yZoAdd84q3L/3GDMxo4wIx0Gqws7YdOKWOw8qm6ygt+0mXRaAW+qyHgunH 9TzMjVvlrxndlJrEV93m/BbJFDJZef/4bNVHvvAqzl5d0etrgdh+qs+QEPbFcW4t1sW6 +tTU1oB1/eGrJmSZa+Hgy6WFCIqpSk2QZmmVnty7Agv8RH+aeIeA726DpnzCUUOF3iLG fT2g== X-Gm-Message-State: AFeK/H1IEkyfzx+N8mVglxD2NWHNl8zh63xgFD3ItJABVBvyzjgLsf12MwH3dKvww2U8yesFDQA= X-Received: by 10.223.178.66 with SMTP id y2mr30352654wra.161.1491474603355; Thu, 06 Apr 2017 03:30:03 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:30:02 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:38 +0100 Message-Id: <20170406102941.14802-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 5/8] Platforms/AMD: implement DtPlatformDtbLoaderLib X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" In order to be able to switch to the generic DtPlatformDxe driver, implement the glue library that loads it and prepares it based on the properties of the actual hardware. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c | 473 ++++++++++++++++++++ Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf | 64 +++ 2 files changed, 537 insertions(+) diff --git a/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c new file mode 100644 index 000000000000..f07651a450be --- /dev/null +++ b/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c @@ -0,0 +1,473 @@ +/** @file +* +* Copyright (c) 2017, 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#define PMU_INT_FLAG_SPI 0 +#define PMU_INT_TYPE_HIGH_LEVEL 4 + +// +// PMU interrupts per core +// +#pragma pack(push, 1) +typedef struct { + UINT32 Flag; // 0 == SPI + UINT32 IntId; // GSIV == IntId+32 + UINT32 Type; // 4 == Level-Sensitive, Active-High +} PMU_INTERRUPT; +#pragma pack(pop) + +STATIC +BOOLEAN +ClusterInRange ( + IN ARM_CORE_INFO *ArmCoreInfoTable, + IN UINTN ClusterId, + IN UINTN LowIndex, + IN UINTN HighIndex + ) +{ + do { + if (ClusterId == ArmCoreInfoTable[LowIndex].ClusterId) + return TRUE; + } while (++LowIndex <= HighIndex); + + return FALSE; +} + + +STATIC +UINTN +NumberOfCoresInCluster ( + IN ARM_CORE_INFO *ArmCoreInfoTable, + IN UINTN NumberOfEntries, + IN UINTN ClusterId + ) +{ + UINTN Index, Cores; + + Cores = 0; + for (Index = 0; Index < NumberOfEntries; ++Index) { + if (ClusterId == ArmCoreInfoTable[Index].ClusterId) + ++Cores; + } + + return Cores; +} + + +STATIC +UINTN +NumberOfClustersInTable ( + IN ARM_CORE_INFO *ArmCoreInfoTable, + IN UINTN NumberOfEntries + ) +{ + UINTN Index, Cores, Clusters, ClusterId; + + Index = 0; + Clusters = 0; + Cores = NumberOfEntries; + while (Cores) { + ++Clusters; + ClusterId = ArmCoreInfoTable[Index].ClusterId; + Cores -= NumberOfCoresInCluster (ArmCoreInfoTable, + NumberOfEntries, + ClusterId); + if (Cores) { + do { + ++Index; + } while (ClusterInRange (ArmCoreInfoTable, + ArmCoreInfoTable[Index].ClusterId, + 0, Index-1)); + } + } + + return Clusters; +} + + +STATIC +INT32 +fdt_alloc_phandle ( + IN VOID *Fdt + ) +{ + INT32 Offset; + INT32 Phandle; + + Phandle = 0; + + for (Offset = fdt_next_node (Fdt, -1, NULL); Offset >= 0; + Offset = fdt_next_node (Fdt, Offset, NULL)) { + Phandle = MAX(Phandle, fdt_get_phandle (Fdt, Offset)); + } + + return Phandle + 1; +} + +STATIC +VOID +SetDeviceStatus ( + IN VOID *Fdt, + IN CONST CHAR8 *Device, + IN BOOLEAN Enable + ) +{ + INT32 Node; + INT32 SubNode; + INT32 Rc; + + Node = fdt_subnode_offset (Fdt, 0, "smb"); + if (Node >= 0) { + SubNode = fdt_subnode_offset (Fdt, Node, Device); + if (SubNode >= 0) { + Rc = fdt_setprop_string(Fdt, SubNode, "status", + Enable ? "okay" : "disabled"); + if (Rc) { + DEBUG ((DEBUG_ERROR, + "%a: Could not set 'status' property for '%a' node\n", + __FUNCTION__, Device)); + } + } + } +} + +#if DO_XGBE + +STATIC +VOID +SetMacAddress ( + IN VOID *Fdt, + IN CONST CHAR8 *Device, + IN UINT64 MacAddress + ) +{ + INT32 Node; + INT32 SubNode; + INT32 Rc; + + Node = fdt_subnode_offset (Fdt, 0, "smb"); + if (Node >= 0) { + SubNode = fdt_subnode_offset (Fdt, Node, Device); + if (SubNode >= 0) { + Rc = fdt_setprop(Fdt, SubNode, "mac-address", (VOID *)&MacAddress, 6); + if (Rc) { + DEBUG ((DEBUG_ERROR, + "%a: Could not set 'mac-address' property for '%a' node\n", + __FUNCTION__, Device)); + } + } + } +} + +#endif + +STATIC +VOID +SetSocIdStatus ( + IN VOID *Fdt + ) +{ + UINT32 SocId; + BOOLEAN IsRevB1; + + SocId = PcdGet32 (PcdSocCpuId); + IsRevB1 = (SocId & 0xFF0) && (SocId & 0x00F); + + SetDeviceStatus (Fdt, "sata@e0d00000", + IsRevB1 && FixedPcdGet8(PcdSata1PortCount) > 0); + SetDeviceStatus (Fdt, "gpio@e0020000", IsRevB1); + SetDeviceStatus (Fdt, "gpio@e0030000", IsRevB1); + SetDeviceStatus (Fdt, "gwdt@e0bb0000", IsRevB1); +#if DO_KCS + SetDeviceStatus (Fdt, "kcs@e0010000", IsRevB1); +#else + SetDeviceStatus (Fdt, "kcs@e0010000", FALSE); +#endif +} + +STATIC +VOID +SetXgbeStatus ( + IN VOID *Fdt + ) +{ +#if DO_XGBE + SetDeviceStatus (Fdt, "xgmac@e0700000", TRUE); + SetDeviceStatus (Fdt, "phy@e1240800", TRUE); + SetDeviceStatus (Fdt, "xgmac@e0900000", TRUE); + SetDeviceStatus (Fdt, "phy@e1240c00", TRUE); + + SetMacAddress (Fdt, "xgmac@e0700000", PcdGet64 (PcdEthMacA)); + SetMacAddress (Fdt, "xgmac@e0900000", PcdGet64 (PcdEthMacB)); +#else + SetDeviceStatus (Fdt, "xgmac@e0700000", FALSE); + SetDeviceStatus (Fdt, "phy@e1240800", FALSE); + SetDeviceStatus (Fdt, "xgmac@e0900000", FALSE); + SetDeviceStatus (Fdt, "phy@e1240c00", FALSE); +#endif +} + + +STATIC +EFI_STATUS +PrepareFdt ( + IN OUT VOID *Fdt, + IN UINTN FdtSize + ) +{ + EFI_STATUS Status; + INT32 Node; + INT32 CpuNode; + UINTN Index; + ARM_CORE_INFO *ArmCoreInfoTable; + UINTN ArmCoreCount; + INT32 MapNode; + INT32 ClusterNode; + INT32 PmuNode; + PMU_INTERRUPT PmuInt; + INT32 Phandle[NUM_CORES]; + UINT32 ClusterIndex; + UINT32 CoreIndex; + UINT32 ClusterCount; + UINT32 CoresInCluster; + UINT32 ClusterId; + UINTN MpId; + CHAR8 Name[10]; + AMD_MP_CORE_INFO_PROTOCOL *AmdMpCoreInfoProtocol; + + // + // Setup Arm Mpcore Info if it is a multi-core or multi-cluster platforms. + // + // For 'cpus' and 'cpu' device tree nodes bindings, refer to this file + // in the kernel documentation: + // Documentation/devicetree/bindings/arm/cpus.txt + // + Status = gBS->LocateProtocol ( + &gAmdMpCoreInfoProtocolGuid, + NULL, + (VOID **)&AmdMpCoreInfoProtocol + ); + ASSERT_EFI_ERROR (Status); + + // Get pointer to ARM core info table + ArmCoreInfoTable = AmdMpCoreInfoProtocol->GetArmCoreInfoTable (&ArmCoreCount); + ASSERT (ArmCoreInfoTable != NULL); + ASSERT (ArmCoreCount <= NUM_CORES); + + // Get Id from primary CPU + MpId = (UINTN) ArmReadMpidr (); + + // Create /pmu node + PmuNode = fdt_add_subnode(Fdt, 0, "pmu"); + if (PmuNode >= 0) { + fdt_setprop_string(Fdt, PmuNode, "compatible", "arm,armv8-pmuv3"); + + // append PMU interrupts + for (Index = 0; Index < ArmCoreCount; Index++) { + MpId = (UINTN) GET_MPID (ArmCoreInfoTable[Index].ClusterId, + ArmCoreInfoTable[Index].CoreId); + + Status = AmdMpCoreInfoProtocol->GetPmuSpiFromMpId (MpId, &PmuInt.IntId); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "FDT: Error getting PMU interrupt for MpId '0x%x'\n", MpId)); + return Status; + } + + PmuInt.Flag = cpu_to_fdt32 (PMU_INT_FLAG_SPI); + PmuInt.IntId = cpu_to_fdt32 (PmuInt.IntId); + PmuInt.Type = cpu_to_fdt32 (PMU_INT_TYPE_HIGH_LEVEL); + fdt_appendprop (Fdt, PmuNode, "interrupts", &PmuInt, sizeof(PmuInt)); + } + } else { + DEBUG ((DEBUG_ERROR, "FDT: Error creating 'pmu' node\n")); + return EFI_INVALID_PARAMETER; + } + + // Create /cpus noide + Node = fdt_add_subnode(Fdt, 0, "cpus"); + if (Node >= 0) { + // Configure the 'cpus' node + fdt_setprop_string (Fdt, Node, "name", "cpus"); + fdt_setprop_cell (Fdt, Node, "#address-cells", sizeof (UINTN) / 4); + fdt_setprop_cell (Fdt, Node, "#size-cells", 0); + } else { + DEBUG ((DEBUG_ERROR, "FDT: Error creating 'cpus' node\n")); + return EFI_INVALID_PARAMETER; + } + + // + // Walk the processor table in reverse order for proper listing in FDT + // + Index = ArmCoreCount; + while (Index--) { + // Create 'cpu' node + AsciiSPrint (Name, sizeof(Name), "CPU%d", Index); + CpuNode = fdt_add_subnode (Fdt, Node, Name); + if (CpuNode < 0) { + DEBUG ((DEBUG_ERROR, "FDT: Error on creating '%a' node\n", Name)); + return EFI_INVALID_PARAMETER; + } + Phandle[Index] = fdt_alloc_phandle (Fdt); + fdt_setprop_cell (Fdt, CpuNode, "phandle", Phandle[Index]); + fdt_setprop_cell (Fdt, CpuNode, "linux,phandle", Phandle[Index]); + + fdt_setprop_string(Fdt, CpuNode, "enable-method", "psci"); + + MpId = (UINTN) GET_MPID (ArmCoreInfoTable[Index].ClusterId, + ArmCoreInfoTable[Index].CoreId); + MpId = cpu_to_fdt64 (MpId); + fdt_setprop (Fdt, CpuNode, "reg", &MpId, sizeof (MpId)); + fdt_setprop_string (Fdt, CpuNode, "compatible", "arm,armv8"); + fdt_setprop_string (Fdt, CpuNode, "device_type", "cpu"); + } + + // Create /cpu-map node + MapNode = fdt_add_subnode(Fdt, Node, "cpu-map"); + if (MapNode >= 0) { + ClusterIndex = ArmCoreCount - 1; + ClusterCount = NumberOfClustersInTable (ArmCoreInfoTable, + ArmCoreCount); + while (ClusterCount--) { + // Create 'cluster' node + AsciiSPrint (Name, sizeof(Name), "cluster%d", ClusterCount); + ClusterNode = fdt_add_subnode (Fdt, MapNode, Name); + if (ClusterNode < 0) { + DEBUG ((DEBUG_ERROR, "FDT: Error creating '%a' node\n", Name)); + return EFI_INVALID_PARAMETER; + } + + ClusterId = ArmCoreInfoTable[ClusterIndex].ClusterId; + CoreIndex = ClusterIndex; + CoresInCluster = NumberOfCoresInCluster (ArmCoreInfoTable, + ArmCoreCount, + ClusterId); + while (CoresInCluster--) { + // Create 'core' node + AsciiSPrint (Name, sizeof(Name), "core%d", CoresInCluster); + CpuNode = fdt_add_subnode (Fdt, ClusterNode, Name); + if (CpuNode < 0) { + DEBUG ((DEBUG_ERROR, "FDT: Error creating '%a' node\n", Name)); + return EFI_INVALID_PARAMETER; + } + fdt_setprop_cell (Fdt, CpuNode, "cpu", Phandle[CoreIndex]); + + // iterate to next core in cluster + if (CoresInCluster) { + do { + --CoreIndex; + } while (ClusterId != ArmCoreInfoTable[CoreIndex].ClusterId); + } + } + + // iterate to next cluster + if (ClusterCount) { + do { + --ClusterIndex; + } while (ClusterInRange (ArmCoreInfoTable, + ArmCoreInfoTable[ClusterIndex].ClusterId, + ClusterIndex + 1, + ArmCoreCount - 1)); + } + } + } else { + DEBUG ((DEBUG_ERROR,"FDT: Error creating 'cpu-map' node\n")); + return EFI_INVALID_PARAMETER; + } + + SetSocIdStatus (Fdt); + SetXgbeStatus (Fdt); + + // Update the real size of the Device Tree + fdt_pack (Fdt); + + return EFI_SUCCESS; +} + + +/** + Return a pool allocated copy of the DTB image that is appropriate for + booting the current platform via DT. + + @param[out] Dtb Pointer to the DTB copy + @param[out] DtbSize Size of the DTB copy + + @retval EFI_SUCCESS Operation completed successfully + @retval EFI_NOT_FOUND No suitable DTB image could be located + @retval EFI_OUT_OF_RESOURCES No pool memory available + +**/ +EFI_STATUS +EFIAPI +DtPlatformLoadDtb ( + OUT VOID **Dtb, + OUT UINTN *DtbSize + ) +{ + EFI_STATUS Status; + VOID *OrigDtb; + VOID *CopyDtb; + UINTN OrigDtbSize; + UINTN CopyDtbSize; + INT32 Error; + + Status = GetSectionFromAnyFv (&gDtPlatformDefaultDtbFileGuid, + EFI_SECTION_RAW, 0, &OrigDtb, &OrigDtbSize); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + // + // Allocate space for the DTB: add a page of slack space to make some room + // for our modifications. + // + CopyDtbSize = OrigDtbSize + EFI_PAGE_SIZE; + CopyDtb = AllocatePool (CopyDtbSize); + if (CopyDtb == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Error = fdt_open_into (OrigDtb, CopyDtb, CopyDtbSize); + if (Error != 0) { + // + // fdt_open_into() validates the DTB header, so if it fails, the template + // is most likely invalid. + // + return EFI_NOT_FOUND; + } + + Status = PrepareFdt (CopyDtb, CopyDtbSize); + if (EFI_ERROR (Status)) { + return Status; + } + + *Dtb = CopyDtb; + *DtbSize = CopyDtbSize; + + return EFI_SUCCESS; +} diff --git a/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf b/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf new file mode 100644 index 000000000000..f5ba5f1d1335 --- /dev/null +++ b/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf @@ -0,0 +1,64 @@ +/** @file +* +* Copyright (c) 2017, 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 = 0x00010019 + BASE_NAME = StyxDtbLoaderLib + FILE_GUID = 3874890c-2917-46a6-8711-8fcaee92260a + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DtPlatformDtbLoaderLib|DXE_DRIVER + +[Sources] + StyxDtbLoaderLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + AmdModulePkg/AmdModulePkg.dec + OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec + +[LibraryClasses] + ArmLib + BaseLib + DebugLib + DxeServicesLib + FdtLib + MemoryAllocationLib + PrintLib + UefiBootServicesTableLib + +[Pcd] + gAmdStyxTokenSpaceGuid.PcdStyxFdt + gAmdStyxTokenSpaceGuid.PcdSocCpuId + gAmdStyxTokenSpaceGuid.PcdEthMacA + gAmdStyxTokenSpaceGuid.PcdEthMacB + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset + gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment + gAmdStyxTokenSpaceGuid.PcdPsciOsSupport + gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport + gAmdStyxTokenSpaceGuid.PcdSata1PortCount + +[Guids] + gDtPlatformDefaultDtbFileGuid + +[Protocols] + gAmdMpCoreInfoProtocolGuid ## CONSUMED + +[Depex] + gAmdMpCoreInfoProtocolGuid From patchwork Thu Apr 6 10:29:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96925 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp664683qgd; Thu, 6 Apr 2017 03:33:11 -0700 (PDT) X-Received: by 10.55.46.198 with SMTP id u189mr31240581qkh.88.1491474791783; Thu, 06 Apr 2017 03:33:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f1si1037895qtb.29.2017.04.06.03.33.11; Thu, 06 Apr 2017 03:33:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7D18864342; Thu, 6 Apr 2017 10:33:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id F0EE564353; Thu, 6 Apr 2017 10:30:23 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6604D6433A; Thu, 6 Apr 2017 10:30:10 +0000 (UTC) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by lists.linaro.org (Postfix) with ESMTPS id 35AAD64334 for ; Thu, 6 Apr 2017 10:30:07 +0000 (UTC) Received: by mail-wr0-f170.google.com with SMTP id w11so51198727wrc.3 for ; Thu, 06 Apr 2017 03:30:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XWzfWctUrez4wVsDSQ5YkPfpjyz69ucI8NpnfB+uDk8=; b=uPOOsFoSCn+0O5SjLM5Rwf4eFDOscrGcGA28k1dKcpqD55NfIvOpeSQjQZx5eloq7S 3pLmldC+Ko+uTHT0h+3fwfxwt5mQgrkP5SO+D6Zy9k6I/teu1SUW46nRKRuJJKPgBCMD tel1g76JEQI17azMZo0bOkoFYGiDCruowATC09dCt73eHqQZM8QFld5Ir8lA4TskHAvn 6rFgYcCqyw9Zdm/RrVYpj5Vv+t0DjZbn62K6Xokmpt1EDX1kdWJa5jfqyfwuS3dZsGp3 3U/7nOPaAOzya5+qaBVjpFnFPyNvZyh6x/snlDowFac7ueLfL3iw4EgfTQB1w8qD0wkM fA1g== X-Gm-Message-State: AFeK/H3TyFPZl7B2W2bS36U9pXO+feI5346xnjK7x+AuZizRXaeV4lWGj9Q2Zbco6Z8qOGM7KNA= X-Received: by 10.223.134.152 with SMTP id 24mr21166434wrx.30.1491474605629; Thu, 06 Apr 2017 03:30:05 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.30.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:30:04 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:39 +0100 Message-Id: <20170406102941.14802-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 6/8] Platforms/AMD: switch Overdrive to DtPlatformDxe X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Replace FdtDxe with the generic DtPlatformDxe, which forces mutual exclusion between DT and ACPI, and does not depend on the deprecated ARM BdsLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc | 11 +++++++---- Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc index a35953d2ec9a..65d229884aa7 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc @@ -606,11 +606,10 @@ DEFINE DO_KCS = 1 # # FDT support # - OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf { + EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf { - # deprecated BdsLib from the ARM BDS - BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + DtPlatformDtbLoaderLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf } # @@ -684,7 +683,11 @@ DEFINE DO_KCS = 1 # # ACPI Support # - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf { + + NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf + } + OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiAml.inf OpenPlatformPkg/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf index d2f01e73fe21..d51bed87ebf6 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf @@ -144,9 +144,9 @@ READ_LOCK_STATUS = TRUE # # FDT support # - INF OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf + INF EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf - FILE FREEFORM = PCD(gAmdStyxTokenSpaceGuid.PcdStyxFdt) { + FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 { SECTION RAW = OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb } From patchwork Thu Apr 6 10:29:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96926 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp664741qgd; Thu, 6 Apr 2017 03:33:23 -0700 (PDT) X-Received: by 10.55.42.28 with SMTP id q28mr25378600qkh.131.1491474803869; Thu, 06 Apr 2017 03:33:23 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m5si1027559qkm.116.2017.04.06.03.33.23; Thu, 06 Apr 2017 03:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8E01564342; Thu, 6 Apr 2017 10:33:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2EDCB64356; Thu, 6 Apr 2017 10:30:26 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7D1ED64337; Thu, 6 Apr 2017 10:30:11 +0000 (UTC) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by lists.linaro.org (Postfix) with ESMTPS id 0D43464336 for ; Thu, 6 Apr 2017 10:30:08 +0000 (UTC) Received: by mail-wr0-f170.google.com with SMTP id o21so26830652wrb.2 for ; Thu, 06 Apr 2017 03:30:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xmX66mXFk9Oe2AZO3xefYdKW93On3rKL6qoq10eLlGo=; b=tIQOJe0lC6XXpRJLq5/FAAcDJshijSh0yRuBoQLCm69eawFGJBE+xEhmlPfKCqvBha eP4/V2+pBfJG55PqGYqvJhtwGbF1DdRXnodUz9hu4aDKwpYL6JSDjWePJYRxQNKyaLIK 6WJ7Qi2GpN0gQvs9umKTsOnnuH8kcmdu63wJuMDBs+lwhqvcTCVvmM67pwOHzVA99lng XB75jaOHQ5qWeN5TZyyo0pr3Jiuia0iDmZ2Yi/qbCdfBhz1LwwtKIIo7w5WnlmW0fjR/ MnyV5XrYK9wIKltoamW2dLTYd+1Vv/cYoLnzxpC74KYSKyNRX24NdoMOFSPkU6Yvw53h KEaA== X-Gm-Message-State: AFeK/H0teMhIRcpS5JWTVthMpw6i8dqhaf2kXM2fIA8q5Jt7KfMoSXsVrqfnyQwq/u5FIjmUmdo= X-Received: by 10.28.23.198 with SMTP id 189mr22294197wmx.127.1491474607764; Thu, 06 Apr 2017 03:30:07 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.30.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:30:06 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:40 +0100 Message-Id: <20170406102941.14802-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 7/8] Platforms/AMD: switch Overdrive 1000 to DtPlatformDxe X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Replace FdtDxe with the generic DtPlatformDxe, which forces mutual exclusion between DT and ACPI, and does not depend on the deprecated ARM BdsLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc | 10 ++++++---- Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc index f723452ad2f2..b1a7cfd4c4a8 100644 --- a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc +++ b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.dsc @@ -563,11 +563,10 @@ DEFINE DO_KCS = 1 # # FDT support # - OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf { + EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf { - # deprecated BdsLib from the ARM BDS - BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + DtPlatformDtbLoaderLib|OpenPlatformPkg/Platforms/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf } # @@ -637,7 +636,10 @@ DEFINE DO_KCS = 1 # # ACPI Support # - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf { + + NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf + } OpenPlatformPkg/Platforms/AMD/Styx/AcpiTables/AcpiAml.inf OpenPlatformPkg/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf diff --git a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf index 170d80be84fa..c7f98b087fa9 100644 --- a/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf +++ b/Platforms/AMD/Styx/Overdrive1000Board/Overdrive1000Board.fdf @@ -141,9 +141,9 @@ READ_LOCK_STATUS = TRUE # # FDT support # - INF OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf + INF EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf - FILE FREEFORM = PCD(gAmdStyxTokenSpaceGuid.PcdStyxFdt) { + FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 { SECTION RAW = OpenPlatformPkg/Platforms/AMD/Styx/Overdrive1000Board/FdtBlob/styx-overdrive1000.dtb } From patchwork Thu Apr 6 10:29:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96927 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp664869qgd; Thu, 6 Apr 2017 03:33:46 -0700 (PDT) X-Received: by 10.200.50.199 with SMTP id a7mr33257786qtb.95.1491474826779; Thu, 06 Apr 2017 03:33:46 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q31si1024057qta.195.2017.04.06.03.33.46; Thu, 06 Apr 2017 03:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7568B6433D; Thu, 6 Apr 2017 10:33:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 761DC64357; Thu, 6 Apr 2017 10:30:33 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9524B64337; Thu, 6 Apr 2017 10:30:20 +0000 (UTC) Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by lists.linaro.org (Postfix) with ESMTPS id 75C0564334 for ; Thu, 6 Apr 2017 10:30:12 +0000 (UTC) Received: by mail-wr0-f173.google.com with SMTP id g19so10697440wrb.0 for ; Thu, 06 Apr 2017 03:30:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+I2jUFsBawBJuUU+He0E/+EsaJe1g3FKOJT2XwhbzsM=; b=ALBxuqFwgpPNRdCzOuN167GpP4P1rWuCHISLMgbtHYkEgz4dh0XyBM+km1YBu2LH4+ EGHDJ7qaddpiRZCRX/5wdc4k7GNSvGjfPBC7QbYru05EssLy66Qg6RAdmBihg6zLPSyw 3Wu4RO0JFvaHTS5WRgqRSPMohRmJcke/yp8biR8cEhcGx0WRxG/915dSewQzBoOUjQNf +FOcaR89M0uCrlqVT9yXAUztmk8sR0iPvkhIEquY5oZJ/tinNBQCO+jnT5cvN7X+cPXP t23ovLPWiEK9M/cy4lUtsHrcryHejSLe/JP1x2pjBlB6YJU7+yyhSbJojSfYQby8vXVI 6k4w== X-Gm-Message-State: AN3rC/6Kj0OkBC2tLdvmUGUkoPdsG+sKBunlKYi/++icdbXQEimuvh8gHsMcZ/ApbajgCO9KKlY= X-Received: by 10.223.154.70 with SMTP id z64mr1995643wrb.136.1491474610818; Thu, 06 Apr 2017 03:30:10 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id s27sm1562822wra.69.2017.04.06.03.30.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 03:30:10 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Thu, 6 Apr 2017 11:29:41 +0100 Message-Id: <20170406102941.14802-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406102941.14802-1-ard.biesheuvel@linaro.org> References: <20170406102941.14802-1-ard.biesheuvel@linaro.org> Cc: alan@softiron.co.uk Subject: [Linaro-uefi] [PATCH 8/8] Platform/AMD: remove FdtDxe driver X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Now that all platforms have been ported over, drive a wooden stake through the heart of FdtDxe and remove it from the tree. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c | 760 -------------------- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c | 274 ------- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h | 54 -- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf | 76 -- Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h | 173 ----- Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c | 200 ------ 6 files changed, 1537 deletions(-) diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c b/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c deleted file mode 100644 index aa595045ca3c..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c +++ /dev/null @@ -1,760 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-* Copyright (c) 2014 - 2016, AMD Inc. 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. -* -**/ -/** - - Derived from: - ArmPkg/Library/BdsLib/BdsLinuxFdt.c - -**/ - -#include -#include - -#include - -#include -#include - -#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset)) - - -// Additional size that could be used for FDT entries added by the UEFI OS Loader -// Estimation based on: EDID (300bytes) + bootargs (200bytes) + initrd region (20bytes) -// + system memory region (20bytes) + mp_core entries (200 bytes) -#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 - - -EFI_STATUS -GetSystemMemoryResources ( - IN LIST_ENTRY *ResourceList - ); - -VOID -DebugDumpFdt ( - IN VOID* FdtBlob - ); - -#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) -#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a)))) -#define GET_CELL(p) (p += 4, *((const UINT32 *)(p-4))) - -// -// PMU interrupts per core -// -#pragma pack(push, 1) -typedef struct { - UINT32 Flag; // 0 == SPI - UINT32 IntId; // GSIV == IntId+32 - UINT32 Type; // 4 == Level-Sensitive, Active-High -} PMU_INTERRUPT; -#pragma pack(pop) - -#define PMU_INT_FLAG_SPI 0 -#define PMU_INT_TYPE_HIGH_LEVEL 4 - - -typedef struct { - UINTN Base; - UINTN Size; -} FdtRegion; - - -STATIC -UINTN -cpu_to_fdtn (UINTN x) { - if (sizeof (UINTN) == sizeof (UINT32)) { - return cpu_to_fdt32 (x); - } else { - return cpu_to_fdt64 (x); - } -} - - -STATIC -BOOLEAN -ClusterInRange( - IN ARM_CORE_INFO *ArmCoreInfoTable, - IN UINTN ClusterId, - IN UINTN LowIndex, - IN UINTN HighIndex - ) -{ - do { - if (ClusterId == ArmCoreInfoTable[LowIndex].ClusterId) - return TRUE; - } while (++LowIndex <= HighIndex); - - return FALSE; -} - - -STATIC -UINTN -NumberOfCoresInCluster( - IN ARM_CORE_INFO *ArmCoreInfoTable, - IN UINTN NumberOfEntries, - IN UINTN ClusterId - ) -{ - UINTN Index, Cores; - - Cores = 0; - for (Index = 0; Index < NumberOfEntries; ++Index) { - if (ClusterId == ArmCoreInfoTable[Index].ClusterId) - ++Cores; - } - - return Cores; -} - - -STATIC -UINTN -NumberOfClustersInTable( - IN ARM_CORE_INFO *ArmCoreInfoTable, - IN UINTN NumberOfEntries - ) -{ - UINTN Index, Cores, Clusters, ClusterId; - - Index = 0; - Clusters = 0; - Cores = NumberOfEntries; - while (Cores) { - ++Clusters; - ClusterId = ArmCoreInfoTable[Index].ClusterId; - Cores -= NumberOfCoresInCluster (ArmCoreInfoTable, - NumberOfEntries, - ClusterId); - if (Cores) { - do { - ++Index; - } while (ClusterInRange (ArmCoreInfoTable, - ArmCoreInfoTable[Index].ClusterId, - 0, Index-1)); - } - } - - return Clusters; -} - - -STATIC -int -fdt_alloc_phandle( - IN VOID *blob - ) -{ - - int offset, phandle = 0; - - for (offset = fdt_next_node(blob, -1, NULL); offset >= 0; - offset = fdt_next_node(blob, offset, NULL)) { - phandle = MAX(phandle, fdt_get_phandle(blob, offset)); - } - - return phandle + 1; -} - - -STATIC -BOOLEAN -IsLinuxReservedRegion ( - IN EFI_MEMORY_TYPE MemoryType - ) -{ - switch(MemoryType) { - case EfiRuntimeServicesCode: - case EfiRuntimeServicesData: - case EfiUnusableMemory: - case EfiACPIReclaimMemory: - case EfiACPIMemoryNVS: - case EfiReservedMemoryType: - return TRUE; - default: - return FALSE; - } -} - -STATIC -VOID -SetDeviceStatus ( - IN VOID *fdt, - IN CHAR8 *device, - IN BOOLEAN enable - ) -{ - int node, subnode, rc; - - node = fdt_subnode_offset (fdt, 0, "smb"); - if (node >= 0) { - subnode = fdt_subnode_offset (fdt, node, device); - if (subnode >= 0) { - rc = fdt_setprop_string(fdt, subnode, "status", enable ? "ok" : "disabled"); - if (rc) { - DEBUG((EFI_D_ERROR,"%a: Could not set 'status' property for '%a' node\n", - __FUNCTION__, device)); - } - } - } -} - -#if DO_XGBE -STATIC -VOID -SetMacAddress ( - IN VOID *fdt, - IN CHAR8 *device, - IN UINT64 mac_addr - ) -{ - int node, subnode, rc; - - node = fdt_subnode_offset (fdt, 0, "smb"); - if (node >= 0) { - subnode = fdt_subnode_offset (fdt, node, device); - if (subnode >= 0) { - rc = fdt_setprop(fdt, subnode, "mac-address", (void *)&mac_addr, 6); - if (rc) { - DEBUG((EFI_D_ERROR,"%a: Could not set 'mac-address' property for '%a' node\n", - __FUNCTION__, device)); - } - } - } -} -#endif - -VOID -SetSocIdStatus ( - IN VOID *fdt - ) -{ - UINT32 SocId; - BOOLEAN IsRevB1; - - SocId = PcdGet32 (PcdSocCpuId); - IsRevB1 = (SocId & 0xFF0) && (SocId & 0x00F); - - SetDeviceStatus (fdt, "sata@e0d00000", - IsRevB1 && FixedPcdGet8(PcdSata1PortCount) > 0); - SetDeviceStatus (fdt, "gpio@e0020000", IsRevB1); - SetDeviceStatus (fdt, "gpio@e0030000", IsRevB1); - SetDeviceStatus (fdt, "gwdt@e0bb0000", IsRevB1); -#if DO_KCS - SetDeviceStatus (fdt, "kcs@e0010000", IsRevB1); -#else - SetDeviceStatus (fdt, "kcs@e0010000", FALSE); -#endif -} - -VOID -SetXgbeStatus ( - IN VOID *fdt - ) -{ -#if DO_XGBE - SetDeviceStatus (fdt, "xgmac@e0700000", TRUE); - SetDeviceStatus (fdt, "phy@e1240800", TRUE); - SetDeviceStatus (fdt, "xgmac@e0900000", TRUE); - SetDeviceStatus (fdt, "phy@e1240c00", TRUE); - - SetMacAddress (fdt, "xgmac@e0700000", PcdGet64 (PcdEthMacA)); - SetMacAddress (fdt, "xgmac@e0900000", PcdGet64 (PcdEthMacB)); -#else - SetDeviceStatus (fdt, "xgmac@e0700000", FALSE); - SetDeviceStatus (fdt, "phy@e1240800", FALSE); - SetDeviceStatus (fdt, "xgmac@e0900000", FALSE); - SetDeviceStatus (fdt, "phy@e1240c00", FALSE); -#endif -} - - -/** -** Relocate the FDT blob to a more appropriate location for the Linux kernel. -** This function will allocate memory for the relocated FDT blob. -** -** @retval EFI_SUCCESS on success. -** @retval EFI_OUT_OF_RESOURCES or EFI_INVALID_PARAMETER on failure. -*/ -STATIC -EFI_STATUS -RelocateFdt ( - EFI_PHYSICAL_ADDRESS OriginalFdt, - UINTN OriginalFdtSize, - EFI_PHYSICAL_ADDRESS *RelocatedFdt, - UINTN *RelocatedFdtSize, - EFI_PHYSICAL_ADDRESS *RelocatedFdtAlloc - ) -{ - EFI_STATUS Status; - INTN Error; - UINT64 FdtAlignment; - - *RelocatedFdtSize = OriginalFdtSize + FDT_ADDITIONAL_ENTRIES_SIZE; - - // If FDT load address needs to be aligned, allocate more space. - FdtAlignment = PcdGet32 (PcdArmLinuxFdtAlignment); - if (FdtAlignment != 0) { - *RelocatedFdtSize += FdtAlignment; - } - - // Try below a watermark address. - Status = EFI_NOT_FOUND; - if (PcdGet32 (PcdArmLinuxFdtMaxOffset) != 0) { - *RelocatedFdt = LINUX_FDT_MAX_OFFSET; - Status = gBS->AllocatePages (AllocateMaxAddress, EfiBootServicesData, - EFI_SIZE_TO_PAGES (*RelocatedFdtSize), RelocatedFdt); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_WARN, "Warning: Failed to load FDT below address 0x%lX (%r). Will try again at a random address anywhere.\n", *RelocatedFdt, Status)); - } - } - - // Try anywhere there is available space. - if (EFI_ERROR (Status)) { - Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, - EFI_SIZE_TO_PAGES (*RelocatedFdtSize), RelocatedFdt); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return EFI_OUT_OF_RESOURCES; - } else { - DEBUG ((EFI_D_WARN, "WARNING: Loaded FDT at random address 0x%lX.\nWARNING: There is a risk of accidental overwriting by other code/data.\n", *RelocatedFdt)); - } - } - - *RelocatedFdtAlloc = *RelocatedFdt; - if (FdtAlignment != 0) { - *RelocatedFdt = ALIGN (*RelocatedFdt, FdtAlignment); - } - - // Load the Original FDT tree into the new region - Error = fdt_open_into ((VOID*)(UINTN) OriginalFdt, - (VOID*)(UINTN)(*RelocatedFdt), *RelocatedFdtSize); - if (Error) { - DEBUG ((EFI_D_ERROR, "fdt_open_into(): %a\n", fdt_strerror (Error))); - gBS->FreePages (*RelocatedFdtAlloc, EFI_SIZE_TO_PAGES (*RelocatedFdtSize)); - return EFI_INVALID_PARAMETER; - } - - DEBUG_CODE_BEGIN(); - // DebugDumpFdt ((VOID*)(UINTN)(*RelocatedFdt)); - DEBUG_CODE_END(); - - return EFI_SUCCESS; -} - - -EFI_STATUS -AmdStyxPrepareFdt ( - IN CONST CHAR8* CommandLineArguments, - IN EFI_PHYSICAL_ADDRESS InitrdImage, - IN UINTN InitrdImageSize, - IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase, - IN OUT UINTN *FdtBlobSize - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS NewFdtBlobBase; - EFI_PHYSICAL_ADDRESS NewFdtBlobAllocation; - UINTN NewFdtBlobSize; - VOID *fdt; - int err; - int node; - int cpu_node; - int lenp; - CONST VOID *BootArg; - EFI_PHYSICAL_ADDRESS InitrdImageStart; - EFI_PHYSICAL_ADDRESS InitrdImageEnd; - FdtRegion Region; - UINTN Index; - CHAR8 Name[10]; - LIST_ENTRY ResourceList; - BDS_SYSTEM_MEMORY_RESOURCE *Resource; - ARM_CORE_INFO *ArmCoreInfoTable; - UINTN ArmCoreCount; - UINT32 PrimaryClusterId; - UINT32 PrimaryCoreId; - UINTN MemoryMapSize; - EFI_MEMORY_DESCRIPTOR *MemoryMap; - EFI_MEMORY_DESCRIPTOR *MemoryMapPtr; - UINTN MapKey; - UINTN DescriptorSize; - UINT32 DescriptorVersion; - UINTN Pages; - UINTN OriginalFdtSize; - int map_node; - int cluster_node; - int pmu_node; - PMU_INTERRUPT PmuInt; - int phandle[NUM_CORES]; - UINT32 ClusterIndex, CoreIndex; - UINT32 ClusterCount, CoresInCluster; - UINT32 ClusterId; - UINTN MpId, MbAddr; - AMD_MP_CORE_INFO_PROTOCOL *AmdMpCoreInfoProtocol; - - // - // Sanity checks on the original FDT blob. - // - err = fdt_check_header ((VOID*)(UINTN)(*FdtBlobBase)); - if (err != 0) { - Print (L"ERROR: Device Tree header not valid (err:%d)\n", err); - return EFI_INVALID_PARAMETER; - } - - // The original FDT blob might have been loaded partially. - // Check that it is not the case. - OriginalFdtSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(*FdtBlobBase)); - if (OriginalFdtSize > *FdtBlobSize) { - Print (L"ERROR: Incomplete FDT. Only %d/%d bytes have been loaded.\n", - *FdtBlobSize, OriginalFdtSize); - return EFI_INVALID_PARAMETER; - } - - // - // Relocate the FDT to its final location. - // - NewFdtBlobAllocation = 0; - Status = RelocateFdt (*FdtBlobBase, OriginalFdtSize, - &NewFdtBlobBase, &NewFdtBlobSize, &NewFdtBlobAllocation); - if (EFI_ERROR (Status)) { - goto FAIL_RELOCATE_FDT; - } - fdt = (VOID*)(UINTN)NewFdtBlobBase; - - node = fdt_subnode_offset (fdt, 0, "chosen"); - if (node < 0) { - // The 'chosen' node does not exist, create it - node = fdt_add_subnode(fdt, 0, "chosen"); - if (node < 0) { - DEBUG((EFI_D_ERROR,"Error on finding 'chosen' node\n")); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - } - - DEBUG_CODE_BEGIN(); - BootArg = fdt_getprop(fdt, node, "bootargs", &lenp); - if (BootArg != NULL) { - DEBUG((EFI_D_ERROR,"BootArg: %a\n",BootArg)); - } - DEBUG_CODE_END(); - - // - // Set Linux CmdLine - // - if ((CommandLineArguments != NULL) && (AsciiStrLen (CommandLineArguments) > 0)) { - err = fdt_setprop(fdt, node, "bootargs", CommandLineArguments, AsciiStrSize(CommandLineArguments)); - if (err) { - DEBUG((EFI_D_ERROR,"Fail to set new 'bootarg' (err:%d)\n",err)); - } - } - - // - // Set Linux Initrd - // - if (InitrdImageSize != 0) { - InitrdImageStart = cpu_to_fdt64 (InitrdImage); - err = fdt_setprop(fdt, node, "linux,initrd-start", &InitrdImageStart, sizeof(EFI_PHYSICAL_ADDRESS)); - if (err) { - DEBUG((EFI_D_ERROR,"Fail to set new 'linux,initrd-start' (err:%d)\n",err)); - } - InitrdImageEnd = cpu_to_fdt64 (InitrdImage + InitrdImageSize); - err = fdt_setprop(fdt, node, "linux,initrd-end", &InitrdImageEnd, sizeof(EFI_PHYSICAL_ADDRESS)); - if (err) { - DEBUG((EFI_D_ERROR,"Fail to set new 'linux,initrd-start' (err:%d)\n",err)); - } - } - - // - // Set Physical memory setup if does not exist - // - node = fdt_subnode_offset(fdt, 0, "memory"); - if (node < 0) { - // The 'memory' node does not exist, create it - node = fdt_add_subnode(fdt, 0, "memory"); - if (node >= 0) { - fdt_setprop_string(fdt, node, "name", "memory"); - fdt_setprop_string(fdt, node, "device_type", "memory"); - - GetSystemMemoryResources (&ResourceList); - Resource = (BDS_SYSTEM_MEMORY_RESOURCE*)ResourceList.ForwardLink; - - Region.Base = cpu_to_fdtn ((UINTN)Resource->PhysicalStart); - Region.Size = cpu_to_fdtn ((UINTN)Resource->ResourceLength); - - err = fdt_setprop(fdt, node, "reg", &Region, sizeof(Region)); - if (err) { - DEBUG((EFI_D_ERROR,"Fail to set new 'memory region' (err:%d)\n",err)); - } - } - } - - // - // Add the memory regions reserved by the UEFI Firmware - // - - // Retrieve the UEFI Memory Map - MemoryMap = NULL; - MemoryMapSize = 0; - Status = gBS->GetMemoryMap (&MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion); - if (Status == EFI_BUFFER_TOO_SMALL) { - // The UEFI specification advises to allocate more memory for the MemoryMap buffer between successive - // calls to GetMemoryMap(), since allocation of the new buffer may potentially increase memory map size. - Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1; - MemoryMap = AllocatePages (Pages); - if (MemoryMap == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto FAIL_COMPLETE_FDT; - } - Status = gBS->GetMemoryMap (&MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion); - } - - // Go through the list and add the reserved region to the Device Tree - if (!EFI_ERROR(Status)) { - MemoryMapPtr = MemoryMap; - for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) { - if (IsLinuxReservedRegion ((EFI_MEMORY_TYPE)MemoryMapPtr->Type)) { - DEBUG((DEBUG_VERBOSE, "Reserved region of type %d [0x%lX, 0x%lX]\n", - MemoryMapPtr->Type, - (UINTN)MemoryMapPtr->PhysicalStart, - (UINTN)(MemoryMapPtr->PhysicalStart + MemoryMapPtr->NumberOfPages * EFI_PAGE_SIZE))); - err = fdt_add_mem_rsv(fdt, MemoryMapPtr->PhysicalStart, MemoryMapPtr->NumberOfPages * EFI_PAGE_SIZE); - if (err != 0) { - Print(L"Warning: Fail to add 'memreserve' (err:%d)\n", err); - } - } - MemoryMapPtr = (EFI_MEMORY_DESCRIPTOR*)((UINTN)MemoryMapPtr + DescriptorSize); - } - } - - // - // Setup Arm Mpcore Info if it is a multi-core or multi-cluster platforms. - // - // For 'cpus' and 'cpu' device tree nodes bindings, refer to this file - // in the kernel documentation: - // Documentation/devicetree/bindings/arm/cpus.txt - // - Status = gBS->LocateProtocol ( - &gAmdMpCoreInfoProtocolGuid, - NULL, - (VOID **)&AmdMpCoreInfoProtocol - ); - ASSERT_EFI_ERROR (Status); - - // Get pointer to ARM core info table - ArmCoreInfoTable = AmdMpCoreInfoProtocol->GetArmCoreInfoTable (&ArmCoreCount); - ASSERT (ArmCoreInfoTable != NULL); - ASSERT (ArmCoreCount <= NUM_CORES); - - // Get Id from primary CPU - MpId = (UINTN) ArmReadMpidr (); - PrimaryClusterId = GET_CLUSTER_ID((UINT32) MpId); - PrimaryCoreId = GET_CORE_ID((UINT32) MpId); - - // Remove existing 'pmu' node and create a new one - pmu_node = fdt_subnode_offset (fdt, 0, "pmu"); - if (pmu_node >= 0) { - fdt_del_node (fdt, pmu_node); - } - pmu_node = fdt_add_subnode(fdt, 0, "pmu"); - if (pmu_node >= 0) { - // append PMU interrupts - for (Index = 0; Index < ArmCoreCount; Index++) { - MpId = (UINTN) GET_MPID (ArmCoreInfoTable[Index].ClusterId, - ArmCoreInfoTable[Index].CoreId); - - Status = AmdMpCoreInfoProtocol->GetPmuSpiFromMpId (MpId, &PmuInt.IntId); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "FDT: Error getting PMU interrupt for MpId '0x%x'\n", MpId)); - goto FAIL_COMPLETE_FDT; - } - - PmuInt.Flag = cpu_to_fdt32(PMU_INT_FLAG_SPI); - PmuInt.IntId = cpu_to_fdt32(PmuInt.IntId); - PmuInt.Type = cpu_to_fdt32(PMU_INT_TYPE_HIGH_LEVEL); - fdt_appendprop(fdt, pmu_node, "interrupts", &PmuInt, sizeof(PmuInt)); - } - fdt_setprop_string(fdt, pmu_node, "compatible", "arm,armv8-pmuv3"); - } else { - DEBUG((EFI_D_ERROR,"FDT: Error creating 'pmu' node\n")); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - - // Remove existing 'psci' node if feature not supported - node = fdt_subnode_offset (fdt, 0, "psci"); - if (node >= 0) { - if (!FixedPcdGetBool (PcdPsciOsSupport)) { - fdt_del_node (fdt, node); - } - } else if (FixedPcdGetBool (PcdPsciOsSupport) && - FixedPcdGetBool (PcdTrustedFWSupport)) { - // Add 'psci' node if not present - node = fdt_add_subnode(fdt, 0, "psci"); - if (node >= 0) { - fdt_setprop_string(fdt, node, "compatible", "arm,psci-0.2"); - fdt_appendprop_string(fdt, node, "compatible", "arm,psci"); - fdt_setprop_string(fdt, node, "method", "smc"); - } else { - DEBUG((EFI_D_ERROR,"FDT: Error creating 'psci' node\n")); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - } - - // Remove existing 'cpus' node and create a new one - node = fdt_subnode_offset (fdt, 0, "cpus"); - if (node >= 0) { - fdt_del_node (fdt, node); - } - node = fdt_add_subnode(fdt, 0, "cpus"); - if (node >= 0) { - // Configure the 'cpus' node - fdt_setprop_string(fdt, node, "name", "cpus"); - fdt_setprop_cell (fdt, node, "#address-cells", sizeof (UINTN) / 4); - fdt_setprop_cell(fdt, node, "#size-cells", 0); - } else { - DEBUG((EFI_D_ERROR,"FDT: Error creating 'cpus' node\n")); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - - // - // Walk the processor table in reverse order for proper listing in FDT - // - Index = ArmCoreCount; - while (Index--) { - // Create 'cpu' node - AsciiSPrint (Name, sizeof(Name), "CPU%d", Index); - cpu_node = fdt_add_subnode (fdt, node, Name); - if (cpu_node < 0) { - DEBUG ((EFI_D_ERROR, "FDT: Error on creating '%a' node\n", Name)); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - phandle[Index] = fdt_alloc_phandle(fdt); - fdt_setprop_cell (fdt, cpu_node, "phandle", phandle[Index]); - fdt_setprop_cell (fdt, cpu_node, "linux,phandle", phandle[Index]); - - if (FixedPcdGetBool (PcdPsciOsSupport) && - FixedPcdGetBool (PcdTrustedFWSupport)) { - fdt_setprop_string(fdt, cpu_node, "enable-method", "psci"); - } else { - fdt_setprop_string(fdt, cpu_node, "enable-method", "spin-table"); - MbAddr = ArmCoreInfoTable[Index].MailboxSetAddress; - MbAddr = cpu_to_fdtn (MbAddr); - fdt_setprop (fdt, cpu_node, "cpu-release-addr", &MbAddr, sizeof (MbAddr)); - } - MpId = (UINTN) GET_MPID (ArmCoreInfoTable[Index].ClusterId, - ArmCoreInfoTable[Index].CoreId); - MpId = cpu_to_fdtn (MpId); - fdt_setprop (fdt, cpu_node, "reg", &MpId, sizeof (MpId)); - fdt_setprop_string(fdt, cpu_node, "compatible", "arm,armv8"); - fdt_setprop_string (fdt, cpu_node, "device_type", "cpu"); - - // If it is not the primary core than the cpu should be disabled - if (((ArmCoreInfoTable[Index].ClusterId != PrimaryClusterId) || - (ArmCoreInfoTable[Index].CoreId != PrimaryCoreId))) { - fdt_setprop_string(fdt, cpu_node, "status", "disabled"); - } - } - - // Remove existing 'cpu-map' node and create a new one - map_node = fdt_subnode_offset (fdt, node, "cpu-map"); - if (map_node >= 0) { - fdt_del_node (fdt, map_node); - } - map_node = fdt_add_subnode(fdt, node, "cpu-map"); - if (map_node >= 0) { - ClusterIndex = ArmCoreCount - 1; - ClusterCount = NumberOfClustersInTable (ArmCoreInfoTable, - ArmCoreCount); - while (ClusterCount--) { - // Create 'cluster' node - AsciiSPrint (Name, sizeof(Name), "cluster%d", ClusterCount); - cluster_node = fdt_add_subnode (fdt, map_node, Name); - if (cluster_node < 0) { - DEBUG ((EFI_D_ERROR, "FDT: Error creating '%a' node\n", Name)); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - - ClusterId = ArmCoreInfoTable[ClusterIndex].ClusterId; - CoreIndex = ClusterIndex; - CoresInCluster = NumberOfCoresInCluster (ArmCoreInfoTable, - ArmCoreCount, - ClusterId); - while (CoresInCluster--) { - // Create 'core' node - AsciiSPrint (Name, sizeof(Name), "core%d", CoresInCluster); - cpu_node = fdt_add_subnode (fdt, cluster_node, Name); - if (cpu_node < 0) { - DEBUG ((EFI_D_ERROR, "FDT: Error creating '%a' node\n", Name)); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - fdt_setprop_cell (fdt, cpu_node, "cpu", phandle[CoreIndex]); - - // iterate to next core in cluster - if (CoresInCluster) { - do { - --CoreIndex; - } while (ClusterId != ArmCoreInfoTable[CoreIndex].ClusterId); - } - } - - // iterate to next cluster - if (ClusterCount) { - do { - --ClusterIndex; - } while (ClusterInRange (ArmCoreInfoTable, - ArmCoreInfoTable[ClusterIndex].ClusterId, - ClusterIndex + 1, - ArmCoreCount - 1)); - } - } - } else { - DEBUG((EFI_D_ERROR,"FDT: Error creating 'cpu-map' node\n")); - Status = EFI_INVALID_PARAMETER; - goto FAIL_COMPLETE_FDT; - } - - SetSocIdStatus (fdt); - SetXgbeStatus (fdt); - - DEBUG_CODE_BEGIN(); - // DebugDumpFdt (fdt); - DEBUG_CODE_END(); - - // If we succeeded to generate the new Device Tree then free the old Device Tree - gBS->FreePages (*FdtBlobBase, EFI_SIZE_TO_PAGES (*FdtBlobSize)); - - // Update the real size of the Device Tree - fdt_pack ((VOID*)(UINTN)(NewFdtBlobBase)); - - *FdtBlobBase = NewFdtBlobBase; - *FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(NewFdtBlobBase)); - return EFI_SUCCESS; - -FAIL_COMPLETE_FDT: - gBS->FreePages (NewFdtBlobAllocation, EFI_SIZE_TO_PAGES (NewFdtBlobSize)); - -FAIL_RELOCATE_FDT: - *FdtBlobSize = (UINTN)fdt_totalsize ((VOID*)(UINTN)(*FdtBlobBase)); - // Return success even if we failed to update the FDT blob. - // The original one is still valid. - return EFI_SUCCESS; -} - diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c b/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c deleted file mode 100644 index 09d650d2b831..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c +++ /dev/null @@ -1,274 +0,0 @@ -/** @file - - Copyright (c) 2014 - 2016, AMD Inc. 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 "FdtDxe.h" - -extern EFI_BOOT_SERVICES *gBS; - -EFI_EVENT mFdtReadyToBootEvent; - -VOID -EFIAPI -FdtReadyToBoot ( - IN EFI_EVENT Event, - IN VOID *Context - ); - -EFI_STATUS -EFIAPI -FdtOverrideDevicePath( - IN CHAR16 *FdtFileName, - OUT EFI_DEVICE_PATH **FdtDevicePath - ); - - -/** - *--------------------------------------------------------------------------------------- - * - * FdtDxeEntryPoint - * - * Description: - * Entry point of the FDT Runtime Driver. - * - * Control flow: - * Configure reserved regions. - * - * Parameters: - * @param[in] ImageHandle The firmware allocate handle for the - * EFI image. - * @param[in] *SystemTable Pointer to the EFI System Table. - * - * @return EFI_STATUS - * - *------------------------------------------------------------------------------------ - **/ -EFI_STATUS -EFIAPI -FdtDxeEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - DEBUG ((EFI_D_ERROR, "FdtDxe Loaded\n")); - - // - // Ready-To-Boot callback - // - Status = EfiCreateEventReadyToBootEx( - TPL_CALLBACK, - FdtReadyToBoot, - NULL, - &mFdtReadyToBootEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - *--------------------------------------------------------------------------------------- - * - * FdtReadyToBoot - * - * Description: - * Ready-2-Boot Event Callback for EFI_EVENT_SIGNAL_READY_TO_BOOT. - * - * Control flow: - * 1. Read FDT blob - * 2. Edit FDT table - * 3. Submit FDT to EFI system table - * - * Parameters: - * @param[in] Event EFI_EVENT notification. - * @param[in] *Context Pointer to the Event Context. - * - * @return VOID - * - *--------------------------------------------------------------------------------------- - **/ -VOID -EFIAPI -FdtReadyToBoot ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - UINTN Index; - EFI_STATUS Status; - UINT32 AuthenticationStatus; - EFI_GUID *FdtGuid = FixedPcdGetPtr(PcdStyxFdt); - UINT8 *FdtBlobBase = NULL; - UINTN FdtBlobSize = 0; - EFI_DEVICE_PATH *FdtDevicePath; - - // Search for FDT blob in EFI partition - Status = FdtOverrideDevicePath(L"fdt.dtb", &FdtDevicePath); - if (!EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "%a: Loading Override FDT blob...\n", __FUNCTION__)); - - FdtBlobBase = (UINT8 *)(UINTN)LINUX_FDT_MAX_OFFSET; - Status = BdsLoadImage (FdtDevicePath, - AllocateMaxAddress, - (EFI_PHYSICAL_ADDRESS *)&FdtBlobBase, - &FdtBlobSize); - if (!EFI_ERROR (Status) && FdtBlobBase && FdtBlobSize) - goto LOAD_FDT_BLOB; - else - goto LOAD_FDT_ERROR; - } - - DEBUG ((EFI_D_ERROR, "%a: Loading Embedded FDT blob...\n", __FUNCTION__)); - HandleBuffer = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiFirmwareVolume2ProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - ASSERT_EFI_ERROR (Status); - - for (Index = 0; Index < HandleCount; Index++) { - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiFirmwareVolume2ProtocolGuid, - (VOID **) &FvProtocol - ); - if (!EFI_ERROR (Status)) { - Status = FvProtocol->ReadSection ( - FvProtocol, - FdtGuid, - EFI_SECTION_RAW, - 0, - (VOID **)&FdtBlobBase, - &FdtBlobSize, - &AuthenticationStatus - ); - if (!EFI_ERROR (Status) && FdtBlobBase && FdtBlobSize) - goto LOAD_FDT_BLOB; - } - } - -LOAD_FDT_ERROR: - DEBUG ((EFI_D_ERROR, "%a: Error loading FDT blob!\n", __FUNCTION__)); - goto LOAD_FDT_DONE; - -LOAD_FDT_BLOB: - Status = AmdStyxPrepareFdt(NULL, 0, 0, (EFI_PHYSICAL_ADDRESS *)&FdtBlobBase, &FdtBlobSize); - ASSERT_EFI_ERROR (Status); - - // Install the FDT blob into EFI system configuration table - Status = gBS->InstallConfigurationTable (&gFdtTableGuid, (VOID *)FdtBlobBase); - ASSERT_EFI_ERROR (Status); - DEBUG ((EFI_D_ERROR, "%a: FDT ready!\n", __FUNCTION__)); - -LOAD_FDT_DONE: - gBS->CloseEvent (mFdtReadyToBootEvent); - return; -} - -/** -*--------------------------------------------------------------------------------------- -* -* FdtOverrideDevicePath -* -* Description: -* Looks for a user-provided FDT blob to override the default file built with the UEFI image. -* -* Parameters: -* @param[in] FdtFileName Name of the FDT blob located in the EFI partition. -* @param[out] FdtDevicePath EFI Device Path of the FDT blob. -* -* @return EFI_SUCCESS The function completed successfully. -* @return EFI_NOT_FOUND The protocol could not be located. -* @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol. -* -*--------------------------------------------------------------------------------------- -**/ -EFI_STATUS -EFIAPI -FdtOverrideDevicePath( - IN CHAR16 *FdtFileName, - OUT EFI_DEVICE_PATH **FdtDevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevPathProtocol; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; - UINTN Index; - EFI_STATUS Status; - CHAR16 *DevPathText; - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *VolProtocol; - EFI_FILE_PROTOCOL *FileProtocol; - EFI_FILE_PROTOCOL *FileHandle; - CHAR16 FilePathText[120]; - - HandleBuffer = NULL; - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiSimpleFileSystemProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer); - if (EFI_ERROR (Status)) - return Status; - - for (Index = 0; Index < HandleCount; Index++) { - DevPathProtocol = NULL; - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiDevicePathProtocolGuid, - (VOID **) &DevPathProtocol); - - if (!EFI_ERROR (Status)) { - VolProtocol = NULL; - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiSimpleFileSystemProtocolGuid, - (VOID **) &VolProtocol); - - if (!EFI_ERROR (Status)) { - FileProtocol = NULL; - Status = VolProtocol->OpenVolume(VolProtocol, &FileProtocol); - - if (!EFI_ERROR (Status)) { - FileHandle = NULL; - Status = FileProtocol->Open(FileProtocol, - &FileHandle, - FdtFileName, - EFI_FILE_MODE_READ, - 0); - - if (!EFI_ERROR (Status)) { - FileProtocol->Close(FileHandle); - DevPathText = ConvertDevicePathToText(DevPathProtocol, TRUE, FALSE); - StrCpy(FilePathText, DevPathText); - StrCat(FilePathText, L"/"); - StrCat(FilePathText, FdtFileName); - *FdtDevicePath = ConvertTextToDevicePath (FilePathText); - return EFI_SUCCESS; - } - } - } - } - } - - return Status; -} - diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h b/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h deleted file mode 100644 index c61b7ec7e326..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - - Copyright (c) 2014 - 2016, AMD Inc. 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 __FDT_DXE__H_ -#define __FDT_DXE__H_ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset)) - -VOID -EFIAPI -AmdStyxParkSecondaryCores( - VOID - ); - -EFI_STATUS -AmdStyxPrepareFdt ( - IN CONST CHAR8* CommandLineArguments, - IN EFI_PHYSICAL_ADDRESS InitrdImage, - IN UINTN InitrdImageSize, - IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase, - IN OUT UINTN *FdtBlobSize - ); - - -#endif // __FDT_DXE__H_ diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf b/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf deleted file mode 100644 index 5479c7b0abfb..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf +++ /dev/null @@ -1,76 +0,0 @@ -#/* @file -# -# Copyright (c) 2014 - 2016, AMD Inc. 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 = 0x00010005 - BASE_NAME = FdtDxe - FILE_GUID = 17f50855-6484-4b56-814b-1a88702d88e1 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = FdtDxeEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = AARCH64 -# -# - -[Sources.common] - FdtDxe.c - BdsLinuxFdt.c - LinuxLoaderHelper.c - -[Packages] - ArmPkg/ArmPkg.dec - EmbeddedPkg/EmbeddedPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AmdModulePkg/AmdModulePkg.dec - OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DxeServicesTableLib - BdsLib - FdtLib - PcdLib - DevicePathLib - -[Guids] - gEfiEventReadyToBootGuid ## CONSUMED - gEfiDxeServicesTableGuid ## CONSUMED - gFdtTableGuid ## CONSUMED - -[Protocols] - gEfiFirmwareVolume2ProtocolGuid ## CONSUMED - gAmdMpCoreInfoProtocolGuid ## CONSUMED - -[Pcd] - gAmdStyxTokenSpaceGuid.PcdStyxFdt - gAmdStyxTokenSpaceGuid.PcdSocCpuId - gAmdStyxTokenSpaceGuid.PcdEthMacA - gAmdStyxTokenSpaceGuid.PcdEthMacB - gArmTokenSpaceGuid.PcdSystemMemoryBase - -[FixedPcd] - gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset - gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment - gAmdStyxTokenSpaceGuid.PcdPsciOsSupport - gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport - gAmdStyxTokenSpaceGuid.PcdSata1PortCount - -[Depex] - TRUE diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h b/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h deleted file mode 100644 index ff6c72cc76f2..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h +++ /dev/null @@ -1,173 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. -* Copyright (c) 2015 - 2016, AMD Inc. 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. -* -**/ -/** - - Derived from: - ArmPkg/Library/BdsLib/LinuxLoader.h - -**/ - -#ifndef __LINUX_LOADER_H__ -#define __LINUX_LOADER_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -// -// Definitions -// - -#define MAX_MSG_LEN 80 - -#define LINUX_UIMAGE_SIGNATURE 0x56190527 -#define LINUX_KERNEL_MAX_OFFSET (SystemMemoryBase + PcdGet32(PcdArmLinuxKernelMaxOffset)) -#define LINUX_ATAG_MAX_OFFSET (SystemMemoryBase + PcdGet32(PcdArmLinuxAtagMaxOffset)) -#define LINUX_FDT_MAX_OFFSET (SystemMemoryBase + PcdGet32(PcdArmLinuxFdtMaxOffset)) - -#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF - -// Additional size that could be used for FDT entries added by the UEFI OS Loader -// Estimation based on: EDID (300bytes) + bootargs (200bytes) + initrd region (20bytes) -// + system memory region (20bytes) + mp_core entries (200 bytes) -#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 - -// -// Global variables -// -extern CONST EFI_GUID mLinuxLoaderHiiGuid; -extern EFI_HANDLE mLinuxLoaderHiiHandle; - -// -// Local Types -// -typedef struct _SYSTEM_MEMORY_RESOURCE { - LIST_ENTRY Link; // This attribute must be the first entry of this structure (to avoid pointer computation) - EFI_PHYSICAL_ADDRESS PhysicalStart; - UINT64 ResourceLength; -} SYSTEM_MEMORY_RESOURCE; - -typedef VOID (*LINUX_KERNEL)(UINT32 Zero, UINT32 Arch, UINTN ParametersBase); - -// -// Functions -// -EFI_STATUS -PrintHii ( - IN CONST CHAR8 *Language OPTIONAL, - IN CONST EFI_STRING_ID HiiFormatStringId, - ... - ); - -VOID -PrintHelp ( - IN CONST CHAR8 *Language OPTIONAL - ); - -EFI_STATUS -ProcessShellParameters ( - OUT CHAR16 **KernelPath, - OUT CHAR16 **FdtPath, - OUT CHAR16 **InitrdPath, - OUT CHAR16 **LinuxCommandLine, - OUT UINTN *AtagMachineType - ); - -EFI_STATUS -ProcessAppCommandLine ( - OUT CHAR16 **KernelTextDevicePath, - OUT CHAR16 **FdtTextDevicePath, - OUT CHAR16 **InitrdTextDevicePath, - OUT CHAR16 **LinuxCommandLine, - OUT UINTN *AtagMachineType - ); - -VOID -PrintPerformance ( - VOID - ); - -EFI_STATUS -GetSystemMemoryResources ( - IN LIST_ENTRY *ResourceList - ); - -EFI_STATUS -PrepareFdt ( - IN EFI_PHYSICAL_ADDRESS SystemMemoryBase, - IN CONST CHAR8* CommandLineArguments, - IN EFI_PHYSICAL_ADDRESS InitrdImage, - IN UINTN InitrdImageSize, - IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase, - IN OUT UINTN *FdtBlobSize - ); - -/** - Start a Linux kernel from a Device Path - - @param SystemMemoryBase Base of the system memory - @param LinuxKernel Device Path to the Linux Kernel - @param Parameters Linux kernel arguments - @param Fdt Device Path to the Flat Device Tree - @param MachineType ARM machine type value - - @retval EFI_SUCCESS All drivers have been connected - @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found - @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results. - @retval RETURN_UNSUPPORTED ATAG is not support by this architecture - -**/ -EFI_STATUS -BootLinuxAtag ( - IN EFI_PHYSICAL_ADDRESS SystemMemoryBase, - IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath, - IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath, - IN CONST CHAR8* CommandLineArguments, - IN UINTN MachineType - ); - -/** - Start a Linux kernel from a Device Path - - @param[in] LinuxKernelDevicePath Device Path to the Linux Kernel - @param[in] InitrdDevicePath Device Path to the Initrd - @param[in] Arguments Linux kernel arguments - - @retval EFI_SUCCESS All drivers have been connected - @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found - @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results. - -**/ -EFI_STATUS -BootLinuxFdt ( - IN EFI_PHYSICAL_ADDRESS SystemMemoryBase, - IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath, - IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath, - IN EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath, - IN CONST CHAR8* Arguments - ); - -#endif /* __LINUX_LOADER_H__ */ diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c b/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c deleted file mode 100644 index 80dce8d545b8..000000000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c +++ /dev/null @@ -1,200 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. -* Copyright (c) 2014 - 2016, AMD Inc. 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. -* -**/ -/** - - Derived from: - ArmPkg/Application/LinuxLoader/LinuxLoaderHelper.c - -**/ - - -#include -#include -#include -#include - -#include "LinuxLoader.h" - -STATIC CONST CHAR8 *mTokenList[] = { - /*"SEC",*/ - "PEI", - "DXE", - "BDS", - NULL -}; - -VOID -PrintPerformance ( - VOID - ) -{ - UINTN Key; - CONST VOID *Handle; - CONST CHAR8 *Token, *Module; - UINT64 Start, Stop, TimeStamp; - UINT64 Delta, TicksPerSecond, Milliseconds; - UINTN Index; - CHAR8 Buffer[100]; - UINTN CharCount; - BOOLEAN CountUp; - - TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop); - if (Start < Stop) { - CountUp = TRUE; - } else { - CountUp = FALSE; - } - - TimeStamp = 0; - Key = 0; - do { - Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop); - if (Key != 0) { - for (Index = 0; mTokenList[Index] != NULL; Index++) { - if (AsciiStriCmp (mTokenList[Index], Token) == 0) { - Delta = CountUp ? (Stop - Start) : (Start - Stop); - TimeStamp += Delta; - Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL); - CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "%6a %6ld ms\n", Token, Milliseconds); - SerialPortWrite ((UINT8 *) Buffer, CharCount); - break; - } - } - } - } while (Key != 0); - - CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "Total Time = %ld ms\n\n", - DivU64x64Remainder (MultU64x32 (TimeStamp, 1000), TicksPerSecond, NULL)); - SerialPortWrite ((UINT8 *) Buffer, CharCount); -} - -STATIC -EFI_STATUS -InsertSystemMemoryResources ( - LIST_ENTRY *ResourceList, - EFI_HOB_RESOURCE_DESCRIPTOR *ResHob - ) -{ - SYSTEM_MEMORY_RESOURCE *NewResource; - LIST_ENTRY *Link; - LIST_ENTRY *NextLink; - LIST_ENTRY AttachedResources; - SYSTEM_MEMORY_RESOURCE *Resource; - EFI_PHYSICAL_ADDRESS NewResourceEnd; - - if (IsListEmpty (ResourceList)) { - NewResource = AllocateZeroPool (sizeof (SYSTEM_MEMORY_RESOURCE)); - NewResource->PhysicalStart = ResHob->PhysicalStart; - NewResource->ResourceLength = ResHob->ResourceLength; - InsertTailList (ResourceList, &NewResource->Link); - return EFI_SUCCESS; - } - - InitializeListHead (&AttachedResources); - - Link = ResourceList->ForwardLink; - ASSERT (Link != NULL); - while (Link != ResourceList) { - Resource = (SYSTEM_MEMORY_RESOURCE*)Link; - - // Sanity Check. The resources should not overlapped. - ASSERT (!((ResHob->PhysicalStart >= Resource->PhysicalStart) && (ResHob->PhysicalStart < (Resource->PhysicalStart + Resource->ResourceLength)))); - ASSERT (!((ResHob->PhysicalStart + ResHob->ResourceLength - 1 >= Resource->PhysicalStart) && - ((ResHob->PhysicalStart + ResHob->ResourceLength - 1) < (Resource->PhysicalStart + Resource->ResourceLength)))); - - // The new resource is attached after this resource descriptor - if (ResHob->PhysicalStart == Resource->PhysicalStart + Resource->ResourceLength) { - Resource->ResourceLength = Resource->ResourceLength + ResHob->ResourceLength; - - NextLink = RemoveEntryList (&Resource->Link); - InsertTailList (&AttachedResources, &Resource->Link); - Link = NextLink; - } - // The new resource is attached before this resource descriptor - else if (ResHob->PhysicalStart + ResHob->ResourceLength == Resource->PhysicalStart) { - Resource->PhysicalStart = ResHob->PhysicalStart; - Resource->ResourceLength = Resource->ResourceLength + ResHob->ResourceLength; - - NextLink = RemoveEntryList (&Resource->Link); - InsertTailList (&AttachedResources, &Resource->Link); - Link = NextLink; - } else { - Link = Link->ForwardLink; - } - } - - if (!IsListEmpty (&AttachedResources)) { - // See if we can merge the attached resource with other resources - - NewResource = (SYSTEM_MEMORY_RESOURCE*)GetFirstNode (&AttachedResources); - Link = RemoveEntryList (&NewResource->Link); - while (!IsListEmpty (&AttachedResources)) { - // Merge resources - Resource = (SYSTEM_MEMORY_RESOURCE*)Link; - - // Ensure they overlap each other - ASSERT ( - ((NewResource->PhysicalStart >= Resource->PhysicalStart) && (NewResource->PhysicalStart < (Resource->PhysicalStart + Resource->ResourceLength))) || - (((NewResource->PhysicalStart + NewResource->ResourceLength) >= Resource->PhysicalStart) && ((NewResource->PhysicalStart + NewResource->ResourceLength) < (Resource->PhysicalStart + Resource->ResourceLength))) - ); - - NewResourceEnd = MAX (NewResource->PhysicalStart + NewResource->ResourceLength, Resource->PhysicalStart + Resource->ResourceLength); - NewResource->PhysicalStart = MIN (NewResource->PhysicalStart, Resource->PhysicalStart); - NewResource->ResourceLength = NewResourceEnd - NewResource->PhysicalStart; - - Link = RemoveEntryList (Link); - } - } else { - // None of the Resource of the list is attached to this ResHob. Create a new entry for it - NewResource = AllocateZeroPool (sizeof (SYSTEM_MEMORY_RESOURCE)); - NewResource->PhysicalStart = ResHob->PhysicalStart; - NewResource->ResourceLength = ResHob->ResourceLength; - } - InsertTailList (ResourceList, &NewResource->Link); - return EFI_SUCCESS; -} - -EFI_STATUS -GetSystemMemoryResources ( - IN LIST_ENTRY *ResourceList - ) -{ - EFI_HOB_RESOURCE_DESCRIPTOR *ResHob; - - InitializeListHead (ResourceList); - - // Find the first System Memory Resource Descriptor - ResHob = (EFI_HOB_RESOURCE_DESCRIPTOR *)GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR); - while ((ResHob != NULL) && (ResHob->ResourceType != EFI_RESOURCE_SYSTEM_MEMORY)) { - ResHob = (EFI_HOB_RESOURCE_DESCRIPTOR *)GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (VOID *)((UINTN)ResHob + ResHob->Header.HobLength)); - } - - // Did not find any - if (ResHob == NULL) { - return EFI_NOT_FOUND; - } else { - InsertSystemMemoryResources (ResourceList, ResHob); - } - - ResHob = (EFI_HOB_RESOURCE_DESCRIPTOR *)GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (VOID *)((UINTN)ResHob + ResHob->Header.HobLength)); - while (ResHob != NULL) { - if (ResHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { - InsertSystemMemoryResources (ResourceList, ResHob); - } - ResHob = (EFI_HOB_RESOURCE_DESCRIPTOR *)GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (VOID *)((UINTN)ResHob + ResHob->Header.HobLength)); - } - - return EFI_SUCCESS; -}