From patchwork Fri Apr 29 21:38:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duran, Leo" X-Patchwork-Id: 66978 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1019098qge; Fri, 29 Apr 2016 14:43:08 -0700 (PDT) X-Received: by 10.107.34.144 with SMTP id i138mr7362842ioi.98.1461966188631; Fri, 29 Apr 2016 14:43:08 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o90si3202092ioi.57.2016.04.29.14.43.08; Fri, 29 Apr 2016 14:43:08 -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 Received: by lists.linaro.org (Postfix, from userid 109) id F1CA561600; Fri, 29 Apr 2016 21:43:07 +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=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 1C062615E6; Fri, 29 Apr 2016 21:40:50 +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 B9C7E615FB; Fri, 29 Apr 2016 21:40:08 +0000 (UTC) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0060.outbound.protection.outlook.com [207.46.100.60]) by lists.linaro.org (Postfix) with ESMTPS id B38B6615FC for ; Fri, 29 Apr 2016 21:38:57 +0000 (UTC) Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by SN1PR12MB0528.namprd12.prod.outlook.com (10.162.105.17) with Microsoft SMTP Server (TLS) id 15.1.477.8; Fri, 29 Apr 2016 21:38:54 +0000 From: Leo Duran To: Date: Fri, 29 Apr 2016 16:38:37 -0500 Message-ID: <1461965918-28324-4-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461965918-28324-1-git-send-email-leo.duran@amd.com> References: <1461965918-28324-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY1PR08CA0003.namprd08.prod.outlook.com (10.163.94.141) To SN1PR12MB0528.namprd12.prod.outlook.com (10.162.105.17) X-MS-Office365-Filtering-Correlation-Id: f4f7e001-e25f-4765-4248-08d37076a9a4 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0528; 2:YQoqiLXdMryYSfua5pv2dxH3vlSqXmaCGyy7orK73Lc09OFPeT/5je2w5BJkN9eUCbSz1k8lHxRvcqP3bF6Nr0mTj1cWFp7YO51/iaIrqhOazf6rf/hV0fAgG7+QHAdRs0s04k8n+jWNg22dWjABsOX7HzZmS6HI1lPuIArplRhcI93R9ejg7j3IF3Zv2a/L; 3:lREOX1kpdvj8fxq9YL4paHwL0SHBLKMGtB/oa4JOd5CQu+6NX8elVAiY0G9ansi7gb2XCMjCHqAPwuprVhYZoj5CGr6jCcH94rsV2sIsCuAx6i3J4pO0BMH8m+CzICyy; 25:SYrWEgqNfZQBXyxvPhzW2f9udBPKc80nuaIBaVbT7fHzz8fTcbjYuWXPcUGuOJUrKcSrHFSuC99b19EF2PAozRQDZGSjTz8k1uJOvE68MU7GOjD5VfLdA5fFJiS9Hlm7qljCFUl8EeD/Civ8JyO1+7gH5g6+Avh1QTAwrK8pRqK6hvnZ+7byjik9QwDYbrgkW4SNclr2/84IvXApaav0lkLpz6sEtB0gwuG1+KRo1VuM+JGPOSaULvblruYzvL17vQBFpJdni139bGTUDma309nHMfzJVBjSEDJ+gwW83+l7LbMh6JkOJ6EFDs/mX3HFn+4cl68q6fMsyUrvnU8u1kIChlxXMxzSlHy/uyLYgJcm0Oh/i0uYuoLzHpA0ur7e4sp3VY0gIru6/bV+xVHExZBK7odCII9PUmniTAmAW7WuowW5onrrQ/PGYd7vXKaCGv/yOenFEPJ0Jgo4UzMCkwILtvQ78Jowk6fLq/gdkSg9/wcA5MLl4CKMZBvjRaFknYwr0wVjTCkWg8MVXmgXjz5Kwodw/vjo4Y9tQehJXobhKqsWVT+hSMfrHkt5DoFJaY9U+jUrDycFIykmbBIsLacFSCeeGFTZuDcxr6yD2lA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0528; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0528; 20:jJ3Q65SJ4OjjdHeSXvLgWXmfFyqIgqNsDnAbOy6/ulj4QU0ztPlzk17pvuLUL46nxeNyfCmOXKWzBjx4utLYc2W2X0omVmHYbAiWjrRNXknkSCYdVIW7+IHggTOOicThF/N5OXjfSfpiB448BEo4JXat0SNTpvafkQuuAh/2keUvFyoL35yRnHA/i5ligjPNNeToX/RPI9JA0p1Syrk4ERWPHT1jQcqSRugiyZTBrCxFtkVrfmwUETwv2oC1K6w6uH0hdRCcDRBMCLP6p8mpC2IaRyhRU1fzsd2bNYwFgZq59eyamiYU8IOXh9CSODACGtcppZ06h1k0ipeaCBuy20iwN0GptML5WUDn04Zgk0IiX4bU+E1ni0mcTRJ+YcYiws5jzYQk+cS4jjbHu2MQk7XFQVgFllZJ1osLlOiWNRzWTZjR2eTh9hStWeIDacUmoxzCh06UNfZDKjwnuy3gOlWEfiq96Y8EKdQGVqPPGzt4DsOfb6hvEKQp8GSgeqxw; 4:j2I8oQ3Cx9RjII5G/ZU7GW3r9Cs2FRJrOZTsiNAGbiQwBO02ENLH/sybI8UNlIjjFB5Rp92s8nsBDK3JImv6As7kNHwaKEc0W3K69dN/e480NrPQA7rvfdRGv0zI2kfD1ajBO/MVOWxQ6I/kK2srXl1x1BGstad8B3deRuUt42ocooGXis8GsKakzVk0H3NZsz9PqIQXLmrEX+EPKBmqOd8AS5W/5b50+OONSUSiSA+AqdMmfC3oX4xzMXwd2vqP4zgNr05w168+bQ3/d305Le8oSLpRKksapGTuwuv2k3wIXMISA0ITllTy4QwrzJ3Cvm81WeagHH/kl47skhXKaA4TjKeazaUPPryZor0x1ZncVdttIczvDKyypCf4MKQNdA5te5rfXp3RA6+Fvkt8X4k1QuksBhB1uLUEN9YYFZ0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521072)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:SN1PR12MB0528; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0528; X-Forefront-PRVS: 0927AA37C7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(43544003)(50944005)(2950100001)(42186005)(53416004)(36756003)(76176999)(66066001)(16799955002)(48376002)(50226002)(47776003)(5890100001)(189998001)(19580405001)(15975445007)(15188155005)(2351001)(15395725005)(110136002)(81166005)(5008740100001)(77096005)(1096002)(5003940100001)(86362001)(3846002)(586003)(50986999)(575784001)(33646002)(229853001)(2906002)(92566002)(6116002)(19580395003)(559001)(579004)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0528; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0528; 23:E6ycT5/QDcTR6Q85IltW+BTQIUitCGOgiZa0FWJXg?= =?us-ascii?Q?oyCNtYhe5YteFRSnZB9YONMkQP4kHy/M7QwDwKSPBtsCgJcbzUsfWsiXdZkl?= =?us-ascii?Q?sQn7Voi3rRKJBmnWID2ESGyXuseiVQszDDw0ekCjxKxJKC2SlWld+EYmdrYX?= =?us-ascii?Q?3wTJDe1hj0oEPtJc3ETYW7QiqQNEGnVdn/MUNYLdMIwdAirhRFXtWaoFZ+Q+?= =?us-ascii?Q?U8ehA33Ji6zkdhGyhartsfYC2+k5AtQwrjsaABch8YAadMKluwSVNd2X3OzJ?= =?us-ascii?Q?ojiI1vFGINiXdAw6sf6eFWlX0eluNyFvtPxkBt5PUVabsbfc8Fmt1JWs7BdL?= =?us-ascii?Q?BWBOUGCZCj1J7N7UOsmuNUE1plVrDT2MINFtAHBW2RMXBxHMFxGuVmvIMz/D?= =?us-ascii?Q?Mq4cktJoLivHitCx6vhtv/Rz+muQDk+ovOQHaxTe1Dy+CZgj7s6DVVUFqjUP?= =?us-ascii?Q?zYcnfcZ1HyU4eIJqm9f5LLuDM63o2V52/cYxxVFWrjtttbcCKK/tSeiv1Lb8?= =?us-ascii?Q?PVsKQn0kU1yNg36kq+Z+TBlXtjxl+I52C6QfR8yZy0rWwgaqXS36AxG2KpNI?= =?us-ascii?Q?NFW6NVxG0tu84Dw0whVneDoC808IGKL4JV/ICm+nHnF+SzWzXh5J5tHTBmxB?= =?us-ascii?Q?vhDaDx206g0e/I4DF+HFHJXGkbkWsIthB9yCtPaepErfB+BDDGDvY8NadRcN?= =?us-ascii?Q?YhCiLv6MSm6kmOiPD8I3uebPjgJi7qqoS5FflVezGf+65dlpPTEOreiVJZ5q?= =?us-ascii?Q?ZRlfjj7DdzbGkWwZJUSMXEtZglAYqHEiZ2GTn6eLrGlB7iXSJGmp9HbORbKn?= =?us-ascii?Q?PU3TKwf9r/N8CsT8+7MNy0V+OH9Bh/pf4yoaQnmYkoPQKGdoWA+iRLqMv//G?= =?us-ascii?Q?IlhXLCoEFco6a8bMJ2E2eUIrz0HvEKm7cawO/SGh6c4NkEpb/iE1KwfKUknb?= =?us-ascii?Q?qOvPZZEk0libwzErgr1WG9knpxZDql7RzDIBqkPaPV2QErU3faA8hm6zfXwa?= =?us-ascii?Q?+bRpVzUoZh82uhZwOEPESrDBV/eqvsjCyy+bOlDJFdUz2xSxu4cXIX+8dNu3?= =?us-ascii?Q?9GhNYgUzDH5rKOZx17oYLg5aNQ+TTfYoDFE9477RjjKEz4lkQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0528; 5:JGX5WS/j+Ft/KpEJKSysuAugJrIt85blBUSCU7VlKlgZ8EVRQl//HkXpRSHU8CvNql9gEKcq/wET8LO3DPM2ebpYAe2Z3nCVktdJlEVVEbbQ5YYUyYxpqRw1jBCBiuy4lUgtJiFbabPfRdPnkV4cVA==; 24:pf7ecdTHGfMKeBsSEaXuXIBCXzkQA7cLm5/M2uiYN6O5UjxcErgm3Iw7c3P9VIPbkb3bG7qlG+Tj960xrfoE6OIgtZAzR6zkPah7IuhPSIo=; 7:MasrZcolSpsCHqvrEVtuYJftrdYZtZWusAQIMkYPJvGN2SNAu+y2g9mheYsZQ4kcA6ZxC8VE4J+Ti5OZQ2BPdGD5KOgNtSLnzJQSC5KIzllhF5VVo4eKG0EPQyfhzuCTfBkWmgr+f7xqX7pqUxopcBlPmHcHNfIVCJJSN1ajt3A=; 20:U0AjvjJIsh6d4p/Bv7Vz/OXnRVEgQS+AnCTrbHW1yX6mOByzEDGQCsR2LAA4a1sehCvfodC7j1AokZkJwwq2ttyIXQtcHOfl7tF2Vv2o8gm0JjvLUGomEQQrIG9Ur4nL8LnPaD+wsFq08kc7tp4Nnfx0as0zkP4g9OrE9Comh8p78wVhmejG9GxHYiUrFL4k1DBPTNZ8/PQM5zrsGCO8R7MRsvn8pp+1X6BzL/pwtftsc21yBzKifMb32/hcj7Nr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2016 21:38:54.0031 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0528 Cc: Leo Duran Subject: [Linaro-uefi] [PATCH 3/4] Move FdtBlob and FdtDxe under OverdriveBoard 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: , Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran --- .../Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c | 122 ---- .../Drivers/FdtDxe/AArch64/BdsLinuxLoaderHelper.S | 87 --- Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c | 754 --------------------- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c | 279 -------- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h | 55 -- Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf | 90 --- Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h | 166 ----- .../AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c | 192 ------ Platforms/AMD/Styx/FdtBlob/styx-husky.dtb | Bin 8093 -> 0 bytes Platforms/AMD/Styx/FdtBlob/styx-husky.dts | 435 ------------ Platforms/AMD/Styx/FdtBlob/styx-overdrive.dtb | Bin 8089 -> 0 bytes Platforms/AMD/Styx/FdtBlob/styx-overdrive.dts | 435 ------------ .../AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dtb | Bin 0 -> 8093 bytes .../AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dts | 435 ++++++++++++ .../Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb | Bin 0 -> 8089 bytes .../Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts | 435 ++++++++++++ .../OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c | 122 ++++ .../FdtDxe/AArch64/BdsLinuxLoaderHelper.S | 87 +++ .../AMD/Styx/OverdriveBoard/FdtDxe/BdsLinuxFdt.c | 754 +++++++++++++++++++++ Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c | 279 ++++++++ Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.h | 55 ++ .../AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf | 90 +++ .../AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoader.h | 166 +++++ .../Styx/OverdriveBoard/FdtDxe/LinuxLoaderHelper.c | 192 ++++++ .../AMD/Styx/OverdriveBoard/OverdriveBoard.dsc | 2 +- .../AMD/Styx/OverdriveBoard/OverdriveBoard.fdf | 4 +- 26 files changed, 2618 insertions(+), 2618 deletions(-) delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoaderHelper.S delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h delete mode 100644 Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c delete mode 100644 Platforms/AMD/Styx/FdtBlob/styx-husky.dtb delete mode 100644 Platforms/AMD/Styx/FdtBlob/styx-husky.dts delete mode 100644 Platforms/AMD/Styx/FdtBlob/styx-overdrive.dtb delete mode 100644 Platforms/AMD/Styx/FdtBlob/styx-overdrive.dts create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dtb create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dts create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/BdsLinuxFdt.c create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.h create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoader.h create mode 100644 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoaderHelper.c diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c b/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c deleted file mode 100644 index 8e6fbfc..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c +++ /dev/null @@ -1,122 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-* Copyright (c) 2014 - 2015, 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/AArch64/BdsLinuxLoader.c - -**/ - -#include -#include -#include -#include -#include - -#include - -/* These externs are used to relocate some ASM code into Linux memory. */ -extern VOID *SecondariesPenStart; -extern VOID *SecondariesPenEnd; -extern UINTN *AsmParkingBase; -extern UINTN *AsmMailboxBase; - -extern EFI_BOOT_SERVICES *gBS; - -VOID -EFIAPI -AmdStyxMoveParkedCores( - VOID - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS MpParkingBase; - UINTN MpParkingSize; - EFI_PHYSICAL_ADDRESS PenBase; - UINTN PenSize; - UINTN MailboxBase; - ARM_PROCESSOR_TABLE *ArmProcessorTable; - ARM_CORE_INFO *ArmCoreInfoTable; - UINTN ArmCoreCount; - UINTN CoreNum; - UINTN CoreMailbox; - UINTN CoreParking; - - // Get core information - ArmProcessorTable = AmdStyxGetArmProcessorTable(); - ASSERT_EFI_ERROR (ArmProcessorTable == NULL); - ArmCoreInfoTable = ArmProcessorTable->ArmCpus; - ArmCoreCount = ArmProcessorTable->NumberOfEntries; - - // Get Parking area (4KB-aligned, 4KB per core) - MpParkingBase = FixedPcdGet64 (PcdParkingProtocolBase); - ASSERT_EFI_ERROR (MpParkingBase & (SIZE_4KB - 1)); - MpParkingSize = ArmCoreCount * SIZE_4KB; - ASSERT_EFI_ERROR (MpParkingSize > FixedPcdGet64 (PcdParkingProtocolSize)); - - // - // Set Pen at the 2K-offset of the Parking area, skipping an 8-byte slot for the Core#. - // For details, refer to the "Multi-processor Startup for ARM Platforms" document: - // https://acpica.org/sites/acpica/files/MP%20Startup%20for%20ARM%20platforms.doc - // - PenBase = (EFI_PHYSICAL_ADDRESS)((UINTN)MpParkingBase + SIZE_2KB + sizeof(UINT64)); - PenSize = (UINTN)&SecondariesPenEnd - (UINTN)&SecondariesPenStart; - - // Reserve the memory as RuntimeServices - Status = gBS->AllocatePages (AllocateAddress, EfiRuntimeServicesCode, - EFI_SIZE_TO_PAGES (MpParkingSize ), &MpParkingBase ); - if (EFI_ERROR (Status)) { - Print (L"Warning: Failed to reserve memory for MP-Parking protocol at 0x%lX, Status = %r\n", - MpParkingBase, Status); - // Even if there is a risk of memory corruption we carry on - } - - // Relocate the Pen code - CopyMem ((VOID*)(PenBase), (VOID*)&SecondariesPenStart, PenSize); - - // Put spin-table mailboxes below the pen code so we know where they are relative to code. - // Make sure this is 8 byte aligned. - MailboxBase = (UINTN)PenBase + ((UINTN)&SecondariesPenEnd - (UINTN)&SecondariesPenStart); - if (MailboxBase % sizeof(UINT64) != 0) { - MailboxBase += sizeof(UINT64) - MailboxBase % sizeof(UINT64); - } - - // Update variables used in the Pen code - *(UINTN*)(PenBase + ((UINTN)&AsmMailboxBase - (UINTN)&SecondariesPenStart)) = MailboxBase; - *(UINTN*)(PenBase + ((UINTN)&AsmParkingBase - (UINTN)&SecondariesPenStart)) = (UINTN)MpParkingBase; - - for (CoreNum = 0; CoreNum < ArmCoreCount; CoreNum++) { - // Clear the jump address at spin-table slot - CoreMailbox = MailboxBase + CoreNum * sizeof (UINT64); - *((UINTN*)(CoreMailbox)) = 0x0; - - // Clear the jump address and set Core# at mp-parking slot - CoreParking = (UINTN)MpParkingBase + CoreNum * SIZE_4KB; - *((UINTN*)(CoreParking + sizeof (UINT64))) = 0x0; - *((UINTN*)(CoreParking + SIZE_2KB)) = CoreNum; - - // Move secondary core to our new Pen - MmioWrite64(ArmCoreInfoTable[CoreNum].MailboxSetAddress, (UINTN)PenBase); - - // Update table entry to be consumed by FDT parser. - ArmCoreInfoTable[CoreNum].MailboxSetAddress = CoreMailbox; - } - - // Flush caches to make sure our pen gets to memory before we release secondary cores. - ArmCleanDataCache(); - - // Send msg to secondary cores to jump to our new Pen. - ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); -} - diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoaderHelper.S b/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoaderHelper.S deleted file mode 100644 index d400a9c..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoaderHelper.S +++ /dev/null @@ -1,87 +0,0 @@ -// -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. -// Copyright (c) 2014 - 2015, 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/AArch64/BdsLinuxLoaderHelper.S -// -//** - -/* Secondary core pens for AArch64 Linux booting. - - This code is placed in Linux kernel memory and marked reserved. UEFI ensures - that the secondary cores get to this pen and the kernel can then start the - cores from here. - NOTE: This code must be self-contained. -*/ - -#include - -.text -.align 3 - -GCC_ASM_EXPORT(SecondariesPenStart) -ASM_GLOBAL SecondariesPenEnd - -ASM_PFX(SecondariesPenStart): - // Registers x0-x3 are reserved for future use and should be set to zero. - mov x0, xzr - mov x1, xzr - mov x2, xzr - mov x3, xzr - - mrs x4, mpidr_el1 // Get MPCore register - and x5, x4, #ARM_CORE_MASK // Get core number - and x4, x4, #ARM_CLUSTER_MASK // Get cluster number - - add x4, x5, x4, LSR #7 // Add scaled cluster number to core number - mov x6, x4 // Save a copy to compute mp-parking offset - - ldr x5, AsmMailboxBase // Get mailbox addr relative to PC - lsl x4, x4, 3 // Add 8-byte offset for this core - add x4, x4, x5 // - - ldr x5, AsmParkingBase // Get mp-parking addr relative to PC - lsl x6, x6, 12 // Add 4K-byte offset for this core - add x6, x6, x5 // - - mov x5, 1 // Get mp-parking id# at 2K offset - lsl x5, x5, 11 // - add x5, x5, x6 // - ldr x10, [x5] // - -1: ldr x5, [x4] // Load jump-addr from spin-table mailbox - cmp xzr, x5 // Has the value been set? - b.ne 4f // If so, break out of loop - - ldr x5, [x6] // Load mp-parking id# - cmp w10, w5 // Is it my id? - b.ne 2f // If not, continue polling - - ldr x5, [x6, 8] // Load jump-addr from mp-parking - cmp xzr, x5 // Has the value been set? - b.ne 3f // If so, break out of loop - -2: wfe // Wait a bit - b 1b // Wait over, check again - -3: str xzr, [x6, 8] // Clear to acknowledge - mov x0, x6 // Return mp-parking address -4: br x5 // Jump to new addr - -.align 3 // Make sure the variable below is 8 byte aligned. - .global AsmParkingBase -AsmParkingBase: .xword 0xdeaddeadbeefbeef - .global AsmMailboxBase -AsmMailboxBase: .xword 0xdeaddeadbeefbeef - -SecondariesPenEnd: diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c b/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c deleted file mode 100644 index 0d03bd7..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/BdsLinuxFdt.c +++ /dev/null @@ -1,754 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
-* Copyright (c) 2014 - 2015, 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 - -//#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdUefiEntryAddress) + PcdGet32(PcdArmLinuxFdtMaxOffset)) -#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); - 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_PROCESSOR_TABLE *ArmProcessorTable; - 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; - - // - // 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 - // - ArmProcessorTable = AmdStyxGetArmProcessorTable(); - ASSERT_EFI_ERROR (ArmProcessorTable == NULL); - ArmCoreInfoTable = ArmProcessorTable->ArmCpus; - - // Make sure SoC's core count does not exceed what we want to build - ArmCoreCount = ArmProcessorTable->NumberOfEntries; - ASSERT_EFI_ERROR (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 = AmdStyxGetPmuSpiFromMpId (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 2559762..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.c +++ /dev/null @@ -1,279 +0,0 @@ -/** @file - - Copyright (c) 2014 - 2015, 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; - - // Move secondary core to a Pen complaint with MP-Parking protocol - if (!FixedPcdGetBool (PcdPsciOsSupport)) { - AmdStyxMoveParkedCores(); - } - - // 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 7d17206..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.h +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - - Copyright (c) 2014 - 2015, 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 (PcdUefiEntryAddress) + PcdGet32(PcdArmLinuxFdtMaxOffset)) -#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset)) - -VOID -EFIAPI -AmdStyxMoveParkedCores( - 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 5ac210b..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf +++ /dev/null @@ -1,90 +0,0 @@ -#/* @file -# -# Copyright (c) 2014 - 2015, 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 - -[Sources.AARCH64] - AArch64/BdsLinuxLoader.c - AArch64/BdsLinuxLoaderHelper.S | GCC - -[Packages] - ArmPkg/ArmPkg.dec - EmbeddedPkg/EmbeddedPkg.dec - MdePkg/MdePkg.dec - AmdModulePkg/AmdModulePkg.dec - OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec - -[LibraryClasses] - UefiDriverEntryPoint - DxeServicesTableLib - BdsLib - FdtLib - DevicePathLib - AmdStyxHelperLib - -[LibraryClasses.AARCH64] - ArmGicLib - PcdLib - -[Guids] - gEfiEventReadyToBootGuid ##CONSUMED - gEfiDxeServicesTableGuid ##CONSUMED - gArmMpCoreInfoGuid ##CONSUMED - gFdtTableGuid ##CONSUMED - -[Protocols] - gEfiFirmwareVolume2ProtocolGuid ##CONSUMED - -[Pcd] - gAmdStyxTokenSpaceGuid.PcdStyxFdt - gAmdStyxTokenSpaceGuid.PcdSocCpuId - gAmdModulePkgTokenSpaceGuid.PcdEthMacA - gAmdModulePkgTokenSpaceGuid.PcdEthMacB - gAmdModulePkgTokenSpaceGuid.PcdEthMacB - gArmTokenSpaceGuid.PcdSystemMemoryBase - -[FixedPcd] - gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset - gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment - gAmdStyxTokenSpaceGuid.PcdUefiEntryAddress - gAmdStyxTokenSpaceGuid.PcdPsciOsSupport - gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport - gAmdStyxTokenSpaceGuid.PcdParkingProtocolBase - gAmdStyxTokenSpaceGuid.PcdParkingProtocolSize - -[Pcd.AARCH64] - gArmTokenSpaceGuid.PcdGicDistributorBase - gArmTokenSpaceGuid.PcdGicSgiIntId - -[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 8a23d7f..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoader.h +++ /dev/null @@ -1,166 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef __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 4d7a844..0000000 --- a/Platforms/AMD/Styx/Drivers/FdtDxe/LinuxLoaderHelper.c +++ /dev/null @@ -1,192 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2015, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include -#include - -#include "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; -} diff --git a/Platforms/AMD/Styx/FdtBlob/styx-husky.dtb b/Platforms/AMD/Styx/FdtBlob/styx-husky.dtb deleted file mode 100644 index 3427c5aa66fff6e4916044203acb4fdc876d76c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8093 zcmdT}U5F(|74DujqcLWatQr&|x$Z=WFzw!%*-18_I3zAa5yTiZ#Gl!|)iw7vbNk*- zSKs+r1@}dL4T8ZJ!9;yk%<7Y}`kIG80t)eM=D|N$F)x82;`)83s`}RS?(EJ__Q3Zhw;yZgWYjG_mB97WN&D0<*|ydOrn59MAIz=^xTf5zf_p0T4&;ElFX z^!a?0R^!fNk32q3tITxHk7`|&Rc>_We3sYwc+~llt~PYldHBhRS>OJ6M+DiFI!>d^ zrbRYybXwO#os1!xRr!XF0xqSk{JZd`pY((6NmIv6Krc8t&gn}vDeFXyM|CwG4t2Gn z7Z$n;-EJ2`0P1)UWj3vf`F^gFv#24i##ODil5}A?0h^*C%lD@oPTNm8{8qlOeg#D| z?Xm{~Hr%_X-gIJ|M{d;KYdLK$3g%Wp0(LMBq{12g2C=Kko5p^R=8Om;> zgfaY%qvMUmVnuhm=MW(mBGG#a^-YW*ldM%~p}_=DC*k`j#A#8XMA3WXiHA55+V=kP zP1}5P3|ZnjFSP4~*C)0yE*s~Prj~W|(Z>NfdyRV7uag0OSAf6Q;bNyOCJ=3W4s4)i zW69TD074stccah-fxYuM#-PDrqrqXj!8vAL9=d=*@LGDQ!h_{6reCND}%i{8YL zEqv-YjY4@JQ=jvs2@D@`=EDmpEpUm2SgGMUW2?{?RxqiAXn0CxCEW6Rw=9On1Z+T=rZgGOWGgG&i&8c^#?SiUB>H*QYFoV zIwgLzv$S+{JMaHOD%NTO(u^29KEtJ_|>lmk5Gb+t|wyBbIpmHz( zY{!L8k=St!Wb|yEU$apgQ-<@HZTNm2#pe>x=nY55&WEh!1J|3sWVuOuL!Ge!fVvLm z+iN0kGwXWadZ;~+Z~3Cab}F9v-qHu|UM@b`EY1JO#9v}!8f%3WMH5B4D*A1_vJp|SDD*L>?kdJt6UAiBiP(EB^_LB#V7P} zaq(6@Qj5S@$QA;(^zpM0JB*Li4EdOQ zK1a*ZviF9xEL4;+nZg-(r3;)udG7PGMWGU`L5UfTYgPcfE@eqi$0y^3#Mfio;|{`n z32K-Ru1$OfIKk7Owq!$pp+$eQMZ2SwmS8ebcQ_7@?32%o&-WlpJ#524 zP$<#v_45nd_y>4Uj?g|wdmUk3twHWEV;1zM8zw((?zd(htDifxC=lk~q5C<4iX-m^)1bU%yZ^fUMAzB=mF||7>E=#XY{ndu^9|~g^f$8_lc3j| z9#AO1-x@9FTHec;o=FonhA@C_Iw%Sy+W9S?0O!EY?=0zP$}(@>s`Of=%^-5OLKI?M zFo)tVg7$fccYJNrbSWpkuPehllIHLSKHKl-JNdJDS>y>C0w+)&J7j#BeBoGL6U!Yx zGWMRK?caCN#`_2T@ippM-K!ti2Yl#_dhcwWltH674=jQv{|g=#R;Zj|+T&ew%Lq1!y~*!%qZ!=Ke#V2~KW?gUY$# zXPW0f4j%i*;>QAdXTAcOcY7?SP`o_nFXtHx>pcHk4kzvBAoctZw1;5tlexjzQJ(!_ z9qGNXR<|qG3>|@{CAOCYiJ}X9Bi8?MGzDBA{k>?+n0Y?l{}-|LV@1CiYtj;HS;w%# zKPpEfaBYA0%WJNE)4XmS++5oZ-U=n!DftAr)ZW>$q@x+vPonre^E`0+2Z*2LL(nMx zT7Z8&z`x;e>H*CB5)a~7(`H_odGV#6{_N-E3y&VWj>7fVuYvahzsl8{*9lw|+_eIA za9sa{x6e`P+(E4J987?h`3G?BGtP(Re8Yb5zK!?VPFCVhdQaRRyB%?V9##lG?mx2R zK5_pHYJJ?l4BW?^Yk5fmG1_g(a2A_pK#YpjgYf_V%8Lj zcD(I7i*crhIE@u$TIaaXjHW;CO57ce>S!*_G91}V!n-sR&6)h7cKB3w`jao33%Jsv z(*3Dc6IJP`uT3<}N0Y7ja*&QPSS?H*{3wht3lb+cC;vg5L5t%A`P@X0)OKX)@uV&% zbuz+VF=JUqG^p`FOBYO?*7%8IrL7q6gaW5WlOn+Zk=!EP!XGwoVPib3)4ulJ;CgX! zaek2NDy`IDJF>L&cr8`h(FkY4z&f(pN``tv50kpe`;J%d;mz?H$o0{p%}-PL7khD- z_YyNHOZ*v)GQE*2y;^UVI>Nsx>zYK+jo5SminK(3%=$F`Aj=3N;-WPbwP9fm2UtW* znW}u$w||36jek-`*Y4kNm1&dohMOv+RaU{9+W$Wmnew^Btn1BC41G_FGUQ}yI;r6+ zMq~{kvcI3Dxv$Y9Ubjn4sjEaGZ$^k{<9~$XZ{jjF;`zoU7Eu|BIa5~}pVK-1tVvp$ SIz!?l$ooN5=z1{DqW=NKelU9g diff --git a/Platforms/AMD/Styx/FdtBlob/styx-husky.dts b/Platforms/AMD/Styx/FdtBlob/styx-husky.dts deleted file mode 100644 index a2af73f..0000000 --- a/Platforms/AMD/Styx/FdtBlob/styx-husky.dts +++ /dev/null @@ -1,435 +0,0 @@ -/* - * DTS file for AMD/Linaro 96Boards Enterprise Edition Server (Husky) Board - * Note: Based-on AMD Seattle Rev.B - * - * Copyright (C) 2015 Advanced Micro Devices, Inc. - */ - -/dts-v1/; - -/ { - model = "Linaro 96Boards Enterprise Edition Server (Husky) Board"; - 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>; - }; - - 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>; - #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"; - }; - - 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 = <0x3>; - }; - - i2c@e0050000 { - compatible = "snps,designware-i2c"; - reg = <0x0 0xe0050000 0x0 0x1000>; - interrupts = <0x0 0x154 0x4>; - clocks = <0x3>; - }; - - 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"; - }; -}; - - diff --git a/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dtb b/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dtb deleted file mode 100644 index 0c0468d89d60faf6c461b0e2e1c67098b063c7a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8089 zcmdT}O^h8!5uRC-g%IK-1|pDx^6&=9k#^$u-g=3VKrD`t00~7n;YZf*E{yw`x751 zsb{LHtE;N3tAD2F)qDT@&megCCqWRL4T6WhkM}8*2T<-u0UWy*{HG1R>ls?=7~Xy2 zpZfgy&Qm(B>r8h}UC`@~oqM!%Ua#wHQsjDEcg{`XGU=Rpa$T26nXc7NB$4C}ouyQ}7lZUxXcDN&5rYdGMKgevhWK%XnQ?s-PKPr^JtT78VX~ z=e>W9maHA=PZig(7@8_|ediqV$AEcE+WE0~l(>HA4>G%GOZ+HQs_BPO3hoVdm;win zt7k{zn&i@5&rH*w{-Wf`nM2t*{?`{TTmPg#d0Hv<$0()B#*WR$!}Z6@N3K~{*W$9S zij=0jlx*^sW5^i0G36K%moennV=-LdS}3!_)Gv_2#)AGqH9B}uDzkm-aC0MxZV-(D4YlUXH;TFp8Nc4o~sCJP*i1;niT-2OBvG9;qkB+xq6Iy*g=>tLk;u6wh2!I zCph|(hHU63Tl6`{VG@J@T3H`7UIshiy0r3MJUNaejdt z{tyq!5!&Zyr^C;y704ZA%)I_|{p6?3z1GYl^>dpR1^oOwa6iXTap-<}6X?$M(~a76 zy@bmL?q`0KetI7z^yX;e##L3|NaL15#ev67DXh(A@9@_O*}M4Fi~7iY53l!PdddDa zb8A~%2FL6ntn=oKTL+qX_PTA)x%z@_CG&)5%B2;ve_KbWi(i|wsEbCEs*bdZ^Ju8Y z*z*)B0F+^$Pg>m3TnDMw(HDSw>tuKZI>C~9u5B-q0Jt+3{d)zpi)Yi{H$=oN?C{Z&lemEILHJ=1Z8_R$>tj6Ha_mc6ZqD+k zgW$&JA>hwFA*}YJQNcDmo0JX5ivH`mMNq*`5SHXQeP0G`jk@OU%`qTI|CJgqbvLz4 zH+#BbGv=6_Z%`jCcF$0r{AQf~P7c5-b#3gobNDS(F&<)LxRKPD1cSl!fI|7b)@V7` z@?NGIRB^<{5C*VK2SuR-+rQ-#U>(^0ogpnvS?0}~rCup@H45yl5QSLh&7trMpj{r~ z9bVt4x|9>&S5?J3lIHLSKHKl*JNdI|k*5(F0w+)&J7jo;eBl^g6U%KkGUlG4?caCM z#`y>R;dSa+-mM??GyK+~CblQdHIwbkIA^Q&n@;-XZ0!5n-}|O}KXhK*9OB~<=g{sl zz9RiEyT-oUJMm;-{gJs(y5)}?soq9^in`d_pV^i_q+9;K=c z=m<0|vArxv5M1ONvHp*xDPa5P?nOh!%<=L5zlgOPEBeh?la^S^I))YgaXA`+Yx=ua zUUTi6=5_1fX4`h~Rw%)C!6(3`_V%VBEzP)o9L4RKp9W6<0O2!y2pWW6_3*EG_}48? zJ%E{C;Xxd0+RQ66&%f}qpZ|h<;n9QFP`LiOHSm7m*SLD~I)ST#y;h(Oj_aTBb~#F& z+lW<~f(dXk{{YT?#`@5lZ`cpsxA9)v%1Ycx?~41!?nK;w04oF+_a7T_kGP*lt&95? zfxEbK4RH9EJ^U*cw|#EK{nsyEdFeNh*d2GSE%b(M_7iuPuZN90C%7MX(u}*rUg5B> z`4wtpkkd2&K8>Fdr*CrE<=PaLvO_O=<-37rH1ebFWA=Kf5wfl7E7!Su&nfxE+T9n8f^f+JfM@h+_j=Bo6Pw)j+b`jao1^SIKY)WfOPDk$Ue zP**{gj@LHli%~pIU^TB&??+*PSrA#dIr$G_4H_IL$Ywo_yutNizdt`pbs3jx zv=taydb|=VZE1uvVqh&J7UuT$m0V2saB`)2U!Fd5gVDvAqE)!ivgKR_jv`R{NQ){1BJR4Q3dc$X-?{QxEoMc5uHGIX0tRO_@_p_LA zHG0hJcBv_J87bt=7!hs!4{-dAY^DZ0-`K<=Dnl_>)uqPgbc#P~l9pASAaNq({V2$F JJ(?uJ{{StXEo}e* diff --git a/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dts b/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dts deleted file mode 100644 index e1a3a98..0000000 --- a/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dts +++ /dev/null @@ -1,435 +0,0 @@ -/* - * DTS file for AMD Seattle (RevB) Overdrive Development Board - * Note: Based-on AMD Seattle Rev.B - * - * Copyright (C) 2015 Advanced Micro Devices, Inc. - */ - -/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>; - }; - - 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>; - #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"; - }; - - 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 = <0x3>; - }; - - i2c@e0050000 { - compatible = "snps,designware-i2c"; - reg = <0x0 0xe0050000 0x0 0x1000>; - interrupts = <0x0 0x154 0x4>; - clocks = <0x3>; - }; - - 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"; - }; -}; - - diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dtb b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dtb new file mode 100644 index 0000000000000000000000000000000000000000..3427c5aa66fff6e4916044203acb4fdc876d76c3 GIT binary patch literal 8093 zcmdT}U5F(|74DujqcLWatQr&|x$Z=WFzw!%*-18_I3zAa5yTiZ#Gl!|)iw7vbNk*- zSKs+r1@}dL4T8ZJ!9;yk%<7Y}`kIG80t)eM=D|N$F)x82;`)83s`}RS?(EJ__Q3Zhw;yZgWYjG_mB97WN&D0<*|ydOrn59MAIz=^xTf5zf_p0T4&;ElFX z^!a?0R^!fNk32q3tITxHk7`|&Rc>_We3sYwc+~llt~PYldHBhRS>OJ6M+DiFI!>d^ zrbRYybXwO#os1!xRr!XF0xqSk{JZd`pY((6NmIv6Krc8t&gn}vDeFXyM|CwG4t2Gn z7Z$n;-EJ2`0P1)UWj3vf`F^gFv#24i##ODil5}A?0h^*C%lD@oPTNm8{8qlOeg#D| z?Xm{~Hr%_X-gIJ|M{d;KYdLK$3g%Wp0(LMBq{12g2C=Kko5p^R=8Om;> zgfaY%qvMUmVnuhm=MW(mBGG#a^-YW*ldM%~p}_=DC*k`j#A#8XMA3WXiHA55+V=kP zP1}5P3|ZnjFSP4~*C)0yE*s~Prj~W|(Z>NfdyRV7uag0OSAf6Q;bNyOCJ=3W4s4)i zW69TD074stccah-fxYuM#-PDrqrqXj!8vAL9=d=*@LGDQ!h_{6reCND}%i{8YL zEqv-YjY4@JQ=jvs2@D@`=EDmpEpUm2SgGMUW2?{?RxqiAXn0CxCEW6Rw=9On1Z+T=rZgGOWGgG&i&8c^#?SiUB>H*QYFoV zIwgLzv$S+{JMaHOD%NTO(u^29KEtJ_|>lmk5Gb+t|wyBbIpmHz( zY{!L8k=St!Wb|yEU$apgQ-<@HZTNm2#pe>x=nY55&WEh!1J|3sWVuOuL!Ge!fVvLm z+iN0kGwXWadZ;~+Z~3Cab}F9v-qHu|UM@b`EY1JO#9v}!8f%3WMH5B4D*A1_vJp|SDD*L>?kdJt6UAiBiP(EB^_LB#V7P} zaq(6@Qj5S@$QA;(^zpM0JB*Li4EdOQ zK1a*ZviF9xEL4;+nZg-(r3;)udG7PGMWGU`L5UfTYgPcfE@eqi$0y^3#Mfio;|{`n z32K-Ru1$OfIKk7Owq!$pp+$eQMZ2SwmS8ebcQ_7@?32%o&-WlpJ#524 zP$<#v_45nd_y>4Uj?g|wdmUk3twHWEV;1zM8zw((?zd(htDifxC=lk~q5C<4iX-m^)1bU%yZ^fUMAzB=mF||7>E=#XY{ndu^9|~g^f$8_lc3j| z9#AO1-x@9FTHec;o=FonhA@C_Iw%Sy+W9S?0O!EY?=0zP$}(@>s`Of=%^-5OLKI?M zFo)tVg7$fccYJNrbSWpkuPehllIHLSKHKl-JNdJDS>y>C0w+)&J7j#BeBoGL6U!Yx zGWMRK?caCN#`_2T@ippM-K!ti2Yl#_dhcwWltH674=jQv{|g=#R;Zj|+T&ew%Lq1!y~*!%qZ!=Ke#V2~KW?gUY$# zXPW0f4j%i*;>QAdXTAcOcY7?SP`o_nFXtHx>pcHk4kzvBAoctZw1;5tlexjzQJ(!_ z9qGNXR<|qG3>|@{CAOCYiJ}X9Bi8?MGzDBA{k>?+n0Y?l{}-|LV@1CiYtj;HS;w%# zKPpEfaBYA0%WJNE)4XmS++5oZ-U=n!DftAr)ZW>$q@x+vPonre^E`0+2Z*2LL(nMx zT7Z8&z`x;e>H*CB5)a~7(`H_odGV#6{_N-E3y&VWj>7fVuYvahzsl8{*9lw|+_eIA za9sa{x6e`P+(E4J987?h`3G?BGtP(Re8Yb5zK!?VPFCVhdQaRRyB%?V9##lG?mx2R zK5_pHYJJ?l4BW?^Yk5fmG1_g(a2A_pK#YpjgYf_V%8Lj zcD(I7i*crhIE@u$TIaaXjHW;CO57ce>S!*_G91}V!n-sR&6)h7cKB3w`jao33%Jsv z(*3Dc6IJP`uT3<}N0Y7ja*&QPSS?H*{3wht3lb+cC;vg5L5t%A`P@X0)OKX)@uV&% zbuz+VF=JUqG^p`FOBYO?*7%8IrL7q6gaW5WlOn+Zk=!EP!XGwoVPib3)4ulJ;CgX! zaek2NDy`IDJF>L&cr8`h(FkY4z&f(pN``tv50kpe`;J%d;mz?H$o0{p%}-PL7khD- z_YyNHOZ*v)GQE*2y;^UVI>Nsx>zYK+jo5SminK(3%=$F`Aj=3N;-WPbwP9fm2UtW* znW}u$w||36jek-`*Y4kNm1&dohMOv+RaU{9+W$Wmnew^Btn1BC41G_FGUQ}yI;r6+ zMq~{kvcI3Dxv$Y9Ubjn4sjEaGZ$^k{<9~$XZ{jjF;`zoU7Eu|BIa5~}pVK-1tVvp$ SIz!?l$ooN5=z1{DqW=NKelU9g literal 0 HcmV?d00001 diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dts b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dts new file mode 100644 index 0000000..a2af73f --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-husky.dts @@ -0,0 +1,435 @@ +/* + * DTS file for AMD/Linaro 96Boards Enterprise Edition Server (Husky) Board + * Note: Based-on AMD Seattle Rev.B + * + * Copyright (C) 2015 Advanced Micro Devices, Inc. + */ + +/dts-v1/; + +/ { + model = "Linaro 96Boards Enterprise Edition Server (Husky) Board"; + 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>; + }; + + 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>; + #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"; + }; + + 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 = <0x3>; + }; + + i2c@e0050000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0xe0050000 0x0 0x1000>; + interrupts = <0x0 0x154 0x4>; + clocks = <0x3>; + }; + + 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"; + }; +}; + + diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb new file mode 100644 index 0000000000000000000000000000000000000000..0c0468d89d60faf6c461b0e2e1c67098b063c7a9 GIT binary patch literal 8089 zcmdT}O^h8!5uRC-g%IK-1|pDx^6&=9k#^$u-g=3VKrD`t00~7n;YZf*E{yw`x751 zsb{LHtE;N3tAD2F)qDT@&megCCqWRL4T6WhkM}8*2T<-u0UWy*{HG1R>ls?=7~Xy2 zpZfgy&Qm(B>r8h}UC`@~oqM!%Ua#wHQsjDEcg{`XGU=Rpa$T26nXc7NB$4C}ouyQ}7lZUxXcDN&5rYdGMKgevhWK%XnQ?s-PKPr^JtT78VX~ z=e>W9maHA=PZig(7@8_|ediqV$AEcE+WE0~l(>HA4>G%GOZ+HQs_BPO3hoVdm;win zt7k{zn&i@5&rH*w{-Wf`nM2t*{?`{TTmPg#d0Hv<$0()B#*WR$!}Z6@N3K~{*W$9S zij=0jlx*^sW5^i0G36K%moennV=-LdS}3!_)Gv_2#)AGqH9B}uDzkm-aC0MxZV-(D4YlUXH;TFp8Nc4o~sCJP*i1;niT-2OBvG9;qkB+xq6Iy*g=>tLk;u6wh2!I zCph|(hHU63Tl6`{VG@J@T3H`7UIshiy0r3MJUNaejdt z{tyq!5!&Zyr^C;y704ZA%)I_|{p6?3z1GYl^>dpR1^oOwa6iXTap-<}6X?$M(~a76 zy@bmL?q`0KetI7z^yX;e##L3|NaL15#ev67DXh(A@9@_O*}M4Fi~7iY53l!PdddDa zb8A~%2FL6ntn=oKTL+qX_PTA)x%z@_CG&)5%B2;ve_KbWi(i|wsEbCEs*bdZ^Ju8Y z*z*)B0F+^$Pg>m3TnDMw(HDSw>tuKZI>C~9u5B-q0Jt+3{d)zpi)Yi{H$=oN?C{Z&lemEILHJ=1Z8_R$>tj6Ha_mc6ZqD+k zgW$&JA>hwFA*}YJQNcDmo0JX5ivH`mMNq*`5SHXQeP0G`jk@OU%`qTI|CJgqbvLz4 zH+#BbGv=6_Z%`jCcF$0r{AQf~P7c5-b#3gobNDS(F&<)LxRKPD1cSl!fI|7b)@V7` z@?NGIRB^<{5C*VK2SuR-+rQ-#U>(^0ogpnvS?0}~rCup@H45yl5QSLh&7trMpj{r~ z9bVt4x|9>&S5?J3lIHLSKHKl*JNdI|k*5(F0w+)&J7jo;eBl^g6U%KkGUlG4?caCM z#`y>R;dSa+-mM??GyK+~CblQdHIwbkIA^Q&n@;-XZ0!5n-}|O}KXhK*9OB~<=g{sl zz9RiEyT-oUJMm;-{gJs(y5)}?soq9^in`d_pV^i_q+9;K=c z=m<0|vArxv5M1ONvHp*xDPa5P?nOh!%<=L5zlgOPEBeh?la^S^I))YgaXA`+Yx=ua zUUTi6=5_1fX4`h~Rw%)C!6(3`_V%VBEzP)o9L4RKp9W6<0O2!y2pWW6_3*EG_}48? zJ%E{C;Xxd0+RQ66&%f}qpZ|h<;n9QFP`LiOHSm7m*SLD~I)ST#y;h(Oj_aTBb~#F& z+lW<~f(dXk{{YT?#`@5lZ`cpsxA9)v%1Ycx?~41!?nK;w04oF+_a7T_kGP*lt&95? zfxEbK4RH9EJ^U*cw|#EK{nsyEdFeNh*d2GSE%b(M_7iuPuZN90C%7MX(u}*rUg5B> z`4wtpkkd2&K8>Fdr*CrE<=PaLvO_O=<-37rH1ebFWA=Kf5wfl7E7!Su&nfxE+T9n8f^f+JfM@h+_j=Bo6Pw)j+b`jao1^SIKY)WfOPDk$Ue zP**{gj@LHli%~pIU^TB&??+*PSrA#dIr$G_4H_IL$Ywo_yutNizdt`pbs3jx zv=taydb|=VZE1uvVqh&J7UuT$m0V2saB`)2U!Fd5gVDvAqE)!ivgKR_jv`R{NQ){1BJR4Q3dc$X-?{QxEoMc5uHGIX0tRO_@_p_LA zHG0hJcBv_J87bt=7!hs!4{-dAY^DZ0-`K<=Dnl_>)uqPgbc#P~l9pASAaNq({V2$F JJ(?uJ{{StXEo}e* literal 0 HcmV?d00001 diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts new file mode 100644 index 0000000..e1a3a98 --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dts @@ -0,0 +1,435 @@ +/* + * DTS file for AMD Seattle (RevB) Overdrive Development Board + * Note: Based-on AMD Seattle Rev.B + * + * Copyright (C) 2015 Advanced Micro Devices, Inc. + */ + +/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>; + }; + + 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>; + #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"; + }; + + 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 = <0x3>; + }; + + i2c@e0050000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0xe0050000 0x0 0x1000>; + interrupts = <0x0 0x154 0x4>; + clocks = <0x3>; + }; + + 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"; + }; +}; + + diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c new file mode 100644 index 0000000..8e6fbfc --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c @@ -0,0 +1,122 @@ +/** @file +* +* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2014 - 2015, 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/AArch64/BdsLinuxLoader.c + +**/ + +#include +#include +#include +#include +#include + +#include + +/* These externs are used to relocate some ASM code into Linux memory. */ +extern VOID *SecondariesPenStart; +extern VOID *SecondariesPenEnd; +extern UINTN *AsmParkingBase; +extern UINTN *AsmMailboxBase; + +extern EFI_BOOT_SERVICES *gBS; + +VOID +EFIAPI +AmdStyxMoveParkedCores( + VOID + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS MpParkingBase; + UINTN MpParkingSize; + EFI_PHYSICAL_ADDRESS PenBase; + UINTN PenSize; + UINTN MailboxBase; + ARM_PROCESSOR_TABLE *ArmProcessorTable; + ARM_CORE_INFO *ArmCoreInfoTable; + UINTN ArmCoreCount; + UINTN CoreNum; + UINTN CoreMailbox; + UINTN CoreParking; + + // Get core information + ArmProcessorTable = AmdStyxGetArmProcessorTable(); + ASSERT_EFI_ERROR (ArmProcessorTable == NULL); + ArmCoreInfoTable = ArmProcessorTable->ArmCpus; + ArmCoreCount = ArmProcessorTable->NumberOfEntries; + + // Get Parking area (4KB-aligned, 4KB per core) + MpParkingBase = FixedPcdGet64 (PcdParkingProtocolBase); + ASSERT_EFI_ERROR (MpParkingBase & (SIZE_4KB - 1)); + MpParkingSize = ArmCoreCount * SIZE_4KB; + ASSERT_EFI_ERROR (MpParkingSize > FixedPcdGet64 (PcdParkingProtocolSize)); + + // + // Set Pen at the 2K-offset of the Parking area, skipping an 8-byte slot for the Core#. + // For details, refer to the "Multi-processor Startup for ARM Platforms" document: + // https://acpica.org/sites/acpica/files/MP%20Startup%20for%20ARM%20platforms.doc + // + PenBase = (EFI_PHYSICAL_ADDRESS)((UINTN)MpParkingBase + SIZE_2KB + sizeof(UINT64)); + PenSize = (UINTN)&SecondariesPenEnd - (UINTN)&SecondariesPenStart; + + // Reserve the memory as RuntimeServices + Status = gBS->AllocatePages (AllocateAddress, EfiRuntimeServicesCode, + EFI_SIZE_TO_PAGES (MpParkingSize ), &MpParkingBase ); + if (EFI_ERROR (Status)) { + Print (L"Warning: Failed to reserve memory for MP-Parking protocol at 0x%lX, Status = %r\n", + MpParkingBase, Status); + // Even if there is a risk of memory corruption we carry on + } + + // Relocate the Pen code + CopyMem ((VOID*)(PenBase), (VOID*)&SecondariesPenStart, PenSize); + + // Put spin-table mailboxes below the pen code so we know where they are relative to code. + // Make sure this is 8 byte aligned. + MailboxBase = (UINTN)PenBase + ((UINTN)&SecondariesPenEnd - (UINTN)&SecondariesPenStart); + if (MailboxBase % sizeof(UINT64) != 0) { + MailboxBase += sizeof(UINT64) - MailboxBase % sizeof(UINT64); + } + + // Update variables used in the Pen code + *(UINTN*)(PenBase + ((UINTN)&AsmMailboxBase - (UINTN)&SecondariesPenStart)) = MailboxBase; + *(UINTN*)(PenBase + ((UINTN)&AsmParkingBase - (UINTN)&SecondariesPenStart)) = (UINTN)MpParkingBase; + + for (CoreNum = 0; CoreNum < ArmCoreCount; CoreNum++) { + // Clear the jump address at spin-table slot + CoreMailbox = MailboxBase + CoreNum * sizeof (UINT64); + *((UINTN*)(CoreMailbox)) = 0x0; + + // Clear the jump address and set Core# at mp-parking slot + CoreParking = (UINTN)MpParkingBase + CoreNum * SIZE_4KB; + *((UINTN*)(CoreParking + sizeof (UINT64))) = 0x0; + *((UINTN*)(CoreParking + SIZE_2KB)) = CoreNum; + + // Move secondary core to our new Pen + MmioWrite64(ArmCoreInfoTable[CoreNum].MailboxSetAddress, (UINTN)PenBase); + + // Update table entry to be consumed by FDT parser. + ArmCoreInfoTable[CoreNum].MailboxSetAddress = CoreMailbox; + } + + // Flush caches to make sure our pen gets to memory before we release secondary cores. + ArmCleanDataCache(); + + // Send msg to secondary cores to jump to our new Pen. + ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId)); +} + diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S new file mode 100644 index 0000000..d400a9c --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S @@ -0,0 +1,87 @@ +// +// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// Copyright (c) 2014 - 2015, 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/AArch64/BdsLinuxLoaderHelper.S +// +//** + +/* Secondary core pens for AArch64 Linux booting. + + This code is placed in Linux kernel memory and marked reserved. UEFI ensures + that the secondary cores get to this pen and the kernel can then start the + cores from here. + NOTE: This code must be self-contained. +*/ + +#include + +.text +.align 3 + +GCC_ASM_EXPORT(SecondariesPenStart) +ASM_GLOBAL SecondariesPenEnd + +ASM_PFX(SecondariesPenStart): + // Registers x0-x3 are reserved for future use and should be set to zero. + mov x0, xzr + mov x1, xzr + mov x2, xzr + mov x3, xzr + + mrs x4, mpidr_el1 // Get MPCore register + and x5, x4, #ARM_CORE_MASK // Get core number + and x4, x4, #ARM_CLUSTER_MASK // Get cluster number + + add x4, x5, x4, LSR #7 // Add scaled cluster number to core number + mov x6, x4 // Save a copy to compute mp-parking offset + + ldr x5, AsmMailboxBase // Get mailbox addr relative to PC + lsl x4, x4, 3 // Add 8-byte offset for this core + add x4, x4, x5 // + + ldr x5, AsmParkingBase // Get mp-parking addr relative to PC + lsl x6, x6, 12 // Add 4K-byte offset for this core + add x6, x6, x5 // + + mov x5, 1 // Get mp-parking id# at 2K offset + lsl x5, x5, 11 // + add x5, x5, x6 // + ldr x10, [x5] // + +1: ldr x5, [x4] // Load jump-addr from spin-table mailbox + cmp xzr, x5 // Has the value been set? + b.ne 4f // If so, break out of loop + + ldr x5, [x6] // Load mp-parking id# + cmp w10, w5 // Is it my id? + b.ne 2f // If not, continue polling + + ldr x5, [x6, 8] // Load jump-addr from mp-parking + cmp xzr, x5 // Has the value been set? + b.ne 3f // If so, break out of loop + +2: wfe // Wait a bit + b 1b // Wait over, check again + +3: str xzr, [x6, 8] // Clear to acknowledge + mov x0, x6 // Return mp-parking address +4: br x5 // Jump to new addr + +.align 3 // Make sure the variable below is 8 byte aligned. + .global AsmParkingBase +AsmParkingBase: .xword 0xdeaddeadbeefbeef + .global AsmMailboxBase +AsmMailboxBase: .xword 0xdeaddeadbeefbeef + +SecondariesPenEnd: diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/BdsLinuxFdt.c b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/BdsLinuxFdt.c new file mode 100644 index 0000000..0d03bd7 --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/BdsLinuxFdt.c @@ -0,0 +1,754 @@ +/** @file +* +* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2014 - 2015, 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 + +//#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdUefiEntryAddress) + PcdGet32(PcdArmLinuxFdtMaxOffset)) +#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); + 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_PROCESSOR_TABLE *ArmProcessorTable; + 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; + + // + // 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 + // + ArmProcessorTable = AmdStyxGetArmProcessorTable(); + ASSERT_EFI_ERROR (ArmProcessorTable == NULL); + ArmCoreInfoTable = ArmProcessorTable->ArmCpus; + + // Make sure SoC's core count does not exceed what we want to build + ArmCoreCount = ArmProcessorTable->NumberOfEntries; + ASSERT_EFI_ERROR (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 = AmdStyxGetPmuSpiFromMpId (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/OverdriveBoard/FdtDxe/FdtDxe.c b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c new file mode 100644 index 0000000..2559762 --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c @@ -0,0 +1,279 @@ +/** @file + + Copyright (c) 2014 - 2015, 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; + + // Move secondary core to a Pen complaint with MP-Parking protocol + if (!FixedPcdGetBool (PcdPsciOsSupport)) { + AmdStyxMoveParkedCores(); + } + + // 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/OverdriveBoard/FdtDxe/FdtDxe.h b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.h new file mode 100644 index 0000000..7d17206 --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.h @@ -0,0 +1,55 @@ +/** @file + + Copyright (c) 2014 - 2015, 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 (PcdUefiEntryAddress) + PcdGet32(PcdArmLinuxFdtMaxOffset)) +#define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset)) + +VOID +EFIAPI +AmdStyxMoveParkedCores( + 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/OverdriveBoard/FdtDxe/FdtDxe.inf b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf new file mode 100644 index 0000000..5ac210b --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf @@ -0,0 +1,90 @@ +#/* @file +# +# Copyright (c) 2014 - 2015, 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 + +[Sources.AARCH64] + AArch64/BdsLinuxLoader.c + AArch64/BdsLinuxLoaderHelper.S | GCC + +[Packages] + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + AmdModulePkg/AmdModulePkg.dec + OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec + +[LibraryClasses] + UefiDriverEntryPoint + DxeServicesTableLib + BdsLib + FdtLib + DevicePathLib + AmdStyxHelperLib + +[LibraryClasses.AARCH64] + ArmGicLib + PcdLib + +[Guids] + gEfiEventReadyToBootGuid ##CONSUMED + gEfiDxeServicesTableGuid ##CONSUMED + gArmMpCoreInfoGuid ##CONSUMED + gFdtTableGuid ##CONSUMED + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid ##CONSUMED + +[Pcd] + gAmdStyxTokenSpaceGuid.PcdStyxFdt + gAmdStyxTokenSpaceGuid.PcdSocCpuId + gAmdModulePkgTokenSpaceGuid.PcdEthMacA + gAmdModulePkgTokenSpaceGuid.PcdEthMacB + gAmdModulePkgTokenSpaceGuid.PcdEthMacB + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset + gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment + gAmdStyxTokenSpaceGuid.PcdUefiEntryAddress + gAmdStyxTokenSpaceGuid.PcdPsciOsSupport + gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport + gAmdStyxTokenSpaceGuid.PcdParkingProtocolBase + gAmdStyxTokenSpaceGuid.PcdParkingProtocolSize + +[Pcd.AARCH64] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicSgiIntId + +[Depex] + TRUE + diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoader.h b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoader.h new file mode 100644 index 0000000..8a23d7f --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoader.h @@ -0,0 +1,166 @@ +/** @file +* +* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __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/OverdriveBoard/FdtDxe/LinuxLoaderHelper.c b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoaderHelper.c new file mode 100644 index 0000000..4d7a844 --- /dev/null +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/LinuxLoaderHelper.c @@ -0,0 +1,192 @@ +/** @file +* +* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include + +#include "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; +} diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc index 6bb40a0..e83a8ef 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.dsc @@ -631,7 +631,7 @@ DEFINE TRANS_CODE = $(EL3_TO_EL2) # # FDT support # - OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf + OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf # # PCI support diff --git a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf index 263a267..cbfb6c3 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf +++ b/Platforms/AMD/Styx/OverdriveBoard/OverdriveBoard.fdf @@ -134,10 +134,10 @@ READ_LOCK_STATUS = TRUE # # FDT support # - INF OpenPlatformPkg/Platforms/AMD/Styx/Drivers/FdtDxe/FdtDxe.inf + INF OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf FILE FREEFORM = PCD(gAmdStyxTokenSpaceGuid.PcdStyxFdt) { - SECTION RAW = OpenPlatformPkg/Platforms/AMD/Styx/FdtBlob/styx-overdrive.dtb + SECTION RAW = OpenPlatformPkg/Platforms/AMD/Styx/OverdriveBoard/FdtBlob/styx-overdrive.dtb } #