From nobody Mon Nov 25 12:20:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71801+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71801+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613706621578230.16289197815036; Thu, 18 Feb 2021 19:50:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id bdqSYY1788612xsa8YUmP0xZ; Thu, 18 Feb 2021 19:50:21 -0800 X-Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by mx.groups.io with SMTP id smtpd.web10.4084.1613706615763468956 for ; Thu, 18 Feb 2021 19:50:15 -0800 X-Received: by mail-oo1-f42.google.com with SMTP id y21so971926oou.13 for ; Thu, 18 Feb 2021 19:50:15 -0800 (PST) X-Gm-Message-State: 3gM83SvLFKLAQihwVIMZqCMqx1787277AA= X-Google-Smtp-Source: ABdhPJw3rsqoiqqSzk32UHwwLlVh3Um+4jJtN7pxLWZV3wpmzCFyP0f/LWJJ4BuXCvjGLLj/hz7znQ== X-Received: by 2002:a4a:4302:: with SMTP id k2mr5474354ooj.50.1613706614403; Thu, 18 Feb 2021 19:50:14 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id k67sm1649522oia.7.2021.02.18.19.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 19:50:14 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Ard Biesheuvel , Leif Lindholm , Graeme Gregory , Radoslaw Biernacki Subject: [edk2-devel] [edk2-platforms v2 2/3] SbsaQemu: Update SbsaQemuAcpiDxe to use FdtHelperLib Date: Thu, 18 Feb 2021 20:50:04 -0700 Message-Id: <20210219035005.457-3-rebecca@nuviainc.com> In-Reply-To: <20210219035005.457-1-rebecca@nuviainc.com> References: <20210219035005.457-1-rebecca@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613706621; bh=YJTAungynuciSguAf3npkg3bj+Gj+teDpFEorcLXLBA=; h=Cc:Date:From:Reply-To:Subject:To; b=od1XwgdsKZoSQ4DevI8wxSUZzzOwAyGg/N3nHGgxyUHID+PvmmA3MfIO+c05jbhthMT hod+rAgb5eK8gSYUxf7kJRivek9RGDo3AGlcR1Co9I93L5Vtjfk8V6nJWuZrUWDYm9rVB NykoSYqaI1zYcyMgz3JelAm53sVNdvonv88= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Use the copy of the CountCpusFromFdt function from FdtHelperLib. Signed-off-by: Rebecca Cran --- Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 50 +--= ----------------- Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 1 + 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.= c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c index fb7c1835c3d7..02ba3e452c06 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -25,55 +26,6 @@ STATIC INT32 FdtFirstCpuOffset; STATIC INT32 FdtCpuNodeSize; =20 -/* - * A function that walks through the Device Tree created - * by Qemu and counts the number of CPUs present in it. - */ -STATIC -VOID -CountCpusFromFdt ( - VOID -) -{ - VOID *DeviceTreeBase; - INT32 Node, Prev; - RETURN_STATUS PcdStatus; - INT32 CpuNode; - INT32 CpuCount; - - DeviceTreeBase =3D (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeBaseAddress); - ASSERT (DeviceTreeBase !=3D NULL); - - // Make sure we have a valid device tree blob - ASSERT (fdt_check_header (DeviceTreeBase) =3D=3D 0); - - CpuNode =3D fdt_path_offset (DeviceTreeBase, "/cpus"); - if (CpuNode <=3D 0) { - DEBUG ((DEBUG_ERROR, "Unable to locate /cpus in device tree\n")); - return; - } - - CpuCount =3D 0; - - // Walk through /cpus node and count the number of subnodes. - // The count of these subnodes corresponds to the number of - // CPUs created by Qemu. - Prev =3D fdt_first_subnode (DeviceTreeBase, CpuNode); - FdtFirstCpuOffset =3D Prev; - while (1) { - CpuCount++; - Node =3D fdt_next_subnode (DeviceTreeBase, Prev); - if (Node < 0) { - break; - } - FdtCpuNodeSize =3D Node - Prev; - Prev =3D Node; - } - - PcdStatus =3D PcdSet32S (PcdCoreCount, CpuCount); - ASSERT_RETURN_ERROR (PcdStatus); -} - /* * Get MPIDR from device tree passed by Qemu */ diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.= inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf index 127eef029f3c..a32c1d91e834 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf @@ -35,6 +35,7 @@ DebugLib DxeServicesLib FdtLib + FdtHelperLib PcdLib PrintLib UefiDriverEntryPoint --=20 2.26.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71801): https://edk2.groups.io/g/devel/message/71801 Mute This Topic: https://groups.io/mt/80748373/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-