From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=rheI2j4O; spf=pass (domain: nuviainc.com, ip: 209.85.161.42, mailfrom: rebecca@nuviainc.com) Received: by mail-oo1-f42.google.com with SMTP id y21so971926oou.13 for ; Thu, 18 Feb 2021 19:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zt5XUXU7hI7ivaefQh4FH4a5T+PtjYnOQ00m4fMkP+4=; b=rheI2j4OL+Blxhcz9cAPhQsTRwQgSWp9CVaVQrfneAs6DjVOFJ4mdAaWcL1hUXkGlS QHfN+RRSC7q+m7XnQbrdyXNrJqYjzdoI5hZ00nXXAiuziajJaa3OVGuocE1GlS0c4Wsm xNOfQj9se77xDb7B3ymhdjXfmVQROuJ/rF76xTXeed5QR3TK+rrOvvMk0vXJPLVn2y+e ZWWj8vXy7j++zfyt7p4zm8ofaZq7mAjriCQAy6tyH7aYvdS/b+idR3QfMnFWmiphVrWW fUDWo6XXnuk6ZC20h91YpO6eu2x80ItV6rCzIpgIv3R28i6uYym+O9wQcWoQHbqfycRP nEnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zt5XUXU7hI7ivaefQh4FH4a5T+PtjYnOQ00m4fMkP+4=; b=ANyN3WXg3NxwVd8ZFj1hv9DPT/gDkMLoEhyW5RFGoY3lmTryxpPW+cNQBSIDGKbZ6E rxLwsZmD3J47DbRVGzhDm6T63RNk5cROpIJ02cazI6Bj3kgszS8ntWwqpetmilNLntuz cQSlCBqeGg3hD8IPN0kMF/6ggXnZ1nnyP/xQpySzBIwbkzD6S3AaqR5wY+acv9E3T65o DexsNizRgxwf2hksp5w9baqhJw8HUGVx5LjHPytpVH70Py1MqPXauqh2WJCjQ72CUwA1 0jIVUAfZw3KX3WPdU1/YVQemqlDhN1NkPOdI7C6sJSheRPE8THER+Ur/oN/59AaQX0Ju LkrA== X-Gm-Message-State: AOAM532AW+Re3Vrr7j1JPjF+WQ3kMZcNJyOcGu2wAwRD8Cyx6IAU/+y9 wCM/DszMmaC5+k1v7Mjd0Ar5vOhSSWBxrN+NVR4JW5GZs5TfXueaBqKTwnR7PJfV2l+1/sytttV OE856FyxjxFjdjY8sHovsh7v7MOdFYrgL3S+2YRTLoO4UlrP03EF7inuAEhJLuaq00U79yQ== 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) Return-Path: 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-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> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219035005.457-1-rebecca@nuviainc.com> References: <20210219035005.457-1-rebecca@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; -/* - * 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 = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeBaseAddress); - ASSERT (DeviceTreeBase != NULL); - - // Make sure we have a valid device tree blob - ASSERT (fdt_check_header (DeviceTreeBase) == 0); - - CpuNode = fdt_path_offset (DeviceTreeBase, "/cpus"); - if (CpuNode <= 0) { - DEBUG ((DEBUG_ERROR, "Unable to locate /cpus in device tree\n")); - return; - } - - CpuCount = 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 = fdt_first_subnode (DeviceTreeBase, CpuNode); - FdtFirstCpuOffset = Prev; - while (1) { - CpuCount++; - Node = fdt_next_subnode (DeviceTreeBase, Prev); - if (Node < 0) { - break; - } - FdtCpuNodeSize = Node - Prev; - Prev = Node; - } - - PcdStatus = 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 -- 2.26.2