From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 02A407803D7 for ; Mon, 25 Mar 2024 18:45:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=L6Zj9CgcOUF65a1pIlcWkkS5f0vND+f6DCsCGupnjp0=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20240206; t=1711392303; v=1; b=YEtj3YKWqD34WRsDb46kHk/SM28JQzEImwy/ZW29gZwGs+8veadwWAxIxHMYPnmsXQgYSZMk D2hPAvIIDeTqA5Ek0URuRtQKSAEm6AlYVWBeSOsNo0x4YHOSlRUZvz7mHw6pi5Ul3X8uHUBAAOv DV83SYdORGITAzJwLlk536oW3W/jzDKqhdgf3xezw0obrAcDk5MLdJ/GghSvaBUa6Tp7IqOV8fv EyXPMAu667yUzJpjSJOObjed0JBCuTc8RbIq2h7jZyRWtN3fXO08MkVQ+b3x6aPuTjLkBfOJDf1 FXKcXaVOwH/gGUoeCtxmKWSQw4fVn4raJrJQY0Tjrn8Qg== X-Received: by 127.0.0.2 with SMTP id 3nOjYY7687511xUw0k3wAeV2; Mon, 25 Mar 2024 11:45:03 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web11.3432.1711392302726645120 for ; Mon, 25 Mar 2024 11:45:02 -0700 X-Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42PIiuis031690; Mon, 25 Mar 2024 18:45:02 GMT X-Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x3626hdxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Mar 2024 18:45:02 +0000 (GMT) X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42PIj1H8014707 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Mar 2024 18:45:01 GMT X-Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 25 Mar 2024 11:44:59 -0700 Date: Mon, 25 Mar 2024 18:44:56 +0000 From: "Leif Lindholm" To: , CC: Ard Biesheuvel , Graeme Gregory , Xiong Yining , Chen Baozi Subject: Re: [edk2-devel] [PATCH edk2-platforms v9 2/4] Platform/SbsaQemu: use SbsaQemuHardwareInfoLib for cpu information Message-ID: References: <20240322-no-dt-for-cpu-v9-0-92e947e0fbdf@linaro.org> <20240322-no-dt-for-cpu-v9-2-92e947e0fbdf@linaro.org> MIME-Version: 1.0 In-Reply-To: <20240322-no-dt-for-cpu-v9-2-92e947e0fbdf@linaro.org> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: Q0DcX3Ga_9XDdlbQOipLpqqhFywxcUtv X-Proofpoint-GUID: Q0DcX3Ga_9XDdlbQOipLpqqhFywxcUtv Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 25 Mar 2024 11:45:02 -0700 Reply-To: devel@edk2.groups.io,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 7YohlWDJxYRNqaIYqvtxbh9lx7686176AA= Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=YEtj3YKW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Fri, Mar 22, 2024 at 17:08:48 +0100, Marcin Juszkiewicz wrote: > We have SbsaQemuHardwareInfoLib to ask for hardware details. No need to > parse DeviceTree anymore. > > Signed-off-by: Marcin Juszkiewicz Nitpicks or changing function calls based on what I commented on in previous patch does not retract from: Reviewed-by: Leif Lindholm > --- > Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf | 6 ++---- > .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 5 ++--- > .../SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.inf | 4 ++-- > Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c | 11 +++++----- > .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 21 +++++++------------- > 5 files changed, 18 insertions(+), 29 deletions(-) > > diff --git a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > index a34f54d431d4..f959d8e0e4ee 100644 > --- a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > +++ b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > @@ -3,7 +3,7 @@ > # > # Copyright (c) 2021, NUVIA Inc. All rights reserved. > # Copyright (c) 2018, Hisilicon Limited. All rights reserved. > -# Copyright (c) 2018, Linaro Limited. All rights reserved. > +# Copyright (c) 2018-2024, Linaro Ltd. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -29,8 +29,7 @@ [Packages] > > [LibraryClasses] > BaseMemoryLib > - FdtLib > - FdtHelperLib > + HardwareInfoLib > IoLib > PcdLib > > @@ -40,7 +39,6 @@ [Guids] > [Pcd] > gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease > gArmTokenSpaceGuid.PcdSystemBiosRelease > - gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress > > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSystemManufacturer > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSystemSerialNumber > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf > index 291743b19115..727c8e82d16e 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf > @@ -1,7 +1,7 @@ > ## @file > # This driver modifies ACPI tables for the Qemu SBSA platform > # > -# Copyright (c) 2020, Linaro Ltd. All rights reserved. > +# Copyright (c) 2020-2024, Linaro Ltd. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -35,7 +35,7 @@ [LibraryClasses] > BaseLib > DebugLib > DxeServicesLib > - FdtHelperLib > + HardwareInfoLib > PcdLib > PrintLib > UefiDriverEntryPoint > @@ -44,7 +44,6 @@ [LibraryClasses] > > [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile > - gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdCoreCount > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdClusterCount > > gArmTokenSpaceGuid.PcdGicDistributorBase > diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.inf > index c067a80cc715..07e6bc4e9b11 100644 > --- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.inf > +++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.inf > @@ -1,6 +1,6 @@ > #/* @file > # > -# Copyright (c) 2019, Linaro Limited. All rights reserved. > +# Copyright (c) 2019-2024, Linaro Limited. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -32,9 +32,9 @@ [LibraryClasses] > ArmLib > BaseMemoryLib > DebugLib > - FdtLib > MemoryAllocationLib > PcdLib > + SbsaQemuHardwareInfoLib LibraryClass uses different name here? > > [Pcd] > gArmTokenSpaceGuid.PcdSystemMemoryBase > diff --git a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > index c38f2851904f..854f6f4072d5 100644 > --- a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > +++ b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > @@ -2,7 +2,7 @@ > * OemMiscLib.c > * > * Copyright (c) 2021, NUVIA Inc. All rights reserved. > -* Copyright (c) 2020, Linaro Ltd. All rights reserved. > +* Copyright (c) 2020-2024, Linaro Ltd. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -12,14 +12,13 @@ > #include > #include > #include > -#include > #include > #include > #include > #include > +#include Move above HiiLib.h. > #include > #include > -#include > > /** Returns whether the specified processor is present or not. > > @@ -33,7 +32,7 @@ OemIsProcessorPresent ( > UINTN ProcessorIndex > ) > { > - if (ProcessorIndex < FdtHelperCountCpus ()) { > + if (ProcessorIndex < GetCpuCount ()) { > return TRUE; > } > > @@ -76,7 +75,7 @@ OemGetProcessorInformation ( > { > UINT16 ProcessorCount; > > - ProcessorCount = FdtHelperCountCpus (); > + ProcessorCount = GetCpuCount (); > > if (ProcessorIndex < ProcessorCount) { > ProcessorStatus->Bits.CpuStatus = 1; // CPU enabled > @@ -121,7 +120,7 @@ OemGetMaxProcessors ( > VOID > ) > { > - return FdtHelperCountCpus (); > + return GetCpuCount (); > } > > /** Gets information about the cache at the specified cache level. > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > index 9fb17151d7b8..4ebe2a445344 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > @@ -1,7 +1,7 @@ > /** @file > * This file is an ACPI driver for the Qemu SBSA platform. > * > -* Copyright (c) 2020, Linaro Ltd. All rights reserved. > +* Copyright (c) 2020-2024, Linaro Ltd. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -15,10 +15,10 @@ > #include > #include > #include > -#include > #include > #include > #include > +#include Move above MemoryAllocationLib.h. / Leif > #include > #include > #include > @@ -255,8 +255,7 @@ AddMadtTable ( > // Initialize GIC Redistributor Structure > EFI_ACPI_6_0_GICR_STRUCTURE Gicr = SBSAQEMU_MADT_GICR_INIT(); > > - // Get CoreCount which was determined eariler after parsing device tree > - NumCores = PcdGet32 (PcdCoreCount); > + NumCores = GetCpuCount (); > > // Calculate the new table size based on the number of cores > TableSize = sizeof (EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER) + > @@ -291,13 +290,13 @@ AddMadtTable ( > New += sizeof (EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER); > > // Add new GICC structures for the Cores > - for (CoreIndex = 0; CoreIndex < PcdGet32 (PcdCoreCount); CoreIndex++) { > + for (CoreIndex = 0; CoreIndex < NumCores; CoreIndex++) { > EFI_ACPI_6_0_GIC_STRUCTURE *GiccPtr; > > CopyMem (New, &Gicc, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE)); > GiccPtr = (EFI_ACPI_6_0_GIC_STRUCTURE *) New; > GiccPtr->AcpiProcessorUid = CoreIndex; > - GiccPtr->MPIDR = FdtHelperGetMpidr (CoreIndex); > + GiccPtr->MPIDR = GetMpidr (CoreIndex); > New += sizeof (EFI_ACPI_6_0_GIC_STRUCTURE); > } > > @@ -396,7 +395,7 @@ AddSsdtTable ( > UINT32 CpuId; > UINT32 Offset; > UINT8 ScopeOpName[] = SBSAQEMU_ACPI_SCOPE_NAME; > - UINT32 NumCores = PcdGet32 (PcdCoreCount); > + UINT32 NumCores = GetCpuCount (); > > EFI_ACPI_DESCRIPTION_HEADER Header = > SBSAQEMU_ACPI_HEADER ( > @@ -497,7 +496,7 @@ AddPpttTable ( > EFI_PHYSICAL_ADDRESS PageAddress; > UINT8 *New; > UINT32 CpuId; > - UINT32 NumCores = PcdGet32 (PcdCoreCount); > + UINT32 NumCores = GetCpuCount (); > > EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE L1DCache = SBSAQEMU_ACPI_PPTT_L1_D_CACHE_STRUCT; > EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE L1ICache = SBSAQEMU_ACPI_PPTT_L1_I_CACHE_STRUCT; > @@ -758,12 +757,6 @@ InitializeSbsaQemuAcpiDxe ( > { > EFI_STATUS Status; > EFI_ACPI_TABLE_PROTOCOL *AcpiTable; > - UINT32 NumCores; > - > - // Parse the device tree and get the number of CPUs > - NumCores = FdtHelperCountCpus (); > - Status = PcdSet32S (PcdCoreCount, NumCores); > - ASSERT_RETURN_ERROR (Status); > > // Check if ACPI Table Protocol has been installed > Status = gBS->LocateProtocol ( > > -- > 2.44.0 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117089): https://edk2.groups.io/g/devel/message/117089 Mute This Topic: https://groups.io/mt/105088440/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-