From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 41F18AC1731 for ; Thu, 8 Aug 2024 14:21:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Ma9MS0UMZ4etKncPNUapkTEamN0xgvuYuTe2E9Y9Irw=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1723126877; v=1; b=Nz1DsyWM3tZao/2QmfOVLkiwtlAm9V23a4I2YldpEyGiqc8CNliw1MNtAizKuEDszrk8bMwt nzWKJXkB+9F+G1UdkWBiKBvmz8dyzLX266CVoASe8wwrEhrgi3sTBNNy4V4c1nlXt2HYyNslZrd Eeju+mmnwzwHIoyJ0eGPl7G+7OZuOcXRsOvLhxNkBM5wo3wxaHN9m+ZBqfkr53KKix+IT9qVq8q yydZJLQcZFe1XLWDG7fvHB6UpdiV0qld2Tw8tFUUvFhhl5ekgSpK35l+gyLGXjGfX+WkFMJPNTr XMzRcF6uUH4ZiOGOZ+gWk/6QieFbcQBfrrVxpKiiSJ6ng== X-Received: by 127.0.0.2 with SMTP id dyBKYY7687511xH0OWRV4hS7; Thu, 08 Aug 2024 07:21:15 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.61231.1723126874533817479 for ; Thu, 08 Aug 2024 07:21:15 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 792E22606CF; Thu, 8 Aug 2024 16:21:12 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id k9s2WHwSk5TH; Thu, 8 Aug 2024 16:21:10 +0200 (CEST) X-Received: from applejack.lan (83.8.56.232.ipv4.supernova.orange.pl [83.8.56.232]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 35AC726113E; Thu, 8 Aug 2024 16:21:09 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Thu, 08 Aug 2024 16:20:58 +0200 Subject: [edk2-devel] [PATCH edk2-platforms 2/3] SbsaQemu: move from ArmSmcLib to ArmMonitorLib MIME-Version: 1.0 Message-Id: <20240808-move-from-armsmclib-to-armmonitorlib-v1-2-de5f744a272c@linaro.org> References: <20240808-move-from-armsmclib-to-armmonitorlib-v1-0-de5f744a272c@linaro.org> In-Reply-To: <20240808-move-from-armsmclib-to-armmonitorlib-v1-0-de5f744a272c@linaro.org> To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Graeme Gregory , Marcin Juszkiewicz 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: Thu, 08 Aug 2024 07:21:15 -0700 Resent-From: marcin.juszkiewicz@linaro.org Reply-To: devel@edk2.groups.io,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: qSEQzrL6DPdkYV2N8FpBIGMJx7686176AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=Nz1DsyWM; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linaro.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io ArmMonitorLib allows to use 18 registers are both arguments and results. Signed-off-by: Marcin Juszkiewicz --- .../SbsaQemuHardwareInfoLib.inf | 2 +- .../SbsaQemuHardwareInfoLib.c | 75 ++++++++++------= ---- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemu= HardwareInfoLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib= /SbsaQemuHardwareInfoLib.inf index 58a9c03f18b8..dd920546b11a 100644 --- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwar= eInfoLib.inf +++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwar= eInfoLib.inf @@ -25,7 +25,7 @@ [Packages] Silicon/Qemu/SbsaQemu/SbsaQemu.dec =20 [LibraryClasses] - ArmSmcLib + ArmMonitorLib ResetSystemLib =20 [Pcd] diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemu= HardwareInfoLib.c b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/S= bsaQemuHardwareInfoLib.c index 1d5291cf5b28..cd9db02ba9fe 100644 --- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwar= eInfoLib.c +++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwar= eInfoLib.c @@ -7,7 +7,6 @@ * **/ =20 -#include #include #include #include @@ -24,18 +23,19 @@ GetCpuCount ( VOID ) { - UINTN Arg0; - UINTN SmcResult; + ARM_MONITOR_ARGS SmcArgs; =20 - SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_CPU_COUNT, &Arg0, NULL, NULL); - if (SmcResult !=3D SMC_SIP_CALL_SUCCESS) { + SmcArgs.Arg0 =3D SIP_SVC_GET_CPU_COUNT; + ArmMonitorCall (&SmcArgs); + + if (SmcArgs.Arg0 !=3D SMC_SIP_CALL_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_COUNT call failed. We have n= o cpu information.\n", __FUNCTION__)); ResetShutdown (); } =20 - DEBUG ((DEBUG_INFO, "%a: We have %d cpus.\n", __FUNCTION__, Arg0)); + DEBUG ((DEBUG_INFO, "%a: We have %d cpus.\n", __FUNCTION__, SmcArgs.Arg1= )); =20 - return Arg0; + return SmcArgs.Arg1; } =20 /** @@ -50,21 +50,20 @@ GetMpidr ( IN UINTN CpuId ) { - UINTN SmcResult; - UINTN Arg0; - UINTN Arg1; + ARM_MONITOR_ARGS SmcArgs; =20 - Arg0 =3D CpuId; + SmcArgs.Arg0 =3D SIP_SVC_GET_CPU_NODE; + SmcArgs.Arg1 =3D CpuId; + ArmMonitorCall (&SmcArgs); =20 - SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_CPU_NODE, &Arg0, &Arg1, NULL); - if (SmcResult !=3D SMC_SIP_CALL_SUCCESS) { + if (SmcArgs.Arg0 !=3D SMC_SIP_CALL_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_NODE call failed. We have no= MPIDR for CPU%d.\n", __FUNCTION__, CpuId)); ResetShutdown (); } =20 - DEBUG ((DEBUG_INFO, "%a: MPIDR for CPU%d: =3D %d\n", __FUNCTION__, CpuId= , Arg1)); + DEBUG ((DEBUG_INFO, "%a: MPIDR for CPU%d: =3D %d\n", __FUNCTION__, CpuId= , SmcArgs.Arg2)); =20 - return Arg1; + return SmcArgs.Arg2; } =20 /** @@ -79,21 +78,20 @@ GetCpuNumaNode ( IN UINTN CpuId ) { - UINTN SmcResult; - UINTN Arg0; - UINTN Arg1; + ARM_MONITOR_ARGS SmcArgs; =20 - Arg0 =3D CpuId; + SmcArgs.Arg0 =3D SIP_SVC_GET_CPU_NODE; + SmcArgs.Arg1 =3D CpuId; + ArmMonitorCall (&SmcArgs); =20 - SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_CPU_NODE, &Arg0, &Arg1, NULL); - if (SmcResult !=3D SMC_SIP_CALL_SUCCESS) { + if (SmcArgs.Arg0 !=3D SMC_SIP_CALL_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_NODE call failed. Could not = find information for CPU%d.\n", __FUNCTION__, CpuId)); return 0; } =20 - DEBUG ((DEBUG_INFO, "%a: NUMA node for CPU%d: =3D %d\n", __FUNCTION__, C= puId, Arg0)); + DEBUG ((DEBUG_INFO, "%a: NUMA node for CPU%d: =3D %d\n", __FUNCTION__, C= puId, SmcArgs.Arg1)); =20 - return Arg0; + return SmcArgs.Arg1; } =20 UINT32 @@ -101,17 +99,18 @@ GetMemNodeCount ( VOID ) { - UINTN SmcResult; - UINTN Arg0; + ARM_MONITOR_ARGS SmcArgs; =20 - SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_MEMORY_NODE_COUNT, &Arg0, NULL, N= ULL); - if (SmcResult !=3D SMC_SIP_CALL_SUCCESS) { + SmcArgs.Arg0 =3D SIP_SVC_GET_MEMORY_NODE_COUNT; + ArmMonitorCall (&SmcArgs); + + if (SmcArgs.Arg0 !=3D SMC_SIP_CALL_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_MEMORY_NODE_COUNT call failed. W= e have no memory information.\n", __FUNCTION__)); ResetShutdown (); } =20 - DEBUG ((DEBUG_INFO, "%a: The number of the memory nodes is %ld\n", __FUN= CTION__, Arg0)); - return (UINT32)Arg0; + DEBUG ((DEBUG_INFO, "%a: The number of the memory nodes is %ld\n", __FUN= CTION__, SmcArgs.Arg1)); + return (UINT32)SmcArgs.Arg1; } =20 VOID @@ -120,21 +119,19 @@ GetMemInfo ( OUT MemoryInfo *MemInfo ) { - UINTN SmcResult; - UINTN Arg0; - UINTN Arg1; - UINTN Arg2; + ARM_MONITOR_ARGS SmcArgs; =20 - Arg0 =3D MemoryId; + SmcArgs.Arg0 =3D SIP_SVC_GET_MEMORY_NODE; + SmcArgs.Arg1 =3D MemoryId; + ArmMonitorCall (&SmcArgs); =20 - SmcResult =3D ArmCallSmc1 (SIP_SVC_GET_MEMORY_NODE, &Arg0, &Arg1, &Arg2)= ; - if (SmcResult !=3D SMC_SIP_CALL_SUCCESS) { + if (SmcArgs.Arg0 !=3D SMC_SIP_CALL_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_MEMORY_NODE call failed. We have= no memory information.\n", __FUNCTION__)); ResetShutdown (); } else { - MemInfo->NodeId =3D Arg0; - MemInfo->AddressBase =3D Arg1; - MemInfo->AddressSize =3D Arg2; + MemInfo->NodeId =3D SmcArgs.Arg1; + MemInfo->AddressBase =3D SmcArgs.Arg2; + MemInfo->AddressSize =3D SmcArgs.Arg3; } =20 DEBUG (( --=20 2.45.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 (#120297): https://edk2.groups.io/g/devel/message/120297 Mute This Topic: https://groups.io/mt/107790447/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-