From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.42.114; helo=nam03-by2-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0114.outbound.protection.outlook.com [104.47.42.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3504220D7ADC5 for ; Thu, 19 Jul 2018 23:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qHMNgAaZHFSGOzQuDF4la2mY0pi8gEgOcC5PGr/kEwk=; b=ltv/AQOSMKv2ujvFHMscMW1zqxJT/M6SFHUQB0zAxMFKVAGTRdOTamnHMycP80+shzkmi17tPaYPT+CagXY+OLUVNm/iuXfbFWWM67k4l5Y5Ea4MTVXgfhG7ScYkWkr3VAtQVc9e0q8cwodHezUshebt8vt/MNr93B17/AdQFt0= Received: from SN6PR2101MB1136.namprd21.prod.outlook.com (52.132.114.25) by SN6PR2101MB1133.namprd21.prod.outlook.com (52.132.114.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.0; Fri, 20 Jul 2018 06:34:00 +0000 Received: from SN6PR2101MB1136.namprd21.prod.outlook.com ([fe80::78f8:214:33a:3c4]) by SN6PR2101MB1136.namprd21.prod.outlook.com ([fe80::78f8:214:33a:3c4%5]) with mapi id 15.20.0995.008; Fri, 20 Jul 2018 06:34:00 +0000 From: Chris Co To: "edk2-devel@lists.01.org" CC: Ard Biesheuvel , Leif Lindholm , Michael D Kinney Thread-Topic: [PATCH edk2-platforms 10/13] Silicon/NXP: Add i.MX6 Board init library Thread-Index: AQHUH/OjnQvOiP17J0mjGXnE5omcGA== Date: Fri, 20 Jul 2018 06:33:59 +0000 Message-ID: <20180720063328.26856-11-christopher.co@microsoft.com> References: <20180720063328.26856-1-christopher.co@microsoft.com> In-Reply-To: <20180720063328.26856-1-christopher.co@microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CY4PR18CA0029.namprd18.prod.outlook.com (2603:10b6:903:9a::15) To SN6PR2101MB1136.namprd21.prod.outlook.com (2603:10b6:805:4::25) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4898:80e8:a:75ac:13c7:7dde:5215] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR2101MB1133; 6:hZQHcaDcSvp8lF/hYVdmifv0ypLwowS302FG1YSzh0WC0iMIYx4EKwxEzHA/D+I0iwYzUzLs6ZStR5Wzrwf6vV32EiEdJ+Hb9g8lMzGxN1iwK5nb5UYi5iUYrwFUX1gx5rIS67hklRn7HDTuCnaBUF7n2d4/hCEFSAeG4SeBcG/d11A3R3ehzhd6ewoWinj/tknL9UkqpVdskvFLyUe6dO1gA6meflL+HGlYTpS/hAA6wstZkPUjPu+Kq/HGoLzTcomUwPdI+K7xP/+w+hmhczRlDAz/diwdAQgwSC8CUJ1/7H2xLjgDvsU4xtqukvVDVLW2zCn6P+MOg5/zOe5tCdnoprev0caatsyJO/b6hk4gUry8U1dsLyW6foeVUof30qXwsCheXJI1fqvR8zfizmyuR1R28TJnXiv8DnArzk9Y8J7D2Cb+6jSUuiGqfOTRfKjFvz39z54NglrNyyPLCw==; 5:vJIWXi/zErVUimcIOphXVn6PRFxsGHCRnG1hUPfqAELRups+PatfTKuTxDFQKpGNPWju5vTdrpceAwHWejkywvydDa8Yc9WeDRJ4l9nNtpV37LCG2skD/zEsHIKqEi0uyUr6qSRR0e/CotxUqfM4oTa/1rVFFQHQAqQKnPGqugg=; 7:DcC9pYVDIuG+5UEYHg7FL1Qeh42buDOnZ42Y7hctQUVXi0c96Zn5UbOk3eu2CIXS5TD6Fc0e8YR279QYtDzoBnbeTZh2B0usE1tidL82w9MSmWvjI/SpyJHCS2fDfgwufJ2ZEKJflAXp9bVHHLjGACafAxk4xef3vWLrO9lDUrXoMo+CYrsL7ufN4mIavyQiKOW7ulgAieJ+CEcz8Y+kUemCVLoHhPaIykBecV3MmBcgQ8kY2onWSsDOqHb7Uhgr x-ms-office365-filtering-correlation-id: 81bb1305-c3b2-4b1a-b067-08d5ee0ac61b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600067)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7193020); SRVR:SN6PR2101MB1133; x-ms-traffictypediagnostic: SN6PR2101MB1133: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(2018427008)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:SN6PR2101MB1133; BCL:0; PCL:0; RULEID:; SRVR:SN6PR2101MB1133; x-forefront-prvs: 073966E86B x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(376002)(366004)(346002)(136003)(39860400002)(189003)(199004)(52116002)(16799955002)(53946003)(46003)(2906002)(2900100001)(15188155005)(36756003)(97736004)(386003)(256004)(99286004)(86612001)(575784001)(6506007)(14444005)(86362001)(186003)(76176011)(10090500001)(102836004)(1076002)(6306002)(6512007)(8936002)(6486002)(2616005)(476003)(5660300001)(486006)(478600001)(8676002)(6116002)(81156014)(81166006)(25786009)(4326008)(5640700003)(53376002)(53936002)(68736007)(6436002)(2501003)(10290500003)(22452003)(2351001)(7736002)(305945005)(5250100002)(6916009)(54906003)(14454004)(11346002)(72206003)(106356001)(966005)(316002)(446003)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR2101MB1133; H:SN6PR2101MB1136.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: JaB4tVARYQRx6ue/yJBfUhiBAtBbMvw/jlZri8rFi1eyEX311ppistSbwFfkLM1oG+Yj8TObw4zaASq+DeEznLI19EEwYQDyu08/ybAOpM/+BICvdFxbzkSX22xiYadid4UspaCzygGkvABdnL3QthFXbfDJczaZHxWtXJbVvSAhlzaSomga4HXuWUN0mxIUlkTi5HYtnG/iqgEZsv64wpEp/9Bjb/jctmBWgvPBYUSFRVzS4pxTdNdVtvpsUuBDH5pHUB6BEjJJDaoNIRc+1Mo8npH+E/7CrVINwLmMtqFBxW7P9GOVYpI0vvgImX/6UfVi9f0pRkjp7fjp4a6g0mZ56a5KIYQtmiCQeOhdBwY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81bb1305-c3b2-4b1a-b067-08d5ee0ac61b X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2018 06:33:59.1080 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR2101MB1133 Subject: [PATCH edk2-platforms 10/13] Silicon/NXP: Add i.MX6 Board init library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2018 06:34:02 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This adds support for board initialization which is common to NXP i.MX6-based platforms. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Michael D Kinney --- Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S | 94 +++++++= ++++++++++ Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c | 106 +++++++= ++++++++++++ Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6Common.c | 92 +++++++= ++++++++++ Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6QBoardCoreDef.c | 107 +++++++= +++++++++++++ 4 files changed, 399 insertions(+) diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S b/S= ilicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S new file mode 100644 index 000000000000..18e58b07e3d4 --- /dev/null +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardHelper.S @@ -0,0 +1,94 @@ +## @file +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +#include +#include +#include +#include +#include +#include + +.text +.align 2 + +// +// GIC Cpu interface +// +#define ARM_GIC_ICCICR 0x00 // CPU Interface Control Register +#define ARM_GIC_ICCPMR 0x04 // Interrupt Priority Mask Register +#define ARM_GIC_ICCBPR 0x08 // Binary Point Register +#define ARM_GIC_ICCIAR 0x0C // Interrupt Acknowledge Register +#define ARM_GIC_ICCEIOR 0x10 // End Of Interrupt Register +#define ARM_GIC_ICCRPR 0x14 // Running Priority Register +#define ARM_GIC_ICCPIR 0x18 // Highest Pending Interrupt Register +#define ARM_GIC_ICCABPR 0x1C // Aliased Binary Point Register +#define ARM_GIC_ICCIDR 0xFC // Identification Register + +// +// SRC (System Reset Controller) register offsets & masks +// +#define IMX6_SRC_SCR 0x0 +#define IMX6_SRC_GPR1 0x20 +#define IMX6_SRC_GPR2 0x24 +#define IMX6_SRC_GPR3 0x28 +#define IMX6_SRC_GPR4 0x2C +#define IMX6_SRC_GPR5 0x30 +#define IMX6_SRC_GPR6 0x34 +#define IMX6_SRC_GPR7 0x38 +#define IMX6_SRC_GPR8 0x3C +#define IMX6_SRC_GPR9 0x40 +#define IMX6_SRC_GPR10 0x44 + +GCC_ASM_EXPORT(ArmPlatformPeiBootAction) +GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) +GCC_ASM_EXPORT(ArmPlatformGetCorePosition) + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_PFX(ArmPlatformGetPrimaryCoreMpId): + MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore)) + ldr r0, [r0] + bx lr + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformIsPrimaryCore): + mrc p15,0,r0,c0,c0,5 + ands r0,r0,#3 + moveq r0,#1 + movne r0,#0 + bx lr + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ASM_PFX(ArmPlatformGetCorePosition): + and r0, r0, #ARM_CORE_MASK + bx lr + +ASM_PFX(ArmPlatformPeiBootAction): + // enable unaligned access + mrc p15, 0, r1, c1, c0, 0 + bic r1, r1, #0x2 + mcr p15, 0, r1, c1, c0, 0 + isb + bx r14 + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c b/Sili= con/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c new file mode 100644 index 000000000000..7d034f813de7 --- /dev/null +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6BoardMem.c @@ -0,0 +1,106 @@ +/** @file +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + +#include +#include +#include +#include +#include +#include "iMX6.h" + +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 8 + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR = describing a Physical-to- + Virtual Memory mapping. This array mus= t be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; + UINTN Index =3D 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + ASSERT(VirtualMemoryMap !=3D NULL); + + DEBUG((DEBUG_VERBOSE, "Enter: ArmPlatformGetVirtualMemoryMap\n")); + + VirtualMemoryTable =3D (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_= SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MA= P_DESCRIPTORS)); + if (VirtualMemoryTable =3D=3D NULL) { + return; + } + + CacheAttributes =3D DDR_ATTRIBUTES_CACHED; + DEBUG((DEBUG_VERBOSE, "CacheAttributes=3D0x%d\n", CacheAttributes)); + + // SOC registers region 1 (0x00100000 size 0x00C00000) + VirtualMemoryTable[Index].PhysicalBase =3D SOC_REGISTERS_PHYSICAL_BASE= 1; + VirtualMemoryTable[Index].VirtualBase =3D SOC_REGISTERS_PHYSICAL_BASE= 1; + VirtualMemoryTable[Index].Length =3D SOC_REGISTERS_PHYSICAL_LENG= TH1; + VirtualMemoryTable[Index].Attributes =3D SOC_REGISTERS_ATTRIBUTES; + + // PCIE Registers (0x01000000 size 0x01000000) + VirtualMemoryTable[++Index].PhysicalBase =3D PCIE_REGISTERS_PHYSICAL_BAS= E; + VirtualMemoryTable[Index].VirtualBase =3D PCIE_REGISTERS_PHYSICAL_BAS= E; + VirtualMemoryTable[Index].Length =3D PCIE_REGISTERS_PHYSICAL_LEN= GTH; + VirtualMemoryTable[Index].Attributes =3D SOC_REGISTERS_ATTRIBUTES; + + // SOC registers region 2 (excluding EIM) (0x02000000 size 0x00A00000) + VirtualMemoryTable[++Index].PhysicalBase =3D SOC_REGISTERS_PHYSICAL_BASE= 2; + VirtualMemoryTable[Index].VirtualBase =3D SOC_REGISTERS_PHYSICAL_BASE= 2; + VirtualMemoryTable[Index].Length =3D SOC_REGISTERS_PHYSICAL_LENG= TH2; + VirtualMemoryTable[Index].Attributes =3D SOC_REGISTERS_ATTRIBUTES; + + // Framebuffer + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet32 (PcdFrameBuff= erBase); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet32 (PcdFrameBuff= erBase); + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdFrameBuff= erSize); + VirtualMemoryTable[Index].Attributes =3D DDR_ATTRIBUTES_UNCACHED; + + // Boot (UEFI) DRAM region (kernel.img & boot working DRAM) (0x10800000 = size 0x001D0000) + VirtualMemoryTable[++Index].PhysicalBase =3D BOOT_IMAGE_PHYSICAL_BASE; + VirtualMemoryTable[Index].VirtualBase =3D BOOT_IMAGE_PHYSICAL_BASE; + VirtualMemoryTable[Index].Length =3D BOOT_IMAGE_PHYSICAL_LENGT= H; + VirtualMemoryTable[Index].Attributes =3D BOOT_IMAGE_ATTRIBUTES; + + // TrustZone Shared Memory + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet64(PcdTrustZone= SharedMemoryBase); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet64(PcdTrustZone= SharedMemoryBase); + VirtualMemoryTable[Index].Length =3D FixedPcdGet64(PcdTrustZone= SharedMemorySize); + VirtualMemoryTable[Index].Attributes =3D CacheAttributes; + + // Base SDRAM + VirtualMemoryTable[++Index].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBa= se); + VirtualMemoryTable[Index].VirtualBase =3D PcdGet64 (PcdSystemMemoryBa= se); + VirtualMemoryTable[Index].Length =3D PcdGet64 (PcdSystemMemorySi= ze); + VirtualMemoryTable[Index].Attributes =3D CacheAttributes; + + // End of Table + VirtualMemoryTable[++Index].PhysicalBase =3D 0; + VirtualMemoryTable[Index].VirtualBase =3D 0; + VirtualMemoryTable[Index].Length =3D 0; + VirtualMemoryTable[Index].Attributes =3D (ARM_MEMORY_REGION_ATTRIBUT= ES)0; + + ASSERT((Index + 1) <=3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap =3D VirtualMemoryTable; +} diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6Common.c b/Silico= n/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6Common.c new file mode 100644 index 000000000000..339f9b243f4a --- /dev/null +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6Common.c @@ -0,0 +1,92 @@ +/** @file +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void __DoNothing() {} +VOID SdhcInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID EhciInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID EnetInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID I2cInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID SpiInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID PcieInit () __attribute__ ((weak, alias ("__DoNothing"))); +VOID SetupAudio () __attribute__ ((weak, alias ("__DoNothing"))); + +RETURN_STATUS +EFIAPI +TimerConstructor ( + VOID + ); + +/** + Initialize controllers that must setup at the early stage +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + if (!ArmPlatformIsPrimaryCore (MpId)) { + return RETURN_SUCCESS; + } + + ImxClkPwrInit (); + + // Initialize default UEFI debug port early so we can use its debug outp= ut + SerialPortInitialize (); + SerialPortWrite ( + (UINT8 *)SERIAL_DEBUG_PORT_INIT_MSG, + (UINTN)sizeof(SERIAL_DEBUG_PORT_INIT_MSG)); + + // Initialize timer early on because the following init path will be cal= ling + // delay functions. PrePi.c calls ArmPlatformInitialize before it calls + // TimerConstructor to initialize the timer. + TimerConstructor (); + + SdhcInit (); + EhciInit (); + EnetInit (); + I2cInit (); + SpiInit (); + PcieInit (); + SetupAudio (); + + return RETURN_SUCCESS; +} + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6QBoardCoreDef.c b= /Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6QBoardCoreDef.c new file mode 100644 index 000000000000..5e136af212a0 --- /dev/null +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6BoardLib/iMX6QBoardCoreDef.c @@ -0,0 +1,107 @@ +/** @file +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + +#include +#include +#include +#include +#include + +ARM_CORE_INFO iMX6Ppi[] =3D +{ + { + // Cluster 0, Core 0 + 0x0, 0x0, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value. + // Not used with i.MX6, set to 0 + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (UINT64)0 + }, + +#if FixedPcdGet32(PcdCoreCount) > 1 + { + // Cluster 0, Core 1 + 0x0, 0x1, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value + // Not used with i.MX6, set to 0 + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (UINT64)0 + }, +#endif // FixedPcdGet32(PcdCoreCount) > 1 + +#if FixedPcdGet32(PcdCoreCount) > 2 + { + // Cluster 0, Core 2 + 0x0, 0x2, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value + // Not used with i.MX6, set to 0 + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (UINT64)0 + }, + + { + // Cluster 0, Core 3 + 0x0, 0x3, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value + // Not used with i.MX6, set to 0 + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (EFI_PHYSICAL_ADDRESS)0x00000000, + (UINT64)0 + } +#endif // FixedPcdGet32(PcdCoreCount) > 2 +}; + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + // Only support one cluster + *CoreCount =3D sizeof(iMX6Ppi) / sizeof(ARM_CORE_INFO); + ASSERT(*CoreCount =3D=3D FixedPcdGet32(PcdCoreCount)); + *ArmCoreTable =3D iMX6Ppi; + return EFI_SUCCESS; +} + +EFI_GUID mArmMpCoreInfoPpiGuid =3D ARM_MP_CORE_INFO_PPI_GUID; +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi =3D { PrePeiCoreGetMpCoreInfo }; +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &mArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + } +}; + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize =3D sizeof(gPlatformPpiTable); + *PpiList =3D gPlatformPpiTable; +} --=20 2.16.2.gvfs.1.33.gf5370f1