From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.73]) by mx.groups.io with SMTP id smtpd.web10.3031.1638910783455332010 for ; Tue, 07 Dec 2021 12:59:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=gXPtuSxb; spf=pass (domain: arm.com, ip: 40.107.20.73, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lOx2D2dfX4oJveUH/sckV9qo/zfd9EfxAPvETZDM3oQ=; b=gXPtuSxb0eGeECMCvmbmS9Kkh3+rfw7v+VlFvyQJqvmhgF/y37+ClzaP6mdp7qdYWaMn5c7J6eF6Tj0rvrKx+W+0XXLuXqlf/vjSn0LutVW6DZ545t/1LLxftrwgcD/euy6e0/lU8tk6ln6t5VmZccX7TcqGgVGditaQzD5Kp/k= Received: from DB6P192CA0015.EURP192.PROD.OUTLOOK.COM (2603:10a6:4:b8::25) by DB7PR08MB2970.eurprd08.prod.outlook.com (2603:10a6:5:17::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Tue, 7 Dec 2021 20:59:40 +0000 Received: from DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:b8:cafe::2e) by DB6P192CA0015.outlook.office365.com (2603:10a6:4:b8::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.17 via Frontend Transport; Tue, 7 Dec 2021 20:59:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT052.mail.protection.outlook.com (10.152.21.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.13 via Frontend Transport; Tue, 7 Dec 2021 20:59:39 +0000 Received: ("Tessian outbound dbb52aec1fa6:v110"); Tue, 07 Dec 2021 20:59:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 939154f628c0292d X-CR-MTA-TID: 64aa7808 Received: from cc16dc481118.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4A5F6142-C0A9-4517-8F69-6AA21011FD40.1; Tue, 07 Dec 2021 20:59:32 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cc16dc481118.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Dec 2021 20:59:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZJXdzy+0H2XUQ5BKJFP9QxP7Ibk+kCfJXfXz4uaGRuhthTKuQhRWLCUj0oTVkk1m//IOydstkQpo0k5q5Zkz8VHc5otFAt9wK3+s4ziT/3afl1FJ5aF2GlHv6nXGEKbPkVypGMMw4PA0e4+EJ/WLNIEpgT17E0zooudxudQUFUPy3WSE8hnkGUjfOiOTh2XR+SfSQNCTVgaL+FQmMd303wBvrnlzc+KK1F+CnGGo2cMeyT12btR7+Oq9FgSg9yu6z9NFoI3/Ss5xev32ZqmXLIe1aZNAya9popT0H3+Eb/7QVp3f+yxU1/hH4F+P6Fv4D5TWqfVYG4aOBfnv9JXLUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lOx2D2dfX4oJveUH/sckV9qo/zfd9EfxAPvETZDM3oQ=; b=ea8npfNDWbvwnIdEtomwRBCqTgpAr+sV+GX8ERjgzbO/EIXlQ56SpxdN/ho8ylzMjXY96hOtcrlDGotPtH0/MsOMMPa8w8Y8HF7Ad0s4DaC4p2T78vRY1ZcwTQsa+KYNTC+rbUhMjLfhKfjCgA1L7q18bK287GGBphf8KHaRspbaea/H7bVT+KEUsfJbdPk66oWRbQBaI81aGi+Igv6aBhjKaACQK96Dp3fwbSkg3UuTODfWF3Ig3EWKjS1rdEQrrcLj/gIRI0egIgKfugPvUmmxIdNKAz515sUULV4detrU4Qagiq8gr7w65FtG/wZGb5K/cou4tyr91BNJ3WmO7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lOx2D2dfX4oJveUH/sckV9qo/zfd9EfxAPvETZDM3oQ=; b=gXPtuSxb0eGeECMCvmbmS9Kkh3+rfw7v+VlFvyQJqvmhgF/y37+ClzaP6mdp7qdYWaMn5c7J6eF6Tj0rvrKx+W+0XXLuXqlf/vjSn0LutVW6DZ545t/1LLxftrwgcD/euy6e0/lU8tk6ln6t5VmZccX7TcqGgVGditaQzD5Kp/k= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB4472.eurprd08.prod.outlook.com (2603:10a6:20b:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Tue, 7 Dec 2021 20:59:29 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::bdcf:cfa6:b2bb:38ac]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::bdcf:cfa6:b2bb:38ac%6]) with mapi id 15.20.4755.021; Tue, 7 Dec 2021 20:59:29 +0000 Subject: Re: [edk2-platforms][PATCH V1 10/11] Platform/ARM/Morello: Add support to parse NT_FW_CONFIG To: Chandni Cherukuri , devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , nd References: <20211204123042.32140-1-chandni.cherukuri@arm.com> <20211204123042.32140-11-chandni.cherukuri@arm.com> From: "Sami Mujawar" Message-ID: <4952c99b-680d-69b7-beca-7ce7ff8ffaa6@arm.com> Date: Tue, 7 Dec 2021 20:59:34 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20211204123042.32140-11-chandni.cherukuri@arm.com> X-ClientProxiedBy: LO3P265CA0001.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:bb::6) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.50) by LO3P265CA0001.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:bb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21 via Frontend Transport; Tue, 7 Dec 2021 20:59:29 +0000 X-MS-Office365-Filtering-Correlation-Id: 51ff56b9-daac-4aa9-6d32-08d9b9c47c3d X-MS-TrafficTypeDiagnostic: AM6PR08MB4472:EE_|DB5EUR03FT052:EE_|DB7PR08MB2970:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /SkhKUP9TDTlxBvRplPLOj47/lvEJVP3frHva83vkzXMs8EsgA1l17BFJg4OROQsvOKd+AuMz/FX6NgDA+ZaqiyiKyQD2h9Y7ZuAG0KHUztgjp2bD+MRZ1fu3Y0vW6g4f6e1OJZSQllLiDH5d+sqpoQ5jioJPcRf2fGcJ/ZbMIeeOR0LlnvGcfgVRNBFsFMTHZlH5SpX2GaVn6TYO5390ITQgulYnfkfglE1yQYCqz7/kZUVpSvS6mJj9uzx3EBphBcPrpmFqEU5d7fKqKeNTgMbF3c/MFYYd+S+JHDG3FN4+52oOSIhp6aYAdzFPu6m4sFjYEvWUtXAdiRAjfNaV5k2Xh517ubsuOUw8eBvitvDUktVs7TEVYeIF0wQKe2ip37ma+5QMxHRnZC2x/WUP+XV1rebtoP4MPK33JDhbTnZUgKgQjYqJflTvtVBDIikLxi4FTExOyrnkygvkk7uD105pO8ydL6yTqutsTET5MJgNJQVWYy4jSMMbvOpGBKEljUKHgYDS4AbXfpyjcKl3/BSPtglrXTZ6/1s09s8RtAatb7W9D+JaFVU/cF5u4krU24clX8kxP8dZ2Ylec0T+mnf7ElK9buOy340b8Ufmo/LNN62NFjEDqjBNasztnI/mH3VjRtOb6ue9I3nJT+9w+2LfGe5SuORKwT1Sh2j8mXqPu8lwAJUwFLGAk7JCyOTkRRg307IKcohoBneUiNUCyGkfanTBMbW6sYeN6fj3PusBBsviwWheEufrM9Y/64XsRc7bW1rQUE+2EW1UYAj5Q== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(30864003)(508600001)(316002)(44832011)(36756003)(38350700002)(16576012)(83380400001)(52116002)(186003)(38100700002)(956004)(86362001)(54906003)(8936002)(26005)(4326008)(2616005)(31686004)(6666004)(53546011)(66556008)(8676002)(31696002)(2906002)(5660300002)(6486002)(66946007)(66476007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4472 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f1a29d5-3150-4a2b-0d03-08d9b9c475ed X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FBGKlGu5oueYchZ6hwZTBcIjbLEEnTshawUNvlOmH68GxeZbCVbUNozT+DLK/UCmTo0EEtFK3y48J9uGxASU0Tu526CBij0RDQNQsxd12uSfWLiABi5HxvXAVeZod0stKVQUIUpuPUcNEDLUxabGIlTovSYmH96epBGJFao2hdDR+bvrqvINzghixCm8takDsb2NmyFSgqmaNFeC8swJ9VM5p5QLKsCi0mfvuPesuoxo/+7xn0Dx4jFmnJ6Y67T3qYxmOcHRHuYY2Hn9dz/rl97YmVYb1AhxJzaNzgquRe3z17PJy1Kn8jAEgVwDa9xcmUEYgvZvTDHO8NJ2srSloop7Le702OXZjuj6/MEVTp73MbI4ZOxs09tzcwGQphrj/ELA8tRK4xr5kS1CJXPe5m6ZfiTn+9RVsgLitCHp0Xa14HPJoXrDstG38IUjPx2b7v5qajxjE+Z2YwvaIQpUhmQ6UNJVTlmcivDJm5zNdrNxOO6ayg4UCwUKd8pFb4tmY/m5qJIjUfsD9Y1Quy/e8e7bl0Ak+rz4AYqjvjX70NoBVF6OudCmzUc9e72hS151jwQUFQYvOqA2SsuoBWfaGE68knncvwyzjUDxtS6o2TYzyC2YiZjjAlqKh4+IbiTbRZksve+7iPJL7QMvVENGFDu4Wli0imHXEkpNoM3JZ+BMlQYqO3JR4qffC15UYpsQ1Ha02hq4tphoE0NiBmJ+DD0KvTqrlfptczT8cLWinr8= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(508600001)(186003)(26005)(356005)(8936002)(2616005)(336012)(956004)(54906003)(44832011)(70206006)(81166007)(36756003)(36860700001)(8676002)(316002)(70586007)(6666004)(6486002)(31686004)(83380400001)(82310400004)(16576012)(31696002)(53546011)(47076005)(30864003)(86362001)(2906002)(4326008)(5660300002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2021 20:59:39.8608 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51ff56b9-daac-4aa9-6d32-08d9b9c47c3d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB2970 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Hi Chandni, Please find my feedback inline marked [SAMI]. With those fixed, Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 04/12/2021 12:30 PM, Chandni Cherukuri wrote: > From: sah01 > > Support has been added to parse NT_FW_CONFIG DTB to get the > platform information. > > Signed-off-by: sahil > Signed-off-by: Chandni Cherukuri > --- > Platform/ARM/Morello/MorelloPlatform.dec | 5 + > Platform/ARM/Morello/Library/PlatformLib/PlatformLibFvp.inf | 6 ++ > Platform/ARM/Morello/Library/PlatformLib/PlatformLibSoc.inf | 6 ++ > Platform/ARM/Morello/Include/MorelloPlatform.h | 18 +++- > Platform/ARM/Morello/Library/PlatformLib/PlatformLib.c | 9 ++ > Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemFvp.c | 74 ++++++++++++- > Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemSoc.c | 113 +++++++++++++++++++- > Platform/ARM/Morello/Library/PlatformLib/AArch64/Helper.S | 2 + > 8 files changed, 225 insertions(+), 8 deletions(-) > > diff --git a/Platform/ARM/Morello/MorelloPlatform.dec b/Platform/ARM/Morello/MorelloPlatform.dec > index 07701e7611b8..3aec23b03b00 100644 > --- a/Platform/ARM/Morello/MorelloPlatform.dec > +++ b/Platform/ARM/Morello/MorelloPlatform.dec > @@ -22,6 +22,8 @@ > Include # Root include for the package > > [Guids.common] > + # ARM Morello Platform Info descriptor > + gArmMorelloPlatformInfoDescriptorGuid = { 0x891422EF, 0x5377, 0x459E, { 0xA5, 0x42, 0x7A, 0xA2, 0x1A, 0x55, 0x54, 0x7F } } > gArmMorelloTokenSpaceGuid = { 0x0A8C3A78, 0xA56F, 0x4788, { 0x83, 0xB4, 0xCD, 0x29, 0x62, 0x96, 0x77, 0x51 } } > > [PcdsFixedAtBuild] > @@ -82,3 +84,6 @@ > gArmMorelloTokenSpaceGuid.PcdRamDiskSupported|FALSE|BOOLEAN|0x00000007 > gArmMorelloTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000008 > gArmMorelloTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x0000002C > + > +[Ppis] > + gNtFwConfigDtInfoPpiGuid = { 0x8E289A83, 0x44E1, 0x41CF, { 0xA7, 0x41, 0x83, 0x80, 0x89, 0x23, 0x43, 0xA3 } } > diff --git a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibFvp.inf b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibFvp.inf > index d4c8744c0954..0f87a18da184 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibFvp.inf > +++ b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibFvp.inf > @@ -18,10 +18,14 @@ > [Packages] > ArmPkg/ArmPkg.dec > ArmPlatformPkg/ArmPlatformPkg.dec > + EmbeddedPkg/EmbeddedPkg.dec > MdeModulePkg/MdeModulePkg.dec > MdePkg/MdePkg.dec > Platform/ARM/Morello/MorelloPlatform.dec > > +[LibraryClasses] > + FdtLib > + > [Sources.common] > PlatformLib.c > PlatformLibMemFvp.c > @@ -46,7 +50,9 @@ > gArmTokenSpaceGuid.PcdSystemMemorySize > > [Guids] > + gArmMorelloPlatformInfoDescriptorGuid > gEfiHobListGuid ## CONSUMES ## SystemTable > > [Ppis] > gArmMpCoreInfoPpiGuid > + gNtFwConfigDtInfoPpiGuid > diff --git a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibSoc.inf b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibSoc.inf > index 0a36a5fe50a5..cc0687ebcaaa 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibSoc.inf > +++ b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibSoc.inf > @@ -18,10 +18,14 @@ > [Packages] > ArmPkg/ArmPkg.dec > ArmPlatformPkg/ArmPlatformPkg.dec > + EmbeddedPkg/EmbeddedPkg.dec > MdeModulePkg/MdeModulePkg.dec > MdePkg/MdePkg.dec > Platform/ARM/Morello/MorelloPlatform.dec > > +[LibraryClasses] > + FdtLib > + > [Sources.common] > PlatformLib.c > PlatformLibMemSoc.c > @@ -56,7 +60,9 @@ > gArmTokenSpaceGuid.PcdSystemMemorySize > > [Guids] > + gArmMorelloPlatformInfoDescriptorGuid > gEfiHobListGuid ## CONSUMES ## SystemTable > > [Ppis] > gArmMpCoreInfoPpiGuid > + gNtFwConfigDtInfoPpiGuid > diff --git a/Platform/ARM/Morello/Include/MorelloPlatform.h b/Platform/ARM/Morello/Include/MorelloPlatform.h > index 8b3233025958..c55bb04445cb 100644 > --- a/Platform/ARM/Morello/Include/MorelloPlatform.h > +++ b/Platform/ARM/Morello/Include/MorelloPlatform.h > @@ -51,13 +51,23 @@ > */ > #pragma pack(1) > > +typedef struct { > + UINT64 LocalDdrSize; ///< Local DDR memory size in Bytes > + UINT64 RemoteDdrSize; ///< Remote DDR memory size in Bytes > + UINT8 RemoteChipCount; ///< Remote chip count in C2C mode > + UINT8 Mode; ///< 0 - Single Chip, 1 - Chip to Chip (C2C) > + UINT32 SccConfig; ///< Contains SCC configuration from BOOT_GPR1 register > +} MORELLO_PLAT_INFO_SOC; > + > typedef struct { > UINT64 LocalDdrSize; ///< Local DDR memory size in Bytes > - UINT64 RemoteDdrSize; ///< Remote DDR memory size in Bytes > - UINT8 SlaveCount; ///< Slave count in C2C mode > - UINT8 Mode; ///< 0 - Single Chip, 1 - Chip to Chip (C2C) > -} MORELLO_PLAT_INFO; > +} MORELLO_PLAT_INFO_FVP; > > #pragma pack() > > +// NT_FW_CONFIG DT structure > +typedef struct { > + UINT64 NtFwConfigDtAddr; > +} MORELLO_NT_FW_CONFIG_INFO_PPI; > + > #endif //MORELLO_PLATFORM_H_ > diff --git a/Platform/ARM/Morello/Library/PlatformLib/PlatformLib.c b/Platform/ARM/Morello/Library/PlatformLib/PlatformLib.c > index 52318a62911a..b46b3fcc2a7b 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/PlatformLib.c > +++ b/Platform/ARM/Morello/Library/PlatformLib/PlatformLib.c > @@ -8,7 +8,10 @@ > #include > #include > #include > +#include > > +UINT64 NtFwConfigDtBlob; > +STATIC MORELLO_NT_FW_CONFIG_INFO_PPI mNtFwConfigDtInfoPpi; > STATIC ARM_CORE_INFO mCoreInfoTable[] = { > { 0x0, 0x0 }, // Cluster 0, Core 0 > { 0x0, 0x1 }, // Cluster 0, Core 1 > @@ -44,6 +47,7 @@ ArmPlatformInitialize ( > IN UINTN MpId > ) > { > + mNtFwConfigDtInfoPpi.NtFwConfigDtAddr = NtFwConfigDtBlob; > return RETURN_SUCCESS; > } > > @@ -76,6 +80,11 @@ STATIC EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = { > EFI_PEI_PPI_DESCRIPTOR_PPI, > &gArmMpCoreInfoPpiGuid, > &mMpCoreInfoPpi > + }, > + { > + EFI_PEI_PPI_DESCRIPTOR_PPI, > + &gNtFwConfigDtInfoPpiGuid, > + &mNtFwConfigDtInfoPpi > } > }; > > diff --git a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemFvp.c b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemFvp.c > index 54a870cfb3ba..9c1da9a25fcd 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemFvp.c > +++ b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemFvp.c > @@ -9,6 +9,8 @@ > #include > #include > #include > +#include > +#include > #include > > // The total number of descriptors, including the final "end-of-table" descriptor. > @@ -39,6 +41,60 @@ STATIC CONST CHAR8 *gTblAttrDesc[] = { > gTblAttrDesc[VirtualMemoryTable[Index].Attributes] \ > )); > > +/** A helper function to locate the NtFwConfig PPI and get the base address of > + NT_FW_CONFIG DT from which values are obtained using FDT helper functions. > + > + @param [out] plat_info Pointer to the MORELLO PLATFORM_INFO HOB > + > + @retval EFI_SUCCESS Success. > + returns EFI_INVALID_PARAMETER A parameter is invalid. > +**/ > +EFI_STATUS > +GetMorelloPlatInfo ( > + OUT MORELLO_PLAT_INFO_FVP *plat_info [SAMI] Please rename variable according to edk2 coding standard. > +) > +{ > + CONST UINT64 *Property; > + INT32 Offset; > + CONST VOID *NtFwCfgDtBlob; > + MORELLO_NT_FW_CONFIG_INFO_PPI *NtFwConfigInfoPpi; > + EFI_STATUS Status; > + > + Status = PeiServicesLocatePpi ( > + &gNtFwConfigDtInfoPpiGuid, > + 0, > + NULL, > + (VOID**)&NtFwConfigInfoPpi > + ); > + > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, > + "PeiServicesLocatePpi failed with error %r\n", Status)); [SAMI] In the current scenario the status code traced and returned do not match. Can the status code returned by PeiServicesLocatePpi() be returned here? [/SAMI] > + return EFI_INVALID_PARAMETER; > + } > + > + NtFwCfgDtBlob = (VOID *)(UINTN)NtFwConfigInfoPpi->NtFwConfigDtAddr; > + if (fdt_check_header (NtFwCfgDtBlob) != 0) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", NtFwCfgDtBlob)); > + return EFI_INVALID_PARAMETER; > + } > + > + Offset = fdt_subnode_offset (NtFwCfgDtBlob, 0, "platform-info"); > + if (Offset == -FDT_ERR_NOTFOUND) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB : platform-info node not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + Property = fdt_getprop (NtFwCfgDtBlob, Offset, "local-ddr-size", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "local-ddr-size property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->LocalDdrSize = fdt64_to_cpu (ReadUnaligned64 (Property)); > + return EFI_SUCCESS; > +} > + > /** > Returns the Virtual Memory Map of the platform. > > @@ -57,13 +113,27 @@ ArmPlatformGetVirtualMemoryMap ( > UINTN Index; > ARM_MEMORY_REGION_DESCRIPTOR * VirtualMemoryTable; > EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; > - MORELLO_PLAT_INFO * PlatInfo; > + MORELLO_PLAT_INFO_FVP * PlatInfo; > UINT64 DramBlock2Size; > + EFI_STATUS Status; > > Index = 0; > DramBlock2Size = 0; > > - PlatInfo = (MORELLO_PLAT_INFO *)MORELLO_PLAT_INFO_STRUCT_BASE; > + // Create platform info HOB > + PlatInfo = (MORELLO_PLAT_INFO_FVP *)BuildGuidHob ( > + &gArmMorelloPlatformInfoDescriptorGuid, > + sizeof (MORELLO_PLAT_INFO_FVP) > + ); > + if (PlatInfo == NULL) { > + DEBUG ((DEBUG_ERROR, "Platform HOB is NULL\n")); > + ASSERT (FALSE); > + return; > + } > + > + Status = GetMorelloPlatInfo (PlatInfo); > + ASSERT (Status == 0); [SAMI] The assert should be 'ASSERT_EFI_STATUS (Status)'. More importantly the code should not progress if there is a failure. Think about what happens for release builds. I think the code should return in case of failure. [/SAMI] > + > if (PlatInfo->LocalDdrSize > MORELLO_DRAM_BLOCK1_SIZE) { > DramBlock2Size = PlatInfo->LocalDdrSize - MORELLO_DRAM_BLOCK1_SIZE; > } > diff --git a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemSoc.c b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemSoc.c > index 5140764c54bc..49e4994176a9 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemSoc.c > +++ b/Platform/ARM/Morello/Library/PlatformLib/PlatformLibMemSoc.c > @@ -9,6 +9,8 @@ > #include > #include > #include > +#include > +#include > #include > > // The total number of descriptors, including the final "end-of-table" descriptor. > @@ -39,6 +41,97 @@ > gTblAttrDesc[VirtualMemoryTable[Index].Attributes] \ > )); > > +/** A helper function to locate the NtFwConfig PPI and get the base address of > + NT_FW_CONFIG DT from which values are obtained using FDT helper functions. > + > + @param [out] plat_info Pointer to the MORELLO PLATFORM_INFO HOB > + > + @retval EFI_SUCCESS Success. > + returns EFI_INVALID_PARAMETER A parameter is invalid. > +**/ > +EFI_STATUS > +GetMorelloPlatInfo ( > + OUT MORELLO_PLAT_INFO_SOC *plat_info [SAMI] Please rename variable according to edk2 coding standard. > + ) > +{ > + CONST UINT32 *Property; > + CONST UINT64 *DdrProperty; > + INT32 Offset; > + CONST VOID *NtFwCfgDtBlob; > + MORELLO_NT_FW_CONFIG_INFO_PPI *NtFwConfigInfoPpi; > + EFI_STATUS Status; > + > + Status = PeiServicesLocatePpi ( > + &gNtFwConfigDtInfoPpiGuid, > + 0, > + NULL, > + (VOID **)&NtFwConfigInfoPpi > + ); > + > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "PeiServicesLocatePpi failed with error %r\n", > + Status > + )); > + return EFI_INVALID_PARAMETER; [SAMI] In the current scenario the status code traced and returned do not match. Can the status code returned by PeiServicesLocatePpi() be returned here? [/SAMI] > + } > + > + NtFwCfgDtBlob = (VOID *)(UINTN)NtFwConfigInfoPpi->NtFwConfigDtAddr; > + if (fdt_check_header (NtFwCfgDtBlob) != 0) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", NtFwCfgDtBlob)); > + return EFI_INVALID_PARAMETER; > + } > + > + Offset = fdt_subnode_offset (NtFwCfgDtBlob, 0, "platform-info"); > + if (Offset == -FDT_ERR_NOTFOUND) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB : platform-info node not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + DdrProperty = fdt_getprop (NtFwCfgDtBlob, Offset, "local-ddr-size", NULL); > + if (DdrProperty == NULL) { > + DEBUG ((DEBUG_ERROR, "local-ddr-size property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->LocalDdrSize = fdt64_to_cpu (ReadUnaligned64 (DdrProperty)); > + > + DdrProperty = fdt_getprop (NtFwCfgDtBlob, Offset, "remote-ddr-size", NULL); > + if (DdrProperty == NULL) { > + DEBUG ((DEBUG_ERROR, "remote-ddr-size property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->RemoteDdrSize = fdt64_to_cpu (ReadUnaligned64 (DdrProperty)); > + > + Property = fdt_getprop (NtFwCfgDtBlob, Offset, "remote-chip-count", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "remote-chip-count property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->RemoteChipCount = fdt32_to_cpu (*Property); > + > + Property = fdt_getprop (NtFwCfgDtBlob, Offset, "multichip-mode", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "multichip-mode property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->Mode = fdt32_to_cpu (*Property); > + > + Property = fdt_getprop (NtFwCfgDtBlob, Offset, "scc-config", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "scc-config property not found\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + plat_info->SccConfig = fdt32_to_cpu (*Property); > + > + return EFI_SUCCESS; > +} > + > /** > Returns the Virtual Memory Map of the platform. > > @@ -57,17 +150,33 @@ ArmPlatformGetVirtualMemoryMap ( > UINTN Index; > ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; > EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; > - MORELLO_PLAT_INFO *PlatInfo; > + MORELLO_PLAT_INFO_SOC *PlatInfo; > UINT64 DramBlock2Size; > + EFI_STATUS Status; > > Index = 0; > DramBlock2Size = 0; > > - PlatInfo = (MORELLO_PLAT_INFO *)MORELLO_PLAT_INFO_STRUCT_BASE; > + // Create platform info HOB > + PlatInfo = (MORELLO_PLAT_INFO_SOC *)BuildGuidHob ( > + &gArmMorelloPlatformInfoDescriptorGuid, > + sizeof (MORELLO_PLAT_INFO_SOC) > + ); > + > + if (PlatInfo == NULL) { > + DEBUG ((DEBUG_ERROR, "Platform HOB is NULL\n")); > + ASSERT (FALSE); > + return; > + } > + > + Status = GetMorelloPlatInfo (PlatInfo); > + ASSERT (Status == 0); [SAMI] The assert should be 'ASSERT_EFI_STATUS (Status)'. More importantly the code should not progress if there is a failure. Think about what happens for release builds. I think the code should return in case of failure. [/SAMI] > + > if (PlatInfo->LocalDdrSize > MORELLO_DRAM_BLOCK1_SIZE) { > DramBlock2Size = PlatInfo->LocalDdrSize - MORELLO_DRAM_BLOCK1_SIZE; > } > > + DEBUG ((DEBUG_ERROR, "DramBlock2Size is 0x%lx\n", DramBlock2Size)); > if (DramBlock2Size != 0) { > ResourceAttributes = > EFI_RESOURCE_ATTRIBUTE_PRESENT | > diff --git a/Platform/ARM/Morello/Library/PlatformLib/AArch64/Helper.S b/Platform/ARM/Morello/Library/PlatformLib/AArch64/Helper.S > index 0bc624dfd2b4..d71cab916c75 100644 > --- a/Platform/ARM/Morello/Library/PlatformLib/AArch64/Helper.S > +++ b/Platform/ARM/Morello/Library/PlatformLib/AArch64/Helper.S > @@ -19,6 +19,8 @@ > // the UEFI firmware through the CPU registers. > // > ASM_FUNC(ArmPlatformPeiBootAction) > + adr x10, NtFwConfigDtBlob > + str x0, [x10] > ret > > //