From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.20305.1683732119040248139 for ; Wed, 10 May 2023 08:21:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qbqqHGt+; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E783634D2 for ; Wed, 10 May 2023 15:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4A49C4339C for ; Wed, 10 May 2023 15:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683732117; bh=XkiRGmkD/3qRF9TwpZsBoNTUF6yVafWkL0PA3ggVSq0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qbqqHGt+N6NLtOQU1pUp8XcKPZfM7nPLgzBElYhx+vt8qBTqFG2tXT208zRKy8E/o jacykuQTek6uoW0MM9qC/XI4NnaX+sF8uBaINiGN/Ttj61YHJkY9/sxvU+ITWDQ1YX B+g/J/GXEYu5QRcHzBOhMVd6wkbM6+muc5ShiCQU4beoXD+iEQ3JUTIdQOG9zsNwNt 728WLW0jtyXol1OeJnmlsPyNoky8tXujj5rPdVunFFzC9gZy9I6hBI/KVyWZ0hjxM3 8L64BgVzLsFsfqoiCgWB73T3Yd2lZf3zOgMuUMeYfvf51k13MYmyfuawxRS97v2EAP DYRr/bogdgrug== Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-4f25d79f6bfso2152332e87.2 for ; Wed, 10 May 2023 08:21:57 -0700 (PDT) X-Gm-Message-State: AC+VfDwWFIgVjTL6UEoJlWgYSwREvmAstpM1fHMqeP8yzLqsLc10TtSl O0l/zK5TYifnA3GFN0vFVwZsHPEkqMDdYVhjTMo= X-Google-Smtp-Source: ACHHUZ73szEBElr5sJSq6LT7H/yX13XMiqygAHQiQwBLjimYWQ8KAMLHasvZ/N/biHKHN+y6ysKSCUquXiRwIL+NNIA= X-Received: by 2002:ac2:44cc:0:b0:4e8:3fca:4927 with SMTP id d12-20020ac244cc000000b004e83fca4927mr1826569lfm.58.1683732115924; Wed, 10 May 2023 08:21:55 -0700 (PDT) MIME-Version: 1.0 References: <20230510150832.193178-1-marcin.juszkiewicz@linaro.org> In-Reply-To: <20230510150832.193178-1-marcin.juszkiewicz@linaro.org> From: "Ard Biesheuvel" Date: Wed, 10 May 2023 17:21:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 1/1] Platform/SbsaQemu: read platform version To: devel@edk2.groups.io, marcin.juszkiewicz@linaro.org Cc: Ard Biesheuvel , Leif Lindholm , Rebecca Cran , Sami Mujawar Content-Type: text/plain; charset="UTF-8" HI Marcin, On Wed, 10 May 2023 at 17:08, Marcin Juszkiewicz wrote: > > Qemu has versioning for sbsa-ref platform. TF-A reads it from provided > DeviceTree and provides as SMC. > > This change adds reading platform version into EDK2. > > Signed-off-by: Marcin Juszkiewicz > --- > Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 3 +++ > .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 14 ++++++++++++++ > .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf | 5 +++++ > Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 3 +++ > 4 files changed, 25 insertions(+) > > diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > index c9b912cc1e9e..facca3b3e272 100644 > --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > @@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT0000" > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK0000" > > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0 > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0 > + > ################################################################################ > # > # Components Section - list of all EDK II Modules needed by this Platform > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > index b7270a07abbd..7a22f067b600 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > @@ -7,12 +7,14 @@ > * > **/ > > +#include > #include > #include > #include > #include > #include > #include > +#include > > #include > > @@ -26,6 +28,9 @@ InitializeSbsaQemuPlatformDxe ( > EFI_STATUS Status; > UINTN Size; > VOID* Base; > + UINTN Major; > + UINTN Minor; > + UINTN Result; > > DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNCTION__)); > > @@ -51,5 +56,14 @@ InitializeSbsaQemuPlatformDxe ( > return Status; > } > > + Result = ArmCallSmc0(SIP_FUNCTION_ID(1), &Major, &Minor, NULL); > + if (Result != 0xFFFFFF) > + { > + PcdSet32S (PcdPlatformVersionMajor, Major); > + PcdSet32S (PcdPlatformVersionMinor, Minor); Please don't ignore the return values of PcdSet32S like that - at least capture the return value and use ASSERT_EFI_ERROR() or log them using DEBUG() so we'll notice if this breaks. > + } > + > + DEBUG((DEBUG_ERROR, "Platform version: %d.%d\n", Major, Minor)); > + > return EFI_SUCCESS; > } > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > index 21d2135f6d17..1f2c8a9dd6af 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > @@ -20,6 +20,7 @@ > SbsaQemuPlatformDxe.c > > [Packages] > + ArmPkg/ArmPkg.dec > ArmVirtPkg/ArmVirtPkg.dec > EmbeddedPkg/EmbeddedPkg.dec > MdeModulePkg/MdeModulePkg.dec > @@ -27,6 +28,7 @@ > Silicon/Qemu/SbsaQemu/SbsaQemu.dec > > [LibraryClasses] > + ArmSmcLib > PcdLib > DebugLib > NonDiscoverableDeviceRegistrationLib > @@ -36,6 +38,9 @@ > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize > > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor > + > [Depex] > TRUE > > diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > index 8654cc7c858c..fb5903bfda0f 100644 > --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > @@ -70,3 +70,6 @@ > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x0000011B > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x0000011C > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x0000011D > + > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x0000011E > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x0000011F > -- > 2.40.1 > > > > ------------ > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#104572): https://edk2.groups.io/g/devel/message/104572 > Mute This Topic: https://groups.io/mt/98807889/1131722 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb@kernel.org] > ------------ > >